[Scummvm-git-logs] scummvm master -> b0be249473f6b46a170a6f409d08bb815fbd85fb
sev-
noreply at scummvm.org
Sun Dec 24 00:58:35 UTC 2023
This automated email contains information about 732 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
120b7acc34 M4: Skeleton engine
a876443129 M4: Added f_info.cpp
e4f520445e M4: Skeleton globals class
12483662d5 M4: Add param parsing
b65c26dabe M4: Added engine info display
7d1cf29ded M4: Add term.cpp
a7a47b7944 M4: Added SysFile and dependencies
c7040048db M4: Finished rget, SysFile methods
a4ffe08595 M4: Added font code
e9abc68861 M4: Added SysFile init/shutdown
1615019499 M4: Add missing imath methods
999a1f1df5 M4: Added player_been
e5bee1cbdf M4: Adding globals array
e1ef55a053 M4: Added gui system init/shutdown
40719565e7 M4: Adding gui systems init/shutdown
482343f473 M4: Adding mouse code
ddf419db58 M4: Added gui buffer init/shutdown
a7bdd99f06 M4: Moved initialization to Globals class
a183b57fc2 M4: Added WS load init/shutdown
8aca4045f6 M4: Adding wscript general init/shutdown
31f06d9635 M4: Added WS Cruncher init/shutdown
31bf3feda0 M4: Added WS Hal init/shutdown
b572cd9dfb M4: Added WS Kill machines
9e0cf325f7 M4: Remaining WS init
1556ce7321 M4: Added some palette code
729d23201a M4: Added rails code
e624797a4c M4: Added FileStream class
3378d03a98 M4: Added Player struct
22016991ec M4: Adding some cursor code
d2ae1c80ca M4: Added inv_init, InvPal, and cstring methods
f4c6eb9416 M4: Adding catalog methods
e1181801ba M4: More catalog methods
b2b418480c M4: Fix creating INvPal
c922847bfd M4: Changes to start in hag mode
34691b8399 M4: Fix reading hash file
cb94642b1b M4: read_catalog isn't used when hag mode is on
999bff0174 M4: Adding walker engine init
5210eec36a M4: Fix loading walker engines
3453b02c5e M4: Fix initializing pointer with bool
76a609b09a M4: Added font initialization
86e60f56c4 M4: Further font initialization
fee9c99b1e M4: Make BurgerGlobals class with overriden main_cold_data_init
43b4e0bdea M4: Implement full Kernel structure
67ca6013f2 M4: Adding burget specific cold startup code
6aa4b60032 M4: Some Burger initialization code, more VMNG methods
87ff33f5a9 M4: Fix Burger loading mouse cursors
47cbdafe70 M4: Added Burger's custom ascii converter
148199510a M4: Added further Burger startup
f55dd6f13d M4: Added further Burger setup and dependant code
e4fdbd9aa2 M4: Prototypes for gui_item.cpp
7f50ca35b8 M4: Statics for gui_item.cpp
366ccfc86b M4: Added gui_item.cpp methods
a6584a6677 M4: Adding gui_dialog.cpp and dependencies
7ba1e59e8b M4: Beginnings of interface.cpp
8d6e8a732c M4: Added gui_cheapo.cpp
1799e1c9a6 M4: Shift gui_cheapo.cpp into Burger namespace
e7bf3abfe1 M4: Cleanup of gui_cheapo
95d8e72e07 M4: Further gui_cheapo cleanup
4343a088de M4: Yet more gui_cheapo cleanup
77f50c5fe0 M4: Fix button state enum for ButtonClass
e5cde8dcc3 M4: Change ButtonClass _name to Common::String
22c32f9c49 M4: Set of Burger Interface setup
be681a7e95 M4: Initialize Burger interface elements
10ceea29e1 M4: Added Burger inventory list
3e14acef9d M4: Make Burger inventory a derived class from an InventoryBase base
4da51ee89b M4: Hook up engine inventory to Burger Inventory widget
d87cab7e16 M4: Stubbed initialize_game method
bf4e0b1c78 M4: Cleaning up adv_inv use of strings
43ce880515 M4: First global vars setup method
f4db866101 M4: Further global vars reset methods
12aed0e48b M4: Add remaining game initialize ending
29edd4fc7a M4: Beginnings of main game loop support methods
d6c9d98617 M4: Beginnings of hotkey handlers, support code
7f39b6a0a1 M4: Move gui_cheapo & interface into Burger::GUI namespace
86a5d004b2 M4: Skeleton Hotkeys class to hold all hotkey methods
b258c02dea M4: Beginnings of savegame code
922d8cccd1 M4: Compilation fixes from eriktorbjorn
046975bb9b M4: Move some files into subfolders
20ebb900ff M4: Globals need to be available in base class
51ee74786b M4: Change existingi Globals class to Vars class
6468e1231d M4: Make EGAcolors constexpr
8296cf026c M4: Fix GCC warnings about potentially undefined behavior
fc50e95070 M4: Add syncing of player_been
47ed56069e M4: Added conv data syncing
5f2fdf9bc8 M4: Added fall through comments to LoadWSAssets
7aa98e56ac M4: Added inventory list sync
c3ee5acc5c M4: Skeleton section/room classes
e5e3fd6f70 M4: Adding section preload code
3a4175a1b4 M4: Create a base Interface class
9364fffa74 M4: More scene/room startup
030e482ab8 M4: Added palette methods
b0103c8a9a M4: Added gui_buffer.cpp methods
c1de175098 M4: Added adv_hotspots.cpp
ad8bac3418 M4: Added adv_chk.cpp
3d11300609 M4: Added kernel_load_room and dependencies
37ba837557 M4: Added get_ipl method
d3b979cfb3 M4: Added gui_buffer_set_event_handler
a37500bc35 M4: Adding Interface methods
a88f14c688 M4: Merge interface.cpp into adv_interface.cpp
27795d8ffa M4: Implemented Interface::show, eventHandler stub
5c78649014 M4: Added track_hotspots_refresh
6389a7e32e M4: Added cancel_sentence
18ff62d9ef M4: Fix invalid cast of GrBuff * to Buffer *
c8090c4e99 M4: Added walker methods
cac6e2ba35 M4: Adding Burger room init code
13a1d6f9fd M4: Beginnings of series_player.cpp
413c544875 M4: Beginnings of digi.cpp
91879a0a7d M4: Room load digi switch
1582cdee3b M4: Added adv_trigger.cpp methods
90a2444439 M4: Comment out unused for now function
f9490f9b91 M4: Move Digi into M4 Vars, skeleton Midi class
fd4e2883b1 M4: Implementing lots of wscript and dependencies
18d3ac846e M4: More m4SceneLoad
fbd3606be2 M4: Added hotspot walk methods
1836a2c3c9 M4: Added game_control_cycle
c6f2e79718 M4: Added scaling methods
aceeb68f64 M4: More main inflight loop
d7107bbe02 M4: Extra globals initialization
06e3b47ab7 M4: Fix adv_been table size
66189df231 M4: Set kernel.going to enter inflight loop
965d8b85fd M4: Skeleton startup room class
2d1409620c M4: Beginnings of room 951 logic
96bd0dd735 M4: Adding stream break methods
f559baff06 M4: Added room 951 stream break arrays
6cbd2df9c5 M4: Added release trigger methods
5398627229 M4: More switch cases for rooim 951
5217968208 M4: Added adv_kill_digi_between_rooms
6ec55d332e M4: Remaining room 951 switch cases
3f1c6ebd86 M4: Added ws_timer.cpp methods
5a90163a80 M4: Move events folder into platform/
d63cfd525c M4: Events handler
0ef3a4a2b4 M4: Properly implement timers
876252582b M4: Merging of event handling
473dd86699 M4: Added keyboard code
3b9228219a M4: Process pending events when doing keyboard check
a80362a793 M4: Explicitly process pending events first in gui_system_event_handler
076b7a2c92 M4: Fix separation of global_room_init and room specific init() methods
68dd812327 M4: Remainder of global_room_init
4c02884c8d M4: Added Section9::daemon_code
9ce3677c22 M4: Adding changes for krn_pal_game_task
47dd0055e7 M4: Added update_mouse_pos_dialog
64636c34c6 M4: Added bunch of conv code
d997c09c8a M4: Cleanup of section/room daemon calls
df6c3063fc M4: Minor cleanups
e5d8eac62f M4: Adding Digi methods implementation
0029933fff M4: Digi fixes, sound now playing
78330f24fb M4: Fix closing down ScummVM
7182698091 M4: Palette fixes
43f4d5c92e M4: Fixes to vmng_refresh_video
01a855d40c M4: Fix palette range passed to kernel_load_room
6f0566b471 M4: Comments cleanup
5714c3fb36 M4: Added trigger dispatch when digi sounds finish playing
3eefd904f4 M4: Stream break methods cleanup and fixes
e45e9b9f14 M4: Move the GlobalVars class to be in Burger namespace
78104eea81 M4: Rename Burger GlobalVars to Flags
6efb03ade9 M4: Fix casting pointers to numbers
6443afd1ac M4: Setting up Globals to handle both numbers and pointers
c5777ab224 M4: Formatting fixes
f8d0c88756 M4: Fix various pointer casts to ints
5cb61c4e22 M4: Simplify regs array access in ExtractArg
57860d338f M4: Simplify globals array holding pointers, gr_series.cpp sysfile pointer
8d1ba27c22 M4: Added cutscene renderer code
b68d672e6a M4: In progress implementing ws_DoDisplay/DrawSprite changes
677580823f M4: Added gr_spite.cpp and skeleton RLE methods
78b9e66464 M4: Implemented RLE8Decode
290ed72dca M4: Added SkipRLE_Lines
f681162f16 M4: Remove RLE compression code
fec5b947fa M4: Added RLE8Decode_Size
9e6d8e8617 M4: Formatting in gr_sprite_draw
e7104738bd M4: Casing fixes and calling RLE8Decod_Size
cdb820f10a M4: Change drawSprite to gr_sprite_draw
3cbf54e146 M4: Properly implement ws_DoDisplay
41e8a945fd M4: Fix screenCodes type in CycleEngines/ws_DoDisplay
f704a7ff74 M4: Temporarily skip title music whilst sprite drawing is being added
d934ebe321 M4: ws_DoDisplay loop fix
a0a6f3a542 M4: Fixes to RLE decoding
b90f72633f M4: Added RLE_Draw
22bb199dca M4: Fix sprite positioning. First cutscene now rendering
c47f9dc3b7 M4: Minor cleanups and pointer casting
bab244b449 M4: Fix shutdown crash
d2003296a5 M4: Updates for cutscene sound code to be called
521df4594c M4: Implement changes for kernel_timing_trigger
d32e6b19de M4: Fix for timer callback dispatch
cce9e26643 M4: Use intptr instead of intptr_t, like most our engines do
ddbe4a5fda M4: Silence format string warnings
5da5efe95f M4: Fix GCC invalid preprocessor token error
e5209489bb M4: Remove "constexpr" for now to placate GCC
6f29c6da68 M4: Fix GCC compile errors
994cd1b2a2 M4: Digi improvements to properly unload sounds
86a0681078 M4: Revert startup of startup room to show title screen
9b26c90b90 M4: Beginnings of main menu room 903
1a911d5d38 M4: Added series_show_
1ff0225ac0 M4: Further framework for room 903
54be33c935 M4: Skeleton room 901
7d537e1b33 M4: Implemented room 901
f8c1cd0186 M4: Fix some pointer arithmatic
fbbfeb6e9a M4: Add missing room 901 code
9bc5b4e9d7 M4: Fix compile error with Buffer initialization
903233aa4c M4: Added menu button frame tick handler
db720319e9 M4: Remove duplicate ws_LogErrorMsg
9f9c10cece M4: Buffer initialization error fix
e9d918c773 M4: Cleanups of mouse init / sprites
417410370c M4: Mouse cursor is now rendering
a7d940bbf5 M4: Added room 903 content
1e507e49ac M4: Added room 902, skeletons for other remaining section 9 rooms
e56a67edde M4: Beginnings of room 904 credits screen
a0487d1ca0 M4: Furhter implementing room 904
2bd43580a5 M4: Remainder of room 904
c8eb5f9077 M4: Fix rendering room 904 credits sections
514d49c9ae M4: Fix rendering credits section contents
b326aa72ae M4: Fix menu initialized flag check in room 903
795bb4fb18 M4: Experimental combined sprite drawing code
e16072ecbe M4: Fixes, cleanup for menu item display
11818ddd9b M4: Populate ButtonState when pressing moues buttons
2dcf33c244 M4: Adding game menu code
3b99cf9672 M4: Implement adv_background support methods
89bdb1285a M4: Adding room 101 code
e376dd8ccb M4: Adding more room 101, wilbur methods
59335025b8 M4: More of room 101 daemon
deb7c73fc4 M4: More room 101 daemon, walker sprites loading
af319c41c7 M4: Added play break code
7295efc650 M4: Remainder of room 101 daemon
9eb354b475 M4: Merge wilbur.cpp methods into Walker class
39a9cab73f M4: Remove duplicated gameInterfaceBuff global
cb4c666672 M4: Added walker callback method, Digi playRandom
afe1da8cfe M4: playRandom should only choose from explicitly preloaded sounds
4b69814cbb M4: Fix shutdown crash
c96b277552 M4: Implementing interface event handler
c32970bf39 M4: Fixes for drawing interface sprites
fa12ee0c4b M4: Add missing inventory drawing
f62e2be8af M4: Fix placement of inventory items
ded1852f15 M4: Added Interface::trackIcons
2c9219f0d4 M4: Added Interface::track
0149d67a0e M4: Clarify several interface methods and variables
c0530a02cc M4: Interface dispatch_command
ae83dda0f7 M4: Fixes for clicking interface buttons
9e96f96e26 M4: Implementing basic action hotkey callbacks
77a03d4c3d M4: Fix duplicated interface visible flag
76ab81eb3a M4: Added global abduct trigger code
910ed54795 M4: More abduction code
1db6150783 M4: Implement kernel_save_game
78928beca8 M4: Implement grey/green fading
a59757e163 M4: Merge duplicated myWalker into my_walker
99c5f637b1 M4: Outer parser method
76af814554 M4: Added wilbur_said
dc41c7ee02 M4: Added room 101 parser
35eae178c6 M4: Added global parser code
89e262de83 M4: Added wilbur_parser
db6680173a M4: Fixes for look actions
94fdf06b80 M4: Fix colors of interface tooltip
7b8d433f04 M4: Added section 1 daemon
65e6461a97 M4: Fix depth code drawing
361efc1cda M4: In progress global daemon
f0cd494623 M4: Remainder of global_daemon
1e559f1bf0 M4: Fixes to opening barbershop door
d1b26bfa99 M4: Hooked up console and added room command
82f8a10263 M4: Fixed some GCC errors and warnings
d503f712ed M4: Fixes closing game menu
988b2db33a M4: Fix quitting game via game menu
11d155d7ba M4: Change %ld in string formats to %d
d5153451e3 M4: Fix missing virtual destructors
64f49143c2 M4: Fix poitner check
9d6400e40c M4: Fix a bunch of pointer arithmatic
bd0b5c1523 M4: Replace all kernel_trigger_dispatch with kernel_trigger_dispatchx
849df58870 M4: Fix climbing ladder
44985bb657 M4: Added skeleton classes for section 1 rooms
4b010aaf89 M4: Beginnings of room 102
91cab0ad19 M4: In progress room 102 daemon
db15d2a225 M4: Finished room 102 daemon case 3
4c8b840696 M4: Remove underscore suffix from several series methods
86f2a8cda1 M4: Finished room 102 daemon
c526ce5be4 M4: Room 102 daemon fixes, added pre_parser
6b4a6e7be1 M4: In progress room 102 parser
6dec7c9885 M4: Finished room 102 parse
295bc491bf M4: Room skeletons for section 8
0c66894302 M4: Implemented digi_ticks_to_play
e14b28a48d M4: Room 102 startup fixes
452aa1aba1 M4: Further room 102 startup fixes
4ba5d36859 M4: Implementing room 104
febfb12860 M4: Finished room 104
555c0fcadd M4: Remove unused gr series declarations
1896b90187 M4: Room 135 init/parser
13b0b633f1 M4: In progress room 135 daemon
b7cb8e8b2c M4: Remainder of room 135 daemon
3dac49f048 M4: Adding room 135 conv methods
9610461e39 M4: Remaining room 135 conv methods
60ffdccbbc M4: Fix refreshing user interface between rooms
506b33fccc M4: Beginnings of room 142
dab0688744 M4: Room 142 preparser
7998e5c9f3 M4: Room 142 parser, wilbur_match method
cca7efca84 M4: Implementing room 142 daemon
ee2d4808aa M4: More room 142 daemon
80d5041914 M4: Remainder of room 142 daemon
9f2fca7c32 M4: Fix room 142 crash
d0df59a726 M4: Make mouse pointer a bit more responsive
4209036235 M4: Fix picking up fanbelt in room 142
f0c847dbe7 M4: Fix highlighting inventory items
d75a347488 M4: Fix green highlight box for inventory items
e452ffd9f7 M4: Fix using inventory items in scene
b2b85becac M4: Further fixes for using items
ad0d02ac7e M4: Adding room 106 methods
c98fc8aeab M4: Starting room 106 daemon
5667ab5fb6 M4: Room 106 daemon
45a08c2577 M4: Added flag command to console
b749980989 M4: Implementing room 103 methods
7bf08dc64b M4: Added room 103 daemon
caec8484c0 M4: Change lots of methods to be camelcase
95b0bdffa2 M4: Adding room 105 methods
e08ed8d384 M4: More room 105 methods
e03a38712b M4: In progress room 105 daemon
53a95d54a8 M4: More of room 105 daemon
3591d1c77a M4: Finished room 105 daemon
ae4452ba4f M4: Consistent handling of a few sourceOffsets
e7eb97aca3 M4: Fix another GCC compile error
71eb0c4276 M4: Clarify a bunch of byte * as being intptr
3e24d2c8d2 M4: Fixing casts to intptr
c2c254c0f6 M4: Fix a bunch of compiler warnings
cd78359c24 M4: Fix further compiler warnings
ceb2647cb6 M4: Remaining methods of room 105
bc1c52836b M4: Added item console command
2cb8cbd203 M4: Fix leaving room 105
b385e848de M4: Remove default initializers to fix GCC build
18012c3ace M4: Guard against empty file open creating InvPal
6da6406ed5 M4: Suppress warning for empty InvPal
8a2feea23b M4: Fix uninitialized read in db_rmlst_get_asset_room_path
9e7deb4618 M4: Added room 120
29df2e5194 M4: Adding room 133/136 methods
95c8899485 M4: Added room 133 daemon
36330fe43a M4: Explicitly initialize entire mem stash arrays
babaaa8acc M4: Adding room 137 methods
a5986df3c9 M4: Further array initialization fixes
03ab6c2298 M4: in progress room 137 daemon
9cae40deb0 M4: Finished room 137 daemon
4cf0158a3a M4: Disable type size match check in mem_register_stash_type
999b44d9fe M4: walker_in_scene should be set in rooms' preload method
cbc7a8a6b0 M4: Adding room 138 methods
0c8d89e783 M4: Added room 138 daemon
ab55bf8199 M4: Fix crash on room 138 startup
6370b277d2 M4: Explicitly zero out allocated memory
222904287d M4: Fix incorrect strng field allocation
0cc99478e4 M4: Fix disappearing Wilbur in room 138
4b9b37111d M4: Fix getting keys in room 138
c5bd72b81a M4: Adding room 141 methods
61dd9e3a1a M4: series stream/play arrays for room 141
6544618ccb M4: Added room 141 daemon
7a73cf0cb5 M4: Remaining conv code for room 141
35435e68f7 M4: Adding room 144 methods
fc37ba4531 M4: Added room 144 daemon
5735adf163 M4: Room 144 is also mapped to room 139
dbae78c0d8 M4: Adding room 170 methods
b8e7f9f756 M4: Added room 170 daemon
7796bf4907 M4: Added room 171 init
3e843f6526 M4: Simplifying static arrays
aa98975976 M4: Adding room 171 methods
e74fbdc420 M4: In progress room 171 daemon
95ceee7e9b M4: Remainder of room 171 daemon
2a2902557c M4: Added chunkops methods
1d73320fb8 M4: Adding conv save/restore state
179154b11a M4: More conversation code added
270e5970c5 M4: Fix random speech in room 141
3be76481c8 M4: Fix crash exiting ScummVM whilst conversation is active
41850d49a2 M4: Beginnings of room 801 daemon
003d6ca0b3 M4: Remainder of room 801 daemon
6a80430628 M4: Beginnings of room 802 daemon
abb60a4199 M4: Finished room 802 daemon
477b98c3c7 M4: Added skeleton room classes for section 7
b91569722e M4: Static arrays for section 7 rooms
365a103b6e M4: Added room 701 methods
6d008fb1d3 M4: In progress room 702 daemon
c89b29438b M4: Added room 702 daemon
1b88e507f9 M4: Added room 706 methods
a01266dea7 M4: Skeleton room classes for section 6
42a3afe30e M4: Added room 601
bce013770d M4: Use Common:: for strcpy_s() and strcat_s()
70c4c63763 M4: Init for room 602/612
c72406dfbc M4: Beginnings of custom sections-wide room logic
24d53d6137 M4: Added Gerbils hotspot setup
30b78b44ad M4: Added walker_spotter
34f344d1ff M4: In progress section 6 custom_hotspot_which
f6ff6437a5 M4: Finished section 6 custom_hotspot_which
d8434c0e06 M4: Clarify the Section pre_parser calls
def763df2d M4: Change walker_spotter to be a base room custom_hotspot_which
c402a492b6 M4: Added section 6 parser
ce448cbf5b M4: Section 6 daemon
63337f7be3 M4: Properly implement room 602's gerbil point table
cc5c400500 M4: Room 602 methods
ad9b132abf M4: Play/series arrays for room 602
e6f9a45c7f M4: In progress room 602 daemon
df258b669e M4: Move SERIES4 in room 141 back to a static array
5ae90e3e08 M4: Put an assert guard on facing array accesses
6aec9ee6f3 M4: Fix some gcc warnings
232ccb6448 M4: Remainder of room 602 daemon
720469f7b0 M4: Room 603 arrays and init
274682a9d5 M4: Adding methods for room 603
33f00324be M4: Added room 603 daemon
9a8c59e4c8 M4: Added room 605
10df93ab80 M4: Adding room 604 methods
6224e061ac M4: Adding room 604 parser and arrays
410093543d M4: Added room 604 daemon
b033e117f8 M4: Added remaining rooms of section 6
f6d478c6fc M4: Skeleton rooms for section 5
bf2325bd9a M4: Adding section 5 custom hotspot code
d354d78f80 M4: Added room 501
67c76f5dd6 M4: Start implementing section 5 gizmo
16979a4c08 M4: Beginning of gui_gizmo module
93d3dda712 M4: Gizmo loading sprites
3590d782e8 M4: Beginnings of Gizmo gui creation
2a82eef94a M4: Room 502 init and setup methods
914965c6b3 M4: Added room 502 preparser/parser
77ce392c9e M4: Added room 502 arrays
d0592ab925 M4: Section 5 rooms static arrays
8d7bd01fc1 M4: In progress room 502 daemon
557c77b2c6 M4: Finished room 502 daemon
7d6330a864 M4: Added room 503 init
527db0bd5d M4: Room 503 pre-parser
9f316f2a28 M4: Added room 503 parser
9e001a3eec M4: Added room 503 daemon
c36c3d1274 M4: Adding room 504 methods
11554f5e77 M4: Room 504 daemon
aaea20603c M4: Implemented room 505
c4008fb1d5 M4: Adding room 506 methods
03ee36e5d0 M4: Room 506 daemon
c12279394a M4: Adding room 507 methods
c486405a7f M4: Added room 507 daemon
cb8cfdffd2 M4: Added room 508
70b78ca4b7 M4: Added room 511
ffa501f746 M4: Adding room 509 methods
f36d6f55d9 M4: Added room 509 daemon
aa045841e0 M4: Adding room 510 methods
925b83fc08 M4: Added room 510 daemon
06079874b1 M4: Added room 512
0000635c3e M4: Added room 513
ef575b28af M4: Added room 204
3c3b2e0bc8 M4: Adding room 207 methods
3e02e370b9 M4: Added room 207 daemon
158f340d00 M4: Added section 2 daemon
88fae69c98 M4: Skeleton room classes for section 3 and 4
20d3665d16 M4: Adding room 172 methods
ebf36f6b42 M4: Arrays for remaining section 1 rooms
699f1f526a M4: Static arrays for section 3 rooms
b2e5cc1b5b M4: Static arrays for section 4
3ad7a5f348 M4: Further section 4 static arrays
9bb72fa253 M4: Remainder of room 172
2f8d047e84 M4: Added room 173
7feb015f87 M4: Added room 174
e923ac4295 M4: Added room 175 and 176
76ec468320 M4: Remaining global_daemon code/methods
aaeff9505e M4: Added Section3Room base class
8548e85c03 M4: Added room 301
dac18f6099 M4: Adding room 302 methods
261f8003c9 M4: Finished room 302
b4b84c43da M4: Adding room 303 methods
66619a3987 M4: Remainder of room 303
45b9d5eff5 M4: Added set_palette_brightness to Section3Room
b20661bff4 M4: Added room 304
220ff5993a M4: Init for room 305
877c1becb9 M4: RIDDLE: Skeleton engine
6ada1733a8 M4: RIDDLE: Skeleton room classes for section 9
e32869893e M4: RIDDLE: Added more initialization
df55d6d69e M4: Beginnings of MineRoom base class
6509f6aed1 M4: Added room 305
fcbdd6f847 M4: Merge MineRoom and Mine classes
0dd7df46ce M4: Adding Mine parser methods and support
f571158e6d M4: Mine daemon entrance info
a92a50ada3 M4: More of mine daemon
5f372e62c1 M4: Added remainder of mine daemon
fc7d39787c M4: Added section 3 methods
f9b2bc7f11 M4: Added room 306
d43881f8a0 M4: Added room 307
c09c674f2a M4: Added room 310
431de407e4 M4: Added room 401
47b3e21317 M4: Adding room 402 methods
9e91b88340 M4: RIDDLE: Added placeholder Walker class
b1a90c95e6 M4: RIDDLE: Fix accessing HAS file
1121536d6a M4: RIDDLE: Added Hotkeys instance
a66adde6fa M4: RIDDLE: Properly hooked up placeholder section 9
6720a21f1c M4: RIDDLE: First title room showing
09a5857f9e M4: Added room 402 conv84
8c443148b7 M4: Added room 402 daemon
e913e4b434 M4: Added room 404
0180bcdb3f M4: Adding room 405 methods
cb6b63647a M4: Added room 405 conv methods
28044c6acb M4: Added room 405 daemon
55e68260e9 M4: RIDDLE: Added room 901
099085e7bd M4: Room 406 init and dependent methods
c6642c2268 M4: Added room 406 parser
381926963d M4: Added room 406 daemon
2d187f3f6a M4: Adding room 407 methods
24660792ef M4: Merge InitMouseSeries
fb82baa158 M4: RIDDLE: Added missing room 901 code
67b470c6b5 M4: RIDDLE: Created base class for section 9 rooms
3700a8a2c8 M4: Fix typo
5da14abe39 M4: Fix compilation
6883519bf9 M4: Added more room 407 support methods
bf65c714cc M4: Added room 407 daemon
fc5aefaa61 M4: Added room 971
9895b55fcb M4: Add missing line from room 801 daemon
fc1e0e7d83 M4: Added section 4 class methods
721c33b24d M4: Added skeletons for two missing section 1 rooms
fe12011c89 M4: Added static arrays for newly added rooms
1a9dfe846b M4: Adding room 143 methods
b9bc4b9e58 M4: In progress room 143 daemon
024915a837 M4: Remainder of room 143 daemon
0bc20e2304 M4: Fix incorrect reference to Series static method
5b6eb2e4d8 M4: Adding room 145 methods
f0a69ca46e M4: Room 145 support methods
b52f30bfcc M4: Added room 145 daemon
8a375b2dbe M4: Added missing room 141 method
6159d3648d M4: Added room 102 conv methods
6dfd674efc M4: Added section 5 daemon
b35af25ac5 M4: Beginnings of section 5 gizmo gui
b1168889ec M4: Adding more gizmo functions
96854b2e71 M4: Adding gizmo digi play
ad7ad11d88 M4: Gizmo digi daemons
2630633d1f M4: Added gizmo_anim
a1a46c1189 M4: Fix startup crash
c674ef6254 M4: Fix setting _borkTable in room 502
e705cf3d71 M4: Fix crash on qutting within section 5 rooms
52d0f19534 M4: In room 510, the 4th button only has two random digis
41ecc0c9a1 M4: Fix incorrect rect calculation in gizmo setup
e3c06a61b4 M4: Added gizmo item draw
7a8ac084d4 M4: Remove unused platform/sound.cpp
ae41287b2c M4: Fixes for loading savegames
df7f82a11e M4: Fix room 502 init on savegame load
c4a9ab3eb4 M4: Fixes to gizmo_draw method
155306b6b5 M4: Added gizmo event handler
e25c4e3e06 M4: Added gizmo free code
a01c1ee723 M4: In progress gizmo item event handler
a2a63dc36a M4: Add remaining gizmo select code
2704b02e4c M4: Fix crash pressing key when gizmo is active
4b658ccfe3 M4: Clarify gizmo room flags, event handling fix
86ea0b72ab M4: Fix placement of gizmo content
ba4f311950 M4: Fix pressing multiple gizmo buttons
ea9f27a119 M4: Remove no longer relevant TODOs
2d9d250e69 M4: Fix unknown depth/scale references
67f66d767f M4: RIDDLE: Fix clash of Room classes
6d5427c93a M4: Implemented wilbur_poof
e2b6d6f083 M4: Remove deprecated code
2a96a63e8e M4: Handle original save files outer file structure
080019ccec M4: roomVal2 is player.walker_visible
6f4301c8f0 M4: visited_room is player.been_here_before
ff2f33d306 M4: Changed walkTrigger to player_info.trigger
5f1d4f11b5 M4: player_info trigger is really facing
30811806ad M4: In progress making savegame data match original
e1d5325a00 M4: game structure save differences for Riddle
f1c70d7678 M4: RIDDLE: Savegame fix for game/kernel structure
b5c9983f4b M4: Cleanup and script fixes for room 104
8e5f7c7cf1 M4: Fix incorrect rendering of backwards rendered sprites
98f791ef86 M4: Script fixes for room 102
748bc38c6c M4: Fix sprite drawing with depth codes
4fc5ad3873 M4: Reset startup room back to title screen
a20e922602 M4: RIDDLE: Added room 902 daemon
317f6976a7 M4: Increased time rate to empirically match original
93e1362ba3 M4: Set default position for player to be off-screen
77c3a7c584 M4: Fix resuming game from main menu
e196872c38 M4: Implement InitializeSlotTables
4a59005825 M4: game_menu.cpp formatting
09f92a5bd0 M4: Remove the shorthand pal_fade_init method
56a1b475fa M4: Revert timer increase
fda93e5847 M4: Room 801 fixes
15fcafbd91 M4: CLeanups and formatting for gui_dialog.cpp
5a1bfc7b6c M4: Rename global triggers to have k prefix
86f547b330 M4: Remove duplicated global statics
8445ccf4f5 M4: cleanups of conv.cpp
1f480cef00 M4: Fixed series_play loopCount default to be 0
a90364d8df M4: Minor room 801 fixes
fa036363f2 M4: Fix formatting of tabs in local variables
bbbd36c2a3 M4: Remove old date based comments
88fb6e7a23 M4: Change NULL to nullptr
87857ecf21 M4: Fix conv_current_entry
c48c2abb18 M4: Intro getting as far as first test execution
c93a0881fe M4: Fixes for failing first test
cd44efcc23 M4: Room 802 fixes
3e74fa989d M4: Clarify Flumix's name and should variable
527c54e397 M4: Renamed getRoomVal method as getFlumixShould
13e4b8f132 M4: Further room 802 fixes
861575ed23 M4: Reset startup room to title screen
566d145fe8 M4: Simple string array class
28a88afd76 M4: Properly free sound resources in digi_unload
d8943dc1de M4: RIDDLE: Skeleton classes for all game rooms
1dc69762c5 M4: Added hyperwalk hotkey
c171921ef9 M4: Add console command to automatically hyperwalk
e5570a09fd M4: Some room 102 cleanups
5f4e0a6ecf M4: Barbershop fixes
bfee383ebd M4: Fixes for Aunt Polly's Living Room
249cb5f988 M4: Remove deprecated sprite drawing code
6a528f267d M4: Experimental shadow rendering
015f392491 M4: Add extra guard for ICT being set for shadowed drawing
7f1abfa038 M4: Barbershop fixes
2ff2c34965 M4: Fixes for Aunt Polly's house
a541900c8e M4: Only say Home Sweet Home the first time
d1d2d3a0b1 M4: Keep the player_info up to date, in case saving done via GMM
61ebfb2013 M4: Remove duplicate RESTORING_GAME constant
19238b81f6 M4: Fixes for Vera's Diner
9f75e3217d M4: Fix global parser list handling
8aed7e84af M4: Old Bridge fixes
f88fad64ef M4: More Old Bridge fixes
8f79736aa3 M4: Fixes getting haircut
8c853303c1 M4: Fix getting ice from ice box
1e9d31e121 M4: Cleanup and fixes for abduction
3683306a6b M4: Fix crash during first test
776db75997 M4: Cleanup and fixes for Astral cutscene
3322e43b39 M4: Fix doing actions in gerbil cage
b8fd9705bd M4: Fix boingy boigny in test 2
1fce62dc53 M4: Gerbil wakeup fixes
a8ce3904e0 M4: Cleanup of flags used in time loop restarts
a41a432ca0 M4: Fix destroyed gerbil wreckage display
1b54a7e2a4 M4: Fix grasshoppers disappearing
d91e21dccb M4: Fixes for motor and opening gerbil cage door
a1256198d7 M4: Fix various compilation warnings
07e04bf830 M4: More compiler warning fixes
274151c233 M4: Cleanup of conv structures
da518ab7e5 M4: Further changes of long to int32
ab7dcb8eae M4: Fix incorrect failed to fseek messages
9e6aa1320c M4: Fix incorrect starting frame index for animations
f4cf30eea6 M4: Valgrind mem fixes
7627334188 M4: Change tt reading parameters from long to int32
a9699c4320 M4: Fix memory overrun in buffer rect copy
252eed30a2 M4: Properly free inventory on shutdown
f0a608b5f4 M4: Ignore copying empty rects to screen
68bc80d576 M4: Fix mismatched malloc/free
67210b01a1 M4: Fixed memory overrun on palette backups
ced447378c M4: Fixes for failing test 3 and loop reset
f1829d16e2 M4: Fix width/height calc for copying rects to screen
3a301add0a M4: Fix moving sign
16f032b5e7 M4: Fixes for buying island deed
21e2232fc7 M4: Clarify Burl flags
62798f2947 M4: Fixes for Boonsville event tracking
4124a957a6 M4: Boonsville event fixes, truck crash cutscene
b94100e390 M4: Fix speaking to Aunt Polly
727f5f3217 M4: Fixes and cleanups for room 172
08891640f0 M4: Make term_message display on debug level 1
27176a7abe M4: Fixes for room 172
9a365ccffc M4: Cleanup of room 139 burl
3fec936cc4 M4: Fix random action in room 139/144
0e86e4542d M4: Cleanup Truffles daemon code in room 141
be5866be22 M4: Cleanup of Elmo daemon code in room 141
e6399a2844 M4: Cleanup of Wilbur daemon code in room 141
eac8fd892d M4: Add missing conv_resume_curr calls in room 141
2544b08e7d M4: Fix for Elmo deed conversation
371c881d53 M4: Finally solve the abyssal performance once and for all
9a48a137da M4: Further removal of redundant updateScreen calls
3625b66109 M4: Fix going to shack backyard
a62f24cc92 M4: Fix picking up moonshine jug
60636a5f72 M4: Fixes for distilling carrot juice
821e4b2140 M4: Fix clearing long inventory item names
db2f883b7a M4: Cellar fixes
04991494dc M4: Fix entering mine from cellar
82231ce3e6 M4: Fix movement through mine
111013aaef M4: Fixes for Truffles animations
4b0c945abe M4: Test 3 is now completeable
7b2311e2e6 M4: Fix getting laxative
b42165a224 M4: Fixes for band arriving
2443aa0716 M4: Cleanup of room 145 daemon
c726373a49 M4: Further room 145 daemon cleanup
77058f3a5a M4: Fixes for talking to band members
163233d620 M4: Fix getting amplifier
dc2a304526 M4: Fix climbing stairs in test 4, stairs bork enum
3ffb132795 M4: Room change fixes for Aunt Polly's house
2cd2071ecc M4: Fix entering bathroom
c04545484e M4: Fixes for stairs bork
4fcf23ed06 M4: Fix destroying stairs bork
2a581e87c3 M4: Fix getting dirty sock
cc10f51de2 M4: Minor inventory scrolling fix
4536a983bc M4: Test 4 is now completable
07792876a6 M4: Fix room poofing in test 5
3a84f7df68 M4: Fixes for talking to Stolie
337aab572e M4: Talking to Elmo fix
bdd0a8ec82 M4: Cleanup of Stolie/Elmo code in room 402
6d69093943 M4: Further Stolie talk fix
f2d397788c M4: Yet more Stolie talk fixes
0743bab06f M4: Fix getting Jawz O' Life
a11ab1a84e M4: Cleanup of police in room 137
0c3099a721 M4: Police fix in room 137
ef51a6a071 M4: Fixes for freeing mayor
927579d234 M4: Cleanup of npc constants in room 407
0d531f63a4 M4: Test 5 now completable
acbfbe7a0c M4: Fix talking to Flumix in room 702
06554f0f80 M4: Endgame fixes
e9bb9c543c M4: Added savegame version number
42f248388d M4: Fixing hotkeys matching, in progress version dialog
433d757f3b M4: Fix cutscene of Burl arriving at diner
e47891b0d7 M4: Fix type of returned current color
a0b7a5d61d M4: Fix display of version dialog
587986be7d M4: Add debug player movement hotkeys
aea678d19d M4: Add camera shift debug hotkeys
6ef405e708 M4: Only encode Ctrl and Alt in key events
2ce38209de M4: Added original debug teleport dialog
59a4a0fb12 M4: Added debug walk codes
bbd4e19b00 M4: Added scale editor toggle mapped to Alt+E
3777e442b1 M4: Fix engine noise when truck leaves Vera's
89a0f7df9c M4: Remove duplicate hotkey cheat stuff
492276ccc5 M4: Added mouse pos dialog toggle
03e27b5fff M4: Added global variable change dialog
cb1ce6c0e0 M4: Adding change global variable dialog
2af44be038 M4: Fixes to change global dialog
ce59fc7a42 M4: Cleanup of npc code in room 143
244f1d5201 M4: Fix talking to Burl at Vera's Diner
b50aa37d96 M4: Cleanup and fixes for room 106
de85af4df1 M4: Cleanup for being thrown in jail
5cddf05141 M4: Fix getting arrested for stealing police keys
5fa0e32e42 M4: Setup character enums for room 138
8077f17de8 M4: Fix bits of cursor remaining on screen
d2369f0094 M4: Cleanup and fixes for Stolie in room 104
92e40639db M4: Added enum for Elgus in room 105
cfd2853761 M4: Further cleanup of Elgus in room 105
e45379bca5 M4: Fixes for mayor and complaints conversations in room 105
6757fbf39b M4: Room 141 is also mapped to room 140
35bc3d1d52 M4: Hook up the ScummVM save/load dialogs
e6c7f5e626 M4: Beginnings of adv_r folder cleanup
09bdaed772 M4: Further adv_r cleanup
e68535af9c M4: Cleanup of core/ folder
fc3cdc2ff5 M4: Fix/cleanup for truck crash viewed from Old Bridge
684a8f1c6c M4: Cleanup of graphics/ folder
52f365a2dc M4: Cleanup of gui/ folder
496ae8674d M4: Cleanup of wscript/ folder
0419b95287 M4: Resolving outstanding TODOs
08be769502 M4: Remove deprecated stubs for various draw styles
6ebbf46718 JANITORIAL: Fix code formatting
8e1b2130a9 JANITORIAL: Fix code formatting
9bd8c66c74 M4: Fix pointer to int cast
50e569b5e0 M4: Fix constant for Burl entering town in room 101
3d12a3709c M4: Fix Burl crash cutscene when at Hanlon's Point
6022404a3a M4: Fix talking to Burl at Hanlon's Point
55dceb7a7b M4: Added trigger debugger command
7936194f4b M4: Added npc enum for room 103
6ef646081b M4: Add support for mouse wheel to change cursors
3a42fb0cdd M4: Added kBurlEntersTown enum to room 137
b3170f30b1 M4: Fix waking up police with horn
261f55ab3b M4: Fix sherrif animation after taking keys
6e3d7caf32 M4: Hook ScummVM save/load to in-game options dialog
b0be249473 M4: Remap the options button to the ScummVM GMM
Commit: 120b7acc3406935e0866d55a662ba9f36582b262
https://github.com/scummvm/scummvm/commit/120b7acc3406935e0866d55a662ba9f36582b262
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton engine
Changed paths:
A engines/m4/POTFILES
A engines/m4/configure.engine
A engines/m4/console.cpp
A engines/m4/console.h
A engines/m4/credits.pl
A engines/m4/detection.cpp
A engines/m4/detection.h
A engines/m4/detection_tables.h
A engines/m4/m4.cpp
A engines/m4/m4.h
A engines/m4/metaengine.cpp
A engines/m4/metaengine.h
A engines/m4/module.mk
diff --git a/engines/m4/POTFILES b/engines/m4/POTFILES
new file mode 100644
index 00000000000..118a42451b2
--- /dev/null
+++ b/engines/m4/POTFILES
@@ -0,0 +1 @@
+engines/m4/metaengine.cpp
diff --git a/engines/m4/configure.engine b/engines/m4/configure.engine
new file mode 100644
index 00000000000..23b8b775dad
--- /dev/null
+++ b/engines/m4/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 m4 "M4" no "" "" ""
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
new file mode 100644
index 00000000000..1caf0bf7b73
--- /dev/null
+++ b/engines/m4/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 "m4/console.h"
+
+namespace M4 {
+
+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 M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
new file mode 100644
index 00000000000..69bda1653ca
--- /dev/null
+++ b/engines/m4/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 M4_CONSOLE_H
+#define M4_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace M4 {
+
+class Console : public GUI::Debugger {
+private:
+ bool Cmd_test(int argc, const char **argv);
+public:
+ Console();
+ ~Console() override;
+};
+
+} // End of namespace M4
+
+#endif // M4_CONSOLE_H
diff --git a/engines/m4/credits.pl b/engines/m4/credits.pl
new file mode 100644
index 00000000000..68f941a9189
--- /dev/null
+++ b/engines/m4/credits.pl
@@ -0,0 +1,3 @@
+begin_section("M4");
+ add_person("Paul Gilbert", "DreamMaster", "");
+end_section();
diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp
new file mode 100644
index 00000000000..a5e54f6b961
--- /dev/null
+++ b/engines/m4/detection.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/detection.h"
+#include "m4/detection_tables.h"
+
+const DebugChannelDef M4MetaEngineDetection::debugFlagList[] = {
+ { M4::kDebugScript, "script", "Script debug level" },
+ { M4::kDebugGraphics, "graphics", "Graphics debug level" },
+ { M4::kDebugConversations, "conversations", "Conversations debugging" },
+ { M4::kDebugSound, "sound", "Sounds debug level" },
+ { M4::kDebugCore, "core", "Core debug level" },
+ { M4::kDebugWSSequ, "wssequ", "WoodScript sequence debug level" },
+ { M4::kDebugWSMach, "wsmach", "WoodScript machine debug level" },
+ DEBUG_CHANNEL_END
+};
+
+M4MetaEngineDetection::M4MetaEngineDetection() : AdvancedMetaEngineDetection(M4::gameDescriptions,
+ sizeof(M4::M4GameDescription), M4::m4Games) {
+}
+
+REGISTER_PLUGIN_STATIC(M4_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, M4MetaEngineDetection);
diff --git a/engines/m4/detection.h b/engines/m4/detection.h
new file mode 100644
index 00000000000..44acdebfb46
--- /dev/null
+++ b/engines/m4/detection.h
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_DETECTION_H
+#define M4_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace M4 {
+
+enum M4DebugChannels {
+ kDebugScript = 1 << 0,
+ kDebugConversations = 1 << 1,
+ kDebugGraphics = 1 << 2,
+ kDebugSound = 1 << 3,
+ kDebugCore = 1 << 4,
+ kDebugWSSequ = 1 << 5,
+ kDebugWSMach = 1 << 6
+};
+
+enum M4GameType {
+ GType_Riddle = 1,
+ GType_Burger = 2
+};
+
+enum Features {
+ kFeaturesNone = 0,
+ kFeaturesCD = 1 << 0,
+ kFeaturesDemo = 1 << 1
+};
+
+struct M4GameDescription {
+ ADGameDescription desc;
+
+ int gameType;
+ uint32 features;
+};
+
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
+} // End of namespace M4
+
+class M4MetaEngineDetection : public AdvancedMetaEngineDetection {
+ static const DebugChannelDef debugFlagList[];
+
+public:
+ M4MetaEngineDetection();
+ ~M4MetaEngineDetection() override {}
+
+ const char *getName() const override {
+ return "m4";
+ }
+
+ const char *getEngineName() const override {
+ return "M4";
+ }
+
+ const char *getOriginalCopyright() const override {
+ return "M4 (C)";
+ }
+
+ const DebugChannelDef *getDebugChannels() const override {
+ return debugFlagList;
+ }
+};
+
+#endif // M4_DETECTION_H
diff --git a/engines/m4/detection_tables.h b/engines/m4/detection_tables.h
new file mode 100644
index 00000000000..bda688aab11
--- /dev/null
+++ b/engines/m4/detection_tables.h
@@ -0,0 +1,179 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4 {
+
+static const PlainGameDescriptor m4Games[] = {
+ { "m4", "MADS/M4 engine game" },
+ { "riddle", "Ripley's Believe It or Not!: The Riddle of Master Lu" },
+ { "burger", "Orion Burger" },
+ { 0, 0 }
+};
+
+static const M4GameDescription gameDescriptions[] = {
+ {
+ {
+ "burger",
+ nullptr,
+ AD_ENTRY1s("burger.has", "10c8064e9c771072122f50737ac97245", 730771),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Burger,
+ kFeaturesCD
+ },
+ {
+ {
+ "burger",
+ nullptr,
+ AD_ENTRY1s("burger.has", "55be8693a4c36e7efcdca0f0c77758ae", 724191),
+ Common::DE_DEU,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Burger,
+ kFeaturesCD
+ },
+ {
+ {
+ "burger",
+ nullptr,
+ AD_ENTRY1s("burger.has", "795c98a74e351ec437a396bb29897daf", 730771),
+ Common::RU_RUS,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Burger,
+ kFeaturesCD
+ },
+ {
+ {
+ "burger",
+ "Demo",
+ AD_ENTRY1s("burger.has", "fc3f363b6153240a448bd3b7be9318da", 62159),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_DEMO | ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Burger,
+ kFeaturesDemo
+ },
+ {
+ {
+ "burger",
+ "Demo",
+ AD_ENTRY1s("overview.has", "57aa43a3ef88a934a43e9b1890ef5e17", 10519),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_DEMO | ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Burger,
+ kFeaturesDemo
+ },
+ {
+ {
+ "riddle",
+ nullptr,
+ AD_ENTRY1s("ripley.has", "056d517360c89eb4c297a319f21a7071", 700469),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesCD
+ },
+ {
+ {
+ "riddle",
+ nullptr,
+ AD_ENTRY1s("ripley.has", "d073582c9011d44dd0d7e2ede317a86d", 700469),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesCD
+ },
+ {
+ {
+ "riddle",
+ nullptr,
+ AD_ENTRY1s("ripley.has", "d9e9f8befec432a047b1047fb2bc7aea", 710997),
+ Common::DE_DEU,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesCD
+ },
+ {
+ {
+ "riddle",
+ nullptr,
+ AD_ENTRY1s("ripley.has", "3d48c5700785d11e6a5bc832b95be918", 701973),
+ Common::FR_FRA,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesCD
+ },
+ {
+ {
+ "riddle",
+ nullptr,
+ AD_ENTRY1s("ripley.has", "5ee011cff7178dae3ddf6f9b7d4102ac", 701691),
+ Common::ES_ESP,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesCD
+ },
+ { // Demo
+ {
+ "riddle",
+ "Demo",
+ AD_ENTRY1s("ripley.has", "3a90dd7052860b6e246ec7e0aaf202f6", 104527),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_DEMO | ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_Riddle,
+ kFeaturesDemo
+ },
+
+ { AD_TABLE_END_MARKER, 0, 0 }
+};
+
+} // End of namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
new file mode 100644
index 00000000000..656a55dbc7f
--- /dev/null
+++ b/engines/m4/m4.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 "m4/m4.h"
+#include "m4/detection.h"
+#include "m4/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 M4 {
+
+M4Engine *g_engine;
+
+M4Engine::M4Engine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+ _gameDescription(gameDesc), _randomSource("M4") {
+ g_engine = this;
+}
+
+M4Engine::~M4Engine() {
+ delete _screen;
+}
+
+uint32 M4Engine::getFeatures() const {
+ return _gameDescription->flags;
+}
+
+Common::String M4Engine::getGameId() const {
+ return _gameDescription->gameId;
+}
+
+Common::Error M4Engine::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 M4Engine::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 M4
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
new file mode 100644
index 00000000000..80f2d185eb2
--- /dev/null
+++ b/engines/m4/m4.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 M4_H
+#define M4_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 "m4/detection.h"
+
+namespace M4 {
+
+struct M4GameDescription;
+
+class M4Engine : public Engine {
+private:
+ const ADGameDescription *_gameDescription;
+ Common::RandomSource _randomSource;
+protected:
+ // Engine APIs
+ Common::Error run() override;
+public:
+ Graphics::Screen *_screen = nullptr;
+public:
+ M4Engine(OSystem *syst, const ADGameDescription *gameDesc);
+ ~M4Engine() 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(Common::U32String *msg = nullptr) override {
+ return true;
+ }
+ bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) 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 M4Engine *g_engine;
+#define SHOULD_QUIT ::M4::g_engine->shouldQuit()
+
+} // End of namespace M4
+
+#endif // M4_H
diff --git a/engines/m4/metaengine.cpp b/engines/m4/metaengine.cpp
new file mode 100644
index 00000000000..ab01e1b1b0c
--- /dev/null
+++ b/engines/m4/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 "m4/metaengine.h"
+#include "m4/detection.h"
+#include "m4/m4.h"
+
+namespace M4 {
+
+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 M4
+
+const char *M4MetaEngine::getName() const {
+ return "m4";
+}
+
+const ADExtraGuiOptionsMap *M4MetaEngine::getAdvancedExtraGuiOptions() const {
+ return M4::optionsList;
+}
+
+Common::Error M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new M4::M4Engine(syst, desc);
+ return Common::kNoError;
+}
+
+bool M4MetaEngine::hasFeature(MetaEngineFeature f) const {
+ return checkExtendedSaves(f) ||
+ (f == kSupportsLoadingDuringStartup);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(M4)
+REGISTER_PLUGIN_DYNAMIC(M4, PLUGIN_TYPE_ENGINE, M4MetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(M4, PLUGIN_TYPE_ENGINE, M4MetaEngine);
+#endif
diff --git a/engines/m4/metaengine.h b/engines/m4/metaengine.h
new file mode 100644
index 00000000000..5596b24a7da
--- /dev/null
+++ b/engines/m4/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 M4_METAENGINE_H
+#define M4_METAENGINE_H
+
+#include "engines/advancedDetector.h"
+
+class M4MetaEngine : 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 // M4_METAENGINE_H
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
new file mode 100644
index 00000000000..dcd3ff1b98a
--- /dev/null
+++ b/engines/m4/module.mk
@@ -0,0 +1,17 @@
+MODULE := engines/m4
+
+MODULE_OBJS = \
+ m4.o \
+ console.o \
+ metaengine.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
Commit: a876443129a3d585b7f23eb6aa9c33f137b8bb14
https://github.com/scummvm/scummvm/commit/a876443129a3d585b7f23eb6aa9c33f137b8bb14
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added f_info.cpp
Changed paths:
A engines/m4/f_info.cpp
A engines/m4/f_info.h
engines/m4/module.mk
diff --git a/engines/m4/f_info.cpp b/engines/m4/f_info.cpp
new file mode 100644
index 00000000000..29dbe171736
--- /dev/null
+++ b/engines/m4/f_info.cpp
@@ -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/>.
+ *
+ */
+
+#include "m4/f_info.h"
+
+namespace M4 {
+
+bool f_info_exists(const Common::String &filename) {
+ return Common::File::exists(filename);
+}
+
+size_t f_info_get_file_size(const Common::String &filename) {
+ Common::File f;
+ return f.open(filename) ? f.size() : 0;
+}
+
+} // namespace M4
diff --git a/engines/m4/f_info.h b/engines/m4/f_info.h
new file mode 100644
index 00000000000..4f481bc83ca
--- /dev/null
+++ b/engines/m4/f_info.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_INFO_H
+#define M4_INFO_H
+
+#include "common/file.h"
+
+namespace M4 {
+
+/**
+ * Returns true if a given file exists
+ */
+extern bool f_info_exists(const Common::String &filename);
+
+/**
+ * Returns the size of a given file
+ */
+extern size_t f_info_get_file_size(const Common::String &filename);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index dcd3ff1b98a..b6d8a76a9ab 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/m4
MODULE_OBJS = \
m4.o \
console.o \
+ f_info.o \
metaengine.o
# This module can be built as a plugin
Commit: e4f520445e6e88fd0a45f834690a5394a169e707
https://github.com/scummvm/scummvm/commit/e4f520445e6e88fd0a45f834690a5394a169e707
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton globals class
Changed paths:
A engines/m4/globals.cpp
A engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
new file mode 100644
index 00000000000..cf2729aba1d
--- /dev/null
+++ b/engines/m4/globals.cpp
@@ -0,0 +1,28 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/globals.h"
+
+namespace M4 {
+
+Globals *g_globals;
+
+} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
new file mode 100644
index 00000000000..1117965d7a5
--- /dev/null
+++ b/engines/m4/globals.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GLOBALS_H
+#define M4_GLOBALS_H
+
+#include "common/file.h"
+
+namespace M4 {
+
+struct Globals;
+
+extern Globals *g_globals;
+
+struct Globals {
+ Globals() { g_globals = this; }
+ ~Globals() { g_globals = nullptr; }
+
+ bool system_shutting_down = false;
+};
+
+#define _G(X) (g_globals->X)
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 656a55dbc7f..ed6c9546301 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -54,41 +54,8 @@ Common::String M4Engine::getGameId() const {
Common::Error M4Engine::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);
- }
+ Globals globals;
return Common::kNoError;
}
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 80f2d185eb2..b3ac9b15da3 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -35,6 +35,7 @@
#include "graphics/screen.h"
#include "m4/detection.h"
+#include "m4/globals.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index b6d8a76a9ab..bfc3bc21d6c 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
m4.o \
console.o \
f_info.o \
+ globals.o \
metaengine.o
# This module can be built as a plugin
Commit: 12483662d5b266115821115310e621777a9fc2fc
https://github.com/scummvm/scummvm/commit/12483662d5b266115821115310e621777a9fc2fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add param parsing
Changed paths:
A engines/m4/game.cpp
A engines/m4/game.h
A engines/m4/kernel.cpp
A engines/m4/kernel.h
A engines/m4/param.cpp
A engines/m4/param.h
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/module.mk
diff --git a/engines/m4/game.cpp b/engines/m4/game.cpp
new file mode 100644
index 00000000000..0231092c6ae
--- /dev/null
+++ b/engines/m4/game.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/game.h"
+
+namespace M4 {
+
+} // namespace M4
diff --git a/engines/m4/game.h b/engines/m4/game.h
new file mode 100644
index 00000000000..0e9d4a62329
--- /dev/null
+++ b/engines/m4/game.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GAME_H
+#define M4_GAME_H
+
+#include "common/scummsys.h"
+
+namespace M4 {
+
+struct Game {
+ int16 new_room;
+ int16 new_section;
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 1117965d7a5..d33dba56f54 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -22,10 +22,13 @@
#ifndef M4_GLOBALS_H
#define M4_GLOBALS_H
-#include "common/file.h"
+#include "m4/game.h"
+#include "m4/kernel.h"
namespace M4 {
+#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
+
struct Globals;
extern Globals *g_globals;
@@ -34,10 +37,14 @@ struct Globals {
Globals() { g_globals = this; }
~Globals() { g_globals = nullptr; }
- bool system_shutting_down = false;
+ bool _system_shutting_down = false;
+ size_t _mem_to_alloc = 0;
+
+ Game _game;
+ Kernel _kernel;
};
-#define _G(X) (g_globals->X)
+#define _G(X) (g_globals->_##X)
} // namespace M4
diff --git a/engines/m4/kernel.cpp b/engines/m4/kernel.cpp
new file mode 100644
index 00000000000..65f69d705fd
--- /dev/null
+++ b/engines/m4/kernel.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/kernel.h"
+
+namespace M4 {
+
+} // namespace M4
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
new file mode 100644
index 00000000000..7e4ee7b26ac
--- /dev/null
+++ b/engines/m4/kernel.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_KERNEL_H
+#define M4_KERNEL_H
+
+namespace M4 {
+
+struct Kernel {
+ bool use_log_file = false;
+ bool suppress_cache = false;
+ bool track_open_close = false;
+ bool hag_mode = false;
+ bool start_up_with_dbg_ws = false;
+ bool cheat_keys_enabled = false;
+ bool use_debug_monitor = false;
+ bool restore_game = false;
+ int last_save = -1;
+ bool teleported_in = false;
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index ed6c9546301..97242cf6986 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -19,9 +19,6 @@
*
*/
-#include "m4/m4.h"
-#include "m4/detection.h"
-#include "m4/console.h"
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
@@ -29,6 +26,10 @@
#include "common/system.h"
#include "engines/util.h"
#include "graphics/palette.h"
+#include "m4/m4.h"
+#include "m4/detection.h"
+#include "m4/console.h"
+#include "m4/param.h"
namespace M4 {
@@ -52,11 +53,19 @@ Common::String M4Engine::getGameId() const {
}
Common::Error M4Engine::run() {
+ Globals globals;
+
// Initialize 320x200 paletted graphics mode
initGraphics(320, 200);
- Globals globals;
+ param_init();
+ parse_all_flags();
+
+ if (!_G(system_shutting_down)) {
+ // TODO
+ }
+ param_shutdown();
return Common::kNoError;
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index bfc3bc21d6c..e16ba17b2a5 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -4,8 +4,11 @@ MODULE_OBJS = \
m4.o \
console.o \
f_info.o \
+ game.o \
globals.o \
- metaengine.o
+ kernel.o \
+ metaengine.o \
+ param.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
diff --git a/engines/m4/param.cpp b/engines/m4/param.cpp
new file mode 100644
index 00000000000..ddfb11f34ce
--- /dev/null
+++ b/engines/m4/param.cpp
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/config-manager.h"
+#include "m4/param.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static bool param_inited = false;
+
+void param_init() {
+ param_inited = true;
+}
+
+void param_shutdown() {
+ param_inited = false;
+}
+
+void parse_all_flags() {
+ assert(param_inited);
+
+ if (ConfMan.hasKey("LOG"))
+ _G(kernel).use_log_file = ConfMan.getBool("LOG");
+
+ if (ConfMan.hasKey("USECACHE"))
+ _G(kernel).suppress_cache = true;
+ else if (ConfMan.hasKey("NOCACHE"))
+ _G(kernel).suppress_cache = false;
+
+ _G(kernel).track_open_close = ConfMan.hasKey("FILECOUNT");
+ _G(kernel).hag_mode = ConfMan.hasKey("C");
+ _G(kernel).start_up_with_dbg_ws = ConfMan.hasKey("W");
+ _G(kernel).cheat_keys_enabled = ConfMan.hasKey("!");
+ _G(kernel).use_debug_monitor = ConfMan.hasKey("H");
+
+ if (ConfMan.hasKey("M"))
+ _G(mem_to_alloc) = ConfMan.getInt("M");
+
+ if (ConfMan.hasKey("R")) {
+ int val = ConfMan.getInt("R");
+
+ if (!val) {
+ _G(kernel).last_save = -1;
+ _G(kernel).restore_game = true;
+ } else {
+ _G(kernel).last_save = val;
+ _G(kernel).restore_game = true;
+ }
+ }
+
+ if (ConfMan.hasKey("V")) {
+ warning("TODO: show_logo");
+ _G(system_shutting_down) = true;
+ return;
+ }
+
+ if (ConfMan.hasKey("T")) {
+ int room = ConfMan.getInt("T");
+
+ if (room) {
+ _G(kernel).teleported_in = true;
+ _G(game).new_room = room;
+ _G(game).new_section = (room / 100);
+ }
+ }
+}
+
+} // namespace M4
diff --git a/engines/m4/param.h b/engines/m4/param.h
new file mode 100644
index 00000000000..f9399da9dac
--- /dev/null
+++ b/engines/m4/param.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_INFO_H
+#define M4_INFO_H
+
+#include "common/file.h"
+
+namespace M4 {
+
+/**
+ * Initialize params handler
+ */
+extern void param_init();
+
+/**
+ * Shutdown params handler
+ */
+extern void param_shutdown();
+
+/**
+ * Parses any flags
+ */
+extern void parse_all_flags();
+
+} // namespace M4
+
+#endif
Commit: b65c26dabee7333179f715961a87c589fb2fcb75
https://github.com/scummvm/scummvm/commit/b65c26dabee7333179f715961a87c589fb2fcb75
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added engine info display
Changed paths:
A engines/m4/burger/burger.cpp
A engines/m4/burger/burger.h
engines/m4/m4.h
engines/m4/metaengine.cpp
engines/m4/module.mk
engines/m4/param.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
new file mode 100644
index 00000000000..1371fe36e60
--- /dev/null
+++ b/engines/m4/burger/burger.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 "common/debug.h"
+#include "m4/burger/burger.h"
+
+namespace M4 {
+namespace Burger {
+
+void BurgerEngine::showEngineInfo() {
+ debug("Orion Burger\n");
+ debug("Game Version %s -- %s\n", "Giraffe", "September 27, 1996");
+ debug("%s\n", "M4 Runtime Engine by NickP, MikeE, AndrasK, Tinman, XiH, PaulL, MattP");
+ debug("M4 Library Version %s -- %s\n", "v1.400 OB", "January 21, 1996");
+ debug("%s.\n\n", "Copyright (c) 1996 by Sanctuary Woods Multimedia Corporation");
+ debug("Orion Burger tastes great!\n");
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
new file mode 100644
index 00000000000..b9b8b42ecbd
--- /dev/null
+++ b/engines/m4/burger/burger.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_BURGER_H
+#define M4_BURGER_BURGER_H
+
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Burger {
+
+class BurgerEngine : public M4Engine {
+public:
+ BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+
+ M4Engine(syst, gameDesc) {
+ }
+ ~BurgerEngine() override {
+ }
+
+ /**
+ * Show the engine information
+ */
+ void showEngineInfo() override;
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index b3ac9b15da3..34f044d81de 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -96,6 +96,11 @@ public:
Common::Serializer s(stream, nullptr);
return syncGame(s);
}
+
+ /**
+ * Show the engine information
+ */
+ virtual void showEngineInfo() = 0;
};
extern M4Engine *g_engine;
diff --git a/engines/m4/metaengine.cpp b/engines/m4/metaengine.cpp
index ab01e1b1b0c..776fc4be9b7 100644
--- a/engines/m4/metaengine.cpp
+++ b/engines/m4/metaengine.cpp
@@ -23,7 +23,7 @@
#include "m4/metaengine.h"
#include "m4/detection.h"
-#include "m4/m4.h"
+#include "m4/burger/burger.h"
namespace M4 {
@@ -53,7 +53,16 @@ const ADExtraGuiOptionsMap *M4MetaEngine::getAdvancedExtraGuiOptions() const {
}
Common::Error M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- *engine = new M4::M4Engine(syst, desc);
+ const M4::M4GameDescription *gd = (const M4::M4GameDescription *)desc;
+
+ switch (gd->gameType) {
+ case M4::GType_Burger:
+ *engine = new M4::Burger::BurgerEngine(syst, desc);
+ break;
+ default:
+ return Common::kUnsupportedGameidError;
+ }
+
return Common::kNoError;
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e16ba17b2a5..ff1209363a7 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -8,7 +8,8 @@ MODULE_OBJS = \
globals.o \
kernel.o \
metaengine.o \
- param.o
+ param.o \
+ burger/burger.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
diff --git a/engines/m4/param.cpp b/engines/m4/param.cpp
index ddfb11f34ce..56dc65eecdb 100644
--- a/engines/m4/param.cpp
+++ b/engines/m4/param.cpp
@@ -22,6 +22,7 @@
#include "common/config-manager.h"
#include "m4/param.h"
#include "m4/globals.h"
+#include "m4/m4.h"
namespace M4 {
@@ -68,7 +69,7 @@ void parse_all_flags() {
}
if (ConfMan.hasKey("V")) {
- warning("TODO: show_logo");
+ g_engine->showEngineInfo();
_G(system_shutting_down) = true;
return;
}
Commit: 7d1cf29ded1c124a6fe710bc1c761e6806b8ac94
https://github.com/scummvm/scummvm/commit/7d1cf29ded1c124a6fe710bc1c761e6806b8ac94
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add term.cpp
Changed paths:
A engines/m4/term.cpp
A engines/m4/term.h
engines/m4/globals.h
engines/m4/module.mk
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index d33dba56f54..b9a3fa8c750 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -24,6 +24,7 @@
#include "m4/game.h"
#include "m4/kernel.h"
+#include "m4/term.h"
namespace M4 {
@@ -37,11 +38,18 @@ struct Globals {
Globals() { g_globals = this; }
~Globals() { g_globals = nullptr; }
- bool _system_shutting_down = false;
- size_t _mem_to_alloc = 0;
-
Game _game;
Kernel _kernel;
+ Term _term;
+
+ bool _system_shutting_down = false;
+ size_t _mem_to_alloc = 0;
+ void *_gameInterfaceBuff = nullptr;
+ void *_custom_interface_setup = nullptr;
+ void *_custom_interface_button_handler = nullptr;
+ int _global_sound_room = 0;
+ bool _interface_visible = false;
+ bool _please_hyperwalk = false;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ff1209363a7..338284b06ff 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS = \
kernel.o \
metaengine.o \
param.o \
+ term.o \
burger/burger.o
# This module can be built as a plugin
diff --git a/engines/m4/term.cpp b/engines/m4/term.cpp
new file mode 100644
index 00000000000..6afccc14c08
--- /dev/null
+++ b/engines/m4/term.cpp
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/debug.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "m4/term.h"
+
+namespace M4 {
+
+void Term::init(bool use_me, bool use_log) {
+ _using_mono_screen = use_me;
+ _use_log_file = use_log;
+ set_mode(MESSAGE_MODE);
+
+ if (use_log) {
+ _file = g_system->getSavefileManager()->openForSaving("term.log");
+ if (!_file)
+ error("Fail to create term.log file");
+ }
+}
+
+void Term::set_mode(TermMode mode) {
+ if (_using_mono_screen && mode != _mode) {
+ _mode = mode;
+
+ switch (mode) {
+ case MESSAGE_MODE:
+ message("********Message Mode");
+ break;
+ case MEMORY_MODE:
+ message("********Memory Mode");
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void Term::message(const Common::String &msg) {
+ if (_mode != MEMORY_MODE) {
+ debug("%s\n", msg.c_str());
+
+ if (_file) {
+ _file->writeString(msg);
+ _file->writeByte('\n');
+ _file->writeByte(0);
+ }
+ }
+}
+
+} // namespace M4
diff --git a/engines/m4/term.h b/engines/m4/term.h
new file mode 100644
index 00000000000..9c01b05c64e
--- /dev/null
+++ b/engines/m4/term.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_TERM_H
+#define M4_TERM_H
+
+#include "common/stream.h"
+
+namespace M4 {
+
+enum TermMode {
+ NO_MODE = 0,
+ MESSAGE_MODE,
+ MEMORY_MODE
+};
+
+class Term {
+private:
+ Common::WriteStream *_file = nullptr;
+ bool _using_mono_screen = false;
+ bool _use_log_file = false;
+ TermMode _mode = NO_MODE;
+
+public:
+ /**
+ * Initialization
+ */
+ void init(bool use_me, bool use_log);
+
+ ~Term() {
+ delete _file;
+ }
+
+ /**
+ * Set the terminal mode
+ */
+ void set_mode(TermMode mode);
+
+ /**
+ * Show a message
+ */
+ void message(const Common::String &msg);
+};
+
+} // namespace M4
+
+#endif
Commit: a7a47b794451203b28fd8f71b2342bc11dc5498b
https://github.com/scummvm/scummvm/commit/a7a47b794451203b28fd8f71b2342bc11dc5498b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added SysFile and dependencies
Changed paths:
A engines/m4/adv_r/db_env.cpp
A engines/m4/adv_r/db_env.h
A engines/m4/adv_r/db_rmlst.cpp
A engines/m4/adv_r/db_rmlst.h
A engines/m4/fileio/extensions.cpp
A engines/m4/fileio/extensions.h
A engines/m4/fileio/fileio.cpp
A engines/m4/fileio/fileio.h
A engines/m4/fileio/info.cpp
A engines/m4/fileio/info.h
A engines/m4/fileio/sys_file.cpp
A engines/m4/fileio/sys_file.h
A engines/m4/m4_types.h
A engines/m4/mem/memman.cpp
A engines/m4/mem/memman.h
A engines/m4/mem/reloc.h
A engines/m4/mem/res.cpp
A engines/m4/mem/res.h
R engines/m4/f_info.cpp
R engines/m4/f_info.h
engines/m4/globals.h
engines/m4/kernel.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
engines/m4/term.cpp
engines/m4/term.h
diff --git a/engines/m4/adv_r/db_env.cpp b/engines/m4/adv_r/db_env.cpp
new file mode 100644
index 00000000000..4f81d4efac8
--- /dev/null
+++ b/engines/m4/adv_r/db_env.cpp
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/str.h"
+#include "common/textconsole.h"
+#include "m4/adv_r/db_env.h"
+#include "m4/adv_r/db_rmlst.h"
+
+namespace M4 {
+
+char *env_find(const Common::String &descName) {
+ static char name[144];
+ static char resultPath[144];
+ int32 sceneCode;
+ Common::strcpy_s(name, descName.c_str());
+
+ if (descName.hasPrefixIgnoreCase(".raw") || descName.hasPrefixIgnoreCase(".hmp")) {
+ return name;
+
+ } else {
+ db_rmlst_get_asset_room_path(name, resultPath, &sceneCode);
+ if (strlen(resultPath) == 0)
+ return nullptr;
+
+ env_get_path(name, sceneCode, resultPath);
+ return name;
+ }
+}
+
+char *env_get_path(char *resultPath, int room_num, char *fileName) {
+ error("TODO: env_get_path");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/db_env.h b/engines/m4/adv_r/db_env.h
new file mode 100644
index 00000000000..9eb04a8c7ea
--- /dev/null
+++ b/engines/m4/adv_r/db_env.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 M4_ADV_R_DB_ENV_H
+#define M4_ADV_R_DB_ENV_H
+
+#include "common/str.h"
+
+namespace M4 {
+
+extern char *env_find(const Common::String &descName);
+extern char *env_get_path(char *resultPath, int room_num, char *fileName);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/adv_r/db_rmlst.cpp b/engines/m4/adv_r/db_rmlst.cpp
new file mode 100644
index 00000000000..dc9c738a7b6
--- /dev/null
+++ b/engines/m4/adv_r/db_rmlst.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/adv_r/db_rmlst.h"
+
+namespace M4 {
+
+int32 db_rmlst_get_volume(char *filename) {
+ error("TODO: db_rmlst_get_volume");
+}
+
+void db_rmlst_delete_global_RoomList() {
+ error("TODO: db_rmlst_delete_global_RoomList");
+}
+
+char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode) {
+ error("TODO: db_rmlst_get_asset_room_path");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/db_rmlst.h b/engines/m4/adv_r/db_rmlst.h
new file mode 100644
index 00000000000..b6b1f9e7bb9
--- /dev/null
+++ b/engines/m4/adv_r/db_rmlst.h
@@ -0,0 +1,36 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_DB_RMLST_H
+#define M4_ADV_R_DB_RMLST_H
+
+#include "common/scummsys.h"
+
+namespace M4 {
+
+int32 db_rmlst_get_volume(char *filename); //is public xi add
+void db_rmlst_delete_global_RoomList(void); //is public
+char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode); //is public
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/fileio/extensions.cpp b/engines/m4/fileio/extensions.cpp
new file mode 100644
index 00000000000..4daa23d6d07
--- /dev/null
+++ b/engines/m4/fileio/extensions.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/fileio/extensions.h"
+
+namespace M4 {
+
+Common::String f_extension_add(const Common::String &name, const Common::String &ext) {
+ size_t dot = name.findFirstOf('.');
+ if (dot == Common::String::npos)
+ return name + "." + ext;
+ else
+ return name;
+}
+
+Common::String f_extension_new(const Common::String &name, const Common::String &ext) {
+ size_t dot = name.findFirstOf('.');
+ if (dot != Common::String::npos)
+ return Common::String(name.c_str(), name.c_str() + dot + 1) + ext;
+ else
+ return name + "." + ext;
+}
+
+} // namespace M4
diff --git a/engines/m4/fileio/extensions.h b/engines/m4/fileio/extensions.h
new file mode 100644
index 00000000000..0c768f91805
--- /dev/null
+++ b/engines/m4/fileio/extensions.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 M4_FILEIO_EXTENSIONS_H
+#define M4_FILEIO_EXTENSIONS_H
+
+#include "common/str.h"
+
+namespace M4 {
+
+Common::String f_extension_add(const Common::String &name, const Common::String &ext);
+
+Common::String f_extension_new(const Common::String &name, const Common::String &ext);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/fileio/fileio.cpp b/engines/m4/fileio/fileio.cpp
new file mode 100644
index 00000000000..0627f6c54c6
--- /dev/null
+++ b/engines/m4/fileio/fileio.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/file.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "m4/fileio/fileio.h"
+
+namespace M4 {
+
+Common::Stream *f_io_open(const Common::String &filename, const Common::String &mode) {
+ if (mode.hasPrefix("r")) {
+ Common::File *f = new Common::File();
+ if (f->open(filename))
+ return f;
+
+ delete f;
+ return nullptr;
+
+ } else {
+ return g_system->getSavefileManager()->openForSaving(filename);
+ }
+}
+
+void f_io_close(Common::Stream *stream) {
+ delete stream;
+}
+
+} // namespace M4
diff --git a/engines/m4/fileio/fileio.h b/engines/m4/fileio/fileio.h
new file mode 100644
index 00000000000..6c55cd671c6
--- /dev/null
+++ b/engines/m4/fileio/fileio.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_FILEIO_FILEIO_H
+#define M4_FILEIO_FILEIO_H
+
+#include "common/stream.h"
+
+namespace M4 {
+
+enum AccessMode {
+ UNOPENED,
+ READ,
+ WRITE,
+ READ_OR_WRITE
+};
+
+enum FileMode {
+ BINARY,
+ TEXT,
+ BINARYW,
+ TEXTW
+};
+
+struct Hag_Name_Record {
+ Common::String filename;
+ byte hagfile;
+ struct Hag_Name_Record *next;
+};
+
+struct Hag_Record {
+ Common::String hag_name;
+ byte hagfile;
+ Common::Stream *hag_fp;
+ uint32 hag_pos;
+ Hag_Record *next;
+};
+
+Common::Stream *f_io_open(const Common::String &filename, const Common::String &mode);
+void f_io_close(Common::Stream *stream);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/f_info.cpp b/engines/m4/fileio/info.cpp
similarity index 97%
rename from engines/m4/f_info.cpp
rename to engines/m4/fileio/info.cpp
index 29dbe171736..d0ed99acde1 100644
--- a/engines/m4/f_info.cpp
+++ b/engines/m4/fileio/info.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/f_info.h"
+#include "m4/fileio/info.h"
namespace M4 {
diff --git a/engines/m4/f_info.h b/engines/m4/fileio/info.h
similarity index 95%
rename from engines/m4/f_info.h
rename to engines/m4/fileio/info.h
index 4f481bc83ca..6b39ac5e8b0 100644
--- a/engines/m4/f_info.h
+++ b/engines/m4/fileio/info.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_INFO_H
-#define M4_INFO_H
+#ifndef M4_FILEIO_INFO_H
+#define M4_FILEIO_INFO_H
#include "common/file.h"
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
new file mode 100644
index 00000000000..f4820833b33
--- /dev/null
+++ b/engines/m4/fileio/sys_file.cpp
@@ -0,0 +1,521 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/fileio/sys_file.h"
+#include "m4/fileio/extensions.h"
+#include "m4/fileio/fileio.h"
+#include "m4/adv_r/db_env.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+// Hash entry format:
+// Filebame 33 bytes, Hagfile 1 byte, Disks 1 byte, Offset 4 bytes,
+// Size 4 bytes Next_record 4 Bytes, Total is 47 bytes.
+#define HASH_RECORD_LENGTH 47
+
+SysFile::SysFile(const Common::String &fname, FileMode myfmode) :
+ filename(fname), fmode(myfmode) {
+}
+
+bool SysFile::exists() {
+ if (fmode == BINARY || fmode == TEXT) {
+ show_error_flag = false;
+ open_read_low_level();
+ show_error_flag = true;
+
+ } else if (fmode == BINARYW || fmode == TEXTW) {
+ show_error_flag = false;
+ open_write();
+ show_error_flag = true;
+ }
+
+ if (!_G(hag).hag_flag)
+ return _fp != nullptr;
+ else
+ return (hag_success);
+}
+
+uint32 SysFile::size() {
+ uint32 fsize;
+
+ open_read();
+
+ if (!_G(hag).hag_flag) {
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(_fp);
+ assert(rs);
+ fsize = rs->size();
+
+ } else {
+ if (hag_success)
+ fsize = curr_hash_record.size;
+ else
+ fsize = 0;
+ }
+
+ return fsize;
+}
+
+void SysFile::open_read_low_level() {
+ Common::File temp_fp;
+ uint32 hash_table_size;
+ char hag_name[33];
+ byte hagfile;
+ Hag_Name_Record *temp_ptr;
+ char *temp_name;
+ Common::String last_string;
+ Common::String local_name, resource_hag;
+ Common::File hagfile_fp;
+
+ if (!_G(hag).first_read_flag) {
+ // First time to read
+ if (_G(hag).hag_flag) {
+ // Use hag file
+ _G(hag).hag_flag = true;
+
+ // Get hagfile table list here
+ if (!temp_fp.open(_G(hag).hash_file))
+ error("Hash file not found: %s", _G(hag).hash_file.c_str());
+
+ hash_table_size = temp_fp.readUint32LE();
+ if (temp_fp.seek(hash_table_size * HASH_RECORD_LENGTH, SEEK_CUR))
+ error("fail to seek");
+
+ _G(hag).hag_name_list = NULL;
+ while (!temp_fp.eos()) {
+ if (temp_fp.read(hag_name, 33) != 33)
+ break;
+ hagfile = temp_fp.readByte();
+
+ temp_ptr = (Hag_Name_Record *)mem_alloc(sizeof(Hag_Name_Record), "hag_name_list");
+ assert(temp_ptr);
+
+ // Check hag file exists or not
+ local_name = f_extension_new(hag_name, "hag");
+
+ if (!Common::File::exists(local_name))
+ error("couldn't find hag file: %s", local_name.c_str());
+
+ // put into hag_name_list //
+ temp_ptr->filename = hag_name;
+ temp_ptr->hagfile = hagfile;
+ temp_ptr->next = _G(hag).hag_name_list;
+ _G(hag).hag_name_list = temp_ptr;
+ }
+
+ temp_fp.close();
+ } else {
+ _G(hag).hag_flag = 0;
+ }
+
+ _G(hag).first_read_flag = 1;
+ }
+
+ switch (mode) {
+ case UNOPENED:
+ switch (fmode) {
+ case TEXT:
+ temp_name = env_find(filename);
+
+ if (!_G(hag).hag_flag) {
+ if (temp_name) {
+ filename = temp_name;
+ _fp = f_io_open(filename, "rb");
+
+ if (!_fp && show_error_flag)
+ error("Failed opening - %s", filename.c_str());
+ } else {
+ _fp = open_by_first_char();
+ }
+ } else {
+ // Hag mode
+ filename = get_last_string(filename);
+
+ if (!open_hash_file() && show_error_flag)
+ error("not in hag file: %s", filename.c_str());
+ }
+ break;
+
+ case BINARY:
+ // is it a font file? They're stored in a *special* place oo-la-la
+ temp_name = env_find(filename);
+
+ if (!_G(hag).hag_flag) {
+ if (temp_name)
+ filename = temp_name;
+ open_by_first_char();
+
+ } else {
+ last_string = get_last_string(filename);
+
+ if (!open_hash_file()) {
+ if (show_error_flag)
+ error("not in hag file: %s", filename.c_str());
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case READ:
+ case WRITE:
+ break;
+
+ default:
+ break;
+ }
+
+ mode = READ;
+}
+
+void SysFile::open_read() {
+ open_read_low_level();
+
+ if (_G(hag).hag_flag && curr_hag_record) {
+ if (!curr_hag_record->hag_fp)
+ error("hag file not open for: %s", filename.c_str());
+ }
+
+ if (!_G(hag).hag_flag && !_fp) {
+ error("Error opening - %s", filename.c_str());
+ } else if (_G(hag).hag_flag && !hag_success) {
+ error("Error opening - %s", filename.c_str());
+ }
+}
+
+Common::String SysFile::get_last_string(const Common::String &src) {
+ int len, j, k, l;
+
+ len = src.size();
+ Common::String result;
+
+ for (j = len - 1; j >= 0; j--) {
+ if (src[j] == '\\' || src[j] == ':') // back for DOS, colon for Mac
+ break;
+ }
+
+ if (j >= 0) {
+ l = 0;
+ for (k = j + 1; k < len; k++)
+ result += src[k];
+ return result;
+
+ } else {
+ return src;
+ }
+}
+
+bool SysFile::open_hash_file() {
+ Common::File hashfp;
+ Common::Stream *temp_fp;
+ uint32 hash_address;
+ Common::String hag_name, temp_name;
+ Common::String local_name;
+ Hag_Record *temp_ptr;
+ uint32 hash_table_size;
+ bool found;
+ Common::String ext_name;
+
+ if (!hashfp.open(_G(hag).hash_file)) {
+ warning("open_hash_file: %s %s", _G(hag).hash_file.c_str());
+ hag_success = false;
+ return false;
+ }
+
+ hash_table_size = hashfp.readUint32LE();
+ hash_address = key_to_hash_address(filename, hash_table_size);
+
+ if (!hash_search(filename, &curr_hash_record, curr_hag_record, hash_address, &hashfp, hash_table_size, show_error_flag)) {
+ hag_success = 0;
+ return false;
+
+ } else {
+ // How to open hag file
+ // Calculate Hagfile name - depends on hagfile field in curr_hash_record
+ if (!get_local_name_from_hagfile(local_name, curr_hash_record.hagfile)) {
+ hag_success = 0;
+ return false;
+ }
+
+ // Check if this Hag file already open or not
+ local_name = f_extension_new(local_name, "HAG");
+ temp_name = local_name;
+ hag_name = local_name; // Original used in cd_resource + name
+
+ found = false;
+ temp_ptr = _G(hag).hag_file_list;
+
+ // Search local open files for hag file...
+ while (temp_ptr)
+ {
+ if (hag_name.equalsIgnoreCase(temp_ptr->hag_name)) {
+ found = true;
+ break;
+ }
+ temp_ptr = temp_ptr->next;
+ }
+
+ // Search resource directory open files for hag file
+ if (!found) {
+ temp_ptr = _G(hag).hag_file_list;
+ found = false;
+ while (temp_ptr) {
+ if (temp_name.equalsIgnoreCase(temp_ptr->hag_name)) {
+ found = true;
+ break;
+ }
+ temp_ptr = temp_ptr->next;
+ }
+ if (!found) {
+ // hag file is not open, try the current directory first, then RESOURCE_PATH
+ temp_fp = f_io_open(hag_name, "rb");
+ if (!temp_fp) {
+ // hag_file is not in current directory, search for RESOURCE_PATH
+ temp_fp = f_io_open(temp_name, "rb");
+ if (!temp_fp) {
+ error("hag file not found: %s", hag_name.c_str());
+ hag_success = 0;
+ return 0;
+ }
+
+ // Add this new open hag file in resource dir into open hag file list
+ temp_ptr = (Hag_Record *)mem_alloc(sizeof(Hag_Record), "Hag_File_List");
+ if (!temp_ptr) {
+ f_io_close(temp_fp);
+ error("creating Hag_record");
+ hag_success = 0;
+ return 0;
+ }
+
+ temp_ptr->hag_name = temp_name;
+ temp_ptr->hag_fp = temp_fp;
+
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(temp_fp);
+ assert(rs);
+
+ if (!rs->seek(curr_hash_record.offset))
+ term_message("fail to fseek");
+ last_head_pos = rs->pos();
+
+ temp_ptr->hag_pos = curr_hash_record.offset;
+ temp_ptr->hagfile = curr_hash_record.hagfile;
+
+ // insert the element into list
+ temp_ptr->next = _G(hag).hag_file_list;
+ _G(hag).hag_file_list = temp_ptr;
+ }
+ // we just opened a previously unopened hag file
+ else {
+ // add this new open hag file in exec dir into its list
+ temp_ptr = (Hag_Record *)mem_alloc(sizeof(Hag_Record), "Hag_File_List");
+ if (!temp_ptr) {
+ f_io_close(temp_fp);
+ error("creating hag_record");
+ hag_success = 0;
+ return 0;
+ }
+
+ temp_ptr->hag_name = hag_name;
+ temp_ptr->hag_fp = temp_fp;
+
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(temp_fp);
+ assert(rs);
+
+ if (!rs->seek(curr_hash_record.offset))
+ term_message("fail to fseek");
+ last_head_pos = rs->pos();
+
+ temp_ptr->hag_pos = curr_hash_record.offset;
+ temp_ptr->hagfile = curr_hash_record.hagfile;
+
+ // Insert the element into list
+ temp_ptr->next = _G(hag).hag_file_list;
+ _G(hag).hag_file_list = temp_ptr;
+ }
+ }
+ }
+
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(temp_ptr->hag_fp);
+ assert(rs);
+
+ // set hag file pointer to current file postion //
+ if (!rs->seek(curr_hash_record.offset))
+ term_message("fail to fseek");
+ last_head_pos = rs->pos();
+
+ temp_ptr->hag_pos = curr_hash_record.offset;
+ curr_hag_record = temp_ptr;
+
+ hag_success = true;
+ return true;
+ }
+}
+
+uint32 SysFile::key_to_hash_address(const Common::String &src, uint32 hash_table_size) {
+ uint32 h;
+ int i, len;
+
+ Common::String key = src;
+ key.toUppercase();
+
+ h = key[0];
+ len = key.size();
+ for (i = 1; i < len; i++)
+ h = ((h * 256) + key[i]) % hash_table_size; // * 256 is because one char is 8 bits
+
+ return h;
+}
+
+int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_record_ptr, Hag_Record *current_hag_record, uint32 hash_address,
+ Common::SeekableReadStream *hashfp, uint32 hash_table_size, bool show_errors) {
+ uint32 offset;
+ bool finded = false;
+ char myfilename[33];
+ uint32 next_entry;
+ uint32 best_dist, find_offset, next_record;
+ Common::String local_name, local_hag_name;
+
+
+ next_entry = hash_address;
+ // 4 bytes is header of hash file, store hash_table_size
+ offset = HASH_RECORD_LENGTH * next_entry + 4;
+ best_dist = 0x7fffffff;
+ find_offset = offset;
+ myfilename[0] = '\0';
+
+ while (!finded) {
+ if (hashfp->seek(offset))
+ term_message("fail to fseek");
+ hashfp->read(myfilename, 33);
+
+ if (myfilename[0] == '\0') {
+ // this hash table is empty, insert new record here
+ f_io_close(hashfp);
+
+ if (show_errors)
+ error("not found in hag file: %s", fname.c_str());
+ else
+ term_message("fclass: file not found '%s', in hag file", fname.c_str());
+ return 0;
+ } else if (fname.equalsIgnoreCase(myfilename)) {
+ // The new record already in hash table, do nothing
+ auto &r = *current_hash_record_ptr;
+ r.hagfile = hashfp->readByte();
+ r.disks = hashfp->readByte();
+ r.offset = hashfp->readUint32LE();
+ next_record = hashfp->readUint32LE();
+ r.filename = myfilename;
+
+ // As long as find a hag file in current directory , use it immedeiately
+ get_local_name_from_hagfile(local_name, current_hash_record_ptr->hagfile);
+ local_hag_name = f_extension_new(local_name, "HAG");
+ local_name = local_hag_name;
+// sprintf(local_name, "%s%s", exec_path, local_hag_name);
+
+ if (Common::File::exists(local_name)) {
+ finded = 1;
+ find_offset = offset;
+ break;
+ }
+ if (current_hag_record && current_hag_record->hagfile == current_hash_record_ptr->hagfile) {
+ // in same hag file
+ if (best_dist > (uint32)ABS((int32)current_hag_record->hag_pos - (int32)current_hash_record_ptr->offset)) {
+ best_dist = ABS((int32)current_hag_record->hag_pos - (int32)current_hash_record_ptr->offset);
+ find_offset = offset;
+ }
+ } else {
+ find_offset = offset;
+ }
+ if (next_record == offset) // only one record of fname in hash table
+ {
+ finded = 1;
+ } else {
+ offset = next_record;
+ }
+ } else // collision here, search the next entry to see if it is empty until find a empty one
+ {
+ next_entry = (next_entry + 1) % hash_table_size; // search the hash table a round way
+ offset = HASH_RECORD_LENGTH * next_entry + 4; // 4 bytes is header of hash file, store hash_table_size
+ }
+ }
+
+
+ // get the best close one of hag file for multiple same fname
+ if (find_offset != offset) {
+ if (!hashfp->seek(find_offset))
+ term_message("fail to fseek");
+
+ auto &r = *current_hash_record_ptr;
+ hashfp->read(myfilename, 33);
+ r.filename = myfilename;
+ r.hagfile = hashfp->readByte();
+ r.disks = hashfp->readByte();
+ r.offset = hashfp->readUint32LE();
+ r.size = hashfp->readUint32LE();
+ }
+
+ f_io_close(hashfp);
+ if (!finded) {
+ error("not in hag file: %s", fname.c_str());
+ }
+
+ return true;
+}
+
+Common::Stream *SysFile::open_by_first_char() {
+ if (filename.hasPrefix("*")) {
+ // MADS folder file in original
+ _fp = f_io_open(filename.c_str() + 1, "rb");
+ } else {
+ _fp = f_io_open(filename, "rb");
+ }
+
+ if (!_fp) {
+ if (show_error_flag)
+ error("fclass: file not found '%s'", filename.c_str());
+ else
+ term_message("fclass: file not found '%s'", filename.c_str());
+ }
+
+ return nullptr;
+}
+
+bool SysFile::get_local_name_from_hagfile(Common::String &local_name, byte hagfile) {
+ bool found = false;
+ Hag_Name_Record *temp_ptr = _G(hag).hag_name_list;
+
+ while (temp_ptr && !found) {
+ if (temp_ptr->hagfile == hagfile) {
+ found = true;
+ local_name = temp_ptr->filename;
+ } else {
+ temp_ptr = temp_ptr->next;
+ }
+ }
+
+ return found;
+}
+
+} // namespace M4
diff --git a/engines/m4/fileio/sys_file.h b/engines/m4/fileio/sys_file.h
new file mode 100644
index 00000000000..ab1cf2a7167
--- /dev/null
+++ b/engines/m4/fileio/sys_file.h
@@ -0,0 +1,103 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_FILEIO_SYS_FILE_H
+#define M4_FILEIO_SYS_FILE_H
+
+#include "common/file.h"
+#include "m4/fileio/fileio.h"
+
+namespace M4 {
+
+struct Hash_Record {
+ Common::String filename;
+ byte hagfile;
+ byte disks;
+ uint32 offset;
+ uint32 size;
+};
+
+struct Hag_Statics {
+ bool hag_flag = false;
+ bool first_read_flag = false;
+ Common::String hash_file;
+ Hag_Name_Record *hag_name_list = nullptr;
+ Hag_Record *hag_file_list = nullptr;
+};
+
+class SysFile {
+private:
+ Common::Stream *_fp = nullptr;
+ Common::String filename;
+ FileMode fmode;
+ AccessMode mode = UNOPENED;
+ int hag_success = 0;
+ bool show_error_flag = true;
+ Hag_Record *curr_hag_record = nullptr;
+ Hash_Record curr_hash_record;
+ uint32 last_head_pos = 0;
+
+private:
+ void open_read();
+ void open_write();
+ void open_read_low_level();
+ bool open_hash_file();
+ Common::String get_last_string(const Common::String &src);
+
+ /**
+ * Calculate key (which is string) into hash table address ie. hash table entry
+ */
+ uint32 key_to_hash_address(const Common::String &src, uint32 hash_table_size);
+
+ /**
+ * Insert a hash record into HASH file depending hash_address. The algorithm is
+ * if hash_address entry is empty record, put the new record into this entry,
+ * if the hash_address entry is not empty, search next record of it, util find
+ * one empty entry and put the new record into the empty entry.
+ */
+ int hash_search(const Common::String &fname, Hash_Record *current_hash_record_ptr, Hag_Record *curr_hag_record, uint32 hash_address,
+ Common::SeekableReadStream *hashfp, uint32 hash_table_size, bool show_error_flag);
+
+ /**
+ * Opens the file for access, paying attention to the first character..
+ * if it's a '*', it indicates a MADS folder file
+ */
+ Common::Stream *open_by_first_char();
+
+ bool get_local_name_from_hagfile(Common::String &local_name, byte hagfile);
+
+public:
+ SysFile(const Common::String &fname, FileMode myfmode = BINARY);
+
+ /**
+ * Return true if the file exists
+ */
+ bool exists();
+
+ /**
+ * Returns the file size
+ */
+ uint32 size();
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index b9a3fa8c750..70c05fef599 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -25,6 +25,7 @@
#include "m4/game.h"
#include "m4/kernel.h"
#include "m4/term.h"
+#include "m4/fileio/sys_file.h"
namespace M4 {
@@ -41,6 +42,7 @@ struct Globals {
Game _game;
Kernel _kernel;
Term _term;
+ Hag_Statics _hag;
bool _system_shutting_down = false;
size_t _mem_to_alloc = 0;
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
index 7e4ee7b26ac..9a961e5194d 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/kernel.h
@@ -24,9 +24,11 @@
namespace M4 {
+#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
+
struct Kernel {
bool use_log_file = false;
- bool suppress_cache = false;
+ int suppress_cache = CACHE_NOT_OVERRIDE_BY_FLAG_PARSE;
bool track_open_close = false;
bool hag_mode = false;
bool start_up_with_dbg_ws = false;
@@ -35,6 +37,8 @@ struct Kernel {
bool restore_game = false;
int last_save = -1;
bool teleported_in = false;
+
+ size_t mem_avail() const { return 7999999; }
};
} // namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 97242cf6986..306a8786c8d 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -62,6 +62,10 @@ Common::Error M4Engine::run() {
parse_all_flags();
if (!_G(system_shutting_down)) {
+ game_systems_initialize();
+
+
+
// TODO
}
@@ -69,6 +73,20 @@ Common::Error M4Engine::run() {
return Common::kNoError;
}
+void M4Engine::game_systems_initialize() {
+ _G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
+
+
+ size_t totalMem = _G(kernel).mem_avail();
+ if (_G(kernel).suppress_cache == CACHE_NOT_OVERRIDE_BY_FLAG_PARSE)
+ _G(kernel).suppress_cache = totalMem < 8000000;
+
+ debugC(kDebugCore, _G(kernel).suppress_cache ?
+ "Cache System Disabled" : "Cache System Enabled");
+ debugC(kDebugCore, "Available memory: %ld", totalMem);
+
+}
+
Common::Error M4Engine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 34f044d81de..4f5f3a1e4e4 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -45,6 +45,9 @@ class M4Engine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+
+ void game_systems_initialize();
+
protected:
// Engine APIs
Common::Error run() override;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
new file mode 100644
index 00000000000..0999f68937b
--- /dev/null
+++ b/engines/m4/m4_types.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_M4_TYPES_H
+#define M4_M4_TYPES_H
+
+#include "common/scummsys.h"
+
+namespace M4 {
+
+typedef void *Ptr;
+typedef void *Handle;
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mem/memman.cpp b/engines/m4/mem/memman.cpp
new file mode 100644
index 00000000000..65f69d705fd
--- /dev/null
+++ b/engines/m4/mem/memman.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/kernel.h"
+
+namespace M4 {
+
+} // namespace M4
diff --git a/engines/m4/mem/memman.h b/engines/m4/mem/memman.h
new file mode 100644
index 00000000000..c18ac4a9a5f
--- /dev/null
+++ b/engines/m4/mem/memman.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 M4_MEM_MEMMAN_H
+#define M4_MEM_MEMMAN_H
+
+#include "common/memory.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+inline Handle mem_alloc(size_t size, const char *type) {
+ return (Handle)malloc(size);
+}
+
+inline void mem_free(Handle ptr) {
+ free(ptr);
+}
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
new file mode 100644
index 00000000000..6b2e906c2eb
--- /dev/null
+++ b/engines/m4/mem/reloc.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 M4_RELOC_H
+#define M4_RELOC_H
+
+#include "common/str.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+inline void HNoPurge(Handle h) {
+}
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
new file mode 100644
index 00000000000..23263ef8bcd
--- /dev/null
+++ b/engines/m4/mem/res.cpp
@@ -0,0 +1,212 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/file.h"
+#include "common/textconsole.h"
+#include "m4/mem/res.h"
+#include "m4/mem/memman.h"
+#include "m4/mem/reloc.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define PRIME 8179
+#define HASHSIZE MAX_RESOURCES
+#define FULLY_BUFFERED 1
+#define MARKED_PURGE 0x80
+
+Resources::~Resources() {
+ delete _fp;
+ // TODO: Delete resource entries
+}
+
+
+Resources::Entry *Resources::findAndSetResEntry(const Common::String &resourceName) {
+ int orig_hash_val;
+ int hash_val;
+ Entry *res = nullptr;
+
+ Common::String resName = resourceName;
+ resName.toLowercase();
+ hash_val = hash(resName);
+
+ // If empty slot at this hash, then we're done
+ if (!_resources[hash_val].Flags)
+ goto got_one;
+
+ // Flags is set, so scan until Flags is clear, or the resource name strings match
+ orig_hash_val = hash_val;
+
+ while ((_resources[hash_val].Flags & FULLY_BUFFERED)
+ && !resName.equalsIgnoreCase(_resources[hash_val].name)) {
+ // if we searched every entry to no avail:
+ if ((hash_val = ++hash_val & (HASHSIZE - 1)) == orig_hash_val)
+ goto test4;
+ }
+
+ goto got_one;
+
+test4:
+ hash_val = orig_hash_val;
+ while (!(_resources[hash_val].Flags & MARKED_PURGE))
+ // if we searched every entry to no avail:
+ if ((hash_val = ++hash_val & (HASHSIZE - 1)) == orig_hash_val) {
+ error("Out of resource space");
+ }
+
+ res = &_resources[hash_val];
+ delete[] res->RHandle;
+ res->RHandle = nullptr;
+
+got_one:
+ res = &_resources[hash_val];
+ res->name = resName;
+ res->Flags = FULLY_BUFFERED;
+
+ return res;
+}
+
+int Resources::hash(const Common::String &sym) const {
+ int ret_val = 0;
+
+ const char *s = sym.c_str();
+ while (*s) {
+ ret_val += *s++;
+ ret_val *= PRIME;
+ }
+
+ return ret_val & (HASHSIZE - 1);
+}
+
+Handle Resources::rget(const Common::String &resourceName, int32 *resourceSize) {
+ Entry *resEntry;
+
+ if (resourceSize)
+ *resourceSize = 0;
+
+ if (!(resEntry = findAndSetResEntry(resourceName))) {
+ term_message("rgetting:%s -> failed!", resourceName.c_str());
+ return nullptr;
+ }
+
+ // Check if resource is fully buffered
+ // All resources are currently fully buffered!
+ if (!(resEntry->Flags & FULLY_BUFFERED)) {
+ term_message("rgetting:%s -> failed!", resourceName.c_str());
+ return nullptr;
+ }
+
+ // If there's a handle with some memory in it
+ // Resource is cached; unmark purge flag and return handle
+// TODO: Review whether Handle is a pointer or a pointer pointer
+ if (resEntry->RHandle && *resEntry->RHandle) {
+ if (resourceSize)
+ *resourceSize = resEntry->Size;
+
+ HNoPurge(resEntry->RHandle);
+ resEntry->Flags &= ~MARKED_PURGE;
+ term_message("rgetting:%s -> from memory", resourceName.c_str());
+ return resEntry->RHandle;
+ }
+
+ // Check if size known
+ if ((resEntry->Size = get_file(resEntry->name)) == -1)
+ error("Error getting entry %s", resEntry->name.c_str());
+
+ // Check if buffer size is set
+ if (resEntry->BufferSize != resEntry->Size)
+ resEntry->BufferSize = resEntry->Size;
+/*
+ // Check if resource handle allocated
+ if (!resEntry->RHandle)
+ if (!(resEntry->RHandle = MakeNewHandle(resEntry->BufferSize, resEntry->Name))) {
+ res_err = MEMORY;
+#ifdef MEM_DEBUG_FILE
+ {
+ FILE *f = f_io_open("mem.dbg", "a");
+
+ fprintf(f, "Fail to find %u bytes for %s...\n", resEntry->BufferSize, ResourceName);
+ f_io_close(f);
+ DumpMem("After MakeNewHandle() fail in rget...");
+ }
+#endif
+ term_message("rgetting:%s -> failed!", ResourceName);
+ error_show(FL, 'OOM!', "rget %s", resEntry->Name);
+ return nullptr;
+ }
+
+ // Check if resource handle has valid memory block allocated to it
+
+ if (!*resEntry->RHandle)
+ if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->Name)) {
+ if (MakeMem(resEntry->BufferSize, resEntry->Name)) {
+ if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->Name)) {
+ term_message("rgetting:%s -> failed!", ResourceName);
+ return nullptr;
+ }
+ } else {
+ res_err = MEMORY;
+#ifdef MEM_DEBUG_FILE
+ {
+ FILE *f = f_io_open("mem.dbg", "a");
+
+ fprintf(f, "Fail to find %u bytes for %s...\n", resEntry->BufferSize, ResourceName);
+ f_io_close(f);
+ DumpMem("After mem_ReallocateHandle() fail in rget...");
+ }
+#endif
+ term_message("rgetting:%s -> failed!", ResourceName);
+ return nullptr;
+ }
+ }
+
+ if (!do_file(resEntry->RHandle, ResourceName))
+ error_show(FL, 'RIOD', "%s", ResourceName);
+
+ if (resourceSize) // xi change
+ *resourceSize = resEntry->Size;
+
+#ifdef MEM_DEBUG_FILE
+ {
+ FILE *f = f_io_open("rio.dbg", "a");
+
+ fprintf(f, "Load (%7u) %s '%s'\n", resEntry->Size, Tim(), ResourceName);
+ f_io_close(f);
+ }
+#endif
+*/
+ term_message("rgetting:%s -> from disk", resourceName.c_str());
+ return resEntry->RHandle;
+}
+
+
+int32 Resources::get_file(const Common::String &name) {
+ assert(!_fp);
+ _fp = new SysFile(name);
+ assert(_fp);
+
+ if (!_fp->exists())
+ error("get_file - getting %s", name.c_str());
+
+ return _fp->size();
+}
+
+} // namespace M4
diff --git a/engines/m4/mem/res.h b/engines/m4/mem/res.h
new file mode 100644
index 00000000000..31d7ba2d34b
--- /dev/null
+++ b/engines/m4/mem/res.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_MEM_RES_H
+#define M4_MEM_RES_H
+
+#include "common/str.h"
+#include "m4/mem/memman.h"
+#include "m4/fileio/sys_file.h"
+
+namespace M4 {
+
+#define MAX_RESOURCES (1 << 7)
+
+typedef void **ResHandle;
+
+class Resources {
+ struct Entry {
+ Common::String name;
+ ResHandle RHandle = nullptr;
+ size_t BufferSize = 0;
+ uint32 Size = 0;
+ byte Flags = 0;
+ };
+private:
+ Entry _resources[MAX_RESOURCES];
+ SysFile *_fp = nullptr;
+
+ Entry *findAndSetResEntry(const Common::String &resourceName);
+ int hash(const Common::String &sym) const;
+ int32 get_file(const Common::String &name);
+
+public:
+ ~Resources();
+
+ Handle rget(const Common::String &resourceName, int32 *ResourceSize);
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 338284b06ff..bc76366cd83 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -3,13 +3,20 @@ MODULE := engines/m4
MODULE_OBJS = \
m4.o \
console.o \
- f_info.o \
game.o \
globals.o \
kernel.o \
metaengine.o \
param.o \
+ res.o \
term.o \
+ adv_r/db_env.o \
+ adv_r/db_rmlst.o \
+ fileio/extensions.o \
+ fileio/fileio.o \
+ fileio/info.o \
+ fileio/sys_file.o \
+ mem/memman.o \
burger/burger.o
# This module can be built as a plugin
diff --git a/engines/m4/term.cpp b/engines/m4/term.cpp
index 6afccc14c08..616a1ee500b 100644
--- a/engines/m4/term.cpp
+++ b/engines/m4/term.cpp
@@ -23,6 +23,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "m4/term.h"
+#include "m4/globals.h"
namespace M4 {
@@ -55,8 +56,16 @@ void Term::set_mode(TermMode mode) {
}
}
-void Term::message(const Common::String &msg) {
+void Term::message(const char *fmt, ...) {
+ va_list va;
+ va_start(va, fmt);
+ vmessage(fmt, va);
+ va_end(va);
+}
+
+void Term::vmessage(const char *fmt, va_list va) {
if (_mode != MEMORY_MODE) {
+ Common::String msg = Common::String::vformat(fmt, va);
debug("%s\n", msg.c_str());
if (_file) {
@@ -67,4 +76,11 @@ void Term::message(const Common::String &msg) {
}
}
+inline void term_message(const char *fmt, ...) {
+ va_list va;
+ va_start(va, fmt);
+ _G(term).vmessage(fmt, va);
+ va_end(va);
+}
+
} // namespace M4
diff --git a/engines/m4/term.h b/engines/m4/term.h
index 9c01b05c64e..2154eb9d047 100644
--- a/engines/m4/term.h
+++ b/engines/m4/term.h
@@ -57,9 +57,12 @@ public:
/**
* Show a message
*/
- void message(const Common::String &msg);
+ void message(const char *fmt, ...);
+ void vmessage(const char *fmt, va_list va);
};
+inline void term_message(const char *fmt, ...);
+
} // namespace M4
#endif
Commit: c7040048dba27276182bdd22d5831ebdc0e0663f
https://github.com/scummvm/scummvm/commit/c7040048dba27276182bdd22d5831ebdc0e0663f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished rget, SysFile methods
Changed paths:
A engines/m4/adv_r/adv.h
A engines/m4/mem/reloc.cpp
engines/m4/fileio/sys_file.cpp
engines/m4/fileio/sys_file.h
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/m4_types.h
engines/m4/mem/reloc.h
engines/m4/mem/res.cpp
engines/m4/mem/res.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
new file mode 100644
index 00000000000..f53eb0d830d
--- /dev/null
+++ b/engines/m4/adv_r/adv.h
@@ -0,0 +1,82 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_H
+#define M4_ADV_R_ADV_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct HotSpotRec {
+ int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
+ int32 feet_x = 0, feet_y = 0; // Walk-to target for player
+ int8 facing = 0; // Direction player should face
+ bool active = false; // Flag if hotspot is active
+ char cursor_number = 0; // Mouse cursor number
+ char syntax = 0; // Word syntax
+ int32 vocabID = 0, verbID = 0; // ids of name and verb
+ char *vocab = nullptr; // Vocabulary name of hotspot
+ char *verb = nullptr; // Vocabulary default verb name
+ char *prep = nullptr; // Preposition
+ char *sprite = nullptr; // Sprite name
+ int16 hash = 0; // woodscript sprite hash (runtime only)
+ HotSpotRec *next = nullptr;
+};
+
+struct pathNode {
+ pathNode *next = nullptr;
+ byte nodeID = 0;
+};
+
+struct noWalkRect {
+ noWalkRect *next = nullptr;
+ noWalkRect *prev = nullptr;
+ int32 x1 = 0, y1 = 0, x2 = 0, y2 = 0;
+ int32 alternateWalkToNode = 0;
+ int32 walkAroundNode1 = 0;
+ int32 walkAroundNode2 = 0;
+ int32 walkAroundNode3 = 0;
+ int32 walkAroundNode4 = 0;
+};
+
+struct SceneDef {
+ char art_base[MAX_FILENAME_SIZE] = { 0 };
+ char picture_base[MAX_FILENAME_SIZE] = { 0 };
+
+ int32 num_hotspots = 0; // # of hotspots
+ HotSpotRec *hotspots = nullptr;
+ int32 num_parallax = 0;
+ HotSpotRec *parallax = nullptr;
+ int32 num_props = 0;
+ HotSpotRec *props = nullptr;
+
+ int32 front_y = 100, back_y = 100; // Player scaling baselines
+ int32 front_scale = 100, back_scale = 100; // Player scaling factors
+
+ int16 depth_table[16] = { 0 }; // Player sprite depth table
+ int32 numRailNodes = 0; // # of rails
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index f4820833b33..980a72e393c 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -34,7 +34,7 @@ namespace M4 {
#define HASH_RECORD_LENGTH 47
SysFile::SysFile(const Common::String &fname, FileMode myfmode) :
- filename(fname), fmode(myfmode) {
+ filename(fname), fmode(myfmode) {
}
bool SysFile::exists() {
@@ -61,9 +61,7 @@ uint32 SysFile::size() {
open_read();
if (!_G(hag).hag_flag) {
- Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(_fp);
- assert(rs);
- fsize = rs->size();
+ fsize = rs()->size();
} else {
if (hag_success)
@@ -75,6 +73,21 @@ uint32 SysFile::size() {
return fsize;
}
+uint32 SysFile::get_pos() {
+ if (!_G(hag).hag_flag) {
+ if (!_fp)
+ return 0;
+
+ return rs()->pos();
+
+ } else {
+ if (hag_success)
+ return (uint32)(curr_hag_record->hag_pos - curr_hash_record.offset);
+ else
+ return 0;
+ }
+}
+
void SysFile::open_read_low_level() {
Common::File temp_fp;
uint32 hash_table_size;
@@ -268,8 +281,7 @@ bool SysFile::open_hash_file() {
temp_ptr = _G(hag).hag_file_list;
// Search local open files for hag file...
- while (temp_ptr)
- {
+ while (temp_ptr) {
if (hag_name.equalsIgnoreCase(temp_ptr->hag_name)) {
found = true;
break;
@@ -278,7 +290,7 @@ bool SysFile::open_hash_file() {
}
// Search resource directory open files for hag file
- if (!found) {
+ if (!found) {
temp_ptr = _G(hag).hag_file_list;
found = false;
while (temp_ptr) {
@@ -389,7 +401,7 @@ uint32 SysFile::key_to_hash_address(const Common::String &src, uint32 hash_table
}
int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_record_ptr, Hag_Record *current_hag_record, uint32 hash_address,
- Common::SeekableReadStream *hashfp, uint32 hash_table_size, bool show_errors) {
+ Common::SeekableReadStream *hashfp, uint32 hash_table_size, bool show_errors) {
uint32 offset;
bool finded = false;
char myfilename[33];
@@ -432,7 +444,7 @@ int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_
get_local_name_from_hagfile(local_name, current_hash_record_ptr->hagfile);
local_hag_name = f_extension_new(local_name, "HAG");
local_name = local_hag_name;
-// sprintf(local_name, "%s%s", exec_path, local_hag_name);
+ // sprintf(local_name, "%s%s", exec_path, local_hag_name);
if (Common::File::exists(local_name)) {
finded = 1;
@@ -518,4 +530,78 @@ bool SysFile::get_local_name_from_hagfile(Common::String &local_name, byte hagfi
return found;
}
+bool SysFile::seek(uint32 pos) {
+ if (!_G(hag).hag_flag) {
+ return rs()->seek(pos);
+
+ } else {
+ if (hag_success) {
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(curr_hag_record->hag_fp);
+ assert(rs);
+
+ if (rs->seek(curr_hash_record.offset + pos - curr_hag_record->hag_pos, SEEK_CUR))
+ term_message("fail to fseek");
+ last_head_pos = rs->pos();
+
+ curr_hag_record->hag_pos = curr_hash_record.offset + pos; // change file position
+ return true;
+
+ } else {
+ return false;
+ }
+ }
+}
+
+uint32 SysFile::read(MemHandle bufferHandle) {
+ int32 bytesToRead;
+
+ bytesToRead = size() - get_pos();
+ if (bytesToRead < 0)
+ error("SysFile::read - %s", filename.c_str());
+
+ return read(bufferHandle, (int32)bytesToRead);
+}
+
+int32 SysFile::read(MemHandle bufferHandle, int32 n) {
+ uint32 temp_size;
+
+ if (!bufferHandle)
+ error("reading %s", filename.c_str());
+
+ open_read();
+
+ if (!*bufferHandle)
+ mem_ReallocateHandle(bufferHandle, n);
+ if (!*bufferHandle)
+ error("Needed %d to read info", n);
+
+ if (!_G(hag).hag_flag) {
+ return (uint32)rs()->read(*bufferHandle, n);
+
+ } else {
+ // Hag mode
+ if (hag_success) {
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(curr_hag_record->hag_fp);
+ assert(rs);
+ rs->seek(last_head_pos);
+ uint32 temp_myfpos = rs->pos();
+
+ temp_size = (uint32)rs->read(*bufferHandle, n);
+ curr_hag_record->hag_pos = temp_myfpos + temp_size; // Change file position
+
+ last_head_pos = rs->pos();
+ return temp_size;
+
+ } else {
+ return 0;
+ }
+ }
+}
+
+Common::SeekableReadStream *SysFile::rs() const {
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(_fp);
+ assert(rs);
+ return rs;
+}
+
} // namespace M4
diff --git a/engines/m4/fileio/sys_file.h b/engines/m4/fileio/sys_file.h
index ab1cf2a7167..cae29f3308e 100644
--- a/engines/m4/fileio/sys_file.h
+++ b/engines/m4/fileio/sys_file.h
@@ -24,6 +24,7 @@
#include "common/file.h"
#include "m4/fileio/fileio.h"
+#include "m4/mem/reloc.h"
namespace M4 {
@@ -46,7 +47,6 @@ struct Hag_Statics {
class SysFile {
private:
Common::Stream *_fp = nullptr;
- Common::String filename;
FileMode fmode;
AccessMode mode = UNOPENED;
int hag_success = 0;
@@ -84,6 +84,11 @@ private:
bool get_local_name_from_hagfile(Common::String &local_name, byte hagfile);
+ Common::SeekableReadStream *rs() const;
+
+public:
+ Common::String filename;
+
public:
SysFile(const Common::String &fname, FileMode myfmode = BINARY);
@@ -96,6 +101,22 @@ public:
* Returns the file size
*/
uint32 size();
+
+ /**
+ * Gets the current position
+ */
+ uint32 get_pos();
+
+ /**
+ * Seek to a given position
+ */
+ bool seek(uint32 pos);
+
+ /**
+ * Read data
+ */
+ uint32 read(MemHandle bufferHandle);
+ int32 read(MemHandle bufferHandle, int32 n);
};
} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 70c05fef599..97a6885bd00 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -26,6 +26,7 @@
#include "m4/kernel.h"
#include "m4/term.h"
#include "m4/fileio/sys_file.h"
+#include "m4/adv_r/adv.h"
namespace M4 {
@@ -43,6 +44,7 @@ struct Globals {
Kernel _kernel;
Term _term;
Hag_Statics _hag;
+ SceneDef currentSceneDef;
bool _system_shutting_down = false;
size_t _mem_to_alloc = 0;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 306a8786c8d..95a17c6347c 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -76,7 +76,6 @@ Common::Error M4Engine::run() {
void M4Engine::game_systems_initialize() {
_G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
-
size_t totalMem = _G(kernel).mem_avail();
if (_G(kernel).suppress_cache == CACHE_NOT_OVERRIDE_BY_FLAG_PARSE)
_G(kernel).suppress_cache = totalMem < 8000000;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 0999f68937b..bb614093bb4 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -26,6 +26,8 @@
namespace M4 {
+#define MAX_FILENAME_SIZE 144
+
typedef void *Ptr;
typedef void *Handle;
diff --git a/engines/m4/mem/reloc.cpp b/engines/m4/mem/reloc.cpp
new file mode 100644
index 00000000000..f2c87be4c02
--- /dev/null
+++ b/engines/m4/mem/reloc.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 "m4/mem/reloc.h"
+
+namespace M4 {
+
+struct HR {
+ void *_data;
+};
+
+MemHandle NewHandle(size_t size, const char *) {
+ HR *result = (HR *)malloc(sizeof(HR));
+ result->_data = malloc(size);
+
+ return (MemHandle)result;
+}
+
+bool mem_ReallocateHandle(MemHandle h, size_t size, const char *) {
+ HR *hr = (HR *)h;
+ assert(!hr->_data);
+ hr->_data = malloc(size);
+
+ return true;
+}
+
+} // namespace M4
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
index 6b2e906c2eb..e33e1299405 100644
--- a/engines/m4/mem/reloc.h
+++ b/engines/m4/mem/reloc.h
@@ -22,13 +22,20 @@
#ifndef M4_RELOC_H
#define M4_RELOC_H
-#include "common/str.h"
#include "m4/m4_types.h"
namespace M4 {
+typedef void **MemHandle;
+
inline void HNoPurge(Handle h) {
}
+inline bool MakeMem(size_t FreeBlockNeeded, const char *) {
+ return true;
+}
+
+MemHandle MakeNewHandle(size_t size, const char *name = nullptr);
+bool mem_ReallocateHandle(MemHandle h, size_t size, const char *name = nullptr);
} // namespace M4
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index 23263ef8bcd..555bf77c76e 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -116,7 +116,6 @@ Handle Resources::rget(const Common::String &resourceName, int32 *resourceSize)
// If there's a handle with some memory in it
// Resource is cached; unmark purge flag and return handle
-// TODO: Review whether Handle is a pointer or a pointer pointer
if (resEntry->RHandle && *resEntry->RHandle) {
if (resourceSize)
*resourceSize = resEntry->Size;
@@ -134,65 +133,32 @@ Handle Resources::rget(const Common::String &resourceName, int32 *resourceSize)
// Check if buffer size is set
if (resEntry->BufferSize != resEntry->Size)
resEntry->BufferSize = resEntry->Size;
-/*
+
// Check if resource handle allocated
if (!resEntry->RHandle)
- if (!(resEntry->RHandle = MakeNewHandle(resEntry->BufferSize, resEntry->Name))) {
- res_err = MEMORY;
-#ifdef MEM_DEBUG_FILE
- {
- FILE *f = f_io_open("mem.dbg", "a");
-
- fprintf(f, "Fail to find %u bytes for %s...\n", resEntry->BufferSize, ResourceName);
- f_io_close(f);
- DumpMem("After MakeNewHandle() fail in rget...");
- }
-#endif
- term_message("rgetting:%s -> failed!", ResourceName);
- error_show(FL, 'OOM!', "rget %s", resEntry->Name);
- return nullptr;
- }
+ if (!(resEntry->RHandle = MakeNewHandle(resEntry->BufferSize, resEntry->name.c_str())))
+ error("rgetting: %s -> failed", resEntry->name.c_str());
// Check if resource handle has valid memory block allocated to it
-
if (!*resEntry->RHandle)
- if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->Name)) {
- if (MakeMem(resEntry->BufferSize, resEntry->Name)) {
- if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->Name)) {
- term_message("rgetting:%s -> failed!", ResourceName);
+ if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->name.c_str())) {
+ if (MakeMem(resEntry->BufferSize, resEntry->name.c_str())) {
+ if (!mem_ReallocateHandle(resEntry->RHandle, resEntry->BufferSize, resEntry->name.c_str())) {
+ term_message("rgetting:%s -> failed!", resourceName.c_str());
return nullptr;
}
} else {
- res_err = MEMORY;
-#ifdef MEM_DEBUG_FILE
- {
- FILE *f = f_io_open("mem.dbg", "a");
-
- fprintf(f, "Fail to find %u bytes for %s...\n", resEntry->BufferSize, ResourceName);
- f_io_close(f);
- DumpMem("After mem_ReallocateHandle() fail in rget...");
- }
-#endif
- term_message("rgetting:%s -> failed!", ResourceName);
+ term_message("rgetting:%s -> failed!", resourceName.c_str());
return nullptr;
}
}
- if (!do_file(resEntry->RHandle, ResourceName))
- error_show(FL, 'RIOD', "%s", ResourceName);
+ if (!do_file(resEntry->RHandle))
+ error("rget: do_file -> %s", resourceName.c_str());
if (resourceSize) // xi change
*resourceSize = resEntry->Size;
-#ifdef MEM_DEBUG_FILE
- {
- FILE *f = f_io_open("rio.dbg", "a");
-
- fprintf(f, "Load (%7u) %s '%s'\n", resEntry->Size, Tim(), ResourceName);
- f_io_close(f);
- }
-#endif
-*/
term_message("rgetting:%s -> from disk", resourceName.c_str());
return resEntry->RHandle;
}
@@ -209,4 +175,21 @@ int32 Resources::get_file(const Common::String &name) {
return _fp->size();
}
+bool Resources::do_file(MemHandle buffer) {
+ _fp->seek(0);
+
+ bool result = true;
+
+ // read in resource from file
+ if (!_fp->read(buffer)) {
+ term_message("unable to read: %s", _fp->filename.c_str());
+ result = false;
+ }
+
+ delete _fp;
+ _fp = nullptr;
+
+ return result;
+}
+
} // namespace M4
diff --git a/engines/m4/mem/res.h b/engines/m4/mem/res.h
index 31d7ba2d34b..538e2f97544 100644
--- a/engines/m4/mem/res.h
+++ b/engines/m4/mem/res.h
@@ -47,6 +47,7 @@ private:
Entry *findAndSetResEntry(const Common::String &resourceName);
int hash(const Common::String &sym) const;
int32 get_file(const Common::String &name);
+ bool do_file(MemHandle buffer);
public:
~Resources();
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index bc76366cd83..b12f3b7b961 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -17,6 +17,7 @@ MODULE_OBJS = \
fileio/info.o \
fileio/sys_file.o \
mem/memman.o \
+ mem/reloc.o \
burger/burger.o
# This module can be built as a plugin
Commit: a4ffe08595cfe6fb070f7e0240507814ca065b0e
https://github.com/scummvm/scummvm/commit/a4ffe08595cfe6fb070f7e0240507814ca065b0e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added font code
Changed paths:
A engines/m4/core/errors.cpp
A engines/m4/core/errors.h
A engines/m4/core/imath.cpp
A engines/m4/core/imath.h
A engines/m4/graphics/gr_buff.cpp
A engines/m4/graphics/gr_buff.h
A engines/m4/graphics/gr_font.cpp
A engines/m4/graphics/gr_font.h
A engines/m4/graphics/gr_pal.cpp
A engines/m4/graphics/gr_pal.h
A engines/m4/graphics/graphics.cpp
A engines/m4/graphics/graphics.h
engines/m4/globals.h
engines/m4/m4_types.h
engines/m4/module.mk
diff --git a/engines/m4/core/errors.cpp b/engines/m4/core/errors.cpp
new file mode 100644
index 00000000000..119af547b59
--- /dev/null
+++ b/engines/m4/core/errors.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/str.h"
+#include "common/textconsole.h"
+#include "m4/core/errors.h"
+
+namespace M4 {
+
+void error_show(const char *filename, uint32 line, quadchar errorcode, const char *fmt, ...) {
+ va_list va;
+ va_start(va, fmt);
+ Common::String msg = Common::String::vformat(fmt, va);
+ va_end(va);
+
+ error("%s", msg.c_str());
+}
+
+void error_show(const char *filename, uint32 line, quadchar errorcode) {
+ error_show(filename, line, errorcode, "No extra description");
+}
+
+} // namespace M4
diff --git a/engines/m4/core/errors.h b/engines/m4/core/errors.h
new file mode 100644
index 00000000000..a755cf63314
--- /dev/null
+++ b/engines/m4/core/errors.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_CORE_ERRORS_H
+#define M4_CORE_ERRORS_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define FL __FILE__,__LINE__
+
+extern void error_show(const char *filename, uint32 line, quadchar errorcode, const char *fmt, ...);
+extern void error_show(const char *filename, uint32 line, quadchar errorcode);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/core/imath.cpp b/engines/m4/core/imath.cpp
new file mode 100644
index 00000000000..27a80268e05
--- /dev/null
+++ b/engines/m4/core/imath.cpp
@@ -0,0 +1,119 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/core/imath.h"
+
+namespace M4 {
+
+unsigned long sqrtul(unsigned long v) {
+ unsigned long r = 0, s;
+
+#define STEP(k) s = r + (1L << k * 2); r >>= 1; \
+ if (s <= v) { v -= s; r |= (1L << k * 2); }
+
+ STEP(15);
+ STEP(14);
+ STEP(13);
+ STEP(12);
+ STEP(11);
+ STEP(10);
+ STEP(9);
+ STEP(8);
+ STEP(7);
+ STEP(6);
+ STEP(5);
+ STEP(4);
+ STEP(3);
+ STEP(2);
+ STEP(1);
+ STEP(0);
+
+ return r;
+#undef STEP
+}
+
+int32 imath_min(int32 a, int32 b) {
+ return ((a < b) ? a : b);
+}
+
+int32 imath_max(int32 a, int32 b) {
+ return ((a > b) ? a : b);
+}
+
+int32 imath_abs(int32 a) {
+ return ((a >= 0) ? a : -a);
+}
+
+static int32 seed;
+
+void imath_seed(int32 seednum) {
+ seed = seednum;
+}
+
+uint32 imath_random() {
+ return(seed = (25173 * seed + 13849) & 0xffff);
+}
+
+int32 imath_ranged_rand(int32 a, int32 b) {
+ int32 result;
+ result = (a + (((1 + imath_abs(b - a)) * imath_random()) >> 16));
+ return result;
+}
+
+frac16 imath_ranged_rand16(frac16 a, frac16 b) {
+ frac16 result;
+ result = ((a + MulSF16(1 + imath_abs(b - a), imath_random())));
+ return result;
+}
+
+frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2) {
+ if ((x2 -= x1) < 0) x2 = -x2;
+ if ((y2 -= y1) < 0) y2 = -y2;
+ return (x2 + y2 - (((x2 > y2) ? y2 : x2) >> 1));
+}
+
+#define STEP(k) s = r + (1L << k * 2); r >>= 1; \
+ if (s <= v) { v -= s; r |= (1L << k * 2); }
+
+frac16 SqrtF16(frac16 n) {
+ ulong r = 0, s, v;
+ v = (ulong)n;
+
+ STEP(15);
+ STEP(14);
+ STEP(13);
+ STEP(12);
+ STEP(11);
+ STEP(10);
+ STEP(9);
+ STEP(8);
+ STEP(7);
+ STEP(6);
+ STEP(5);
+ STEP(4);
+ STEP(3);
+ STEP(2);
+ STEP(1);
+ STEP(0);
+ return (frac16)r;
+}
+
+} // namespace M4
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
new file mode 100644
index 00000000000..57ccbb7740f
--- /dev/null
+++ b/engines/m4/core/imath.h
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_CORE_IMATH_H
+#define M4_CORE_IMATH_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define FRAC16(a,b) ((a<<16) + (b))
+
+#define Atan2F16(x1, x2) ArcTan(x1, x2)
+#define MulSF16(x1, x2) FixedMul(x1, x2)
+#define DivSF16(x1, x2) FixedDiv(x1, x2)
+#define RecipUF16(x) FixedDiv(1, x)
+#define SquareSF16(x) FixedMul(x, x)
+
+frac16 FixedMul(frac16 Multiplicand, frac16 Multiplier);
+frac16 FixedDiv(frac16 Dividend, frac16 Divisor);
+
+unsigned long sqrtul(unsigned long v);
+
+int32 imath_max(int32 a, int32 b);
+int32 imath_min(int32 a, int32 b);
+int32 imath_abs(int32 a);
+
+void imath_seed(int32 seednum);
+uint32 imath_random();
+int32 imath_ranged_rand(int32 a, int32 b);
+frac16 imath_ranged_rand16(frac16 a, frac16 b);
+
+frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2);
+frac16 SqrtF16(frac16 n);
+frac16 ArcTan(frac16 x, frac16 y);
+
+short HighWord(long n);
+short LowWord(long n);
+
+uint32 convert_intel32(uint32 a);
+uint16 convert_intel16(uint16 a);
+
+//
+// I N L I N E S
+//
+
+inline static short abs(short a) {
+ return (a >= 0) ? a : -a;
+}
+
+inline static long abs(long a) {
+ return (a >= 0) ? a : -a;
+}
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 97a6885bd00..2f09690125d 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -25,8 +25,9 @@
#include "m4/game.h"
#include "m4/kernel.h"
#include "m4/term.h"
-#include "m4/fileio/sys_file.h"
#include "m4/adv_r/adv.h"
+#include "m4/fileio/sys_file.h"
+#include "m4/graphics/gr_font.h"
namespace M4 {
@@ -44,7 +45,18 @@ struct Globals {
Kernel _kernel;
Term _term;
Hag_Statics _hag;
- SceneDef currentSceneDef;
+ SceneDef _currentSceneDef;
+
+ Font *_system_font = nullptr;
+ Font *_font_line = nullptr;
+ Font *_font_tiny_prop = nullptr;
+ Font *_font_tiny = nullptr;
+ Font *_font_inter = nullptr;
+ Font *_font_conv = nullptr;
+ Font *_font_menu = nullptr;
+ Font *_font_misc = nullptr;
+ Font *_interfaceFont = nullptr;
+ Font *_font = nullptr;
bool _system_shutting_down = false;
size_t _mem_to_alloc = 0;
@@ -54,6 +66,7 @@ struct Globals {
int _global_sound_room = 0;
bool _interface_visible = false;
bool _please_hyperwalk = false;
+ void (*_custom_ascii_converter)(char *string);
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
new file mode 100644
index 00000000000..d96b52427b0
--- /dev/null
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -0,0 +1,140 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_buff.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/core/errors.h"
+#include "m4/mem/memman.h"
+
+namespace M4 {
+
+int32 gr_buffer_free(Buffer *buf) {
+ buf->W = buf->h = buf->stride = 0;
+
+ if (buf->data != NULL) {
+ mem_free((char *)buf->data);
+ buf->data = NULL;
+ return true;
+ }
+
+ error_show(FL, 'BUF!');
+ return false;
+}
+
+char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y) {
+ if (!buf || !buf->data || y < 0 || x < 0) {
+ error_show(FL, 'BUF!', "buffer_pointer x,y = %ld,%ld", x, y);
+ return 0;
+ }
+ return (char *)(buf->data + x + (y * buf->stride));
+}
+
+int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h) {
+ if (buf->data)
+ error_show(FL, 'BUFR', "buffer_init %s", name);
+
+ buf->W = w;
+ buf->h = h;
+ buf->stride = w;
+
+ buf->data = (uint8 *)mem_alloc(buf->stride * h, name);
+ if (buf->data == NULL)
+ error_show(FL, 'OOM!', "buffer: %s - w:%ld h:%ld bytes:%ld", name, buf->stride, h, buf->stride * h);
+
+ memset(buf->data, 0, buf->stride * h);
+
+ return(true);
+}
+
+bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
+ int32 dx, int32 dy, int32 w, int32 h) {
+ // stupid check for no data
+ if (!from || !to || !from->data || !to->data)
+ error_show(FL, 'BUF!', "buff_rect_copy2");
+
+ // CKB: if height is greater than source height, truncate!
+ if (h > from->h)
+ h = from->h;
+
+ // if source x,y or dest x,y won't touch dest or source buffers, we're done
+ if ((sx > from->W) || (sy > from->h) || (dx > to->W) || (dy > to->h))
+ return true;
+
+ // if dest request intersects dest buffer, clip dest request
+ if ((dx + w) > to->W)
+ w = to->W - dx;
+ if ((dy + h) > to->h)
+ h = to->h - dy;
+
+ // if our dest request is too small, we're done
+ if ((w < 1) || (h < 1))
+ return true;
+
+ // initialize pointers
+ char *src = gr_buffer_pointer(from, sx, sy);
+ char *dest = gr_buffer_pointer(to, dx, dy);
+
+ // get stride
+ int32 sIncr = from->stride;
+ int32 dIncr = to->stride;
+
+ // copy one to d'other
+ int i;
+ for (i = 0; i < h; i++, dest += dIncr, src += sIncr)
+ memmove(dest, src, w);
+
+ return true;
+}
+
+bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, int32 h) {
+ return (gr_buffer_rect_copy_2(from, to, x, y, x, y, w, h));
+}
+
+int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h) {
+ int32 i;
+ uint8 *start;
+ char color = gr_color_get_current();
+
+ // if no data, bad.
+ if (!target || !target->data)
+ error_show(FL, 'BUF!', "buffer_rect_fill");
+
+ // if nothing to fill, we're done
+ if ((w < 1) || (h < 1) || (x1 > target->W) || (y1 > target->h))
+ return true;
+
+ // clip if rectangles too big
+ if ((x1 + w) > target->W)
+ w = target->W - x1;
+ if ((y1 + h) > target->h)
+ h = target->h - y1;
+
+ if ((w < 1) || (h < 1))
+ return true;
+
+ start = target->data + y1 * target->stride + x1;
+ for (i = 0; i < h; i++, start += target->stride)
+ memset(start, color, w);
+
+ return true;
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
new file mode 100644
index 00000000000..f5f067263ed
--- /dev/null
+++ b/engines/m4/graphics/gr_buff.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_BUFF_H
+#define M4_GRAPHICS_GR_BUFF_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+int32 gr_buffer_free(Buffer *buf);
+char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
+int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
+
+/**
+ * Copies a "rectangular" buffer area from "from" to "unto". Size
+ * of copied rectangle is determined by "size_x, size_y". Upper left
+ * corner in source buffer is indicated by "from_x, from_y", and
+ * "unto_x, unto_y" determines upper left corner in destination
+ * buffer (if upper left corner coordinates are the same in both
+ * buffers, buf_rect_copy() can be used instead).
+ * @returns Returns true if successful.
+ */
+bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
+ int32 dx, int32 dy, int32 w, int32 h);
+
+/**
+ * Copies a "rectangular" buffer area from "from" to "unto". Size
+ * of copied rectangle is determined by "size_x, size_y". Upper left
+ * corner in BOTH buffers is indicated by "ul_x, ul_y". (To copy
+ * using separate corner coordinates in each buffer, use
+ * buf_rect_copy_2 ().
+ * @returns Returns true if successful.
+ */
+bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, int32 h);
+
+/**
+ * Fills a rectangular buffer area with the specified byte value.
+ * Upper left corner is determined by "ul_x, ul_y", and sizes are
+ * determined by "size_x, size_y."
+ * @returns Returns true if successful; false if buffer invalid.
+ */
+int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h);
+
+void GrBuff_Show(void *s, void *r, void *b, int32 destX, int32 destY);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
new file mode 100644
index 00000000000..a519bbc5e74
--- /dev/null
+++ b/engines/m4/graphics/gr_font.cpp
@@ -0,0 +1,328 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_font.h"
+#include "m4/graphics/gr_buff.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define font_width 2 /* offset to width array */
+#define font_data 130 /* offset to data array */
+#define STR_FONTSTRUCT "font struct"
+#define STR_FONTWIDTH "font widths"
+#define STR_FONTOFF "font offsets"
+#define STR_FONTDATA "font data"
+
+static byte font_colors[4] = { __BLACK, __WHITE, __BLACK, __DKGRAY };
+constexpr byte font_intr_w = 8;
+constexpr byte font_intr_h = 8;
+
+static byte fontintr_width[128] = {
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 00-0f width (128 entries)
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,4, // 10-1f
+ 2,3,4,5,4,6,6,3, 3,3,6,3,3,3,3,6, // 20-2f [ !"#]$%&' ()*+,-./
+ 6,6,6,6,6,6,6,6, 6,6,2,2,3,3,3,6, // 30-3f [01234567] [89:;]<=>?
+ 6,6,6,5,6,5,5,6, 6,3,5,5,6,7,6,6, // 40-4f [@ABCDEFG] [HIJKLMNO]
+ 6,6,6,6,6,6,6,6, 6,6,6,3,3,3,4,6, // 50-5f [PQRSTUVW] [XYZ[\]^_]
+ 5,5,5,5,5,5,5,5, 5,2,3,5,2,6,5,5, // 60-6f ['abcdefg] [hijklmno]
+ 5,5,3,5,3,5,5,6, 5,5,5,4,2,4,4,4, // 70-7f [pqrstuvw] []xyz{|}~^
+};
+
+static short fontintr_offsets[128] = {
+ 784, 784, 784, 784, 784, 784, 784, 784, // 00-07
+ 784, 784, 784, 784, 784, 784, 784, 784, // 08-0f
+ 784, 784, 784, 784, 784, 784, 784, 784, // 10-17
+ 784, 784, 784, 784, 784, 784, 784, 784, // 18-1f
+ 0, 8, 16, 24, 40, 48, 64, 80, // 20-27 [ !"#$%&']
+ 88, 96, 104, 120, 128, 136, 144, 152, // 28-2f [()*+,-./]
+ 168, 1176, 192, 208, 224, 240, 256, 272, // 30-37 [01234567]
+ 288, 304, 320, 328, 88, 336, 96, 344, // 38-3f [89:;]<=>?
+ 360, 376, 392, 408, 424, 440, 456, 472, // 40-47 [@ABCDEFG]
+ 488, 504, 512, 528, 544, 560, 576, 592, // 48-4f [HIJKLMNO]
+ 608, 624, 640, 656, 672, 688, 704, 720, // 50-57 [PQRSTUVW]
+ 736, 752, 768, 1192, 1208, 1200, 784, 784, // 58-5f [XYZ[\]^_]
+ 784, 800, 816, 832, 848, 864, 880, 896, // 60-67 [`abcdefg]
+ 912, 928, 936, 944, 960, 968, 984, 1000, // 68-6f [hijklmno]
+ 1016, 1032, 1048, 1056, 1072, 1080, 1096, 1112, // 70-77 [pqrstuvw]
+ 1128, 1144, 1160, 784, 184, 1216, 784, 1224 // 78-7f []xyz{|}~^
+};
+
+static byte fontintr_data[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0 " "
+ 0x14,0x14,0x14,0x14,0x14,0x00,0x14,0x00, // 8 "!"
+ 0x44,0x44,0x00,0x00,0x00,0x00,0x00,0x00, // 16 "
+ 0x00,0x00,0x11,0x00,0x55,0x40,0x11,0x00,0x11,0x00,0x55,0x40,0x11,0x00,0x00,0x00, // 24 "#"
+ 0x10,0x14,0x40,0x54,0x04,0x50,0x10,0x00, // 40 "$"
+ 0x00,0x00,0x10,0x00,0x44,0x40,0x11,0x00,0x01,0x10,0x04,0x44,0x00,0x10,0x00,0x00, // 48 "%"
+ 0x04,0x00,0x11,0x00,0x10,0x00,0x44,0x00,0x41,0x40,0x41,0x00,0x14,0x40,0x00,0x00, // 64 "&"
+ 0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, // 80 "'"
+ 0x04,0x10,0x40,0x40,0x40,0x10,0x04,0x00, // 88 "("
+ 0x40,0x10,0x04,0x04,0x04,0x10,0x40,0x00, // 96 ")"
+ 0x00,0x00,0x04,0x00,0x44,0x40,0x15,0x00,0x44,0x40,0x04,0x00,0x00,0x00,0x00,0x00, // 104 "*"
+ 0x00,0x00,0x00,0x10,0x54,0x10,0x00,0x00, // 120 "+"
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x40, // 128 ","
+ 0x00,0x00,0x00,0x00,0x54,0x00,0x00,0x00, // 136 "-"
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, // 144 "."
+ 0x00,0x04,0x00,0x10,0x00,0x40,0x01,0x00,0x04,0x00,0x10,0x00,0x40,0x00,0x00,0x00, // 152 "/"
+ 0x00,0x00,0x15,0x40,0x50,0x10,0x54,0x10,0x51,0x10,0x50,0x50,0x15,0x40,0x00,0x00, // 168 "0"
+ 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, // 184 "|"
+ 0x00,0x00,0x15,0x00,0x41,0x40,0x01,0x40,0x05,0x00,0x14,0x00,0x55,0x40,0x00,0x00, // 192 "2"
+ 0x00,0x00,0x15,0x40,0x00,0x50,0x05,0x40,0x00,0x50,0x00,0x50,0x55,0x40,0x00,0x00, // 208 "3"
+ 0x00,0x00,0x01,0x40,0x41,0x40,0x41,0x40,0x55,0x40,0x01,0x40,0x01,0x40,0x00,0x00, // 224 "4"
+ 0x00,0x00,0x55,0x50,0x50,0x00,0x55,0x40,0x00,0x50,0x00,0x50,0x55,0x40,0x00,0x00, // 240 "5"
+ 0x00,0x00,0x15,0x40,0x50,0x00,0x55,0x40,0x50,0x10,0x50,0x10,0x15,0x40,0x00,0x00, // 256 "6"
+ 0x00,0x00,0x55,0x50,0x00,0x50,0x01,0x40,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00, // 272 "7"
+ 0x00,0x00,0x15,0x40,0x50,0x10,0x15,0x40,0x50,0x10,0x50,0x10,0x15,0x40,0x00,0x00, // 288 "8"
+ 0x00,0x00,0x15,0x40,0x40,0x50,0x41,0x50,0x14,0x50,0x00,0x50,0x15,0x40,0x00,0x00, // 304 "9"
+ 0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00, // 320 ":"
+ 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x00, // 328 ";"
+ 0x00,0x00,0x00,0x54,0x00,0x54,0x00,0x00, // 336 "="
+ 0x14,0x00,0x41,0x00,0x01,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00, // 344 "?" // 352
+ 0x15,0x00,0x40,0x40,0x41,0x00,0x44,0x40,0x41,0x00,0x40,0x00,0x15,0x00,0x00,0x00, // 360 "@"
+ 0x15,0x40,0x50,0x10,0x50,0x10,0x55,0x50,0x50,0x10,0x50,0x10,0x50,0x10,0x00,0x00, // 376 "A"
+ 0x55,0x40,0x50,0x10,0x50,0x10,0x55,0x40,0x50,0x10,0x50,0x10,0x55,0x40,0x00,0x00, // 392 "B"
+ 0x15,0x00,0x50,0x40,0x50,0x00,0x50,0x00,0x50,0x00,0x50,0x40,0x15,0x00,0x00,0x00, // 408 "C"
+ 0x55,0x40,0x14,0x40,0x14,0x10,0x14,0x10,0x14,0x10,0x14,0x10,0x55,0x40,0x00,0x00, // 424 "D"
+ 0x55,0x40,0x50,0x00,0x50,0x00,0x55,0x00,0x50,0x00,0x50,0x00,0x55,0x40,0x00,0x00, // 440 "E"
+ 0x55,0x40,0x50,0x00,0x50,0x00,0x55,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x00,0x00, // 456 "F"
+ 0x15,0x40,0x50,0x10,0x50,0x00,0x51,0x50,0x50,0x10,0x50,0x10,0x15,0x40,0x00,0x00, // 472 "G"
+ 0x50,0x10,0x50,0x10,0x50,0x10,0x55,0x50,0x50,0x10,0x50,0x10,0x50,0x10,0x00,0x00, // 488 "H"
+ 0x55,0x14,0x14,0x14,0x14,0x14,0x55,0x00, // 504 "I"
+ 0x05,0x50,0x01,0x40,0x01,0x40,0x01,0x40,0x01,0x40,0x41,0x40,0x15,0x00,0x00,0x00, // 512 "J"
+ 0x50,0x40,0x51,0x00,0x54,0x00,0x50,0x00,0x54,0x00,0x51,0x00,0x50,0x40,0x00,0x00, // 528 "K"
+ 0x50,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x55,0x50,0x00,0x00, // 544 "L"
+ 0x50,0x10,0x54,0x50,0x51,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x00,0x00, // 560 "M"
+ 0x50,0x10,0x50,0x10,0x54,0x10,0x51,0x10,0x50,0x50,0x50,0x10,0x50,0x10,0x00,0x00, // 576 "N"
+ 0x15,0x40,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x15,0x40,0x00,0x00, // 592 "O"
+ 0x55,0x00,0x50,0x40,0x50,0x40,0x55,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x00,0x00, // 608 "P"
+ 0x15,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x50,0x40,0x51,0x00,0x14,0x40,0x00,0x00, // 624 "Q"
+ 0x55,0x40,0x50,0x10,0x50,0x10,0x55,0x40,0x50,0x10,0x50,0x10,0x50,0x10,0x00,0x00, // 640 "R"
+ 0x15,0x00,0x40,0x40,0x10,0x00,0x05,0x40,0x00,0x50,0x40,0x50,0x15,0x40,0x00,0x00, // 656 "S"
+ 0x55,0x50,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00, // 672 "T"
+ 0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x15,0x40,0x00,0x00, // 688 "U"
+ 0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x10,0x40,0x04,0x00,0x00,0x00, // 704 "V"
+ 0x50,0x10,0x50,0x10,0x50,0x10,0x50,0x10,0x51,0x10,0x55,0x50,0x50,0x10,0x00,0x00, // 720 "W"
+ 0x40,0x40,0x40,0x40,0x11,0x00,0x04,0x00,0x11,0x00,0x40,0x40,0x40,0x40,0x00,0x00, // 736 "X"
+ 0x40,0x40,0x40,0x40,0x11,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00, // 752 "Y"
+ 0x55,0x40,0x00,0x40,0x01,0x00,0x04,0x00,0x10,0x00,0x40,0x00,0x55,0x40,0x00,0x00, // 768 "Z"
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x40,0x00,0x00, // 784 a little weirdo thing
+ 0x00,0x00,0x00,0x00,0x15,0x00,0x01,0x40,0x11,0x40,0x41,0x40,0x14,0x40,0x00,0x00, // 800 "a"
+ 0x50,0x00,0x50,0x00,0x55,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x55,0x00,0x00,0x00, // 816 "b"
+ 0x00,0x00,0x00,0x00,0x15,0x00,0x50,0x40,0x50,0x00,0x50,0x40,0x15,0x00,0x00,0x00, // 832 "c"
+ 0x01,0x40,0x01,0x40,0x15,0x40,0x41,0x40,0x41,0x40,0x41,0x40,0x15,0x40,0x00,0x00, // 848 "d"
+ 0x00,0x00,0x00,0x00,0x15,0x00,0x50,0x40,0x55,0x40,0x50,0x00,0x15,0x00,0x00,0x00, // 864 "e"
+ 0x05,0x00,0x11,0x00,0x14,0x00,0x55,0x00,0x14,0x00,0x14,0x00,0x14,0x00,0x00,0x00, // 880 "f"
+ 0x00,0x00,0x00,0x00,0x14,0x00,0x41,0x40,0x41,0x40,0x15,0x40,0x41,0x40,0x15,0x00, // 896 "g"
+ 0x50,0x00,0x50,0x00,0x55,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x50,0x40,0x00,0x00, // 912 "h"
+ 0x50,0x00,0x50,0x50,0x50,0x50,0x50,0x00, // 928 "i"
+ 0x05,0x00,0x05,0x05,0x05,0x05,0x45,0x10, // 936 "j"
+ 0x50,0x00,0x50,0x00,0x50,0x40,0x51,0x00,0x54,0x00,0x51,0x00,0x50,0x40,0x00,0x00, // 944 "k"
+ 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x00, // 960 "l"
+ 0x00,0x00,0x00,0x00,0x54,0x40,0x51,0x10,0x51,0x10,0x51,0x10,0x51,0x10,0x00,0x00, // 968 "m"
+ 0x00,0x00,0x00,0x00,0x55,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x50,0x40,0x00,0x00, // 984 "n"
+ 0x00,0x00,0x00,0x00,0x15,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x15,0x00,0x00,0x00, // 1000 "o"
+ 0x00,0x00,0x00,0x00,0x55,0x00,0x50,0x40,0x50,0x40,0x55,0x00,0x50,0x00,0x50,0x00, // 1016 "p"
+ 0x00,0x00,0x00,0x00,0x14,0x40,0x41,0x40,0x41,0x40,0x15,0x40,0x01,0x40,0x01,0x40, // 1032 "q"
+ 0x00,0x00,0x51,0x54,0x50,0x50,0x50,0x00, // 1048 "r"
+ 0x00,0x00,0x00,0x00,0x15,0x00,0x40,0x00,0x15,0x00,0x01,0x40,0x55,0x00,0x00,0x00, // 1056 "s"
+ 0x10,0x14,0x55,0x14,0x14,0x14,0x05,0x00, // 1072 "t"
+ 0x00,0x00,0x00,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x50,0x40,0x15,0x00,0x00,0x00, // 1080 "u"
+ 0x00,0x00,0x00,0x00,0x50,0x40,0x50,0x40,0x50,0x40,0x11,0x10,0x05,0x00,0x00,0x00, // 1096 "v"
+ 0x00,0x00,0x00,0x00,0x50,0x10,0x50,0x10,0x51,0x10,0x51,0x10,0x15,0x00,0x00,0x00, // 1112 "w"
+ 0x00,0x00,0x00,0x00,0x50,0x40,0x50,0x40,0x15,0x00,0x50,0x40,0x50,0x40,0x00,0x00, // 1128 "x"
+ 0x00,0x00,0x00,0x00,0x41,0x40,0x41,0x40,0x41,0x40,0x15,0x40,0x01,0x40,0x01,0x40, // 1144 "y
+ 0x00,0x00,0x00,0x00,0x55,0x00,0x01,0x00,0x14,0x00,0x40,0x00,0x55,0x00,0x00,0x00, // 1160 "z"
+ 0x00,0x00,0x05,0x00,0x15,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x15,0x40,0x00,0x00, // 1176 thick "1"
+ 0x55,0x50,0x50,0x50,0x50,0x50,0x55,0x00, // 1192 "["
+ 0x55,0x05,0x05,0x05,0x05,0x05,0x55,0x00, // 1200 "]"
+ 0x00,0x40,0x10,0x10,0x04,0x04,0x01,0x00, // 1208 "\"
+ 0x15,0x14,0x14,0x50,0x14,0x14,0x15,0x00, // 1216 "{"
+ 0x54,0x14,0x14,0x05,0x14,0x14,0x54,0x00 // 1224 "}"
+};
+
+void font_set_colors(uint8 alt1, uint8 alt2, uint8 foreground) {
+ if (_G(font) == _G(interfaceFont)) {
+ font_colors[1] = foreground;
+ } else {
+ font_colors[1] = alt1;
+ font_colors[2] = alt2;
+ font_colors[3] = foreground;
+ }
+}
+void gr_font_set_color(uint8 foreground) {
+ if (_G(font) == _G(interfaceFont))
+ font_colors[1] = foreground;
+ else
+ font_colors[3] = foreground;
+}
+
+Font *gr_font_create_system_font() {
+ _G(interfaceFont) = (Font *)mem_alloc(sizeof(Font), "Font");
+ if (!_G(interfaceFont))
+ error("font struct");
+
+ _G(interfaceFont)->max_y_size = font_intr_h;
+ _G(interfaceFont)->max_x_size = font_intr_w;
+ _G(interfaceFont)->width = fontintr_width;
+ _G(interfaceFont)->offset = fontintr_offsets;
+ _G(interfaceFont)->pixData = fontintr_data;
+
+ return _G(interfaceFont);
+}
+
+void gr_font_system_shutdown() {
+ if (_G(interfaceFont))
+ mem_free(_G(interfaceFont));
+}
+
+void gr_font_dealloc(Font *killMe) {
+ if (!killMe)
+ return;
+ if (killMe->width)
+ mem_free(killMe->width);
+ if (killMe->offset)
+ mem_free(killMe->offset);
+ if (killMe->pixData)
+ mem_free(killMe->pixData);
+ mem_free(killMe);
+}
+
+void gr_font_set(Font *newFont) {
+ if (newFont)
+ _G(font) = newFont;
+}
+
+Font *gr_font_get() {
+ return _G(font);
+}
+
+int32 gr_font_string_width(char *out_string, int32 auto_spacing) {
+ if (_G(custom_ascii_converter)) { // if there is a function to convert the extended ASCII characters
+ _G(custom_ascii_converter)(out_string); // call it with the string
+ }
+
+ int32 width = 0; // Add some spacing in between the characters
+ byte *widthArray = _G(font)->width;
+
+ while (*out_string) {
+ width += widthArray[*out_string] + auto_spacing;
+ out_string++;
+ }
+
+ return width;
+}
+
+int32 gr_font_get_height() {
+ if (!_G(font))
+ return -1;
+
+ return (int32)_G(font)->max_y_size;
+}
+
+Font *gr_font_load(const char *fontName) {
+ uint8 buffer[10];
+ uint32 tag;
+ uint32 *bumpf;
+ Font *newFont;
+ void *bufferHandle = &buffer[0];
+
+ SysFile fontFile(fontName, BINARY);
+ if (!fontFile.exists())
+ return nullptr;
+
+ bufferHandle = &buffer[0];
+ fontFile.read(&bufferHandle, 10);
+
+ bumpf = (uint32 *)&buffer[0];
+ tag = convert_intel32(*bumpf);
+ if (tag != 'FONT')
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", (const char *)fontName, 0);
+
+ newFont = (Font *)mem_alloc(sizeof(Font), STR_FONTSTRUCT);
+ if (!newFont)
+ error_show(FL, 'OOM!', "_G(font) struct");
+
+ newFont->max_y_size = buffer[4];
+ newFont->max_x_size = buffer[5];
+ newFont->dataSize = *((uint32 *)&buffer[6]);
+ newFont->dataSize = convert_intel32(newFont->dataSize);
+
+ // read 'WIDT' into tag
+ bufferHandle = &buffer[0];
+ fontFile.read(&bufferHandle, 4);
+ bumpf = (uint32 *)&buffer[0];
+ tag = convert_intel32(*bumpf);
+ if (tag != 'WIDT')
+ error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 1);
+
+ // width table
+ newFont->width = (byte *)mem_alloc(256, STR_FONTWIDTH);
+ if (!newFont->width)
+ error_show(FL, 'OOM!', "_G(font) width table");
+
+ bufferHandle = newFont->width;
+ fontFile.read(&bufferHandle, 256);
+
+ // read 'OFFS' into tag
+ bufferHandle = &buffer[0];
+ fontFile.read(&bufferHandle, 4);
+ bumpf = (uint32 *)&buffer[0];
+ tag = convert_intel32(*bumpf);
+ if (tag != 'OFFS')
+ error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 2);
+
+ // offset table
+ newFont->offset = (short *)mem_alloc(256 * sizeof(short), STR_FONTOFF);
+ if (!newFont->offset)
+ error_show(FL, 'OOM!', "_G(font) offset table");
+
+ bufferHandle = newFont->offset;
+ fontFile.read(&bufferHandle, 256 * sizeof(short));
+
+ for (int i = 0; i < 256; i++)
+ newFont->offset[i] = convert_intel16(newFont->offset[i]);
+
+ // read 'PIXS' into tag
+ bufferHandle = &buffer[0];
+ fontFile.read(&bufferHandle, 4);
+ bumpf = (uint32 *)&buffer[0];
+ tag = convert_intel32(*bumpf);
+ if (tag != 'PIXS')
+ error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 3);
+
+ // pixData
+ newFont->pixData = (byte *)mem_alloc(newFont->dataSize, STR_FONTDATA);
+ if (!newFont->pixData)
+ error_show(FL, 'OOM!', "_G(font) pix data");
+
+ bufferHandle = newFont->pixData;
+ fontFile.read(&bufferHandle, newFont->dataSize);
+
+ // we don't need to close the file, because the destructor will close fontFile automagically
+ return newFont;
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_font.h b/engines/m4/graphics/gr_font.h
new file mode 100644
index 00000000000..49e392a54a1
--- /dev/null
+++ b/engines/m4/graphics/gr_font.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_FONT_H
+#define M4_GRAPHICS_GR_FONT_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct Font {
+ byte max_y_size;
+ byte max_x_size;
+ uint32 dataSize;
+
+ byte *width;
+ int16 *offset;
+ byte *pixData;
+};
+
+void gr_font_system_shutdown();
+void gr_font_dealloc(Font *killMe);
+Font *gr_font_create_system_font();
+void gr_font_set_color(uint8 foreground);
+Font *gr_font_get();
+void gr_font_set(Font *font);
+int32 gr_font_get_height();
+int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y,
+ int32 w, int32 auto_spacing = 1);
+int32 gr_font_string_width(char *out_string, int32 auto_spacing = 1);
+//Font *gr_font_file_read(const char *fontName);
+Font *gr_font_load(const char *fontName);
+
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
new file mode 100644
index 00000000000..849652caa0d
--- /dev/null
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/graphics/gr_pal.h"
+
+namespace M4 {
+
+uint8 gr_pal_get_ega_color(uint8 myColor) {
+ error("TODO");
+}
+
+uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color) {
+ error("TODO: gr_color_createInverseTable");
+}
+
+void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num) {
+ error("TODO: gr_color_create_ipl5");
+}
+
+uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors) {
+ error("TODO: gr_color_load_ipl5");
+}
+
+void gr_color_set(int32 c) {
+ error("TODO: gr_color_set");
+}
+
+byte gr_color_get_current() {
+ error("TODO: gr_color_get_current");
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
new file mode 100644
index 00000000000..93ed0721f67
--- /dev/null
+++ b/engines/m4/graphics/gr_pal.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GRAPHICS_H
+#define M4_GRAPHICS_GRAPHICS_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define __BLACK (gr_pal_get_ega_color(0))
+#define __BLUE (gr_pal_get_ega_color(1))
+#define __GREEN (gr_pal_get_ega_color(2))
+#define __CYAN (gr_pal_get_ega_color(3))
+#define __RED (gr_pal_get_ega_color(4))
+#define __VIOLET (gr_pal_get_ega_color(5))
+#define __BROWN (gr_pal_get_ega_color(6))
+#define __LTGRAY (gr_pal_get_ega_color(7))
+#define __DKGRAY (gr_pal_get_ega_color(8))
+#define __LTBLUE (gr_pal_get_ega_color(9))
+#define __LTGREEN (gr_pal_get_ega_color(10))
+#define __LTCYAN (gr_pal_get_ega_color(11))
+#define __LTRED (gr_pal_get_ega_color(12))
+#define __PINK (gr_pal_get_ega_color(13))
+#define __YELLOW (gr_pal_get_ega_color(14))
+#define __WHITE (gr_pal_get_ega_color(15))
+
+extern uint8 gr_pal_get_ega_color(uint8 myColor);
+
+uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color);
+void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
+uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
+void gr_color_set(int32 c);
+byte gr_color_get_current();
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/graphics/graphics.cpp b/engines/m4/graphics/graphics.cpp
new file mode 100644
index 00000000000..cb1b8d0adf5
--- /dev/null
+++ b/engines/m4/graphics/graphics.cpp
@@ -0,0 +1,26 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/graphics.h"
+
+namespace M4 {
+
+} // namespace M4
diff --git a/engines/m4/graphics/graphics.h b/engines/m4/graphics/graphics.h
new file mode 100644
index 00000000000..0fba536acea
--- /dev/null
+++ b/engines/m4/graphics/graphics.h
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GRAPHICS_H
+#define M4_GRAPHICS_GRAPHICS_H
+
+#include "common/scummsys.h"
+
+namespace M4 {
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index bb614093bb4..98e8c065dd4 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -31,6 +31,35 @@ namespace M4 {
typedef void *Ptr;
typedef void *Handle;
+typedef uint32 frac16;
+typedef uint32 ulong;
+typedef uint32 quadchar;
+typedef uint32 trigraph;
+
+typedef byte Bit;
+typedef byte Bool;
+typedef byte boolean;
+typedef byte Boolean;
+typedef byte byte;
+typedef byte Byte;
+typedef uint16 word;
+typedef uint16 Word;
+typedef uint32 DWord;
+
+struct Buffer {
+ int32 W;
+ int32 h;
+ uint8 *data;
+ uint8 encoding;
+ int32 stride;
+};
+
+#include "common/pack-start.h" // START STRUCT PACKING
+struct RGB8 {
+ byte r, g, b;
+} PACKED_STRUCT;
+#include "common/pack-end.h" // END STRUCT PACKING
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index b12f3b7b961..932af0f3313 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -12,10 +12,16 @@ MODULE_OBJS = \
term.o \
adv_r/db_env.o \
adv_r/db_rmlst.o \
+ core/errors.o \
+ core/imath.o \
fileio/extensions.o \
fileio/fileio.o \
fileio/info.o \
fileio/sys_file.o \
+ graphics/gr_buff.o \
+ graphics/gr_font.o \
+ graphics/gr_pal.o \
+ graphics/graphics.o \
mem/memman.o \
mem/reloc.o \
burger/burger.o
Commit: e9abc688611ce86b182c32e200721b26dcee0d54
https://github.com/scummvm/scummvm/commit/e9abc688611ce86b182c32e200721b26dcee0d54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added SysFile init/shutdown
Changed paths:
engines/m4/fileio/sys_file.cpp
engines/m4/fileio/sys_file.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/term.cpp
engines/m4/term.h
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 980a72e393c..8dceb09e1c4 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -218,6 +218,10 @@ void SysFile::open_read() {
}
}
+void SysFile::open_write() {
+ error("TODO: open_write");
+}
+
Common::String SysFile::get_last_string(const Common::String &src) {
int len, j, k, l;
@@ -604,4 +608,26 @@ Common::SeekableReadStream *SysFile::rs() const {
return rs;
}
+void sysfile_init(bool in_hag_mode) {
+ _G(hag).hag_flag = in_hag_mode;
+
+ if (in_hag_mode) {
+ term_message("Initialized in hag mode");
+ } else {
+ term_message("Initialized in file mode");
+ }
+}
+
+void sysfile_shutdown() {
+ Hag_Record *temp_ptr;
+
+ temp_ptr = _G(hag).hag_file_list;
+ while (temp_ptr) {
+ _G(hag).hag_file_list = _G(hag).hag_file_list->next;
+ f_io_close(temp_ptr->hag_fp);
+ mem_free(temp_ptr);
+ temp_ptr = _G(hag).hag_file_list;
+ }
+}
+
} // namespace M4
diff --git a/engines/m4/fileio/sys_file.h b/engines/m4/fileio/sys_file.h
index cae29f3308e..c06f86148ad 100644
--- a/engines/m4/fileio/sys_file.h
+++ b/engines/m4/fileio/sys_file.h
@@ -119,6 +119,9 @@ public:
int32 read(MemHandle bufferHandle, int32 n);
};
+extern void sysfile_init(bool in_hag_mode);
+extern void sysfile_shutdown();
+
} // namespace M4
#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index cf2729aba1d..5a208ecdfa8 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -25,4 +25,14 @@ namespace M4 {
Globals *g_globals;
+Globals::Globals() {
+ g_globals = this;
+}
+
+Globals::~Globals() {
+ sysfile_shutdown();
+
+ g_globals = nullptr;
+}
+
} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 2f09690125d..f91d28d1da4 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -38,8 +38,8 @@ struct Globals;
extern Globals *g_globals;
struct Globals {
- Globals() { g_globals = this; }
- ~Globals() { g_globals = nullptr; }
+ Globals();
+ ~Globals();
Game _game;
Kernel _kernel;
diff --git a/engines/m4/term.cpp b/engines/m4/term.cpp
index 616a1ee500b..4a3fb3a430e 100644
--- a/engines/m4/term.cpp
+++ b/engines/m4/term.cpp
@@ -76,7 +76,7 @@ void Term::vmessage(const char *fmt, va_list va) {
}
}
-inline void term_message(const char *fmt, ...) {
+void term_message(const char *fmt, ...) {
va_list va;
va_start(va, fmt);
_G(term).vmessage(fmt, va);
diff --git a/engines/m4/term.h b/engines/m4/term.h
index 2154eb9d047..b5a3f8ae123 100644
--- a/engines/m4/term.h
+++ b/engines/m4/term.h
@@ -61,7 +61,7 @@ public:
void vmessage(const char *fmt, va_list va);
};
-inline void term_message(const char *fmt, ...);
+void term_message(const char *fmt, ...);
} // namespace M4
Commit: 161501949955f1ce176611a4c371b1011a41435b
https://github.com/scummvm/scummvm/commit/161501949955f1ce176611a4c371b1011a41435b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add missing imath methods
Changed paths:
engines/m4/core/imath.cpp
engines/m4/core/imath.h
diff --git a/engines/m4/core/imath.cpp b/engines/m4/core/imath.cpp
index 27a80268e05..bfdeb7bd947 100644
--- a/engines/m4/core/imath.cpp
+++ b/engines/m4/core/imath.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/endian.h"
#include "m4/core/imath.h"
namespace M4 {
@@ -116,4 +117,39 @@ frac16 SqrtF16(frac16 n) {
return (frac16)r;
}
+uint16 HighWord(uint32 n) {
+ return (uint16)(n >> 16);
+}
+
+uint16 LowWord(uint32 n) {
+ return (uint16)(n & 0xffff);
+}
+
+uint32 convert_intel32(uint32 a) {
+ return FROM_LE_32(a);
+}
+
+uint16 convert_intel16(uint16 a) {
+ return FROM_LE_16(a);
+}
+
+frac16 FixedMul(frac16 a, frac16 b) {
+ float ta = a;
+ float tb = b;
+ return (frac16)((ta * tb) / 65536.0);
+}
+
+frac16 FixedDiv(frac16 a, frac16 b) {
+ float ta = a;
+ float tb = b;
+ return (frac16)((ta / tb) * 65536.0);
+}
+
+frac16 FixedMulDiv(frac16 a, frac16 b, frac16 c) {
+ float ta = a;
+ float tb = b;
+ float tc = c;
+ return (frac16)((ta * tb) / tc);
+}
+
} // namespace M4
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
index 57ccbb7740f..6d5383ea423 100644
--- a/engines/m4/core/imath.h
+++ b/engines/m4/core/imath.h
@@ -50,10 +50,10 @@ frac16 imath_ranged_rand16(frac16 a, frac16 b);
frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2);
frac16 SqrtF16(frac16 n);
-frac16 ArcTan(frac16 x, frac16 y);
+//frac16 ArcTan(frac16 x, frac16 y);
-short HighWord(long n);
-short LowWord(long n);
+uint16 HighWord(uint32 n);
+uint16 LowWord(uint32 n);
uint32 convert_intel32(uint32 a);
uint16 convert_intel16(uint16 a);
Commit: 999a1f1df5487a3c3d88483aad2f855ccda72f94
https://github.com/scummvm/scummvm/commit/999a1f1df5487a3c3d88483aad2f855ccda72f94
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added player_been
Changed paths:
A engines/m4/adv_r/adv_been.cpp
A engines/m4/adv_r/adv_been.h
engines/m4/adv_r/adv.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/mem/memman.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index f53eb0d830d..65db3008ea1 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -27,6 +27,16 @@
namespace M4 {
+enum {
+ INSTALL_SOUND_DRIVERS = 1,
+ INSTALL_PLAYER_BEEN_INIT = 2,
+ INSTALL_RAIL_SYSTEM = 4,
+ INSTALL_INVENTORY_SYSTEM = 8,
+ INSTALL_INVERSE_PALETTE = 0x10,
+ INSTALL_MININUM = 0,
+ INSTALL_ALL = 0x1f
+};
+
struct HotSpotRec {
int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
int32 feet_x = 0, feet_y = 0; // Walk-to target for player
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
new file mode 100644
index 00000000000..a0b1f6e9fc6
--- /dev/null
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -0,0 +1,145 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_been.h"
+#include "m4/core/errors.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool player_been_init(int16 num_scenes) {
+ _G(scene_list).table = (int16 *)mem_alloc(sizeof(int16) * num_scenes, "been_scenes");
+
+ if (!_G(scene_list).table)
+ error_show(FL, 'OOM!', "player_been_init");
+
+ _G(scene_list).total_scenes = num_scenes;
+ player_reset_been();
+
+ return true;
+}
+
+void player_been_shutdown() {
+ mem_free(_G(scene_list).table);
+}
+
+void player_reset_been() {
+ memset(_G(scene_list).table, 0, sizeof(int16) * _G(scene_list).total_scenes);
+ _G(scene_list).tail = 0;
+}
+
+int32 player_been_restore(Common::SeekableReadStream *file_ptr) {
+ // Read chunk type marker
+ int32 size;
+
+ if (file_ptr->readUint32BE() != 'BEEN')
+ error_show(FL, 'PBR1');
+
+ // Skip chunk size and read number of scenes
+ file_ptr->skip(4);
+ size = file_ptr->readUint32LE();
+
+ // Do we need to reallocate the scene table?
+ if (size != _G(scene_list).total_scenes) {
+ _G(scene_list).table = (int16 *)mem_realloc(_G(scene_list).table, size * sizeof(int16), "been_scenes");
+ if (!_G(scene_list).table)
+ error_show(FL, 'OOM!');
+ }
+ _G(scene_list).total_scenes = size;
+
+ // Read the tail
+ _G(scene_list).tail = file_ptr->readUint32LE();
+
+ // Read in the scene list
+ for (int i = 0; i < _G(scene_list).total_scenes; ++i)
+ _G(scene_list).table[i] = file_ptr->readUint16LE();
+
+ return (4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes);
+}
+
+int32 player_been_save(Common::WriteStream *handle) {
+ int32 size;
+
+ // write chunk identity
+ handle->writeUint32BE('BEEN');
+
+ // Write chunk size
+ size = 4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes;
+ handle->writeUint32LE(size);
+
+ // write number of scenes
+ handle->writeUint32LE(_G(scene_list).total_scenes);
+
+ // write current tail
+ handle->writeUint32LE(_G(scene_list).tail);
+
+ // Write scene list
+ for (int i = 0; i < _G(scene_list).total_scenes; ++i)
+ handle->writeUint16LE(_G(scene_list).table[i]);
+
+ return (sizeof(int32) + (sizeof(int16) * _G(scene_list).total_scenes));
+}
+
+/**
+ * Checks whether player has been in specified scene before
+ */
+static bool player_been_here(int16 scene_num) {
+ for (int i = 0; i < _G(scene_list).tail; i++)
+ if (_G(scene_list).table[i] == scene_num)
+ return true;
+
+ return false;
+}
+
+bool player_enters_scene(int16 scene_num) {
+ if (player_been_here(scene_num))
+ return true;
+
+ _G(scene_list).table[_G(scene_list).tail] = scene_num;
+ ++_G(scene_list).tail;
+
+ if (_G(scene_list).tail > _G(scene_list).total_scenes)
+ error_show(FL, 'SLTS');
+
+ return false;
+}
+
+void player_forgets_scene(int16 scene_num) {
+ int i, j;
+
+ // Check the list
+ for (i = 0; i < _G(scene_list).tail; i++) {
+ // Found a match
+ if (_G(scene_list).table[i] == scene_num) {
+ // Close the table
+ for (j = i; j < _G(scene_list).tail; j++) {
+ _G(scene_list).table[j] = _G(scene_list).table[j + 1];
+ }
+
+ // One less scene
+ --_G(scene_list).tail;
+ return;
+ }
+ }
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_been.h b/engines/m4/adv_r/adv_been.h
new file mode 100644
index 00000000000..f66eb4aca7a
--- /dev/null
+++ b/engines/m4/adv_r/adv_been.h
@@ -0,0 +1,87 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_BEEN_H
+#define M4_ADV_R_ADV_BEEN_H
+
+#include "common/stream.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct Scene_list {
+ int32 total_scenes = 0;
+ int32 tail = 0;
+ int16 *table = nullptr;
+};
+
+/**
+ * Initializes player_been information, allocates memory for a list of scenes
+ *
+ * Takes the number of scenes to allocate space for
+ * @returns True if successfully allocated
+ */
+extern bool player_been_init(int16 num_scenes);
+
+/**
+ * Shuts down player_been system. Deallocates some memory
+ */
+extern void player_been_shutdown();
+
+/**
+ * Resets the player_been system
+ */
+extern void player_reset_been(void);
+
+/**
+ * Restores player_been information
+ *
+ * A file must already been open for reading and seeked to the right place
+ * returns the number of bytes read. player_been_init must have been called
+ * previously with a sufficient number of scenes to hold the record being read.
+ */
+extern int32 player_been_restore(Common::SeekableReadStream *handle);
+
+/**
+ * Saves player_been information
+ *
+ * A file must already been open for writing and seeked to the right place
+ * @returns The number of bytes written
+ */
+extern int32 player_been_save(Common::WriteStream *handle);
+
+/**
+ * Called whenever player enters a scene
+ * @param scene_num Takes the scene to be entered
+ * @returns True if the player has been there before, or false otherwise
+ */
+extern bool player_enters_scene(int16 scene_num);
+
+/**
+ * Called if the apps programmer wants the player to forget about being in
+ * a room
+ */
+extern void player_forgets_scene(int16 scene_num);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 5a208ecdfa8..bf405bbdfac 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -31,6 +31,7 @@ Globals::Globals() {
Globals::~Globals() {
sysfile_shutdown();
+ player_been_shutdown();
g_globals = nullptr;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index f91d28d1da4..005bdb2893a 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -26,6 +26,7 @@
#include "m4/kernel.h"
#include "m4/term.h"
#include "m4/adv_r/adv.h"
+#include "m4/adv_r/adv_been.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
@@ -46,6 +47,8 @@ struct Globals {
Term _term;
Hag_Statics _hag;
SceneDef _currentSceneDef;
+ Scene_list _scene_list;
+ byte _globals[0x400];
Font *_system_font = nullptr;
Font *_font_line = nullptr;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 95a17c6347c..bcbeeee8871 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
#include "engines/util.h"
#include "graphics/palette.h"
+#include "m4/adv_r/adv_been.h"
#include "m4/m4.h"
#include "m4/detection.h"
#include "m4/console.h"
@@ -62,7 +63,7 @@ Common::Error M4Engine::run() {
parse_all_flags();
if (!_G(system_shutting_down)) {
- game_systems_initialize();
+ game_systems_initialize(INSTALL_ALL);
@@ -73,7 +74,7 @@ Common::Error M4Engine::run() {
return Common::kNoError;
}
-void M4Engine::game_systems_initialize() {
+void M4Engine::game_systems_initialize(byte flags) {
_G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
size_t totalMem = _G(kernel).mem_avail();
@@ -84,6 +85,8 @@ void M4Engine::game_systems_initialize() {
"Cache System Disabled" : "Cache System Enabled");
debugC(kDebugCore, "Available memory: %ld", totalMem);
+ if (flags & INSTALL_PLAYER_BEEN_INIT)
+ player_been_init(180);
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 4f5f3a1e4e4..a4360f6a6c3 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -46,7 +46,7 @@ private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
- void game_systems_initialize();
+ void game_systems_initialize(byte flags);
protected:
// Engine APIs
diff --git a/engines/m4/mem/memman.h b/engines/m4/mem/memman.h
index c18ac4a9a5f..7bbbd289dbf 100644
--- a/engines/m4/mem/memman.h
+++ b/engines/m4/mem/memman.h
@@ -27,7 +27,7 @@
namespace M4 {
-inline Handle mem_alloc(size_t size, const char *type) {
+inline Handle mem_alloc(size_t size, const char *) {
return (Handle)malloc(size);
}
@@ -35,6 +35,10 @@ inline void mem_free(Handle ptr) {
free(ptr);
}
+inline Handle mem_realloc(Handle src, size_t new_size, const char *) {
+ return (Handle)realloc(src, new_size);
+}
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 932af0f3313..6aa26203c84 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
param.o \
res.o \
term.o \
+ adv_r/adv_been.o \
adv_r/db_env.o \
adv_r/db_rmlst.o \
core/errors.o \
Commit: e5bee1cbdfba1785dccb75810d29e1f52574bf60
https://github.com/scummvm/scummvm/commit/e5bee1cbdfba1785dccb75810d29e1f52574bf60
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding globals array
Changed paths:
engines/m4/adv_r/adv.h
engines/m4/globals.h
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 65db3008ea1..f5ef31ba8f7 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -27,6 +27,9 @@
namespace M4 {
+#define MAX_SCENES 180
+#define GLB_SHARED_VARS 512
+
enum {
INSTALL_SOUND_DRIVERS = 1,
INSTALL_PLAYER_BEEN_INIT = 2,
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 005bdb2893a..c60453859f6 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -48,7 +48,7 @@ struct Globals {
Hag_Statics _hag;
SceneDef _currentSceneDef;
Scene_list _scene_list;
- byte _globals[0x400];
+ frac16 _globals[GLB_SHARED_VARS];
Font *_system_font = nullptr;
Font *_font_line = nullptr;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index bcbeeee8871..2607529a838 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -26,7 +26,9 @@
#include "common/system.h"
#include "engines/util.h"
#include "graphics/palette.h"
+#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
+#include "m4/core/errors.h"
#include "m4/m4.h"
#include "m4/detection.h"
#include "m4/console.h"
@@ -85,8 +87,11 @@ void M4Engine::game_systems_initialize(byte flags) {
"Cache System Disabled" : "Cache System Enabled");
debugC(kDebugCore, "Available memory: %ld", totalMem);
- if (flags & INSTALL_PLAYER_BEEN_INIT)
- player_been_init(180);
+ if (flags & INSTALL_PLAYER_BEEN_INIT) {
+ if (!player_been_init(MAX_SCENES))
+ error_show(FL, 'PBIF');
+ }
+
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
Commit: e1ef55a053c3d4a1b36e86b2b16bfca7d0601b45
https://github.com/scummvm/scummvm/commit/e1ef55a053c3d4a1b36e86b2b16bfca7d0601b45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui system init/shutdown
Changed paths:
A engines/m4/gui/gui.h
A engines/m4/gui/gui_sys.cpp
A engines/m4/gui/gui_sys.h
A engines/m4/gui/gui_univ.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_buff.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/m4_types.h
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index bf405bbdfac..57c0cc05190 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/globals.h"
+#include "m4/gui/gui_sys.h"
namespace M4 {
@@ -32,6 +33,7 @@ Globals::Globals() {
Globals::~Globals() {
sysfile_shutdown();
player_been_shutdown();
+ gui_system_shutdown();
g_globals = nullptr;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index c60453859f6..69ac1af2374 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -29,6 +29,7 @@
#include "m4/adv_r/adv_been.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
+#include "m4/gui/gui_univ.h"
namespace M4 {
@@ -69,7 +70,13 @@ struct Globals {
int _global_sound_room = 0;
bool _interface_visible = false;
bool _please_hyperwalk = false;
- void (*_custom_ascii_converter)(char *string);
+ void (*_custom_ascii_converter)(char *string) = nullptr;
+ int32 _mouseX = 0, _mouseY = 0, _oldX = 0, _oldY = 0;
+ bool _vmng_Initted = false;
+ ScreenContext *_frontScreen = nullptr;
+ // A list of "hot keys" which are activated by their keyboard event, if the event
+ // has been passed right through the complete list of active windows.
+ Hotkey *_systemHotkeys = nullptr;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
index f5f067263ed..515ca8284cf 100644
--- a/engines/m4/graphics/gr_buff.h
+++ b/engines/m4/graphics/gr_buff.h
@@ -26,9 +26,43 @@
namespace M4 {
-int32 gr_buffer_free(Buffer *buf);
-char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
-int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
+class GrBuff {
+public:
+ GrBuff(int32 _w, int32 _h);
+ GrBuff(int32 _w, int32 _h, int32 _x_off, int32 _y_off, int32 _pitch, int32 _height);
+ virtual ~GrBuff();
+
+ void *operator new(size_t sz);
+ void operator delete(void *ptr, size_t);
+
+ // note: get_buffer will return the whole pixmap, not the
+ // subrectangle specified via x_off, y_off, w, h, and pitch.
+ // get_buffer will lock the pixmap, unlock it after use, SVP.
+ // DO NOT FREE THE RETURNED BUFFER!
+
+ Buffer *get_buffer();
+
+ uint8 *get_pixmap();
+ void clear();
+
+ void lock();
+ void release();
+ void refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2);
+
+ int32 width, Height, x_off, y_off, stride, buffer_lines;
+
+ int32 lock_count;
+
+protected:
+ void alloc_pixmap();
+
+ Buffer dummy;
+ Handle pixmap;
+};
+
+extern int32 gr_buffer_free(Buffer *buf);
+extern char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
+extern int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
/**
* Copies a "rectangular" buffer area from "from" to "unto". Size
@@ -39,7 +73,7 @@ int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
* buffers, buf_rect_copy() can be used instead).
* @returns Returns true if successful.
*/
-bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
+extern bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
int32 dx, int32 dy, int32 w, int32 h);
/**
@@ -50,7 +84,7 @@ bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
* buf_rect_copy_2 ().
* @returns Returns true if successful.
*/
-bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, int32 h);
+extern bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, int32 h);
/**
* Fills a rectangular buffer area with the specified byte value.
@@ -58,9 +92,9 @@ bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, in
* determined by "size_x, size_y."
* @returns Returns true if successful; false if buffer invalid.
*/
-int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h);
+extern int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h);
-void GrBuff_Show(void *s, void *r, void *b, int32 destX, int32 destY);
+extern void GrBuff_Show(void *s, void *r, void *b, int32 destX, int32 destY);
} // namespace M4
diff --git a/engines/m4/gui/gui.h b/engines/m4/gui/gui.h
new file mode 100644
index 00000000000..280828b4374
--- /dev/null
+++ b/engines/m4/gui/gui.h
@@ -0,0 +1,57 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_H
+#define M4_GUI_GUI_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct M4sprite {
+ struct M4sprite *next;
+ struct M4sprite *prev;
+ int32 x;
+ int32 y;
+ int32 w;
+ int32 h;
+ int32 xOffset; // the "hotspot" of the sprite, ie: the registration point
+ int32 yOffset;
+ uint8 encoding;
+ uint8 *data;
+ Handle sourceHandle;
+ int32 sourceOffset;
+};
+
+struct M4Rect {
+ int32 x1, y1, x2, y2;
+};
+
+struct RectList {
+ RectList *next;
+ RectList *prev;
+ int32 x1, y1, x2, y2;
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
new file mode 100644
index 00000000000..1fd52d5608f
--- /dev/null
+++ b/engines/m4/gui/gui_sys.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_sys.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool gui_system_init() {
+ _G(systemHotkeys) = NULL;
+ return true;
+}
+
+void gui_system_shutdown() {
+ Hotkey *myHotkeys, *tempHotkey;
+
+ myHotkeys = _G(systemHotkeys);
+ tempHotkey = myHotkeys;
+
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ tempHotkey = myHotkeys;
+ }
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_sys.h b/engines/m4/gui/gui_sys.h
new file mode 100644
index 00000000000..7fe364951e0
--- /dev/null
+++ b/engines/m4/gui/gui_sys.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 M4_ADV_R_DB_ENV_H
+#define M4_ADV_R_DB_ENV_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+extern bool gui_system_init();
+extern void gui_system_shutdown();
+extern void gui_system_event_handler(void); // was ScreenEventHandle
+extern void AddSystemHotkey(int32 myKey, HotkeyCB callback);
+extern void RemoveSystemHotkey(int32 myKey);
+extern HotkeyCB GetSystemHotkey(int32 myKey);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_univ.h b/engines/m4/gui/gui_univ.h
new file mode 100644
index 00000000000..4de48bc22ff
--- /dev/null
+++ b/engines/m4/gui/gui_univ.h
@@ -0,0 +1,141 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_UNIV_H
+#define M4_GUI_GUI_UNIV_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui.h"
+#include "m4/graphics/gr_font.h"
+#include "m4/graphics/gr_buff.h"
+
+namespace M4 {
+
+typedef void (*RefreshFunc)(void *myScreen, void *theRectList, void *destBuffer, int32 destX, int32 destY);
+typedef void (*HotkeyCB)(void *myParam, void *myContent);
+typedef bool (*EventHandler)(void *scrnContent, int32 eventType,
+ int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
+
+struct Hotkey {
+ Hotkey *next;
+ int32 myKey;
+ HotkeyCB callback;
+};
+
+/**
+ * The main structure used by the view manager is the ScreenContext
+ */
+struct ScreenContext {
+ ScreenContext *infront;
+ ScreenContext *behind;
+ int32 x1, y1, x2, y2;
+ int32 scrnType;
+ uint32 scrnFlags;
+ void *scrnContent;
+ RefreshFunc redraw;
+ EventHandler evtHandler;
+ Hotkey *scrnHotkeys;
+};
+
+struct ButtonDrawRec {
+ void *dialog;
+ Buffer *scrBuf;
+ M4sprite *sprite;
+ int32 x1, y1, x2, y2;
+ int16 el_type;
+ bool fillMe, pressed;
+};
+
+enum ItemType {
+ MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
+};
+
+struct ListItem {
+ char prompt[80];
+ int32 tag;
+ struct ListItem *next;
+ struct ListItem *prev;
+};
+
+struct Item {
+ struct Item *next;
+ struct Item *prev;
+ M4CALLBACK callback;
+ enum ItemType type;
+ int32 status;
+ Font *myFont;
+ char *prompt;
+ char *aux;
+ char *aux2;
+ int32 promptMax;
+ int32 myListCount;
+ int32 viewIndex;
+ int32 thumbY;
+ ListItem *myList;
+ ListItem *currItem;
+ ListItem *viewTop;
+ ListItem *viewBottom;
+ int32 listView;
+ int32 x, y, w, h;
+ int32 tag;
+};
+
+struct Dialog {
+ int32 w, h;
+ int32 num_items;
+ Item *itemList;
+ Item *listBottom;
+ Item *cancel_item, *return_item, *default_item;
+ GrBuff *dlgBuffer;
+};
+
+struct TextItem {
+ struct TextItem *next;
+ int32 justification;
+ int32 x;
+ int32 y;
+ int32 w;
+ int32 h;
+ int32 tag;
+ int32 type;
+ char *prompt;
+ M4CALLBACK callback;
+};
+
+struct TextScrn {
+ int32 w, h;
+ int32 textColor;
+ int32 textColor_alt1;
+ int32 textColor_alt2;
+ int32 hiliteColor;
+ int32 hiliteColor_alt1;
+ int32 hiliteColor_alt2;
+ int32 luminance;
+ Font *myFont;
+ TextItem *myTextItems;
+ TextItem *hiliteItem;
+ GrBuff *textScrnBuffer;
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 2607529a838..cce7f3b114d 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -29,6 +29,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
+#include "m4/gui/gui_sys.h"
#include "m4/m4.h"
#include "m4/detection.h"
#include "m4/console.h"
@@ -92,6 +93,25 @@ void M4Engine::game_systems_initialize(byte flags) {
error_show(FL, 'PBIF');
}
+ term_message("Firing up GUI");
+ fire_up_gui();
+}
+
+void M4Engine::fire_up_gui() {
+ if (!gui_system_init())
+ error_show(FL, 'GUI0');
+/*
+ if (!vmng_init())
+ error_show(FL, 'GUI1');
+ if (!gui_mouse_init())
+ error_show(FL, 'GUI2');
+ if (!InitDialogs())
+ error_show(FL, 'GUI3');
+ if (!InitItems())
+ error_show(FL, 'GUI4');
+ if (!gui_buffer_system_init())
+ error_show(FL, 'GUI5');
+ */
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index a4360f6a6c3..8402a33404d 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -47,6 +47,7 @@ private:
Common::RandomSource _randomSource;
void game_systems_initialize(byte flags);
+ void fire_up_gui();
protected:
// Engine APIs
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 98e8c065dd4..b293510ba40 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -60,6 +60,14 @@ struct RGB8 {
} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
+typedef void (*FuncPtr)();
+typedef bool (*FuncPtr_b_l)(int32);
+typedef void (*FuncPtr_v_vv)(void *, void *);
+
+typedef FuncPtr_b_l ExceptionPtr;
+
+typedef FuncPtr_v_vv M4CALLBACK;
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6aa26203c84..080ad41e822 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -23,6 +23,7 @@ MODULE_OBJS = \
graphics/gr_font.o \
graphics/gr_pal.o \
graphics/graphics.o \
+ gui/gui_sys.o \
mem/memman.o \
mem/reloc.o \
burger/burger.o
Commit: 40719565e74ef843ca61ea0374a05e8e5eecc3c1
https://github.com/scummvm/scummvm/commit/40719565e74ef843ca61ea0374a05e8e5eecc3c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding gui systems init/shutdown
Changed paths:
A engines/m4/gui/gui_dialog.cpp
A engines/m4/gui/gui_dialog.h
A engines/m4/gui/gui_vmng.cpp
A engines/m4/gui/gui_vmng.h
A engines/m4/mem/mem.cpp
A engines/m4/mem/mem.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/gui/gui.h
engines/m4/gui/gui_sys.h
engines/m4/gui/gui_univ.h
engines/m4/m4.cpp
engines/m4/mem/memman.h
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 57c0cc05190..59c48faa8f0 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -21,6 +21,8 @@
#include "m4/globals.h"
#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_dialog.h"
+#include "m4/mem/mem.h"
namespace M4 {
@@ -34,6 +36,8 @@ Globals::~Globals() {
sysfile_shutdown();
player_been_shutdown();
gui_system_shutdown();
+ gui_dialog_shutdown();
+ mem_stash_shutdown();
g_globals = nullptr;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 69ac1af2374..4680ea5cd1d 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -30,6 +30,7 @@
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
#include "m4/gui/gui_univ.h"
+#include "m4/mem/memman.h"
namespace M4 {
@@ -74,9 +75,22 @@ struct Globals {
int32 _mouseX = 0, _mouseY = 0, _oldX = 0, _oldY = 0;
bool _vmng_Initted = false;
ScreenContext *_frontScreen = nullptr;
+ ScreenContext *_backScreen = nullptr;
+ ScreenContext *_inactiveScreens = nullptr;
// A list of "hot keys" which are activated by their keyboard event, if the event
// has been passed right through the complete list of active windows.
Hotkey *_systemHotkeys = nullptr;
+ int32 _memtypeSCRN = 0; // Memory slots used by the memory manager
+ int32 _memtypeMATTE = 0;
+ int32 _memtypeRECT = 0;
+ int32 _sizeMem[_MEMTYPE_LIMIT] = { 0 };
+ int32 _requests[_MEMTYPE_LIMIT] = { 0 };
+ void *_memBlock[_MEMTYPE_LIMIT] = { nullptr };
+ bool _okButton = false;
+ bool _movingScreen = false;
+ Item *_clickItem = nullptr;
+ Item *_doubleClickItem = nullptr;
+ char _listboxSearchStr[80] = { 0 };
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/gui/gui.h b/engines/m4/gui/gui.h
index 280828b4374..be2a83894f9 100644
--- a/engines/m4/gui/gui.h
+++ b/engines/m4/gui/gui.h
@@ -27,6 +27,13 @@
namespace M4 {
+enum {
+ SCRN_DLG = 0, SCRN_BUF, SCRN_TEXT, SCRN_TRANS
+};
+enum {
+ SCRN_ANY = 0, SCRN_ACTIVE, SCRN_INACTIVE, SCRN_UNDEFN
+};
+
struct M4sprite {
struct M4sprite *next;
struct M4sprite *prev;
@@ -52,6 +59,19 @@ struct RectList {
int32 x1, y1, x2, y2;
};
+struct matte {
+ struct matte *nextMatte;
+ void *myScreen;
+ int32 x1;
+ int32 y1;
+ int32 x2;
+ int32 y2;
+ int32 w;
+ int32 h;
+ uint8 *SrcBuffer;
+ uint32 SrcPitch;
+};
+
} // End of namespace M4
#endif
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
new file mode 100644
index 00000000000..80826b17b56
--- /dev/null
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_dialog.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool gui_dialog_init() {
+ _G(listboxSearchStr)[0] = '\0';
+ return true;
+}
+
+void gui_dialog_shutdown() {
+}
+
+void vmng_TextScrn_Destroy(TextScrn *myTextScrn) {
+ TextItem *myTextItems;
+ TextItem *tempTextItem;
+ tempTextItem = myTextItems = myTextScrn->myTextItems;
+
+ while (tempTextItem) {
+ myTextItems = myTextItems->next;
+ mem_free(tempTextItem->prompt);
+ mem_free((void *)tempTextItem);
+ tempTextItem = myTextItems;
+ }
+
+ delete myTextScrn->textScrnBuffer;
+ mem_free((void *)myTextScrn);
+}
+
+void vmng_Dialog_Destroy(Dialog *d) {
+ error("TODO: vmng_Dialog_Destroy");
+}
+
+} // namespace M4
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
new file mode 100644
index 00000000000..af2bfedac3f
--- /dev/null
+++ b/engines/m4/gui/gui_dialog.h
@@ -0,0 +1,144 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_DIALOG_H
+#define M4_GUI_GUI_DIALOG_H
+
+#include "m4/m4_types.h"
+#include "m4/graphics/gr_buff.h"
+#include "m4/gui/gui.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+struct Dialog {
+ int32 w, h;
+ int32 num_items;
+ Item *itemList;
+ Item *listBottom;
+ Item *cancel_item, *return_item, *default_item;
+ GrBuff *dlgBuffer;
+};
+
+struct TextScrn {
+ int32 w, h;
+ int32 textColor;
+ int32 textColor_alt1;
+ int32 textColor_alt2;
+ int32 hiliteColor;
+ int32 hiliteColor_alt1;
+ int32 hiliteColor_alt2;
+ int32 luminance;
+ Font *myFont;
+ TextItem *myTextItems;
+ TextItem *hiliteItem;
+ GrBuff *textScrnBuffer;
+};
+
+extern bool gui_dialog_init();
+extern void gui_dialog_shutdown();
+
+//GENERAL DIALOG SUPPORT
+extern Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrnFlags);
+extern Dialog *DialogCreate(M4Rect *r, uint32 scrnFlags);
+extern void vmng_Dialog_Destroy(Dialog *d); //used only by viewmgr.cpp **DO NOT USE
+extern void DialogDestroy(Dialog *d, M4Rect *r);
+extern void Dialog_Refresh(Dialog *d);
+extern void Dialog_Refresh_All();
+extern void Dialog_Resize(Dialog *d, int32 newW, int32 newH);
+extern bool GetDialogCoords(Dialog *d, M4Rect *r);
+extern void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancelTag);
+extern void Dialog_SetDefault(Dialog *d, int32 tag);
+extern bool Dialog_SetPressed(Dialog *d, int32 tag);
+
+//MESSAGE TYPE SUPPORT
+extern bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, char *prompt, int32 tag);
+
+//PICTURE TYPE SUPPORT
+extern bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag);
+
+//BUTTON TYPE SUPPORT
+extern bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, char *prompt, M4CALLBACK cb, int32 tag);
+extern bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, char *prompt, M4CALLBACK cb, int32 tag);
+
+//LIST TYPE SUPPORT
+extern bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
+extern bool Dialog_Add_DirList(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag, char *myDir, char *myTypes);
+extern bool Dialog_Change_DirList(Dialog *d, Item *myItem, char *myDir, char *myTypes);
+extern bool Dialog_Add_List_Item(Dialog *d, Item *myItem, char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh);
+extern bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag);
+extern bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh);
+extern void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag);
+extern char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag);
+extern ListItem *Dialog_GetCurrListItem(Dialog *d, Item *i, int32 tag);
+extern char *Dialog_GetCurrListItemPrompt(Dialog *d, Item *i, int32 tag);
+extern bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag);
+extern bool Dialog_ListItemExists(Dialog *d, Item *myItem, int32 tag, char *prompt, int32 listTag);
+extern bool Dialog_ListboxSearch(Dialog *d, Item *myItem, int32 tag, int32 searchMode, char *searchStr, int32 parm1);
+extern void Dialog_GetPrevListItem(Dialog *d);
+extern void Dialog_GetNextListItem(Dialog *d);
+
+//TEXTFIELD TYPE SUPPORT
+extern bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
+extern void Dialog_RegisterTextField(Dialog *d);
+
+//HOTKEY SUPPORT
+extern bool Dialog_Add_Key(Dialog *d, long myKey, HotkeyCB cb);
+extern bool Dialog_Remove_Key(Dialog *d, long myKey);
+
+//GENERAL ITEM SUPPORT
+extern Item *Dialog_Get_Item(Dialog *d, int32 tag);
+extern void Dialog_Change_Item_Prompt(Dialog *d, char *newPrompt, Item *myItem, int32 tag);
+extern bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag);
+extern void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag);
+extern void Dialog_KeyMouseCollision();
+
+extern void Dialog_SystemError(char *s);
+
+extern bool sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h);
+extern bool sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect);
+extern bool drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect);
+
+extern bool custom_drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect);
+extern bool custom_sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h);
+extern bool custom_sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect);
+
+//----------------------------------------------------------------------------------------
+//TEXTSCRN STUFF...
+TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminance, uint32 scrnFlags,
+ int32 textColor, int32 hiliteColor,
+ int32 textColor_alt1 = 0, int32 hiliteColor_alt1 = 0,
+ int32 textColor_alt2 = 0, int32 hiliteColor_alt2 = 0);
+void vmng_TextScrn_Destroy(TextScrn *myTextScrn);
+void TextScrn_Destroy(TextScrn *myTextScrn);
+void TextScrn_Activate(TextScrn *myTextScrn);
+bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb);
+bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
+ int32 justification, char *prompt, M4CALLBACK callback);
+bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
+ int32 justification, char *prompt);
+void TextScrn_Change_TextItem(TextScrn *myTextScrn, int32 tag, char *prompt, uint8 color);
+void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_sys.h b/engines/m4/gui/gui_sys.h
index 7fe364951e0..82ce5d37f78 100644
--- a/engines/m4/gui/gui_sys.h
+++ b/engines/m4/gui/gui_sys.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef M4_ADV_R_DB_ENV_H
-#define M4_ADV_R_DB_ENV_H
+#ifndef M4_GUI_GUI_SYS_H
+#define M4_GUI_GUI_SYS_H
#include "m4/m4_types.h"
#include "m4/gui/gui_univ.h"
diff --git a/engines/m4/gui/gui_univ.h b/engines/m4/gui/gui_univ.h
index 4de48bc22ff..f4ffb5a9404 100644
--- a/engines/m4/gui/gui_univ.h
+++ b/engines/m4/gui/gui_univ.h
@@ -99,15 +99,6 @@ struct Item {
int32 tag;
};
-struct Dialog {
- int32 w, h;
- int32 num_items;
- Item *itemList;
- Item *listBottom;
- Item *cancel_item, *return_item, *default_item;
- GrBuff *dlgBuffer;
-};
-
struct TextItem {
struct TextItem *next;
int32 justification;
@@ -121,21 +112,6 @@ struct TextItem {
M4CALLBACK callback;
};
-struct TextScrn {
- int32 w, h;
- int32 textColor;
- int32 textColor_alt1;
- int32 textColor_alt2;
- int32 hiliteColor;
- int32 hiliteColor_alt1;
- int32 hiliteColor_alt2;
- int32 luminance;
- Font *myFont;
- TextItem *myTextItems;
- TextItem *hiliteItem;
- GrBuff *textScrnBuffer;
-};
-
} // End of namespace M4
#endif
diff --git a/engines/m4/gui/gui_vmng.cpp b/engines/m4/gui/gui_vmng.cpp
new file mode 100644
index 00000000000..6c0bf6f9275
--- /dev/null
+++ b/engines/m4/gui/gui_vmng.cpp
@@ -0,0 +1,106 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_vmng.h"
+#include "m4/gui/gui_dialog.h"
+#include "m4/mem/memman.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool vmng_init() {
+ if (_G(vmng_Initted))
+ return false;
+ _G(vmng_Initted) = true;
+
+ _G(frontScreen) = nullptr;
+ _G(backScreen) = nullptr;
+ _G(inactiveScreens) = nullptr;
+
+ if (!mem_register_stash_type(&_G(memtypeSCRN), sizeof(ScreenContext), 32, "+SCRN")) {
+ return false;
+ }
+ if (!mem_register_stash_type(&_G(memtypeMATTE), sizeof(matte), 32, "+guiMATTE")) {
+ return false;
+ }
+ if (!mem_register_stash_type(&_G(memtypeRECT), sizeof(RectList), 256, "+guiRecList")) {
+ return false;
+ }
+
+ return true;
+}
+
+void vmng_shutdown() {
+ ScreenContext *myScreen;
+ Hotkey *myHotkeys, *tempHotkey;
+
+ if (!_G(vmng_Initted))
+ return;
+ _G(vmng_Initted) = false;
+
+ // First, destroy all active windows
+ myScreen = _G(frontScreen);
+ while (myScreen) {
+ _G(frontScreen) = _G(frontScreen)->behind;
+ if (myScreen->scrnType == SCRN_DLG) {
+ vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
+ } else if (myScreen->scrnType == SCRN_TEXT) {
+ vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
+ }
+
+ myHotkeys = myScreen->scrnHotkeys;
+ tempHotkey = myHotkeys;
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ tempHotkey = myHotkeys;
+ }
+
+ mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
+ myScreen = _G(frontScreen);
+ }
+
+ // Duplicate the above loop exactly for the list of inactive windows
+ myScreen = _G(inactiveScreens);
+ while (myScreen) {
+ _G(inactiveScreens) = _G(inactiveScreens)->behind;
+ if (myScreen->scrnType == SCRN_DLG) {
+ vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
+ } else if (myScreen->scrnType == SCRN_TEXT) {
+ vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
+ }
+ myHotkeys = myScreen->scrnHotkeys;
+ tempHotkey = myHotkeys;
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ //mem_free_to_stash((void*)tempHotkey, memtypeHOTKEY);
+ tempHotkey = myHotkeys;
+ }
+
+ mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
+ myScreen = _G(inactiveScreens);
+ }
+}
+
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng.h b/engines/m4/gui/gui_vmng.h
new file mode 100644
index 00000000000..ff98fb41f36
--- /dev/null
+++ b/engines/m4/gui/gui_vmng.h
@@ -0,0 +1,51 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_VMNG_H
+#define M4_GUI_GUI_VMNG_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+/**
+ * To initialize the GUI view manager.
+ * @returns The success of the call
+ * @remarks Should be called once during program initialization,
+ * after dpmi_init_mem() has been called.
+ */
+extern bool vmng_init();
+
+/**
+ * Shutdown the GUI view manager, and release all resources.
+ *
+ * Since applications can be written in which Dialogs are designed, created, and
+ * Their callback procedures are executed by the view manager, it is not always
+ * necessary for the application to retain the (Dialog*)s which it created.
+ * Therefore, Any windows which contain a (Dialog*) and still exist also destroy
+ * The Dialog for which they were created. The same goes for (TextScrn*)s.
+ */
+void vmng_shutdown();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index cce7f3b114d..4ff98ade43f 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -29,7 +29,10 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
+#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/mem/mem.h"
#include "m4/m4.h"
#include "m4/detection.h"
#include "m4/console.h"
@@ -88,6 +91,8 @@ void M4Engine::game_systems_initialize(byte flags) {
"Cache System Disabled" : "Cache System Enabled");
debugC(kDebugCore, "Available memory: %ld", totalMem);
+ mem_stash_init(32);
+
if (flags & INSTALL_PLAYER_BEEN_INIT) {
if (!player_been_init(MAX_SCENES))
error_show(FL, 'PBIF');
@@ -100,13 +105,13 @@ void M4Engine::game_systems_initialize(byte flags) {
void M4Engine::fire_up_gui() {
if (!gui_system_init())
error_show(FL, 'GUI0');
-/*
if (!vmng_init())
error_show(FL, 'GUI1');
- if (!gui_mouse_init())
- error_show(FL, 'GUI2');
- if (!InitDialogs())
+// if (!gui_mouse_init())
+// error_show(FL, 'GUI2');
+ if (!gui_dialog_init())
error_show(FL, 'GUI3');
+/*
if (!InitItems())
error_show(FL, 'GUI4');
if (!gui_buffer_system_init())
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
new file mode 100644
index 00000000000..4f730813635
--- /dev/null
+++ b/engines/m4/mem/mem.cpp
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/mem/mem.h"
+#include "m4/mem/memman.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define MAX_REQUESTS 255
+
+void mem_stash_init(int16 num_types) {
+ if (num_types > _MEMTYPE_LIMIT)
+ error_show(FL, 'MSIF', "num_types (%d) _MEMTYPE_LIMIT (%d)", num_types, _MEMTYPE_LIMIT);
+
+ for (int i = 0; i < _MEMTYPE_LIMIT; i++) {
+ _G(memBlock)[i] = NULL;
+ _G(sizeMem)[i] = 0;
+ _G(requests)[i] = 0;
+ }
+}
+
+void mem_stash_shutdown(void) {
+ for (int i = 0; i < _MEMTYPE_LIMIT; i++) {
+ if (_G(memBlock)[i]) {
+ mem_free(_G(memBlock)[i]);
+ _G(memBlock)[i] = NULL;
+ }
+ }
+}
+
+bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumRequests, const char *name) {
+ int32 i = 0;
+ bool found = false;
+
+ while ((i < _MEMTYPE_LIMIT) && (_G(sizeMem)[i] > 0) && (!found)) {
+ if (blockSize == _G(sizeMem)[i])
+ break;
+ else
+ i++;
+ }
+ if (i == _MEMTYPE_LIMIT)
+ error_show(FL, 'MSIF', "stash: %s", name);
+
+ // Found a slot
+ if (found || (i < _MEMTYPE_LIMIT)) {
+ _G(sizeMem)[i] = blockSize;
+ *memType = i;
+
+ if (maxNumRequests > MAX_REQUESTS)
+ maxNumRequests = MAX_REQUESTS;
+
+ _G(requests)[i] = maxNumRequests;
+
+ _G(memBlock)[i] = mem_alloc((blockSize + 1) * maxNumRequests, name);
+ memset(_G(memBlock)[i], 0, (blockSize + 1) * maxNumRequests);
+
+ return true;
+ }
+
+ error_show(FL, 'MSIF', "stash: %s", name);
+ return false;
+}
+
+void mem_free_to_stash(void *mem, int32 memType) {
+ // _G(memBlock)[memType] is block associated with memType
+ int8 *b_ptr = (int8 *)_G(memBlock)[memType];
+ int32 index = ((long)mem - (long)_G(memBlock)[memType]) / (_G(sizeMem)[memType] + 1);
+
+ if (index < 0 || index > _G(requests)[memType])
+ error_show(FL, 'MSGF', NULL);
+
+ b_ptr += index * (_G(sizeMem)[memType] + 1);
+ *b_ptr = 0;
+}
+
+/**
+ * Deliver a memory block whose size has been previously registered.
+ */
+void *mem_get_from_stash(int32 memType, char *name) {
+ int i;
+ int8 *b_ptr = (int8 *)_G(memBlock)[memType];
+
+ for (i = 0; i < _G(requests)[memType]; i++) {
+ if (!*b_ptr) {
+ *b_ptr = 1;
+ return (void *)(b_ptr + 1);
+ } else {
+ b_ptr += _G(sizeMem)[memType] + 1;
+ }
+ }
+
+ error_show(FL, 'OOS!', "stash full %s", name);
+ return 0;
+}
+
+} // namespace M4
diff --git a/engines/m4/mem/mem.h b/engines/m4/mem/mem.h
new file mode 100644
index 00000000000..066741ac07d
--- /dev/null
+++ b/engines/m4/mem/mem.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_MEM_MEM_H
+#define M4_MEM_MEM_H
+
+#include "common/scummsys.h"
+
+namespace M4 {
+
+/**
+ * Initialize the memory manager.
+ */
+extern void mem_stash_init(int16 num_types);
+
+/**
+ * Purges the memory manager
+ */
+extern void mem_stash_shutdown();
+
+extern bool mem_register_stash_type(int32 *memType, int32 size, int32 numRequests, const char *name);
+
+/**
+ * To free a memory block whose size has been previously registered.
+ * @param myMem The pointer to be freed
+ */
+extern void mem_free_to_stash(void *myMem, int32 memType);
+
+extern void *mem_get_from_stash(int32 memType, const char *name);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mem/memman.h b/engines/m4/mem/memman.h
index 7bbbd289dbf..f38c6464354 100644
--- a/engines/m4/mem/memman.h
+++ b/engines/m4/mem/memman.h
@@ -27,6 +27,8 @@
namespace M4 {
+#define _MEMTYPE_LIMIT 33
+
inline Handle mem_alloc(size_t size, const char *) {
return (Handle)malloc(size);
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 080ad41e822..8c21d4d5e4e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -23,7 +23,10 @@ MODULE_OBJS = \
graphics/gr_font.o \
graphics/gr_pal.o \
graphics/graphics.o \
+ gui/gui_dialog.o \
gui/gui_sys.o \
+ gui/gui_vmng.o \
+ mem/mem.o \
mem/memman.o \
mem/reloc.o \
burger/burger.o
Commit: 482343f47370220645ac157b8b8fa433893d44a1
https://github.com/scummvm/scummvm/commit/482343f47370220645ac157b8b8fa433893d44a1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding mouse code
Changed paths:
A engines/m4/core/mouse.cpp
A engines/m4/core/mouse.h
A engines/m4/gui/gui_mouse.cpp
A engines/m4/gui/gui_mouse.h
engines/m4/fileio/sys_file.cpp
engines/m4/globals.h
engines/m4/gui/gui.h
engines/m4/gui/gui_vmng.cpp
engines/m4/gui/gui_vmng.h
engines/m4/m4.cpp
engines/m4/m4_types.h
engines/m4/mem/mem.cpp
engines/m4/mem/mem.h
engines/m4/mem/reloc.cpp
engines/m4/mem/reloc.h
engines/m4/mem/res.cpp
engines/m4/mem/res.h
engines/m4/module.mk
diff --git a/engines/m4/core/mouse.cpp b/engines/m4/core/mouse.cpp
new file mode 100644
index 00000000000..8f3d8f48639
--- /dev/null
+++ b/engines/m4/core/mouse.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/core/mouse.h"
+
+namespace M4 {
+
+static byte Pointer[] = {
+ 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 01, 01, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 01, 01, 01, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 01, 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 01, 15, 00, 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 15, 00, 00, 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 15, 00, 00, 00, 00, 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 15, 01, 01, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
+};
+
+// returns FALSE if the mouse couldn't be initialized
+int mouse_init() {
+ return true;
+}
+
+
+void mouse_uninstall() {
+ // No implementation
+}
+
+byte *GetMousePicture() {
+ return &Pointer[0];
+}
+
+} // namespace M4
diff --git a/engines/m4/core/mouse.h b/engines/m4/core/mouse.h
new file mode 100644
index 00000000000..4ff67a875ca
--- /dev/null
+++ b/engines/m4/core/mouse.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 M4_CORE_MOUSE_H
+#define M4_CORE_MOUSE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern int mouse_init();
+extern void mouse_uninstall();
+extern byte *GetMousePicture();
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 8dceb09e1c4..bea9342abdd 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -575,7 +575,7 @@ int32 SysFile::read(MemHandle bufferHandle, int32 n) {
open_read();
if (!*bufferHandle)
- mem_ReallocateHandle(bufferHandle, n);
+ mem_ReallocateHandle(bufferHandle, n, "SysFile");
if (!*bufferHandle)
error("Needed %d to read info", n);
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 4680ea5cd1d..20a18c1e2de 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -29,8 +29,10 @@
#include "m4/adv_r/adv_been.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
+#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
#include "m4/mem/memman.h"
+#include "m4/mem/res.h"
namespace M4 {
@@ -40,7 +42,7 @@ struct Globals;
extern Globals *g_globals;
-struct Globals {
+struct Globals : public Mouse_Statics {
Globals();
~Globals();
@@ -51,6 +53,7 @@ struct Globals {
SceneDef _currentSceneDef;
Scene_list _scene_list;
frac16 _globals[GLB_SHARED_VARS];
+ Resources _resources;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
@@ -72,7 +75,6 @@ struct Globals {
bool _interface_visible = false;
bool _please_hyperwalk = false;
void (*_custom_ascii_converter)(char *string) = nullptr;
- int32 _mouseX = 0, _mouseY = 0, _oldX = 0, _oldY = 0;
bool _vmng_Initted = false;
ScreenContext *_frontScreen = nullptr;
ScreenContext *_backScreen = nullptr;
diff --git a/engines/m4/gui/gui.h b/engines/m4/gui/gui.h
index be2a83894f9..3bf4dea8fc1 100644
--- a/engines/m4/gui/gui.h
+++ b/engines/m4/gui/gui.h
@@ -24,31 +24,31 @@
#define M4_GUI_GUI_H
#include "m4/m4_types.h"
+#include "m4/graphics/gr_buff.h"
namespace M4 {
-enum {
- SCRN_DLG = 0, SCRN_BUF, SCRN_TEXT, SCRN_TRANS
-};
-enum {
- SCRN_ANY = 0, SCRN_ACTIVE, SCRN_INACTIVE, SCRN_UNDEFN
-};
-
struct M4sprite {
struct M4sprite *next;
struct M4sprite *prev;
- int32 x;
- int32 y;
- int32 w;
- int32 h;
- int32 xOffset; // the "hotspot" of the sprite, ie: the registration point
- int32 yOffset;
- uint8 encoding;
+ int32 x;
+ int32 y;
+ int32 w;
+ int32 h;
+ int32 xOffset; // the "hotspot" of the sprite, ie: the registration point
+ int32 yOffset;
+ uint8 encoding;
uint8 *data;
- Handle sourceHandle;
- int32 sourceOffset;
+ Handle sourceHandle;
+ int32 sourceOffset;
+};
+
+struct transSprite {
+ M4sprite *srcSprite;
+ Buffer *scrnBuffer;
};
+
struct M4Rect {
int32 x1, y1, x2, y2;
};
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
new file mode 100644
index 00000000000..d67c4874177
--- /dev/null
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -0,0 +1,270 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_mouse.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/core/mouse.h"
+#include "m4/mem/res.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static void transShow(void *s, void *r, void *b, int32 destX, int32 destY);
+
+bool gui_mouse_init() {
+ _G(mouseBuffer).data = NULL;
+ if ((_G(mouseBuffer).data = (uint8 *)mem_alloc(32 * 32, "mouse graphic")) == NULL) {
+ return false;
+ }
+ _G(mouseBuffer).W = 32;
+ _G(mouseBuffer).stride = 32;
+ _G(mouseBuffer).h = 32;
+
+ auto &mouseSprite = _G(mouseSprite);
+ if (!mouseSprite) {
+ if ((mouseSprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "mouse sprite")) == NULL) {
+ return false;
+ }
+
+ mouseSprite->x = 0;
+ mouseSprite->y = 0;
+ mouseSprite->w = 32;
+ mouseSprite->h = 32;
+ mouseSprite->xOffset = 0;
+ mouseSprite->yOffset = 0;
+ mouseSprite->encoding = 0;
+ mouseSprite->data = GetMousePicture();
+ mouseSprite->sourceHandle = NULL;
+ mouseSprite->sourceOffset = 0;
+
+ _G(mouseX1offset) = mouseSprite->xOffset;
+ _G(mouseY1offset) = mouseSprite->yOffset;
+ _G(mouseX2offset) = mouseSprite->w - _G(mouseX1offset) - 1;
+ _G(mouseY2offset) = mouseSprite->h - _G(mouseY1offset) - 1;
+ }
+
+ if ((_G(mouseScreenSource) = (transSprite *)mem_alloc(sizeof(transSprite), "mouse transSprite")) == NULL) {
+ return false;
+ }
+
+ _G(mouseScreenSource)->srcSprite = mouseSprite;
+ _G(mouseScreenSource)->scrnBuffer = &_G(mouseBuffer);
+
+ if ((_G(mouseScreen) = vmng_screen_create(0, 0, mouseSprite->w - 1, mouseSprite->h - 1, SCRN_TRANS, SF_MOUSE | SF_OFFSCRN | SF_TRANSPARENT,
+ (void *)_G(mouseScreenSource), transShow, nullptr)) == nullptr) {
+ return false;
+ }
+
+ _G(mouseSeriesResource) = NULL;
+ _G(mouseSeriesHandle) = NULL;
+ _G(mouseSeriesOffset) = 0;
+ _G(mouseSeriesPalOffset) = 0;
+
+ return true;
+}
+
+void gui_mouse_shutdown() {
+ mem_free(_G(mouseSprite));
+ gr_buffer_free(&_G(mouseBuffer));
+ mem_free((void *)_G(mouseScreenSource));
+
+ if (_G(mouseSeriesResource)) {
+ rtoss(_G(mouseSeriesResource));
+ mem_free(_G(mouseSeriesResource));
+ }
+
+ _G(mouseSeriesResource) = NULL;
+ _G(mouseSeriesHandle) = NULL;
+ _G(mouseSeriesOffset) = 0;
+ _G(mouseSeriesPalOffset) = 0;
+}
+
+void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
+#ifdef TODO
+ ScreenContext *myScreen = (ScreenContext *)s;
+ matte *myRectList = (matte *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ ScreenContext *tempScreen;
+ transSprite *mySource;
+ M4sprite *mySprite;
+ Buffer *myBuff;
+ Buffer drawSpriteBuff;
+ DrawRequest spriteDrawReq;
+ matte *myMatte, tempMatte;
+ RectList *updateList, *updateRect;
+ RectList *newUpdateList;
+ uint8 *rowPtr, *destPtr;
+ int32 i, j;
+
+ //parameter verification
+ if (!myScreen) return;
+
+ mySource = (transSprite *)(myScreen->scrnContent);
+ if (!mySource) return;
+
+ myBuff = (Buffer *)(mySource->scrnBuffer);
+ if (!myBuff) return;
+
+ mySprite = mySource->srcSprite;
+ if (!mySprite) return;
+
+ //if no destBuffer, then draw directly to video
+ if (!destBuffer) {
+
+ tempMatte.nextMatte = NULL;
+
+ //loopthrough the dirty matte list
+ myMatte = myRectList;
+ while (myMatte) {
+
+ //create an updateRectList to catch the black areas afterwards
+ updateList = vmng_CreateNewRect(myMatte->x1, myMatte->y1, myMatte->x2, myMatte->y2);
+ updateList->prev = NULL;
+ updateList->next = NULL;
+
+ //now loop through all the screens behind myScreen
+ tempScreen = myScreen->behind;
+ while (tempScreen && updateList) {
+
+ //duplicate the updateList
+ newUpdateList = vmng_DuplicateRectList(updateList);
+
+ //loop through the updateList
+ updateRect = updateList;
+ while (updateRect) {
+
+ //see if it intersects
+ tempMatte.x1 = imath_max(updateRect->x1, tempScreen->x1);
+ tempMatte.y1 = imath_max(updateRect->y1, tempScreen->y1);
+ tempMatte.x2 = imath_min(updateRect->x2, tempScreen->x2);
+ tempMatte.y2 = imath_min(updateRect->y2, tempScreen->y2);
+
+ if (tempScreen->redraw && (tempMatte.x1 <= tempMatte.x2) && (tempMatte.y1 <= tempMatte.y2)) {
+ //draw the intersected part of tempScreen onto myBuffer
+ (tempScreen->redraw)(tempScreen, (void *)&tempMatte, myBuff, tempMatte.x1 - myScreen->x1, tempMatte.y1 - myScreen->y1);
+
+ //remove that rectangle from the update list
+ vmng_RemoveRectFromRectList(&newUpdateList, tempMatte.x1, tempMatte.y1, tempMatte.x2, tempMatte.y2);
+ }
+
+ //get the next updateRect
+ updateRect = updateRect->next;
+ }
+
+ //the newUpdateList now contains all the pieces not covered by tempScreen;
+ //turf the update list, and replace it with the newupdateList
+ vmng_DisposeRectList(&updateList);
+ updateList = newUpdateList;
+
+ //now get the next screen
+ tempScreen = tempScreen->behind;
+ }
+
+ //now we've gone through all the screens, whatever is left in the updateList should be filled in with black
+ gr_color_set(__BLACK);
+ updateRect = updateList;
+ while (updateRect) {
+ gr_buffer_rect_fill(myBuff, updateRect->x1 - myScreen->x1, updateRect->y1 - myScreen->y1,
+ updateRect->x2 - updateRect->x1 + 1, updateRect->y2 - updateRect->y1 + 1);
+ updateRect = updateRect->next;
+ }
+
+ //now dispose of the updateList
+ vmng_DisposeRectList(&updateList);
+
+ //and finally, get the next matte
+ myMatte = myMatte->nextMatte;
+ }
+
+ //now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
+ //now would be the time to draw the contents
+
+ if (mySprite->sourceHandle) {
+ HLock(mySprite->sourceHandle);
+ mySprite->data = (uint8 *)((int32) * (mySprite->sourceHandle) + mySprite->sourceOffset);
+
+ drawSpriteBuff.W = mySprite->w;
+ drawSpriteBuff.stride = mySprite->w;
+ drawSpriteBuff.h = mySprite->h;
+ drawSpriteBuff.encoding = (mySprite->encoding) & (uint8)0x7f;
+ drawSpriteBuff.data = mySprite->data;
+
+ spriteDrawReq.Src = &drawSpriteBuff;
+ spriteDrawReq.Dest = myBuff;
+ spriteDrawReq.x = 0;
+ spriteDrawReq.y = 0;
+ spriteDrawReq.scaleX = 100;
+ spriteDrawReq.scaleY = 100;
+ spriteDrawReq.srcDepth = 0;
+ spriteDrawReq.depthCode = NULL;
+ spriteDrawReq.Pal = NULL;
+ spriteDrawReq.ICT = NULL;
+
+ gr_sprite_draw(&spriteDrawReq);
+
+ //unlock the handle
+ HUnLock(mySprite->sourceHandle);
+ }
+
+ //else the data for the transparent sprite is stored directly in mySprite->data
+ else if (mySprite->data) {
+
+ //loop through the rows
+ for (j = 0; (j < mySprite->h) && (j < myBuff->h); j++) {
+
+ //set the rowPtr and the destPtr
+ rowPtr = mySprite->data + (j * mySprite->w);
+ destPtr = myBuff->data + (j * myBuff->stride);
+
+ //loop through the columns
+ for (i = 0; (i < mySprite->w) && (i < myBuff->W); i++) {
+ if (*rowPtr) {
+ *destPtr = *rowPtr;
+ }
+ destPtr++;
+ rowPtr++;
+ }
+ }
+ }
+
+ //now dump the matte list out to video
+ myMatte = myRectList;
+ while (myMatte) {
+ vmng_refresh_video(myMatte->x1, myMatte->y1, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
+ myMatte->x2 - myScreen->x1, myMatte->y2 - myScreen->y1, myBuff);
+ myMatte = myMatte->nextMatte;
+ }
+ }
+
+ //else draw to the dest buffer
+ else {
+ myMatte = myRectList;
+ while (myMatte) {
+ gr_buffer_rect_copy_2(myBuff, destBuffer, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
+ destX, destY, myMatte->x2 - myMatte->x1 + 1, myMatte->y2 - myMatte->y1 + 1);
+ myMatte = myMatte->nextMatte;
+ }
+ }
+#endif
+}
+
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
new file mode 100644
index 00000000000..42a725026c3
--- /dev/null
+++ b/engines/m4/gui/gui_mouse.h
@@ -0,0 +1,71 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_MOUSE_H
+#define M4_GUI_GUI_MOUSE_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+struct Mouse_Statics {
+ ScreenContext *_mouseScreen = nullptr;
+ transSprite *_mouseScreenSource = nullptr;
+
+ Buffer _mouseBuffer; // A scratch buffer used by RedrawMouse()
+ char *_mouseSeriesResource = nullptr;
+ Handle _mouseSeriesHandle = nullptr;
+ int32 _mouseSeriesOffset = 0;
+ int32 _mouseSeriesPalOffset = 0;
+ M4sprite *_mouseSprite = nullptr; // The specific sprite which is drawn to indicate the current mouse position.
+ int32 _mouseX1offset = 0; // These two are the "x" and "Y" offset into the sprite which will center that
+ int32 _mouseY1offset = 0; // sprite onto the current mouse position. ie. the mouse "hot spot".
+ int32 _mouseX2offset = 0; // These two are the horizontal and vertical distances from the mouse "hot spot"
+ int32 _mouseY2offset = 0; // to the edge of the sprite.
+ int32 _currMouseNum = 0; // The current index into the sprite series of the sprite which currently is the mouse.
+ bool _mouseIsLocked = false; // An bool which when TRUE will prevent any other mouse from being set.
+ int32 _newMouseNum = 0; // An int32 which stores the currMouseNum while the mouse is locked.
+
+ int32 _hideMouseX1 = MIN_VIDEO_X - 1; // These 4 represent the mouse "hide" rectangle. The mouse is drawn if'f it is
+ int32 _hideMouseY1 = MIN_VIDEO_Y - 1; // located within the mouse "show" rectangle (below), or it is not within the
+ int32 _hideMouseX2 = MIN_VIDEO_X - 1; // mouse "hide" rectangle. ie. If the "hide" rect covers the whole monitor, and
+ int32 _hideMouseY2 = MIN_VIDEO_Y - 1; // the "show" rectangle covers a specific window, then the mouse will be hidden
+ // everywhere except within the specific window.
+ int32 _showMouseX1 = MIN_VIDEO_X; // These 4 represent the mouse "show" rectangle.
+ int32 _showMouseY1 = MIN_VIDEO_Y;
+ int32 _showMouseX2 = MAX_VIDEO_X;
+ int32 _showMouseY2 = MAX_VIDEO_Y;
+
+ int32 _mouseX = MAX_VIDEO_X >> 1; // The current mouse "x" position (global coords).
+ int32 _mouseY = MAX_VIDEO_Y >> 1; // The current mouse "y" position (global coords).
+
+ int32 _oldX = MAX_VIDEO_X >> 1; // The previous mouse "x" and "y" position. When the mouse has moved, the
+ int32 _oldY = MAX_VIDEO_Y >> 1; // position where the mouse sprite was last drawn is here.
+};
+
+extern bool gui_mouse_init();
+extern void gui_mouse_shutdown();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_vmng.cpp b/engines/m4/gui/gui_vmng.cpp
index 6c0bf6f9275..36a96f94c77 100644
--- a/engines/m4/gui/gui_vmng.cpp
+++ b/engines/m4/gui/gui_vmng.cpp
@@ -19,6 +19,41 @@
*
*/
+/**
+ * THE GUI:
+ * gui_vmng.cpp controls the windowing system. The gui is comprised of layered independent
+ * windows. The view manager controls which pieces of each window are visible, and which
+ * window receives events. The contents of of the windows, whether they be dialog boxes,
+ * buffers, or some new addition has no bearing on the performance of the view manager.
+ * Therefore, each window is created with a layer, an event handler, and a redraw function.
+ * When the view manager determines that an area of a window needs to be redrawn, it
+ * simply calls that window's redraw function. It is up to the redraw function to ensure
+ * that the rectangle is properly redrawn. If an event occurs, the view manager will
+ * determine which window should handle the event.
+ *
+ * To recap then, it manages the visual display of each window's current position
+ * and relative layer, and when either a keyboard event, or mouse event is registered, which
+ * window's evtHandler will be given the event to process. In addition to requesting a
+ * window to redraw a portion of itself, or handle an event which has occurred, vmng.cpp
+ * also displays the mouse in its current location. Through the use of an off screen bitmap
+ * which is an exact duplicate of what is visible on the monitor, the view manager creates
+ * a flicker-free graphical display of the mouse and all visible windows.
+ *
+ * NOTE: FOR MANY OF THE FOLLOWING PROCEDURES, A "void *scrnContent" IS LISTED AMONG THE
+ * PARAMETERS. THIS PARAMETER REFERS TO THE STRUCTURE FOR WHICH THE WINDOW WAS CREATED, BE
+ * IT A (Buffer*), (Dialog*), (TextScrn*), OR WHATEVER. SINCE THE VIEW MANAGER ONLY
+ * REQUESTS WINDOW REFRESHES AND PASSES EVENTS, THE CONTENTS OF THE WINDOW ARE UNKNOWN,
+ * AND THEREFORE, ALL ARE STORED AS (void*). FROM NOW ON, THIS WILL BE KNOWN AS THE "WINDOW
+ * IDENTIFIER".
+ *
+ * NOTE: THE TERM "WINDOW" AND THE TERM "SCREEN" ARE COMPLETELY INTERCHANGEABLE DURING
+ * THE DOCUMENTATION OF ANY GUI SOURCE CODE.
+ *
+ * NOTE: ANY PROCEDURE IN THIS FILE WHICH, WHEN EXECUTED, RESULTS IN A VISUAL CHANGE TO
+ * THE MONITOR (SUCH AS vmng_screen_show(), or MoveScreen())
+ * WILL ALSO RESTORE THE MONITOR'S IMAGE, TAKING CARE OF A VIDEO REFRESH REQUIREMENTS.
+ */
+
#include "m4/gui/gui_vmng.h"
#include "m4/gui/gui_dialog.h"
#include "m4/mem/memman.h"
@@ -102,5 +137,34 @@ void vmng_shutdown() {
}
}
+ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
+ void *scrnContent, RefreshFunc redraw, EventHandler evtHandler) {
+ ScreenContext *myScreen;
+
+ if (!_G(vmng_Initted))
+ return nullptr;
+
+ if ((myScreen = (ScreenContext *)mem_get_from_stash(_G(memtypeSCRN), "+SCRN")) == nullptr)
+ return nullptr;
+
+ myScreen->x1 = x1;
+ myScreen->y1 = y1;
+ myScreen->x2 = x2;
+ myScreen->y2 = y2;
+ myScreen->scrnType = scrnType;
+ myScreen->scrnFlags = scrnFlags;
+ myScreen->scrnContent = scrnContent;
+ myScreen->redraw = redraw;
+ myScreen->evtHandler = evtHandler;
+ myScreen->scrnHotkeys = nullptr;
+
+ if (_G(inactiveScreens))
+ _G(inactiveScreens)->infront = myScreen;
+
+ myScreen->behind = _G(inactiveScreens);
+ myScreen->infront = nullptr;
+ _G(inactiveScreens) = myScreen;
+ return myScreen;
+}
} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng.h b/engines/m4/gui/gui_vmng.h
index ff98fb41f36..b6e00637e79 100644
--- a/engines/m4/gui/gui_vmng.h
+++ b/engines/m4/gui/gui_vmng.h
@@ -24,9 +24,41 @@
#define M4_GUI_GUI_VMNG_H
#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
namespace M4 {
+enum {
+ SCRN_DLG = 0, SCRN_BUF, SCRN_TEXT, SCRN_TRANS
+};
+enum {
+ SCRN_ANY = 0, SCRN_ACTIVE, SCRN_INACTIVE, SCRN_UNDEFN
+};
+
+#define SF_LAYER 0x000f
+#define SF_BACKGRND 0x0000
+#define SF_DRIFTER 0x0001
+#define SF_FLOATER 0x0002
+#define SF_SURFACE 0x0003
+#define SF_MOUSE 0x000e
+
+#define SF_GET_NONE 0x0000
+#define SF_GET_KEY 0x0010
+#define SF_GET_MOUSE 0x0020
+#define SF_GET_ALL 0x0030
+
+#define SF_BLOCK_NONE 0x0000
+#define SF_BLOCK_KEY 0x0040
+#define SF_BLOCK_MOUSE 0x0080
+#define SF_BLOCK_ALL 0x00c0
+
+#define SF_IMMOVABLE 0x0100 // if set, it ain't draggable
+#define SF_OFFSCRN 0x0200 // can be dragged off screen, if it's draggable
+#define SF_TRANSPARENT 0x0400 // if the screen is transparent
+
+#define SF_DEFAULT SF_DRIFTER | SF_GET_ALL | SF_BLOCK_NONE
+#define SF_ALERT SF_FLOATER | SF_GET_ALL | SF_BLOCK_ALL
+
/**
* To initialize the GUI view manager.
* @returns The success of the call
@@ -46,6 +78,70 @@ extern bool vmng_init();
*/
void vmng_shutdown();
+/**
+ * Create a new window for the identifier given (scrnContent).
+ * @param x1 Top left x
+ * @param y1 Top left y
+ * @param x2 Bottom right x
+ * @param y2 Bottom right y
+ * @param scrnType One of: SCRN_DLG (Dialog), SCRN_BUF (Buffer),
+ * SCRN_TEXT (TextScrn). to identify scrnContent type.
+ * @param See the overview at the top of this file for an explanation of scrnFlags.
+ * @param scrnContent The identifier for the new window.
+ * @param redraw The function pointer which will be called when the view
+ * manager requests the window to redraw a portion of itself.
+ * @param evtHandler The function pointer call when the view manager
+ * determines that an event should be processed by this window.
+ * @remarks If TRUE is returned, the window was successfully created, and is currently
+ * in the list of inactive windows. A call to vmng_screen_show() will activate
+ * (make visible) this window.
+ */
+extern ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
+ void *scrnContent, RefreshFunc redraw, EventHandler evtHandler);
+
+/**
+ * Return the ScreenContext * associated with a window, and to determine whether it is active,
+ * exists but is inactive (invisible, no events are received or blocked), or is undefined
+ * (does not exist).
+ * @param scrnContent The window identifier.
+ * @param status If not NULL, the status: SCRN_ACTIVE, SCRN_INACTIVE, or SCRN_UNDEFN
+ * is recoreded here.
+ * @returns the ScreenContext* associated with the window which was created for
+ * the structure scrnContent. returns NULL if now window was found.
+ */
+extern ScreenContext *vmng_screen_find(void *scrnContent, int32 *status); // was FindScreen
+
+/**
+ * Remove a window from the active list, and place it on the inactive list
+ * @param The window identifier
+ */
+extern void vmng_screen_hide(void *scrnContent); // was HideScreen
+
+/**
+ * Place a window at the front of its layer on the active list.
+ * @param scrnContent The window Identifier.
+ * @remarks If the window is currently inactive, it will be activated and placed
+ * into the list at the front of its layer (SF_BACKGRND, SF_DRIFTER, SF_FLOATER, or SF_SURFACE).
+ * If the window is already active, it will be moved to the front of its layer.
+ */
+extern void vmng_screen_show(void *scrnContent); // was ShowScreen
+
+/**
+ * Place a window at the back of its layer.
+ * @param scrnContent The window Identifier.
+ * @remarks Essentially this procedure does the same as vmng_screen_show(),
+ * the only difference is that the window is at the back of its layer.
+ */
+extern void vmng_screen_to_back(void *scrnContent); // was MoveScreenToBack
+
+/**
+ * Release all resources associated with the window.
+ * @param scrnContent The window Identifier.
+ */
+extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
+
+extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 4ff98ade43f..9522b916659 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -63,7 +63,7 @@ Common::Error M4Engine::run() {
Globals globals;
// Initialize 320x200 paletted graphics mode
- initGraphics(320, 200);
+ initGraphics(640, 480);
param_init();
parse_all_flags();
@@ -107,8 +107,8 @@ void M4Engine::fire_up_gui() {
error_show(FL, 'GUI0');
if (!vmng_init())
error_show(FL, 'GUI1');
-// if (!gui_mouse_init())
-// error_show(FL, 'GUI2');
+ if (!gui_mouse_init())
+ error_show(FL, 'GUI2');
if (!gui_dialog_init())
error_show(FL, 'GUI3');
/*
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index b293510ba40..1146cbb46e7 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -27,6 +27,12 @@
namespace M4 {
#define MAX_FILENAME_SIZE 144
+#define MIN_VIDEO_X 0
+#define MIN_VIDEO_Y 0
+#define MAX_VIDEO_X 639
+#define MAX_VIDEO_Y 479
+#define VIDEO_W 640
+#define VIDEO_H 480
typedef void *Ptr;
typedef void *Handle;
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 4f730813635..1c8cc596bd1 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -47,7 +47,7 @@ void mem_stash_shutdown(void) {
}
}
-bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumRequests, const char *name) {
+bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumRequests, const Common::String &name) {
int32 i = 0;
bool found = false;
@@ -58,7 +58,7 @@ bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumReques
i++;
}
if (i == _MEMTYPE_LIMIT)
- error_show(FL, 'MSIF', "stash: %s", name);
+ error_show(FL, 'MSIF', "stash: %s", name.c_str());
// Found a slot
if (found || (i < _MEMTYPE_LIMIT)) {
@@ -70,13 +70,13 @@ bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumReques
_G(requests)[i] = maxNumRequests;
- _G(memBlock)[i] = mem_alloc((blockSize + 1) * maxNumRequests, name);
+ _G(memBlock)[i] = mem_alloc((blockSize + 1) * maxNumRequests, name.c_str());
memset(_G(memBlock)[i], 0, (blockSize + 1) * maxNumRequests);
return true;
}
- error_show(FL, 'MSIF', "stash: %s", name);
+ error_show(FL, 'MSIF', "stash: %s", name.c_str());
return false;
}
@@ -95,7 +95,7 @@ void mem_free_to_stash(void *mem, int32 memType) {
/**
* Deliver a memory block whose size has been previously registered.
*/
-void *mem_get_from_stash(int32 memType, char *name) {
+void *mem_get_from_stash(int32 memType, const Common::String &name) {
int i;
int8 *b_ptr = (int8 *)_G(memBlock)[memType];
@@ -108,7 +108,7 @@ void *mem_get_from_stash(int32 memType, char *name) {
}
}
- error_show(FL, 'OOS!', "stash full %s", name);
+ error_show(FL, 'OOS!', "stash full %s", name.c_str());
return 0;
}
diff --git a/engines/m4/mem/mem.h b/engines/m4/mem/mem.h
index 066741ac07d..7e3d9c58aca 100644
--- a/engines/m4/mem/mem.h
+++ b/engines/m4/mem/mem.h
@@ -22,7 +22,7 @@
#ifndef M4_MEM_MEM_H
#define M4_MEM_MEM_H
-#include "common/scummsys.h"
+#include "common/str.h"
namespace M4 {
@@ -36,7 +36,7 @@ extern void mem_stash_init(int16 num_types);
*/
extern void mem_stash_shutdown();
-extern bool mem_register_stash_type(int32 *memType, int32 size, int32 numRequests, const char *name);
+extern bool mem_register_stash_type(int32 *memType, int32 size, int32 numRequests, const Common::String &name);
/**
* To free a memory block whose size has been previously registered.
@@ -44,7 +44,7 @@ extern bool mem_register_stash_type(int32 *memType, int32 size, int32 numRequest
*/
extern void mem_free_to_stash(void *myMem, int32 memType);
-extern void *mem_get_from_stash(int32 memType, const char *name);
+extern void *mem_get_from_stash(int32 memType, const Common::String &name);
} // namespace M4
diff --git a/engines/m4/mem/reloc.cpp b/engines/m4/mem/reloc.cpp
index f2c87be4c02..8655eda9a47 100644
--- a/engines/m4/mem/reloc.cpp
+++ b/engines/m4/mem/reloc.cpp
@@ -27,14 +27,14 @@ struct HR {
void *_data;
};
-MemHandle NewHandle(size_t size, const char *) {
+MemHandle NewHandle(size_t size, const Common::String &) {
HR *result = (HR *)malloc(sizeof(HR));
result->_data = malloc(size);
return (MemHandle)result;
}
-bool mem_ReallocateHandle(MemHandle h, size_t size, const char *) {
+bool mem_ReallocateHandle(MemHandle h, size_t size, const Common::String &) {
HR *hr = (HR *)h;
assert(!hr->_data);
hr->_data = malloc(size);
@@ -42,4 +42,8 @@ bool mem_ReallocateHandle(MemHandle h, size_t size, const char *) {
return true;
}
+MemHandle MakeNewHandle(size_t size, const Common::String &name) {
+ return NewHandle(size, name);
+}
+
} // namespace M4
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
index e33e1299405..885e3b48c99 100644
--- a/engines/m4/mem/reloc.h
+++ b/engines/m4/mem/reloc.h
@@ -22,20 +22,24 @@
#ifndef M4_RELOC_H
#define M4_RELOC_H
+#include "common/str.h"
#include "m4/m4_types.h"
namespace M4 {
typedef void **MemHandle;
-inline void HNoPurge(Handle h) {
-}
+inline void HLock(Handle h) {}
+inline void HUnLock(Handle h) {}
+inline void HPurge(Handle h) {}
+inline void HNoPurge(Handle h) {}
+
inline bool MakeMem(size_t FreeBlockNeeded, const char *) {
return true;
}
-MemHandle MakeNewHandle(size_t size, const char *name = nullptr);
-bool mem_ReallocateHandle(MemHandle h, size_t size, const char *name = nullptr);
+extern MemHandle MakeNewHandle(size_t size, const Common::String &);
+extern bool mem_ReallocateHandle(MemHandle h, size_t size, const Common::String &name);
} // namespace M4
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index 555bf77c76e..f90780f9814 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -24,6 +24,7 @@
#include "m4/mem/res.h"
#include "m4/mem/memman.h"
#include "m4/mem/reloc.h"
+#include "m4/core/errors.h"
#include "m4/globals.h"
namespace M4 {
@@ -163,6 +164,41 @@ Handle Resources::rget(const Common::String &resourceName, int32 *resourceSize)
return resEntry->RHandle;
}
+void Resources::rtoss(const Common::String &resourceName) {
+ int hash_val;
+ Entry *resEntry = NULL;
+ Common::String lowerName;
+
+ lowerName = resourceName;
+ lowerName.toLowercase();
+ hash_val = hash(lowerName);
+
+ /* check if resource is in resource table */
+ if (_resources[hash_val].Flags) {
+ while (_resources[hash_val].Flags && !lowerName.equals(_resources[hash_val].name))
+ hash_val = ++hash_val & (HASHSIZE - 1);
+ resEntry = &_resources[hash_val];
+ }
+
+ if (!resEntry)
+ error_show(FL, 'RIOU', "rtoss: %s", resourceName.c_str());
+ else if (!(resEntry->Flags & FULLY_BUFFERED))
+ return;
+
+ if (!resEntry || !*resEntry->RHandle) {
+ term_message("bad rtoss no memory %s", resourceName.c_str());
+ return;
+ }
+
+ if (resEntry->Flags & MARKED_PURGE)
+ term_message("multiple rtoss: %s", resourceName.c_str());
+ else
+ term_message("rtossing: %s", resourceName.c_str());
+
+ HUnLock(resEntry->RHandle);
+ HPurge(resEntry->RHandle);
+ resEntry->Flags |= MARKED_PURGE;
+}
int32 Resources::get_file(const Common::String &name) {
assert(!_fp);
@@ -192,4 +228,12 @@ bool Resources::do_file(MemHandle buffer) {
return result;
}
+Handle rget(const Common::String &resourceName, int32 *resourceSize) {
+ return _G(resources).rget(resourceName, resourceSize);
+}
+
+void rtoss(const Common::String &resourceName) {
+ _G(resources).rtoss(resourceName);
+}
+
} // namespace M4
diff --git a/engines/m4/mem/res.h b/engines/m4/mem/res.h
index 538e2f97544..eb304d308bb 100644
--- a/engines/m4/mem/res.h
+++ b/engines/m4/mem/res.h
@@ -52,9 +52,13 @@ private:
public:
~Resources();
- Handle rget(const Common::String &resourceName, int32 *ResourceSize);
+ Handle rget(const Common::String &resourceName, int32 *resourceSize);
+ void rtoss(const Common::String &resourceName);
};
+extern Handle rget(const Common::String &resourceName, int32 *ResourceSize);
+extern void rtoss(const Common::String &resourceName);
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8c21d4d5e4e..ad587850457 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS = \
adv_r/db_rmlst.o \
core/errors.o \
core/imath.o \
+ core/mouse.o \
fileio/extensions.o \
fileio/fileio.o \
fileio/info.o \
@@ -24,6 +25,7 @@ MODULE_OBJS = \
graphics/gr_pal.o \
graphics/graphics.o \
gui/gui_dialog.o \
+ gui/gui_mouse.o \
gui/gui_sys.o \
gui/gui_vmng.o \
mem/mem.o \
Commit: ddf419db58a666d4d4389061d53097075e682904
https://github.com/scummvm/scummvm/commit/ddf419db58a666d4d4389061d53097075e682904
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui buffer init/shutdown
Changed paths:
A engines/m4/gui/gui_buffer.cpp
A engines/m4/gui/gui_buffer.h
engines/m4/globals.cpp
engines/m4/m4.cpp
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 59c48faa8f0..d055bbcaf5f 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -21,6 +21,7 @@
#include "m4/globals.h"
#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
#include "m4/mem/mem.h"
@@ -36,6 +37,7 @@ Globals::~Globals() {
sysfile_shutdown();
player_been_shutdown();
gui_system_shutdown();
+ gui_buffer_system_shutdown();
gui_dialog_shutdown();
mem_stash_shutdown();
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
new file mode 100644
index 00000000000..d293a3aa838
--- /dev/null
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_buffer.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool gui_buffer_system_init() {
+ return true;
+}
+
+void gui_buffer_system_shutdown() {
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_buffer.h b/engines/m4/gui/gui_buffer.h
new file mode 100644
index 00000000000..3dd3e4eb063
--- /dev/null
+++ b/engines/m4/gui/gui_buffer.h
@@ -0,0 +1,51 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_BUFFER_H
+#define M4_GUI_GUI_BUFFER_H
+
+#include "m4/m4_types.h"
+#include "m4/graphics/gr_buff.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+/**
+ * Initialize any code associated with managing buffers in the GUI
+ */
+extern bool gui_buffer_system_init();
+
+extern void gui_buffer_system_shutdown();
+extern bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler);
+
+extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
+
+extern void gui_buffer_deregister(Buffer *myBuf);
+
+extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
+extern void gui_buffer_activate(Buffer *myBuf);
+extern bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb);
+extern bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 9522b916659..7beeacffbbd 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -29,6 +29,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
+#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
@@ -114,9 +115,9 @@ void M4Engine::fire_up_gui() {
/*
if (!InitItems())
error_show(FL, 'GUI4');
+*/
if (!gui_buffer_system_init())
error_show(FL, 'GUI5');
- */
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ad587850457..6c85057c579 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -24,6 +24,7 @@ MODULE_OBJS = \
graphics/gr_font.o \
graphics/gr_pal.o \
graphics/graphics.o \
+ gui/gui_buffer.o \
gui/gui_dialog.o \
gui/gui_mouse.o \
gui/gui_sys.o \
Commit: a7bdd99f0664ef32938b5caf24cc1ce903680ada
https://github.com/scummvm/scummvm/commit/a7bdd99f0664ef32938b5caf24cc1ce903680ada
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Moved initialization to Globals class
Changed paths:
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index d055bbcaf5f..0ec6ee56b67 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -19,11 +19,18 @@
*
*/
+#include "common/debug.h"
#include "m4/globals.h"
-#include "m4/gui/gui_sys.h"
+#include "m4/adv_r/adv.h"
+#include "m4/adv_r/adv_been.h"
+#include "m4/core/errors.h"
#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
+#include "m4/detection.h"
+#include "m4/param.h"
namespace M4 {
@@ -40,8 +47,69 @@ Globals::~Globals() {
gui_buffer_system_shutdown();
gui_dialog_shutdown();
mem_stash_shutdown();
+ param_shutdown();
g_globals = nullptr;
}
+bool Globals::init() {
+ param_init();
+ parse_all_flags();
+
+ if (_G(system_shutting_down))
+ return false;
+
+ game_systems_initialize(INSTALL_ALL);
+
+ // TODO
+ return true;
+}
+
+
+void Globals::game_systems_initialize(byte flags) {
+ _G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
+
+ size_t totalMem = _G(kernel).mem_avail();
+ if (_G(kernel).suppress_cache == CACHE_NOT_OVERRIDE_BY_FLAG_PARSE)
+ _G(kernel).suppress_cache = totalMem < 8000000;
+
+ debugC(kDebugCore, _G(kernel).suppress_cache ?
+ "Cache System Disabled" : "Cache System Enabled");
+ debugC(kDebugCore, "Available memory: %ld", totalMem);
+
+ mem_stash_init(32);
+
+ if (flags & INSTALL_PLAYER_BEEN_INIT) {
+ if (!player_been_init(MAX_SCENES))
+ error_show(FL, 'PBIF');
+ }
+
+ term_message("Firing up GUI");
+ fire_up_gui();
+
+ if (flags & INSTALL_SOUND_DRIVERS) {
+ warning("TODO: sound init");
+ } else {
+ term_message("Sound driver installation skipped");
+ }
+}
+
+void Globals::fire_up_gui() {
+ if (!gui_system_init())
+ error_show(FL, 'GUI0');
+ if (!vmng_init())
+ error_show(FL, 'GUI1');
+ if (!gui_mouse_init())
+ error_show(FL, 'GUI2');
+ if (!gui_dialog_init())
+ error_show(FL, 'GUI3');
+#ifdef TODO
+ if (!InitItems())
+ error_show(FL, 'GUI4');
+#endif
+ if (!gui_buffer_system_init())
+ error_show(FL, 'GUI5');
+
+}
+
} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 20a18c1e2de..2296d0efad5 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -38,13 +38,19 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
-struct Globals;
+class Globals;
extern Globals *g_globals;
-struct Globals : public Mouse_Statics {
+class Globals : public Mouse_Statics {
+private:
+ void game_systems_initialize(byte flags);
+ void fire_up_gui();
+
+public:
Globals();
~Globals();
+ bool init();
Game _game;
Kernel _kernel;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 7beeacffbbd..31c2f3ee0af 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -26,14 +26,6 @@
#include "common/system.h"
#include "engines/util.h"
#include "graphics/palette.h"
-#include "m4/adv_r/adv.h"
-#include "m4/adv_r/adv_been.h"
-#include "m4/core/errors.h"
-#include "m4/gui/gui_buffer.h"
-#include "m4/gui/gui_dialog.h"
-#include "m4/gui/gui_sys.h"
-#include "m4/gui/gui_vmng.h"
-#include "m4/mem/mem.h"
#include "m4/m4.h"
#include "m4/detection.h"
#include "m4/console.h"
@@ -61,63 +53,20 @@ Common::String M4Engine::getGameId() const {
}
Common::Error M4Engine::run() {
- Globals globals;
-
// Initialize 320x200 paletted graphics mode
initGraphics(640, 480);
- param_init();
- parse_all_flags();
-
- if (!_G(system_shutting_down)) {
- game_systems_initialize(INSTALL_ALL);
-
-
+ // Instantiate globals and setup
+ Globals globals;
- // TODO
+ if (globals.init()) {
+ // Run game here
+ warning("TODO: game loop");
}
- param_shutdown();
- return Common::kNoError;
-}
-
-void M4Engine::game_systems_initialize(byte flags) {
- _G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
-
- size_t totalMem = _G(kernel).mem_avail();
- if (_G(kernel).suppress_cache == CACHE_NOT_OVERRIDE_BY_FLAG_PARSE)
- _G(kernel).suppress_cache = totalMem < 8000000;
-
- debugC(kDebugCore, _G(kernel).suppress_cache ?
- "Cache System Disabled" : "Cache System Enabled");
- debugC(kDebugCore, "Available memory: %ld", totalMem);
-
- mem_stash_init(32);
- if (flags & INSTALL_PLAYER_BEEN_INIT) {
- if (!player_been_init(MAX_SCENES))
- error_show(FL, 'PBIF');
- }
-
- term_message("Firing up GUI");
- fire_up_gui();
-}
-void M4Engine::fire_up_gui() {
- if (!gui_system_init())
- error_show(FL, 'GUI0');
- if (!vmng_init())
- error_show(FL, 'GUI1');
- if (!gui_mouse_init())
- error_show(FL, 'GUI2');
- if (!gui_dialog_init())
- error_show(FL, 'GUI3');
-/*
- if (!InitItems())
- error_show(FL, 'GUI4');
-*/
- if (!gui_buffer_system_init())
- error_show(FL, 'GUI5');
+ return Common::kNoError;
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 8402a33404d..d1bce0a031f 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -46,9 +46,6 @@ private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
- void game_systems_initialize(byte flags);
- void fire_up_gui();
-
protected:
// Engine APIs
Common::Error run() override;
Commit: a183b57fc2eb62687ab6bb926ac0469db592254a
https://github.com/scummvm/scummvm/commit/a183b57fc2eb62687ab6bb926ac0469db592254a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added WS load init/shutdown
Changed paths:
A engines/m4/wscript/ws_load.cpp
A engines/m4/wscript/ws_load.h
A engines/m4/wscript/ws_machine.cpp
A engines/m4/wscript/ws_machine.h
A engines/m4/wscript/ws_univ.h
A engines/m4/wscript/wscript.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 0ec6ee56b67..81330f9d9e1 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -92,6 +92,9 @@ void Globals::game_systems_initialize(byte flags) {
} else {
term_message("Sound driver installation skipped");
}
+
+ if (!woodscript_init())
+ error_show(FL, 'WSIF');
}
void Globals::fire_up_gui() {
@@ -109,7 +112,23 @@ void Globals::fire_up_gui() {
#endif
if (!gui_buffer_system_init())
error_show(FL, 'GUI5');
+}
+bool Globals::woodscript_init() {
+ if (!InitWSAssets())
+ return false;
+#ifdef TODO
+ if (!ws_Initialize(globals))
+ return false;
+#endif
+ return true;
+}
+
+void Globals::woodscript_shutdown() {
+ ShutdownWSAssets();
+#ifdef TODO
+ ws_Shutdown();
+#endif
}
} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 2296d0efad5..36d1dd72537 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -33,6 +33,7 @@
#include "m4/gui/gui_univ.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
+#include "m4/wscript/wscript.h"
namespace M4 {
@@ -42,10 +43,12 @@ class Globals;
extern Globals *g_globals;
-class Globals : public Mouse_Statics {
+class Globals : public Mouse_Statics, public WS_Globals {
private:
void game_systems_initialize(byte flags);
void fire_up_gui();
+ bool woodscript_init();
+ void woodscript_shutdown();
public:
Globals();
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6c85057c579..171f519eb39 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,6 +32,8 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ wscript/ws_load.o \
+ wscript/ws_machine.o \
burger/burger.o
# This module can be built as a plugin
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
new file mode 100644
index 00000000000..a15b4f0fa85
--- /dev/null
+++ b/engines/m4/wscript/ws_load.cpp
@@ -0,0 +1,215 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_load.h"
+#include "m4/wscript/ws_machine.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool InitWSAssets(void) {
+ int32 i;
+
+ //make sure this is only called once.
+ if (_G(wsloaderInitialized)) {
+ error_show(FL, 'WSSN');
+ }
+
+ //allocate space for the tables used by the loader and the resource io
+
+ //MACHine tables
+ if ((_G(globalMACHnames) = (char **)mem_alloc(sizeof(char *) * 256, "MACH resource table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalMACHHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalMACHoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "MACH offsets table")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < 256; i++) {
+ _G(globalMACHnames)[i] = nullptr;
+ _G(globalMACHHandles)[i] = nullptr;
+ _G(globalMACHoffsets)[i] = -1;
+ }
+
+ // SEQUence tables
+ if ((_G(globalSEQUnames) = (char **)mem_alloc(sizeof(char *) * 256, "SEQU resource table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalSEQUHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalSEQUoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "SEQU offsets table")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < 256; i++) {
+ _G(globalSEQUnames)[i] = nullptr;
+ _G(globalSEQUHandles)[i] = nullptr;
+ _G(globalSEQUoffsets)[i] = -1;
+ }
+
+ // DATA tables
+ if ((_G(globalDATAnames) = (char **)mem_alloc(sizeof(char *) * 256, "DATA resource table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalDATAHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalDATAoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "DATA offsets table")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < 256; i++) {
+ _G(globalDATAnames)[i] = nullptr;
+ _G(globalDATAHandles)[i] = nullptr;
+ _G(globalDATAoffsets)[i] = -1;
+ }
+
+ // CELS tables
+ if ((_G(globalCELSnames) = (char **)mem_alloc(sizeof(char *) * 256, "CELS resource table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalCELSHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalCELSoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS offsets table")) == nullptr) {
+ return false;
+ }
+ if ((_G(globalCELSPaloffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS pal offsets table")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < 256; i++) {
+ _G(globalCELSnames)[i] = nullptr;
+ _G(globalCELSHandles)[i] = nullptr;
+ _G(globalCELSoffsets)[i] = -1;
+ _G(globalCELSPaloffsets)[i] = -1;
+ }
+
+ //set the global to indicate the loader is active
+ _G(wsloaderInitialized) = true;
+
+ return true;
+}
+
+bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
+ int32 i;
+
+ if (!_G(wsloaderInitialized)) {
+ return false;
+ }
+
+ // Bounds checking
+ if (minHash < 0)
+ minHash = 0;
+ if (maxHash > MAX_ASSET_HASH)
+ maxHash = MAX_ASSET_HASH;
+
+ switch (assetType) {
+ case _WS_ASSET_MACH:
+ //clear the machines table for entries [minHash, maxHash]
+ for (i = minHash; i <= maxHash; i++) {
+ TerminateMachinesByHash(i);
+ if (_G(globalMACHnames)[i]) {
+ rtoss(_G(globalMACHnames)[i]);
+ mem_free(_G(globalMACHnames)[i]);
+ _G(globalMACHnames)[i] = nullptr;
+ _G(globalMACHHandles)[i] = nullptr;
+ _G(globalMACHoffsets)[i] = -1;
+ }
+ }
+ break;
+
+ case _WS_ASSET_SEQU:
+ // Clear the sequences table for entries [minHash, maxHash]
+ for (i = minHash; i <= maxHash; i++) {
+ if (_G(globalSEQUnames)[i]) {
+ rtoss(_G(globalSEQUnames)[i]);
+ mem_free(_G(globalSEQUnames)[i]);
+ _G(globalSEQUnames)[i] = nullptr;
+ _G(globalSEQUHandles)[i] = nullptr;
+ _G(globalSEQUoffsets)[i] = -1;
+ }
+ }
+ break;
+
+ case _WS_ASSET_DATA:
+ //clear the data table for entries [minHash, maxHash]
+ for (i = minHash; i <= maxHash; i++) {
+ if (_G(globalDATAnames)[i]) {
+ rtoss(_G(globalDATAnames)[i]);
+ mem_free(_G(globalDATAnames)[i]);
+ _G(globalDATAnames)[i] = nullptr;
+ _G(globalDATAHandles)[i] = nullptr;
+ _G(globalDATAoffsets)[i] = -1;
+ }
+ }
+ break;
+
+ case _WS_ASSET_CELS:
+ //clear the cels tables for entries [minHash, maxHash]
+ for (i = minHash; i <= maxHash; i++) {
+ if (_G(globalCELSnames)[i]) {
+ rtoss(_G(globalCELSnames)[i]);
+ mem_free(_G(globalCELSnames)[i]);
+ _G(globalCELSnames)[i] = nullptr;
+ _G(globalCELSHandles)[i] = nullptr;
+ _G(globalCELSoffsets)[i] = -1;
+ _G(globalCELSPaloffsets)[i] = -1;
+ }
+ }
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+}
+
+void ShutdownWSAssets(void) {
+ if (!_G(wsloaderInitialized)) return;
+
+ //for each asset type, clear the entire table
+ ClearWSAssets(_WS_ASSET_MACH, 0, MAX_ASSET_HASH);
+ ClearWSAssets(_WS_ASSET_SEQU, 0, MAX_ASSET_HASH);
+ ClearWSAssets(_WS_ASSET_CELS, 0, MAX_ASSET_HASH);
+ ClearWSAssets(_WS_ASSET_DATA, 0, MAX_ASSET_HASH);
+
+ //deallocate all tables
+ if (_G(globalMACHnames)) mem_free((void *)_G(globalMACHnames));
+ if (_G(globalSEQUnames)) mem_free((void *)_G(globalSEQUnames));
+ if (_G(globalDATAnames)) mem_free((void *)_G(globalDATAnames));
+ if (_G(globalCELSnames)) mem_free((void *)_G(globalCELSnames));
+
+ if (_G(globalMACHHandles)) mem_free((void *)_G(globalMACHHandles));
+ if (_G(globalMACHoffsets)) mem_free((void *)_G(globalMACHoffsets));
+ if (_G(globalSEQUHandles)) mem_free((void *)_G(globalSEQUHandles));
+ if (_G(globalSEQUoffsets)) mem_free((void *)_G(globalSEQUoffsets));
+ if (_G(globalDATAHandles)) mem_free((void *)_G(globalDATAHandles));
+ if (_G(globalDATAoffsets)) mem_free((void *)_G(globalDATAoffsets));
+ if (_G(globalCELSHandles)) mem_free((void *)_G(globalCELSHandles));
+ if (_G(globalCELSoffsets)) mem_free((void *)_G(globalCELSoffsets));
+ if (_G(globalCELSPaloffsets)) mem_free((void *)_G(globalCELSPaloffsets));
+
+ _G(wsloaderInitialized) = false;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
new file mode 100644
index 00000000000..4c85acbc190
--- /dev/null
+++ b/engines/m4/wscript/ws_load.h
@@ -0,0 +1,83 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_WSCRIPT_WS_LOAD_H
+#define M4_WSCRIPT_WS_LOAD_H
+
+#include "m4/m4_types.h"
+#include "m4/wscript/ws_univ.h"
+
+namespace M4 {
+
+#define _WS_ASSET_MACH 0
+#define _WS_ASSET_SEQU 1
+#define _WS_ASSET_CELS 2
+#define _WS_ASSET_DATA 3
+
+#define CHUNK_MACH 0x4D414348 //'MACH'
+#define CHUNK_SEQU 0x53455155 //'SEQU'
+#define CHUNK_DATA 0x44415441 //'DATA'
+#define CHUNK_CELS 0x43454C53 //'CELS'
+
+#define CHUNK_NECS 0x4E454353 //INTEL 'SCEN'
+#define CHUNK_HCAM 0x4843414D //INTEL 'MACH'
+#define CHUNK_UQES 0x55514553 //INTEL 'SEQU'
+#define CHUNK_SLEC 0x534C4543 //INTEL 'CELS'
+#define CHUNK_ATAD 0x41544144 //INTEL 'DATA'
+
+#define MACH_NUM_STATES 0
+#define MACH_OFFSETS 1
+
+#define SEQU_NUM_VARS 0
+#define SEQU_SEQU_START 1
+
+#define DATA_REC_COUNT 0
+#define DATA_REC_SIZE 1
+#define DATA_REC_START 2
+
+#define MAX_ASSET_HASH 255
+
+struct WSLoad_Globals {
+ bool _wsloaderInitialized = false;
+ char **_globalMACHnames = nullptr;
+ char **_globalSEQUnames = nullptr;
+ char **_globalDATAnames = nullptr;
+ char **_globalCELSnames = nullptr;
+
+ Handle *_globalMACHHandles = nullptr;
+ int32 *_globalMACHoffsets = nullptr;
+ Handle *_globalSEQUHandles = nullptr;
+ int32 *_globalSEQUoffsets = nullptr;
+ Handle *_globalDATAHandles = nullptr;
+ int32 *_globalDATAoffsets = nullptr;
+ Handle *_globalCELSHandles = nullptr;
+ int32 *_globalCELSoffsets = nullptr;
+ int32 *_globalCELSPaloffsets = nullptr;
+};
+
+extern bool InitWSAssets();
+extern bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
+extern void ShutdownWSAssets();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
new file mode 100644
index 00000000000..e60c4a70462
--- /dev/null
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_machine.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void TerminateMachinesByHash(int32 machHash) {
+ warning("TODO: TerminateMachinesByHash");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
new file mode 100644
index 00000000000..19b86fbe2c3
--- /dev/null
+++ b/engines/m4/wscript/ws_machine.h
@@ -0,0 +1,34 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_WSCRIPT_WS_MACHINE_H
+#define M4_WSCRIPT_WS_MACHINE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void TerminateMachinesByHash(int32 machHash);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_univ.h b/engines/m4/wscript/ws_univ.h
new file mode 100644
index 00000000000..183337cfe0a
--- /dev/null
+++ b/engines/m4/wscript/ws_univ.h
@@ -0,0 +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/>.
+ *
+ */
+
+#ifndef M4_WSCRIPT_WS_UNIV_H
+#define M4_WSCRIPT_WS_UNIV_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
new file mode 100644
index 00000000000..a83d384cf25
--- /dev/null
+++ b/engines/m4/wscript/wscript.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 M4_WSCRIPT_WS_SCRIPT_H
+#define M4_WSCRIPT_WS_SCRIPT_H
+
+#include "m4/wscript/ws_load.h"
+
+namespace M4 {
+
+struct WS_Globals : public WSLoad_Globals {
+};
+
+} // End of namespace M4
+
+#endif
Commit: 8aca4045f6f616b4a707e801e26c072e0dcd4db8
https://github.com/scummvm/scummvm/commit/8aca4045f6f616b4a707e801e26c072e0dcd4db8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding wscript general init/shutdown
Changed paths:
A engines/m4/wscript/ws_crnch.cpp
A engines/m4/wscript/ws_crnch.h
A engines/m4/wscript/wscript.cpp
engines/m4/globals.cpp
engines/m4/module.mk
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
engines/m4/wscript/wscript.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 81330f9d9e1..08f8610b17e 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -117,18 +117,15 @@ void Globals::fire_up_gui() {
bool Globals::woodscript_init() {
if (!InitWSAssets())
return false;
-#ifdef TODO
- if (!ws_Initialize(globals))
+ if (!ws_Initialize(_G(globals)))
return false;
-#endif
+
return true;
}
void Globals::woodscript_shutdown() {
ShutdownWSAssets();
-#ifdef TODO
ws_Shutdown();
-#endif
}
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 171f519eb39..d16b9b8ba30 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,8 +32,10 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ wscript/ws_crnch.o \
wscript/ws_load.o \
wscript/ws_machine.o \
+ wscript/wscript.o \
burger/burger.o
# This module can be built as a plugin
diff --git a/engines/m4/wscript/ws_crnch.cpp b/engines/m4/wscript/ws_crnch.cpp
new file mode 100644
index 00000000000..05c886a0401
--- /dev/null
+++ b/engines/m4/wscript/ws_crnch.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_crnch.h"
+
+namespace M4 {
+
+static int32 dataFormats[] = { 0, 5, 8, 12, 16 };
+
+int32 *ws_GetDataFormats() {
+ return &dataFormats[0];
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_crnch.h b/engines/m4/wscript/ws_crnch.h
new file mode 100644
index 00000000000..5e43ad0fa25
--- /dev/null
+++ b/engines/m4/wscript/ws_crnch.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 M4_WSCRIPT_WS_CRNCH_H
+#define M4_WSCRIPT_WS_CRNCH_H
+
+#include "m4/m4_types.h"
+//#include "m4/wscript/ws_univ.h"
+
+namespace M4 {
+
+extern int32 *ws_GetDataFormats();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index e60c4a70462..e7ac322469e 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -20,11 +20,62 @@
*/
#include "m4/wscript/ws_machine.h"
+#include "m4/wscript/ws_crnch.h"
+#include "m4/wscript/wscript.h"
#include "m4/core/errors.h"
#include "m4/globals.h"
namespace M4 {
+bool ws_Initialize(frac16 *theGlobals) {
+ int32 i;
+
+ _G(machineIDCount) = 0;
+
+ _G(dataFormats) = ws_GetDataFormats();
+
+ if (!theGlobals) {
+ ws_LogErrorMsg(FL, "ws_Initialize() called without a valid global register array.");
+ return false;
+ }
+
+ _G(ws_globals) = theGlobals;
+
+ for (i = 0; i < GLB_SHARED_VARS; i++) {
+ _G(ws_globals)[i] = 0;
+ }
+
+ _G(firstMachine) = NULL;
+ _G(nextXM) = NULL;
+ _G(myGlobalMessages) = NULL;
+#ifdef TODO
+ if (!ws_InitWSTimer()) {
+ return false;
+ }
+ if (!ws_InitCruncher()) {
+ return false;
+ }
+ if (!ws_InitHAL()) {
+ return false;
+ }
+
+ _G(oldTime) = timer_read_60();
+#endif
+ _G(pauseTime) = 0;
+ _G(enginesPaused) = false;
+
+ return true;
+}
+
+void ws_Shutdown() {
+#ifdef TODO
+ ws_KillTime();
+ ws_KillCruncher();
+ ws_KillMachines();
+ ws_KillHAL();
+#endif
+}
+
void TerminateMachinesByHash(int32 machHash) {
warning("TODO: TerminateMachinesByHash");
}
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 19b86fbe2c3..170a40248d9 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -24,9 +24,141 @@
#define M4_WSCRIPT_WS_MACHINE_H
#include "m4/m4_types.h"
+#include "m4/gui/gui.h"
namespace M4 {
+// A message request
+struct msgRequest {
+ msgRequest *nextMsg = nullptr;
+ uint32 msgHash = 0;
+ frac16 msgValue = 0;
+ int32 pcOffset = 0;
+ int32 pcCount = 0;
+};
+
+struct machine;
+typedef void (*MessageCB)(frac16 myMessage, struct machine *sender);
+
+//timebase request structure.
+struct onTimeReq {
+ struct onTimeReq *next = nullptr;
+ int32 myTime = 0;
+ struct machine *myXM = nullptr;
+ int32 pcOffset = 0;
+ int32 pcCount = 0;
+};
+
+// rails algorithm struct
+struct railNode {
+ uint8 nodeID = 0;
+ int32 x = 0, y = 0;
+ railNode *shortPath = nullptr;
+ int32 pathWeight = 0;
+};
+
+struct CCB {
+ uint32 flags = 0;
+ M4sprite *source = nullptr;
+ M4Rect *currLocation = nullptr;
+ M4Rect *newLocation = nullptr;
+ M4Rect *maxArea = nullptr;
+ int32 scaleX = 0;
+ int32 scaleY = 0;
+ int32 layer = 0;
+ uint32 *streamSSHeader = nullptr;
+ uint32 *streamSpriteSource = nullptr;
+ void *myStream = nullptr;
+ char *seriesName = nullptr;
+};
+
+#define JSR_STACK_MAX 8
+struct Anim8 {
+ machine *myMachine = nullptr; // Pointer back to myMachine
+ int32 eosReqOffset = 0; // The machine PC offset to be executed at the EOS
+ int32 eosReqCount = 0;
+ Anim8 *next = nullptr; // The linked list used for execution order
+ Anim8 *prev = nullptr;
+ int32 myLayer = 0;
+ Anim8 *infront = nullptr; // The linked list used for layering
+ Anim8 *behind = nullptr;
+ Anim8 *myParent = nullptr; // The parent anim8
+ int32 sequHash = 0; // The current sequence Hash = 0;
+ Handle sequHandle = nullptr; // The sequence Handle
+ int32 pcOffset = 0; // The offset into the sequence of the current PC
+ CCB *myCCB = nullptr;
+ int32 dataHash = 0; // The array of data
+ Handle dataHandle = nullptr;
+ int32 dataOffset = 0;
+ int32 startTime = 0;
+ int32 switchTime = 0;
+ frac16 transTime = 0;
+ int32 flags = 0;
+ frac16 start_s = 0;
+ frac16 start_r = 0;
+ frac16 start_x = 0;
+ frac16 start_y = 0;
+ int32 numLocalVars = 0;
+ frac16 *myRegs = nullptr;
+ bool active = false;
+ int32 returnStackIndex = 0;
+ uint32 returnHashes[JSR_STACK_MAX] = { 0 };
+ int32 returnOffsets[JSR_STACK_MAX] = { 0 };
+};
+
+struct machine {
+ machine *next = nullptr;
+ machine *prev = nullptr;
+ uint32 myHash = 0;
+ uint32 machID = 0;
+ char *machName = nullptr;
+ Handle machHandle = 0;
+ int32 machInstrOffset = 0;
+ int32 stateTableOffset = 0;
+ int32 curState = 0;
+ int32 numOfStates = 0;
+ uint32 recurseLevel = 0;
+ Anim8 *myAnim8 = nullptr;
+ Anim8 *parentAnim8 = nullptr;
+ int32 dataHash = 0;
+ Handle dataHandle = 0;
+ int32 dataOffset = 0;
+ int32 targetCount = 0;
+ struct machine *msgReplyXM = nullptr;
+ MessageCB CintrMsg;
+ msgRequest *myMsgs = nullptr;
+ msgRequest *myPersistentMsgs = nullptr;
+ msgRequest *usedPersistentMsgs = nullptr;
+ railNode *walkPath = nullptr;
+};
+
+struct globalMsgReq {
+ struct globalMsgReq *next = nullptr;
+ ulong msgHash = 0;
+ frac16 msgValue = 0;
+ ulong machHash = 0;
+ machine *sendM = nullptr;
+ int32 msgCount = 0;
+};
+
+struct WSMachine_Globals {
+ int32 _pauseTime = 0;
+ int32 _oldTime = 0;
+ bool _enginesPaused = false;
+
+ int32 *_dataFormats = nullptr;
+ uint32 _machineIDCount = 0;
+ machine *_firstMachine = nullptr;
+
+ machine *_nextXM = nullptr;
+ globalMsgReq *_myGlobalMessages = nullptr;
+
+ // Used for processing pCodes
+ frac16 *_ws_globals = nullptr;
+};
+
+extern bool ws_Initialize(frac16 *theGlobals);
+extern void ws_Shutdown();
extern void TerminateMachinesByHash(int32 machHash);
} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.cpp b/engines/m4/wscript/wscript.cpp
new file mode 100644
index 00000000000..902b90ac1c1
--- /dev/null
+++ b/engines/m4/wscript/wscript.cpp
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/wscript/wscript.h"
+
+namespace M4 {
+
+void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg) {
+ error("%s", msg);
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
index a83d384cf25..09ab1f2bf1d 100644
--- a/engines/m4/wscript/wscript.h
+++ b/engines/m4/wscript/wscript.h
@@ -24,12 +24,15 @@
#define M4_WSCRIPT_WS_SCRIPT_H
#include "m4/wscript/ws_load.h"
+#include "m4/wscript/ws_machine.h"
namespace M4 {
-struct WS_Globals : public WSLoad_Globals {
+struct WS_Globals : public WSLoad_Globals, public WSMachine_Globals {
};
+extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg);
+
} // End of namespace M4
#endif
Commit: 31f06d963562254698b53c92efd16369bc605ad0
https://github.com/scummvm/scummvm/commit/31f06d963562254698b53c92efd16369bc605ad0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added WS Cruncher init/shutdown
Changed paths:
A engines/m4/wscript/ws_cruncher.cpp
A engines/m4/wscript/ws_cruncher.h
A engines/m4/wscript/ws_hal.cpp
A engines/m4/wscript/ws_hal.h
A engines/m4/wscript/ws_timer.cpp
A engines/m4/wscript/ws_timer.h
R engines/m4/wscript/ws_crnch.cpp
R engines/m4/wscript/ws_crnch.h
engines/m4/module.mk
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
engines/m4/wscript/wscript.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index d16b9b8ba30..2487a6a918c 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,9 +32,11 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
- wscript/ws_crnch.o \
+ wscript/ws_cruncher.o \
+ wscript/ws_hal.o \
wscript/ws_load.o \
wscript/ws_machine.o \
+ wscript/ws_timer.o \
wscript/wscript.o \
burger/burger.o
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
new file mode 100644
index 00000000000..2f33ed377e1
--- /dev/null
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_cruncher.h"
+#include "m4/wscript/ws_hal.h"
+#include "m4/core/errors.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define VERIFY_INTIALIZED(s) if (!_G(cruncherInitialized)) error_show(FL, 'WSCI', "%s failed.", s);
+
+static int32 dataFormats[] = { 0, 5, 8, 12, 16 };
+
+int32 *ws_GetDataFormats() {
+ return &dataFormats[0];
+}
+
+bool ws_InitCruncher(void) {
+ // int32 i;
+
+ //make sure the cruncher has not been initialized
+ if (_G(cruncherInitialized))
+ error_show(FL, 'WSCR');
+
+ // Register the end of sequence struct with the stash manager
+ mem_register_stash_type(&_G(memtypeEOS), sizeof(EOSreq), 32, "+EOS");
+ if (_G(memtypeEOS) < 0)
+ error_show(FL, 'WSCE');
+
+ if ((_G(myCruncher) = (cruncher *)mem_alloc(sizeof(cruncher), "cruncher")) == NULL)
+ error_show(FL, 'OOM!', "%ld bytes.", sizeof(cruncher));
+
+ _G(myCruncher)->backLayerAnim8 = NULL;
+ _G(myCruncher)->frontLayerAnim8 = NULL;
+ _G(myCruncher)->firstAnim8ToCrunch = NULL;
+ _G(myCruncher)->lastAnim8ToCrunch = NULL;
+
+ // Set up stack
+ _G(stackSize) = 2048;
+ if ((_G(stackBase) = (uint32 *)mem_alloc(_G(stackSize), "crunchstack")) == NULL) {
+ error_show(FL, 'OOM!', "%ld bytes.", _G(stackSize));
+ }
+ _G(stackTop) = _G(stackBase);
+ _G(stackLimit) = (uint32 *)((uint32)_G(stackBase) + (uint32)_G(stackSize));
+
+ _G(cruncherInitialized) = true;
+
+ return true;
+}
+
+void ws_KillCruncher(void) {
+ Anim8 *myAnim8;
+
+ //make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_KillCruncher()");
+
+ myAnim8 = _G(myCruncher)->firstAnim8ToCrunch;
+ while (myAnim8) {
+ _G(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
+ if (myAnim8->myCCB) {
+ KillCCB(myAnim8->myCCB, false);
+ }
+ mem_free((void *)myAnim8->myRegs);
+ myAnim8 = _G(myCruncher)->firstAnim8ToCrunch;
+ }
+ mem_free((void *)_G(myCruncher));
+ if (_G(stackBase)) {
+ mem_free(_G(stackBase));
+ }
+
+ _G(cruncherInitialized) = false;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_cruncher.h b/engines/m4/wscript/ws_cruncher.h
new file mode 100644
index 00000000000..5b95ea397ac
--- /dev/null
+++ b/engines/m4/wscript/ws_cruncher.h
@@ -0,0 +1,79 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_WSCRIPT_WS_CRUNCHER_H
+#define M4_WSCRIPT_WS_CRUNCHER_H
+
+#include "m4/m4_types.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+struct EOSreq {
+ EOSreq *next = nullptr;
+ EOSreq *prev = nullptr;
+ Anim8 *myAnim8 = nullptr;
+};
+
+struct cruncher {
+ Anim8 *backLayerAnim8;
+ Anim8 *frontLayerAnim8;
+ Anim8 *firstAnim8ToCrunch;
+ Anim8 *lastAnim8ToCrunch;
+};
+
+struct WSCruncher_Globals {
+ cruncher *_myCruncher = nullptr;
+ bool _cruncherInitialized = false;
+ EOSreq *_EOSreqList = nullptr;
+ int32 _memtypeEOS = -1;
+
+ int32 _stackSize = 0;
+ uint32 *_stackBase = nullptr;
+ uint32 *_stackTop = nullptr;
+ uint32 *_stackLimit = nullptr;
+ Anim8 *_crunchNext = nullptr;
+
+ // OPCODE PROCESSING GLOBALS
+ int16 *_myDepthTable = nullptr;
+
+ frac16 _dataArg1 = 0;
+ frac16 _dataArg2 = 0;
+ frac16 _dataArg3 = 0;
+ frac16 *_myArg1 = nullptr;
+ frac16 *_myArg2 = nullptr;
+ frac16 *_myArg3 = nullptr;
+
+ bool _keepProcessing = false, _terminated = false, _mapTheCel = false;
+ int32 _compareCCR = 0;
+ int32 _indexReg = 0;
+ int32 _pcOffsetOld = 0;
+};
+
+extern int32 *ws_GetDataFormats();
+
+extern bool ws_InitCruncher();
+extern void ws_KillCruncher();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
new file mode 100644
index 00000000000..31d751ae7f3
--- /dev/null
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_hal.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void KillCCB(CCB *myCCB, bool restoreFlag) {
+ error("TODO: KillCCB");
+#ifdef TODO
+ if (!myCCB) {
+ error_show(FL, 'WSIC');
+ }
+ if (restoreFlag && (!(myCCB->flags & CCB_SKIP)) && (!(myCCB->flags & CCB_HIDE))) {
+ if ((myCCB->flags & CCB_STREAM) && myCCB->maxArea) {
+ vmng_AddRectToRectList(&deadRectList, myCCB->maxArea->x1, myCCB->maxArea->y1,
+ myCCB->maxArea->x2, myCCB->maxArea->y2);
+ } else {
+ vmng_AddRectToRectList(&deadRectList, myCCB->currLocation->x1, myCCB->currLocation->y1,
+ myCCB->currLocation->x2, myCCB->currLocation->y2);
+ }
+ }
+ if (myCCB->flags & CCB_DISC_STREAM) {
+ ws_CloseSSstream(myCCB);
+ }
+ if (myCCB->currLocation) {
+ mem_free((void *)myCCB->currLocation);
+ }
+ if (myCCB->newLocation) {
+ mem_free((void *)myCCB->newLocation);
+ }
+ if (myCCB->maxArea) {
+ mem_free((void *)myCCB->maxArea);
+ }
+ if (myCCB->source) {
+ mem_free((char *)myCCB->source);
+ }
+ mem_free((void *)myCCB);
+#endif
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_crnch.cpp b/engines/m4/wscript/ws_hal.h
similarity index 85%
rename from engines/m4/wscript/ws_crnch.cpp
rename to engines/m4/wscript/ws_hal.h
index 05c886a0401..1894fc7ce8b 100644
--- a/engines/m4/wscript/ws_crnch.cpp
+++ b/engines/m4/wscript/ws_hal.h
@@ -1,3 +1,4 @@
+
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
@@ -19,14 +20,15 @@
*
*/
-#include "m4/wscript/ws_crnch.h"
+#ifndef M4_WSCRIPT_WS_HAL_H
+#define M4_WSCRIPT_WS_HAL_H
-namespace M4 {
+#include "m4/wscript/ws_machine.h"
-static int32 dataFormats[] = { 0, 5, 8, 12, 16 };
+namespace M4 {
-int32 *ws_GetDataFormats() {
- return &dataFormats[0];
-}
+extern void KillCCB(CCB *myCCB, bool restoreFlag);
} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index e7ac322469e..1b303ed0a6b 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/wscript/ws_machine.h"
-#include "m4/wscript/ws_crnch.h"
+#include "m4/wscript/ws_cruncher.h"
#include "m4/wscript/wscript.h"
#include "m4/core/errors.h"
#include "m4/globals.h"
@@ -48,13 +48,14 @@ bool ws_Initialize(frac16 *theGlobals) {
_G(firstMachine) = NULL;
_G(nextXM) = NULL;
_G(myGlobalMessages) = NULL;
-#ifdef TODO
+
if (!ws_InitWSTimer()) {
return false;
}
if (!ws_InitCruncher()) {
return false;
}
+#ifdef TODO
if (!ws_InitHAL()) {
return false;
}
@@ -68,9 +69,9 @@ bool ws_Initialize(frac16 *theGlobals) {
}
void ws_Shutdown() {
-#ifdef TODO
ws_KillTime();
ws_KillCruncher();
+#ifdef TODO
ws_KillMachines();
ws_KillHAL();
#endif
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 170a40248d9..1fad0efacf9 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -42,7 +42,7 @@ typedef void (*MessageCB)(frac16 myMessage, struct machine *sender);
//timebase request structure.
struct onTimeReq {
- struct onTimeReq *next = nullptr;
+ onTimeReq *next = nullptr;
int32 myTime = 0;
struct machine *myXM = nullptr;
int32 pcOffset = 0;
diff --git a/engines/m4/wscript/ws_timer.cpp b/engines/m4/wscript/ws_timer.cpp
new file mode 100644
index 00000000000..666a0e6fe38
--- /dev/null
+++ b/engines/m4/wscript/ws_timer.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/ws_timer.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static void dispose_timeRequest(onTimeReq *timeReq);
+
+bool ws_InitWSTimer(void) {
+ _G(firstTimeReq) = nullptr;
+ return true;
+}
+
+void ws_KillTime() {
+ onTimeReq *tempTime;
+
+ tempTime = _G(firstTimeReq);
+ while (tempTime) {
+ _G(firstTimeReq) = _G(firstTimeReq)->next;
+ dispose_timeRequest(tempTime);
+ tempTime = _G(firstTimeReq);
+ }
+}
+
+static void dispose_timeRequest(onTimeReq *timeReq) {
+ if (timeReq) {
+ mem_free(timeReq);
+ }
+}
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/ws_crnch.h b/engines/m4/wscript/ws_timer.h
similarity index 69%
rename from engines/m4/wscript/ws_crnch.h
rename to engines/m4/wscript/ws_timer.h
index 5e43ad0fa25..903302020de 100644
--- a/engines/m4/wscript/ws_crnch.h
+++ b/engines/m4/wscript/ws_timer.h
@@ -20,15 +20,23 @@
*
*/
-#ifndef M4_WSCRIPT_WS_CRNCH_H
-#define M4_WSCRIPT_WS_CRNCH_H
+#ifndef M4_WSCRIPT_WS_TIMER_H
+#define M4_WSCRIPT_WS_TIMER_H
#include "m4/m4_types.h"
-//#include "m4/wscript/ws_univ.h"
+#include "m4/wscript/ws_machine.h"
namespace M4 {
-extern int32 *ws_GetDataFormats();
+struct WSTimer_Globals {
+ onTimeReq *_firstTimeReq = nullptr;
+};
+
+extern bool ws_InitWSTimer(void);
+extern void ws_KillTime(void);
+extern void ws_MakeOnTimeReq(int32 wakeUpTime, machine *myXM, int32 pcOffset, int32 pcCount);
+extern void ws_CancelOnTimeReqs(machine *m);
+extern void ws_CheckTimeReqs(int32 curTime);
} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
index 09ab1f2bf1d..56e3230f6db 100644
--- a/engines/m4/wscript/wscript.h
+++ b/engines/m4/wscript/wscript.h
@@ -23,12 +23,15 @@
#ifndef M4_WSCRIPT_WS_SCRIPT_H
#define M4_WSCRIPT_WS_SCRIPT_H
+#include "m4/wscript/ws_cruncher.h"
#include "m4/wscript/ws_load.h"
#include "m4/wscript/ws_machine.h"
+#include "m4/wscript/ws_timer.h"
namespace M4 {
-struct WS_Globals : public WSLoad_Globals, public WSMachine_Globals {
+struct WS_Globals : public WSCruncher_Globals, public WSLoad_Globals,
+ public WSMachine_Globals, public WSTimer_Globals {
};
extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg);
Commit: 31bf3feda0cf75fc397cfb1e582d07171e4075d7
https://github.com/scummvm/scummvm/commit/31bf3feda0cf75fc397cfb1e582d07171e4075d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added WS Hal init/shutdown
Changed paths:
engines/m4/gui/gui_vmng.cpp
engines/m4/gui/gui_vmng.h
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_hal.h
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/wscript.h
diff --git a/engines/m4/gui/gui_vmng.cpp b/engines/m4/gui/gui_vmng.cpp
index 36a96f94c77..88885ed3ad1 100644
--- a/engines/m4/gui/gui_vmng.cpp
+++ b/engines/m4/gui/gui_vmng.cpp
@@ -56,6 +56,8 @@
#include "m4/gui/gui_vmng.h"
#include "m4/gui/gui_dialog.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/mem/memman.h"
#include "m4/mem/mem.h"
#include "m4/globals.h"
@@ -167,4 +169,520 @@ ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32
return myScreen;
}
+#define LEFT_EDGE 1
+#define RIGHT_EDGE 2
+
+//--------------------------------------------------------------------------
+RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *newRect;
+ if ((newRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_CreateNewRect");
+ }
+ newRect->x1 = x1;
+ newRect->y1 = y1;
+ newRect->x2 = x2;
+ newRect->y2 = y2;
+ newRect->next = NULL;
+ newRect->prev = NULL;
+
+ return newRect;
+}
+
+//--------------------------------------------------------------------------
+void vmng_AddRectToRectList(RectList **theRectList, int32 rectX1, int32 rectY1, int32 rectX2, int32 rectY2) {
+ RectList *dirtyRect, *dirtyRectList;
+ RectList *endCleanRectList, *cleanRectList;
+ RectList *myRect, *myRectList;
+ RectList *newRect;
+ bool intersected;
+
+ //first make sure we have a valid rectangle
+ if ((rectX1 > rectX2) || (rectY1 > rectY2)) {
+ return;
+ }
+
+ //intialize the dirty rect list
+ dirtyRectList = vmng_CreateNewRect(rectX1, rectY1, rectX2, rectY2);
+
+ //intialize the clean rectList
+ cleanRectList = NULL;
+ endCleanRectList = NULL;
+
+ //use a local var for theRectlist
+ myRectList = *theRectList;
+
+ //loop through all the dirtyRects
+ dirtyRect = dirtyRectList;
+ while (dirtyRect) {
+
+ //remove dirtyRect from the head of the dirtyRectList
+ dirtyRectList = dirtyRectList->next;
+
+ //set the intersected flag
+ intersected = false;
+
+ //loop on through
+ myRect = myRectList;
+ while (myRect) {
+
+ //if the two rectangles intersect
+ if ((dirtyRect->x1 <= myRect->x2) && (dirtyRect->x2 >= myRect->x1) && (dirtyRect->y1 <= myRect->y2) && (dirtyRect->y2 >= myRect->y1)) {
+
+ //set the intersected flag
+ intersected = true;
+
+ //if dirtyRect is not completely contained within myRect
+ if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->y1 < myRect->y1) || (dirtyRect->x2 > myRect->x2) || (dirtyRect->y2 > myRect->y2)) {
+
+ //first remove it from the list
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ myRectList = myRect->next;
+ }
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+
+ //so now there is an intersection.
+ //if myRect sticks out above dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
+ if (myRect->y1 < dirtyRect->y1) {
+ newRect = vmng_CreateNewRect(myRect->x1, myRect->y1, myRect->x2, dirtyRect->y1 - 1);
+ newRect->prev = NULL;
+ newRect->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = newRect;
+ }
+ myRectList = newRect;
+
+ //and set the top of myRect to be the same as dirtyRect
+ myRect->y1 = dirtyRect->y1;
+ }
+
+ //else if dirtyRect sticks out above chop it off and put it on the dirty list
+ else if (dirtyRect->y1 < myRect->y1) {
+ newRect = vmng_CreateNewRect(dirtyRect->x1, dirtyRect->y1, dirtyRect->x2, myRect->y1 - 1);
+ newRect->next = dirtyRectList;
+ dirtyRectList = newRect;
+
+ //and set the top of dirtyRect to be the same as myRect
+ dirtyRect->y1 = myRect->y1;
+ }
+
+ //if myRect sticks out below dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
+ if (myRect->y2 > dirtyRect->y2) {
+ newRect = vmng_CreateNewRect(myRect->x1, dirtyRect->y2 + 1, myRect->x2, myRect->y2);
+ newRect->prev = NULL;
+ newRect->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = newRect;
+ }
+ myRectList = newRect;
+
+ //and set the bottom of myRect to be the same as dirtyRect
+ myRect->y2 = dirtyRect->y2;
+ }
+
+ //else if dirtyRect sticks out below myRect...
+ else if (dirtyRect->y2 > myRect->y2) {
+ newRect = vmng_CreateNewRect(dirtyRect->x1, myRect->y2 + 1, dirtyRect->x2, dirtyRect->y2);
+ newRect->next = dirtyRectList;
+ dirtyRectList = newRect;
+
+ //and set the bottom of dirtyRect to be the same as myRect
+ dirtyRect->y2 = myRect->y2;
+ }
+
+ //now we've got overlapping rectangles which are the same height. create one max width one
+ //if the dirtyRect sticks out on either side, the resulting rect is still dirty, otherwise clean
+ if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->x2 > myRect->x2)) {
+
+ //use dirtyRect to become the max width rect
+ dirtyRect->x1 = imath_min(dirtyRect->x1, myRect->x1);
+ dirtyRect->x2 = imath_max(dirtyRect->x2, myRect->x2);
+ dirtyRect->next = dirtyRectList;
+ dirtyRectList = dirtyRect;
+
+ //and turf myRect
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+ }
+
+ //else we can put what's left of myRect onto the clean list and turf dirtyRect
+ //note, it is impossible to split the dirtyRect list vertically, they always stretch horizontally,
+ //therefore if this dirty rect does not stick out the sides, what's left of myRect is clean
+ else {
+ myRect->prev = NULL;
+ myRect->next = cleanRectList;
+ if (cleanRectList) {
+ cleanRectList->prev = myRect;
+ } else {
+ endCleanRectList = myRect;
+ }
+ cleanRectList = myRect;
+
+ mem_free_to_stash((void *)dirtyRect, _G(memtypeRECT));
+ }
+
+ //exit the loop
+ myRect = NULL;
+ }
+
+ //else through away dirtyRect, and get the next dirtyRect
+ else {
+ mem_free_to_stash((void *)dirtyRect, _G(memtypeRECT));
+ myRect = NULL;
+ }
+ }
+
+ //else get the next rect
+ else {
+ myRect = myRect->next;
+ }
+ }
+
+ //if we didn't intersect, put the dirtyRect on the clean list
+ if (!intersected) {
+ dirtyRect->prev = NULL;
+ dirtyRect->next = cleanRectList;
+ if (cleanRectList) {
+ cleanRectList->prev = dirtyRect;
+ } else {
+ endCleanRectList = dirtyRect;
+ }
+ cleanRectList = dirtyRect;
+ }
+
+ //get the next dirty rect
+ dirtyRect = dirtyRectList;
+ }
+
+ //now, just add the clean list onto the dirty list
+ if (cleanRectList) {
+
+ //now add the entire cleanRectList to the front of myRectList
+ endCleanRectList->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = endCleanRectList;
+ }
+ myRectList = cleanRectList;
+ }
+
+ //return the rect list
+ *theRectList = myRectList;
+}
+
+//----------------------------------------------------------------------------------------
+RectList *vmng_DuplicateRectList(RectList *myRectList) {
+ RectList *newRectList, *tempRect, *myRect, *prevRect;
+
+ newRectList = NULL;
+ prevRect = NULL;
+ myRect = myRectList;
+ while (myRect) {
+
+ //duplicate myRect and stick it on the newRectList
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_DuplicateRectList()");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+ tempRect->prev = prevRect;
+ tempRect->next = NULL;
+ if (prevRect) {
+ prevRect->next = tempRect;
+ } else {
+ newRectList = tempRect;
+ }
+ prevRect = tempRect;
+
+ //get the next rectangle
+ myRect = myRect->next;
+ }
+
+ return newRectList;
+}
+
+//----------------------------------------------------------------------------------------
+bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *myRect;
+ int32 intrX1, intrY1, intrX2, intrY2;
+
+ //parameter verification
+ if ((!myRectList) || (x1 > x2) || (y1 > y2)) {
+ return false;
+ }
+
+ //loop through the list, and break as soon as there is an intersection
+ myRect = myRectList;
+ while (myRect) {
+
+ //calculate the intersection
+ intrX1 = imath_max(myRect->x1, x1);
+ intrY1 = imath_max(myRect->y1, y1);
+ intrX2 = imath_min(myRect->x2, x2);
+ intrY2 = imath_min(myRect->y2, y2);
+
+ //if we intersected, return true
+ if ((intrX1 <= intrX2) && (intrY1 <= intrY2)) {
+ return true;
+ }
+
+ //else get the next rect in the list
+ myRect = myRect->next;
+ }
+
+ //we made it through the entire list with no intersections - return false
+ return false;
+}
+
+//----------------------------------------------------------------------------------------
+bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2) {
+ RectList *nextRect, *myRect;
+
+ int32 x1, y1, x2, y2;
+
+ //loop through myRect list
+ myRect = *myRectList;
+ while (myRect) {
+
+ //set the next rect
+ nextRect = myRect->next;
+
+ //clip myRect
+ x1 = imath_max(myRect->x1, clipX1);
+ y1 = imath_max(myRect->y1, clipY1);
+ x2 = imath_min(myRect->x2, clipX2);
+ y2 = imath_min(myRect->y2, clipY2);
+
+ //if we have a valid rectangle
+ if ((x1 <= x2) && (y1 <= y2)) {
+
+ //clip the rectangle
+ myRect->x1 = x1;
+ myRect->y1 = y1;
+ myRect->x2 = x2;
+ myRect->y2 = y2;
+ }
+
+ //else remove it from the rectList and turf it
+ else {
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ *myRectList = myRect->next;
+ }
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+ }
+
+ //check the next rect
+ myRect = nextRect;
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------------------
+bool vmng_RectListValid(RectList *myRectList) {
+ RectList *myRect, *tempRectList;
+
+ myRect = myRectList;
+ while (myRect) {
+ tempRectList = myRect->next;
+ if (vmng_RectIntersectsRectList(tempRectList, myRect->x1, myRect->y1, myRect->x2, myRect->y2)) {
+ return false;
+ }
+ myRect = myRect->next;
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------------------
+void vmng_DisposeRectList(RectList **rectList) {
+ RectList *myRect;
+
+ //loop through the rect list
+ myRect = *rectList;
+ while (myRect) {
+
+ //remove myRect from the head of the list
+ *rectList = myRect->next;
+
+ //dispose of myRect;
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+
+ //get the next rectangle
+ myRect = *rectList;
+ }
+}
+
+//----------------------------------------------------------------------------------------
+void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *myRect, *prevRect, *nextRect, *tempRect;
+ RectList *rectList, *unsortedRectList;
+ int32 tempX1, tempY1, tempX2, tempY2;
+ bool finished;
+
+ rectList = *scrnRectList;
+
+ //go through the rectList list breaking down any rects which intersect the given coords
+ unsortedRectList = NULL;
+ myRect = rectList;
+ while (myRect) {
+
+ //set the nextRect pointer
+ nextRect = myRect->next;
+
+ //check for an intersection
+ tempX1 = imath_max(x1, myRect->x1);
+ tempY1 = imath_max(y1, myRect->y1);
+ tempX2 = imath_min(x2, myRect->x2);
+ tempY2 = imath_min(y2, myRect->y2);
+
+ //if we have an intersection
+ if ((tempX1 <= tempX2) && (tempY1 <= tempY2)) {
+
+ //break myRect apart into any pieces not covered by x1, y1, x2, y2
+ //top edge
+ if (myRect->y1 < y1) {
+
+ //create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = y1 - 1;
+
+ //add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+
+ //update myRect
+ myRect->y1 = y1;
+ }
+
+ //bottom edge
+ if (myRect->y2 > y2) {
+
+ //create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = y2 + 1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+
+ //add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+
+ //update myRect
+ myRect->y2 = y2;
+ }
+
+ //left edge
+ if (myRect->x1 < x1) {
+
+ //create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = x1 - 1;
+ tempRect->y2 = myRect->y2;
+
+ //add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+ }
+
+ //right edge
+ if (myRect->x2 > x2) {
+
+ //create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = x2 + 1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+
+ //add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+ }
+
+ //remove myRect from the list and turf it
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ rectList = myRect->next;
+ }
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+ }
+
+ //get the next rect
+ myRect = nextRect;
+ }
+
+ //now go through the unsorted list and insert them into the main list
+ tempRect = unsortedRectList;
+ while (tempRect) {
+
+ unsortedRectList = unsortedRectList->next;
+
+ //for each unsorted rect, loop through the rect list until its place is found
+ finished = false;
+ prevRect = NULL;
+ myRect = rectList;
+ while (myRect && (!finished)) {
+
+ //if it goes before myRect
+ if (tempRect->y2 <= myRect->y2) {
+ finished = true;
+ } else {
+ prevRect = myRect;
+ myRect = myRect->next;
+ }
+ }
+
+ //tempRect belongs after prevRect
+ if (prevRect) {
+ tempRect->prev = prevRect;
+ tempRect->next = prevRect->next;
+ if (prevRect->next) {
+ prevRect->next->prev = tempRect;
+ }
+ prevRect->next = tempRect;
+ }
+
+ //else it belongs at the front of rectList
+ else {
+ tempRect->prev = NULL;
+ tempRect->next = rectList;
+ if (rectList) {
+ rectList->prev = tempRect;
+ }
+ rectList = tempRect;
+ }
+
+ //get the next unsorted rect
+ tempRect = unsortedRectList;
+ }
+
+ //set the screen rect list to the resulting rect list
+ *scrnRectList = rectList;
+}
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng.h b/engines/m4/gui/gui_vmng.h
index b6e00637e79..e6320dc2ee5 100644
--- a/engines/m4/gui/gui_vmng.h
+++ b/engines/m4/gui/gui_vmng.h
@@ -142,6 +142,16 @@ extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
+// Rectangle routines
+extern RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2);
+extern void vmng_AddRectToRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+extern RectList *vmng_DuplicateRectList(RectList *myRectList);
+extern bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+extern bool vmng_RectListValid(RectList *myRectList);
+extern bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2);
+extern void vmng_DisposeRectList(RectList **rectList);
+extern void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 2f33ed377e1..5ec911c6d37 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -83,10 +83,11 @@ void ws_KillCruncher(void) {
mem_free((void *)myAnim8->myRegs);
myAnim8 = _G(myCruncher)->firstAnim8ToCrunch;
}
- mem_free((void *)_G(myCruncher));
- if (_G(stackBase)) {
+
+ mem_free(_G(myCruncher));
+
+ if (_G(stackBase))
mem_free(_G(stackBase));
- }
_G(cruncherInitialized) = false;
}
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 31d751ae7f3..5f0c615de1d 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -21,10 +21,20 @@
#include "m4/wscript/ws_hal.h"
#include "m4/core/errors.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/globals.h"
namespace M4 {
+bool ws_InitHAL() {
+ _G(deadRectList) = NULL;
+ return true;
+}
+
+void ws_KillHAL() {
+ vmng_DisposeRectList(&_G(deadRectList));
+}
+
void KillCCB(CCB *myCCB, bool restoreFlag) {
error("TODO: KillCCB");
#ifdef TODO
@@ -33,10 +43,10 @@ void KillCCB(CCB *myCCB, bool restoreFlag) {
}
if (restoreFlag && (!(myCCB->flags & CCB_SKIP)) && (!(myCCB->flags & CCB_HIDE))) {
if ((myCCB->flags & CCB_STREAM) && myCCB->maxArea) {
- vmng_AddRectToRectList(&deadRectList, myCCB->maxArea->x1, myCCB->maxArea->y1,
+ vmng_AddRectToRectList(&_G(deadRectList), myCCB->maxArea->x1, myCCB->maxArea->y1,
myCCB->maxArea->x2, myCCB->maxArea->y2);
} else {
- vmng_AddRectToRectList(&deadRectList, myCCB->currLocation->x1, myCCB->currLocation->y1,
+ vmng_AddRectToRectList(&_G(deadRectList), myCCB->currLocation->x1, myCCB->currLocation->y1,
myCCB->currLocation->x2, myCCB->currLocation->y2);
}
}
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index 1894fc7ce8b..c11dd7be373 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -27,6 +27,13 @@
namespace M4 {
+struct WSHal_Globals {
+ RectList *_deadRectList;
+ int32 _pcOffsetOld;
+};
+
+extern bool ws_InitHAL();
+extern void ws_KillHAL();
extern void KillCCB(CCB *myCCB, bool restoreFlag);
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 1b303ed0a6b..a385e787259 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -55,11 +55,11 @@ bool ws_Initialize(frac16 *theGlobals) {
if (!ws_InitCruncher()) {
return false;
}
-#ifdef TODO
+
if (!ws_InitHAL()) {
return false;
}
-
+#ifdef TODO
_G(oldTime) = timer_read_60();
#endif
_G(pauseTime) = 0;
@@ -73,8 +73,8 @@ void ws_Shutdown() {
ws_KillCruncher();
#ifdef TODO
ws_KillMachines();
- ws_KillHAL();
#endif
+ ws_KillHAL();
}
void TerminateMachinesByHash(int32 machHash) {
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
index 56e3230f6db..f3bd3c466e5 100644
--- a/engines/m4/wscript/wscript.h
+++ b/engines/m4/wscript/wscript.h
@@ -24,14 +24,15 @@
#define M4_WSCRIPT_WS_SCRIPT_H
#include "m4/wscript/ws_cruncher.h"
+#include "m4/wscript/ws_hal.h"
#include "m4/wscript/ws_load.h"
#include "m4/wscript/ws_machine.h"
#include "m4/wscript/ws_timer.h"
namespace M4 {
-struct WS_Globals : public WSCruncher_Globals, public WSLoad_Globals,
- public WSMachine_Globals, public WSTimer_Globals {
+struct WS_Globals : public WSCruncher_Globals, public WSHal_Globals,
+ public WSLoad_Globals, public WSMachine_Globals, public WSTimer_Globals {
};
extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg);
Commit: b572cd9dfb42c13bd10e56ac0e15c47b60262024
https://github.com/scummvm/scummvm/commit/b572cd9dfb42c13bd10e56ac0e15c47b60262024
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added WS Kill machines
Changed paths:
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index a385e787259..2c16ee053ea 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -27,6 +27,10 @@
namespace M4 {
+static int32 ws_KillMachines();
+static void clear_msg_list(machine *m);
+static void clear_persistent_msg_list(machine *m);
+
bool ws_Initialize(frac16 *theGlobals) {
int32 i;
@@ -71,9 +75,7 @@ bool ws_Initialize(frac16 *theGlobals) {
void ws_Shutdown() {
ws_KillTime();
ws_KillCruncher();
-#ifdef TODO
ws_KillMachines();
-#endif
ws_KillHAL();
}
@@ -81,4 +83,76 @@ void TerminateMachinesByHash(int32 machHash) {
warning("TODO: TerminateMachinesByHash");
}
+static int32 ws_KillMachines() {
+ machine *myMachine;
+ globalMsgReq *tempGlobalMsg;
+ int32 myBytes = 0;
+
+ // Deallocate all machines
+ myMachine = _G(firstMachine);
+ while (myMachine) {
+ _G(firstMachine) = _G(firstMachine)->next;
+
+ clear_msg_list(myMachine);
+ clear_persistent_msg_list(myMachine);
+
+ mem_free(myMachine);
+ myBytes += sizeof(machine);
+ myMachine = _G(firstMachine);
+ }
+
+ // deallocate global messages
+ //
+ tempGlobalMsg = _G(myGlobalMessages);
+ while (tempGlobalMsg) {
+ _G(myGlobalMessages) = _G(myGlobalMessages)->next;
+ mem_free((void *)tempGlobalMsg);
+ tempGlobalMsg = _G(myGlobalMessages);
+ }
+
+ return myBytes;
+}
+
+static void dispose_msgRequest(msgRequest *msg) {
+ if (msg) {
+ mem_free(msg);
+ }
+}
+
+static void clear_msg_list(machine *m) {
+ msgRequest *freeMsg, *nextMsg;
+
+ nextMsg = m->myMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+
+ m->myMsgs = nullptr;
+}
+
+static void clear_persistent_msg_list(machine *m) {
+
+ msgRequest *freeMsg, *nextMsg;
+
+ // Clear the active persistent msgs
+ nextMsg = m->myPersistentMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+ m->myPersistentMsgs = NULL;
+
+ // Clear the used persistent msgs
+ nextMsg = m->usedPersistentMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+ m->usedPersistentMsgs = NULL;
+}
+
} // End of namespace M4
Commit: 9e0cf325f7fed7639d90285fe78c71253b0b1668
https://github.com/scummvm/scummvm/commit/9e0cf325f7fed7639d90285fe78c71253b0b1668
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining WS init
Changed paths:
A engines/m4/platform/timer.cpp
A engines/m4/platform/timer.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/module.mk
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 08f8610b17e..4033bef490b 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -48,6 +48,7 @@ Globals::~Globals() {
gui_dialog_shutdown();
mem_stash_shutdown();
param_shutdown();
+ woodscript_shutdown();
g_globals = nullptr;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 36d1dd72537..ba5c9a6b365 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -33,6 +33,7 @@
#include "m4/gui/gui_univ.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
+#include "m4/platform/timer.h"
#include "m4/wscript/wscript.h"
namespace M4 {
@@ -43,7 +44,7 @@ class Globals;
extern Globals *g_globals;
-class Globals : public Mouse_Statics, public WS_Globals {
+class Globals : public Mouse_Statics, public WS_Globals, public Timer_Globals {
private:
void game_systems_initialize(byte flags);
void fire_up_gui();
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 2487a6a918c..e02c12d8531 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,6 +32,7 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ platform/timer.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
wscript/ws_load.o \
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
new file mode 100644
index 00000000000..ed315f9ae97
--- /dev/null
+++ b/engines/m4/platform/timer.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/platform/timer.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+uint32 timer_read() {
+ return _G(timer_60_low);
+}
+
+
+uint32 timer_read_dos() {
+ return _G(timer_dos_low);
+}
+
+
+uint32 timer_read_600() {
+ return _G(timer_600_low);
+}
+
+
+uint32 timer_read_60() {
+ return _G(timer_60_low);
+}
+
+void timer_600_proc() {
+ _G(timer_600_low)++;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/platform/timer.h b/engines/m4/platform/timer.h
new file mode 100644
index 00000000000..1bc0fd02173
--- /dev/null
+++ b/engines/m4/platform/timer.h
@@ -0,0 +1,49 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_PLATFORM_TIMER_H
+#define M4_PLATFORM_TIMER_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct Timer_Globals {
+ uint32 _timer_600_low = 0;
+ uint32 _timer_60_low = 0;
+ uint32 _timer_dos_low = 0;
+
+ bool _timer_installed = false;
+ uint16 _timer_600_handle = 0;
+ uint16 _timer_60_handle = 0;
+ uint16 _timer_dos_handle = 0;
+};
+
+extern uint32 timer_read();
+extern uint32 timer_read_dos();
+extern uint32 timer_read_600();
+extern uint32 timer_read_60();
+extern void timer_600_proc();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 2c16ee053ea..c28645f4a73 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -23,6 +23,7 @@
#include "m4/wscript/ws_cruncher.h"
#include "m4/wscript/wscript.h"
#include "m4/core/errors.h"
+#include "m4/platform/timer.h"
#include "m4/globals.h"
namespace M4 {
@@ -63,9 +64,8 @@ bool ws_Initialize(frac16 *theGlobals) {
if (!ws_InitHAL()) {
return false;
}
-#ifdef TODO
+
_G(oldTime) = timer_read_60();
-#endif
_G(pauseTime) = 0;
_G(enginesPaused) = false;
@@ -101,8 +101,7 @@ static int32 ws_KillMachines() {
myMachine = _G(firstMachine);
}
- // deallocate global messages
- //
+ // Deallocate global messages
tempGlobalMsg = _G(myGlobalMessages);
while (tempGlobalMsg) {
_G(myGlobalMessages) = _G(myGlobalMessages)->next;
@@ -133,7 +132,6 @@ static void clear_msg_list(machine *m) {
}
static void clear_persistent_msg_list(machine *m) {
-
msgRequest *freeMsg, *nextMsg;
// Clear the active persistent msgs
Commit: 1556ce732160abcbe839d2a50253e1cc30cd54e9
https://github.com/scummvm/scummvm/commit/1556ce732160abcbe839d2a50253e1cc30cd54e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added some palette code
Changed paths:
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 4033bef490b..328a547c425 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -24,6 +24,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
+#include "m4/graphics/gr_pal.h"
#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_sys.h"
@@ -96,6 +97,8 @@ void Globals::game_systems_initialize(byte flags) {
if (!woodscript_init())
error_show(FL, 'WSIF');
+
+ gr_pal_clear(_master_palette);
}
void Globals::fire_up_gui() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index ba5c9a6b365..51c8d9f277c 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -103,6 +103,7 @@ public:
Item *_clickItem = nullptr;
Item *_doubleClickItem = nullptr;
char _listboxSearchStr[80] = { 0 };
+ RGB8 _master_palette[256];
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 849652caa0d..607abc93f61 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -19,6 +19,8 @@
*
*/
+#include "common/system.h"
+#include "graphics/palette.h"
#include "common/textconsole.h"
#include "m4/graphics/gr_pal.h"
@@ -48,4 +50,29 @@ byte gr_color_get_current() {
error("TODO: gr_color_get_current");
}
+void gr_pal_clear(RGB8 *palette) {
+ int i;
+ RGB8 x = { 0, 0, 0 };
+
+ for (i = 0; i < 256; i++) {
+ palette[i].r = 0;
+ palette[i].g = 0;
+ palette[i].b = 0;
+ }
+
+ gr_pal_set(palette);
+}
+
+void gr_pal_set(RGB8 *pal) {
+ gr_pal_set_range(pal, 0, 256);
+}
+
+void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors) {
+ g_system->getPaletteManager()->setPalette((const byte *)pal, first_color, num_colors);
+}
+
+void gr_pal_set_entry(int32 index, RGB8 *entry) {
+ g_system->getPaletteManager()->setPalette((const byte *)entry, index, 1);
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 93ed0721f67..10ba96bcb3c 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -51,6 +51,18 @@ uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
void gr_color_set(int32 c);
byte gr_color_get_current();
+void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
+void gr_pal_set(RGB8 *pal);
+void gr_pal_interface(RGB8 *fixpal);
+void gr_pal_set_RGB6(RGB8 *entry, int r, int g, int b);
+void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
+void gr_pal_set_entry(int32 index, RGB8 *entry);
+void gr_pal_clear(RGB8 *palette);
+void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color);
+uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b);
+uint8 gr_pal_find_best_match_by_index(RGB8 *pal, uint8 r, uint8 g, uint8 b, int begin_color, int end_color);
+void gr_pal_copy(RGB8 *dest, RGB8 *src, uint8 firstIndex, uint8 lastIndex);
+
} // namespace M4
#endif
Commit: 729d23201aaf534bfbfb0e12e25cc56139bb0712
https://github.com/scummvm/scummvm/commit/729d23201aaf534bfbfb0e12e25cc56139bb0712
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added rails code
Changed paths:
A engines/m4/adv_r/adv_rails.cpp
A engines/m4/adv_r/adv_rails.h
engines/m4/adv_r/adv.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index f5ef31ba8f7..b0ee6219255 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -29,6 +29,13 @@ namespace M4 {
#define MAX_SCENES 180
#define GLB_SHARED_VARS 512
+#define MAXRAILNODES 32
+#define PATH_END 0xffff
+
+#define STR_FADEPAL "fade palette"
+#define STR_RAILNODE "rail node"
+#define STR_HOT_SPOT "hot spot"
+#define STR_PATH_NODE "path node"
enum {
INSTALL_SOUND_DRIVERS = 1,
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
new file mode 100644
index 00000000000..47b7bc9043e
--- /dev/null
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -0,0 +1,1069 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_rails.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define TOP_EDGE 0x01
+#define LEFT_EDGE 0x02
+#define BOTTOM_EDGE 0x04
+#define RIGHT_EDGE 0x08
+
+bool InitRails() {
+ int32 i, edgeTableSize;
+
+ // Register with the stash the frequently used structs
+ if (!mem_register_stash_type(&_G(rails).memtypePATHN, sizeof(pathNode), 32, "+PATHNODE")) {
+ return false;
+ }
+
+ // Create the stack. Since any path through a series of nodes can have at most MAXRAILNODES...
+ if ((_G(rails).stackBottom = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == NULL) {
+ return false;
+ }
+
+ // Allocate the array of railNode pointers and initialize...
+ if ((_G(rails).myNodes = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == NULL) {
+ return false;
+ }
+
+ for (i = 0; i < MAXRAILNODES; i++) {
+ _G(rails).myNodes[i] = NULL;
+ }
+
+ // Calculate the size of the edge table, allocate, and initialize
+ // The edge table stores the upper triangle of a square matrix.
+ edgeTableSize = (MAXRAILNODES * (MAXRAILNODES - 1)) >> 1;
+ if ((_G(rails).myEdges = (int16 *)mem_alloc(sizeof(int16) * edgeTableSize, "edge table")) == NULL) {
+ return false;
+ }
+
+ for (i = 0; i < edgeTableSize; i++) {
+ _G(rails).myEdges[i] = 0;
+ }
+
+ // Set the parameters and return
+ _G(rails).noWalkRectList = NULL;
+
+ return true;
+}
+
+
+void rail_system_shutdown(void) {
+ if (_G(rails).stackBottom) {
+ mem_free(_G(rails).stackBottom);
+ _G(rails).stackBottom = NULL;
+ }
+
+ ClearRails();
+
+ if (_G(rails).myNodes) {
+ mem_free(_G(rails).myNodes);
+ _G(rails).myNodes = NULL;
+ }
+ if (_G(rails).myEdges) {
+ mem_free(_G(rails).myEdges);
+ _G(rails).myEdges = NULL;
+ }
+}
+
+
+void ClearRails(void) {
+ int32 i, edgeTableSize;
+ noWalkRect *myRect;
+
+ if (_G(rails).myNodes) {
+ for (i = 0; i < MAXRAILNODES; i++) {
+ if (_G(rails).myNodes[i]) {
+ mem_free((void *)_G(rails).myNodes[i]);
+ _G(rails).myNodes[i] = NULL;
+ }
+ }
+ }
+
+ if (_G(rails).myEdges) {
+ edgeTableSize = (MAXRAILNODES * (MAXRAILNODES - 1)) >> 1;
+ for (i = 0; i < edgeTableSize; i++) {
+ _G(rails).myEdges[i] = 0;
+ }
+ }
+
+ // Now turf the noWalkRectList
+ myRect = _G(rails).noWalkRectList;
+ while (myRect) {
+ _G(rails).noWalkRectList = _G(rails).noWalkRectList->next;
+ mem_free((void *)myRect);
+ myRect = _G(rails).noWalkRectList;
+ }
+}
+
+
+noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY, Buffer *walkCodes) {
+ noWalkRect *newRect;
+
+ // Parameter verification
+ if ((x2 < x1) || (y2 < y1)) {
+ return NULL;
+ }
+
+ // Create new noWalkRect structure
+ if ((newRect = (noWalkRect *)mem_alloc(sizeof(noWalkRect), "intr noWalkRect")) == NULL) {
+ error_show(FL, 'IADN', "rect size: %ld %ld %ld %ld", x1, y1, x2, y2);
+ return NULL;
+ }
+
+ // Initialize the new rect
+ newRect->x1 = x1;
+ newRect->y1 = y1;
+ newRect->x2 = x2;
+ newRect->y2 = y2;
+
+ // Add the alternate walkto node - this node must exist
+ if ((newRect->alternateWalkToNode = AddRailNode(altX, altY, walkCodes, false)) < 0) {
+ error_show(FL, 'IADN', "could not add node. coord: %ld %ld", altX, altY);
+ }
+
+ // Now add the corner nodes. Not as important if these don't exist
+ newRect->walkAroundNode1 = AddRailNode(x1 - 1, y1 - 1, walkCodes, false);
+ newRect->walkAroundNode2 = AddRailNode(x2 + 1, y1 - 1, walkCodes, false);
+ newRect->walkAroundNode3 = AddRailNode(x2 + 1, y2 + 1, walkCodes, false);
+ newRect->walkAroundNode4 = AddRailNode(x1 - 1, y2 + 1, walkCodes, false);
+
+ // Now link the rectangle into the list
+ newRect->prev = NULL;
+ newRect->next = _G(rails).noWalkRectList;
+
+ if (_G(rails).noWalkRectList) {
+ _G(rails).noWalkRectList->prev = newRect;
+ }
+ _G(rails).noWalkRectList = newRect;
+
+ // Now refresh all the edges in case the noWalkRect is blocking edges
+ RestoreEdgeList(walkCodes);
+
+ return newRect;
+}
+
+
+void intr_move_no_walk_rect(noWalkRect *myRect, int32 new_x1, int32 new_y1,
+ int32 new_x2, int32 new_y2, int32 new_altX, int32 new_altY, Buffer *walkCodes) {
+ if (!myRect) {
+ return;
+ }
+
+ // Set the new values into the rect
+ myRect->x1 = new_x1;
+ myRect->y1 = new_y1;
+ myRect->x2 = new_x2;
+ myRect->y2 = new_y2;
+
+ // Now move the nodes
+ MoveRailNode(myRect->alternateWalkToNode, new_altX, new_altY, walkCodes, false);
+ MoveRailNode(myRect->walkAroundNode1, new_x1 - 1, new_y1 - 1, walkCodes, false);
+ MoveRailNode(myRect->walkAroundNode2, new_x2 + 1, new_y1 - 1, walkCodes, false);
+ MoveRailNode(myRect->walkAroundNode3, new_x2 + 1, new_y2 - 1, walkCodes, false);
+ MoveRailNode(myRect->walkAroundNode4, new_x1 - 1, new_y2 - 1, walkCodes, false);
+
+ // Now refresh all the edges
+ RestoreEdgeList(walkCodes);
+}
+
+
+void intr_remove_no_walk_rect(noWalkRect *myRect, Buffer *walkCodes) {
+ // Parameter verification
+ if (!myRect) {
+ return;
+ }
+
+ // Remove myRect from the list
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ _G(rails).noWalkRectList = myRect->next;
+ }
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+
+ // Remove the railNodes
+ RemoveRailNode(myRect->alternateWalkToNode, walkCodes, false);
+ RemoveRailNode(myRect->walkAroundNode1, walkCodes, false);
+ RemoveRailNode(myRect->walkAroundNode2, walkCodes, false);
+ RemoveRailNode(myRect->walkAroundNode3, walkCodes, false);
+ RemoveRailNode(myRect->walkAroundNode4, walkCodes, false);
+
+ // Turf myRect
+ mem_free(myRect);
+
+ // Now refresh all the edges
+ RestoreEdgeList(walkCodes);
+}
+
+bool intr_LineCrossesRect(int32 line_x1, int32 line_y1, int32 line_x2, int32 line_y2,
+ int32 rect_x1, int32 rect_y1, int32 rect_x2, int32 rect_y2) {
+ int32 p1X, p1Y, p2X, p2Y, mX, mY;
+ uint8 endCode1, endCode2, midCode;
+ bool finished;
+
+ // Ensure we have a valid rectangle
+ if ((rect_x1 > rect_x2) || (rect_y1 > rect_y2)) {
+ return false;
+ }
+
+ // Make copies of x1, y1, x2, y2
+ p1X = line_x1;
+ p1Y = line_y1;
+ p2X = line_x2;
+ p2Y = line_y2;
+
+ // Calculate the cohen sutherland codes for the endpoints of the line
+ // For (p1X, p1Y)
+ endCode1 = 0;
+ if (p1X < rect_x1) {
+ endCode1 = LEFT_EDGE;
+ } else if (p1X > rect_x2) {
+ endCode1 = RIGHT_EDGE;
+ }
+ if (p1Y < rect_y1) {
+ endCode1 |= TOP_EDGE;
+ } else if (p1Y > rect_y2) {
+ endCode1 |= BOTTOM_EDGE;
+ }
+
+ // For (p2X, p2Y)
+ endCode2 = 0;
+ if (p2X < rect_x1) {
+ endCode2 = LEFT_EDGE;
+ } else if (p2X > rect_x2) {
+ endCode2 = RIGHT_EDGE;
+ }
+ if (p2Y < rect_y1) {
+ endCode2 |= TOP_EDGE;
+ } else if (p2Y > rect_y2) {
+ endCode2 |= BOTTOM_EDGE;
+ }
+
+ // If either endCode is 0, that point is inside the rect, therefore the line intersects
+ if ((!endCode1) || (!endCode2)) {
+ return true;
+ }
+
+ finished = false;
+ while (!finished) {
+ // If both have a bit set in common, then the line segment is completely off one edge
+ if (endCode1 & endCode2) {
+ finished = true;
+ }
+
+ // Calculate the mid point of the line segment
+ mX = (p1X + p2X) >> 1;
+ mY = (p1Y + p2Y) >> 1;
+
+ // Because the midpoint is an integer (round-off err), make sure it isn't the same
+ // as one of the two endpoints.
+ if (((mX == p1X) && (mY == p1Y)) || ((mX == p1X) && (mY == p1Y))) {
+ return false;
+ }
+
+ // Calculate the cohen sutherland codes for the midpoint of the line segment
+ midCode = 0;
+ if (mX < rect_x1) {
+ midCode = LEFT_EDGE;
+ } else if (mX > rect_x2) {
+ midCode = RIGHT_EDGE;
+ }
+ if (mY < rect_y1) {
+ midCode |= TOP_EDGE;
+ } else if (mY > rect_y2) {
+ midCode |= BOTTOM_EDGE;
+ }
+
+ if (!midCode) {
+ return true;
+ }
+
+ // Else the midCode and one of the end points must form a line segment completely off one edge
+ else if (midCode & endCode1) {
+ // Setting endpoint1 to the midpoint throws away that half of the line segment
+ p1X = mX;
+ p1Y = mY;
+ endCode1 = midCode;
+ } else {
+ // Ditto for endpoint 2
+ p2X = mX;
+ p2Y = mY;
+ endCode2 = midCode;
+ }
+ }
+
+ // Got through without intersecting, therefore...
+ return false;
+}
+
+
+static bool intr_LinePassesThroughRect(int32 x1, int32 y1, int32 x2, int32 y2) {
+ noWalkRect *tempRect;
+ bool intersected;
+
+ // If there aren't any no-walk rects, no problem, return false
+ if (!_G(rails).noWalkRectList) {
+ return false;
+ }
+
+ // Loop through the _G(rails).noWalkRectList
+ tempRect = _G(rails).noWalkRectList;
+ intersected = false;
+ while (tempRect && (!intersected)) {
+ // See if the line passes through tempRect
+ intersected = intr_LineCrossesRect(x1, y1, x2, y2, tempRect->x1, tempRect->y1, tempRect->x2, tempRect->y2);
+
+ tempRect = tempRect->next;
+ }
+
+ return intersected;
+}
+
+
+bool intr_LinesCross(int32 line1_x1, int32 line1_y1, int32 line1_x2, int32 line1_y2,
+ int32 line2_x1, int32 line2_y1, int32 line2_x2, int32 line2_y2) {
+ bool intersected;
+ int32 rectX1, rectY1, rectX2, rectY2;
+
+ // The theory is that either line1 intersects the rectangle created by line2, and/or line2
+ // intersects the rectangle reacted by line1.
+
+ // Make sure both lines are listed left to right, top to bottom when passing in the coords as a rectangle
+ rectX1 = imath_min(line1_x1, line1_x2);
+ rectY1 = imath_min(line1_y1, line1_y2);
+ rectX2 = imath_max(line1_x1, line1_x2);
+ rectY2 = imath_max(line1_y1, line1_y2);
+
+ intersected = intr_LineCrossesRect(line2_x1, line2_y1, line2_x2, line2_y2, rectX1, rectY1, rectX2, rectY2);
+ if (intersected) {
+ rectX1 = imath_min(line2_x1, line2_x2);
+ rectY1 = imath_min(line2_y1, line2_y2);
+ rectX2 = imath_max(line2_x1, line2_x2);
+ rectY2 = imath_max(line2_y1, line2_y2);
+
+ intersected = intr_LineCrossesRect(line1_x1, line1_y1, line1_x2, line1_y2, rectX1, rectY1, rectX2, rectY2);
+ }
+
+ return intersected;
+}
+
+
+void CreateEdge(int32 node1, int32 node2, Buffer *walkCodes) {
+ int32 i, temp;
+ int32 index;
+ int32 x1, y1, x2, y2;
+ int32 y_unit, x_unit, xdiff, ydiff, scanX, scanY, width, height, error_term, stride;
+ bool valid, finished;
+ frac16 deltaX, deltaY, distance;
+ uint8 *walkCodePtr;
+
+ // Check for nodes and edges
+ if ((!_G(rails).myNodes) || (!_G(rails).myEdges)) {
+ return;
+ }
+ if ((node1 < 0) || (node1 >= MAXRAILNODES) || (node2 < 0) || (node2 >= MAXRAILNODES)) {
+ return;
+ }
+ if (node1 == node2) {
+ return;
+ }
+
+ // Ensure node1 < node2
+ if (node2 < node1) {
+ temp = node1;
+ node1 = node2;
+ node2 = temp;
+ }
+
+ // If node1 is y and node2 is x, first find table entry ie. tableWidth * y + x, the subtract
+ // n(n+1)/2 since only the upper triangle of the table is stored...
+ index = (MAXRAILNODES - 1) * node1 + node2 - 1 - (node1 * (node1 + 1) >> 1);
+ _G(rails).myEdges[index] = 0;
+ valid = true;
+ walkCodePtr = NULL;
+ finished = false;
+
+ if ((!_G(rails).myNodes[node1]) || (!_G(rails).myNodes[node2]))
+ return;
+ x1 = _G(rails).myNodes[node1]->x;
+ y1 = _G(rails).myNodes[node1]->y;
+ x2 = _G(rails).myNodes[node2]->x;
+ y2 = _G(rails).myNodes[node2]->y;
+
+ // Ensure the algorithm is symmetric...
+ if (x2 < x1) {
+ temp = x1;
+ x1 = x2;
+ x2 = temp;
+ temp = y1;
+ y1 = y2;
+ y2 = temp;
+ }
+
+ if (walkCodes && walkCodes->data) {
+ // Initialize the buffer data pointer, the maximum dimensions of the buffer, and the scan x and y
+ width = walkCodes->W;
+ stride = walkCodes->stride;
+ height = walkCodes->h;
+ scanX = x1;
+ scanY = y1;
+
+ // Calculate the difference along the y-axis
+ ydiff = y2 - y1;
+
+ // If we are scanning from bottom to top
+ if (ydiff < 0) {
+
+ //set ydiff to be the absolute, and set the y_unit direction negative
+ ydiff = -ydiff;
+ y_unit = -1;
+ }
+
+ //else set the y_unit direction positive
+ else {
+ y_unit = 1;
+ }
+
+ // Because of the symmetry check, xdiff is always positive
+ xdiff = x2 - x1;
+ x_unit = 1;
+
+ // If the difference is bigger along the x axis
+ if (xdiff > ydiff) {
+ // Initialize the error term
+ error_term = xdiff >> 1;
+
+ // Loop along the x axis and adjust scanY as necessary
+ scanX = x1;
+ for (i = 0; ((i <= xdiff) && valid && (!finished)); i++) {
+
+ // Check if we have scanned off the edge of the buffer
+ if ((scanX >= width) || ((y_unit > 0) && (scanY >= height)) || ((y_unit < 0) && (scanY < 0))) {
+ finished = true;
+ } else {
+ // Else we either haven't yet reached the buffer, or we are on it
+ // Make sure we're on the buffer
+ if ((scanX >= 0) && (scanY >= 0) && (scanY < height)) {
+ // Check to see if this is a valid walking area
+ if (!walkCodePtr) {
+ walkCodePtr = (uint8 *) & ((walkCodes->data)[scanY * stride + scanX]);
+ }
+ if ((*walkCodePtr) & 0x10) {
+ valid = false;
+ }
+ }
+
+ // Update scanY if appropriate
+ // Update the error term
+ error_term += ydiff;
+
+ // If the error_term has exceeded the xdiff, we need to move one unit along the y axis
+ if (error_term >= xdiff) {
+ // Reset the error term
+ error_term -= xdiff;
+
+ // Move along the y axis
+ scanY += y_unit;
+
+ // Update the walkCodePtr index if necessary
+ if (walkCodePtr) {
+ if (y_unit > 0) {
+ walkCodePtr += stride;
+ } else {
+ walkCodePtr -= stride;
+ }
+ }
+ }
+ }
+ scanX += x_unit;
+
+ // Update the walkCodePtr index if necessary
+ if (walkCodePtr) {
+ if (x_unit > 0) {
+ walkCodePtr++;
+ } else {
+ walkCodePtr--;
+ }
+ }
+ }
+ } else {
+ // Else the difference is bigger along the y axis
+ // Initialize the error term
+ error_term = ydiff >> 1;
+
+ // Loop along the y axis and adjust scanX as necessary
+ scanY = y1;
+ for (i = 0; ((i <= ydiff) && valid && (!finished)); i++) {
+ // Check if we have scanned off the edge of the buffer
+ if (((x_unit > 0) && (scanX >= width)) || ((x_unit < 0) && (scanX < 0)) ||
+ ((y_unit > 0) && (scanY >= height)) || ((y_unit < 0) && (scanY < 0))) {
+ finished = true;
+ } else {
+ // Else we either haven't yet reached the buffer, or we are on it
+ // Make sure we're on the buffer
+ if ((scanX >= 0) && (scanX < width) && (scanY >= 0) && (scanY < height)) {
+ // Check to see if this is a valid walking area
+ if (!walkCodePtr) {
+ walkCodePtr = (uint8 *) & ((walkCodes->data)[scanY * stride + scanX]);
+ }
+ if ((*walkCodePtr) & 0x10) {
+ valid = false;
+ }
+ }
+
+ // Update scanX if appropriate
+ // Update the error term
+ error_term += xdiff;
+
+ // If the error_term has exceeded the xdiff, we need to move one unit along the y axis
+ if (error_term >= ydiff) {
+ // Reset the error term
+ error_term -= ydiff;
+
+ // Move along the x axis
+ scanX += x_unit;
+
+ // Update the walkCodePtr index if necessary
+ if (walkCodePtr) {
+ if (x_unit > 0) {
+ walkCodePtr++;
+ } else {
+ walkCodePtr--;
+ }
+ }
+ }
+ }
+ scanY += y_unit;
+
+ // Update the walkCodePtr index if necessary
+ if (walkCodePtr) {
+ if (y_unit > 0) {
+ walkCodePtr += stride;
+ } else {
+ walkCodePtr -= stride;
+ }
+ }
+ }
+ }
+ }
+
+ // Now that we've checked it against the walk codes, we check if the line passes through
+ // any of the forbidden rectangles
+ if (valid) {
+ if (intr_LinePassesThroughRect(x1, y1, x2, y2)) {
+ valid = false;
+ }
+ }
+
+ // Finally, if the edge is still valid, fill in the edge table with the distance between the nodes.
+ if (valid) {
+ deltaX = imath_abs(((frac16)(x2 - x1)) << 16);
+ deltaY = imath_abs(((frac16)(y2 - y1)) << 16);
+ if ((deltaX >= 0x800000) || (deltaY >= 0x800000)) {
+ deltaX >>= 16;
+ deltaY >>= 16;
+ distance = (frac16)(SqrtF16(deltaX * deltaX + deltaY * deltaY) << 16);
+ } else {
+ distance = SqrtF16(SquareSF16(deltaX) + SquareSF16(deltaY)) << 8;
+ }
+
+ _G(rails).myEdges[index] = (int16)(distance >> 16);
+ }
+}
+
+
+void RestoreNodeEdges(int32 nodeID, Buffer *walkCodes) {
+ int32 i;
+ for (i = 0; i < MAXRAILNODES; i++) {
+ CreateEdge(i, nodeID, walkCodes);
+ }
+}
+
+
+void RestoreEdgeList(Buffer *walkCodes) {
+ int32 i, j;
+ for (i = 0; i < MAXRAILNODES; i++) {
+ for (j = i + 1; j < MAXRAILNODES; j++) {
+ CreateEdge(i, j, walkCodes);
+ }
+ }
+}
+
+int32 AddRailNode(int32 x, int32 y, Buffer *walkCodes, bool restoreEdges) {
+ int32 i, j;
+ railNode *newNode;
+
+ if ((!_G(rails).myNodes) || (!_G(rails).myEdges)) {
+ return -1;
+ }
+ for (i = 0; (i < MAXRAILNODES) && _G(rails).myNodes[i]; i++) {
+ }
+
+ if (i < MAXRAILNODES) {
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == NULL) {
+ return -1;
+ }
+ newNode->nodeID = (Byte)i;
+ newNode->x = (int16)x;
+ newNode->y = (int16)y;
+ _G(rails).myNodes[i] = newNode;
+
+ if (restoreEdges) {
+ for (j = 0; j < MAXRAILNODES; j++) {
+ if (_G(rails).myNodes[j]) CreateEdge(i, j, walkCodes);
+ }
+ }
+
+ return i;
+ }
+ return -1;
+}
+
+void MoveRailNode(int32 nodeID, int32 x, int32 y, Buffer *walkCodes, bool restoreEdges) {
+ if ((!_G(rails).myNodes) || (!_G(rails).myEdges) || (nodeID < 0) || (nodeID >= MAXRAILNODES) || (!_G(rails).myNodes[nodeID])) {
+ return;
+ }
+ _G(rails).myNodes[nodeID]->x = (int16)x;
+ _G(rails).myNodes[nodeID]->y = (int16)y;
+
+ if (restoreEdges) {
+ RestoreNodeEdges(nodeID, walkCodes);
+ }
+}
+
+bool RemoveRailNode(int32 nodeID, Buffer *walkCodes, bool restoreEdges) {
+ if ((nodeID < 0) || (nodeID >= MAXRAILNODES)) {
+ return false;
+ }
+ if ((!_G(rails).myNodes) || (!_G(rails).myNodes[nodeID]) || (!_G(rails).myEdges)) {
+ return false;
+ }
+ mem_free((void *)_G(rails).myNodes[nodeID]);
+ _G(rails).myNodes[nodeID] = NULL;
+
+ if (restoreEdges) {
+ RestoreNodeEdges(nodeID, walkCodes);
+ }
+
+ return true;
+}
+
+bool RailNodeExists(int32 nodeID, int32 *nodeX, int32 *nodeY) {
+ if ((nodeID < 0) || (nodeID >= MAXRAILNODES) || (!_G(rails).myNodes) || (!_G(rails).myNodes[nodeID])) {
+ return false;
+ }
+ if (nodeX) {
+ *nodeX = _G(rails).myNodes[nodeID]->x;
+ }
+ if (nodeY) {
+ *nodeY = _G(rails).myNodes[nodeID]->y;
+ }
+ return true;
+}
+
+int16 GetEdgeLength(int32 node1, int32 node2) {
+ int32 temp;
+ int32 index;
+ if (!_G(rails).myEdges) return 0;
+ if (node1 == node2) return 0;
+ if (node2 < node1) {
+ temp = node1;
+ node1 = node2;
+ node2 = temp;
+ }
+ // If node1 is y and node2 is x, first find table entry ie. tableWidth * y + x, the subtract
+ // n(n+1)/2 since only the upper triangle of the table is stored...
+ index = (MAXRAILNODES - 1) * node1 + node2 - 1 - (node1 * (node1 + 1) >> 1);
+ return _G(rails).myEdges[index];
+}
+
+
+void DisposePath(railNode *pathStart) {
+ railNode *tempNode;
+
+ tempNode = pathStart;
+ while (tempNode) {
+ pathStart = pathStart->shortPath;
+ mem_free((void *)tempNode);
+ tempNode = pathStart;
+ }
+}
+
+
+static railNode *DuplicatePath(railNode *pathStart) {
+ railNode *newNode, *firstNode, *prevNode, *pathNode;
+
+ // Initialize pointers
+ firstNode = prevNode = NULL;
+
+ // This routine assumes a valid path from _G(rails).myNodes[origID] following _G(rails).myNodes[]->shortPath until NULL
+ pathNode = pathStart;
+
+ // Loop until NULL - end of path
+ while (pathNode) {
+
+ // Create a new railNode, and duplicate values
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "+RAIL")) == NULL) {
+ error_show(FL, 'OOM!', "Could not alloc railNode");
+ return NULL;
+ }
+ newNode->x = pathNode->x;
+ newNode->y = pathNode->y;
+ newNode->shortPath = NULL;
+
+ // Link into the new list
+ if (!firstNode) {
+ firstNode = newNode;
+ } else {
+ prevNode->shortPath = newNode;
+ }
+ prevNode = newNode;
+
+ // Get the next in the list
+ pathNode = pathNode->shortPath;
+ }
+
+ return firstNode;
+}
+
+
+railNode *CreateCustomPath(int32 coord, ...) {
+ va_list argPtr;
+ railNode *firstNode, *prevNode = nullptr, *newNode;
+ int32 x, y;
+
+ // Initialize firstNode
+ firstNode = false;
+
+ // Set argPtr to point to the beginning of the variable arg list
+ va_start(argPtr, coord);
+
+ // Loop until coord == 0xffff
+ while (coord != 0xffff) {
+ // Set x
+ x = coord;
+
+ // Read the next arg off the arg list, and set y
+ coord = va_arg(argPtr, int32);
+ y = coord;
+
+
+ // Create a new node struct
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == NULL) {
+ error_show(FL, 'OOM!', "could not alloc railNode");
+ return NULL;
+ }
+
+ // Set the new node values...
+ newNode->x = x;
+ newNode->y = y;
+ newNode->shortPath = NULL;
+
+ // Link into path list
+ if (!firstNode) {
+ firstNode = newNode;
+ } else {
+ assert(prevNode);
+ prevNode->shortPath = newNode;
+ }
+ prevNode = newNode;
+
+ // Read another arg, should be the next "x" for the next pair of args
+ if (coord != 65535) {
+ coord = va_arg(argPtr, int32);
+ }
+ }
+
+ // Restore the stack
+ va_end(argPtr);
+
+ return firstNode;
+}
+
+
+bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath) {
+ pathNode *thePath, *tempPathNode;
+ railNode **checkStackTop, *currNode, *tempNode;
+ int16 edgeDist, shortcutWeight;
+ uint32 currPathNodes;
+ int32 i, prevID, maxNodeID;
+
+ *shortPath = NULL;
+
+ // Check that we have two valid and different nodes to walk between
+ if ((!_G(rails).myNodes) || (!_G(rails).myEdges)) {
+ return false;
+ }
+ if (origID == destID) {
+ return true;
+ }
+ if ((!_G(rails).myNodes[origID]) || (!_G(rails).myNodes[destID])) {
+ return false;
+ }
+ if ((_G(rails).myNodes[origID]->x == _G(rails).myNodes[destID]->x) && (_G(rails).myNodes[origID]->y == _G(rails).myNodes[destID]->y)) {
+ return true;
+ }
+
+ // Set the end of the shortest path
+ _G(rails).myNodes[destID]->shortPath = NULL;
+
+ // Check to see if we can walk directly from oridID to destID
+ edgeDist = GetEdgeLength(origID, destID);
+ if (edgeDist > 0) {
+ _G(rails).myNodes[origID]->shortPath = _G(rails).myNodes[destID];
+ _G(rails).myNodes[destID]->pathWeight = edgeDist;
+ *shortPath = DuplicatePath(_G(rails).myNodes[origID]->shortPath);
+ return true;
+ }
+
+ // Otherwise, run the algorithm to determine the shortest path
+
+ // Initialize the railNodes and find the largest node ID to speed up for loops
+ maxNodeID = 0;
+ for (i = 0; i < MAXRAILNODES; i++) {
+ tempNode = _G(rails).myNodes[i];
+ if (tempNode) {
+ maxNodeID = i;
+ tempNode->shortPath = NULL;
+ tempNode->pathWeight = 32767;
+ }
+ }
+
+ // Initialize the stack
+ _G(rails).stackTop = _G(rails).stackBottom;
+
+ // Initialize the bitmask of the nodes and the current path list
+ currPathNodes = 0;
+ thePath = NULL;
+
+ // Put the first node onto the stack (the address of, actually)
+ _G(rails).myNodes[origID]->pathWeight = 0;
+ *_G(rails).stackTop++ = _G(rails).myNodes[origID];
+
+ // While there are still nodes on the stack keep processing
+ while (_G(rails).stackTop > _G(rails).stackBottom) {
+
+ // Take the first node off the stack
+ currNode = *(--_G(rails).stackTop);
+
+ // See if it is adjacent to the destination node - always 0 the first time through...
+ edgeDist = GetEdgeLength(currNode->nodeID, destID);
+
+ // Yes it is, therefore, we have a valid path, maybe the shortest...
+ if (edgeDist > 0) {
+ // Check whether the pathweight of the second last node + the edge to get to the last
+ // is less than the pathweight of the previously found shortest path
+ if (currNode->pathWeight + edgeDist < _G(rails).myNodes[destID]->pathWeight) {
+ // If so, store the new shortest path weight, and complete the path link
+ _G(rails).myNodes[destID]->pathWeight = (int16)(currNode->pathWeight + edgeDist);
+ _G(rails).myNodes[currNode->nodeID]->shortPath = _G(rails).myNodes[destID];
+
+ // Now we follow "thePath" back to the origID, updating the bitMask, and setting shortPath links
+ // initialize variables used in the loop
+ prevID = currNode->nodeID;
+ currPathNodes = 0;
+ tempPathNode = thePath;
+
+ // Loop through to the end of the path
+ while (tempPathNode) {
+
+ // Link up the nodes in the shortPath
+ _G(rails).myNodes[tempPathNode->nodeID]->shortPath = _G(rails).myNodes[prevID];
+
+ // Or in the bitmask
+ currPathNodes |= (1 << prevID);
+
+ // Setup for the next link
+ prevID = tempPathNode->nodeID;
+ tempPathNode = tempPathNode->next;
+ }
+ }
+
+ // Set the stackTop to point at the node preceeding currNode, which preceeds destID
+ // we want to check the contents of the stack from the top, and stackTop always point to
+ // the next available location, not directly at the top element.
+ _G(rails).stackTop--;
+
+ // Setup temp Ptr
+ tempPathNode = thePath;
+
+ // While the top of the stack point at a node directly in thePath -
+ // we remove all the nodes in thePath from the top of the stack until we come across
+ // one that is not in thePath. This one that is not in thePath will not yet have been
+ // checked.
+ while ((tempPathNode) && (tempPathNode->nodeID == (*_G(rails).stackTop)->nodeID)) {
+ _G(rails).stackTop--;
+ thePath = thePath->next;
+ mem_free_to_stash((void *)tempPathNode, _G(rails).memtypePATHN);
+ tempPathNode = thePath;
+ }
+
+ // Since thePath cannot have more elements than are on the stack, we will never have
+ // a stack underflow, but when the _G(rails).stackTop points to a node not in thePath, or
+ // if the entire thePath was on the stack, thus the stack was completely emptied,
+ // we must reset the _G(rails).stackTop to point to the next available location.
+ _G(rails).stackTop++;
+ } else {
+ // Else the currNode is not adjacent to the dest node
+ // Put currNode back onto the stack
+ _G(rails).stackTop++;
+
+ // Setup a temporary pointer, so we know whether any neighbors of the currNode were stacked...
+ checkStackTop = _G(rails).stackTop;
+
+ // Check to see whether the path leading to currNode is at least shorter than the current shortest path
+ if (currNode->pathWeight < _G(rails).myNodes[destID]->pathWeight) {
+ // If so, loop through all the nodes
+ for (i = 0; i <= maxNodeID; i++) {
+ if (_G(rails).myNodes[i]) {
+ // For each different valid node, check to see if the currNode is adjacent to it
+ edgeDist = GetEdgeLength(currNode->nodeID, i);
+
+ // If it is a neighbor, and the pathweight reaching it through currNode is
+ // less than the weight of any previous path that reached the same neighbor...
+ if ((edgeDist > 0) && ((currNode->pathWeight + edgeDist) < _G(rails).myNodes[i]->pathWeight)) {
+ // Now see if that neighbor is already part of the current shortest path
+ if (currPathNodes & (1 << i)) {
+ // If so, the path from node i to the destination node will already have been created
+ // therefore the entire path will become shorter by the original weight to reach node i
+ // minus (the weight to get to the currNode plus the weight of the edge to
+ // get from the currNode to node i).
+ shortcutWeight = (int16)(_G(rails).myNodes[i]->pathWeight - (currNode->pathWeight + edgeDist));
+
+ // Loop from node i to the dest node, subtract the shortcutWeight, and or the bitmask
+ currPathNodes = 0;
+ tempNode = _G(rails).myNodes[i];
+ while (tempNode) {
+ currPathNodes |= (1 << tempNode->nodeID);
+ tempNode->pathWeight -= shortcutWeight;
+ tempNode = tempNode->shortPath;
+ }
+
+ // Link the currNode to node i
+ _G(rails).myNodes[currNode->nodeID]->shortPath = _G(rails).myNodes[i];
+
+ // ThePath is a linked list that lists the nodeIDs
+ // FROM: the node leading up to the currNode
+ // TO: the origID (ie. backwards)
+ // Loop through backwards, linking up the new shortPath, and ORing the bitmask
+ prevID = currNode->nodeID;
+ tempPathNode = thePath;
+ while (tempPathNode) {
+ _G(rails).myNodes[tempPathNode->nodeID]->shortPath = _G(rails).myNodes[prevID];
+ currPathNodes |= (1 << prevID);
+ prevID = tempPathNode->nodeID;
+ tempPathNode = tempPathNode->next;
+ }
+ } else {
+ // Else we don't know whether we can reach the destID from node i
+ // Set the pathweight of node i to the smaller value, and place it on the stack
+ _G(rails).myNodes[i]->pathWeight = (int16)(currNode->pathWeight + edgeDist);
+ *_G(rails).stackTop++ = _G(rails).myNodes[i];
+ }
+ }
+ }
+ }
+ }
+
+ // If we put neighbors of the currNode onto the stack...
+ if (_G(rails).stackTop != checkStackTop) {
+ // Create a pathNode, and place in the list.
+ tempPathNode = (pathNode *)mem_get_from_stash(_G(rails).memtypePATHN, "+PATH");
+ tempPathNode->nodeID = currNode->nodeID;
+ tempPathNode->next = thePath;
+ thePath = tempPathNode;
+ } else {
+ // Otherwise currNode had no neighbors such that it is not known whether traversing
+ // through it's neighbor is shorter. currNode is either a dead end, or is in the path
+
+ // Take currNode off the stack top
+ _G(rails).stackTop--;
+
+ // Set the _G(rails).stackTop to point at the node preceeding currNode
+ // we want to check the contents of the stack from the top, and _G(rails).stackTop always point to
+ // the next available location, not directly at the top element.
+ _G(rails).stackTop--;
+
+ //setup temp Ptr
+ tempPathNode = thePath;
+
+ // While the top of the stack point at a node directly in thePath -
+ // we remove all the nodes in thePath from the top of the stack until we come across
+ // one that is not in thePath. This one that is not in thePath will not yet have been
+ // checked.
+ while ((tempPathNode) && (tempPathNode->nodeID == (*_G(rails).stackTop)->nodeID)) {
+ _G(rails).stackTop--;
+ thePath = thePath->next;
+ mem_free_to_stash((void *)tempPathNode, _G(rails).memtypePATHN);
+ tempPathNode = thePath;
+ }
+
+ // Since thePath cannot have more elements than are on the stack, we will never have
+ // a stack underflow, but when the _G(rails).stackTop points to a node not in thePath, or
+ // if the entire thePath was on the stack, thus the stack was completely emptied,
+ // we must reset the _G(rails).stackTop to point to the next available location.
+ _G(rails).stackTop++;
+
+ }
+ }
+ }
+
+ // We've completed the enhanced breadth-first search of the rail nodes. return the result
+ if (_G(rails).myNodes[destID]->pathWeight < 32767) {
+ *shortPath = DuplicatePath(_G(rails).myNodes[origID]->shortPath);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool intr_PathCrossesLine(int32 startX, int32 startY, railNode *pathStart,
+ int32 line_x1, int32 line_y1, int32 line_x2, int32 line_y2) {
+ railNode *tempNode;
+ bool intersected;
+ int32 prevX, prevY;
+
+ intersected = false;
+ prevX = startX;
+ prevY = startY;
+
+ // Loop through the path nodes. Each node is the end of line segment started at (prevX, prevY)
+ tempNode = pathStart;
+ while (tempNode && (!intersected)) {
+ intersected = intr_LinesCross(line_x1, line_y1, line_x2, line_y2, prevX, prevY, tempNode->x, tempNode->y);
+ prevX = tempNode->x;
+ prevY = tempNode->y;
+ tempNode = tempNode->shortPath;
+ }
+
+ return intersected;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_rails.h b/engines/m4/adv_r/adv_rails.h
new file mode 100644
index 00000000000..480b8ff1754
--- /dev/null
+++ b/engines/m4/adv_r/adv_rails.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 M4_ADV_R_ADV_RAILS_H
+#define M4_ADV_R_ADV_RAILS_H
+
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+struct Rails_Globals {
+ railNode **myNodes;
+ int16 *myEdges;
+
+ railNode **stackBottom, **stackTop;
+ noWalkRect *noWalkRectList;
+
+ int32 memtypePATHN;
+};
+
+extern bool InitRails();
+extern void rail_system_shutdown();
+extern void ClearRails();
+noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY, Buffer *walkCodes);
+extern void intr_move_no_walk_rect(noWalkRect *myRect, int32 new_x1, int32 new_y1,
+ int32 new_x2, int32 new_y2, int32 new_altX, int32 new_altY, Buffer *walkCodes);
+extern void intr_remove_no_walk_rect(noWalkRect *myRect, Buffer *walkCodes);
+extern void CreateEdge(int32 node1, int32 node2, Buffer *walkCodes);
+extern void RestoreNodeEdges(int32 nodeID, Buffer *walkCodes);
+extern void RestoreEdgeList(Buffer *walkCodes);
+extern int32 AddRailNode(int32 x, int32 y, Buffer *walkCodes, bool restoreEdges);
+extern void MoveRailNode(int32 nodeID, int32 x, int32 y, Buffer *walkCodes, bool restoreEdges);
+extern bool RemoveRailNode(int32 nodeID, Buffer *walkCodes, bool restoreEdges);
+extern bool RailNodeExists(int32 nodeID, int32 *nodeX, int32 *nodeY);
+extern int16 GetEdgeLength(int32 node1, int32 node2);
+extern bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath);
+extern railNode *CreateCustomPath(int32 coord, ...);
+extern void DisposePath(railNode *pathStart);
+extern bool intr_LineCrossesRect(int32 line_x1, int32 line_y1, int32 line_x2, int32 line_y2,
+ int32 rect_x1, int32 rect_y1, int32 rect_x2, int32 rect_y2);
+extern bool intr_LinesCross(int32 line1_x1, int32 line1_y1, int32 line1_x2, int32 line1_y2,
+ int32 line2_x1, int32 line2_y1, int32 line2_x2, int32 line2_y2);
+extern bool intr_PathCrossesLine(int32 startX, int32 startY, railNode *pathStart,
+ int32 line_x1, int32 line_y1, int32 line_x2, int32 line_y2);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 328a547c425..0dce5aabe1d 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -99,6 +99,10 @@ void Globals::game_systems_initialize(byte flags) {
error_show(FL, 'WSIF');
gr_pal_clear(_master_palette);
+
+ // Start up rail system
+ if (flags & INSTALL_RAIL_SYSTEM)
+ InitRails();
}
void Globals::fire_up_gui() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 51c8d9f277c..3e21200aabf 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -27,6 +27,7 @@
#include "m4/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
+#include "m4/adv_r/adv_rails.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
#include "m4/gui/gui_mouse.h"
@@ -64,6 +65,7 @@ public:
Scene_list _scene_list;
frac16 _globals[GLB_SHARED_VARS];
Resources _resources;
+ Rails_Globals _rails;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e02c12d8531..c987882d03e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
res.o \
term.o \
adv_r/adv_been.o \
+ adv_r/adv_rails.o \
adv_r/db_env.o \
adv_r/db_rmlst.o \
core/errors.o \
Commit: e624797a4c216b9c420a78f06e92f65f329bdff5
https://github.com/scummvm/scummvm/commit/e624797a4c216b9c420a78f06e92f65f329bdff5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added FileStream class
Changed paths:
A engines/m4/fileio/fstream.cpp
A engines/m4/fileio/fstream.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/module.mk
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
new file mode 100644
index 00000000000..999ae2e6bc4
--- /dev/null
+++ b/engines/m4/fileio/fstream.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/fileio/fstream.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool f_stream_Init() {
+ _G(firstStream) = nullptr;
+ _G(lastStream) = nullptr;
+ return true;
+}
+
+StreamFile::StreamFile(const Common::String &filename) {
+ if (!_file.open(filename))
+ error("Could not open - %s", filename.c_str());
+}
+
+int32 StreamFile::read(Handle bufferHandle, int32 n) {
+ return _file.read(bufferHandle, n);
+}
+
+bool StreamFile::seek(uint32 n) {
+ return _file.seek(n);
+}
+
+bool StreamFile::seek_ahead(uint32 n) {
+ return _file.skip(n);
+}
+
+uint32 StreamFile::get_pos() {
+ return _file.pos();
+}
+
+} // namespace M4
diff --git a/engines/m4/fileio/fstream.h b/engines/m4/fileio/fstream.h
new file mode 100644
index 00000000000..ff8936895e9
--- /dev/null
+++ b/engines/m4/fileio/fstream.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_FILEIO_FSTREAM_H
+#define M4_FILEIO_FSTREAM_H
+
+#include "common/file.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+class StreamFile {
+private:
+ Common::File _file;
+public:
+ StreamFile(const Common::String &filename);
+ ~StreamFile() {}
+
+ int32 read(Handle bufferHandle, int32 n);
+ bool seek(uint32 n);
+ bool seek_ahead(uint32 n);
+ uint32 get_pos();
+};
+
+struct strmRequest {
+ strmRequest *next;
+ strmRequest *prev;
+ StreamFile *srcFile;
+ int32 strmSize;
+ Handle strmHandle;
+ uint8 *strmBuff;
+ uint8 *endStrmBuff;
+ uint8 *strmHead;
+ uint8 *strmTail;
+ uint8 *strmWrap;
+ uint8 *strmLastRead;
+ int32 nextReadSize;
+ int32 numBlocksToRead;
+ int32 *blockSizeArray;
+ bool wrapStream;
+};
+
+extern bool f_stream_Init();
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 0dce5aabe1d..ee443b61cb0 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -103,6 +103,9 @@ void Globals::game_systems_initialize(byte flags) {
// Start up rail system
if (flags & INSTALL_RAIL_SYSTEM)
InitRails();
+
+ if (!f_stream_Init())
+ error_show(FL, 'FSIF');
}
void Globals::fire_up_gui() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 3e21200aabf..a2f44e75c21 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -28,6 +28,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_font.h"
#include "m4/gui/gui_mouse.h"
@@ -106,6 +107,8 @@ public:
Item *_doubleClickItem = nullptr;
char _listboxSearchStr[80] = { 0 };
RGB8 _master_palette[256];
+ strmRequest *_firstStream;
+ strmRequest *_lastStream;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index c987882d03e..2e3c61a62a2 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS = \
core/mouse.o \
fileio/extensions.o \
fileio/fileio.o \
+ fileio/fstream.o \
fileio/info.o \
fileio/sys_file.o \
graphics/gr_buff.o \
Commit: 3378d03a9850e3b4ad8116c4e495380809195a88
https://github.com/scummvm/scummvm/commit/3378d03a9850e3b4ad8116c4e495380809195a88
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Player struct
Changed paths:
engines/m4/adv_r/adv.h
engines/m4/globals.cpp
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index b0ee6219255..12ddb8d0865 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -31,6 +31,7 @@ namespace M4 {
#define GLB_SHARED_VARS 512
#define MAXRAILNODES 32
#define PATH_END 0xffff
+#define MAX_PLYR_STRING_LEN 40
#define STR_FADEPAL "fade palette"
#define STR_RAILNODE "rail node"
@@ -90,13 +91,69 @@ struct SceneDef {
int32 num_props = 0;
HotSpotRec *props = nullptr;
- int32 front_y = 100, back_y = 100; // Player scaling baselines
- int32 front_scale = 100, back_scale = 100; // Player scaling factors
+ int32 front_y = 400, back_y = 100; // Player scaling baselines
+ int32 front_scale = 100, back_scale = 85; // Player scaling factors
int16 depth_table[16] = { 0 }; // Player sprite depth table
int32 numRailNodes = 0; // # of rails
};
+struct Player {
+ int32 x = 0, y = 0; // Player's current screen location
+ int32 facing = 0; // Player's current directional facing
+
+ char verb[MAX_PLYR_STRING_LEN] = { 0 };
+ char noun[MAX_PLYR_STRING_LEN] = { 0 };
+ char prep[MAX_PLYR_STRING_LEN] = { 0 };
+ char object[MAX_PLYR_STRING_LEN] = { 0 };
+ char ws_asset_name[32] = { 0 };
+ char ws_shadow_name[32] = { 0 };
+ int16 walker_type = 0; // Type of walker (ripley, mei_chin, safari, etc.)
+ int16 shadow_type = 0; // Type of walker (ripley shadow, candleman shadow, etc.)
+
+ // If he walks off edge, this holds the number of the room he goes to
+ int32 walk_off_edge_to_room; // Player should walk off edge unless told otherwise
+
+ // if false player won't walk - totally aborts a walk
+ bool need_to_walk = false; // Player needs to walk somewhere
+
+ // if FALSE player won't walk yet - walk suspended until TRUE
+ bool ready_to_walk = false; // Player is ready to perform that walk
+
+ bool waiting_for_walk = false;
+
+ // Default TRUE for every room
+ // Flag if accepting player input
+ bool comm_allowed = true;
+
+ // Means a parser command is ready. When apps programmer finishes
+ // parsing command, the programmer must set this to FALSE. If this
+ // doesn't get set, the command falls through to the error handling code.
+ int32 command_ready = 0;
+
+ // Default TRUE, if set to FALSE walker disappears instantly, and vv
+ bool walker_visible = false; // Flag if player's sprite is visible
+
+ // if TRUE, then apps programmer must display look messages
+ bool look_around = false; // Flag for special "look around" command
+
+ // Tested by the apps programmer to check if player has been here before
+ bool been_here_before = false;
+
+ // Walker sprites dumped on switching scenes if TRUE in room preload code
+ bool walker_reload_palette = false;
+ bool disable_hyperwalk = false;
+ bool walker_loads_first = false;
+ bool walker_in_this_scene = false;
+
+ int32 walker_trigger = false;
+
+ int32 walk_x = 0, walk_y = 0; // where to walk to when player.ready_to_walk
+ int32 walk_facing = 0;
+
+ int32 click_x = 0, click_y = 0;
+};
+
} // namespace M4
#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index ee443b61cb0..4a6e3993595 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -106,6 +106,8 @@ void Globals::game_systems_initialize(byte flags) {
if (!f_stream_Init())
error_show(FL, 'FSIF');
+
+
}
void Globals::fire_up_gui() {
Commit: 22016991ecfe8b4a941cd147f6b4e9586b8038b3
https://github.com/scummvm/scummvm/commit/22016991ecfe8b4a941cd147f6b4e9586b8038b3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding some cursor code
Changed paths:
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/graphics.h
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_mouse.h
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_load.h
engines/m4/wscript/wscript.cpp
engines/m4/wscript/wscript.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 4a6e3993595..118da119246 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -27,6 +27,7 @@
#include "m4/graphics/gr_pal.h"
#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
+#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
@@ -107,7 +108,7 @@ void Globals::game_systems_initialize(byte flags) {
if (!f_stream_Init())
error_show(FL, 'FSIF');
-
+ mouse_set_sprite(kArrowCursor);
}
void Globals::fire_up_gui() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index a2f44e75c21..1e0a4f8de2e 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -46,7 +46,7 @@ class Globals;
extern Globals *g_globals;
-class Globals : public Mouse_Statics, public WS_Globals, public Timer_Globals {
+class Globals : public Mouse_Globals, public WS_Globals, public Timer_Globals {
private:
void game_systems_initialize(byte flags);
void fire_up_gui();
diff --git a/engines/m4/graphics/graphics.h b/engines/m4/graphics/graphics.h
index 0fba536acea..5cc4c086bc3 100644
--- a/engines/m4/graphics/graphics.h
+++ b/engines/m4/graphics/graphics.h
@@ -26,6 +26,60 @@
namespace M4 {
+#define FILL_INTERIOR 1 // a flag for use by DrawTile
+#define BORDER 0
+
+#define COLOR_MAX_SHADOW_COLORS 3
+
+#define FONT_SIZE 128
+#define FONT_MAX_WIDTH 255
+#define FONT_MAX_HEIGHT 200
+
+//SS FILE DATA DEFINITIONS...
+#define HEAD_M4SS 0x4D345353 //'M4SS'
+#define HEAD_SS4M 0x5353344D //'SS4M'
+#define SS_FORMAT 101 //if it ever has to be printed, divide by 100
+
+#define CELS__PAL 0x2050414C //' PAL'
+#define CELS_LAP_ 0x4C415020 //INTEL ' PAL'
+#define CELS___SS 0x20205353 //' SS'
+#define CELS_SS__ 0x53532020 //INTEL ' SS'
+
+#define CELS_HEADER 0
+#define CELS_SRC_SIZE 1
+#define CELS_PACKING 2
+#define CELS_FRAME_RATE 3
+#define CELS_PIX_SPEED 4
+#define CELS_SS_MAX_W 5
+#define CELS_SS_MAX_H 6
+#define CELS_RSVD_3 7
+#define CELS_RSVD_4 8
+#define CELS_RSVD_5 9
+#define CELS_RSVD_6 10
+#define CELS_RSVD_7 11
+#define CELS_RSVD_8 12
+#define CELS_COUNT 13
+#define SS_HEAD_SIZE 14 //includes all the previous dwords
+#define CELS_OFFSETS 14
+
+#define CELS_PACK 0
+#define CELS_STREAM 1
+#define CELS_X 2
+#define CELS_Y 3
+#define CELS_W 4
+#define CELS_H 5
+#define CELS_COMP 6
+#define INDV_RSVD_1 8
+#define INDV_RSVD_2 8
+#define INDV_RSVD_3 9
+#define INDV_RSVD_4 10
+#define INDV_RSVD_5 11
+#define INDV_RSVD_6 12
+#define INDV_RSVD_7 13
+#define INDV_RSVD_8 14
+#define SS_INDV_HEAD 15 //includes all the previous dwords
+#define CELS_DATA 15
+
} // namespace M4
#endif
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index d67c4874177..fa7c4b032be 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -266,5 +266,53 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
#endif
}
+bool mouse_set_sprite(int32 spriteNum) {
+ M4sprite *tempSprite;
+ int32 minX, minY, maxX, maxY;
+
+ if (_G(mouseIsLocked)) {
+ _G(newMouseNum) = spriteNum;
+ return true;
+ }
+
+ if (spriteNum == _G(currMouseNum)) {
+ return true;
+ }
+
+ if (!_G(mouseSeriesHandle) || !*_G(mouseSeriesHandle))
+ return false;
+
+ minX = _G(oldX) - _G(mouseX1offset);
+ minY = _G(oldY) - _G(mouseY1offset);
+ maxX = _G(oldX) + _G(mouseX2offset);
+ maxY = _G(oldY) + _G(mouseY2offset);
+
+ if ((tempSprite = CreateSprite(_G(mouseSeriesHandle), _G(mouseSeriesOffset), spriteNum,
+ _G(mouseSprite), nullptr)) == nullptr)
+ return false;
+
+ _G(mouseSprite) = tempSprite;
+ _G(mouseX1offset) = _G(mouseSprite)->xOffset;
+ _G(mouseY1offset) = _G(mouseSprite)->yOffset;
+ _G(mouseX2offset) = _G(mouseSprite)->w - _G(mouseX1offset) - 1;
+ _G(mouseY2offset) = _G(mouseSprite)->h - _G(mouseY1offset) - 1;
+ if (_G(mousex) - _G(mouseX1offset) < minX)
+ minX = _G(mousex) - _G(mouseX1offset);
+ if (_G(mousey) - _G(mouseY1offset) < minY)
+ minY = _G(mousey) - _G(mouseY1offset);
+ if (_G(mousex) + _G(mouseX2offset) > maxX)
+ maxX = _G(mousex) + _G(mouseX2offset);
+ if (_G(mousey) + _G(mouseY2offset) > maxY)
+ maxY = _G(mousey) + _G(mouseY2offset);
+
+ gui_mouse_refresh();
+ _G(currMouseNum) = spriteNum;
+
+ return true;
+}
+
+void gui_mouse_refresh() {
+ warning("TODO: gui_mouse_refresh");
+}
} // End of namespace M4
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
index 42a725026c3..1dd48ac3cac 100644
--- a/engines/m4/gui/gui_mouse.h
+++ b/engines/m4/gui/gui_mouse.h
@@ -25,16 +25,19 @@
#include "m4/m4_types.h"
#include "m4/gui/gui_univ.h"
+#include "m4/mem/reloc.h"
namespace M4 {
-struct Mouse_Statics {
+constexpr uint32 kArrowCursor = 0;
+
+struct Mouse_Globals {
ScreenContext *_mouseScreen = nullptr;
transSprite *_mouseScreenSource = nullptr;
Buffer _mouseBuffer; // A scratch buffer used by RedrawMouse()
char *_mouseSeriesResource = nullptr;
- Handle _mouseSeriesHandle = nullptr;
+ MemHandle _mouseSeriesHandle = nullptr;
int32 _mouseSeriesOffset = 0;
int32 _mouseSeriesPalOffset = 0;
M4sprite *_mouseSprite = nullptr; // The specific sprite which is drawn to indicate the current mouse position.
@@ -56,8 +59,8 @@ struct Mouse_Statics {
int32 _showMouseX2 = MAX_VIDEO_X;
int32 _showMouseY2 = MAX_VIDEO_Y;
- int32 _mouseX = MAX_VIDEO_X >> 1; // The current mouse "x" position (global coords).
- int32 _mouseY = MAX_VIDEO_Y >> 1; // The current mouse "y" position (global coords).
+ int32 _mousex = MAX_VIDEO_X >> 1; // The current mouse "x" position (global coords).
+ int32 _mousey = MAX_VIDEO_Y >> 1; // The current mouse "y" position (global coords).
int32 _oldX = MAX_VIDEO_X >> 1; // The previous mouse "x" and "y" position. When the mouse has moved, the
int32 _oldY = MAX_VIDEO_Y >> 1; // position where the mouse sprite was last drawn is here.
@@ -65,6 +68,8 @@ struct Mouse_Statics {
extern bool gui_mouse_init();
extern void gui_mouse_shutdown();
+extern bool mouse_set_sprite(int32 spriteNum);
+extern void gui_mouse_refresh();
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index a15b4f0fa85..a7d3409d852 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -22,21 +22,20 @@
#include "m4/wscript/ws_load.h"
#include "m4/wscript/ws_machine.h"
#include "m4/core/errors.h"
+#include "m4/graphics/graphics.h"
#include "m4/globals.h"
namespace M4 {
bool InitWSAssets(void) {
- int32 i;
+ int32 i;
- //make sure this is only called once.
+ // Make sure this is only called once.
if (_G(wsloaderInitialized)) {
error_show(FL, 'WSSN');
}
- //allocate space for the tables used by the loader and the resource io
-
- //MACHine tables
+ // Allocate space for the tables used by the loader and the resource io MACHine tables
if ((_G(globalMACHnames) = (char **)mem_alloc(sizeof(char *) * 256, "MACH resource table")) == nullptr) {
return false;
}
@@ -185,31 +184,100 @@ bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
}
void ShutdownWSAssets(void) {
- if (!_G(wsloaderInitialized)) return;
+ if (!_G(wsloaderInitialized))
+ return;
- //for each asset type, clear the entire table
+ // For each asset type, clear the entire table
ClearWSAssets(_WS_ASSET_MACH, 0, MAX_ASSET_HASH);
ClearWSAssets(_WS_ASSET_SEQU, 0, MAX_ASSET_HASH);
ClearWSAssets(_WS_ASSET_CELS, 0, MAX_ASSET_HASH);
ClearWSAssets(_WS_ASSET_DATA, 0, MAX_ASSET_HASH);
- //deallocate all tables
- if (_G(globalMACHnames)) mem_free((void *)_G(globalMACHnames));
- if (_G(globalSEQUnames)) mem_free((void *)_G(globalSEQUnames));
- if (_G(globalDATAnames)) mem_free((void *)_G(globalDATAnames));
- if (_G(globalCELSnames)) mem_free((void *)_G(globalCELSnames));
-
- if (_G(globalMACHHandles)) mem_free((void *)_G(globalMACHHandles));
- if (_G(globalMACHoffsets)) mem_free((void *)_G(globalMACHoffsets));
- if (_G(globalSEQUHandles)) mem_free((void *)_G(globalSEQUHandles));
- if (_G(globalSEQUoffsets)) mem_free((void *)_G(globalSEQUoffsets));
- if (_G(globalDATAHandles)) mem_free((void *)_G(globalDATAHandles));
- if (_G(globalDATAoffsets)) mem_free((void *)_G(globalDATAoffsets));
- if (_G(globalCELSHandles)) mem_free((void *)_G(globalCELSHandles));
- if (_G(globalCELSoffsets)) mem_free((void *)_G(globalCELSoffsets));
- if (_G(globalCELSPaloffsets)) mem_free((void *)_G(globalCELSPaloffsets));
+ // Deallocate all tables
+ if (_G(globalMACHnames)) mem_free(_G(globalMACHnames));
+ if (_G(globalSEQUnames)) mem_free(_G(globalSEQUnames));
+ if (_G(globalDATAnames)) mem_free(_G(globalDATAnames));
+ if (_G(globalCELSnames)) mem_free(_G(globalCELSnames));
+
+ if (_G(globalMACHHandles)) mem_free(_G(globalMACHHandles));
+ if (_G(globalMACHoffsets)) mem_free(_G(globalMACHoffsets));
+ if (_G(globalSEQUHandles)) mem_free(_G(globalSEQUHandles));
+ if (_G(globalSEQUoffsets)) mem_free(_G(globalSEQUoffsets));
+ if (_G(globalDATAHandles)) mem_free(_G(globalDATAHandles));
+ if (_G(globalDATAoffsets)) mem_free(_G(globalDATAoffsets));
+ if (_G(globalCELSHandles)) mem_free(_G(globalCELSHandles));
+ if (_G(globalCELSoffsets)) mem_free(_G(globalCELSoffsets));
+ if (_G(globalCELSPaloffsets)) mem_free(_G(globalCELSPaloffsets));
_G(wsloaderInitialized) = false;
}
+M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries) {
+ uint32 *myCelSource, *data, *offsets, numCels;
+ uint32 *celsPtr;
+
+ // Parameter verification
+ if ((!resourceHandle) || (!*resourceHandle)) {
+ ws_LogErrorMsg(FL, "No sprite source in memory.");
+ return NULL;
+ }
+
+ if (!mySprite) {
+ mySprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "Sprite");
+ if (!mySprite) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(M4sprite));
+ return NULL;
+ }
+ }
+
+ // Find the cels source from the asset block
+ HLock(resourceHandle);
+ celsPtr = (uint32 *)((int32)*resourceHandle + handleOffset);
+
+ // Check that the index into the series requested is within a valid range
+ numCels = celsPtr[CELS_COUNT];
+ if (index >= (int)numCels) {
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ return NULL;
+ }
+
+ // Find the offset table, and the beginning of the data for all sprites
+ offsets = &celsPtr[CELS_OFFSETS];
+ data = &celsPtr[CELS_OFFSETS + numCels];
+
+ // Find the sprite data for the specific sprite in the series
+ myCelSource = (uint32 *)((uint32)data + offsets[index]);
+
+ // Set the stream boolean
+ if (streamSeries) {
+ if (myCelSource[CELS_STREAM])
+ *streamSeries = true;
+ else
+ *streamSeries = false;
+ }
+
+ // Initialize the sprite struct and return it
+ mySprite->sourceHandle = resourceHandle;
+ mySprite->xOffset = (int32)myCelSource[CELS_X];
+ mySprite->yOffset = (int32)myCelSource[CELS_Y];
+ mySprite->w = (int32)myCelSource[CELS_W];
+ mySprite->h = (int32)myCelSource[CELS_H];
+ mySprite->encoding = (uint8)myCelSource[CELS_COMP];
+ mySprite->data = (uint8 *)&myCelSource[CELS_DATA];
+
+ if ((mySprite->w > 0) && (mySprite->h > 0)) {
+ mySprite->sourceOffset = (int32)((int32)(mySprite->data) - (int32)*resourceHandle);
+ } else {
+ mySprite->sourceOffset = 0;
+ }
+
+ // This value MUST be set before sprite draws are called after the block has been locked
+ mySprite->data = NULL;
+
+ // Unlock the handle
+ HUnLock(resourceHandle);
+
+ return mySprite;
+}
+
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
index 4c85acbc190..844e48b11d1 100644
--- a/engines/m4/wscript/ws_load.h
+++ b/engines/m4/wscript/ws_load.h
@@ -24,6 +24,9 @@
#define M4_WSCRIPT_WS_LOAD_H
#include "m4/m4_types.h"
+#include "m4/fileio/fstream.h"
+#include "m4/mem/reloc.h"
+#include "m4/wscript/ws_machine.h"
#include "m4/wscript/ws_univ.h"
namespace M4 {
@@ -78,6 +81,34 @@ extern bool InitWSAssets();
extern bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
extern void ShutdownWSAssets();
+extern bool ws_CELSIntegrity(int32 minHash, int32 maxHash);
+extern bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette);
+extern int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette);
+extern uint32 *FindSpriteSource(uint32 *celsPtr, int32 index);
+extern M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries);
+extern CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB);
+extern int32 GetWSAssetCELCount(uint32 hash);
+extern int32 GetWSAssetCELFrameRate(uint32 hash);
+extern int32 GetWSAssetCELPixSpeed(uint32 hash);
+extern int32 ws_get_sprite_width(uint32 hash, int32 index);
+extern int32 ws_get_sprite_height(uint32 hash, int32 index);
+extern Handle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
+extern Handle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
+extern Handle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
+extern int32 ws_GetDATACount(uint32 hash);
+extern int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data, RGB8 *myPalette);
+extern bool ws_GetSSMaxWH(Handle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
+
+// USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
+extern int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
+extern int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
+extern M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
+
+// WOODSCRIPT STREAMING API
+extern bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8);
+extern bool ws_GetNextSSstreamCel(Anim8 *anim8);
+extern void ws_CloseSSstream(CCB *myCCB);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/wscript/wscript.cpp b/engines/m4/wscript/wscript.cpp
index 902b90ac1c1..fb711538546 100644
--- a/engines/m4/wscript/wscript.cpp
+++ b/engines/m4/wscript/wscript.cpp
@@ -24,8 +24,14 @@
namespace M4 {
-void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg) {
- error("%s", msg);
+void ws_LogErrorMsg(const char *filename, uint32 line, const char *fmt, ...) {
+ va_list argPtr;
+ va_start(argPtr, fmt);
+
+ Common::String msg = Common::String::vformat(fmt, argPtr);
+ va_end(argPtr);
+
+ error("%s", msg.c_str());
}
} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
index f3bd3c466e5..fed1ced823e 100644
--- a/engines/m4/wscript/wscript.h
+++ b/engines/m4/wscript/wscript.h
@@ -35,7 +35,7 @@ struct WS_Globals : public WSCruncher_Globals, public WSHal_Globals,
public WSLoad_Globals, public WSMachine_Globals, public WSTimer_Globals {
};
-extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *msg);
+extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *fmt, ...);
} // End of namespace M4
Commit: d2ae1c80ca4e07c8b26f265552b69024cb35b1f6
https://github.com/scummvm/scummvm/commit/d2ae1c80ca4e07c8b26f265552b69024cb35b1f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added inv_init, InvPal, and cstring methods
Changed paths:
A engines/m4/adv_r/adv_inv.cpp
A engines/m4/adv_r/adv_inv.h
A engines/m4/core/cstring.cpp
A engines/m4/core/cstring.h
A engines/m4/graphics/gr_color.cpp
A engines/m4/graphics/gr_color.h
R engines/m4/game.cpp
R engines/m4/game.h
engines/m4/adv_r/adv.h
engines/m4/fileio/sys_file.cpp
engines/m4/fileio/sys_file.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/mem/mem.cpp
engines/m4/mem/mem.h
engines/m4/mem/reloc.cpp
engines/m4/mem/reloc.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 12ddb8d0865..ade987642bb 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -23,6 +23,7 @@
#ifndef M4_ADV_R_ADV_H
#define M4_ADV_R_ADV_H
+#include "common/textconsole.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -32,6 +33,7 @@ namespace M4 {
#define MAXRAILNODES 32
#define PATH_END 0xffff
#define MAX_PLYR_STRING_LEN 40
+#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
#define STR_FADEPAL "fade palette"
#define STR_RAILNODE "rail node"
@@ -48,6 +50,18 @@ enum {
INSTALL_ALL = 0x1f
};
+enum {
+ UNKNOWN_OBJECT = 997,
+ BACKPACK = 998,
+ NOWHERE = 999
+};
+
+enum KernelTriggerType {
+ KT_PARSE = 1,
+ KT_DAEMON, KT_PREPARSE, KT_EXPIRE, KT_LOOP
+};
+
+
struct HotSpotRec {
int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
int32 feet_x = 0, feet_y = 0; // Walk-to target for player
@@ -154,6 +168,32 @@ struct Player {
int32 click_x = 0, click_y = 0;
};
+struct GameControl {
+ uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
+
+ int32 digi_overall_volume_percent;
+ int32 midi_overall_volume_percent;
+ bool camera_pan_instant;
+
+ int16 room_id;
+ int16 new_room;
+ int16 previous_section;
+ int16 section_id;
+ int16 new_section;
+ int16 previous_room;
+};
+
+
+inline void inventory_add(char *name, char *verb, int32 sprite, int32 cursor) {
+ error("TODO: inventory_add");
+}
+inline void inventory_set_scroll(int32 scroll) {
+ error("TODO: inventory_set_scroll");
+}
+inline void inventory_remove(char *name) {
+ error("TODO: inventory_remove");
+}
+
} // namespace M4
#endif
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
new file mode 100644
index 00000000000..9032dc2e639
--- /dev/null
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -0,0 +1,318 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/str.h"
+#include "m4/adv_r/adv_inv.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool inv_init(int32 num_objects) {
+ term_message("Fluffing up the backpack", nullptr);
+ int i;
+
+ _G(inventory).num_objects = num_objects;
+ _G(inventory).objects = (InvObj **)mem_alloc(sizeof(InvObj *) * num_objects, "inventory store");
+ if (!_G(inventory).objects)
+ error_show(FL, 'OOM!', "%ld bytes", (int32)sizeof(InvObj *) * num_objects);
+
+ if (!mem_register_stash_type(&_G(inv_obj_mem_type), sizeof(InvObj), num_objects, "obj"))
+ error_show(FL, 'OOM!', "fail to mem_register_stash_type for inv_obj");
+
+ for (i = 0; i < num_objects; i++) {
+ _G(inventory).objects[i] = (InvObj *)mem_get_from_stash(_G(inv_obj_mem_type), "obj");
+ if (!_G(inventory).objects[i])
+ error_show(FL, 'OOM!', "%ld bytes", (int32)sizeof(InvObj));
+ }
+
+ _G(inventory).tail = 0;
+ return true;
+}
+
+void inv_shutdown(void) {
+ int i;
+
+ for (i = 0; i < _G(inventory).tail; i++) {
+ mem_free_to_stash((void *)_G(inventory).objects[i], _G(inv_obj_mem_type));
+ }
+
+ mem_free((char *)_G(inventory).objects);
+}
+
+bool inv_register_thing(char *name, char *verbs, int32 scene, int32 cel, int32 cursor) {
+ cstrupr(name);
+ cstrupr(verbs);
+
+ _G(inventory).objects[_G(inventory).tail]->name = nullptr;
+ _G(inventory).objects[_G(inventory).tail]->verbs = nullptr;
+
+ if (name)
+ _G(inventory).objects[_G(inventory).tail]->name = mem_strdup(name);
+
+ if (verbs)
+ _G(inventory).objects[_G(inventory).tail]->verbs = mem_strdup(verbs);
+
+ _G(inventory).objects[_G(inventory).tail]->scene = scene;
+ _G(inventory).objects[_G(inventory).tail]->cel = cel;
+ _G(inventory).objects[_G(inventory).tail]->cursor = cursor;
+
+ _G(inventory).tail++;
+
+ if (scene == BACKPACK) {
+ inventory_add(name, verbs, cel, cursor);
+ }
+
+ return true;
+}
+
+//-------------------------------------------------------------------
+
+int32 inv_where_is(char *name) {
+ int i;
+ cstrupr(name);
+
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ return _G(inventory).objects[i]->scene;
+ }
+ }
+ }
+
+ return UNKNOWN_OBJECT;
+}
+
+bool inv_player_has(char *name) {
+ return (inv_where_is(name) == BACKPACK);
+}
+
+bool inv_put_thing_in(char *name, int32 scene) {
+ int i;
+ cstrupr(name);
+
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+
+ // Remove object from backpack?
+ if (_G(inventory).objects[i]->scene == BACKPACK && scene != BACKPACK) {
+ inventory_remove(name);
+ }
+ _G(inventory).objects[i]->scene = scene;
+
+ // Put object in backpack?
+ if (scene == BACKPACK) {
+ inventory_add(name, _G(inventory).objects[i]->verbs, _G(inventory).objects[i]->cel, _G(inventory).objects[i]->cursor);
+ }
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+int32 inv_get_cursor(char *name) {
+ int i;
+ cstrupr(name);
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ return _G(inventory).objects[i]->cursor;
+ }
+ }
+ }
+ return UNKNOWN_OBJECT;
+}
+
+int32 inv_get_cel(char *name) {
+ int i;
+ cstrupr(name);
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ return _G(inventory).objects[i]->cel;
+ }
+ }
+ }
+ return UNKNOWN_OBJECT;
+}
+
+char *inv_get_verbs(char *name) {
+ int i;
+ cstrupr(name);
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ return _G(inventory).objects[i]->verbs;
+ }
+ }
+ }
+ return nullptr;
+}
+
+// this is provided so that when restoring a game from a save file,
+// we store a pointer to the registered name, not to an unmanaged
+// memory pointer.
+
+static char *inv_get_name(char *name) {
+ int i;
+ cstrupr(name);
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (_G(inventory).objects[i]->name) {
+ if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ return _G(inventory).objects[i]->name;
+ }
+ }
+ }
+ return nullptr;
+}
+
+void inv_give_to_player(char *name) {
+ inv_put_thing_in(name, BACKPACK);
+}
+
+void inv_move_object(char *name, int32 scene) {
+ inv_put_thing_in(name, scene);
+}
+
+bool inv_object_is_here(char *name) {
+ return (inv_where_is(name) == _G(game).room_id);
+}
+
+bool inv_object_in_scene(char *name, int32 scene) {
+ return (inv_where_is(name) == scene);
+}
+
+void MoveBP(char *s, int32 from, int32 to) {
+#ifdef TODO
+ Dialog *d = inv_dialog;
+ Item *myItem;
+ char old_loc[MAX_PLYR_STRING_LEN],
+ new_loc[MAX_PLYR_STRING_LEN],
+ curr_loc[MAX_PLYR_STRING_LEN];
+
+ cstrupr(s);
+
+ sprintf(old_loc, "%s %d", s, from);
+ sprintf(new_loc, "%s %d", s, to);
+
+ if ((myItem = Dialog_Get_Item(d, 100)) == nullptr) return; //bp list.
+
+ while (GetPrevListItem(myItem)) {
+ }
+ if ((myItem = Dialog_Get_Item(d, 100)) == nullptr) return; //bp list.
+
+ for (;; ) {
+ sprintf(curr_loc, "%s", Dialog_GetCurrListItemPrompt(d, myItem, 100));
+
+ if (!strcmp(old_loc, curr_loc)) {
+ Dialog_Change_List_Item(d, myItem, 100,
+ Dialog_GetCurrListItem(d, myItem, 100), 0, //listTag == 0?
+ new_loc, 0, LIST_ALPH, true); //true: REFRESH
+
+ break;
+ }
+
+ if (!GetNextListItem(myItem))
+ break;
+ }
+#else
+ error("TODO: MoveBP");
+#endif
+}
+
+void inv_save_game(Common::WriteStream *fp_save) {
+ char *inv_save_buff = nullptr;
+ uint32 inv_size = 0, index = 0;
+ int32 i;
+
+ if (!fp_save)
+ error_show(FL, 'ISGF');
+
+ inv_size = _G(inventory).tail * (40 * sizeof(char) + sizeof(long));
+ fp_save->writeUint32LE(inv_size);
+
+ inv_save_buff = (char *)mem_alloc(inv_size, "inv save buff");
+
+ cstrcpy(inv_save_buff, "\0");
+ for (i = 0; i < _G(inventory).tail; i++) {
+ if (cstrlen(_G(inventory).objects[i]->name) > 39)
+ error_show(FL, 'ISGF', "inventory name '%s' > 39 chars:", _G(inventory).objects[i]->name);
+
+ Common::strcpy_s(&inv_save_buff[index], 256, _G(inventory).objects[i]->name);
+ index += 40;
+
+ memcpy(&inv_save_buff[index], &(_G(inventory).objects[i]->scene), sizeof(int32));
+ index += sizeof(long);
+ }
+
+ if (fp_save->write(inv_save_buff, inv_size) != inv_size)
+ error_show(FL, 'ISGF', "Could not write save game size.");
+
+ if (inv_save_buff)
+ mem_free(inv_save_buff);
+}
+
+void inv_restore_game(Common::SeekableReadStream *fp_restore) {
+ char *inv_restore_buff = nullptr;
+ long inv_size = 0, index = 0;
+ char *name;
+ int32 scene;
+
+ if (!fp_restore)
+ error_show(FL, 'IRGF', "fp_save is nullptr");
+
+ inv_size = fp_restore->readUint32LE();
+
+ inv_restore_buff = (char *)mem_alloc(inv_size, "inv restore buff");
+ if (!inv_restore_buff)
+ error_show(FL, 'IRGF', "Couldn't alloc game restore buffer");
+
+ if (fp_restore->read(inv_restore_buff, inv_size) != inv_size)
+ error_show(FL, 'IRGF', "Couldn't read restored _G(game).");
+
+ while (index < inv_size) {
+ name = inv_get_name(&inv_restore_buff[index]);
+ if (!name) {
+ term_message("inv_restore unknown object: %s", &inv_restore_buff[index]);
+ index += 40;
+ } else {
+ index += 40;
+ memcpy(&scene, &inv_restore_buff[index], sizeof(int32));
+ index += sizeof(long); //jul21
+ if (!inv_put_thing_in(name, scene)) {
+ error_show(FL, 'IPTI', "could not put '%s' in %d", name, scene);
+ }
+ }
+ }
+
+ if (inv_restore_buff)
+ mem_free(inv_restore_buff);
+
+ inventory_set_scroll(0); // MattP
+ //myInventory->set_scroll(0); in above function
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
new file mode 100644
index 00000000000..28569c447f9
--- /dev/null
+++ b/engines/m4/adv_r/adv_inv.h
@@ -0,0 +1,86 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_INV_H
+#define M4_ADV_R_ADV_INV_H
+
+#include "common/stream.h"
+
+namespace M4 {
+
+struct InvObj {
+ char *name = nullptr;
+ char *verbs = nullptr;
+ int32 scene = 0, cel = 0, cursor = 0;
+};
+
+struct InventoryRec {
+ InvObj **objects = nullptr;
+ int32 num_objects = 0;
+ int32 tail = 0;
+};
+
+/**
+ * Init the system, preferably in game_systems_initialize
+ */
+extern bool inv_init(int32 num_objects);
+
+/**
+ * Shutdown the system
+ */
+extern void inv_shutdown();
+
+/**
+ * Register things during init of the game
+ * @param name Name of the object as it should appear as a sentence is built
+ * @param verbs Verbs should have this format: verbs = "slit,peel,fricasee,examine"
+ * There can be any number of verbs in the string.
+ * @param scene The place for the thing to appear initially (BACKPACK is one place)
+ * @param cel Index into the inventory sprite series for use when displaying inventory
+ * @param cursor Cel index into the cursor sprite series when the player is "holding" a thing
+ */
+extern bool inv_register_thing(char *name, char *verbs, int32 scene, int32 cel, int32 cursor);
+
+extern int32 inv_where_is(const char *name);
+extern bool inv_player_has(const char *name);
+extern bool inv_put_thing_in(const char *name, int32 scene);
+extern int32 inv_get_cursor(const char *name);
+extern int32 inv_get_cel(const char *name);
+extern char *inv_get_verbs(const char *name);
+extern void inv_give_to_player(const char *name);
+extern void inv_move_object(const char *name, int32 scene);
+extern bool inv_object_is_here(const char *name);
+extern bool inv_object_in_scene(const char *name, int32 scene);
+
+// private
+
+extern void MoveBP(const char *s, int32 from, int32 to);
+extern void InsertBP(const char *s, int32 where);
+
+// private
+
+extern void inv_save_game(Common::WriteStream *fp_save);
+extern void inv_restore_game(Common::SeekableReadStream *fp_restore);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/core/cstring.cpp b/engines/m4/core/cstring.cpp
new file mode 100644
index 00000000000..6067c505855
--- /dev/null
+++ b/engines/m4/core/cstring.cpp
@@ -0,0 +1,410 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/str.h"
+#include "common/util.h"
+#include "m4/core/cstring.h"
+
+namespace M4 {
+
+bool cstr_isdigit(char c) {
+ return (c >= '0' && c <= '9');
+}
+
+bool charIsIn(char ch, char *str) {
+ if (!str)
+ return false;
+ int16 bail = 0;
+ char *mark = str;
+ while (*mark) {
+ if (*mark == ch)
+ return true;
+ ++mark;
+ ++bail;
+ if (bail > 256)
+ return false;
+ }
+ return false;
+}
+
+int32 cstrlen(const char *s) {
+ if (!s)
+ return 0;
+
+ int32 size = -1;
+ const char *str = s;
+ do {
+ ++size;
+ } while (*str++);
+ return size;
+}
+
+void cstrcpy(char *dest, const char *src) {
+ if (!src || !dest)
+ return;
+
+ do {
+ *dest++ = *src;
+ } while (*src++);
+}
+
+void cstrncpy(char *dest, const char *src, const int16 max_len) {
+ if (!src || !dest)
+ return;
+
+ int16 count = 0;
+ do {
+ *dest++ = *src;
+ ++count;
+ } while (*src++ && (count < max_len));
+}
+
+char *cstrupr(char *src) {
+ if (!src)
+ return 0;
+
+ char *mark = src;
+ do {
+ if (*mark >= 'a' && *mark <= 'z')
+ *mark = (char)(*mark - 'a' + 'A');
+ } while (*mark++);
+
+ return src;
+}
+
+char *cstr_lower(char *src) {
+ if (!src)
+ return 0;
+
+ char *mark = src;
+ do {
+ if (*mark >= 'A' && *mark <= 'Z')
+ *mark = (char)(*mark - 'A' + 'a');
+ } while (*mark++);
+
+ return src;
+}
+
+int xtoi(char *string) {
+ if (!string)
+ return 0;
+
+ int value = 0;
+ int item;
+
+ while (*string) {
+ item = *string++;
+ if (cstr_isdigit(item))
+ value = (value << 4) + item - '0';
+ else
+ if (Common::isDigit(item))
+ value = (value << 4) + toupper(item) - 'A' + 0xa;
+ else
+ while (*string)
+ string++; // if not hexadecimal, eat string.
+ }
+ return (value);
+}
+
+
+/* Returns position within TARGET of string KEY (1-length) */
+
+int strpos(char *key, char *target) {
+ if (!key || !target)
+ return 0;
+
+ char *tmp;
+
+ tmp = strstr(target, key);
+
+ if (tmp)
+ return(tmp - target + 1);
+
+ return 0;
+}
+
+
+/* Deletes AMOUNT characters from string INP starting at position indx */
+
+void strdel(char *inp, int indx, int count) {
+ if (!inp)
+ return;
+
+ if (indx >= (int)strlen(inp) || !count)
+ return;
+
+ strncpy(&inp[indx], &inp[indx + count], count);
+}
+
+
+// Given a string, index and count, returns a substring of length count
+
+void strseg(char *work, char *work2, int indx, int count) {
+ if (!work || !work2)
+ return;
+
+ char *s = NULL; //may26 MJE
+
+ s = &work2[indx];
+ strncpy(work, s, count); //may26 MJE
+}
+
+
+/*
+ Inserts string NEW into string WORK at character INDEX.
+ INDEX is 1->strlen, not 0->strlen-1
+*/
+void strins(char *work, char *newStr, int indx) {
+ if (!work || !newStr) {
+ newStr = 0;
+ return;
+ }
+
+ int l, l1;
+
+ l1 = (strlen(work) - indx + 2);
+ l = strlen(newStr);
+ memmove(work + indx + l - 1, work + indx - 1, l1);
+ memcpy(work + indx - 1, newStr, l);
+}
+
+
+void str_purge_trailing_spaces(char *myline) {
+ if (!myline)
+ return;
+
+ char *search;
+ int again = true;
+
+ do {
+ search = &myline[strlen(myline) - 1];
+ if ((*search == 0x20) || (*search == 0x09))
+ *search = 0;
+ else
+ again = false;
+
+ search--;
+ if (search < myline) again = false;
+ } while (again);
+}
+
+
+void str_purge_all_spaces(char *text) {
+ if (!text)
+ return;
+
+ char work[256];
+ char *mark;
+
+ str_purge_trailing_spaces(text);
+
+ mark = text;
+ while (*mark && ((*mark == ' ') || (*mark == 0x09))) mark++;
+
+ Common::strcpy_s(work, 256, mark);
+ Common::strcpy_s(text, 256, work);
+}
+
+
+char *str_strip_final_lf(char *mystring) {
+ if (!mystring)
+ return 0;
+
+ char *temp;
+
+ temp = strrchr(mystring, 0x0a);
+ if (temp != NULL) {
+ *temp = '\0';
+ }
+ return (temp);
+}
+
+void str_add_final_lf(char *mystring) {
+ if (!mystring)
+ return;
+
+ char *temp;
+
+ temp = mystring + strlen(mystring);
+ *(temp++) = 0x0a;
+ *temp = '\0';
+}
+
+#ifdef TODO
+char str_parse_buffer[STR_PARSE_BUFFER_SIZE + 1];
+char str_parse_delimiter;
+bool str_parse_done = YES;
+
+void str_parse_init(char *instring, char delimiter) {
+ if (!instring)
+ return;
+
+ int len;
+
+ len = strlen(instring); /* Eval once since C's STRLEN is way slow */
+
+ Common::strcpy_s(str_parse_buffer, instring);
+ str_parse_delimiter = delimiter;
+ str_parse_done = NO;
+}
+
+char *str_parse(char *out) {
+ if (!out)
+ return NULL;
+
+ char *test;
+ char tmp[STR_PARSE_BUFFER_SIZE + 1];
+
+ Common::strcpy_s(tmp, str_parse_buffer);
+ test = tmp;
+ while (test[0] != 0 && test[0] != str_parse_delimiter)
+ test++;
+
+ if (test[0] == 0) { /* Last segment in original string */
+ Common::strcpy_s(out, str_parse_buffer);
+ str_parse_done = YES;
+ return(out);
+ }
+
+ /* Otherwise, there must be more left in the buffer */
+ test[0] = 0; /* Force an end-of-string in our temp area */
+ Common::strcpy_s(out, tmp); /* Copy the good part to the output string */
+ Common::strcpy_s(str_parse_buffer, test + 1); /* Copy back the remainder */
+ return(out);
+}
+
+#endif
+
+//new!
+int16 char_IsIn(char ch, char *str) {
+ if (!str)
+ return -1;
+
+ int16 index = 0;
+ char *mark = str;
+
+ while (*mark) {
+ if (*mark == ch)
+ return index;
+ ++index;
+ ++mark;
+ if (index > 256)
+ return -1;
+ }
+ return -1;
+}
+
+
+// stringIsIn returns the index of the match string, or -1 if there wasn't one.
+
+int16 stringIsIn(char *str, char *strings[]) {
+ if (!str || !strings)
+ return -1;
+
+ int16 index = 0;
+ while (*strings != NULL) {
+ if (!strcmp(str, *strings))
+ return index;
+ ++index;
+ ++strings;
+ }
+ return -1;
+}
+
+// dtoi
+// Converts decimal string to integer
+
+int dtoi(char *string) {
+ if (!string)
+ return 0;
+
+ int value = 0;
+ int item;
+
+ while (*string) {
+ item = *string++;
+ if (cstr_isdigit(item))
+ value = (value * 10) + item - '0';
+ else
+ while (*string)
+ string++; // if not a digit, eat string.
+ }
+ return (value);
+}
+
+
+// returns true if str is a positive integer, false otherwise
+
+bool stringIsInt(char *str) {
+ if (!str)
+ return false;
+
+ int16 bail = 0;
+
+ while (*str) {
+ if (!cstr_isdigit(*str))
+ return false;
+ ++str;
+ ++bail;
+ if (bail > 256)
+ return false;
+ }
+ return true;
+}
+
+bool stringIsFloat(char *str) {
+ if (!str)
+ return false;
+
+ int16 bail = 0;
+ bool decimal_seen = false;
+
+ /*
+ while (*str) {
+ if (!cstr_isdigit(*str))
+ return false;
+ ++str;
+ ++bail;
+ if (bail>256)
+ return false;
+ }
+ return true;
+ */
+
+ while (*str) {
+ if (*str == '.') {
+ if (!decimal_seen)
+ decimal_seen = true;
+ else return false;
+ } else {
+ if (!cstr_isdigit(*str))
+ return false;
+ }
+
+ ++str;
+ ++bail;
+ if (bail > 256)
+ return false;
+ }
+ return true;
+}
+
+} // namespace M4
diff --git a/engines/m4/core/cstring.h b/engines/m4/core/cstring.h
new file mode 100644
index 00000000000..bdee103fdf7
--- /dev/null
+++ b/engines/m4/core/cstring.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_CORE_CSTRING_H
+#define M4_CORE_CSTRING_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define STR_PARSE_BUFFER_SIZE 255
+
+extern bool charIsIn(char ch, char *str);
+extern int16 char_IsIn(char ch, char *str); //new
+extern int dtoi(char *string);
+extern bool stringIsInt(char *str);
+extern bool stringIsFloat(char *str);
+
+extern int16 stringIsIn(char *str, char *strings[]);
+
+extern int32 cstrlen(const char *s);
+extern void cstrcpy(char *dest, const char *src);
+extern void cstrncpy(char *dest, const char *src, const int16 max_len);
+extern char *cstrupr(char *src);
+extern char *cstr_lower(char *src);
+extern int xtoi(char *string);
+extern int strpos(char *key, char *target);
+extern void strdel(char *inp, int indx, int count);
+extern void strseg(char *work, char *work2, int indx, int count);
+extern void strins(char *work, char *newStr, int indx);
+extern void str_purge_trailing_spaces(char *myline);
+extern void str_purge_all_spaces(char *text);
+extern char *str_strip_final_lf(char *mystring);
+extern void str_add_final_lf(char *mystring);
+extern void str_parse_init(char *instring, char delimiter);
+extern char *str_parse(char *out);
+
+extern bool cstr_isdigit(char c);
+
+#define strrun(a,b,c) memset(a,b,c)
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index bea9342abdd..78db7797f15 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -608,6 +608,12 @@ Common::SeekableReadStream *SysFile::rs() const {
return rs;
}
+void SysFile::close() {
+ delete _fp;
+ _fp = nullptr;
+}
+
+
void sysfile_init(bool in_hag_mode) {
_G(hag).hag_flag = in_hag_mode;
diff --git a/engines/m4/fileio/sys_file.h b/engines/m4/fileio/sys_file.h
index c06f86148ad..83d1ba5da8b 100644
--- a/engines/m4/fileio/sys_file.h
+++ b/engines/m4/fileio/sys_file.h
@@ -117,6 +117,11 @@ public:
*/
uint32 read(MemHandle bufferHandle);
int32 read(MemHandle bufferHandle, int32 n);
+
+ /**
+ * Close the file
+ */
+ void close();
};
extern void sysfile_init(bool in_hag_mode);
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 118da119246..f0f8b74624f 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -43,6 +43,8 @@ Globals::Globals() {
}
Globals::~Globals() {
+ game_systems_shutdown();
+
sysfile_shutdown();
player_been_shutdown();
gui_system_shutdown();
@@ -109,6 +111,18 @@ void Globals::game_systems_initialize(byte flags) {
error_show(FL, 'FSIF');
mouse_set_sprite(kArrowCursor);
+
+ if (flags & INSTALL_INVENTORY_SYSTEM)
+ inv_init(128); // Initialize with 128 objects
+
+ if (flags & INSTALL_INVERSE_PALETTE)
+ _inverse_pal = new InvPal(""); // Ceate an empty color table.
+ else
+ _inverse_pal = nullptr;
+}
+
+void Globals::game_systems_shutdown() {
+ // TODO
}
void Globals::fire_up_gui() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 1e0a4f8de2e..dd76246b666 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -22,14 +22,15 @@
#ifndef M4_GLOBALS_H
#define M4_GLOBALS_H
-#include "m4/game.h"
#include "m4/kernel.h"
#include "m4/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
+#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_rails.h"
#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
+#include "m4/graphics/gr_color.h"
#include "m4/graphics/gr_font.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
@@ -49,6 +50,7 @@ extern Globals *g_globals;
class Globals : public Mouse_Globals, public WS_Globals, public Timer_Globals {
private:
void game_systems_initialize(byte flags);
+ void game_systems_shutdown();
void fire_up_gui();
bool woodscript_init();
void woodscript_shutdown();
@@ -58,7 +60,7 @@ public:
~Globals();
bool init();
- Game _game;
+ GameControl _game;
Kernel _kernel;
Term _term;
Hag_Statics _hag;
@@ -107,8 +109,11 @@ public:
Item *_doubleClickItem = nullptr;
char _listboxSearchStr[80] = { 0 };
RGB8 _master_palette[256];
- strmRequest *_firstStream;
- strmRequest *_lastStream;
+ strmRequest *_firstStream = nullptr;
+ strmRequest *_lastStream = nullptr;
+ InvPal *_inverse_pal = nullptr;
+ InventoryRec _inventory;
+ int32 _inv_obj_mem_type = 0;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/game.cpp b/engines/m4/graphics/gr_color.cpp
similarity index 55%
rename from engines/m4/game.cpp
rename to engines/m4/graphics/gr_color.cpp
index 0231092c6ae..404e311c183 100644
--- a/engines/m4/game.cpp
+++ b/engines/m4/graphics/gr_color.cpp
@@ -19,8 +19,51 @@
*
*/
-#include "m4/game.h"
+#include "m4/graphics/gr_color.h"
+#include "m4/core/errors.h"
+#include "m4/fileio/sys_file.h"
+#include "m4/mem/reloc.h"
namespace M4 {
+InvPal::InvPal(const char *filename) {
+ handle = NULL;
+ SysFile ipl5(filename, BINARY);
+
+ if (!ipl5.exists())
+ return;
+
+ handle = NewHandle(32768, "5 bit ict");
+
+ if (!handle) {
+ MakeMem(32768, "5 bit ict");
+ handle = NewHandle(32768, "5 bit ict");
+ if (!handle) {
+ ipl5.close();
+ error_show(FL, 'OOM!', "5 bit ict");
+ return;
+ }
+ }
+
+ ipl5.read(handle, 32768);
+}
+
+InvPal::~InvPal() {
+ if (handle)
+ DisposeHandle(handle);
+}
+
+uint8 *InvPal::get_ptr() {
+ if (!handle)
+ return NULL;
+
+ HLock(handle);
+ return (uint8 *)*handle;
+}
+
+void InvPal::release() {
+ if (handle)
+ HUnLock(handle);
+}
+
} // namespace M4
diff --git a/engines/m4/game.h b/engines/m4/graphics/gr_color.h
similarity index 78%
rename from engines/m4/game.h
rename to engines/m4/graphics/gr_color.h
index 0e9d4a62329..d6c3de187f4 100644
--- a/engines/m4/game.h
+++ b/engines/m4/graphics/gr_color.h
@@ -19,16 +19,24 @@
*
*/
-#ifndef M4_GAME_H
-#define M4_GAME_H
+#ifndef M4_GRAPHICS_GR_COLOR_H
+#define M4_GRAPHICS_GR_COLOR_H
-#include "common/scummsys.h"
+#include "m4/m4_types.h"
+#include "m4/mem/reloc.h"
namespace M4 {
-struct Game {
- int16 new_room;
- int16 new_section;
+class InvPal {
+private:
+ MemHandle handle;
+
+public:
+ InvPal(const char *filename);
+ virtual ~InvPal();
+
+ uint8 *get_ptr();
+ void release();
};
} // namespace M4
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 1c8cc596bd1..0b38c315ee9 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -32,7 +32,7 @@ void mem_stash_init(int16 num_types) {
error_show(FL, 'MSIF', "num_types (%d) _MEMTYPE_LIMIT (%d)", num_types, _MEMTYPE_LIMIT);
for (int i = 0; i < _MEMTYPE_LIMIT; i++) {
- _G(memBlock)[i] = NULL;
+ _G(memBlock)[i] = nullptr;
_G(sizeMem)[i] = 0;
_G(requests)[i] = 0;
}
@@ -42,7 +42,7 @@ void mem_stash_shutdown(void) {
for (int i = 0; i < _MEMTYPE_LIMIT; i++) {
if (_G(memBlock)[i]) {
mem_free(_G(memBlock)[i]);
- _G(memBlock)[i] = NULL;
+ _G(memBlock)[i] = nullptr;
}
}
}
@@ -86,15 +86,12 @@ void mem_free_to_stash(void *mem, int32 memType) {
int32 index = ((long)mem - (long)_G(memBlock)[memType]) / (_G(sizeMem)[memType] + 1);
if (index < 0 || index > _G(requests)[memType])
- error_show(FL, 'MSGF', NULL);
+ error_show(FL, 'MSGF', nullptr);
b_ptr += index * (_G(sizeMem)[memType] + 1);
*b_ptr = 0;
}
-/**
- * Deliver a memory block whose size has been previously registered.
- */
void *mem_get_from_stash(int32 memType, const Common::String &name) {
int i;
int8 *b_ptr = (int8 *)_G(memBlock)[memType];
@@ -112,4 +109,22 @@ void *mem_get_from_stash(int32 memType, const Common::String &name) {
return 0;
}
+char *mem_strdup(const char *str) {
+ char *new_str = nullptr;
+ //jul4
+ if (!str) {
+ new_str = (char *)mem_alloc(1, "string");
+ new_str[0] = '\0';
+ return new_str;
+ }
+
+ new_str = (char *)mem_alloc(strlen(str) + 1, "string");
+ if (!new_str)
+ return nullptr;
+
+ Common::strcpy_s(new_str, 256, str);
+ return new_str;
+}
+
+
} // namespace M4
diff --git a/engines/m4/mem/mem.h b/engines/m4/mem/mem.h
index 7e3d9c58aca..0c98cc76c04 100644
--- a/engines/m4/mem/mem.h
+++ b/engines/m4/mem/mem.h
@@ -44,8 +44,13 @@ extern bool mem_register_stash_type(int32 *memType, int32 size, int32 numRequest
*/
extern void mem_free_to_stash(void *myMem, int32 memType);
+/**
+ * Deliver a memory block whose size has been previously registered.
+ */
extern void *mem_get_from_stash(int32 memType, const Common::String &name);
+extern char *mem_strdup(const char *str);
+
} // namespace M4
#endif
diff --git a/engines/m4/mem/reloc.cpp b/engines/m4/mem/reloc.cpp
index 8655eda9a47..75d0adcfce0 100644
--- a/engines/m4/mem/reloc.cpp
+++ b/engines/m4/mem/reloc.cpp
@@ -46,4 +46,9 @@ MemHandle MakeNewHandle(size_t size, const Common::String &name) {
return NewHandle(size, name);
}
+void DisposeHandle(MemHandle handle) {
+ free(*handle);
+ free(handle);
+}
+
} // namespace M4
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
index 885e3b48c99..ce2dea6a7ce 100644
--- a/engines/m4/mem/reloc.h
+++ b/engines/m4/mem/reloc.h
@@ -40,6 +40,8 @@ inline bool MakeMem(size_t FreeBlockNeeded, const char *) {
extern MemHandle MakeNewHandle(size_t size, const Common::String &);
extern bool mem_ReallocateHandle(MemHandle h, size_t size, const Common::String &name);
+extern MemHandle NewHandle(size_t size, const Common::String &);
+extern void DisposeHandle(MemHandle handle);
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 2e3c61a62a2..3b284c745cb 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -3,7 +3,6 @@ MODULE := engines/m4
MODULE_OBJS = \
m4.o \
console.o \
- game.o \
globals.o \
kernel.o \
metaengine.o \
@@ -11,9 +10,11 @@ MODULE_OBJS = \
res.o \
term.o \
adv_r/adv_been.o \
+ adv_r/adv_inv.o \
adv_r/adv_rails.o \
adv_r/db_env.o \
adv_r/db_rmlst.o \
+ core/cstring.o \
core/errors.o \
core/imath.o \
core/mouse.o \
@@ -23,6 +24,7 @@ MODULE_OBJS = \
fileio/info.o \
fileio/sys_file.o \
graphics/gr_buff.o \
+ graphics/gr_color.o \
graphics/gr_font.o \
graphics/gr_pal.o \
graphics/graphics.o \
Commit: f4c6eb94162e6f01c20b1bad43d74d8fdd1aa634
https://github.com/scummvm/scummvm/commit/f4c6eb94162e6f01c20b1bad43d74d8fdd1aa634
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding catalog methods
Changed paths:
A engines/m4/adv_db_r/database.h
A engines/m4/adv_db_r/db_catalog.cpp
A engines/m4/adv_db_r/db_catalog.h
R engines/m4/adv_r/db_rmlst.cpp
R engines/m4/adv_r/db_rmlst.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/db_env.cpp
engines/m4/core/imath.h
engines/m4/globals.h
engines/m4/m4_types.h
engines/m4/module.mk
diff --git a/engines/m4/adv_db_r/database.h b/engines/m4/adv_db_r/database.h
new file mode 100644
index 00000000000..b913e4f4d0b
--- /dev/null
+++ b/engines/m4/adv_db_r/database.h
@@ -0,0 +1,137 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_DB_R_DATABASE_H
+#define M4_ADV_DB_R_DATABASE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define STR_DB_TREE "db tree node"
+#define STR_DB_TOKEN "db token"
+#define STR_DB_STRING "db string"
+#define STR_GENERICLIST "GenericList"
+
+#define NOTHING 0
+#define INTEGER 1
+#define FLOAT 2
+#define DELIMITER 3
+#define IDENTIFIER 4
+#define STRING 5
+#define COMMENT 6
+#define OPERATOR 7
+#define MATH 8
+#define BITWISE 9
+#define LOGICAL 10
+#define DUMMY 11
+
+#define OPENB 400
+#define CLOSEB 401
+#define O_BRACE 408
+#define C_BRACE 409
+#define COMMA 414
+#define COLON 479
+
+#define _T_SCENEFILE 101
+#define _T_VERSION 102
+#define _T_SCENE 103
+#define _T_ARTBASE 104
+#define _T_HOTSPOTS 105
+#define _T_VERB 107
+#define _T_SYNTAX 108
+#define _T_FACING 109
+#define _T_FEETX 110
+#define _T_FEETY 111
+#define _T_CURSOR 112
+#define _T_FRONTSCALE 113
+#define _T_BACKSCALE 114
+#define _T_FRONTY 115
+#define _T_BACKY 116
+#define _T_RAILS 117
+#define _T_DEPTHS 118
+#define _T_PREP 123
+#define _T_PARALLAX 124
+#define _T_SPRITE 125
+#define _T_PROPS 126
+
+#define PR_ERR_PARSE -1
+#define _T_NAME 146
+#define _T_ARTIST 103
+#define _T_ITEM 107
+#define _T_TITLE 108
+#define _T_NEXTASSET 109
+#define _T_BACKGROUNDS 110
+#define _T_SPRITES 111
+#define _T_CONVERSATIONS 112
+#define _T_ANIMATIONS 144
+#define _T_SOUNDS 113
+#define _T_MUSICSCORES 114
+#define _T_CODE 115
+#define _T_ROOM 116
+#define _T_ASSET 118
+#define _T_OPENBRACE 119
+#define _T_CLOSEBRACE 120
+#define _T_OPENBRACKET 121
+#define _T_CLOSE_BRACKET 122
+#define _T_ROOMPATH 123
+#define _T_STARTTIME 124
+#define _T_LASTMODIFIED 125
+#define _T_APPROVEDTIME 126
+#define _T_COMMENTS 127
+#define _T_PRIORITY 128
+#define _T_STATUS 129
+#define _T_SECRETTAG 130
+#define _T_PATH 131
+#define _T_WALK 141
+#define _T_DEPTH 142
+#define _T_SPECIAL 143
+#define _T_VOLUME 145
+#define _T_TASK_APPROVALS 132
+#define _T_DEPTHCODES 133
+#define _T_WALKCODES 134
+#define _T_SPECIALCODES 135
+
+
+#define name_size 20
+#define num_reserved_words 10
+#define string_size 1024
+
+struct tree {
+ int n;
+ int index;
+ int seen;
+ int line_num;
+ char *label;
+ token *data;
+ tree *left, *right;
+ tree *parent;
+};
+
+struct treeclass {
+ tree *t;
+ tree *r;
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
new file mode 100644
index 00000000000..6e34ec61cf3
--- /dev/null
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -0,0 +1,175 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/str.h"
+#include "m4/adv_db_r/db_catalog.h"
+#include "m4/adv_db_r/database.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+//#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static char *catalog_search(char *name);
+static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name, char *path, short *c_size);
+static int compare_catalog_entries_for_search(const void *n1, const void *n2);
+
+char *db_rmlst_get_asset_room_path(char *asset_name, char *result, int32 *sceneCode) {
+ char name[MAX_FILENAME_SIZE], path[MAX_FILENAME_SIZE];
+ short tag = 0, room = 0;
+ short c_size = 0;
+ long str_len;
+
+ result[0] = '\0';
+
+ char *search_result = catalog_search(asset_name);
+
+ //apr10
+ if (search_result != NULL) {
+ db_get_catalog_entry(search_result, &tag, &room, name, path, &c_size);
+ *sceneCode = room;
+ }
+
+ if (!scumm_strnicmp(asset_name, name, MAX_FILENAME_SIZE)) {
+ if (path[0] == '\\')
+ cstrncpy(result, &path[1], MAX_FILENAME_SIZE);
+ else
+ cstrncpy(result, path, MAX_FILENAME_SIZE);
+
+ str_len = strlen(result);
+
+ if (str_len) {
+ if (result[str_len - 1] == '\\')
+ result[str_len - 1] = '\0';
+ }
+ }
+
+ return result;
+}
+
+static char *catalog_search(char *name) {
+ char myString[80];
+ cstrcpy(myString, name);
+ cstrupr(myString);
+
+ char **result = (char **)bsearch((void *)myString, (void *)_G(catalog)._catalog, _G(catalog)._size, sizeof(char *), compare_catalog_entries_for_search);
+ if (!result)
+ return NULL;
+
+ return *result;
+}
+
+static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name, char *path, short *c_size) {
+ int i;
+ char s[MAX_FILENAME_SIZE];
+
+ if (tag)
+ *tag = 0;
+ if (room)
+ *room = 0;
+ if (name)
+ *name = '\0';
+ if (path)
+ *path = '\0';
+ if (c_size)
+ *c_size = 0;
+
+ short size = convert_intel16(*(short *)&c[0]);
+
+ if (!size)
+ return NULL;
+
+ if (c_size)
+ *c_size = size;
+
+ int32 x = sizeof(short);
+
+ int16 theTag = convert_intel16(*(short *)&c[x]);
+ if (tag)
+ *tag = theTag;
+
+ x += sizeof(short); //tag
+
+ if ((theTag == _T_ROOM) && room) {
+ *room = convert_intel16(*(short *)&c[x]);
+ x += sizeof(short);
+ }
+
+ for (i = 0; c[x]; x++) {
+ s[i++] = c[x];
+
+ if (i == MAX_FILENAME_SIZE)
+ error_show(FL, 'OOM!');
+ }
+ s[i] = '\0';
+
+ if (name)
+ snprintf(name, MAX_FILENAME_SIZE, "%s", s);
+
+ //feb5
+ //skip over trailing '\0' or NULL string.
+ //for( i=0; i<2; i++ ) {
+ // if( c[x] )
+ // break;
+ // x++;
+ //}
+ for (;; ) {
+ if (c[x])
+ break;
+ x++;
+ }
+
+ switch (theTag) {
+ case _T_DEPTH:
+ case _T_SPECIAL:
+ case _T_WALK:
+ break;
+
+ default:
+ for (i = 0; c[x]; x++) {
+ s[i++] = c[x];
+ }
+ s[i] = '\0';
+ if (path)
+ snprintf(path, MAX_FILENAME_SIZE, "%s", s);
+ break;
+ }
+
+ if ((theTag != _T_ROOM) && room)
+ *room = convert_intel16(*(short *)&c[size - (sizeof(short))]);
+
+ return &c[size];
+}
+
+static int compare_catalog_entries_for_search(const void *n1, const void *n2) {
+ char *cat_entry = *(char **)n2;
+
+ if (convert_intel16(*(short *)&cat_entry[2]) == _T_ROOM)
+ cat_entry = &cat_entry[6];
+ else
+ cat_entry = &cat_entry[4];
+
+ return (scumm_strnicmp((char *)n1, cat_entry, 80));
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/db_rmlst.h b/engines/m4/adv_db_r/db_catalog.h
similarity index 64%
rename from engines/m4/adv_r/db_rmlst.h
rename to engines/m4/adv_db_r/db_catalog.h
index b6b1f9e7bb9..bd1eca36fd1 100644
--- a/engines/m4/adv_r/db_rmlst.h
+++ b/engines/m4/adv_db_r/db_catalog.h
@@ -20,16 +20,29 @@
*
*/
-#ifndef M4_ADV_R_DB_RMLST_H
-#define M4_ADV_R_DB_RMLST_H
+#ifndef M4_ADV_DB_R_DB_CATALOG_H
+#define M4_ADV_DB_R_DB_CATALOG_H
-#include "common/scummsys.h"
+#include "m4/m4_types.h"
namespace M4 {
-int32 db_rmlst_get_volume(char *filename); //is public xi add
-void db_rmlst_delete_global_RoomList(void); //is public
-char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode); //is public
+typedef char *StrngPtr;
+
+struct Catalog {
+ char *_data = nullptr;
+ char **_catalog = nullptr;
+ int32 _size = 0;
+};
+
+extern void db_rmlst_delete_global_RoomList();
+
+/**
+ * Given an asset name, name, return "path" from the database in result.
+ * if path starts or ends with a '\', the '\' characters at those places
+ * are deleted.
+ */
+extern char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode);
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 9032dc2e639..dbb29756786 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -277,7 +277,7 @@ void inv_save_game(Common::WriteStream *fp_save) {
void inv_restore_game(Common::SeekableReadStream *fp_restore) {
char *inv_restore_buff = nullptr;
- long inv_size = 0, index = 0;
+ uint32 inv_size = 0, index = 0;
char *name;
int32 scene;
diff --git a/engines/m4/adv_r/db_env.cpp b/engines/m4/adv_r/db_env.cpp
index 4f81d4efac8..d9e9e35de93 100644
--- a/engines/m4/adv_r/db_env.cpp
+++ b/engines/m4/adv_r/db_env.cpp
@@ -21,8 +21,8 @@
#include "common/str.h"
#include "common/textconsole.h"
+#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/db_env.h"
-#include "m4/adv_r/db_rmlst.h"
namespace M4 {
diff --git a/engines/m4/adv_r/db_rmlst.cpp b/engines/m4/adv_r/db_rmlst.cpp
deleted file mode 100644
index dc9c738a7b6..00000000000
--- a/engines/m4/adv_r/db_rmlst.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/>.
- *
- */
-
-#include "common/textconsole.h"
-#include "m4/adv_r/db_rmlst.h"
-
-namespace M4 {
-
-int32 db_rmlst_get_volume(char *filename) {
- error("TODO: db_rmlst_get_volume");
-}
-
-void db_rmlst_delete_global_RoomList() {
- error("TODO: db_rmlst_delete_global_RoomList");
-}
-
-char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode) {
- error("TODO: db_rmlst_get_asset_room_path");
-}
-
-} // End of namespace M4
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
index 6d5383ea423..a44bf4de397 100644
--- a/engines/m4/core/imath.h
+++ b/engines/m4/core/imath.h
@@ -22,6 +22,7 @@
#ifndef M4_CORE_IMATH_H
#define M4_CORE_IMATH_H
+#include "common/endian.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -62,14 +63,18 @@ uint16 convert_intel16(uint16 a);
// I N L I N E S
//
-inline static short abs(short a) {
+inline short abs(short a) {
return (a >= 0) ? a : -a;
}
-inline static long abs(long a) {
+inline long abs(long a) {
return (a >= 0) ? a : -a;
}
+inline int16 convert_intel16(void *src) {
+ return READ_LE_INT16(src);
+}
+
} // namespace M4
#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index dd76246b666..2170d089962 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -24,6 +24,7 @@
#include "m4/kernel.h"
#include "m4/term.h"
+#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_inv.h"
@@ -69,6 +70,7 @@ public:
frac16 _globals[GLB_SHARED_VARS];
Resources _resources;
Rails_Globals _rails;
+ Catalog _catalog;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 1146cbb46e7..a0187c499cd 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -60,6 +60,11 @@ struct Buffer {
int32 stride;
};
+struct token {
+ char *sym_name;
+ int32 tag;
+};
+
#include "common/pack-start.h" // START STRUCT PACKING
struct RGB8 {
byte r, g, b;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 3b284c745cb..ddd7db7cabf 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -9,11 +9,11 @@ MODULE_OBJS = \
param.o \
res.o \
term.o \
+ adv_db_r/db_catalog.o \
adv_r/adv_been.o \
adv_r/adv_inv.o \
adv_r/adv_rails.o \
adv_r/db_env.o \
- adv_r/db_rmlst.o \
core/cstring.o \
core/errors.o \
core/imath.o \
Commit: e1181801ba4614bc5efca1a7cca1ec9909ce038b
https://github.com/scummvm/scummvm/commit/e1181801ba4614bc5efca1a7cca1ec9909ce038b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More catalog methods
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/adv_db_r/db_catalog.h
engines/m4/globals.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 6e34ec61cf3..704f89a5380 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -19,21 +19,68 @@
*
*/
+#include "common/file.h"
#include "common/str.h"
#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_db_r/database.h"
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
-//#include "m4/mem/mem.h"
#include "m4/globals.h"
namespace M4 {
+static void sort_catalog();
static char *catalog_search(char *name);
static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name, char *path, short *c_size);
static int compare_catalog_entries_for_search(const void *n1, const void *n2);
+int read_catalog() {
+ Common::File f;
+ size_t size = 0;
+ Common::String myFilename;
+
+ myFilename = "roomsdb.chk";
+#if 0
+ if (f_info_exists(myFileName))
+ goto plarg_o_rama;
+
+ f_info_cd_name(myFileName);
+ strcat(myFileName, PATHNAME_SEPARATOR_STRING);
+ strcat(myFileName, "roomsdb.chk");
+
+ if (f_info_exists(myFileName))
+ goto plarg_o_rama;
+
+ env_get_path(myFileName, 0, "roomsdb.chk");
+ term_message("using network ROOMSDB.CHK %s", myFileName);
+ if (!f_info_exists(myFileName))
+ return 0;
+
+plarg_o_rama:
+#endif
+ if (!f.open(myFilename))
+ error_show(FL, 'FNF!', "Can't open %s", myFilename.c_str());
+ size = f.size();
+
+ if (_G(catalog)._data)
+ mem_free(_G(catalog)._data);
+
+ _G(catalog)._data = (char *)mem_alloc(size + 4, "catalog");
+
+ if (f.read(_G(catalog)._data, size) != size)
+ error_show(FL, 'FRDF', "Could not read in the catalog.");
+
+ f.close();
+
+ sort_catalog();
+ return 1;
+}
+
+char *db_get_catalog() {
+ return _G(catalog)._data;
+}
+
char *db_rmlst_get_asset_room_path(char *asset_name, char *result, int32 *sceneCode) {
char name[MAX_FILENAME_SIZE], path[MAX_FILENAME_SIZE];
short tag = 0, room = 0;
@@ -67,6 +114,81 @@ char *db_rmlst_get_asset_room_path(char *asset_name, char *result, int32 *sceneC
return result;
}
+static int32 count_catalog_items() {
+ char *pCatIter = db_get_catalog();
+ int32 my_catalog_size = 0;
+
+ while (pCatIter) {
+ pCatIter = db_get_catalog_entry(pCatIter, NULL, NULL, NULL, NULL, NULL);
+ if (pCatIter)
+ ++my_catalog_size;
+ }
+
+ return my_catalog_size;
+}
+
+static int compare_catalog_entries_for_sort(const void *n1, const void *n2) {
+ char *entry1 = *(char **)n1;
+ if (convert_intel16(*(short *)&entry1[2]) == _T_ROOM)
+ entry1 = &entry1[6];
+ else
+ entry1 = &entry1[4];
+
+ char *entry2 = *(char **)n2;
+ if (convert_intel16(*(short *)&entry2[2]) == _T_ROOM)
+ entry2 = &entry2[6];
+ else
+ entry2 = &entry2[4];
+
+ return (scumm_strnicmp(entry1, entry2, 80));
+}
+
+static void sort_catalog() {
+ char name[MAX_FILENAME_SIZE], path[MAX_FILENAME_SIZE];
+ short tag;
+ long i;
+
+ _G(catalog)._size = count_catalog_items();
+ _G(catalog)._catalog = (char **)calloc(_G(catalog)._size + 4, sizeof(char *));
+
+ char *pCatalogIter = _G(catalog)._data;
+ int32 index = 0;
+ while (pCatalogIter) {
+ _G(catalog)._catalog[index] = pCatalogIter;
+
+ short room_number;
+ char *nextItem = db_get_catalog_entry(pCatalogIter, &tag, &room_number, name, path, NULL);
+
+ switch (tag) {
+ case _T_ROOM:
+ snprintf(&pCatalogIter[(3 * sizeof(short))], 256, "%03d!\0", room_number);
+
+ i = (3 * sizeof(short)) + (5 * sizeof(char));
+
+ for (;;) {
+ if (!pCatalogIter[i])
+ break;
+ pCatalogIter[i++] = '\0';
+ }
+ break;
+
+ default:
+ cstrupr(pCatalogIter + (2 * sizeof(short)));
+ break;
+ }
+
+ pCatalogIter = nextItem;
+
+ if (pCatalogIter)
+ ++index;
+
+ if (index > _G(catalog)._size)
+ error_show(FL, 'OOM!');
+ }
+
+ qsort(_G(catalog)._catalog, _G(catalog)._size, sizeof(char *), compare_catalog_entries_for_sort);
+}
+
static char *catalog_search(char *name) {
char myString[80];
cstrcpy(myString, name);
diff --git a/engines/m4/adv_db_r/db_catalog.h b/engines/m4/adv_db_r/db_catalog.h
index bd1eca36fd1..9c7a7df8c17 100644
--- a/engines/m4/adv_db_r/db_catalog.h
+++ b/engines/m4/adv_db_r/db_catalog.h
@@ -35,7 +35,15 @@ struct Catalog {
int32 _size = 0;
};
-extern void db_rmlst_delete_global_RoomList();
+/**
+ * Read in the catalog
+ */
+int read_catalog();
+
+/**
+ * Return the catalog data
+ */
+extern char *db_get_catalog();
/**
* Given an asset name, name, return "path" from the database in result.
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index f0f8b74624f..df0ea0d47f2 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -67,6 +67,8 @@ bool Globals::init() {
game_systems_initialize(INSTALL_ALL);
// TODO
+ read_catalog();
+
return true;
}
Commit: b2b418480c93bc3ca9586b3c3d344fdbd31e79e7
https://github.com/scummvm/scummvm/commit/b2b418480c93bc3ca9586b3c3d344fdbd31e79e7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix creating INvPal
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/fileio/fileio.cpp
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 704f89a5380..91331b5eb18 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -91,8 +91,7 @@ char *db_rmlst_get_asset_room_path(char *asset_name, char *result, int32 *sceneC
char *search_result = catalog_search(asset_name);
- //apr10
- if (search_result != NULL) {
+ if (search_result != nullptr) {
db_get_catalog_entry(search_result, &tag, &room, name, path, &c_size);
*sceneCode = room;
}
@@ -119,7 +118,7 @@ static int32 count_catalog_items() {
int32 my_catalog_size = 0;
while (pCatIter) {
- pCatIter = db_get_catalog_entry(pCatIter, NULL, NULL, NULL, NULL, NULL);
+ pCatIter = db_get_catalog_entry(pCatIter, nullptr, nullptr, nullptr, nullptr, nullptr);
if (pCatIter)
++my_catalog_size;
}
@@ -157,7 +156,7 @@ static void sort_catalog() {
_G(catalog)._catalog[index] = pCatalogIter;
short room_number;
- char *nextItem = db_get_catalog_entry(pCatalogIter, &tag, &room_number, name, path, NULL);
+ char *nextItem = db_get_catalog_entry(pCatalogIter, &tag, &room_number, name, path, nullptr);
switch (tag) {
case _T_ROOM:
@@ -196,7 +195,7 @@ static char *catalog_search(char *name) {
char **result = (char **)bsearch((void *)myString, (void *)_G(catalog)._catalog, _G(catalog)._size, sizeof(char *), compare_catalog_entries_for_search);
if (!result)
- return NULL;
+ return nullptr;
return *result;
}
@@ -219,7 +218,7 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
short size = convert_intel16(*(short *)&c[0]);
if (!size)
- return NULL;
+ return nullptr;
if (c_size)
*c_size = size;
@@ -230,7 +229,7 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
if (tag)
*tag = theTag;
- x += sizeof(short); //tag
+ x += sizeof(short); // tag
if ((theTag == _T_ROOM) && room) {
*room = convert_intel16(*(short *)&c[x]);
@@ -248,13 +247,6 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
if (name)
snprintf(name, MAX_FILENAME_SIZE, "%s", s);
- //feb5
- //skip over trailing '\0' or NULL string.
- //for( i=0; i<2; i++ ) {
- // if( c[x] )
- // break;
- // x++;
- //}
for (;; ) {
if (c[x])
break;
diff --git a/engines/m4/fileio/fileio.cpp b/engines/m4/fileio/fileio.cpp
index 0627f6c54c6..5f319bab757 100644
--- a/engines/m4/fileio/fileio.cpp
+++ b/engines/m4/fileio/fileio.cpp
@@ -28,6 +28,9 @@ namespace M4 {
Common::Stream *f_io_open(const Common::String &filename, const Common::String &mode) {
if (mode.hasPrefix("r")) {
+ if (filename.empty())
+ return nullptr;
+
Common::File *f = new Common::File();
if (f->open(filename))
return f;
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 78db7797f15..a4e5ff8e25c 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -90,9 +90,9 @@ uint32 SysFile::get_pos() {
void SysFile::open_read_low_level() {
Common::File temp_fp;
- uint32 hash_table_size;
- char hag_name[33];
- byte hagfile;
+ uint32 hash_table_size;
+ char hag_name[33];
+ byte hagfile;
Hag_Name_Record *temp_ptr;
char *temp_name;
Common::String last_string;
Commit: c922847bfdb5d3cfcae29723d183fe9279643785
https://github.com/scummvm/scummvm/commit/c922847bfdb5d3cfcae29723d183fe9279643785
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Changes to start in hag mode
Changed paths:
engines/m4/fileio/sys_file.cpp
engines/m4/globals.cpp
engines/m4/kernel.h
engines/m4/param.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index a4e5ff8e25c..8845a34cbcb 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -25,6 +25,7 @@
#include "m4/adv_r/db_env.h"
#include "m4/mem/memman.h"
#include "m4/globals.h"
+#include "m4/m4.h"
namespace M4 {
@@ -103,8 +104,6 @@ void SysFile::open_read_low_level() {
// First time to read
if (_G(hag).hag_flag) {
// Use hag file
- _G(hag).hag_flag = true;
-
// Get hagfile table list here
if (!temp_fp.open(_G(hag).hash_file))
error("Hash file not found: %s", _G(hag).hash_file.c_str());
@@ -618,6 +617,8 @@ void sysfile_init(bool in_hag_mode) {
_G(hag).hag_flag = in_hag_mode;
if (in_hag_mode) {
+ _G(hag).hash_file = Common::String::format("%s.has",
+ g_engine->getGameId().c_str());
term_message("Initialized in hag mode");
} else {
term_message("Initialized in file mode");
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index df0ea0d47f2..02e2f01c4ee 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -86,6 +86,8 @@ void Globals::game_systems_initialize(byte flags) {
mem_stash_init(32);
+ sysfile_init(_kernel.hag_mode);
+
if (flags & INSTALL_PLAYER_BEEN_INIT) {
if (!player_been_init(MAX_SCENES))
error_show(FL, 'PBIF');
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
index 9a961e5194d..df110a5c6e5 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/kernel.h
@@ -27,10 +27,11 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
struct Kernel {
- bool use_log_file = false;
+ bool hag_mode = true;
int suppress_cache = CACHE_NOT_OVERRIDE_BY_FLAG_PARSE;
+
+ bool use_log_file = false;
bool track_open_close = false;
- bool hag_mode = false;
bool start_up_with_dbg_ws = false;
bool cheat_keys_enabled = false;
bool use_debug_monitor = false;
diff --git a/engines/m4/param.cpp b/engines/m4/param.cpp
index 56dc65eecdb..a33a0efefaa 100644
--- a/engines/m4/param.cpp
+++ b/engines/m4/param.cpp
@@ -48,7 +48,6 @@ void parse_all_flags() {
_G(kernel).suppress_cache = false;
_G(kernel).track_open_close = ConfMan.hasKey("FILECOUNT");
- _G(kernel).hag_mode = ConfMan.hasKey("C");
_G(kernel).start_up_with_dbg_ws = ConfMan.hasKey("W");
_G(kernel).cheat_keys_enabled = ConfMan.hasKey("!");
_G(kernel).use_debug_monitor = ConfMan.hasKey("H");
Commit: 34691b83994cfca9c676a8e9d78236b61cbd6b3b
https://github.com/scummvm/scummvm/commit/34691b83994cfca9c676a8e9d78236b61cbd6b3b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix reading hash file
Changed paths:
engines/m4/fileio/fileio.h
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/fileio/fileio.h b/engines/m4/fileio/fileio.h
index 6c55cd671c6..a4428187c62 100644
--- a/engines/m4/fileio/fileio.h
+++ b/engines/m4/fileio/fileio.h
@@ -41,7 +41,7 @@ enum FileMode {
};
struct Hag_Name_Record {
- Common::String filename;
+ char filename[33];
byte hagfile;
struct Hag_Name_Record *next;
};
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 8845a34cbcb..7ffe68a82ce 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -109,7 +109,7 @@ void SysFile::open_read_low_level() {
error("Hash file not found: %s", _G(hag).hash_file.c_str());
hash_table_size = temp_fp.readUint32LE();
- if (temp_fp.seek(hash_table_size * HASH_RECORD_LENGTH, SEEK_CUR))
+ if (!temp_fp.seek(hash_table_size * HASH_RECORD_LENGTH, SEEK_CUR))
error("fail to seek");
_G(hag).hag_name_list = NULL;
@@ -122,13 +122,13 @@ void SysFile::open_read_low_level() {
assert(temp_ptr);
// Check hag file exists or not
- local_name = f_extension_new(hag_name, "hag");
+ local_name = f_extension_new(hag_name, "HAG");
if (!Common::File::exists(local_name))
error("couldn't find hag file: %s", local_name.c_str());
// put into hag_name_list //
- temp_ptr->filename = hag_name;
+ Common::strcpy_s(temp_ptr->filename, hag_name);
temp_ptr->hagfile = hagfile;
temp_ptr->next = _G(hag).hag_name_list;
_G(hag).hag_name_list = temp_ptr;
@@ -244,7 +244,7 @@ Common::String SysFile::get_last_string(const Common::String &src) {
}
bool SysFile::open_hash_file() {
- Common::File hashfp;
+ Common::SeekableReadStream *hashfp;
Common::Stream *temp_fp;
uint32 hash_address;
Common::String hag_name, temp_name;
@@ -254,16 +254,17 @@ bool SysFile::open_hash_file() {
bool found;
Common::String ext_name;
- if (!hashfp.open(_G(hag).hash_file)) {
+ hashfp = dynamic_cast<Common::SeekableReadStream *>(f_io_open(_G(hag).hash_file, "rb"));
+ if (!hashfp) {
warning("open_hash_file: %s %s", _G(hag).hash_file.c_str());
hag_success = false;
return false;
}
- hash_table_size = hashfp.readUint32LE();
+ hash_table_size = hashfp->readUint32LE();
hash_address = key_to_hash_address(filename, hash_table_size);
- if (!hash_search(filename, &curr_hash_record, curr_hag_record, hash_address, &hashfp, hash_table_size, show_error_flag)) {
+ if (!hash_search(filename, &curr_hash_record, curr_hag_record, hash_address, hashfp, hash_table_size, show_error_flag)) {
hag_success = 0;
return false;
@@ -395,6 +396,9 @@ uint32 SysFile::key_to_hash_address(const Common::String &src, uint32 hash_table
Common::String key = src;
key.toUppercase();
+ if (key.empty())
+ return 0;
+
h = key[0];
len = key.size();
for (i = 1; i < len; i++)
@@ -421,7 +425,7 @@ int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_
myfilename[0] = '\0';
while (!finded) {
- if (hashfp->seek(offset))
+ if (!hashfp->seek(offset))
term_message("fail to fseek");
hashfp->read(myfilename, 33);
Commit: cb94642b1b20a108ae82d0ce197afbdb70c8dfde
https://github.com/scummvm/scummvm/commit/cb94642b1b20a108ae82d0ce197afbdb70c8dfde
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: read_catalog isn't used when hag mode is on
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/adv_db_r/db_catalog.h
engines/m4/globals.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 91331b5eb18..1077d761f7d 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -35,37 +35,20 @@ static char *catalog_search(char *name);
static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name, char *path, short *c_size);
static int compare_catalog_entries_for_search(const void *n1, const void *n2);
-int read_catalog() {
+bool read_catalog() {
Common::File f;
size_t size = 0;
Common::String myFilename;
myFilename = "roomsdb.chk";
-#if 0
- if (f_info_exists(myFileName))
- goto plarg_o_rama;
- f_info_cd_name(myFileName);
- strcat(myFileName, PATHNAME_SEPARATOR_STRING);
- strcat(myFileName, "roomsdb.chk");
-
- if (f_info_exists(myFileName))
- goto plarg_o_rama;
-
- env_get_path(myFileName, 0, "roomsdb.chk");
- term_message("using network ROOMSDB.CHK %s", myFileName);
- if (!f_info_exists(myFileName))
- return 0;
-
-plarg_o_rama:
-#endif
if (!f.open(myFilename))
- error_show(FL, 'FNF!', "Can't open %s", myFilename.c_str());
- size = f.size();
+ return false;
if (_G(catalog)._data)
mem_free(_G(catalog)._data);
+ size = f.size();
_G(catalog)._data = (char *)mem_alloc(size + 4, "catalog");
if (f.read(_G(catalog)._data, size) != size)
@@ -74,7 +57,7 @@ plarg_o_rama:
f.close();
sort_catalog();
- return 1;
+ return true;
}
char *db_get_catalog() {
diff --git a/engines/m4/adv_db_r/db_catalog.h b/engines/m4/adv_db_r/db_catalog.h
index 9c7a7df8c17..2c462ca8384 100644
--- a/engines/m4/adv_db_r/db_catalog.h
+++ b/engines/m4/adv_db_r/db_catalog.h
@@ -38,7 +38,7 @@ struct Catalog {
/**
* Read in the catalog
*/
-int read_catalog();
+bool read_catalog();
/**
* Return the catalog data
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 02e2f01c4ee..3713bdfd186 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -66,8 +66,10 @@ bool Globals::init() {
game_systems_initialize(INSTALL_ALL);
- // TODO
- read_catalog();
+ if (!_kernel.hag_mode) {
+ if (!read_catalog())
+ error_show(FL, 'PARS', "game_main");
+ }
return true;
}
Commit: 999bff0174e66f26d8fdaedc5eaf8a9b37544377
https://github.com/scummvm/scummvm/commit/999bff0174e66f26d8fdaedc5eaf8a9b37544377
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding walker engine init
Changed paths:
engines/m4/core/imath.h
engines/m4/fileio/fileio.h
engines/m4/fileio/sys_file.cpp
engines/m4/globals.cpp
engines/m4/mem/res.cpp
engines/m4/mem/res.h
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
index a44bf4de397..de8e5573e4f 100644
--- a/engines/m4/core/imath.h
+++ b/engines/m4/core/imath.h
@@ -35,6 +35,11 @@ namespace M4 {
#define RecipUF16(x) FixedDiv(1, x)
#define SquareSF16(x) FixedMul(x, x)
+#define SWAP_INT16(x) ((((x)>>8)&0x00ff) + (((x)&0x00ff)<<8))
+#define SWAP_INT32(x) ((((int32)(x)&0x000000ff)<<24) + (((int32)(x)&0x0000ff00)<<8) + \
+ (((int32)(x)&0x00ff0000)>>8) + (((int32)(x)>>24)&0x000000ff))
+
+
frac16 FixedMul(frac16 Multiplicand, frac16 Multiplier);
frac16 FixedDiv(frac16 Dividend, frac16 Divisor);
diff --git a/engines/m4/fileio/fileio.h b/engines/m4/fileio/fileio.h
index a4428187c62..6534b2937dc 100644
--- a/engines/m4/fileio/fileio.h
+++ b/engines/m4/fileio/fileio.h
@@ -47,7 +47,7 @@ struct Hag_Name_Record {
};
struct Hag_Record {
- Common::String hag_name;
+ char hag_name[33];
byte hagfile;
Common::Stream *hag_fp;
uint32 hag_pos;
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 7ffe68a82ce..f47de547a05 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -325,7 +325,7 @@ bool SysFile::open_hash_file() {
return 0;
}
- temp_ptr->hag_name = temp_name;
+ Common::strcpy_s(temp_ptr->hag_name, temp_name.c_str());
temp_ptr->hag_fp = temp_fp;
Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(temp_fp);
@@ -353,7 +353,7 @@ bool SysFile::open_hash_file() {
return 0;
}
- temp_ptr->hag_name = hag_name;
+ Common::strcpy_s(temp_ptr->hag_name, hag_name.c_str());
temp_ptr->hag_fp = temp_fp;
Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(temp_fp);
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 3713bdfd186..a3ca50b17f6 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -71,6 +71,14 @@ bool Globals::init() {
error_show(FL, 'PARS', "game_main");
}
+ term_message("Load walker engines");
+ if (!LoadWSAssets("walker script", &_master_palette[0]))
+ error_show(FL, 'FNF!', "walker script");
+ if (!LoadWSAssets("show script", &_master_palette[0]))
+ error_show(FL, 'FNF!', "show script");
+ if (!LoadWSAssets("stream script", &_master_palette[0]))
+ error_show(FL, 'FNF!', "stream script");
+
return true;
}
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index f90780f9814..596b2263572 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -97,7 +97,7 @@ int Resources::hash(const Common::String &sym) const {
return ret_val & (HASHSIZE - 1);
}
-Handle Resources::rget(const Common::String &resourceName, int32 *resourceSize) {
+MemHandle Resources::rget(const Common::String &resourceName, int32 *resourceSize) {
Entry *resEntry;
if (resourceSize)
@@ -228,7 +228,7 @@ bool Resources::do_file(MemHandle buffer) {
return result;
}
-Handle rget(const Common::String &resourceName, int32 *resourceSize) {
+MemHandle rget(const Common::String &resourceName, int32 *resourceSize) {
return _G(resources).rget(resourceName, resourceSize);
}
diff --git a/engines/m4/mem/res.h b/engines/m4/mem/res.h
index eb304d308bb..c38f54cec48 100644
--- a/engines/m4/mem/res.h
+++ b/engines/m4/mem/res.h
@@ -30,12 +30,10 @@ namespace M4 {
#define MAX_RESOURCES (1 << 7)
-typedef void **ResHandle;
-
class Resources {
struct Entry {
Common::String name;
- ResHandle RHandle = nullptr;
+ MemHandle RHandle = nullptr;
size_t BufferSize = 0;
uint32 Size = 0;
byte Flags = 0;
@@ -52,11 +50,11 @@ private:
public:
~Resources();
- Handle rget(const Common::String &resourceName, int32 *resourceSize);
+ MemHandle rget(const Common::String &resourceName, int32 *resourceSize);
void rtoss(const Common::String &resourceName);
};
-extern Handle rget(const Common::String &resourceName, int32 *ResourceSize);
+extern MemHandle rget(const Common::String &resourceName, int32 *ResourceSize);
extern void rtoss(const Common::String &resourceName);
} // namespace M4
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index a7d3409d852..78ea99c2049 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -22,11 +22,17 @@
#include "m4/wscript/ws_load.h"
#include "m4/wscript/ws_machine.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/graphics/graphics.h"
+#include "m4/mem/mem.h"
#include "m4/globals.h"
namespace M4 {
+static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal);
+static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
+ int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette);
+
bool InitWSAssets(void) {
int32 i;
@@ -212,6 +218,226 @@ void ShutdownWSAssets(void) {
_G(wsloaderInitialized) = false;
}
+bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
+ MemHandle workHandle;
+ char *mainAssetPtr, *parseAssetPtr, *endOfAssetBlock;
+ uint32 *tempPtr;
+ uint32 *chunkType, *chunkSize, *chunkHash;
+ bool finished, chunkSwap;
+ int32 *celsPtr, *palPtr;
+ uint32 i;
+ int32 assetSize;
+
+ // Check that the loader has been initialized
+ if (!_G(wsloaderInitialized)) {
+ error_show(FL, 'WSLI');
+ }
+
+ // Use the resource io manager to read in the entire block
+ if ((workHandle = rget(wsAssetName, &assetSize)) == nullptr) {
+ error_show(FL, 'FNF!', "Asset Name: %s", wsAssetName);
+ }
+
+ // Lock the handle so we can step through the chunk
+ HLock(workHandle);
+ mainAssetPtr = (char *)(*workHandle);
+
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+
+ parseAssetPtr = mainAssetPtr;
+
+ // Set the finished flag
+ finished = false;
+
+ // Get the first chunkType
+ if (!GetNextint32(&parseAssetPtr, endOfAssetBlock, &chunkType)) {
+ finished = true;
+ }
+
+ // Process each chunk according to type
+ while (!finished) {
+
+ // Read in the chunk size and hash number
+ if (!GetNextint32(&parseAssetPtr, endOfAssetBlock, &chunkSize)) {
+ error_show(FL, 'WSLE', "Asset Name: %s", wsAssetName);
+ }
+ if (!GetNextint32(&parseAssetPtr, endOfAssetBlock, &chunkHash)) {
+ error_show(FL, 'WSLE', "Asset Name: %s", wsAssetName);
+ }
+
+ // Process the chunk according to type
+ chunkSwap = false;
+ switch (*chunkType) {
+ // Chunk is a machine chunk
+ case CHUNK_HCAM:
+ // Byte swap the type, size and hash and continue through case CHUNK_MACH.
+ *chunkType = SWAP_INT32(*chunkType);
+ *chunkSize = SWAP_INT32(*chunkSize);
+ *chunkHash = SWAP_INT32(*chunkHash);
+ chunkSwap = true;
+
+ case CHUNK_MACH:
+ // Check the validity of the machine hash number, and clear it
+ if (*chunkHash > MAX_ASSET_HASH) {
+ error_show(FL, 'WSLA', "Asset Name: %s, MACH hash was: %ld", wsAssetName, *chunkHash);
+ }
+ ClearWSAssets(_WS_ASSET_MACH, *chunkHash, *chunkHash);
+
+ // Store the resource name, and the offset into the resource block
+ _G(globalMACHnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _G(globalMACHHandles)[*chunkHash] = workHandle;
+ _G(globalMACHoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+
+ // Check that the assetblocksize is big enough that the chunk body was read in...
+ if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
+ error_show(FL, 'WSLE', "Asset Name: %s, MACH hash was: %ld", wsAssetName, *chunkHash);
+ }
+
+ // Byteswap the entire machine if necessary
+ if (chunkSwap) {
+ tempPtr = (uint32 *)parseAssetPtr;
+ for (i = 0; i < (*chunkSize - 12) >> 2; i++) { //>>2 - chunkSize is bytes, not int32s
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
+ }
+ }
+
+ // Update the assetPtr to the beginning of the next chunk
+ parseAssetPtr += *chunkSize - 12;
+
+ break;
+
+ // Chunk is a machine chunk
+ case CHUNK_UQES:
+ // Byte swap the type, size and hash and continue through case CHUNK_SEQU.
+ *chunkType = SWAP_INT32(*chunkType);
+ *chunkSize = SWAP_INT32(*chunkSize);
+ *chunkHash = SWAP_INT32(*chunkHash);
+ chunkSwap = true;
+
+ case CHUNK_SEQU:
+ // Check the validity of the sequence hash number, and clear it
+ if (*chunkHash > MAX_ASSET_HASH) {
+ error_show(FL, 'WSLA', "Asset Name: %s, SEQU hash was: %ld", wsAssetName, *chunkHash);
+ }
+ ClearWSAssets(_WS_ASSET_SEQU, *chunkHash, *chunkHash);
+
+ // Store the resource name, and the offset into the resource block
+ _G(globalSEQUnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _G(globalSEQUHandles)[*chunkHash] = workHandle;
+ _G(globalSEQUoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+
+ // Check that the assetblocksize is big enough that the chunk body was read in...
+ if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
+ error_show(FL, 'WSLE', "Asset Name: %s, SEQU hash was: %ld", wsAssetName, *chunkHash);
+ }
+
+ // Byteswap the entire sequence if necessary
+ if (chunkSwap) {
+ tempPtr = (uint32 *)parseAssetPtr;
+ for (i = 0; i < (*chunkSize - 12) >> 2; i++) { //>>2 - chunkSize is bytes, not int32s
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
+ }
+ }
+
+ // Update the assetPtr to the beginning of the next chunk
+ parseAssetPtr += *chunkSize - 12;
+ break;
+
+ // Chunk is a data chunk
+ case CHUNK_ATAD:
+ // Byte swap the type, size and hash and continue through case CHUNK_DATA.
+ *chunkType = SWAP_INT32(*chunkType);
+ *chunkSize = SWAP_INT32(*chunkSize);
+ *chunkHash = SWAP_INT32(*chunkHash);
+ chunkSwap = true;
+
+ case CHUNK_DATA:
+ // Check the validity of the data block hash number, and clear it
+ if (*chunkHash > MAX_ASSET_HASH) {
+ error_show(FL, 'WSLA', "Asset Name: %s, DATA hash was: %ld", wsAssetName, *chunkHash);
+ }
+ ClearWSAssets(_WS_ASSET_DATA, *chunkHash, *chunkHash);
+
+ // Store the resource name, and the offset into the resource block
+ _G(globalDATAnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _G(globalDATAHandles)[*chunkHash] = workHandle;
+ _G(globalDATAoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+
+ // Check that the assetblocksize is big enough that the chunk body was read in...
+ if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
+ error_show(FL, 'WSLE', "Asset Name: %s, DATA hash was: %ld", wsAssetName, *chunkHash);
+ }
+
+ // Byteswap the entire data block if necessary
+ if (chunkSwap) {
+ tempPtr = (uint32 *)parseAssetPtr;
+ for (i = 0; i < (*chunkSize - 12) >> 2; i++) { //>>2 - chunkSize is bytes, not int32s
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
+ }
+ }
+
+ // Update the assetPtr to the beginning of the next chunk
+ parseAssetPtr += *chunkSize - 12;
+
+ break;
+
+ case CHUNK_SLEC:
+ // Byte swap the type, size and hash and continue through case CHUNK_CELS.
+ *chunkType = SWAP_INT32(*chunkType);
+ *chunkSize = SWAP_INT32(*chunkSize);
+ *chunkHash = SWAP_INT32(*chunkHash);
+ chunkSwap = true;
+
+ case CHUNK_CELS:
+ // Check the validity of the cels hash number, and clear it
+ if (*chunkHash > MAX_ASSET_HASH) {
+ error_show(FL, 'WSLA', "Asset Name: %s, CELS hash was: %ld", wsAssetName, *chunkHash);
+ }
+ ClearWSAssets(_WS_ASSET_CELS, *chunkHash, *chunkHash);
+
+ // Store the resource name
+ _G(globalCELSnames)[*chunkHash] = mem_strdup(wsAssetName);
+
+ // Process the SS from the stream file
+ if (ProcessCELS(wsAssetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette) < 0) {
+ error_show(FL, 'WSLP', "Asset Name: %s, CELS hash was: %ld", wsAssetName, *chunkHash);
+ }
+
+ // At this point, celsPtr points to the beginning of the cels data, palPtr to the pal data
+ // Store the Handle, and calculate the offsets
+ _G(globalCELSHandles)[*chunkHash] = workHandle;
+ if (celsPtr) {
+ _G(globalCELSoffsets)[*chunkHash] = (int32)celsPtr - (int32)mainAssetPtr;
+ } else {
+ _G(globalCELSoffsets)[*chunkHash] = -1;
+ }
+ if (palPtr) {
+ _G(globalCELSPaloffsets)[*chunkHash] = (int32)palPtr - (int32)mainAssetPtr;
+ } else {
+ _G(globalCELSPaloffsets)[*chunkHash] = -1;
+ }
+ break;
+
+ default:
+ error_show(FL, 'WSLT', "Asset Name: %s, %ld bytes into the file.", wsAssetName,
+ (int32)parseAssetPtr - 12 - (int32)mainAssetPtr);
+ break;
+ }
+
+ // Read the next chunkType, or signal we are finished
+ if (!GetNextint32(&parseAssetPtr, endOfAssetBlock, &chunkType)) {
+ finished = true;
+ }
+ }
+
+ // Unlock the handle now
+ HUnLock(workHandle);
+ return true;
+}
+
M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries) {
uint32 *myCelSource, *data, *offsets, numCels;
uint32 *celsPtr;
@@ -219,14 +445,14 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
// Parameter verification
if ((!resourceHandle) || (!*resourceHandle)) {
ws_LogErrorMsg(FL, "No sprite source in memory.");
- return NULL;
+ return nullptr;
}
if (!mySprite) {
mySprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "Sprite");
if (!mySprite) {
ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(M4sprite));
- return NULL;
+ return nullptr;
}
}
@@ -238,7 +464,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
numCels = celsPtr[CELS_COUNT];
if (index >= (int)numCels) {
ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
- return NULL;
+ return nullptr;
}
// Find the offset table, and the beginning of the data for all sprites
@@ -272,7 +498,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
}
// This value MUST be set before sprite draws are called after the block has been locked
- mySprite->data = NULL;
+ mySprite->data = nullptr;
// Unlock the handle
HUnLock(resourceHandle);
@@ -280,4 +506,205 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
return mySprite;
}
+static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal) {
+ // Check to see if we still have an int32 available
+ if ((endOfAssetBlock - *assetPtr) < 4) {
+ return false;
+ }
+
+ // Get the next int32
+ *returnVal = (uint32 *)*assetPtr;
+ *assetPtr += 4;
+
+ return true;
+}
+
+static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
+ int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette) {
+ uint32 *celsType, *numColors, *palData;
+ uint32 *tempPtr, *celsSize, *data, *dataPtr, *offsetPtr, i, j, *header, *format;
+ bool byteSwap;
+
+ if (!_G(wsloaderInitialized))
+ return -1;
+
+ *dataOffset = nullptr;
+ *palDataOffset = nullptr;
+
+ // Get the header and the format
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &header)) {
+ ws_LogErrorMsg(FL, "Unable to get the SS header");
+ return -1;
+ }
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &format)) {
+ ws_LogErrorMsg(FL, "Unable to get the SS format");
+ return -1;
+ }
+
+ // Make sure the file is tagged "M4SS" (or "SS4M")
+ if (*header == HEAD_SS4M) {
+ *header = SWAP_INT32(*header);
+ *format = SWAP_INT32(*format);
+ } else if (*header != HEAD_M4SS) {
+ ws_LogErrorMsg(FL, "SS chunk is not a valid M4SS chunk.");
+ return -1;
+ }
+
+ // Verify the format is recent. This is a version control
+ if (*format < SS_FORMAT) {
+ ws_LogErrorMsg(FL, "Format is antique and cannot be read - rebuild series.");
+ return -1;
+ }
+
+ // Get the CELS chunk type - either PAL information, or the actual SS info
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &celsType)) {
+ ws_LogErrorMsg(FL, "Unable to read the SS chunk type.");
+ return -1;
+ }
+
+ byteSwap = false;
+ // If the chunk is PAL info - celsType == CELS_LAP_ indicates the chunk needs to be byte-swapped.
+ if ((*celsType == CELS__PAL) || (*celsType == CELS_LAP_)) {
+
+ // Read the chunk size, and the number of palette colors, and byte-swap if necessary
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &celsSize)) {
+ ws_LogErrorMsg(FL, "Unable to read the SS PAL chunk size.");
+ return -1;
+ }
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &numColors)) {
+ ws_LogErrorMsg(FL, "Unable to read the SS PAL number of colors.");
+ return -1;
+ }
+
+ if (*celsType == CELS_LAP_) {
+ *celsType = SWAP_INT32(*celsType);
+ *celsSize = SWAP_INT32(*celsSize);
+ *numColors = SWAP_INT32(*numColors);
+ byteSwap = true;
+ }
+
+ // Verify that we actually got legitimate values
+ if (((int32)(*celsSize) <= 0) || ((int32)(*numColors) <= 0)) {
+ ws_LogErrorMsg(FL, "Pal info has been corrupted");
+ return -1;
+ }
+
+ // The asset block offset for palData should begin with the number of colors
+ *palDataOffset = (int32 *)numColors;
+ palData = (uint32 *)numColors;
+
+ if (((int32)endOfAssetBlock - (int32)(*parseAssetPtr)) < ((int32)(*celsSize) - 8)) {
+ ws_LogErrorMsg(FL, "Pal info is larger than asset block.");
+ return -1;
+ }
+
+ // If the chunk is in the wrong format, byte-swap the entire chunk
+ // Note: we do this because we want the data stored in nrgb format
+ // The data is always read in low byte first, but we need it high byte first
+ // regardless of the endianness of the machine.
+ if (byteSwap) {
+ tempPtr = (uint32 *)&numColors[1];
+ for (i = 0; i < *numColors; i++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+ }
+
+ *parseAssetPtr += *numColors << 2;
+
+ // The palette info has been processed, now it can be stored
+ if (myPalette) {
+ tempPtr = (uint32 *)(&palData[1]);
+ for (i = 0; i < (uint32)*numColors; i++) {
+ j = (*tempPtr & 0xff000000) >> 24;
+ myPalette[j].r = (*tempPtr & 0x00ff0000) >> 14;
+ myPalette[j].g = (*tempPtr & 0x0000ff00) >> 6;
+ myPalette[j].b = (*tempPtr & 0x000000ff) << 2;
+ tempPtr++;
+ }
+ }
+
+ byteSwap = false;
+ // Pal chunk has been processed, get the next chunk type
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &celsType)) {
+ ws_LogErrorMsg(FL, "Unable to read the SS chunk type.");
+ return -1;
+ }
+ }
+
+ // The chunk header must now be the SS information (possibly byte-swapped)
+ if ((*celsType != CELS___SS) && (*celsType != CELS_SS__)) {
+ ws_LogErrorMsg(FL, "SS chunk type is invalid.");
+ return -1;
+ }
+
+ // Read in the chunk size
+ if (!GetNextint32(parseAssetPtr, endOfAssetBlock, &celsSize)) {
+ ws_LogErrorMsg(FL, "Unable to read the SS chunk size.");
+ return -1;
+ }
+
+ // Byteswap if necessary
+ if (*celsType == CELS_SS__) {
+ *celsType = SWAP_INT32(*celsType);
+ *celsSize = SWAP_INT32(*celsSize);
+ byteSwap = true;
+ }
+
+ // The asset block offset for the cel should begin with the celsType
+ *dataOffset = (int32 *)celsType;
+ data = (uint32 *)celsType;
+
+ // Verify that we actually got legitimate values
+ if ((int32)(*celsSize) <= 0) {
+ ws_LogErrorMsg(FL, "SS info has been corrupted");
+ return -1;
+ }
+
+ if (((int32)endOfAssetBlock - (int32)data) < (int32)*celsSize) {
+ ws_LogErrorMsg(FL, "SS info is larger than asset block.");
+ return -1;
+ }
+
+ // Check to see if we need to byte-swap the header information.
+ if (byteSwap) {
+
+ // The chunk header begins at (*data)[2]
+ // byte-swap the entire chunk header
+ tempPtr = &(data[2]);
+ for (i = 0; i < SS_HEAD_SIZE - 2; i++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+
+ if ((int32)(data[CELS_COUNT]) <= 0) {
+ ws_LogErrorMsg(FL, "SS info has been corrupted");
+ return -1;
+ }
+
+ // The chunk header has been byteswapped, now we must byte-swap the table of
+ // offsets into the chunk, which indicate where each individual sprite can be found.
+ offsetPtr = &(data[CELS_OFFSETS]);
+ tempPtr = offsetPtr;
+ for (i = 0; i < data[CELS_COUNT]; i++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+
+ // dataPtr points to the beginning of the block which is a concatenation of
+ // all the sprites. Loop through and byteswap each individual sprite header.
+ dataPtr = tempPtr;
+ for (i = 0; i < data[CELS_COUNT]; i++) {
+
+ // The beginning of sprite i is the dataPtr + the number of bytes in the offset table
+ tempPtr = (uint32 *)((uint32)dataPtr + offsetPtr[i]);
+
+ // Byteswap the individual sprite's header
+ for (j = 0; j < SS_INDV_HEAD; j++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+ }
+ }
+
+ // Return the size of the chunk containing the sprite series info
+ return *celsSize;
+}
+
} // End of namespace M4
Commit: 5210eec36a43dcec0243524c18ab1603cc79b826
https://github.com/scummvm/scummvm/commit/5210eec36a43dcec0243524c18ab1603cc79b826
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix loading walker engines
Changed paths:
engines/m4/fileio/sys_file.cpp
engines/m4/mem/res.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index f47de547a05..1b4f99b2275 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -444,10 +444,11 @@ int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_
r.hagfile = hashfp->readByte();
r.disks = hashfp->readByte();
r.offset = hashfp->readUint32LE();
+ r.size = hashfp->readUint32LE();
next_record = hashfp->readUint32LE();
r.filename = myfilename;
- // As long as find a hag file in current directory , use it immedeiately
+ // As long as we find a hag file, use it immedeiately
get_local_name_from_hagfile(local_name, current_hash_record_ptr->hagfile);
local_hag_name = f_extension_new(local_name, "HAG");
local_name = local_hag_name;
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index 596b2263572..337af772f2e 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -86,7 +86,7 @@ got_one:
}
int Resources::hash(const Common::String &sym) const {
- int ret_val = 0;
+ uint ret_val = 0;
const char *s = sym.c_str();
while (*s) {
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 78ea99c2049..aa834ccc6e5 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -256,7 +256,6 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Process each chunk according to type
while (!finished) {
-
// Read in the chunk size and hash number
if (!GetNextint32(&parseAssetPtr, endOfAssetBlock, &chunkSize)) {
error_show(FL, 'WSLE', "Asset Name: %s", wsAssetName);
@@ -381,7 +380,6 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Update the assetPtr to the beginning of the next chunk
parseAssetPtr += *chunkSize - 12;
-
break;
case CHUNK_SLEC:
Commit: 3453b02c5ee391b708cdc9d70111430ae7d6a0f2
https://github.com/scummvm/scummvm/commit/3453b02c5ee391b708cdc9d70111430ae7d6a0f2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix initializing pointer with bool
Changed paths:
engines/m4/adv_r/adv_rails.cpp
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index 47b7bc9043e..f4707bf9aa8 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -760,7 +760,7 @@ railNode *CreateCustomPath(int32 coord, ...) {
int32 x, y;
// Initialize firstNode
- firstNode = false;
+ firstNode = nullptr;
// Set argPtr to point to the beginning of the variable arg list
va_start(argPtr, coord);
Commit: 76a609b09a7280b56f9942a7129a8a7289725341
https://github.com/scummvm/scummvm/commit/76a609b09a7280b56f9942a7129a8a7289725341
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added font initialization
Changed paths:
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index a3ca50b17f6..05a55a49c15 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -136,7 +136,57 @@ void Globals::game_systems_initialize(byte flags) {
}
void Globals::game_systems_shutdown() {
- // TODO
+ _system_shutting_down = true;
+#ifdef TODO
+ term_message("asset list be gone!");
+ db_destroy_cat();
+#endif
+ rail_system_shutdown();
+
+ term_message("fonts be gone!");
+ gr_font_dealloc(_font_tiny_prop);
+ gr_font_dealloc(_font_tiny);
+ gr_font_dealloc(_font_line);
+ gr_font_dealloc(_font_inter);
+ gr_font_dealloc(_font_conv);
+ gr_font_dealloc(_font_menu);
+ gr_font_dealloc(_font_misc);
+ gr_font_system_shutdown();
+#ifdef TODO
+ conv_reset_all(); //mar4 from mattp
+
+ term_message("tin streams be gone!");
+ f_stream_Shutdown();
+
+ term_message("mouse dialog be gone!");
+ DialogDestroy(mousePosDialog, NULL);
+
+ term_message("sounds stop");
+ midi_stop();
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+
+ if (_globals)
+ mem_free(_globals);
+ if (_globalCtrls)
+ mem_free(_globalCtrls);
+ if (_inverse_pal)
+ delete (inverse_pal);
+
+ term_message("big buffers be gone");
+ if (_gameDrawBuff)
+ delete _gameDrawBuff;
+
+ term_message("SOS be gone");
+ digi_uninstall();
+ midi_uninstall();
+
+ f_io_report(NULL, NULL);
+ term_message("calling registry shutdown");
+ registry_shutdown_all();
+ term_shutdown();
+#endif
}
void Globals::fire_up_gui() {
@@ -165,6 +215,18 @@ bool Globals::woodscript_init() {
return true;
}
+void Globals::grab_fonts() {
+ term_message("Grabbing fonts");
+
+ _font_tiny_prop = gr_font_load("4X6PP.FNT");
+ _font_tiny = gr_font_load("FONTTINY.FNT");
+ _font_line = gr_font_load("FONTLINE.FNT");
+ _font_inter = gr_font_load("FONTINTR.FNT");
+ _font_conv = gr_font_load("FONTCONV.FNT");
+ _font_menu = gr_font_load("FONTMENU.FNT");
+ _font_misc = gr_font_load("FONTMISC.FNT");
+}
+
void Globals::woodscript_shutdown() {
ShutdownWSAssets();
ws_Shutdown();
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 2170d089962..db38ffed132 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -53,7 +53,8 @@ private:
void game_systems_initialize(byte flags);
void game_systems_shutdown();
void fire_up_gui();
- bool woodscript_init();
+ bool woodscript_init();
+ void grab_fonts();
void woodscript_shutdown();
public:
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 607abc93f61..995445311f0 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -26,10 +26,13 @@
namespace M4 {
-uint8 gr_pal_get_ega_color(uint8 myColor) {
- error("TODO");
+static const uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+
+constexpr uint8 gr_pal_get_ega_color(uint8 myColor) {
+ return EGAcolors[myColor];
}
+
uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color) {
error("TODO: gr_color_createInverseTable");
}
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 10ba96bcb3c..32d23428c2b 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -43,7 +43,7 @@ namespace M4 {
#define __YELLOW (gr_pal_get_ega_color(14))
#define __WHITE (gr_pal_get_ega_color(15))
-extern uint8 gr_pal_get_ega_color(uint8 myColor);
+extern constexpr uint8 gr_pal_get_ega_color(uint8 myColor);
uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color);
void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
Commit: 86e60f56c4ef614c0e4bffd42d78954604973209
https://github.com/scummvm/scummvm/commit/86e60f56c4ef614c0e4bffd42d78954604973209
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further font initialization
Changed paths:
engines/m4/globals.cpp
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 05a55a49c15..196a6e0f198 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -96,6 +96,9 @@ void Globals::game_systems_initialize(byte flags) {
mem_stash_init(32);
+ _system_font = gr_font_create_system_font();
+ gr_font_set(_system_font);
+
sysfile_init(_kernel.hag_mode);
if (flags & INSTALL_PLAYER_BEEN_INIT) {
Commit: fee9c99b1e4a072f581dc9effed707a67132126b
https://github.com/scummvm/scummvm/commit/fee9c99b1e4a072f581dc9effed707a67132126b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Make BurgerGlobals class with overriden main_cold_data_init
Changed paths:
A engines/m4/burger/burger_globals.cpp
A engines/m4/burger/burger_globals.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 1371fe36e60..1c5285178b5 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -21,10 +21,15 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
+#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
+Globals *BurgerEngine::createGlobals() {
+ return new BurgerGlobals();
+}
+
void BurgerEngine::showEngineInfo() {
debug("Orion Burger\n");
debug("Game Version %s -- %s\n", "Giraffe", "September 27, 1996");
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index b9b8b42ecbd..7c271101a6a 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -28,13 +28,15 @@ namespace M4 {
namespace Burger {
class BurgerEngine : public M4Engine {
+ /**
+ * Creates globals
+ */
+ Globals *createGlobals() override;
+
public:
BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
-
- M4Engine(syst, gameDesc) {
- }
- ~BurgerEngine() override {
- }
+ M4Engine(syst, gameDesc) {}
+ ~BurgerEngine() override {}
/**
* Show the engine information
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
new file mode 100644
index 00000000000..56e9055e541
--- /dev/null
+++ b/engines/m4/burger/burger_globals.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/burger_globals.h"
+
+namespace M4 {
+namespace Burger {
+
+void BurgerGlobals::main_cold_data_init() {
+ // TODO
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
new file mode 100644
index 00000000000..8db6f13a99f
--- /dev/null
+++ b/engines/m4/burger/burger_globals.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_BURGER_GLOBALS_H
+#define M4_BURGER_BURGER_GLOBALS_H
+
+#include "m4/globals.h"
+
+namespace M4 {
+namespace Burger {
+
+class BurgerGlobals : public Globals {
+protected:
+ void main_cold_data_init() override;
+
+public:
+ BurgerGlobals() {}
+ virtual ~BurgerGlobals() {}
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 196a6e0f198..4b75774f8b2 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -79,6 +79,8 @@ bool Globals::init() {
if (!LoadWSAssets("stream script", &_master_palette[0]))
error_show(FL, 'FNF!', "stream script");
+ main_cold_data_init();
+
return true;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index db38ffed132..4f8c591c618 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -57,9 +57,12 @@ private:
void grab_fonts();
void woodscript_shutdown();
+protected:
+ virtual void main_cold_data_init() = 0;
+
public:
Globals();
- ~Globals();
+ virtual ~Globals();
bool init();
GameControl _game;
@@ -73,6 +76,7 @@ public:
Rails_Globals _rails;
Catalog _catalog;
+ bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
Font *_font_tiny_prop = nullptr;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 31c2f3ee0af..bfc73b76096 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -57,15 +57,15 @@ Common::Error M4Engine::run() {
initGraphics(640, 480);
// Instantiate globals and setup
- Globals globals;
+ Globals *globals = createGlobals();
- if (globals.init()) {
+ if (globals->init()) {
// Run game here
warning("TODO: game loop");
}
-
+ delete globals;
return Common::kNoError;
}
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index d1bce0a031f..4863eb02baf 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -49,6 +49,12 @@ private:
protected:
// Engine APIs
Common::Error run() override;
+
+ /**
+ * Creates globals
+ */
+ virtual Globals *createGlobals() = 0;
+
public:
Graphics::Screen *_screen = nullptr;
public:
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ddd7db7cabf..1bd671a4214 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -43,7 +43,8 @@ MODULE_OBJS = \
wscript/ws_machine.o \
wscript/ws_timer.o \
wscript/wscript.o \
- burger/burger.o
+ burger/burger.o \
+ burger/burger_globals.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 43b4e0bdeaf1c372db974621b6babf6a4884dfe0
https://github.com/scummvm/scummvm/commit/43b4e0bdeaf1c372db974621b6babf6a4884dfe0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement full Kernel structure
Changed paths:
engines/m4/kernel.h
engines/m4/param.cpp
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
index df110a5c6e5..daaa8ee8f27 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/kernel.h
@@ -22,22 +22,50 @@
#ifndef M4_KERNEL_H
#define M4_KERNEL_H
+#include "m4/adv_r/adv.h"
+#include "m4/wscript/ws_machine.h"
+
namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
struct Kernel {
- bool hag_mode = true;
- int suppress_cache = CACHE_NOT_OVERRIDE_BY_FLAG_PARSE;
+ uint32 clock = 0; // Current game timing clock
+ int32 trigger = 0; // Game trigger code, if any
+ int32 letter_box_x = 0;
+ int32 letter_box_y = 0;
+ int32 restore_slot = -1;
+ int16 first_non_walker_cel_hash = 0;
+ int16 last_save = 0; // Most recent save slot #
- bool use_log_file = false;
- bool track_open_close = false;
+ char save_file_name[8] = { 0 };
+ bool restore_game = false; // TRUE if we wanna restore
+ bool force_restart = false; // Forces restart of room if true
+ bool teleported_in = false; // Flag if player teleported to room
+
+ int32 fade_up_time = 0;
+ int16 first_fade = 0;
+ bool fading_to_grey = false;
+ bool supress_fadeup = false;
+
+ int32 minPalEntry = 0;
+ int32 maxPalEntry = 0;
+
+ bool going = false; // Game is running OK
+ bool pause = false;
+
+ machine* myWalker = nullptr;
+
+ KernelTriggerType trigger_mode = KT_DAEMON; // trigger was/is invoked in this mode
+ bool call_daemon_every_loop = false;
+ bool continue_handling_trigger = true; // set to True in apps code when trigger is to
+ // be handled by the next layer (scene/section/global daemon code)
+ int suppress_cache = CACHE_NOT_OVERRIDE_BY_FLAG_PARSE;
bool start_up_with_dbg_ws = false;
- bool cheat_keys_enabled = false;
bool use_debug_monitor = false;
- bool restore_game = false;
- int last_save = -1;
- bool teleported_in = false;
+ bool use_log_file = false;
+ bool hag_mode = false;
+ bool track_open_close = false;
size_t mem_avail() const { return 7999999; }
};
diff --git a/engines/m4/param.cpp b/engines/m4/param.cpp
index a33a0efefaa..87eb8f39208 100644
--- a/engines/m4/param.cpp
+++ b/engines/m4/param.cpp
@@ -49,8 +49,8 @@ void parse_all_flags() {
_G(kernel).track_open_close = ConfMan.hasKey("FILECOUNT");
_G(kernel).start_up_with_dbg_ws = ConfMan.hasKey("W");
- _G(kernel).cheat_keys_enabled = ConfMan.hasKey("!");
_G(kernel).use_debug_monitor = ConfMan.hasKey("H");
+ _G(cheat_keys_enabled) = ConfMan.hasKey("!");
if (ConfMan.hasKey("M"))
_G(mem_to_alloc) = ConfMan.getInt("M");
Commit: 67ca6013f206ef0e1060928fca365ea7dcbc178a
https://github.com/scummvm/scummvm/commit/67ca6013f206ef0e1060928fca365ea7dcbc178a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding burget specific cold startup code
Changed paths:
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_mouse.h
engines/m4/gui/gui_vmng.h
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_load.h
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 56e9055e541..50c22c7a1f0 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -19,14 +19,64 @@
*
*/
+#include "common/debug.h"
#include "m4/burger/burger_globals.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/mem/mem.h"
+#include "m4/detection.h"
namespace M4 {
namespace Burger {
+const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
+
void BurgerGlobals::main_cold_data_init() {
// TODO
+ initMouseSeries("cursor", nullptr);
+
+ debugC(1, kDebugCore, "executing - %s", GAME_MODES[_gameMode]);
+
+ // TODO
}
+void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
+ int32 maxW, maxH;
+
+ _mouseSeriesHandle = nullptr;
+ _mouseSeriesOffset = 0;
+ _mouseSeriesPalOffset = 0;
+
+ if (_mouseSprite)
+ _mouseSprite->data = nullptr;
+ if (_mouseBuffer.data)
+ mem_free(_mouseBuffer.data);
+
+ if (LoadSpriteSeries(assetName.c_str(), _mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
+ _mouseSeriesResource = assetName;
+
+ if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
+ if (maxW && maxH) {
+ _mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
+ _mouseBuffer.W = maxW;
+ _mouseBuffer.h = maxH;
+ _mouseBuffer.stride = maxW;
+
+ vmng_screen_show(_mouseScreenSource);
+ ResizeScreen(_mouseScreenSource, maxW, maxH);
+
+ _currMouseNum = -1;
+ _mouseIsLocked = false;
+ mouse_set_sprite(kArrowCursor);
+ }
+ }
+ }
+}
+
+void BurgerGlobals::custom_ascii_converter_proc(char *string) {
+
+}
+
+
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 8db6f13a99f..508c23851bb 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -27,7 +27,17 @@
namespace M4 {
namespace Burger {
+enum GameMode {
+ WHOLE_GAME0 = 0, INTERACTIVE_DEMO = 1, MAGAZINE_DEMO = 2, WHOLE_GAME3 = 3
+};
+
class BurgerGlobals : public Globals {
+private:
+ GameMode _gameMode = WHOLE_GAME3;
+
+ void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
+ void custom_ascii_converter_proc(char *string);
+
protected:
void main_cold_data_init() override;
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index fa7c4b032be..101fdaedaca 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -73,8 +73,7 @@ bool gui_mouse_init() {
return false;
}
- _G(mouseSeriesResource) = NULL;
- _G(mouseSeriesHandle) = NULL;
+ _G(mouseSeriesHandle) = nullptr;
_G(mouseSeriesOffset) = 0;
_G(mouseSeriesPalOffset) = 0;
@@ -86,13 +85,7 @@ void gui_mouse_shutdown() {
gr_buffer_free(&_G(mouseBuffer));
mem_free((void *)_G(mouseScreenSource));
- if (_G(mouseSeriesResource)) {
- rtoss(_G(mouseSeriesResource));
- mem_free(_G(mouseSeriesResource));
- }
-
- _G(mouseSeriesResource) = NULL;
- _G(mouseSeriesHandle) = NULL;
+ _G(mouseSeriesHandle) = nullptr;
_G(mouseSeriesOffset) = 0;
_G(mouseSeriesPalOffset) = 0;
}
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
index 1dd48ac3cac..0e1d7ab8e7b 100644
--- a/engines/m4/gui/gui_mouse.h
+++ b/engines/m4/gui/gui_mouse.h
@@ -36,7 +36,7 @@ struct Mouse_Globals {
transSprite *_mouseScreenSource = nullptr;
Buffer _mouseBuffer; // A scratch buffer used by RedrawMouse()
- char *_mouseSeriesResource = nullptr;
+ Common::String _mouseSeriesResource;
MemHandle _mouseSeriesHandle = nullptr;
int32 _mouseSeriesOffset = 0;
int32 _mouseSeriesPalOffset = 0;
diff --git a/engines/m4/gui/gui_vmng.h b/engines/m4/gui/gui_vmng.h
index e6320dc2ee5..2d09d879f44 100644
--- a/engines/m4/gui/gui_vmng.h
+++ b/engines/m4/gui/gui_vmng.h
@@ -142,6 +142,18 @@ extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
+// Limbo
+extern bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *y2);
+extern bool vmng_SetScreenRefresh(void *scrnContent, RefreshFunc redraw);
+extern bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback);
+extern bool RemoveScreenHotkey(void *scrnContent, int32 myKey);
+extern bool MoveScreenAbs(ScreenContext *myScreen, int32 parmX, int32 parmY);
+extern bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY);
+extern bool ResizeScreen(void *scrnContent, int32 newW, int32 newH);
+extern void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 updateY2);
+extern void RestoreScreensInContext(int32 x1, int32 y1, int32 x2, int32 y2, ScreenContext *myScreen);
+extern void Screen2BuffC(int8 *Buff);
+
// Rectangle routines
extern RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2);
extern void vmng_AddRectToRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index aa834ccc6e5..db51ce87d54 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -33,7 +33,7 @@ static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **return
static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette);
-bool InitWSAssets(void) {
+bool InitWSAssets() {
int32 i;
// Make sure this is only called once.
@@ -504,6 +504,88 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
return mySprite;
}
+int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+ MemHandle workHandle;
+ int32 celsSize, *celsPtr, *palPtr;
+ char *mainAssetPtr, *endOfAssetBlock, *parseAssetPtr;
+ int32 assetSize;
+
+ // This loads a sprite series into the provided vars, rather than the WS tables.
+ // The WS loader is not involved with this procedure.
+
+ // Load in the sprite series
+ if ((workHandle = rget(assetName, &assetSize)) == NULL)
+ error_show(FL, 'FNF!', "Sprite series: %s", assetName);
+
+ HLock(workHandle);
+
+ mainAssetPtr = (char *)*workHandle;
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ parseAssetPtr = mainAssetPtr;
+
+ // Process the SS from the stream file
+ if ((celsSize = ProcessCELS(assetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette)) < 0) {
+ error_show(FL, 'WSLP', "series: %s", assetName);
+ }
+
+ //store the handle and offsets
+ *seriesHandle = workHandle;
+ *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
+ *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+
+ HUnLock(workHandle);
+
+ return celsSize;
+}
+
+int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+ MemHandle workHandle;
+ Common::File f;
+ int32 celsSize, *celsPtr, *palPtr;
+ char *mainAssetPtr, *endOfAssetBlock, *parseAssetPtr;
+ uint32 assetSize;
+
+ // This loads a sprite series into the provided vars, rather than the WS tables.
+ // The WS loader is not involved with this procedure.
+
+ // First open the file
+ if (!f.open(assetName))
+ return -1;
+
+ // Get the file size
+ assetSize = f.size();
+
+ // Create a handle big enough to hold the contents of the file
+ if ((workHandle = NewHandle(assetSize, "ss file")) == nullptr)
+ return -1;
+
+ // Lock the handle and read the contents of the file intoit
+ HLock(workHandle);
+ mainAssetPtr = (char *)*workHandle;
+ if (f.read(mainAssetPtr, assetSize) < assetSize)
+ return -1;
+
+ // Close the file
+ f.close();
+
+ // Set up some pointers
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ parseAssetPtr = mainAssetPtr;
+
+ // Process the SS from the stream file
+ if ((celsSize = ProcessCELS(assetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette)) < 0) {
+ error_show(FL, 'WSLP', "series: %s", assetName);
+ }
+
+ // Store the handle and offsets
+ *seriesHandle = workHandle;
+ *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
+ *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ HUnLock(workHandle);
+
+ return celsSize;
+}
+
static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal) {
// Check to see if we still have an int32 available
if ((endOfAssetBlock - *assetPtr) < 4) {
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
index 844e48b11d1..5490b60650d 100644
--- a/engines/m4/wscript/ws_load.h
+++ b/engines/m4/wscript/ws_load.h
@@ -97,7 +97,7 @@ extern Handle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset,
extern Handle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
extern int32 ws_GetDATACount(uint32 hash);
extern int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data, RGB8 *myPalette);
-extern bool ws_GetSSMaxWH(Handle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
+extern bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
// USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
extern int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
Commit: 6aa4b60032a328bbd85f54edcf9f19671fbe5ab4
https://github.com/scummvm/scummvm/commit/6aa4b60032a328bbd85f54edcf9f19671fbe5ab4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Some Burger initialization code, more VMNG methods
Changed paths:
A engines/m4/gui/gui_vmng_core.cpp
A engines/m4/gui/gui_vmng_core.h
A engines/m4/gui/gui_vmng_rectangles.cpp
A engines/m4/gui/gui_vmng_rectangles.h
A engines/m4/gui/gui_vmng_screen.cpp
A engines/m4/gui/gui_vmng_screen.h
R engines/m4/gui/gui_vmng.cpp
engines/m4/gui/gui_vmng.h
engines/m4/module.mk
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/gui/gui_vmng.cpp b/engines/m4/gui/gui_vmng.cpp
deleted file mode 100644
index 88885ed3ad1..00000000000
--- a/engines/m4/gui/gui_vmng.cpp
+++ /dev/null
@@ -1,688 +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/>.
- *
- */
-
-/**
- * THE GUI:
- * gui_vmng.cpp controls the windowing system. The gui is comprised of layered independent
- * windows. The view manager controls which pieces of each window are visible, and which
- * window receives events. The contents of of the windows, whether they be dialog boxes,
- * buffers, or some new addition has no bearing on the performance of the view manager.
- * Therefore, each window is created with a layer, an event handler, and a redraw function.
- * When the view manager determines that an area of a window needs to be redrawn, it
- * simply calls that window's redraw function. It is up to the redraw function to ensure
- * that the rectangle is properly redrawn. If an event occurs, the view manager will
- * determine which window should handle the event.
- *
- * To recap then, it manages the visual display of each window's current position
- * and relative layer, and when either a keyboard event, or mouse event is registered, which
- * window's evtHandler will be given the event to process. In addition to requesting a
- * window to redraw a portion of itself, or handle an event which has occurred, vmng.cpp
- * also displays the mouse in its current location. Through the use of an off screen bitmap
- * which is an exact duplicate of what is visible on the monitor, the view manager creates
- * a flicker-free graphical display of the mouse and all visible windows.
- *
- * NOTE: FOR MANY OF THE FOLLOWING PROCEDURES, A "void *scrnContent" IS LISTED AMONG THE
- * PARAMETERS. THIS PARAMETER REFERS TO THE STRUCTURE FOR WHICH THE WINDOW WAS CREATED, BE
- * IT A (Buffer*), (Dialog*), (TextScrn*), OR WHATEVER. SINCE THE VIEW MANAGER ONLY
- * REQUESTS WINDOW REFRESHES AND PASSES EVENTS, THE CONTENTS OF THE WINDOW ARE UNKNOWN,
- * AND THEREFORE, ALL ARE STORED AS (void*). FROM NOW ON, THIS WILL BE KNOWN AS THE "WINDOW
- * IDENTIFIER".
- *
- * NOTE: THE TERM "WINDOW" AND THE TERM "SCREEN" ARE COMPLETELY INTERCHANGEABLE DURING
- * THE DOCUMENTATION OF ANY GUI SOURCE CODE.
- *
- * NOTE: ANY PROCEDURE IN THIS FILE WHICH, WHEN EXECUTED, RESULTS IN A VISUAL CHANGE TO
- * THE MONITOR (SUCH AS vmng_screen_show(), or MoveScreen())
- * WILL ALSO RESTORE THE MONITOR'S IMAGE, TAKING CARE OF A VIDEO REFRESH REQUIREMENTS.
- */
-
-#include "m4/gui/gui_vmng.h"
-#include "m4/gui/gui_dialog.h"
-#include "m4/core/errors.h"
-#include "m4/core/imath.h"
-#include "m4/mem/memman.h"
-#include "m4/mem/mem.h"
-#include "m4/globals.h"
-
-namespace M4 {
-
-bool vmng_init() {
- if (_G(vmng_Initted))
- return false;
- _G(vmng_Initted) = true;
-
- _G(frontScreen) = nullptr;
- _G(backScreen) = nullptr;
- _G(inactiveScreens) = nullptr;
-
- if (!mem_register_stash_type(&_G(memtypeSCRN), sizeof(ScreenContext), 32, "+SCRN")) {
- return false;
- }
- if (!mem_register_stash_type(&_G(memtypeMATTE), sizeof(matte), 32, "+guiMATTE")) {
- return false;
- }
- if (!mem_register_stash_type(&_G(memtypeRECT), sizeof(RectList), 256, "+guiRecList")) {
- return false;
- }
-
- return true;
-}
-
-void vmng_shutdown() {
- ScreenContext *myScreen;
- Hotkey *myHotkeys, *tempHotkey;
-
- if (!_G(vmng_Initted))
- return;
- _G(vmng_Initted) = false;
-
- // First, destroy all active windows
- myScreen = _G(frontScreen);
- while (myScreen) {
- _G(frontScreen) = _G(frontScreen)->behind;
- if (myScreen->scrnType == SCRN_DLG) {
- vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
- } else if (myScreen->scrnType == SCRN_TEXT) {
- vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
- }
-
- myHotkeys = myScreen->scrnHotkeys;
- tempHotkey = myHotkeys;
- while (tempHotkey) {
- myHotkeys = myHotkeys->next;
- mem_free(tempHotkey);
- tempHotkey = myHotkeys;
- }
-
- mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
- myScreen = _G(frontScreen);
- }
-
- // Duplicate the above loop exactly for the list of inactive windows
- myScreen = _G(inactiveScreens);
- while (myScreen) {
- _G(inactiveScreens) = _G(inactiveScreens)->behind;
- if (myScreen->scrnType == SCRN_DLG) {
- vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
- } else if (myScreen->scrnType == SCRN_TEXT) {
- vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
- }
- myHotkeys = myScreen->scrnHotkeys;
- tempHotkey = myHotkeys;
- while (tempHotkey) {
- myHotkeys = myHotkeys->next;
- mem_free(tempHotkey);
- //mem_free_to_stash((void*)tempHotkey, memtypeHOTKEY);
- tempHotkey = myHotkeys;
- }
-
- mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
- myScreen = _G(inactiveScreens);
- }
-}
-
-ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
- void *scrnContent, RefreshFunc redraw, EventHandler evtHandler) {
- ScreenContext *myScreen;
-
- if (!_G(vmng_Initted))
- return nullptr;
-
- if ((myScreen = (ScreenContext *)mem_get_from_stash(_G(memtypeSCRN), "+SCRN")) == nullptr)
- return nullptr;
-
- myScreen->x1 = x1;
- myScreen->y1 = y1;
- myScreen->x2 = x2;
- myScreen->y2 = y2;
- myScreen->scrnType = scrnType;
- myScreen->scrnFlags = scrnFlags;
- myScreen->scrnContent = scrnContent;
- myScreen->redraw = redraw;
- myScreen->evtHandler = evtHandler;
- myScreen->scrnHotkeys = nullptr;
-
- if (_G(inactiveScreens))
- _G(inactiveScreens)->infront = myScreen;
-
- myScreen->behind = _G(inactiveScreens);
- myScreen->infront = nullptr;
- _G(inactiveScreens) = myScreen;
- return myScreen;
-}
-
-#define LEFT_EDGE 1
-#define RIGHT_EDGE 2
-
-//--------------------------------------------------------------------------
-RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2) {
- RectList *newRect;
- if ((newRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == NULL) {
- error_show(FL, 'OOS!', "vmng_CreateNewRect");
- }
- newRect->x1 = x1;
- newRect->y1 = y1;
- newRect->x2 = x2;
- newRect->y2 = y2;
- newRect->next = NULL;
- newRect->prev = NULL;
-
- return newRect;
-}
-
-//--------------------------------------------------------------------------
-void vmng_AddRectToRectList(RectList **theRectList, int32 rectX1, int32 rectY1, int32 rectX2, int32 rectY2) {
- RectList *dirtyRect, *dirtyRectList;
- RectList *endCleanRectList, *cleanRectList;
- RectList *myRect, *myRectList;
- RectList *newRect;
- bool intersected;
-
- //first make sure we have a valid rectangle
- if ((rectX1 > rectX2) || (rectY1 > rectY2)) {
- return;
- }
-
- //intialize the dirty rect list
- dirtyRectList = vmng_CreateNewRect(rectX1, rectY1, rectX2, rectY2);
-
- //intialize the clean rectList
- cleanRectList = NULL;
- endCleanRectList = NULL;
-
- //use a local var for theRectlist
- myRectList = *theRectList;
-
- //loop through all the dirtyRects
- dirtyRect = dirtyRectList;
- while (dirtyRect) {
-
- //remove dirtyRect from the head of the dirtyRectList
- dirtyRectList = dirtyRectList->next;
-
- //set the intersected flag
- intersected = false;
-
- //loop on through
- myRect = myRectList;
- while (myRect) {
-
- //if the two rectangles intersect
- if ((dirtyRect->x1 <= myRect->x2) && (dirtyRect->x2 >= myRect->x1) && (dirtyRect->y1 <= myRect->y2) && (dirtyRect->y2 >= myRect->y1)) {
-
- //set the intersected flag
- intersected = true;
-
- //if dirtyRect is not completely contained within myRect
- if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->y1 < myRect->y1) || (dirtyRect->x2 > myRect->x2) || (dirtyRect->y2 > myRect->y2)) {
-
- //first remove it from the list
- if (myRect->prev) {
- myRect->prev->next = myRect->next;
- } else {
- myRectList = myRect->next;
- }
- if (myRect->next) {
- myRect->next->prev = myRect->prev;
- }
-
- //so now there is an intersection.
- //if myRect sticks out above dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
- if (myRect->y1 < dirtyRect->y1) {
- newRect = vmng_CreateNewRect(myRect->x1, myRect->y1, myRect->x2, dirtyRect->y1 - 1);
- newRect->prev = NULL;
- newRect->next = myRectList;
- if (myRectList) {
- myRectList->prev = newRect;
- }
- myRectList = newRect;
-
- //and set the top of myRect to be the same as dirtyRect
- myRect->y1 = dirtyRect->y1;
- }
-
- //else if dirtyRect sticks out above chop it off and put it on the dirty list
- else if (dirtyRect->y1 < myRect->y1) {
- newRect = vmng_CreateNewRect(dirtyRect->x1, dirtyRect->y1, dirtyRect->x2, myRect->y1 - 1);
- newRect->next = dirtyRectList;
- dirtyRectList = newRect;
-
- //and set the top of dirtyRect to be the same as myRect
- dirtyRect->y1 = myRect->y1;
- }
-
- //if myRect sticks out below dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
- if (myRect->y2 > dirtyRect->y2) {
- newRect = vmng_CreateNewRect(myRect->x1, dirtyRect->y2 + 1, myRect->x2, myRect->y2);
- newRect->prev = NULL;
- newRect->next = myRectList;
- if (myRectList) {
- myRectList->prev = newRect;
- }
- myRectList = newRect;
-
- //and set the bottom of myRect to be the same as dirtyRect
- myRect->y2 = dirtyRect->y2;
- }
-
- //else if dirtyRect sticks out below myRect...
- else if (dirtyRect->y2 > myRect->y2) {
- newRect = vmng_CreateNewRect(dirtyRect->x1, myRect->y2 + 1, dirtyRect->x2, dirtyRect->y2);
- newRect->next = dirtyRectList;
- dirtyRectList = newRect;
-
- //and set the bottom of dirtyRect to be the same as myRect
- dirtyRect->y2 = myRect->y2;
- }
-
- //now we've got overlapping rectangles which are the same height. create one max width one
- //if the dirtyRect sticks out on either side, the resulting rect is still dirty, otherwise clean
- if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->x2 > myRect->x2)) {
-
- //use dirtyRect to become the max width rect
- dirtyRect->x1 = imath_min(dirtyRect->x1, myRect->x1);
- dirtyRect->x2 = imath_max(dirtyRect->x2, myRect->x2);
- dirtyRect->next = dirtyRectList;
- dirtyRectList = dirtyRect;
-
- //and turf myRect
- mem_free_to_stash((void *)myRect, _G(memtypeRECT));
- }
-
- //else we can put what's left of myRect onto the clean list and turf dirtyRect
- //note, it is impossible to split the dirtyRect list vertically, they always stretch horizontally,
- //therefore if this dirty rect does not stick out the sides, what's left of myRect is clean
- else {
- myRect->prev = NULL;
- myRect->next = cleanRectList;
- if (cleanRectList) {
- cleanRectList->prev = myRect;
- } else {
- endCleanRectList = myRect;
- }
- cleanRectList = myRect;
-
- mem_free_to_stash((void *)dirtyRect, _G(memtypeRECT));
- }
-
- //exit the loop
- myRect = NULL;
- }
-
- //else through away dirtyRect, and get the next dirtyRect
- else {
- mem_free_to_stash((void *)dirtyRect, _G(memtypeRECT));
- myRect = NULL;
- }
- }
-
- //else get the next rect
- else {
- myRect = myRect->next;
- }
- }
-
- //if we didn't intersect, put the dirtyRect on the clean list
- if (!intersected) {
- dirtyRect->prev = NULL;
- dirtyRect->next = cleanRectList;
- if (cleanRectList) {
- cleanRectList->prev = dirtyRect;
- } else {
- endCleanRectList = dirtyRect;
- }
- cleanRectList = dirtyRect;
- }
-
- //get the next dirty rect
- dirtyRect = dirtyRectList;
- }
-
- //now, just add the clean list onto the dirty list
- if (cleanRectList) {
-
- //now add the entire cleanRectList to the front of myRectList
- endCleanRectList->next = myRectList;
- if (myRectList) {
- myRectList->prev = endCleanRectList;
- }
- myRectList = cleanRectList;
- }
-
- //return the rect list
- *theRectList = myRectList;
-}
-
-//----------------------------------------------------------------------------------------
-RectList *vmng_DuplicateRectList(RectList *myRectList) {
- RectList *newRectList, *tempRect, *myRect, *prevRect;
-
- newRectList = NULL;
- prevRect = NULL;
- myRect = myRectList;
- while (myRect) {
-
- //duplicate myRect and stick it on the newRectList
- if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == NULL) {
- error_show(FL, 'OOS!', "vmng_DuplicateRectList()");
- }
- tempRect->x1 = myRect->x1;
- tempRect->y1 = myRect->y1;
- tempRect->x2 = myRect->x2;
- tempRect->y2 = myRect->y2;
- tempRect->prev = prevRect;
- tempRect->next = NULL;
- if (prevRect) {
- prevRect->next = tempRect;
- } else {
- newRectList = tempRect;
- }
- prevRect = tempRect;
-
- //get the next rectangle
- myRect = myRect->next;
- }
-
- return newRectList;
-}
-
-//----------------------------------------------------------------------------------------
-bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
- RectList *myRect;
- int32 intrX1, intrY1, intrX2, intrY2;
-
- //parameter verification
- if ((!myRectList) || (x1 > x2) || (y1 > y2)) {
- return false;
- }
-
- //loop through the list, and break as soon as there is an intersection
- myRect = myRectList;
- while (myRect) {
-
- //calculate the intersection
- intrX1 = imath_max(myRect->x1, x1);
- intrY1 = imath_max(myRect->y1, y1);
- intrX2 = imath_min(myRect->x2, x2);
- intrY2 = imath_min(myRect->y2, y2);
-
- //if we intersected, return true
- if ((intrX1 <= intrX2) && (intrY1 <= intrY2)) {
- return true;
- }
-
- //else get the next rect in the list
- myRect = myRect->next;
- }
-
- //we made it through the entire list with no intersections - return false
- return false;
-}
-
-//----------------------------------------------------------------------------------------
-bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2) {
- RectList *nextRect, *myRect;
-
- int32 x1, y1, x2, y2;
-
- //loop through myRect list
- myRect = *myRectList;
- while (myRect) {
-
- //set the next rect
- nextRect = myRect->next;
-
- //clip myRect
- x1 = imath_max(myRect->x1, clipX1);
- y1 = imath_max(myRect->y1, clipY1);
- x2 = imath_min(myRect->x2, clipX2);
- y2 = imath_min(myRect->y2, clipY2);
-
- //if we have a valid rectangle
- if ((x1 <= x2) && (y1 <= y2)) {
-
- //clip the rectangle
- myRect->x1 = x1;
- myRect->y1 = y1;
- myRect->x2 = x2;
- myRect->y2 = y2;
- }
-
- //else remove it from the rectList and turf it
- else {
- if (myRect->prev) {
- myRect->prev->next = myRect->next;
- } else {
- *myRectList = myRect->next;
- }
- if (myRect->next) {
- myRect->next->prev = myRect->prev;
- }
- mem_free_to_stash((void *)myRect, _G(memtypeRECT));
- }
-
- //check the next rect
- myRect = nextRect;
- }
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-bool vmng_RectListValid(RectList *myRectList) {
- RectList *myRect, *tempRectList;
-
- myRect = myRectList;
- while (myRect) {
- tempRectList = myRect->next;
- if (vmng_RectIntersectsRectList(tempRectList, myRect->x1, myRect->y1, myRect->x2, myRect->y2)) {
- return false;
- }
- myRect = myRect->next;
- }
- return true;
-}
-
-//----------------------------------------------------------------------------------------
-void vmng_DisposeRectList(RectList **rectList) {
- RectList *myRect;
-
- //loop through the rect list
- myRect = *rectList;
- while (myRect) {
-
- //remove myRect from the head of the list
- *rectList = myRect->next;
-
- //dispose of myRect;
- mem_free_to_stash((void *)myRect, _G(memtypeRECT));
-
- //get the next rectangle
- myRect = *rectList;
- }
-}
-
-//----------------------------------------------------------------------------------------
-void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
- RectList *myRect, *prevRect, *nextRect, *tempRect;
- RectList *rectList, *unsortedRectList;
- int32 tempX1, tempY1, tempX2, tempY2;
- bool finished;
-
- rectList = *scrnRectList;
-
- //go through the rectList list breaking down any rects which intersect the given coords
- unsortedRectList = NULL;
- myRect = rectList;
- while (myRect) {
-
- //set the nextRect pointer
- nextRect = myRect->next;
-
- //check for an intersection
- tempX1 = imath_max(x1, myRect->x1);
- tempY1 = imath_max(y1, myRect->y1);
- tempX2 = imath_min(x2, myRect->x2);
- tempY2 = imath_min(y2, myRect->y2);
-
- //if we have an intersection
- if ((tempX1 <= tempX2) && (tempY1 <= tempY2)) {
-
- //break myRect apart into any pieces not covered by x1, y1, x2, y2
- //top edge
- if (myRect->y1 < y1) {
-
- //create a new rect of just the part that extends beyond the top of myRect
- if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
- error_show(FL, 'OOS!', "vmng_AddRectToRectList");
- }
- tempRect->x1 = myRect->x1;
- tempRect->y1 = myRect->y1;
- tempRect->x2 = myRect->x2;
- tempRect->y2 = y1 - 1;
-
- //add tempRect to the unsortedRectList
- tempRect->next = unsortedRectList;
- unsortedRectList = tempRect;
-
- //update myRect
- myRect->y1 = y1;
- }
-
- //bottom edge
- if (myRect->y2 > y2) {
-
- //create a new rect of just the part that extends beyond the top of myRect
- if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
- error_show(FL, 'OOS!', "vmng_AddRectToRectList");
- }
- tempRect->x1 = myRect->x1;
- tempRect->y1 = y2 + 1;
- tempRect->x2 = myRect->x2;
- tempRect->y2 = myRect->y2;
-
- //add tempRect to the unsortedRectList
- tempRect->next = unsortedRectList;
- unsortedRectList = tempRect;
-
- //update myRect
- myRect->y2 = y2;
- }
-
- //left edge
- if (myRect->x1 < x1) {
-
- //create a new rect of just the part that extends beyond the top of myRect
- if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
- error_show(FL, 'OOS!', "vmng_AddRectToRectList");
- }
- tempRect->x1 = myRect->x1;
- tempRect->y1 = myRect->y1;
- tempRect->x2 = x1 - 1;
- tempRect->y2 = myRect->y2;
-
- //add tempRect to the unsortedRectList
- tempRect->next = unsortedRectList;
- unsortedRectList = tempRect;
- }
-
- //right edge
- if (myRect->x2 > x2) {
-
- //create a new rect of just the part that extends beyond the top of myRect
- if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == NULL) {
- error_show(FL, 'OOS!', "vmng_AddRectToRectList");
- }
- tempRect->x1 = x2 + 1;
- tempRect->y1 = myRect->y1;
- tempRect->x2 = myRect->x2;
- tempRect->y2 = myRect->y2;
-
- //add tempRect to the unsortedRectList
- tempRect->next = unsortedRectList;
- unsortedRectList = tempRect;
- }
-
- //remove myRect from the list and turf it
- if (myRect->next) {
- myRect->next->prev = myRect->prev;
- }
- if (myRect->prev) {
- myRect->prev->next = myRect->next;
- } else {
- rectList = myRect->next;
- }
- mem_free_to_stash((void *)myRect, _G(memtypeRECT));
- }
-
- //get the next rect
- myRect = nextRect;
- }
-
- //now go through the unsorted list and insert them into the main list
- tempRect = unsortedRectList;
- while (tempRect) {
-
- unsortedRectList = unsortedRectList->next;
-
- //for each unsorted rect, loop through the rect list until its place is found
- finished = false;
- prevRect = NULL;
- myRect = rectList;
- while (myRect && (!finished)) {
-
- //if it goes before myRect
- if (tempRect->y2 <= myRect->y2) {
- finished = true;
- } else {
- prevRect = myRect;
- myRect = myRect->next;
- }
- }
-
- //tempRect belongs after prevRect
- if (prevRect) {
- tempRect->prev = prevRect;
- tempRect->next = prevRect->next;
- if (prevRect->next) {
- prevRect->next->prev = tempRect;
- }
- prevRect->next = tempRect;
- }
-
- //else it belongs at the front of rectList
- else {
- tempRect->prev = NULL;
- tempRect->next = rectList;
- if (rectList) {
- rectList->prev = tempRect;
- }
- rectList = tempRect;
- }
-
- //get the next unsorted rect
- tempRect = unsortedRectList;
- }
-
- //set the screen rect list to the resulting rect list
- *scrnRectList = rectList;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng.h b/engines/m4/gui/gui_vmng.h
index 2d09d879f44..7d0277075fb 100644
--- a/engines/m4/gui/gui_vmng.h
+++ b/engines/m4/gui/gui_vmng.h
@@ -25,6 +25,9 @@
#include "m4/m4_types.h"
#include "m4/gui/gui_univ.h"
+#include "m4/gui/gui_vmng_core.h"
+#include "m4/gui/gui_vmng_rectangles.h"
+#include "m4/gui/gui_vmng_screen.h"
namespace M4 {
@@ -59,111 +62,6 @@ enum {
#define SF_DEFAULT SF_DRIFTER | SF_GET_ALL | SF_BLOCK_NONE
#define SF_ALERT SF_FLOATER | SF_GET_ALL | SF_BLOCK_ALL
-/**
- * To initialize the GUI view manager.
- * @returns The success of the call
- * @remarks Should be called once during program initialization,
- * after dpmi_init_mem() has been called.
- */
-extern bool vmng_init();
-
-/**
- * Shutdown the GUI view manager, and release all resources.
- *
- * Since applications can be written in which Dialogs are designed, created, and
- * Their callback procedures are executed by the view manager, it is not always
- * necessary for the application to retain the (Dialog*)s which it created.
- * Therefore, Any windows which contain a (Dialog*) and still exist also destroy
- * The Dialog for which they were created. The same goes for (TextScrn*)s.
- */
-void vmng_shutdown();
-
-/**
- * Create a new window for the identifier given (scrnContent).
- * @param x1 Top left x
- * @param y1 Top left y
- * @param x2 Bottom right x
- * @param y2 Bottom right y
- * @param scrnType One of: SCRN_DLG (Dialog), SCRN_BUF (Buffer),
- * SCRN_TEXT (TextScrn). to identify scrnContent type.
- * @param See the overview at the top of this file for an explanation of scrnFlags.
- * @param scrnContent The identifier for the new window.
- * @param redraw The function pointer which will be called when the view
- * manager requests the window to redraw a portion of itself.
- * @param evtHandler The function pointer call when the view manager
- * determines that an event should be processed by this window.
- * @remarks If TRUE is returned, the window was successfully created, and is currently
- * in the list of inactive windows. A call to vmng_screen_show() will activate
- * (make visible) this window.
- */
-extern ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
- void *scrnContent, RefreshFunc redraw, EventHandler evtHandler);
-
-/**
- * Return the ScreenContext * associated with a window, and to determine whether it is active,
- * exists but is inactive (invisible, no events are received or blocked), or is undefined
- * (does not exist).
- * @param scrnContent The window identifier.
- * @param status If not NULL, the status: SCRN_ACTIVE, SCRN_INACTIVE, or SCRN_UNDEFN
- * is recoreded here.
- * @returns the ScreenContext* associated with the window which was created for
- * the structure scrnContent. returns NULL if now window was found.
- */
-extern ScreenContext *vmng_screen_find(void *scrnContent, int32 *status); // was FindScreen
-
-/**
- * Remove a window from the active list, and place it on the inactive list
- * @param The window identifier
- */
-extern void vmng_screen_hide(void *scrnContent); // was HideScreen
-
-/**
- * Place a window at the front of its layer on the active list.
- * @param scrnContent The window Identifier.
- * @remarks If the window is currently inactive, it will be activated and placed
- * into the list at the front of its layer (SF_BACKGRND, SF_DRIFTER, SF_FLOATER, or SF_SURFACE).
- * If the window is already active, it will be moved to the front of its layer.
- */
-extern void vmng_screen_show(void *scrnContent); // was ShowScreen
-
-/**
- * Place a window at the back of its layer.
- * @param scrnContent The window Identifier.
- * @remarks Essentially this procedure does the same as vmng_screen_show(),
- * the only difference is that the window is at the back of its layer.
- */
-extern void vmng_screen_to_back(void *scrnContent); // was MoveScreenToBack
-
-/**
- * Release all resources associated with the window.
- * @param scrnContent The window Identifier.
- */
-extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
-
-extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
-
-// Limbo
-extern bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *y2);
-extern bool vmng_SetScreenRefresh(void *scrnContent, RefreshFunc redraw);
-extern bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback);
-extern bool RemoveScreenHotkey(void *scrnContent, int32 myKey);
-extern bool MoveScreenAbs(ScreenContext *myScreen, int32 parmX, int32 parmY);
-extern bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY);
-extern bool ResizeScreen(void *scrnContent, int32 newW, int32 newH);
-extern void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 updateY2);
-extern void RestoreScreensInContext(int32 x1, int32 y1, int32 x2, int32 y2, ScreenContext *myScreen);
-extern void Screen2BuffC(int8 *Buff);
-
-// Rectangle routines
-extern RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2);
-extern void vmng_AddRectToRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
-extern RectList *vmng_DuplicateRectList(RectList *myRectList);
-extern bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2);
-extern bool vmng_RectListValid(RectList *myRectList);
-extern bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2);
-extern void vmng_DisposeRectList(RectList **rectList);
-extern void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
-
} // End of namespace M4
#endif
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
new file mode 100644
index 00000000000..fd429bce3c7
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -0,0 +1,300 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * THE GUI:
+ * gui_vmng.cpp controls the windowing system. The gui is comprised of layered independent
+ * windows. The view manager controls which pieces of each window are visible, and which
+ * window receives events. The contents of of the windows, whether they be dialog boxes,
+ * buffers, or some new addition has no bearing on the performance of the view manager.
+ * Therefore, each window is created with a layer, an event handler, and a redraw function.
+ * When the view manager determines that an area of a window needs to be redrawn, it
+ * simply calls that window's redraw function. It is up to the redraw function to ensure
+ * that the rectangle is properly redrawn. If an event occurs, the view manager will
+ * determine which window should handle the event.
+ *
+ * To recap then, it manages the visual display of each window's current position
+ * and relative layer, and when either a keyboard event, or mouse event is registered, which
+ * window's evtHandler will be given the event to process. In addition to requesting a
+ * window to redraw a portion of itself, or handle an event which has occurred, vmng.cpp
+ * also displays the mouse in its current location. Through the use of an off screen bitmap
+ * which is an exact duplicate of what is visible on the monitor, the view manager creates
+ * a flicker-free graphical display of the mouse and all visible windows.
+ *
+ * NOTE: FOR MANY OF THE FOLLOWING PROCEDURES, A "void *scrnContent" IS LISTED AMONG THE
+ * PARAMETERS. THIS PARAMETER REFERS TO THE STRUCTURE FOR WHICH THE WINDOW WAS CREATED, BE
+ * IT A (Buffer*), (Dialog*), (TextScrn*), OR WHATEVER. SINCE THE VIEW MANAGER ONLY
+ * REQUESTS WINDOW REFRESHES AND PASSES EVENTS, THE CONTENTS OF THE WINDOW ARE UNKNOWN,
+ * AND THEREFORE, ALL ARE STORED AS (void*). FROM NOW ON, THIS WILL BE KNOWN AS THE "WINDOW
+ * IDENTIFIER".
+ *
+ * NOTE: THE TERM "WINDOW" AND THE TERM "SCREEN" ARE COMPLETELY INTERCHANGEABLE DURING
+ * THE DOCUMENTATION OF ANY GUI SOURCE CODE.
+ *
+ * NOTE: ANY PROCEDURE IN THIS FILE WHICH, WHEN EXECUTED, RESULTS IN A VISUAL CHANGE TO
+ * THE MONITOR (SUCH AS vmng_screen_show(), or MoveScreen())
+ * WILL ALSO RESTORE THE MONITOR'S IMAGE, TAKING CARE OF A VIDEO REFRESH REQUIREMENTS.
+ */
+
+#include "m4/gui/gui_vmng.h"
+#include "m4/gui/gui_dialog.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/mem/memman.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static ScreenContext *ExtractScreen(void *scrnContent, int32 status);
+
+bool vmng_init() {
+ if (_G(vmng_Initted))
+ return false;
+ _G(vmng_Initted) = true;
+
+ _G(frontScreen) = nullptr;
+ _G(backScreen) = nullptr;
+ _G(inactiveScreens) = nullptr;
+
+ if (!mem_register_stash_type(&_G(memtypeSCRN), sizeof(ScreenContext), 32, "+SCRN")) {
+ return false;
+ }
+ if (!mem_register_stash_type(&_G(memtypeMATTE), sizeof(matte), 32, "+guiMATTE")) {
+ return false;
+ }
+ if (!mem_register_stash_type(&_G(memtypeRECT), sizeof(RectList), 256, "+guiRecList")) {
+ return false;
+ }
+
+ return true;
+}
+
+void vmng_shutdown() {
+ ScreenContext *myScreen;
+ Hotkey *myHotkeys, *tempHotkey;
+
+ if (!_G(vmng_Initted))
+ return;
+ _G(vmng_Initted) = false;
+
+ // First, destroy all active windows
+ myScreen = _G(frontScreen);
+ while (myScreen) {
+ _G(frontScreen) = _G(frontScreen)->behind;
+ if (myScreen->scrnType == SCRN_DLG) {
+ vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
+ } else if (myScreen->scrnType == SCRN_TEXT) {
+ vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
+ }
+
+ myHotkeys = myScreen->scrnHotkeys;
+ tempHotkey = myHotkeys;
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ tempHotkey = myHotkeys;
+ }
+
+ mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
+ myScreen = _G(frontScreen);
+ }
+
+ // Duplicate the above loop exactly for the list of inactive windows
+ myScreen = _G(inactiveScreens);
+ while (myScreen) {
+ _G(inactiveScreens) = _G(inactiveScreens)->behind;
+ if (myScreen->scrnType == SCRN_DLG) {
+ vmng_Dialog_Destroy((Dialog *)myScreen->scrnContent);
+ } else if (myScreen->scrnType == SCRN_TEXT) {
+ vmng_TextScrn_Destroy((TextScrn *)myScreen->scrnContent);
+ }
+ myHotkeys = myScreen->scrnHotkeys;
+ tempHotkey = myHotkeys;
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ //mem_free_to_stash((void*)tempHotkey, memtypeHOTKEY);
+ tempHotkey = myHotkeys;
+ }
+
+ mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
+ myScreen = _G(inactiveScreens);
+ }
+}
+
+ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
+ void *scrnContent, RefreshFunc redraw, EventHandler evtHandler) {
+ ScreenContext *myScreen;
+
+ if (!_G(vmng_Initted))
+ return nullptr;
+
+ if ((myScreen = (ScreenContext *)mem_get_from_stash(_G(memtypeSCRN), "+SCRN")) == nullptr)
+ return nullptr;
+
+ myScreen->x1 = x1;
+ myScreen->y1 = y1;
+ myScreen->x2 = x2;
+ myScreen->y2 = y2;
+ myScreen->scrnType = scrnType;
+ myScreen->scrnFlags = scrnFlags;
+ myScreen->scrnContent = scrnContent;
+ myScreen->redraw = redraw;
+ myScreen->evtHandler = evtHandler;
+ myScreen->scrnHotkeys = nullptr;
+
+ if (_G(inactiveScreens))
+ _G(inactiveScreens)->infront = myScreen;
+
+ myScreen->behind = _G(inactiveScreens);
+ myScreen->infront = nullptr;
+ _G(inactiveScreens) = myScreen;
+ return myScreen;
+}
+
+void vmng_screen_show(void *scrnContent) {
+ ScreenContext *myScreen, *tempScreen;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == nullptr)
+ return;
+
+ if (!_G(frontScreen)) {
+ myScreen->infront = nullptr;
+ myScreen->behind = nullptr;
+ _G(frontScreen) = myScreen;
+ _G(backScreen) = myScreen;
+
+ } else {
+ tempScreen = _G(frontScreen);
+ while (tempScreen &&
+ ((tempScreen->scrnFlags & SF_LAYER) > (myScreen->scrnFlags & SF_LAYER))) {
+ tempScreen = tempScreen->behind;
+ }
+ if (!tempScreen) {
+ myScreen->behind = nullptr;
+ myScreen->infront = _G(backScreen);
+ _G(backScreen)->behind = myScreen;
+ _G(backScreen) = myScreen;
+ } else if (tempScreen == _G(frontScreen)) {
+ myScreen->behind = _G(frontScreen);
+ myScreen->infront = nullptr;
+ _G(frontScreen)->infront = myScreen;
+ _G(frontScreen) = myScreen;
+ } else {
+ myScreen->behind = tempScreen;
+ myScreen->infront = tempScreen->infront;
+ tempScreen->infront = myScreen;
+ myScreen->infront->behind = myScreen;
+ }
+ }
+
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+}
+
+ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
+ ScreenContext *myScreen;
+ int32 myStatus = SCRN_ACTIVE;
+
+ if (!_G(vmng_Initted))
+ return nullptr;
+
+ myScreen = _G(frontScreen);
+
+ while (myScreen && (myScreen->scrnContent != scrnContent))
+ myScreen = myScreen->behind;
+
+ if (!myScreen) {
+ myStatus = SCRN_INACTIVE;
+ myScreen = _G(inactiveScreens);
+ while (myScreen && (myScreen->scrnContent != scrnContent))
+ myScreen = myScreen->behind;
+ }
+
+ if (status) {
+ if (myScreen)
+ *status = myStatus;
+ else
+ *status = SCRN_UNDEFN;
+ }
+
+ return myScreen;
+}
+
+/**
+ * Remove the window from either the active list of windows, or the inactive list,
+ * wherever it was found.
+ */
+static ScreenContext *ExtractScreen(void *scrnContent, int32 status) {
+ ScreenContext *myScreen = nullptr, *tempScreen;
+ if (!_G(vmng_Initted))
+ return nullptr;
+
+ if ((status == SCRN_ANY) || (status == SCRN_ACTIVE)) {
+ // Search the active list, and remove the window if it is found
+ myScreen = _G(frontScreen);
+
+ while (myScreen && (myScreen->scrnContent != scrnContent))
+ myScreen = myScreen->behind;
+
+ if (myScreen) {
+ if (myScreen == _G(frontScreen)) {
+ if (myScreen == _G(backScreen)) {
+ _G(frontScreen) = nullptr;
+ _G(backScreen) = nullptr;
+ } else {
+ _G(frontScreen) = _G(frontScreen)->behind;
+ _G(frontScreen)->infront = nullptr;
+ }
+ } else {
+ tempScreen = myScreen->infront;
+ tempScreen->behind = myScreen->behind;
+ if (tempScreen->behind)
+ tempScreen->behind->infront = tempScreen;
+ else
+ _G(backScreen) = tempScreen;
+ }
+ }
+ }
+
+ if (((status == SCRN_ANY) && (!myScreen)) || (status == SCRN_INACTIVE)) {
+ // Search the inactive list and remove the window if it is found
+ myScreen = _G(inactiveScreens);
+ while (myScreen && (myScreen->scrnContent != scrnContent))
+ myScreen = myScreen->behind;
+
+ if (myScreen) {
+ if (myScreen == _G(inactiveScreens)) {
+ _G(inactiveScreens) = _G(inactiveScreens)->behind;
+ if (_G(inactiveScreens))
+ _G(inactiveScreens)->infront = nullptr;
+
+ } else {
+ tempScreen = myScreen->infront;
+ tempScreen->behind = myScreen->behind;
+ if (tempScreen->behind) tempScreen->behind->infront = tempScreen;
+ }
+ }
+ }
+
+ return myScreen;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng_core.h b/engines/m4/gui/gui_vmng_core.h
new file mode 100644
index 00000000000..6ad3ad89d6b
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_core.h
@@ -0,0 +1,116 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_VMNG_CORE_H
+#define M4_GUI_GUI_VMNG_CORE_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+/**
+ * To initialize the GUI view manager.
+ * @returns The success of the call
+ * @remarks Should be called once during program initialization,
+ * after dpmi_init_mem() has been called.
+ */
+extern bool vmng_init();
+
+/**
+ * Shutdown the GUI view manager, and release all resources.
+ *
+ * Since applications can be written in which Dialogs are designed, created, and
+ * Their callback procedures are executed by the view manager, it is not always
+ * necessary for the application to retain the (Dialog*)s which it created.
+ * Therefore, Any windows which contain a (Dialog*) and still exist also destroy
+ * The Dialog for which they were created. The same goes for (TextScrn*)s.
+ */
+void vmng_shutdown();
+
+/**
+ * Create a new window for the identifier given (scrnContent).
+ * @param x1 Top left x
+ * @param y1 Top left y
+ * @param x2 Bottom right x
+ * @param y2 Bottom right y
+ * @param scrnType One of: SCRN_DLG (Dialog), SCRN_BUF (Buffer),
+ * SCRN_TEXT (TextScrn). to identify scrnContent type.
+ * @param See the overview at the top of this file for an explanation of scrnFlags.
+ * @param scrnContent The identifier for the new window.
+ * @param redraw The function pointer which will be called when the view
+ * manager requests the window to redraw a portion of itself.
+ * @param evtHandler The function pointer call when the view manager
+ * determines that an event should be processed by this window.
+ * @remarks If TRUE is returned, the window was successfully created, and is currently
+ * in the list of inactive windows. A call to vmng_screen_show() will activate
+ * (make visible) this window.
+ */
+extern ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32 scrnType, uint32 scrnFlags,
+ void *scrnContent, RefreshFunc redraw, EventHandler evtHandler);
+
+/**
+ * Return the ScreenContext * associated with a window, and to determine whether it is active,
+ * exists but is inactive (invisible, no events are received or blocked), or is undefined
+ * (does not exist).
+ * @param scrnContent The window identifier.
+ * @param status If not NULL, the status: SCRN_ACTIVE, SCRN_INACTIVE, or SCRN_UNDEFN
+ * is recoreded here.
+ * @returns the ScreenContext* associated with the window which was created for
+ * the structure scrnContent. returns NULL if now window was found.
+ */
+extern ScreenContext *vmng_screen_find(void *scrnContent, int32 *status); // was FindScreen
+
+/**
+ * Remove a window from the active list, and place it on the inactive list
+ * @param The window identifier
+ */
+extern void vmng_screen_hide(void *scrnContent); // was HideScreen
+
+/**
+ * Place a window at the front of its layer on the active list.
+ * @param scrnContent The window Identifier.
+ * @remarks If the window is currently inactive, it will be activated and placed
+ * into the list at the front of its layer (SF_BACKGRND, SF_DRIFTER, SF_FLOATER, or SF_SURFACE).
+ * If the window is already active, it will be moved to the front of its layer.
+ */
+extern void vmng_screen_show(void *scrnContent); // was ShowScreen
+
+/**
+ * Place a window at the back of its layer.
+ * @param scrnContent The window Identifier.
+ * @remarks Essentially this procedure does the same as vmng_screen_show(),
+ * the only difference is that the window is at the back of its layer.
+ */
+extern void vmng_screen_to_back(void *scrnContent); // was MoveScreenToBack
+
+/**
+ * Release all resources associated with the window.
+ * @param scrnContent The window Identifier.
+ */
+extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
+
+extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_vmng_rectangles.cpp b/engines/m4/gui/gui_vmng_rectangles.cpp
new file mode 100644
index 00000000000..170baf7768f
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_rectangles.cpp
@@ -0,0 +1,521 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_vmng_rectangles.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/mem/mem.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+
+#define LEFT_EDGE 1
+#define RIGHT_EDGE 2
+
+RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *newRect;
+ if ((newRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_CreateNewRect");
+ }
+
+ newRect->x1 = x1;
+ newRect->y1 = y1;
+ newRect->x2 = x2;
+ newRect->y2 = y2;
+ newRect->next = nullptr;
+ newRect->prev = nullptr;
+
+ return newRect;
+}
+
+void vmng_AddRectToRectList(RectList **theRectList, int32 rectX1, int32 rectY1, int32 rectX2, int32 rectY2) {
+ RectList *dirtyRect, *dirtyRectList;
+ RectList *endCleanRectList, *cleanRectList;
+ RectList *myRect, *myRectList;
+ RectList *newRect;
+ bool intersected;
+
+ // First make sure we have a valid rectangle
+ if ((rectX1 > rectX2) || (rectY1 > rectY2)) {
+ return;
+ }
+
+ // Intialize the dirty rect list
+ dirtyRectList = vmng_CreateNewRect(rectX1, rectY1, rectX2, rectY2);
+
+ // Intialize the clean rectList
+ cleanRectList = nullptr;
+ endCleanRectList = nullptr;
+
+ // Use a local var for theRectlist
+ myRectList = *theRectList;
+
+ // Loop through all the dirtyRects
+ dirtyRect = dirtyRectList;
+ while (dirtyRect) {
+ // Remove dirtyRect from the head of the dirtyRectList
+ dirtyRectList = dirtyRectList->next;
+
+ // Set the intersected flag
+ intersected = false;
+
+ // Loop on through
+ myRect = myRectList;
+ while (myRect) {
+
+ // If the two rectangles intersect
+ if ((dirtyRect->x1 <= myRect->x2) && (dirtyRect->x2 >= myRect->x1) && (dirtyRect->y1 <= myRect->y2) && (dirtyRect->y2 >= myRect->y1)) {
+ // Set the intersected flag
+ intersected = true;
+
+ // If dirtyRect is not completely contained within myRect
+ if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->y1 < myRect->y1) || (dirtyRect->x2 > myRect->x2) || (dirtyRect->y2 > myRect->y2)) {
+
+ // First remove it from the list
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ myRectList = myRect->next;
+ }
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+
+ // So now there is an intersection.
+ // If myRect sticks out above dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
+ if (myRect->y1 < dirtyRect->y1) {
+ newRect = vmng_CreateNewRect(myRect->x1, myRect->y1, myRect->x2, dirtyRect->y1 - 1);
+ newRect->prev = nullptr;
+ newRect->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = newRect;
+ }
+ myRectList = newRect;
+
+ // And set the top of myRect to be the same as dirtyRect
+ myRect->y1 = dirtyRect->y1;
+ } else if (dirtyRect->y1 < myRect->y1) {
+ // else if dirtyRect sticks out above chop it off and put it on the dirty list
+ newRect = vmng_CreateNewRect(dirtyRect->x1, dirtyRect->y1, dirtyRect->x2, myRect->y1 - 1);
+ newRect->next = dirtyRectList;
+ dirtyRectList = newRect;
+
+ // and set the top of dirtyRect to be the same as myRect
+ dirtyRect->y1 = myRect->y1;
+ }
+
+ // If myRect sticks out below dirtyRect, chop it off and put it in the main rect list, to be recheck by other dirty rects
+ if (myRect->y2 > dirtyRect->y2) {
+ newRect = vmng_CreateNewRect(myRect->x1, dirtyRect->y2 + 1, myRect->x2, myRect->y2);
+ newRect->prev = nullptr;
+ newRect->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = newRect;
+ }
+ myRectList = newRect;
+
+ // and set the bottom of myRect to be the same as dirtyRect
+ myRect->y2 = dirtyRect->y2;
+ } else if (dirtyRect->y2 > myRect->y2) {
+ //else if dirtyRect sticks out below myRect...
+ newRect = vmng_CreateNewRect(dirtyRect->x1, myRect->y2 + 1, dirtyRect->x2, dirtyRect->y2);
+ newRect->next = dirtyRectList;
+ dirtyRectList = newRect;
+
+ // and set the bottom of dirtyRect to be the same as myRect
+ dirtyRect->y2 = myRect->y2;
+ }
+
+ // Now we've got overlapping rectangles which are the same height. create one max width one
+ // If the dirtyRect sticks out on either side, the resulting rect is still dirty, otherwise clean
+ if ((dirtyRect->x1 < myRect->x1) || (dirtyRect->x2 > myRect->x2)) {
+
+ // Use dirtyRect to become the max width rect
+ dirtyRect->x1 = imath_min(dirtyRect->x1, myRect->x1);
+ dirtyRect->x2 = imath_max(dirtyRect->x2, myRect->x2);
+ dirtyRect->next = dirtyRectList;
+ dirtyRectList = dirtyRect;
+
+ // And turf myRect
+ mem_free_to_stash(myRect, _G(memtypeRECT));
+ } else {
+ // Else we can put what's left of myRect onto the clean list and turf dirtyRect
+ // Note: it is impossible to split the dirtyRect list vertically, they always stretch horizontally,
+ // therefore if this dirty rect does not stick out the sides, what's left of myRect is clean
+ myRect->prev = nullptr;
+ myRect->next = cleanRectList;
+ if (cleanRectList) {
+ cleanRectList->prev = myRect;
+ } else {
+ endCleanRectList = myRect;
+ }
+ cleanRectList = myRect;
+
+ mem_free_to_stash((void *)dirtyRect, _G(memtypeRECT));
+ }
+
+ // Exit the loop
+ myRect = nullptr;
+ } else {
+ // else through away dirtyRect, and get the next dirtyRect
+ mem_free_to_stash(dirtyRect, _G(memtypeRECT));
+ myRect = nullptr;
+ }
+ }
+
+ //else get the next rect
+ else {
+ myRect = myRect->next;
+ }
+ }
+
+ //if we didn't intersect, put the dirtyRect on the clean list
+ if (!intersected) {
+ dirtyRect->prev = nullptr;
+ dirtyRect->next = cleanRectList;
+ if (cleanRectList) {
+ cleanRectList->prev = dirtyRect;
+ } else {
+ endCleanRectList = dirtyRect;
+ }
+ cleanRectList = dirtyRect;
+ }
+
+ //get the next dirty rect
+ dirtyRect = dirtyRectList;
+ }
+
+ //now, just add the clean list onto the dirty list
+ if (cleanRectList) {
+
+ //now add the entire cleanRectList to the front of myRectList
+ endCleanRectList->next = myRectList;
+ if (myRectList) {
+ myRectList->prev = endCleanRectList;
+ }
+ myRectList = cleanRectList;
+ }
+
+ // Return the rect list
+ *theRectList = myRectList;
+}
+
+RectList *vmng_DuplicateRectList(RectList *myRectList) {
+ RectList *newRectList, *tempRect, *myRect, *prevRect;
+
+ newRectList = nullptr;
+ prevRect = nullptr;
+ myRect = myRectList;
+ while (myRect) {
+
+ // Duplicate myRect and stick it on the newRectList
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectList")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_DuplicateRectList()");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+ tempRect->prev = prevRect;
+ tempRect->next = nullptr;
+ if (prevRect) {
+ prevRect->next = tempRect;
+ } else {
+ newRectList = tempRect;
+ }
+ prevRect = tempRect;
+
+ //get the next rectangle
+ myRect = myRect->next;
+ }
+
+ return newRectList;
+}
+
+bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *myRect;
+ int32 intrX1, intrY1, intrX2, intrY2;
+
+ // Parameter verification
+ if ((!myRectList) || (x1 > x2) || (y1 > y2)) {
+ return false;
+ }
+
+ // Loop through the list, and break as soon as there is an intersection
+ myRect = myRectList;
+ while (myRect) {
+ // Calculate the intersection
+ intrX1 = imath_max(myRect->x1, x1);
+ intrY1 = imath_max(myRect->y1, y1);
+ intrX2 = imath_min(myRect->x2, x2);
+ intrY2 = imath_min(myRect->y2, y2);
+
+ // If we intersected, return true
+ if ((intrX1 <= intrX2) && (intrY1 <= intrY2)) {
+ return true;
+ }
+
+ // else get the next rect in the list
+ myRect = myRect->next;
+ }
+
+ // We made it through the entire list with no intersections - return false
+ return false;
+}
+
+bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2) {
+ RectList *nextRect, *myRect;
+ int32 x1, y1, x2, y2;
+
+ // Loop through myRect list
+ myRect = *myRectList;
+ while (myRect) {
+
+ // Set the next rect
+ nextRect = myRect->next;
+
+ // Clip myRect
+ x1 = imath_max(myRect->x1, clipX1);
+ y1 = imath_max(myRect->y1, clipY1);
+ x2 = imath_min(myRect->x2, clipX2);
+ y2 = imath_min(myRect->y2, clipY2);
+
+ // If we have a valid rectangle
+ if ((x1 <= x2) && (y1 <= y2)) {
+ // Clip the rectangle
+ myRect->x1 = x1;
+ myRect->y1 = y1;
+ myRect->x2 = x2;
+ myRect->y2 = y2;
+ } else {
+ // Else remove it from the rectList and turf it
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ *myRectList = myRect->next;
+ }
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+ }
+
+ // Check the next rect
+ myRect = nextRect;
+ }
+
+ return true;
+}
+
+bool vmng_RectListValid(RectList *myRectList) {
+ RectList *myRect, *tempRectList;
+
+ myRect = myRectList;
+ while (myRect) {
+ tempRectList = myRect->next;
+ if (vmng_RectIntersectsRectList(tempRectList, myRect->x1, myRect->y1, myRect->x2, myRect->y2)) {
+ return false;
+ }
+ myRect = myRect->next;
+ }
+
+ return true;
+}
+
+void vmng_DisposeRectList(RectList **rectList) {
+ RectList *myRect;
+
+ // Loop through the rect list
+ myRect = *rectList;
+ while (myRect) {
+ // Remove myRect from the head of the list
+ *rectList = myRect->next;
+
+ // Dispose of myRect;
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+
+ // Get the next rectangle
+ myRect = *rectList;
+ }
+}
+
+void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2) {
+ RectList *myRect, *prevRect, *nextRect, *tempRect;
+ RectList *rectList, *unsortedRectList;
+ int32 tempX1, tempY1, tempX2, tempY2;
+ bool finished;
+
+ rectList = *scrnRectList;
+
+ // Go through the rectList list breaking down any rects which intersect the given coords
+ unsortedRectList = nullptr;
+ myRect = rectList;
+
+ while (myRect) {
+ // Set the nextRect pointer
+ nextRect = myRect->next;
+
+ // Check for an intersection
+ tempX1 = imath_max(x1, myRect->x1);
+ tempY1 = imath_max(y1, myRect->y1);
+ tempX2 = imath_min(x2, myRect->x2);
+ tempY2 = imath_min(y2, myRect->y2);
+
+ // If we have an intersection
+ if ((tempX1 <= tempX2) && (tempY1 <= tempY2)) {
+ // Break myRect apart into any pieces not covered by x1, y1, x2, y2
+ // Top edge
+ if (myRect->y1 < y1) {
+ // Create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = y1 - 1;
+
+ // Add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+
+ // Update myRect
+ myRect->y1 = y1;
+ }
+
+ // Bottom edge
+ if (myRect->y2 > y2) {
+ // Create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = y2 + 1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+
+ // Add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+
+ // Update myRect
+ myRect->y2 = y2;
+ }
+
+ // Left edge
+ if (myRect->x1 < x1) {
+ // Create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+ tempRect->x1 = myRect->x1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = x1 - 1;
+ tempRect->y2 = myRect->y2;
+
+ // Add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+ }
+
+ // Right edge
+ if (myRect->x2 > x2) {
+ // Create a new rect of just the part that extends beyond the top of myRect
+ if ((tempRect = (RectList *)mem_get_from_stash(_G(memtypeRECT), "+guiRectangle")) == nullptr) {
+ error_show(FL, 'OOS!', "vmng_AddRectToRectList");
+ }
+
+ tempRect->x1 = x2 + 1;
+ tempRect->y1 = myRect->y1;
+ tempRect->x2 = myRect->x2;
+ tempRect->y2 = myRect->y2;
+
+ // Add tempRect to the unsortedRectList
+ tempRect->next = unsortedRectList;
+ unsortedRectList = tempRect;
+ }
+
+ // Remove myRect from the list and turf it
+ if (myRect->next) {
+ myRect->next->prev = myRect->prev;
+ }
+ if (myRect->prev) {
+ myRect->prev->next = myRect->next;
+ } else {
+ rectList = myRect->next;
+ }
+
+ mem_free_to_stash((void *)myRect, _G(memtypeRECT));
+ }
+
+ // Get the next rect
+ myRect = nextRect;
+ }
+
+ // Now go through the unsorted list and insert them into the main list
+ tempRect = unsortedRectList;
+ while (tempRect) {
+ unsortedRectList = unsortedRectList->next;
+ // For each unsorted rect, loop through the rect list until its place is found
+ finished = false;
+ prevRect = nullptr;
+ myRect = rectList;
+
+ while (myRect && (!finished)) {
+ // If it goes before myRect
+ if (tempRect->y2 <= myRect->y2) {
+ finished = true;
+ } else {
+ prevRect = myRect;
+ myRect = myRect->next;
+ }
+ }
+
+ // tempRect belongs after prevRect
+ if (prevRect) {
+ tempRect->prev = prevRect;
+ tempRect->next = prevRect->next;
+ if (prevRect->next) {
+ prevRect->next->prev = tempRect;
+ }
+ prevRect->next = tempRect;
+ } else {
+ // else it belongs at the front of rectList
+ tempRect->prev = nullptr;
+ tempRect->next = rectList;
+ if (rectList) {
+ rectList->prev = tempRect;
+ }
+ rectList = tempRect;
+ }
+
+ // Get the next unsorted rect
+ tempRect = unsortedRectList;
+ }
+
+ // Set the screen rect list to the resulting rect list
+ *scrnRectList = rectList;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng_rectangles.h b/engines/m4/gui/gui_vmng_rectangles.h
new file mode 100644
index 00000000000..7a1a2c5e1f4
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_rectangles.h
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_VMNG_RECTANGLES_H
+#define M4_GUI_GUI_VMNG_RECTANGLES_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+extern RectList *vmng_CreateNewRect(int32 x1, int32 y1, int32 x2, int32 y2);
+extern void vmng_AddRectToRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+extern RectList *vmng_DuplicateRectList(RectList *myRectList);
+extern bool vmng_RectIntersectsRectList(RectList *myRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+extern bool vmng_RectListValid(RectList *myRectList);
+extern bool vmng_ClipRectList(RectList **myRectList, int32 clipX1, int32 clipY1, int32 clipX2, int32 clipY2);
+extern void vmng_DisposeRectList(RectList **rectList);
+extern void vmng_RemoveRectFromRectList(RectList **scrnRectList, int32 x1, int32 y1, int32 x2, int32 y2);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
new file mode 100644
index 00000000000..7a227dcc152
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -0,0 +1,194 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/system.h"
+#include "common/rect.h"
+#include "graphics/surface.h"
+#include "m4/gui/gui_vmng_screen.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2);
+
+bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *y2) {
+ ScreenContext *myScreen;
+ if ((myScreen = vmng_screen_find(scrnContent, nullptr)) == nullptr)
+ return false;
+
+ if (x1)
+ *x1 = myScreen->x1;
+ if (y1)
+ *y1 = myScreen->y1;
+ if (x2)
+ *x2 = myScreen->x2;
+ if (y2)
+ *y2 = myScreen->y2;
+
+ return true;
+}
+
+void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 updateY2) {
+ ScreenContext *myScreen, *tempScreen;
+ RectList *updateRectList, *scrnUpdateList, *tempRect;
+
+ if (!_G(vmng_Initted) || _G(system_shutting_down)) {
+ return;
+ }
+
+ // Clip to screen
+ if (updateX1 < MIN_VIDEO_X)
+ updateX1 = MIN_VIDEO_X;
+ if (updateY1 < MIN_VIDEO_Y)
+ updateY1 = MIN_VIDEO_Y;
+ if (updateX2 > MAX_VIDEO_X)
+ updateX2 = MAX_VIDEO_X;
+ if (updateY2 > MAX_VIDEO_Y)
+ updateY2 = MAX_VIDEO_Y;
+
+ // Throw away inside out rectangles
+ if ((updateX2 < updateX1) || (updateY2 < updateY1)) {
+ return;
+ }
+
+ // Create a master updateRectList - when this list is empty, the screen has been redrawn
+ updateRectList = vmng_CreateNewRect(updateX1, updateY1, updateX2, updateY2);
+
+ // First loop through the screens back to front, drawing only the transparent screens
+ myScreen = _G(backScreen);
+
+ while (myScreen && updateRectList) {
+ // We only draw transparent screens on the first pass
+ if ((myScreen->scrnFlags & SF_TRANSPARENT) && myScreen->redraw) {
+ // Duplicate the updateRectList
+ scrnUpdateList = vmng_DuplicateRectList(updateRectList);
+
+ // Now clip the scrnUpdateList with the coordinates of myScreen, see if there is anything visible
+ vmng_ClipRectList(&scrnUpdateList, myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+
+ // Now remove the rects of all screens blocking the scrnUpdateList
+ tempScreen = myScreen->infront;
+
+ while (scrnUpdateList && tempScreen) {
+ vmng_RemoveRectFromRectList(&scrnUpdateList, tempScreen->x1, tempScreen->y1, tempScreen->x2, tempScreen->y2);
+ tempScreen = tempScreen->infront;
+ }
+
+ // If there is anything left of the scrnUpdateList, redraw it
+ if (scrnUpdateList) {
+ (myScreen->redraw)((void *)myScreen, (void *)scrnUpdateList, nullptr, 0, 0);
+
+ // Now remove all the updated rects from the updateRectList
+ tempRect = scrnUpdateList;
+ while (tempRect && updateRectList) {
+ vmng_RemoveRectFromRectList(&updateRectList, tempRect->x1, tempRect->y1, tempRect->x2, tempRect->y2);
+ tempRect = tempRect->next;
+ }
+
+ // Now turf the scrnUpdateList
+ vmng_DisposeRectList(&scrnUpdateList);
+ }
+ }
+
+ // Get the next screen
+ myScreen = myScreen->infront;
+ }
+
+ // Now, draw from front to back the non-transparent screens. This way, we can detect when the entire update region has been
+ // filled, however, if one transparent screen is infront of another, the back transparent screen must be drawn first.
+ myScreen = _G(frontScreen);
+ while (myScreen && updateRectList) {
+ // Make sure it isn't a transparent screen
+ if (!(myScreen->scrnFlags & SF_TRANSPARENT) && myScreen->redraw) {
+ // Duplicate the updateRectList
+ scrnUpdateList = vmng_DuplicateRectList(updateRectList);
+ // Now clip the scrnUpdateList with the coordinates of myScreen, see what has to be redrawn
+ vmng_ClipRectList(&scrnUpdateList, myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+
+ // If there is anything visible, redraw it
+ if (scrnUpdateList) {
+ myScreen->redraw((void *)myScreen, (void *)scrnUpdateList, nullptr, 0, 0);
+
+ // Now remove all the updated rects from the updateRectList
+ tempRect = scrnUpdateList;
+ while (tempRect && updateRectList) {
+ vmng_RemoveRectFromRectList(&updateRectList, tempRect->x1, tempRect->y1, tempRect->x2, tempRect->y2);
+ tempRect = tempRect->next;
+ }
+
+ // Now turf the scrnUpdateList
+ vmng_DisposeRectList(&scrnUpdateList);
+ }
+ }
+
+ // Get the next screen
+ myScreen = myScreen->behind;
+ }
+
+ // Now, if there is anything left, it should be filled in with black
+ if (updateRectList) {
+
+ tempRect = updateRectList;
+ while (tempRect) {
+ vmng_black_out_video(tempRect->x1, tempRect->y1, tempRect->x2, tempRect->y2);
+ tempRect = tempRect->next;
+ }
+
+ // Now turf the updateRectList
+ vmng_DisposeRectList(&updateRectList);
+ }
+}
+
+bool ResizeScreen(void *scrnContent, int32 newW, int32 newH) {
+ ScreenContext *myScreen;
+ int32 status, oldX2, oldY2;
+
+ if ((newW <= 0) || (newH <= 0))
+ return false;
+ if ((myScreen = vmng_screen_find(scrnContent, &status)) == nullptr)
+ return false;
+
+ oldX2 = myScreen->x2;
+ myScreen->x2 = myScreen->x1 + newW - 1;
+
+ if (myScreen->x2 < oldX2) {
+ RestoreScreens(myScreen->x2 + 1, myScreen->y1, oldX2, myScreen->y2);
+ }
+
+ oldY2 = myScreen->y2;
+ myScreen->y2 = myScreen->y1 + newH - 1;
+
+ if (myScreen->y2 < oldY2) {
+ RestoreScreens(myScreen->x1, myScreen->y2 + 1, myScreen->x2, oldY2);
+ }
+
+ return true;
+}
+
+static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2) {
+ Graphics::Surface *screen = g_system->lockScreen();
+ Common::Rect r(x1, y1, x2, y2);
+ screen->fillRect(r, 0);
+ g_system->unlockScreen();
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng_screen.h b/engines/m4/gui/gui_vmng_screen.h
new file mode 100644
index 00000000000..03cbbf5a6e2
--- /dev/null
+++ b/engines/m4/gui/gui_vmng_screen.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_GUI_GUI_VMNG_SCREEN_H
+#define M4_GUI_GUI_VMNG_SCREEN_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui_univ.h"
+
+namespace M4 {
+
+/**
+ * Record the (global) coordinates of the window which was created for scrnContent.
+ * @param scrnContent The window identifier
+ * @param x1 Window top-left X
+ * @param y1 Window top-left Y
+ * @param x2 Window bottom-right X
+ * @param y2 Window bottom-right Y
+ */
+extern bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *y2);
+
+/**
+ * Change which procedure will be called when a portion of the window
+ * needs to be redrawn.
+ * @param scrnContent The window identifier
+ * @param redraw The new refresh function pointer
+ */
+extern bool vmng_SetScreenRefresh(void *scrnContent, RefreshFunc redraw);
+
+/**
+ * Add a "hot key" to a window.
+ * @paramscrnContent The window identifier
+ * @param myKey The "key" which, when pressed, will cause the callback function
+ * to be executed.
+ * @param callback The function to be executed when "myKey" is pressed
+ */
+extern bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback);
+
+/**
+ * Remove a hot key
+ * @param scrnContent The window identifier
+ * @param myKey The "hot key" to be removed.
+ * @returns False if either the window or the "hot key" could not be found,
+ * TRUE if successful
+ */
+extern bool RemoveScreenHotkey(void *scrnContent, int32 myKey);
+
+/**
+ * Obvious shell to MoveScreen
+ */
+extern bool MoveScreenAbs(ScreenContext *myScreen, int32 parmX, int32 parmY);
+
+/**
+ * Obvious shell to MoveScreen
+ */
+extern bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY);
+
+/**
+ * Resize the windows width and/or height
+ * @param newW The new width of the window. If <= 0, the old window width will remain
+ * @param newH The new height of the window. If <= 0, the old window height will remain.
+ * @returns TRUE if the window was found, FALSE otherwise
+ */
+extern bool ResizeScreen(void *scrnContent, int32 newW, int32 newH);
+
+/**
+ * Restore the monitor image by redrawing the visible portions of each window
+ * intersecting the given rectangle.
+ * @param updateX1 Rectangle top-left X
+ * @param updateY1 Rectangle top-left Y
+ * @param updateX2 Rectangle bottom-right X
+ * @param updateY2 Rectangle bottom-right Y
+ */
+extern void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 updateY2);
+
+/**
+ * A shell to RestoreScreens
+ */
+extern void RestoreScreensInContext(int32 x1, int32 y1, int32 x2, int32 y2, ScreenContext *myScreen);
+
+/**
+ * Capture a screenshot to a bitmap.
+ */
+extern void Screen2BuffC(int8 *Buff);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 1bd671a4214..6d547f041f9 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -33,6 +33,9 @@ MODULE_OBJS = \
gui/gui_mouse.o \
gui/gui_sys.o \
gui/gui_vmng.o \
+ gui/gui_vmng_core.o \
+ gui/gui_vmng_rectangles.o \
+ gui/gui_vmng_screen.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index db51ce87d54..3c6c6614f7c 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -787,4 +787,32 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
return *celsSize;
}
+bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH) {
+ int32 *celsPtr;
+
+ // Parameter verification
+ if ((!ssHandle) || (!*ssHandle)) {
+ ws_LogErrorMsg(FL, "NULL Handle given.");
+ return false;
+ }
+
+ // Lock the handle, and get the cels source
+ HLock(ssHandle);
+ celsPtr = (int32 *)((int32)*ssHandle + ssOffset);
+
+ // Return the values
+ if (maxW) {
+ *maxW = celsPtr[CELS_SS_MAX_W];
+ }
+
+ if (maxH) {
+ *maxH = celsPtr[CELS_SS_MAX_H];
+ }
+
+ // unlock the handle
+ HUnLock(ssHandle);
+
+ return true;
+}
+
} // End of namespace M4
Commit: 87ff33f5a914f334db9fd6ea99d3d15aac45bf26
https://github.com/scummvm/scummvm/commit/87ff33f5a914f334db9fd6ea99d3d15aac45bf26
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix Burger loading mouse cursors
Changed paths:
engines/m4/burger/burger_globals.cpp
engines/m4/kernel.h
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_load.h
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 50c22c7a1f0..40edfc75487 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -51,7 +51,7 @@ void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPal
if (_mouseBuffer.data)
mem_free(_mouseBuffer.data);
- if (LoadSpriteSeries(assetName.c_str(), _mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
+ if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
_mouseSeriesResource = assetName;
if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
index daaa8ee8f27..aa54b0049bd 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/kernel.h
@@ -30,6 +30,8 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
struct Kernel {
+ bool hag_mode = true;
+
uint32 clock = 0; // Current game timing clock
int32 trigger = 0; // Game trigger code, if any
int32 letter_box_x = 0;
@@ -64,7 +66,6 @@ struct Kernel {
bool start_up_with_dbg_ws = false;
bool use_debug_monitor = false;
bool use_log_file = false;
- bool hag_mode = false;
bool track_open_close = false;
size_t mem_avail() const { return 7999999; }
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 3c6c6614f7c..a15ce00f1cb 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -504,7 +504,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
return mySprite;
}
-int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
MemHandle workHandle;
int32 celsSize, *celsPtr, *palPtr;
char *mainAssetPtr, *endOfAssetBlock, *parseAssetPtr;
@@ -514,7 +514,7 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
// The WS loader is not involved with this procedure.
// Load in the sprite series
- if ((workHandle = rget(assetName, &assetSize)) == NULL)
+ if ((workHandle = rget(assetName, &assetSize)) == nullptr)
error_show(FL, 'FNF!', "Sprite series: %s", assetName);
HLock(workHandle);
@@ -528,7 +528,7 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
error_show(FL, 'WSLP', "series: %s", assetName);
}
- //store the handle and offsets
+ // Store the handle and offsets
*seriesHandle = workHandle;
*celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
*palOffset = (int32)palPtr - (int32)mainAssetPtr;
@@ -538,7 +538,7 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
return celsSize;
}
-int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
MemHandle workHandle;
Common::File f;
int32 celsSize, *celsPtr, *palPtr;
@@ -792,7 +792,7 @@ bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH)
// Parameter verification
if ((!ssHandle) || (!*ssHandle)) {
- ws_LogErrorMsg(FL, "NULL Handle given.");
+ ws_LogErrorMsg(FL, "nullptr Handle given.");
return false;
}
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
index 5490b60650d..6e85a479763 100644
--- a/engines/m4/wscript/ws_load.h
+++ b/engines/m4/wscript/ws_load.h
@@ -100,8 +100,8 @@ extern int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data,
extern bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
// USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
-extern int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
-extern int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
+extern int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
+extern int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
extern M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
// WOODSCRIPT STREAMING API
Commit: 47cbdafe70809803abd8be1d09a102729be697eb
https://github.com/scummvm/scummvm/commit/47cbdafe70809803abd8be1d09a102729be697eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Burger's custom ascii converter
Changed paths:
engines/m4/burger/burger_globals.cpp
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 40edfc75487..b7f19886aca 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -30,12 +30,49 @@ namespace Burger {
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
+/**
+ * Structure for accented character replacement
+ */
+struct ConverterEntry {
+ const char *_find;
+ byte _replace;
+};
+static const ConverterEntry ASCII_CONVERTERS[] = {
+ { "\xc4", 1 },
+ { "\xc9", 2 },
+ { "\xd6", 3 },
+ { "\xdc", 4 },
+ { "\xe1", 5 },
+ { "\xe4", 6 },
+ { "\xe9", 0x0B },
+ { "\xf6", 0x0C },
+ { "\xfc", 0x0E },
+ { "\xdf", 0x0F },
+ { "\xe2", 0x10 },
+ { "\xe0", 0x11 },
+ { "\xef", 0x12 },
+ { "\xee", 0x13 },
+ { "\xea", 0x14 },
+ { "\xe8", 0x15 },
+ { "\xeb", 0x16 },
+ { "\xf9", 0x17 },
+ { "\xfb", 0x18 },
+ { "\xe7", 0x19 },
+ { "\xc7", 0x1C },
+ { "\xf4", 0x1D },
+ { nullptr, 0 }
+};
+
+
void BurgerGlobals::main_cold_data_init() {
// TODO
initMouseSeries("cursor", nullptr);
+ _kernel.first_fade = 32;
debugC(1, kDebugCore, "executing - %s", GAME_MODES[_gameMode]);
+
+
// TODO
}
@@ -73,10 +110,13 @@ void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPal
}
void BurgerGlobals::custom_ascii_converter_proc(char *string) {
+ char *str;
+ for (const auto &entry : ASCII_CONVERTERS) {
+ while ((str = strstr(string, entry._find)) != nullptr)
+ *str = entry._replace;
+ }
}
-
-
} // namespace Burger
} // namespace M4
Commit: 148199510ad455ff3cb962da2b71984b4c06699b
https://github.com/scummvm/scummvm/commit/148199510ad455ff3cb962da2b71984b4c06699b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added further Burger startup
Changed paths:
A engines/m4/adv_r/adv_file.cpp
A engines/m4/adv_r/adv_file.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_font.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
new file mode 100644
index 00000000000..30673eae064
--- /dev/null
+++ b/engines/m4/adv_r/adv_file.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 "common/system.h"
+#include "common/savefile.h"
+#include "m4/adv_r/adv_file.h"
+#include "m4/m4.h"
+
+namespace M4 {
+
+bool kernel_save_game_exists(int32 slot) {
+ Common::String slotName = g_engine->getSaveStateName(slot);
+ Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(slotName);
+ bool result = save != nullptr;
+ delete save;
+
+ return result;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_file.h b/engines/m4/adv_r/adv_file.h
new file mode 100644
index 00000000000..e02f4439865
--- /dev/null
+++ b/engines/m4/adv_r/adv_file.h
@@ -0,0 +1,61 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_FILE_H
+#define M4_ADV_R_ADV_FILE_H
+
+#include "common/stream.h"
+#include "m4/adv_r/adv.h"
+#include "m4/fileio/sys_file.h"
+#include "m4/gui/gui.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+M4sprite *kernel_CreateThumbnail(int32 *spriteSize);
+bool kernel_CreateSSFromGrBuff(GrBuff *myBuff, RGB8 *myPalette, bool completePal, const char *ssName);
+
+bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff **scr_orig_data, GrBuff **scr_orig);
+void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **loadBuffer);
+
+int kernel_save_game(Common::SeekableReadStream *save_file, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
+int kernel_save_game(int slot, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
+int kernel_load_game(Common::SeekableReadStream *save_file);
+int kernel_load_game(int slot);
+bool kernel_save_game_exists(int32 slot);
+
+bool kernel_load_variant(char *variant);
+GrBuff *load_codes(SysFile *code_file);
+bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette);
+
+bool load_picture_and_codes(SysFile *pic_file, SysFile *code_file,
+ GrBuff **loadBuf, GrBuff **code_data, uint8 minPalEntry, uint8 maxPalEntry);
+
+bool kernel_load_code_variant(SceneDef *rdef, char *variant, GrBuff **codeData);
+
+void kernel_current_background_name(char *result);
+void kernel_current_codes_name(char *result);
+void screen_capture(RGB8 *masterPalette);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index b7f19886aca..f001876a2a3 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -21,6 +21,7 @@
#include "common/debug.h"
#include "m4/burger/burger_globals.h"
+#include "m4/adv_r/adv_file.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/detection.h"
@@ -71,8 +72,27 @@ void BurgerGlobals::main_cold_data_init() {
_kernel.first_fade = 32;
debugC(1, kDebugCore, "executing - %s", GAME_MODES[_gameMode]);
+ // Set up game mode and starting room
+ _gameMode = WHOLE_GAME;
+
+ switch (_gameMode) {
+ case JUST_OVERVIEW:
+ _game.new_room = 971; // Burger overview starts right in at 971
+ break;
+ case INTERACTIVE_DEMO:
+ case MAGAZINE_DEMO:
+ _game.new_room = 901; // Burger Demo starts at the demo menu screen
+ break;
+ case WHOLE_GAME:
+ _game.new_room = kernel_save_game_exists(0) ? 903 : 951;
+ break;
+ }
+ _game.new_section = _game.new_room / 100; // ... in this section!
+ font_set_colors(2, 1, 3);
+}
+void BurgerGlobals::global_menu_system_init() {
// TODO
}
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 508c23851bb..a08421c3cc5 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -28,18 +28,19 @@ namespace M4 {
namespace Burger {
enum GameMode {
- WHOLE_GAME0 = 0, INTERACTIVE_DEMO = 1, MAGAZINE_DEMO = 2, WHOLE_GAME3 = 3
+ JUST_OVERVIEW = 0, INTERACTIVE_DEMO = 1, MAGAZINE_DEMO = 2, WHOLE_GAME = 3
};
class BurgerGlobals : public Globals {
private:
- GameMode _gameMode = WHOLE_GAME3;
+ GameMode _gameMode = WHOLE_GAME;
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
void custom_ascii_converter_proc(char *string);
protected:
void main_cold_data_init() override;
+ void global_menu_system_init() override;
public:
BurgerGlobals() {}
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 4b75774f8b2..9a53e4382a4 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -80,6 +80,7 @@ bool Globals::init() {
error_show(FL, 'FNF!', "stream script");
main_cold_data_init();
+ global_menu_system_init();
return true;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 4f8c591c618..ba1b8b26d39 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -59,6 +59,7 @@ private:
protected:
virtual void main_cold_data_init() = 0;
+ virtual void global_menu_system_init() = 0;
public:
Globals();
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index a519bbc5e74..cba3a105876 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -172,6 +172,7 @@ void font_set_colors(uint8 alt1, uint8 alt2, uint8 foreground) {
font_colors[3] = foreground;
}
}
+
void gr_font_set_color(uint8 foreground) {
if (_G(font) == _G(interfaceFont))
font_colors[1] = foreground;
diff --git a/engines/m4/graphics/gr_font.h b/engines/m4/graphics/gr_font.h
index 49e392a54a1..3aa74b57181 100644
--- a/engines/m4/graphics/gr_font.h
+++ b/engines/m4/graphics/gr_font.h
@@ -49,6 +49,8 @@ int32 gr_font_string_width(char *out_string, int32 auto_spacing = 1);
//Font *gr_font_file_read(const char *fontName);
Font *gr_font_load(const char *fontName);
+extern void font_set_colors(uint8 alt1, uint8 alt2, uint8 foreground);
+extern void gr_font_set_color(uint8 foreground);
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6d547f041f9..2538233f743 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
term.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
+ adv_r/adv_file.o \
adv_r/adv_inv.o \
adv_r/adv_rails.o \
adv_r/db_env.o \
Commit: f55dd6f13d0345556e64eb88af86770249ec5aa9
https://github.com/scummvm/scummvm/commit/f55dd6f13d0345556e64eb88af86770249ec5aa9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added further Burger setup and dependant code
Changed paths:
A engines/m4/graphics/gr_series.cpp
A engines/m4/graphics/gr_series.h
A engines/m4/gui/gui_event.h
A engines/m4/mouse/mickey.cpp
A engines/m4/mouse/mickey.h
A engines/m4/mouse/mouse_handler.cpp
A engines/m4/mouse/mouse_handler.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/core/mouse.h
engines/m4/globals.h
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_mouse.h
engines/m4/gui/gui_sys.cpp
engines/m4/gui/gui_sys.h
engines/m4/module.mk
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index f001876a2a3..a120fc3c571 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -20,8 +20,12 @@
*/
#include "common/debug.h"
+#include "common/events.h"
#include "m4/burger/burger_globals.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/detection.h"
@@ -93,6 +97,14 @@ void BurgerGlobals::main_cold_data_init() {
}
void BurgerGlobals::global_menu_system_init() {
+ _main_interface_sprite = series_load("999intr", 22, nullptr);
+ if (_main_interface_sprite != 22)
+ error_show(FL, 'SLF!');
+
+ AddSystemHotkey(Common::KEYCODE_ESCAPE, escape_key_pressed);
+ AddSystemHotkey(Common::KEYCODE_F2, cb_F2);
+ AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
+
// TODO
}
@@ -138,5 +150,17 @@ void BurgerGlobals::custom_ascii_converter_proc(char *string) {
}
}
+void BurgerGlobals::escape_key_pressed(void *, void *) {
+
+}
+
+void BurgerGlobals::cb_F2(void *, void *) {
+
+}
+
+void BurgerGlobals::cb_F3(void *, void *) {
+
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index a08421c3cc5..fec320d6073 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -37,6 +37,9 @@ private:
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
void custom_ascii_converter_proc(char *string);
+ static void escape_key_pressed(void *, void *);
+ static void cb_F2(void *, void *);
+ static void cb_F3(void *, void *);
protected:
void main_cold_data_init() override;
diff --git a/engines/m4/core/mouse.h b/engines/m4/core/mouse.h
index 4ff67a875ca..f42b0fdf23a 100644
--- a/engines/m4/core/mouse.h
+++ b/engines/m4/core/mouse.h
@@ -26,6 +26,84 @@
namespace M4 {
+struct MouseInfo {
+ uint16 Event;
+ uint16 ButtonState;
+ uint16 CursorColumn; // x
+ uint16 CursorRow; // y
+ uint16 HorizontalMickeyCount;
+ uint16 VerticalMickeyCount;
+};
+
+struct MouseDriverInfo {
+ byte MajorVersion;
+ byte MinorVersion;
+ byte MouseType;
+ byte MouseIRQ;
+};
+
+/*
+ * Define call mask bit fields
+ */
+enum {
+ CursorPositionChanged = 0,
+ LeftButtonPressed, LeftButtonReleased, RightButtonPressed,
+ RightButtonReleased, OEM_MiddleButtonPressed, OEM_MiddleButtonReleased,
+ LeftButtonHold, RightButtonHold, OEM_MiddleButtonHold
+};
+
+/*
+ * Define call mask values
+ */
+#define CPC ((Word)(1 << CursorPositionChanged))
+#define LBD ((Word)(1 << LeftButtonPressed))
+#define LBU ((Word)(1 << LeftButtonReleased))
+#define LBH ((int32)(1 << LeftButtonHold))
+#define RBD ((Word)(1 << RightButtonPressed))
+#define RBU ((Word)(1 << RightButtonReleased))
+#define RBH ((int32)(1 << RightButtonHold))
+#define MBD ((Word)(1 << OEM_MiddleButtonPressed))
+#define MBU ((Word)(1 << OEM_MiddleButtonReleased))
+#define MBHold ((int32)(1 << OEM_MiddleButtonHold))
+
+#define LBC (LBD + LBU)
+#define RBC (RBD + RBU)
+#define MBC (MBD + MBU)
+
+#define MSA (LBC + RBC + CPC)
+#define OEMA (LBC + RBC + MBC + CPC)
+
+
+enum mausEvent {
+ _ME_no_event, // 0
+ _ME_move, // 1
+ _ME_L_click, // 2
+ _ME_L_hold, // 3
+ _ME_L_drag, // 4
+ _ME_L_release, // 5
+ _ME_R_click, // 6
+ _ME_R_hold, // 7
+ _ME_R_drag, // 8
+ _ME_R_release, // 9
+ _ME_both_click, // 10
+ _ME_both_hold, // 11
+ _ME_both_drag, // 12
+ _ME_both_release, // 13
+ _ME_doubleclick, // 14
+ _ME_doubleclick_hold, // 15
+ _ME_doubleclick_drag, // 16
+ _ME_doubleclick_release
+};
+
+enum mausState {
+ _MS_no_event, // 0
+ _MS_L_clickDown, // 1
+ _MS_R_clickDown, // 2
+ _MS_both_clickDown, // 3
+ _MS_doubleclick_Down // 4
+};
+
+
extern int mouse_init();
extern void mouse_uninstall();
extern byte *GetMousePicture();
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index ba1b8b26d39..e1f95f8eede 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -29,6 +29,7 @@
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/core/mouse.h"
#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_color.h"
@@ -76,6 +77,7 @@ public:
Resources _resources;
Rails_Globals _rails;
Catalog _catalog;
+ MouseInfo _MouseState;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
@@ -122,6 +124,9 @@ public:
InvPal *_inverse_pal = nullptr;
InventoryRec _inventory;
int32 _inv_obj_mem_type = 0;
+ int _main_interface_sprite = 22;
+ bool _currScreen = false;
+ ScreenContext *_eventToScreen = nullptr;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
new file mode 100644
index 00000000000..3b293a6a349
--- /dev/null
+++ b/engines/m4/graphics/gr_series.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_series.h"
+#include "m4/core/errors.h"
+#include "m4/wscript/ws_load.h"
+
+namespace M4 {
+
+int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal) {
+ int32 myAssetIndex = AddWSAssetCELS(seriesName, assetIndex, myPal);
+
+ if ((myAssetIndex < 0) || (myAssetIndex >= 256))
+ error_show(FL, 'SPNF', seriesName);
+
+ return myAssetIndex;
+}
+
+void series_unload(int32 assetIndex) {
+ ClearWSAssets(_WS_ASSET_CELS, assetIndex, assetIndex);
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
new file mode 100644
index 00000000000..e5daacdf627
--- /dev/null
+++ b/engines/m4/graphics/gr_series.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_SERIES_H
+#define M4_GRAPHICS_GR_SERIES_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal);
+extern void series_unload(int32 assetIndex);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 80826b17b56..3f28ed630d9 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -53,4 +53,8 @@ void vmng_Dialog_Destroy(Dialog *d) {
error("TODO: vmng_Dialog_Destroy");
}
+void Dialog_KeyMouseCollision(void) {
+ error("TODO: Dialog_KeyMouseCollision");
+}
+
} // namespace M4
diff --git a/engines/m4/gui/gui_event.h b/engines/m4/gui/gui_event.h
new file mode 100644
index 00000000000..524bbe9b362
--- /dev/null
+++ b/engines/m4/gui/gui_event.h
@@ -0,0 +1,36 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_EVENT_H
+#define M4_GUI_GUI_EVENT_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+enum {
+ EVENT_MOUSE = 0, EVENT_KEY
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index 101fdaedaca..4cbeefd7ec2 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -289,14 +289,14 @@ bool mouse_set_sprite(int32 spriteNum) {
_G(mouseY1offset) = _G(mouseSprite)->yOffset;
_G(mouseX2offset) = _G(mouseSprite)->w - _G(mouseX1offset) - 1;
_G(mouseY2offset) = _G(mouseSprite)->h - _G(mouseY1offset) - 1;
- if (_G(mousex) - _G(mouseX1offset) < minX)
- minX = _G(mousex) - _G(mouseX1offset);
- if (_G(mousey) - _G(mouseY1offset) < minY)
- minY = _G(mousey) - _G(mouseY1offset);
- if (_G(mousex) + _G(mouseX2offset) > maxX)
- maxX = _G(mousex) + _G(mouseX2offset);
- if (_G(mousey) + _G(mouseY2offset) > maxY)
- maxY = _G(mousey) + _G(mouseY2offset);
+ if (_G(mouseX) - _G(mouseX1offset) < minX)
+ minX = _G(mouseX) - _G(mouseX1offset);
+ if (_G(mouseY) - _G(mouseY1offset) < minY)
+ minY = _G(mouseY) - _G(mouseY1offset);
+ if (_G(mouseX) + _G(mouseX2offset) > maxX)
+ maxX = _G(mouseX) + _G(mouseX2offset);
+ if (_G(mouseY) + _G(mouseY2offset) > maxY)
+ maxY = _G(mouseY) + _G(mouseY2offset);
gui_mouse_refresh();
_G(currMouseNum) = spriteNum;
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
index 0e1d7ab8e7b..d9ed3c5fa24 100644
--- a/engines/m4/gui/gui_mouse.h
+++ b/engines/m4/gui/gui_mouse.h
@@ -59,8 +59,8 @@ struct Mouse_Globals {
int32 _showMouseX2 = MAX_VIDEO_X;
int32 _showMouseY2 = MAX_VIDEO_Y;
- int32 _mousex = MAX_VIDEO_X >> 1; // The current mouse "x" position (global coords).
- int32 _mousey = MAX_VIDEO_Y >> 1; // The current mouse "y" position (global coords).
+ int32 _mouseX = MAX_VIDEO_X >> 1; // The current mouse "x" position (global coords).
+ int32 _mouseY = MAX_VIDEO_Y >> 1; // The current mouse "y" position (global coords).
int32 _oldX = MAX_VIDEO_X >> 1; // The previous mouse "x" and "y" position. When the mouse has moved, the
int32 _oldY = MAX_VIDEO_Y >> 1; // position where the mouse sprite was last drawn is here.
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 1fd52d5608f..9432450d414 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -20,13 +20,21 @@
*/
#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_dialog.h"
+#include "m4/gui/gui_event.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/core/mouse.h"
+#include "m4/mouse/mickey.h"
+#include "m4/mouse/mouse_handler.h"
#include "m4/mem/memman.h"
#include "m4/globals.h"
namespace M4 {
+static bool inScreen(ScreenContext *sc, int32 x, int32 y);
+
bool gui_system_init() {
- _G(systemHotkeys) = NULL;
+ _G(systemHotkeys) = nullptr;
return true;
}
@@ -43,4 +51,205 @@ void gui_system_shutdown() {
}
}
+void gui_system_event_handler(void) {
+ mausEvent newMouseEvent;
+
+ ScreenContext *myScreen;
+ Hotkey *myHotkey;
+ int32 parm1 = 0;
+ bool handled;
+ bool blocked;
+ bool found;
+
+ if (!_G(vmng_Initted))
+ return;
+
+ // Deal with mouse events first..
+ _G(mouseX) = _G(MouseState).CursorColumn;
+ _G(mouseY) = _G(MouseState).CursorRow;
+
+ newMouseEvent = mouse_get_event();
+
+ if (newMouseEvent != _MS_no_event) { //We have a mouse event
+ gui_mouse_refresh();
+ _G(oldX) = _G(mouseX);
+ _G(oldY) = _G(mouseY);
+
+ // currScreen is a global, the address of which is passed to every window's evtHandler.
+ // If the evtHandler sets currScreen to true, then that window will receive all mouse events,
+ // regardless of any windows in front of this one, until its evtHandler sets currScreen to false.
+ if (_G(currScreen)) {
+ if (_G(eventToScreen)->scrnFlags & SF_GET_MOUSE) {
+ (_G(eventToScreen)->evtHandler)(_G(eventToScreen)->scrnContent, EVENT_MOUSE,
+ newMouseEvent, _G(mouseX), _G(mouseY), &_G(currScreen));
+ }
+ } else {
+ myScreen = _G(frontScreen);
+ blocked = false;
+ found = false;
+
+ // Loop through the active window list, until we find a window which accepts
+ // mouse events and/or one that blocks them.
+ while (myScreen && (!found) && (!blocked)) {
+ if (myScreen->scrnFlags & SF_BLOCK_MOUSE)
+ blocked = true;
+ if ((myScreen->scrnFlags & SF_GET_MOUSE) && inScreen(myScreen, _G(mouseX), _G(mouseY)))
+ found = true; // The mouse must be within the window's
+ else
+ myScreen = myScreen->behind; // Boundaries to receive the event.
+ }
+ if (found && (myScreen->evtHandler)) {
+ // NOTE: if the window accepts mouse events, and the mouse is within the window's
+ // boundaries, the event will never be passed on.
+ (myScreen->evtHandler)(myScreen->scrnContent, EVENT_MOUSE, newMouseEvent, _G(mouseX), _G(mouseY), &_G(currScreen));
+ } else {
+ _G(currScreen) = false;
+ }
+
+ if (_G(currScreen))
+ _G(eventToScreen) = myScreen;
+ }
+ }
+
+ // Check keyboard
+ if (util_kbd_check(&parm1)) {
+ // Scan window list for windows with event handlers, aborting the scan if we find
+ // a window which handles or blocks key events. The event is passed to the handler
+ // if found.
+ //
+ handled = false;
+ myScreen = _G(frontScreen);
+ found = false;
+ blocked = false;
+ while (myScreen && (!found) && (!blocked)) { // Loop through windows until we find a window that accepts key events and/or
+ if (myScreen->scrnFlags & SF_BLOCK_KEY)
+ blocked = true; // one that blocks them.
+ if (myScreen->scrnFlags & SF_GET_KEY) {
+ found = true;
+ if (myScreen->evtHandler) {
+ handled = (myScreen->evtHandler)(myScreen->scrnContent, EVENT_KEY, parm1, 0, 0, nullptr);
+ }
+ } else myScreen = myScreen->behind;
+ }
+
+ // Scan window list for windows with hotkey lists, aborting the scan if we find
+ // a window which blocks key events. If the window has a hotkey list, we check if
+ // the key event matches any of the hotkeys. If it does, scanning aborts, and that
+ // key's callback is invoked. If it doesn't the search continues.
+ blocked = false;
+ while (myScreen && (!blocked) && (!handled)) {
+ if (myScreen->scrnFlags & SF_BLOCK_KEY)
+ blocked = true;
+ if (myScreen->scrnFlags & SF_GET_KEY) {
+ myHotkey = myScreen->scrnHotkeys;
+ while (myHotkey && (!handled)) {
+ if (myHotkey->myKey == parm1) {
+ handled = true;
+ _G(currScreen) = false;
+ Dialog_KeyMouseCollision();
+ if (myHotkey->callback) {
+ (myHotkey->callback)((void *)parm1, (void *)myScreen->scrnContent);
+ }
+ } else myHotkey = myHotkey->next;
+ }
+ }
+ myScreen = myScreen->behind;
+ }
+
+ // finally, if no window blocked the key, and no window handled the key, check
+ // the list of system hotkeys, invoking the callback if one is found.
+ if ((!handled) && (!blocked)) {
+ myHotkey = _G(systemHotkeys);
+ while (myHotkey && (!handled)) {
+ if (myHotkey->myKey == parm1) {
+ handled = true;
+ _G(currScreen) = false;
+ Dialog_KeyMouseCollision();
+ if (myHotkey->callback) {
+ (myHotkey->callback)((void *)parm1, nullptr);
+ }
+ } else myHotkey = myHotkey->next;
+ }
+ }
+ } // end key handling check
+}
+
+void AddSystemHotkey(int32 myKey, HotkeyCB callback) {
+ Hotkey *myHotkey;
+
+ if (!_G(vmng_Initted)) {
+ return;
+ }
+
+ myHotkey = _G(systemHotkeys);
+ while (myHotkey && (myHotkey->myKey != myKey)) {
+ myHotkey = myHotkey->next;
+ }
+
+ if (myHotkey) {
+ myHotkey->callback = callback;
+ } else {
+ if ((myHotkey = (Hotkey *)mem_alloc(sizeof(Hotkey), "hotkey")) == nullptr) {
+ return;
+ }
+
+ myHotkey->myKey = myKey;
+ myHotkey->callback = callback;
+ myHotkey->next = _G(systemHotkeys);
+ _G(systemHotkeys) = myHotkey;
+ }
+}
+
+void RemoveSystemHotkey(int32 myKey) {
+ Hotkey *myHotkey, *tempHotkey;
+
+ if (!_G(vmng_Initted))
+ return;
+
+ myHotkey = _G(systemHotkeys);
+ tempHotkey = myHotkey;
+
+ while (myHotkey && (myHotkey->myKey != myKey)) {
+ if (tempHotkey != myHotkey) tempHotkey = tempHotkey->next;
+ myHotkey = myHotkey->next;
+ }
+
+ if (myHotkey) {
+ if (myHotkey == tempHotkey)
+ _G(systemHotkeys) = _G(systemHotkeys)->next;
+ else
+ tempHotkey->next = myHotkey->next;
+
+ mem_free(myHotkey);
+ }
+}
+
+HotkeyCB GetSystemHotkey(int32 myKey) {
+ Hotkey *myHotkey, *tempHotkey;
+ if (!_G(vmng_Initted))
+ return (nullptr);
+
+ myHotkey = _G(systemHotkeys);
+ tempHotkey = myHotkey;
+
+ while (myHotkey && (myHotkey->myKey != myKey)) {
+ if (tempHotkey != myHotkey)
+ tempHotkey = tempHotkey->next;
+
+ myHotkey = myHotkey->next;
+ }
+ if (myHotkey) {
+ return myHotkey->callback;
+ }
+
+ return nullptr;
+}
+
+static bool inScreen(ScreenContext *sc, int32 x, int32 y) {
+ if (x >= sc->x1 && x <= sc->x2 && y >= sc->y1 && y <= sc->y2)
+ return true;
+
+ return false;
+}
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_sys.h b/engines/m4/gui/gui_sys.h
index 82ce5d37f78..c8e9bde5848 100644
--- a/engines/m4/gui/gui_sys.h
+++ b/engines/m4/gui/gui_sys.h
@@ -30,9 +30,31 @@ namespace M4 {
extern bool gui_system_init();
extern void gui_system_shutdown();
-extern void gui_system_event_handler(void); // was ScreenEventHandle
+
+/**
+ * Determine if an event happens, and if so, which window should process the event
+ * This is the main "engine call" of the GUI. It should be called once each time in the
+ * applications main loop. All "hot key" call backs, and evtHandlers are executed from here.
+ */
+extern void gui_system_event_handler();
+
+/**
+ * Add a "hot key" to the system (as opposed to a specific window).
+ * @param myKey The "key" which, when pressed, will cause the callback function to be executed.
+ * @param callback The function to be executed when "myKey" is pressed.
+ * @remarks If the view manager has not been initialized, or sizeof(Hotkey) memory is not available,
+ * the procedure will be aborted.
+ */
extern void AddSystemHotkey(int32 myKey, HotkeyCB callback);
+
+/**
+ * Remove a "hot key" from the system
+ */
extern void RemoveSystemHotkey(int32 myKey);
+
+/**
+ * To find the callback associated with a "hot key" in the system
+ */
extern HotkeyCB GetSystemHotkey(int32 myKey);
} // End of namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 2538233f743..19d33a5953a 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -28,6 +28,7 @@ MODULE_OBJS = \
graphics/gr_color.o \
graphics/gr_font.o \
graphics/gr_pal.o \
+ graphics/gr_series.o \
graphics/graphics.o \
gui/gui_buffer.o \
gui/gui_dialog.o \
@@ -40,6 +41,8 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ mouse/mickey.o \
+ mouse/mouse_handler.o \
platform/timer.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
diff --git a/engines/m4/mouse/mickey.cpp b/engines/m4/mouse/mickey.cpp
new file mode 100644
index 00000000000..20c77f8ec61
--- /dev/null
+++ b/engines/m4/mouse/mickey.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 "common/textconsole.h"
+#include "m4/mouse/mickey.h"
+
+namespace M4 {
+
+bool util_kbd_check(int32 *parm1) {
+ if (!parm1)
+ return false;
+
+ *parm1 = 0;
+ warning("TODO: util_kbd_check");
+
+ return false;
+}
+
+
+} // namespace M4
diff --git a/engines/m4/mouse/mickey.h b/engines/m4/mouse/mickey.h
new file mode 100644
index 00000000000..18e6575c101
--- /dev/null
+++ b/engines/m4/mouse/mickey.h
@@ -0,0 +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/>.
+ *
+ */
+
+#ifndef M4_MOUSE_MICKEY_H
+#define M4_MOUSE_MICKEY_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern bool util_kbd_check(int32 *parm1);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mouse/mouse_handler.cpp b/engines/m4/mouse/mouse_handler.cpp
new file mode 100644
index 00000000000..8e53024543d
--- /dev/null
+++ b/engines/m4/mouse/mouse_handler.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/mouse/mouse_handler.h"
+
+namespace M4 {
+
+mausEvent mouse_get_event() {
+ warning("TODO: mouse_get_event");
+ return _ME_no_event;
+}
+
+} // namespace M4
diff --git a/engines/m4/mouse/mouse_handler.h b/engines/m4/mouse/mouse_handler.h
new file mode 100644
index 00000000000..4e1dd91ba93
--- /dev/null
+++ b/engines/m4/mouse/mouse_handler.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_MOUSE_MOUSE_HANDLER_H
+#define M4_MOUSE_MOUSE_HANDLER_H
+
+#include "m4/m4_types.h"
+#include "m4/core/mouse.h"
+
+namespace M4 {
+
+mausEvent mouse_get_event();
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index a15ce00f1cb..65ebd78b7d5 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -32,6 +32,7 @@ namespace M4 {
static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal);
static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette);
+static void RestoreSSPaletteInfo(RGB8 *myPalette, int32 *palPtr);
bool InitWSAssets() {
int32 i;
@@ -586,6 +587,161 @@ int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int
return celsSize;
}
+bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH) {
+ int32 *celsPtr;
+
+ // Parameter verification
+ if ((!ssHandle) || (!*ssHandle)) {
+ ws_LogErrorMsg(FL, "nullptr Handle given.");
+ return false;
+ }
+
+ // Lock the handle, and get the cels source
+ HLock(ssHandle);
+ celsPtr = (int32 *)((int32)*ssHandle + ssOffset);
+
+ // Return the values
+ if (maxW) {
+ *maxW = celsPtr[CELS_SS_MAX_W];
+ }
+
+ if (maxH) {
+ *maxH = celsPtr[CELS_SS_MAX_H];
+ }
+
+ // unlock the handle
+ HUnLock(ssHandle);
+
+ return true;
+}
+
+int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
+ MemHandle workHandle;
+ char *parseAssetPtr, *mainAssetPtr, *endOfAssetBlock;
+ int32 emptySlot, i, assetSize, *celsPtr, *palPtr;
+
+ // Check that the loader has been initialized
+ if (!_G(wsloaderInitialized)) {
+ error_show(FL, 'WSLI', "Asset Name: %s", wsAssetName);
+ }
+
+ emptySlot = -1;
+
+ // If hash is < 0, find the first available slot
+ if (hash < 0) {
+ // Search through the SS names table
+ for (i = 0; i <= MAX_ASSET_HASH; i++) {
+ // See if there is something loaded in this slot
+ if (_G(globalCELSnames)[i]) {
+ if (!strcmp(_G(globalCELSnames)[i], wsAssetName)) {
+ break;
+ }
+ } else if (emptySlot < 0) {
+ // Else we found an empty slot
+ emptySlot = i;
+ }
+ }
+ } else {
+ // Else the SS must be stored in the given hash, replacing any previous contents.
+ // Index checking
+ if (hash > MAX_ASSET_HASH) {
+ error_show(FL, 'WSLA', "Asset Name: %s, hash given was %ld", wsAssetName, hash);
+ }
+
+ // Check to see if the SS is already loaded in the given hash slot
+ if (_G(globalCELSnames)[hash] && (!strcmp(_G(globalCELSnames)[hash], wsAssetName))) {
+ if (_G(globalCELSPaloffsets)[hash] >= 0) {
+ // Get the pointer to the pal data
+#ifdef TODO
+ workHandle = _G(globalCELSHandles)[hash];
+ palPtr = (int32 *)((int32)*workHandle + _G(globalCELSPaloffsets)[hash]);
+#else
+ error("TODO: Figure out dereferencing");
+#endif
+
+ // Restore the palette and unlock the handle
+ RestoreSSPaletteInfo(myPalette, palPtr);
+ HUnLock(workHandle);
+ }
+
+ // Since the SS is already loaded, return the slot
+ return hash;
+ } else {
+ // The series is not already loaded, set up values for the next if statement
+ i = MAX_ASSET_HASH + 1;
+ emptySlot = hash;
+ }
+ }
+
+ // If we've searched the entire table and not found the series, but
+ // we found an empty slot to load the SS into
+ if ((i > MAX_ASSET_HASH) && (emptySlot >= 0)) {
+
+ if ((workHandle = rget(wsAssetName, &assetSize)) == NULL) {
+ error_show(FL, 'FNF!', (char *)wsAssetName);
+ }
+
+ // Lock the handle so we can step through the chunk
+ HLock(workHandle);
+ mainAssetPtr = (char *)(*workHandle);
+
+ parseAssetPtr = mainAssetPtr;
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+
+ ClearWSAssets(_WS_ASSET_CELS, emptySlot, emptySlot);
+
+ // Store the resource name
+ _G(globalCELSnames)[emptySlot] = mem_strdup(wsAssetName);
+
+ // Process the SS from the stream file
+ if (ProcessCELS(wsAssetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette) < 0) {
+ error_show(FL, 'WSLP', "Asset Name: %s", wsAssetName);
+ }
+
+ // At this point, celsPtr points to the beginning of the cels data, palPtr to the pal data
+ // Store the Handle, and calculate the offsets
+ _G(globalCELSHandles)[emptySlot] = workHandle;
+ if (celsPtr) {
+ _G(globalCELSoffsets)[emptySlot] = (int32)celsPtr - (int32)mainAssetPtr;
+ } else {
+ _G(globalCELSoffsets)[emptySlot] = -1;
+ }
+ if (palPtr) {
+ _G(globalCELSPaloffsets)[emptySlot] = (int32)palPtr - (int32)mainAssetPtr;
+ } else {
+ _G(globalCELSPaloffsets)[emptySlot] = -1;
+ }
+
+ // Unlock the handle
+ HUnLock(workHandle);
+
+ return emptySlot;
+ } else if (i < MAX_ASSET_HASH) {
+ // Else if we found the SS already loaded
+ if (_G(globalCELSPaloffsets)[i] >= 0) {
+ // Get the pointer to the pal data
+#ifdef TODO
+ workHandle = _G(globalCELSHandles)[i];
+ HLock(workHandle);
+ palPtr = (int32 *)((int32)*workHandle + _G(globalCELSPaloffsets)[i]);
+#else
+ error("TODO: Figure out dereferencing");
+#endif
+ // Restore the palette and unlock the handle
+ RestoreSSPaletteInfo(myPalette, palPtr);
+ HUnLock(workHandle);
+ }
+
+ // Return the hash number for the series
+ return i;
+ } else {
+ // Else we searched the entire table, it was not already loaded, and there are no empty slots
+ error_show(FL, 'WSLF', "Asset Name: %s", wsAssetName);
+ }
+
+ return -1;
+}
+
static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal) {
// Check to see if we still have an int32 available
if ((endOfAssetBlock - *assetPtr) < 4) {
@@ -600,7 +756,7 @@ static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **return
}
static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
- int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette) {
+ int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette) {
uint32 *celsType, *numColors, *palData;
uint32 *tempPtr, *celsSize, *data, *dataPtr, *offsetPtr, i, j, *header, *format;
bool byteSwap;
@@ -787,32 +943,24 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
return *celsSize;
}
-bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH) {
- int32 *celsPtr;
+static void RestoreSSPaletteInfo(RGB8 *myPalette, int32 *palPtr) {
+ uint32 *tempPtr, i, j;
// Parameter verification
- if ((!ssHandle) || (!*ssHandle)) {
- ws_LogErrorMsg(FL, "nullptr Handle given.");
- return false;
- }
-
- // Lock the handle, and get the cels source
- HLock(ssHandle);
- celsPtr = (int32 *)((int32)*ssHandle + ssOffset);
-
- // Return the values
- if (maxW) {
- *maxW = celsPtr[CELS_SS_MAX_W];
- }
+ if ((!myPalette) || (!palPtr))
+ return;
- if (maxH) {
- *maxH = celsPtr[CELS_SS_MAX_H];
+ // Set up a pointer that can step through the pal info for the SS, and restore each color
+ if (myPalette) {
+ tempPtr = (uint32 *)(&palPtr[1]);
+ for (i = 0; i < (uint32)palPtr[0]; i++) {
+ j = (*tempPtr & 0xff000000) >> 24;
+ myPalette[j].r = (*tempPtr & 0x00ff0000) >> 14;
+ myPalette[j].g = (*tempPtr & 0x0000ff00) >> 6;
+ myPalette[j].b = (*tempPtr & 0x000000ff) << 2;
+ tempPtr++;
+ }
}
-
- // unlock the handle
- HUnLock(ssHandle);
-
- return true;
}
} // End of namespace M4
Commit: e4fdbd9aa23058baadb632289fea1cf031e9a162
https://github.com/scummvm/scummvm/commit/e4fdbd9aa23058baadb632289fea1cf031e9a162
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Prototypes for gui_item.cpp
Changed paths:
A engines/m4/gui/gui_item.cpp
A engines/m4/gui/gui_item.h
engines/m4/globals.h
engines/m4/gui/gui_dialog.h
engines/m4/gui/gui_univ.h
engines/m4/module.mk
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index e1f95f8eede..4045c087cbe 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -34,6 +34,7 @@
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_color.h"
#include "m4/graphics/gr_font.h"
+#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
#include "m4/mem/memman.h"
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index af2bfedac3f..a32e6575c24 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -26,6 +26,7 @@
#include "m4/m4_types.h"
#include "m4/graphics/gr_buff.h"
#include "m4/gui/gui.h"
+#include "m4/gui/gui_item.h"
#include "m4/gui/gui_univ.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
new file mode 100644
index 00000000000..6c555e99f7c
--- /dev/null
+++ b/engines/m4/gui/gui_item.cpp
@@ -0,0 +1,28 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_item.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_item.h b/engines/m4/gui/gui_item.h
new file mode 100644
index 00000000000..9efa0ddc318
--- /dev/null
+++ b/engines/m4/gui/gui_item.h
@@ -0,0 +1,120 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_ITEM_H
+#define M4_GUI_GUI_ITEM_H
+
+#include "m4/m4_types.h"
+#include "m4/graphics/gr_font.h"
+
+namespace M4 {
+
+enum ItemType {
+ MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
+};
+
+struct ListItem {
+ char prompt[80];
+ int32 tag;
+ struct ListItem *next;
+ struct ListItem *prev;
+};
+
+struct TextItem {
+ TextItem *next;
+ int32 justification;
+ int32 x;
+ int32 y;
+ int32 w;
+ int32 h;
+ int32 tag;
+ int32 type;
+ char *prompt;
+ M4CALLBACK callback;
+};
+
+struct Item {
+ Item *next;
+ Item *prev;
+ M4CALLBACK callback;
+ ItemType type;
+ int32 status;
+ Font *myFont;
+ char *prompt;
+ char *aux;
+ char *aux2;
+ int32 promptMax;
+ int32 myListCount;
+ int32 viewIndex;
+ int32 thumbY;
+ ListItem *myList;
+ ListItem *currItem;
+ ListItem *viewTop;
+ ListItem *viewBottom;
+ int32 listView;
+ int32 x, y, w, h;
+ int32 tag;
+};
+
+extern bool InitItems(void);
+extern Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
+extern void Item_destroy(Item *myItem);
+extern void Item_empty_list(Item *myItem);
+extern Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, char *prompt, int32 tag,
+ ItemType type, M4CALLBACK cb, int32 promptMax);
+extern Item *ItemFind(Item *itemList, int32 tag);
+extern bool Item_SetViewBottom(Item *i);
+extern bool ListItemExists(Item *myItem, char *prompt, int32 listTag);
+extern bool ListItemAdd(Item *myItem, char *prompt, int32 listTag, int32 addMode, ListItem *changedItem);
+extern bool ListItemDelete(Item *myItem, ListItem *myListItem, int32 listTag);
+extern bool ListItemChange(Item *myItem, ListItem *myListItem, int32 listTag,
+ char *newPrompt, int32 newTag, int32 changeMode);
+extern void ViewCurrListItem(Item *myItem);
+extern ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
+extern bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
+extern bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset);
+extern bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType);
+extern bool ResetDefaultListBox(Item *myItem);
+extern bool Item_change_prompt(Item *myItem, char *newPrompt);
+extern void Item_ClearOrigPrompt(void);
+extern Item *Item_RestoreTextField(void);
+extern Item *Item_CheckTextField(void);
+extern void Item_SaveTextField(Item *myItem);
+extern void SetTextBlockBegin(Item *myItem, int32 relXPos);
+extern void SetTextBlockEnd(Item *myItem, int32 relXPos);
+extern bool Item_TextEdit(Item *myItem, int32 parm1);
+extern bool GetNextListItem(Item *myItem);
+extern bool GetNextPageList(Item *myItem);
+extern bool GetPrevListItem(Item *myItem);
+extern bool GetPrevPageList(Item *myItem);
+extern bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType);
+extern void Item_format(Item *i);
+extern Item *Item_set_default(Item *itemList, Item *currDefault, int32 tag);
+extern Item *Item_set_pressed(Item *itemList, Item *myItem, int32 tag);
+extern Item *Item_set_unpressed(Item *itemList, Item *myItem, int32 tag);
+extern Item *Item_set_cancel(Item *itemList, int32 tag);
+extern Item *Item_set_next_default(Item *currDefault, Item *itemList);
+extern Item *Item_set_prev_default(Item *currDefault, Item *listBottom);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_univ.h b/engines/m4/gui/gui_univ.h
index f4ffb5a9404..3ee7b0c37e5 100644
--- a/engines/m4/gui/gui_univ.h
+++ b/engines/m4/gui/gui_univ.h
@@ -65,53 +65,6 @@ struct ButtonDrawRec {
bool fillMe, pressed;
};
-enum ItemType {
- MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
-};
-
-struct ListItem {
- char prompt[80];
- int32 tag;
- struct ListItem *next;
- struct ListItem *prev;
-};
-
-struct Item {
- struct Item *next;
- struct Item *prev;
- M4CALLBACK callback;
- enum ItemType type;
- int32 status;
- Font *myFont;
- char *prompt;
- char *aux;
- char *aux2;
- int32 promptMax;
- int32 myListCount;
- int32 viewIndex;
- int32 thumbY;
- ListItem *myList;
- ListItem *currItem;
- ListItem *viewTop;
- ListItem *viewBottom;
- int32 listView;
- int32 x, y, w, h;
- int32 tag;
-};
-
-struct TextItem {
- struct TextItem *next;
- int32 justification;
- int32 x;
- int32 y;
- int32 w;
- int32 h;
- int32 tag;
- int32 type;
- char *prompt;
- M4CALLBACK callback;
-};
-
} // End of namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 19d33a5953a..557b71d8a71 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,6 +32,7 @@ MODULE_OBJS = \
graphics/graphics.o \
gui/gui_buffer.o \
gui/gui_dialog.o \
+ gui/gui_item.o \
gui/gui_mouse.o \
gui/gui_sys.o \
gui/gui_vmng.o \
Commit: 7f50ca35b83040b84cb1b0c367d1b494d8078d53
https://github.com/scummvm/scummvm/commit/7f50ca35b83040b84cb1b0c367d1b494d8078d53
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Statics for gui_item.cpp
Changed paths:
engines/m4/globals.h
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_item.h
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 4045c087cbe..a892eab799a 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -79,6 +79,7 @@ public:
Rails_Globals _rails;
Catalog _catalog;
MouseInfo _MouseState;
+ Item_Globals _items;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 6c555e99f7c..689fd6b4540 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -20,9 +20,127 @@
*/
#include "m4/gui/gui_item.h"
+#include "m4/graphics/gr_pal.h"
#include "m4/globals.h"
namespace M4 {
+#define _REDRAW_ALL 2
+#define _REDRAW_ACTIVE 4
+#define _INIT_LISTBOX 8
+
+#define _LB_BLACK __BLACK
+#define _LB_LTGREY 0x07 //used to be 0x0c
+#define _LB_DKGREY 0x08 //used to be 0x04
+#define _LB_WHITE 0x0f
+#define _LB_BROWN 0x07
+
+
+//INTRFACE SPRITES
+#define scrollUpWidth 11
+#define scrollUpHeight 12
+static const byte scrollUpData[] = {
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY,
+ _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
+};
+static const Buffer scrollUpBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpData[0], 0 };
+
+static const byte scrollUpPressedData[] = {
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_LTGREY, _LB_BLACK, _LB_WHITE, _LB_DKGREY,
+ _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_LTGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_BLACK, _LB_BLACK, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+};
+static const Buffer scrollUpPressedBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpPressedData[0], 0 };
+
+#define scrollDownWidth 11
+#define scrollDownHeight 12
+static const byte scrollDownData[] = {
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY,
+ _LB_LTGREY, _LB_WHITE, _LB_BLACK, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
+};
+static const Buffer scrollDownBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownData[0], 0 };
+
+static const byte scrollDownPressedData[] = {
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY,
+ _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_WHITE, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_WHITE, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BLACK, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
+};
+static const Buffer scrollDownPressedBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownPressedData[0], 0 };
+
+#define thumbWidth 11
+#define thumbHeight 11
+static const byte thumbData[] = {
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_BLACK, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
+ _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
+};
+static const Buffer thumbBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbData[0], 0 };
+
+static const byte thumbPressedData[] = {
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BROWN, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
+ _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
+};
+static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbPressedData[0], 0 };
+
+#define minThumbY (scrollUpHeight + buttonHeight)
+#define maxThumbY (scrollDownHeight + thumbHeight + (buttonHeight<<1))
+#define thumbYRange (scrollUpHeight + scrollUpHeight + thumbHeight + (buttonHeight<<2) + buttonHeight - 1)
+
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_item.h b/engines/m4/gui/gui_item.h
index 9efa0ddc318..358b48e8dfe 100644
--- a/engines/m4/gui/gui_item.h
+++ b/engines/m4/gui/gui_item.h
@@ -75,6 +75,19 @@ struct Item {
int32 tag;
};
+struct Item_Globals {
+ char *_origPrompt;
+ char *_undoPrompt;
+ char *_undoAux;
+ char *_undoAux2;
+ Item *_currTextField;
+
+ int32 _buttonWidth;
+ int32 _buttonHeight;
+
+ char _clipBoard[100];
+};
+
extern bool InitItems(void);
extern Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
extern void Item_destroy(Item *myItem);
Commit: 366ccfc86b848f073d293b174ba58351c4228ed4
https://github.com/scummvm/scummvm/commit/366ccfc86b848f073d293b174ba58351c4228ed4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui_item.cpp methods
Changed paths:
A engines/m4/events/keys.h
A engines/m4/events/mickey.cpp
A engines/m4/events/mickey.h
A engines/m4/events/mouse_handler.cpp
A engines/m4/events/mouse_handler.h
A engines/m4/graphics/gr_draw.cpp
A engines/m4/graphics/gr_draw.h
A engines/m4/graphics/gr_line.cpp
A engines/m4/graphics/gr_line.h
R engines/m4/mouse/mickey.cpp
R engines/m4/mouse/mickey.h
R engines/m4/mouse/mouse_handler.cpp
R engines/m4/mouse/mouse_handler.h
engines/m4/globals.h
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_buff.h
engines/m4/graphics/gr_pal.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_item.h
engines/m4/gui/gui_sys.cpp
engines/m4/module.mk
diff --git a/engines/m4/events/keys.h b/engines/m4/events/keys.h
new file mode 100644
index 00000000000..69f6d6001ac
--- /dev/null
+++ b/engines/m4/events/keys.h
@@ -0,0 +1,147 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_EVENTS_KEYS_H
+#define M4_EVENTS_KEYS_H
+
+#include "common/events.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+enum {
+ KEY_CTRL_A = (Common::KBD_CTRL << 16) | Common::KEYCODE_a,
+ KEY_CTRL_B = (Common::KBD_CTRL << 16) | Common::KEYCODE_b,
+ KEY_CTRL_C = (Common::KBD_CTRL << 16) | Common::KEYCODE_c,
+ KEY_CTRL_D = (Common::KBD_CTRL << 16) | Common::KEYCODE_d,
+ KEY_CTRL_E = (Common::KBD_CTRL << 16) | Common::KEYCODE_e,
+ KEY_CTRL_F = (Common::KBD_CTRL << 16) | Common::KEYCODE_f,
+ KEY_CTRL_G = (Common::KBD_CTRL << 16) | Common::KEYCODE_g,
+ KEY_CTRL_H = (Common::KBD_CTRL << 16) | Common::KEYCODE_h,
+ KEY_CTRL_I = (Common::KBD_CTRL << 16) | Common::KEYCODE_i,
+ KEY_CTRL_J = (Common::KBD_CTRL << 16) | Common::KEYCODE_j,
+ KEY_CTRL_K = (Common::KBD_CTRL << 16) | Common::KEYCODE_k,
+ KEY_CTRL_L = (Common::KBD_CTRL << 16) | Common::KEYCODE_l,
+ KEY_CTRL_M = (Common::KBD_CTRL << 16) | Common::KEYCODE_m,
+ KEY_CTRL_N = (Common::KBD_CTRL << 16) | Common::KEYCODE_n,
+ KEY_CTRL_O = (Common::KBD_CTRL << 16) | Common::KEYCODE_o,
+ KEY_CTRL_P = (Common::KBD_CTRL << 16) | Common::KEYCODE_p,
+ KEY_CTRL_Q = (Common::KBD_CTRL << 16) | Common::KEYCODE_q,
+ KEY_CTRL_R = (Common::KBD_CTRL << 16) | Common::KEYCODE_r,
+ KEY_CTRL_S = (Common::KBD_CTRL << 16) | Common::KEYCODE_s,
+ KEY_CTRL_T = (Common::KBD_CTRL << 16) | Common::KEYCODE_t,
+ KEY_CTRL_U = (Common::KBD_CTRL << 16) | Common::KEYCODE_u,
+ KEY_CTRL_V = (Common::KBD_CTRL << 16) | Common::KEYCODE_v,
+ KEY_CTRL_W = (Common::KBD_CTRL << 16) | Common::KEYCODE_w,
+ KEY_CTRL_X = (Common::KBD_CTRL << 16) | Common::KEYCODE_x,
+ KEY_CTRL_Y = (Common::KBD_CTRL << 16) | Common::KEYCODE_y,
+ KEY_CTRL_Z = (Common::KBD_CTRL << 16) | Common::KEYCODE_z,
+
+ KEY_ALT_A = (Common::KBD_ALT << 16) | Common::KEYCODE_a,
+ KEY_ALT_B = (Common::KBD_ALT << 16) | Common::KEYCODE_b,
+ KEY_ALT_C = (Common::KBD_ALT << 16) | Common::KEYCODE_c,
+ KEY_ALT_D = (Common::KBD_ALT << 16) | Common::KEYCODE_d,
+ KEY_ALT_E = (Common::KBD_ALT << 16) | Common::KEYCODE_e,
+ KEY_ALT_F = (Common::KBD_ALT << 16) | Common::KEYCODE_f,
+ KEY_ALT_G = (Common::KBD_ALT << 16) | Common::KEYCODE_g,
+ KEY_ALT_H = (Common::KBD_ALT << 16) | Common::KEYCODE_h,
+ KEY_ALT_I = (Common::KBD_ALT << 16) | Common::KEYCODE_i,
+ KEY_ALT_J = (Common::KBD_ALT << 16) | Common::KEYCODE_j,
+ KEY_ALT_K = (Common::KBD_ALT << 16) | Common::KEYCODE_k,
+ KEY_ALT_L = (Common::KBD_ALT << 16) | Common::KEYCODE_l,
+ KEY_ALT_M = (Common::KBD_ALT << 16) | Common::KEYCODE_m,
+ KEY_ALT_N = (Common::KBD_ALT << 16) | Common::KEYCODE_n,
+ KEY_ALT_O = (Common::KBD_ALT << 16) | Common::KEYCODE_o,
+ KEY_ALT_P = (Common::KBD_ALT << 16) | Common::KEYCODE_p,
+ KEY_ALT_Q = (Common::KBD_ALT << 16) | Common::KEYCODE_q,
+ KEY_ALT_R = (Common::KBD_ALT << 16) | Common::KEYCODE_r,
+ KEY_ALT_S = (Common::KBD_ALT << 16) | Common::KEYCODE_s,
+ KEY_ALT_T = (Common::KBD_ALT << 16) | Common::KEYCODE_t,
+ KEY_ALT_U = (Common::KBD_ALT << 16) | Common::KEYCODE_u,
+ KEY_ALT_V = (Common::KBD_ALT << 16) | Common::KEYCODE_v,
+ KEY_ALT_W = (Common::KBD_ALT << 16) | Common::KEYCODE_w,
+ KEY_ALT_X = (Common::KBD_ALT << 16) | Common::KEYCODE_x,
+ KEY_ALT_Y = (Common::KBD_ALT << 16) | Common::KEYCODE_y,
+ KEY_ALT_Z = (Common::KBD_ALT << 16) | Common::KEYCODE_z,
+
+ KEY_ALT_0 = (Common::KBD_ALT << 16) | Common::KEYCODE_0,
+ KEY_ALT_1 = (Common::KBD_ALT << 16) | Common::KEYCODE_1,
+ KEY_ALT_2 = (Common::KBD_ALT << 16) | Common::KEYCODE_2,
+ KEY_ALT_3 = (Common::KBD_ALT << 16) | Common::KEYCODE_3,
+ KEY_ALT_4 = (Common::KBD_ALT << 16) | Common::KEYCODE_4,
+ KEY_ALT_5 = (Common::KBD_ALT << 16) | Common::KEYCODE_5,
+ KEY_ALT_6 = (Common::KBD_ALT << 16) | Common::KEYCODE_6,
+ KEY_ALT_7 = (Common::KBD_ALT << 16) | Common::KEYCODE_7,
+ KEY_ALT_8 = (Common::KBD_ALT << 16) | Common::KEYCODE_8,
+ KEY_ALT_9 = (Common::KBD_ALT << 16) | Common::KEYCODE_9,
+
+ KEY_PAD_MINUS = Common::KEYCODE_KP_MINUS,
+ KEY_PAD_PLUS = Common::KEYCODE_KP_PLUS,
+ KEY_PAD_TIMES = Common::KEYCODE_KP_MULTIPLY,
+ KEY_PAD_DIVIDE = Common::KEYCODE_KP_DIVIDE,
+};
+
+enum {
+ KEY_PAGE_UP = Common::KEYCODE_PAGEUP,
+ KEY_PAGE_DOWN = Common::KEYCODE_PAGEDOWN,
+ KEY_HOME = Common::KEYCODE_HOME,
+ KEY_END = Common::KEYCODE_END,
+ KEY_DELETE = Common::KEYCODE_DELETE,
+ KEY_BACKSP = Common::KEYCODE_BACKSPACE,
+ KEY_TAB = Common::KEYCODE_TAB,
+ KEY_SHFTTAB = (Common::KBD_SHIFT << 16) | Common::KEYCODE_TAB,
+ KEY_RETURN = Common::KEYCODE_RETURN,
+ KEY_ESCAPE = Common::KEYCODE_ESCAPE,
+ KEY_SPACE = Common::KEYCODE_SPACE,
+
+ KEY_LEFT = Common::KEYCODE_LEFT,
+ KEY_RIGHT = Common::KEYCODE_RIGHT,
+ KEY_UP = Common::KEYCODE_UP,
+ KEY_DOWN = Common::KEYCODE_DOWN,
+
+ KEY_ALT_UP = (Common::KBD_ALT << 16) | Common::KEYCODE_UP,
+ KEY_ALT_DOWN = (Common::KBD_ALT << 16) | Common::KEYCODE_DOWN,
+ KEY_ALT_LEFT = (Common::KBD_ALT << 16) | Common::KEYCODE_LEFT,
+ KEY_ALT_RIGHT = (Common::KBD_ALT << 16) | Common::KEYCODE_RIGHT,
+
+ KEY_CTRL_UP = (Common::KBD_CTRL << 16) | Common::KEYCODE_UP,
+ KEY_CTRL_DOWN = (Common::KBD_CTRL << 16) | Common::KEYCODE_DOWN,
+ KEY_CTRL_LEFT = (Common::KBD_CTRL << 16) | Common::KEYCODE_LEFT,
+ KEY_CTRL_RIGHT = (Common::KBD_CTRL << 16) | Common::KEYCODE_RIGHT,
+
+ KEY_F1 = Common::KEYCODE_F1,
+ KEY_F2 = Common::KEYCODE_F2,
+ KEY_F3 = Common::KEYCODE_F3,
+ KEY_F4 = Common::KEYCODE_F4,
+
+ KEY_F5 = Common::KEYCODE_F5,
+ KEY_F6 = Common::KEYCODE_F6,
+ KEY_F7 = Common::KEYCODE_F7,
+ KEY_F8 = Common::KEYCODE_F8,
+ KEY_F9 = Common::KEYCODE_F9,
+ KEY_F10 = Common::KEYCODE_F10,
+ KEY_F11 = Common::KEYCODE_F11,
+ KEY_F12 = Common::KEYCODE_F12
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/mouse/mickey.cpp b/engines/m4/events/mickey.cpp
similarity index 97%
rename from engines/m4/mouse/mickey.cpp
rename to engines/m4/events/mickey.cpp
index 20c77f8ec61..6f97771b9fe 100644
--- a/engines/m4/mouse/mickey.cpp
+++ b/engines/m4/events/mickey.cpp
@@ -20,7 +20,7 @@
*/
#include "common/textconsole.h"
-#include "m4/mouse/mickey.h"
+#include "m4/events/mickey.h"
namespace M4 {
diff --git a/engines/m4/mouse/mickey.h b/engines/m4/events/mickey.h
similarity index 94%
rename from engines/m4/mouse/mickey.h
rename to engines/m4/events/mickey.h
index 18e6575c101..747360742ab 100644
--- a/engines/m4/mouse/mickey.h
+++ b/engines/m4/events/mickey.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_MOUSE_MICKEY_H
-#define M4_MOUSE_MICKEY_H
+#ifndef M4_EVENTS_MICKEY_H
+#define M4_EVENTS_MICKEY_H
#include "m4/m4_types.h"
diff --git a/engines/m4/mouse/mouse_handler.cpp b/engines/m4/events/mouse_handler.cpp
similarity index 96%
rename from engines/m4/mouse/mouse_handler.cpp
rename to engines/m4/events/mouse_handler.cpp
index 8e53024543d..a64f1a5e46d 100644
--- a/engines/m4/mouse/mouse_handler.cpp
+++ b/engines/m4/events/mouse_handler.cpp
@@ -20,7 +20,7 @@
*/
#include "common/textconsole.h"
-#include "m4/mouse/mouse_handler.h"
+#include "m4/events/mouse_handler.h"
namespace M4 {
diff --git a/engines/m4/mouse/mouse_handler.h b/engines/m4/events/mouse_handler.h
similarity index 93%
rename from engines/m4/mouse/mouse_handler.h
rename to engines/m4/events/mouse_handler.h
index 4e1dd91ba93..62a84718b0b 100644
--- a/engines/m4/mouse/mouse_handler.h
+++ b/engines/m4/events/mouse_handler.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_MOUSE_MOUSE_HANDLER_H
-#define M4_MOUSE_MOUSE_HANDLER_H
+#ifndef M4_EVENTS_MOUSE_HANDLER_H
+#define M4_EVENTS_MOUSE_HANDLER_H
#include "m4/m4_types.h"
#include "m4/core/mouse.h"
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index a892eab799a..375115dc979 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -129,6 +129,7 @@ public:
int _main_interface_sprite = 22;
bool _currScreen = false;
ScreenContext *_eventToScreen = nullptr;
+ byte _color = 0;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index d96b52427b0..9225dccbeff 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -39,12 +39,22 @@ int32 gr_buffer_free(Buffer *buf) {
return false;
}
-char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y) {
+byte *gr_buffer_pointer(Buffer *buf, int32 x, int32 y) {
if (!buf || !buf->data || y < 0 || x < 0) {
error_show(FL, 'BUF!', "buffer_pointer x,y = %ld,%ld", x, y);
return 0;
}
- return (char *)(buf->data + x + (y * buf->stride));
+
+ return (byte *)(buf->data + x + (y * buf->stride));
+}
+
+const byte *gr_buffer_pointer(const Buffer *buf, int32 x, int32 y) {
+ if (!buf || !buf->data || y < 0 || x < 0) {
+ error_show(FL, 'BUF!', "buffer_pointer x,y = %ld,%ld", x, y);
+ return 0;
+ }
+
+ return (byte *)(buf->data + x + (y * buf->stride));
}
int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h) {
@@ -64,7 +74,7 @@ int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h) {
return(true);
}
-bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
+bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
int32 dx, int32 dy, int32 w, int32 h) {
// stupid check for no data
if (!from || !to || !from->data || !to->data)
@@ -89,8 +99,8 @@ bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
return true;
// initialize pointers
- char *src = gr_buffer_pointer(from, sx, sy);
- char *dest = gr_buffer_pointer(to, dx, dy);
+ const byte *src = gr_buffer_pointer(from, sx, sy);
+ byte *dest = gr_buffer_pointer(to, dx, dy);
// get stride
int32 sIncr = from->stride;
diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
index 515ca8284cf..40d01869a4d 100644
--- a/engines/m4/graphics/gr_buff.h
+++ b/engines/m4/graphics/gr_buff.h
@@ -61,7 +61,8 @@ protected:
};
extern int32 gr_buffer_free(Buffer *buf);
-extern char *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
+extern byte *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
+extern const byte *gr_buffer_pointer(const Buffer *buf, int32 x, int32 y);
extern int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
/**
@@ -73,7 +74,7 @@ extern int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
* buffers, buf_rect_copy() can be used instead).
* @returns Returns true if successful.
*/
-extern bool gr_buffer_rect_copy_2(Buffer *from, Buffer *to, int32 sx, int32 sy,
+extern bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
int32 dx, int32 dy, int32 w, int32 h);
/**
diff --git a/engines/m4/graphics/gr_draw.cpp b/engines/m4/graphics/gr_draw.cpp
new file mode 100644
index 00000000000..84a3da2a5ce
--- /dev/null
+++ b/engines/m4/graphics/gr_draw.cpp
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_draw.h"
+#include "m4/graphics/gr_line.h"
+#include "m4/graphics/gr_pal.h"
+
+namespace M4 {
+
+void buffer_put_pixel(Buffer *buf, int32 x, int32 y, byte c) {
+ *(buf->data + x + (y * buf->stride)) = (uint8)c;
+}
+
+byte buffer_get_pixel(Buffer *buf, int32 x, int32 y) {
+ return(*(byte *)((int32)(buf->data) + x + (y * buf->stride)));
+}
+
+void buffer_draw_box(Buffer *buf, int32 x1, int32 y1, int32 x2, int32 y2, byte color) {
+ gr_color_set(color);
+ gr_hline(buf, x1, x2, y1);
+ gr_hline(buf, x1, x2, y2);
+ gr_vline(buf, x1, y1, y2);
+ gr_vline(buf, x2, y1, y2);
+}
+
+void buffer_draw_box_xor(Buffer *buf, int32 x1, int32 y1, int32 x2, int32 y2) {
+ gr_hline_xor(buf, x1, x2, y1);
+ gr_hline_xor(buf, x1, x2, y2);
+ gr_vline_xor(buf, x1, y1 + 1, y2 - 1);
+ gr_vline_xor(buf, x2, y1 + 1, y2 - 1);
+}
+
+int32 buffer_fill(Buffer *target, byte value) {
+ if (!target)
+ return false;
+ if (!target->data)
+ return false;
+
+ memset(target->data, value, target->stride * target->h);
+ return true;
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_draw.h b/engines/m4/graphics/gr_draw.h
new file mode 100644
index 00000000000..b2c152da955
--- /dev/null
+++ b/engines/m4/graphics/gr_draw.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_DRAW_H
+#define M4_GRAPHICS_GR_DRAW_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+/**
+ * Given X, Y sets the value of the pixel at that position
+ */
+extern void buffer_put_pixel(Buffer *buf, int32 x, int32 y, byte c);
+
+/**
+ * Given X, Y returns value of pixel at that address on the screen
+ */
+extern byte buffer_get_pixel(Buffer *buf, int32 x, int32 y);
+
+/**
+ * Draws outside edge of retangle given home and size along both axis
+ */
+extern void buffer_draw_box(Buffer *buf, int32 x1, int32 y1, int32 x2, int32 y2, byte color);
+
+/**
+ * Draws a rectangle using xor
+ */
+extern void buffer_draw_box_xor(Buffer *buf, int32 x1, int32 y1, int32 x2, int32 y2);
+
+/**
+ * Fills an entire buffer with a single byte value.
+ * @returns Returns True if successful, FALSE if buffer invalid.
+*/
+extern int32 buffer_fill(Buffer *target, byte value);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/graphics/gr_line.cpp b/engines/m4/graphics/gr_line.cpp
new file mode 100644
index 00000000000..f2d72a36479
--- /dev/null
+++ b/engines/m4/graphics/gr_line.cpp
@@ -0,0 +1,151 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_line.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void gr_vline_xor(Buffer *buf, int32 x, int32 y1, int32 y2) {
+ byte *start;
+ int32 i;
+
+ if (y1 > y2) {
+ i = y1; y1 = y2; y2 = i;
+ }
+
+ if ((x > buf->W) || (y1 > buf->h))
+ return;
+
+ if (y2 > buf->h)
+ y2 = buf->h; // Don't draw past bottom
+
+ start = buf->data + x;
+
+ for (i = y1; i < y2; i++, start += buf->stride)
+ *start ^= 0xff;
+}
+
+void gr_hline_xor(Buffer *buf, int32 x1, int32 x2, int32 y) {
+ byte *start;
+ int32 i;
+
+ if (x1 > x2) {
+ i = x1; x1 = x2; x2 = i;
+ }
+
+ if ((y > buf->h) || (x1 > buf->W))
+ return;
+
+ start = gr_buffer_pointer(buf, x1, y);
+
+ for (i = x1; i < x2; i++, start++)
+ *start ^= 0xff;
+}
+
+void gr_vline(Buffer *buf, int32 x, int32 y1, int32 y2) {
+ byte *start;
+ int32 i;
+
+ if (y1 > y2) {
+ i = y1; y1 = y2; y2 = i;
+ }
+
+ if ((x > buf->W) || (y1 > buf->h))
+ return;
+
+ y2++;
+ if (y2 > buf->h)
+ y2 = buf->h; // don't draw past bottom
+
+ start = gr_buffer_pointer(buf, x, y1);
+
+ for (i = y1; i < y2; i++, start += buf->stride)
+ *start = _G(color);
+}
+
+void gr_hline(Buffer *buf, int32 x1, int32 x2, int32 y) {
+ byte *start;
+ int32 i;
+
+ if (x1 > x2) {
+ i = x1; x1 = x2; x2 = i;
+ }
+
+ if ((y > buf->h) || (x1 > buf->W))
+ return;
+
+ start = gr_buffer_pointer(buf, x1, y);
+
+ x2++;
+ if (x2 > buf->W)
+ x2 = buf->W;
+
+ for (i = x1; i < x2; i++, start++)
+ *start = _G(color);
+}
+
+void gr_line(int32 x1, int32 y1, int32 x2, int32 y2, int32 color, Buffer *screen) {
+ byte *myData = (byte *)screen->data;
+ int32 y_unit, x_unit; // Variables for amount of change in x and y
+
+ int32 offset = y1 * screen->stride + x1; // Calculate offset into video RAM
+
+ int32 ydiff = y2 - y1; // Calculate difference between y coordinates
+ if (ydiff < 0) { // If the line moves in the negative direction
+ ydiff = -ydiff; // ...get absolute value of difference
+ y_unit = -screen->stride; // ...and set negative unit in y dimension
+ } else y_unit = screen->stride; // Else set positive unit in y dimension
+
+ int32 xdiff = x2 - x1; // Calculate difference between x coordinates
+ if (xdiff < 0) { // If the line moves in the negative direction
+ xdiff = -xdiff; // ...get absolute value of difference
+ x_unit = -1; // ...and set negative unit in x dimension
+ } else x_unit = 1; // Else set positive unit in y dimension
+
+ int32 error_term = 0; // Initialize error term
+ if (xdiff > ydiff) { // If difference is bigger in x dimension
+ int32 length = xdiff + 1; // ...prepare to count off in x direction
+ int32 i;
+ for (i = 0; i < length; i++) { // Loop through points in x direction
+ myData[offset] = (char)color; // Set the next pixel in the line to COLOR
+ offset += x_unit; // Move offset to next pixel in x direction
+ error_term += ydiff; // Check to see if move required in y direction
+ if (error_term > xdiff) { // If so...
+ error_term -= xdiff; // ...reset error term
+ offset += y_unit; // ...and move offset to next pixel in y dir.
+ }
+ }
+ } else { // If difference is bigger in y dimension
+ int32 length = ydiff + 1; // ...prepare to count off in y direction
+ for (int32 i = 0; i < length; i++) { // Loop through points in y direction
+ myData[offset] = (char)color; // Set the next pixel in the line to COLOR
+ offset += y_unit; // Move offset to next pixel in y direction
+ error_term += xdiff; // Check to see if move required in x direction
+ if (error_term > 0) { // If so...
+ error_term -= ydiff; // ...reset error term
+ offset += x_unit; // ...and move offset to next pixel in x dir.
+ }
+ }
+ }
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_line.h b/engines/m4/graphics/gr_line.h
new file mode 100644
index 00000000000..2c134a24eea
--- /dev/null
+++ b/engines/m4/graphics/gr_line.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_LINE_H
+#define M4_GRAPHICS_GR_LINE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+/**
+ * Given starting and ending points on the Y axis, and the constant
+ * X value, draws a line in the set color in the specified buffer
+ */
+extern void gr_hline(Buffer *buf, int32 x1, int32 x2, int32 y);
+
+/**
+ * Given starting and ending points on the Y axis, and the constant
+ * X value, draws a line in the given color on the live MCGA screen.
+ */
+extern void gr_vline(Buffer *buf, int32 x, int32 y1, int32 y2);
+extern void gr_hline_xor(Buffer *buf, int32 x1, int32 x2, int32 y);
+extern void gr_vline_xor(Buffer *buf, int32 x, int32 y1, int32 y2);
+extern void gr_line(int32 x1, int32 y1, int32 x2, int32 y2, int32 color, Buffer *screen);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 995445311f0..4b8b99a4099 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -23,6 +23,7 @@
#include "graphics/palette.h"
#include "common/textconsole.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/globals.h"
namespace M4 {
@@ -46,11 +47,11 @@ uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors) {
}
void gr_color_set(int32 c) {
- error("TODO: gr_color_set");
+ _G(color) = c;
}
byte gr_color_get_current() {
- error("TODO: gr_color_get_current");
+ return _G(color);
}
void gr_pal_clear(RGB8 *palette) {
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 689fd6b4540..43698aa2d64 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -20,7 +20,11 @@
*/
#include "m4/gui/gui_item.h"
+#include "m4/events/keys.h"
+#include "m4/graphics/gr_draw.h"
+#include "m4/graphics/gr_line.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/mem/mem.h"
#include "m4/globals.h"
namespace M4 {
@@ -35,8 +39,17 @@ namespace M4 {
#define _LB_WHITE 0x0f
#define _LB_BROWN 0x07
+#define STR_ITEM "gui item"
+#define STR_LIST "gui list item"
+#define STR_PROMPT "prompt"
-//INTRFACE SPRITES
+enum {
+ LIST_BY_TAG = 0,
+ LIST_ALPH,
+ LIST_SEQUN
+};
+
+// Interface sprites
#define scrollUpWidth 11
#define scrollUpHeight 12
static const byte scrollUpData[] = {
@@ -137,10 +150,1527 @@ static const byte thumbPressedData[] = {
};
static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbPressedData[0], 0 };
-#define minThumbY (scrollUpHeight + buttonHeight)
-#define maxThumbY (scrollDownHeight + thumbHeight + (buttonHeight<<1))
-#define thumbYRange (scrollUpHeight + scrollUpHeight + thumbHeight + (buttonHeight<<2) + buttonHeight - 1)
+#define minThumbY (scrollUpHeight + _G(items).buttonHeight)
+#define maxThumbY (scrollDownHeight + thumbHeight + (_G(items).buttonHeight<<1))
+#define thumbYRange (scrollUpHeight + scrollUpHeight + thumbHeight + (_G(items).buttonHeight<<2) + _G(items).buttonHeight - 1)
+
+static void Item_Clear_origPrompt();
+
+bool sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h) {
+ if ((!w) || (!h))
+ return false;
+
+ if ((el_type == MESSAGE) || (el_type == PICTURE)) {
+ *w = 0;
+ *h = 0;
+ } else {
+ *w = 3;
+ *h = 3;
+ }
+
+ return true;
+}
+
+bool sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect) {
+ if ((!myRect) || (!bdr))
+ return false;
+
+ if ((bdr->el_type == MESSAGE) || (bdr->el_type == PICTURE)) {
+ myRect->x1 = bdr->x1;
+ myRect->y1 = bdr->y1;
+ myRect->x2 = bdr->x2;
+ myRect->y2 = bdr->y2;
+ } else if ((bdr->el_type == TEXTFIELD) || (bdr->el_type == LISTBOX) || (!bdr->pressed)) {
+ myRect->x1 = bdr->x1 + 2;
+ myRect->y1 = bdr->y1 + 2;
+ myRect->x2 = bdr->x2 - 1;
+ myRect->y2 = bdr->y2 - 1;
+ } else {
+ myRect->x1 = bdr->x1 + 1;
+ myRect->y1 = bdr->y1 + 1;
+ myRect->x2 = bdr->x2 - 2;
+ myRect->y2 = bdr->y2 - 2;
+ }
+
+ return true;
+}
+
+bool drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect) {
+ int32 topLeftColor, interiorColor, bottomRightColor, bottomLeftPix, topRightPix;
+ int32 x1 = bdr->x1, y1 = bdr->y1, x2 = bdr->x2, y2 = bdr->y2;
+ bool pressed = bdr->pressed;
+
+ if (!bdr)
+ return false;
+
+ if (bdr->el_type == MESSAGE) {
+ sizeofGUIelement_interior(bdr, myRect);
+ return true;
+ }
+
+ if ((bdr->el_type == TEXTFIELD) || (bdr->el_type == LISTBOX)) {
+ if (!pressed) {
+ topLeftColor = __DKGRAY;
+ bottomRightColor = __WHITE;
+ interiorColor = __LTGRAY;
+ } else {
+ topLeftColor = __BLACK;
+ bottomRightColor = __LTGRAY;
+ interiorColor = __DKGRAY;
+ }
+ bottomLeftPix = topLeftColor;
+ topRightPix = bottomRightColor;
+ } else {
+ if (!pressed) {
+ topLeftColor = __WHITE;
+ interiorColor = __LTGRAY;
+ bottomRightColor = __DKGRAY;
+ bottomLeftPix = topLeftColor;
+ topRightPix = bottomRightColor;
+ } else {
+ topLeftColor = __BLACK;
+ interiorColor = __DKGRAY;
+ bottomRightColor = __WHITE;
+ bottomLeftPix = bottomRightColor;
+ topRightPix = topLeftColor;
+ }
+ }
+ if (bdr->fillMe == FILL_INTERIOR) {
+ gr_color_set(interiorColor);
+ gr_buffer_rect_fill(bdr->scrBuf, x1 + 1, y1 + 1, x2 - x1 - 1, y2 - y1 - 1);
+ }
+
+ gr_color_set(topLeftColor);
+ gr_hline(bdr->scrBuf, x1, x2 - 1, y1); // Top inner line
+ gr_vline(bdr->scrBuf, x1, y1 + 1, y2 - 1); // Left inner edge
+
+ gr_color_set(bottomRightColor);
+ gr_hline(bdr->scrBuf, x1 + 1, x2, y2); // Bottom outer edge
+ gr_vline(bdr->scrBuf, x2, y1 + 1, y2 - 1); // Right outer edge
+
+ buffer_put_pixel(bdr->scrBuf, x1, y2, (byte)bottomLeftPix); // Bottom left pixel
+ buffer_put_pixel(bdr->scrBuf, x2, y1, (byte)topRightPix); // Top right pixel
+
+ sizeofGUIelement_interior(bdr, myRect);
+ return true;
+}
+
+bool InitItems() {
+ _G(items).origPrompt = nullptr;
+ _G(items).undoPrompt = nullptr;
+ _G(items).currTextField = nullptr;
+ _G(items).clipBoard[0] = '\0';
+ _G(items).clipBoard[99] = '\0';
+ if (!sizeofGUIelement_border(BUTTON, &_G(items).buttonWidth, &_G(items).buttonHeight)) return false;
+ return true;
+}
+
+Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb) {
+ Item *temp;
+ if ((temp = (Item *)mem_alloc(sizeof(Item), STR_ITEM)) == nullptr)
+ return nullptr;
+
+ temp->callback = cb;
+ temp->type = type;
+ temp->prompt = nullptr;
+
+ temp->tag = tag;
+ temp->x = temp->y = temp->w = temp->h = 0;
+
+ temp->myList = nullptr;
+
+ // add to end of list
+ if (parent) {
+ while (parent->next)
+ parent = parent->next;
+ parent->next = temp;
+ temp->prev = parent;
+ } else temp->prev = nullptr;
+ temp->next = nullptr;
+ return temp;
+}
+
+void Item_destroy(Item *myItem) {
+ ListItem *myList, *tempListItem;
+ myList = myItem->myList;
+ tempListItem = myList;
+ while (tempListItem) {
+ myList = myList->next;
+ mem_free((void *)tempListItem);
+ tempListItem = myList;
+ }
+ if (myItem->prompt) mem_free(myItem->prompt);
+ mem_free((void *)myItem);
+}
+
+void Item_empty_list(Item *myItem) {
+ ListItem *myList, *tempListItem;
+ myList = myItem->myList;
+ tempListItem = myList;
+ while (tempListItem) {
+ myList = myList->next;
+ mem_free((void *)tempListItem);
+ tempListItem = myList;
+ }
+ myItem->myList = nullptr;
+ myItem->currItem = nullptr;
+ myItem->viewTop = nullptr;
+ myItem->viewBottom = nullptr;
+ myItem->myListCount = 0;
+ myItem->viewIndex = 0;
+ myItem->thumbY = minThumbY;
+}
+
+static int32 item_string_width(char *myStr, int32 spacing) {
+ char *tempPtr, *tempPtr2, *tempPtr3, highlightChar[2];
+ int32 highlightNum;
+ int32 strWidth, column;
+
+ highlightChar[0] = '~';
+ highlightChar[1] = '\0';
+ if (!myStr) return 0;
+ column = 0;
+ if ((tempPtr2 = strrchr(myStr, '^')) != nullptr) {
+ *tempPtr2 = '\0';
+ if ((tempPtr = strrchr(myStr, '^')) == nullptr) return 0;
+ tempPtr++;
+ column = (int32)atoi(tempPtr);
+ *tempPtr2 = '^';
+ tempPtr2++;
+ } else tempPtr2 = myStr;
+ tempPtr = strchr(tempPtr2, '~');
+ highlightNum = 0;
+ while (tempPtr) {
+ highlightNum++;
+ tempPtr3 = tempPtr + 1;
+ tempPtr = strchr(tempPtr3, '~');
+ }
+ strWidth = column + gr_font_string_width(tempPtr2, spacing) - (gr_font_string_width(highlightChar, spacing) * highlightNum);
+ return strWidth;
+}
+
+static int32 item_string_write(Buffer *target, char *myStr, int32 x, int32 y, int32 w, int32 spacing, int32 color, int32 highlight) {
+ char *tempPtr, *strPtr, *nextStrPtr;
+ char *highlightPtr;
+ char tempStr[2];
+ int32 currX, column;
+
+ if (!target) return false;
+ if ((tempPtr = strchr(myStr, '^')) == nullptr) {
+ if ((tempPtr = strchr(myStr, '~')) == nullptr) {
+ gr_font_set_color((char)color);
+ gr_font_write(target, myStr, x, y, w, spacing);
+ return true;
+ }
+ }
+ tempStr[1] = '\0';
+ column = 0;
+ strPtr = myStr;
+ while (strPtr) {
+ column = 0;
+ if (*strPtr == '^') {
+ if ((tempPtr = strchr((char *)(strPtr + 1), '^')) == nullptr) return false;
+ *tempPtr = '\0';
+ strPtr++;
+ column = (int32)atoi(strPtr);
+ *tempPtr = '^';
+ strPtr = tempPtr + 1;
+ }
+ currX = x + column;
+ nextStrPtr = strchr(strPtr, '^');
+ if (nextStrPtr) *nextStrPtr = '\0';
+ highlightPtr = strchr(strPtr, '~');
+ while (highlightPtr) {
+ if (highlightPtr != strPtr) {
+ *highlightPtr = '\0';
+ gr_font_set_color((char)color);
+ gr_font_write(target, strPtr, currX, y, 0, spacing);
+ currX += gr_font_string_width(strPtr, spacing);
+ *highlightPtr = '~';
+ }
+ if (*(highlightPtr + 1) == '\0') return true;
+ tempStr[0] = *(highlightPtr + 1);
+ gr_font_set_color((char)highlight);
+ gr_font_write(target, tempStr, currX, y, 0, spacing);
+ currX += gr_font_string_width(tempStr, spacing);
+ strPtr = highlightPtr + 2;
+ highlightPtr = strchr(strPtr, '~');
+ }
+ if (*strPtr != '\0') {
+ gr_font_set_color((char)color);
+ gr_font_write(target, strPtr, currX, y, 0, spacing);
+ }
+ if (nextStrPtr) *nextStrPtr = '^';
+ strPtr = nextStrPtr;
+ }
+ return true;
+}
+
+static void CorrectItemWidthHeight(Item *item, int32 fontHeight) {
+ char tempStr[2];
+ int32 tempWidth, tempHeight, minWidth, minHeight;
+
+ if (!item) return;
+
+ tempStr[0] = '~';
+ tempStr[1] = '\0';
+
+ switch (item->type) {
+ case LISTBOX:
+ minHeight = scrollUpHeight + thumbHeight + scrollDownHeight + _G(items).buttonHeight * 3; //scrollup + thumb + scrolldown heights + (newHeight for each)
+ if (!sizeofGUIelement_border(LISTBOX, &tempWidth, &tempHeight)) return;
+ minWidth = scrollUpWidth + thumbWidth + scrollDownWidth + _G(items).buttonWidth * 3 + (tempWidth + 1); //same as above + width of listbox
+ if (item->h < minHeight) item->h = minHeight;
+ if (item->w < minWidth) item->w = minWidth;
+ break;
+ case MESSAGE:
+ if (!sizeofGUIelement_border(MESSAGE, &tempWidth, &tempHeight)) return;
+ item->w = item_string_width(item->prompt, 1) + tempWidth;
+ item->h = fontHeight + tempHeight;
+ break;
+ case TEXTFIELD:
+ if (!sizeofGUIelement_border(TEXTFIELD, &tempWidth, &tempHeight)) return;
+ item->h = fontHeight + tempHeight + 1;
+ break;
+ case BUTTON:
+ case REPEAT_BUTTON:
+ if (!sizeofGUIelement_border(BUTTON, &tempWidth, &tempHeight)) return;
+ item->w = item_string_width(item->prompt, 1) + tempWidth;
+ item->h = fontHeight + tempHeight + 1;
+ break;
+ case PICTURE:
+ default:
+ break;
+ }
+}
+
+Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, char *prompt, int32 tag, enum ItemType type, M4CALLBACK cb, int32 promptMax) {
+ Item *item;
+ int32 fontHeight, listboxWidth, listboxHeight;
+ Font *myFont;
+
+ if ((item = Item_create(itemList, type, tag, cb)) == nullptr) return nullptr;
+ myFont = gr_font_get();
+ fontHeight = gr_font_get_height();
+ item->myFont = myFont;
+ item->x = x;
+ item->y = y;
+ item->w = w;
+ item->h = h;
+ item->status = ITEM_NORMAL;
+ item->callback = cb;
+
+ switch (type) {
+ case LISTBOX:
+ item->prompt = nullptr;
+ item->myListCount = 0;
+ item->viewIndex = 0;
+ item->thumbY = minThumbY;
+ item->myList = nullptr;
+ item->currItem = nullptr;
+ item->viewTop = nullptr;
+ item->viewBottom = nullptr;
+ break;
+ case PICTURE:
+ item->myFont = nullptr;
+ item->prompt = nullptr;
+ item->aux = prompt;
+ break;
+ case TEXTFIELD:
+ if ((int)strlen(prompt) > (promptMax + 1))
+ item->promptMax = strlen(prompt) + 1;
+ else
+ item->promptMax = promptMax + 1;
+
+ item->prompt = (char *)mem_alloc(item->promptMax, STR_PROMPT);
+ Common::strcpy_s(item->prompt, 256, prompt);
+ item->aux = &(item->prompt[strlen(item->prompt)]);
+ item->aux2 = item->aux;
+ break;
+ case MESSAGE:
+ case BUTTON:
+ case REPEAT_BUTTON:
+ item->prompt = mem_strdup(prompt);
+ break;
+ }
+ CorrectItemWidthHeight(item, fontHeight);
+ if (type == LISTBOX) {
+ if (!sizeofGUIelement_border(LISTBOX, &listboxWidth, &listboxHeight)) return nullptr;
+ item->listView = (item->h - listboxHeight - 2) / fontHeight;
+ }
+ return item;
+}
+
+Item *ItemFind(Item *itemList, int32 tag) {
+ if (!itemList) return nullptr;
+ if (tag > 0) {
+ while (itemList && (itemList->tag != tag)) itemList = itemList->next;
+ } else itemList = nullptr;
+ return itemList;
+}
+
+bool Item_SetViewBottom(Item *i) {
+ int32 count;
+ ListItem *myListItem;
+ bool found = false;
+
+ if ((!i) || (!i->viewTop)) return false;
+ myListItem = i->viewTop;
+ for (count = 1; (count < i->listView) && myListItem->next; count++) {
+ if (myListItem == i->currItem) found = true;
+ myListItem = myListItem->next;
+ }
+ if (myListItem == i->currItem) found = true;
+ if (count == i->listView) i->viewBottom = myListItem;
+ else i->viewBottom = nullptr;
+ return found;
+}
+
+static void CalculateViewIndex(Item *myItem) {
+ ListItem *myListItem;
+ int32 i;
+ if ((!myItem) || (!myItem->viewTop)) return;
+ i = 0;
+ myListItem = myItem->myList;
+ while (myListItem != myItem->viewTop) {
+ i++;
+ myListItem = myListItem->next;
+ }
+ myItem->viewIndex = i;
+ if (myItem->myListCount > myItem->listView) {
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ } else myItem->thumbY = minThumbY;
+}
+
+static void SetViewIndex(Item *myItem) {
+ ListItem *myListItem;
+ int32 i;
+ if ((!myItem) || (!myItem->myList)) return;
+ if (myItem->thumbY == myItem->h - maxThumbY) {
+ myItem->viewIndex = myItem->myListCount - myItem->listView;
+ } else {
+ myItem->viewIndex = ((myItem->thumbY - minThumbY) * (myItem->myListCount - myItem->listView)) / (myItem->h - thumbYRange);
+ }
+ myListItem = myItem->myList;
+ for (i = 0; i < myItem->viewIndex; i++) {
+ myListItem = myListItem->next;
+ }
+ myItem->viewTop = myListItem;
+ Item_SetViewBottom(myItem);
+}
+
+bool ListItemExists(Item *myItem, char *prompt, int32 listTag) {
+ ListItem *myListItems;
+ if (!myItem) return false;
+ myListItems = myItem->myList;
+ if (prompt) {
+ while (myListItems && strcmp(myListItems->prompt, prompt)) {
+ myListItems = myListItems->next;
+ }
+ } else {
+ while (myListItems && (myListItems->tag != listTag)) {
+ myListItems = myListItems->next;
+ }
+ }
+ if (myListItems) return true;
+ return false;
+}
+
+bool ListItemAdd(Item *myItem, char *prompt, int32 listTag, int32 addMode, ListItem *changedItem) {
+ ListItem *myList;
+ ListItem *newListItem;
+
+ if (!myItem) return false;
+ if (changedItem) newListItem = changedItem;
+ else {
+ if ((newListItem = (ListItem *)mem_alloc(sizeof(ListItem), STR_LIST)) == nullptr) return false;
+ strncpy(newListItem->prompt, prompt, 79);
+ newListItem->tag = listTag;
+ }
+ //Add it into the list in the correct place...
+ myList = myItem->myList;
+ if (!myList) {
+ newListItem->prev = nullptr;
+ newListItem->next = nullptr;
+ myItem->myList = newListItem;
+ myItem->currItem = newListItem;
+ myItem->viewTop = newListItem;
+ myItem->viewIndex = 0;
+ myItem->thumbY = minThumbY;
+ } else {
+ switch (addMode) {
+ case LIST_SEQUN:
+ while (myList->next) myList = myList->next;
+ myList->next = newListItem;
+ newListItem->prev = myList;
+ newListItem->next = nullptr;
+ break;
+ case LIST_ALPH:
+ if (strcmp(newListItem->prompt, myList->prompt) <= 0) { //add to front
+ newListItem->prev = nullptr;
+ newListItem->next = myList;
+ myList->prev = newListItem;
+ myItem->myList = newListItem;
+ myItem->currItem = newListItem;
+ myItem->viewTop = newListItem;
+ } else {
+ while (myList->next &&
+ (strcmp(newListItem->prompt, myList->next->prompt) > 0)) {
+ myList = myList->next;
+ }
+ if (myList->next) {
+ newListItem->next = myList->next;
+ newListItem->prev = myList;
+ myList->next->prev = newListItem;
+ myList->next = newListItem;
+ } else {
+ newListItem->next = nullptr;
+ newListItem->prev = myList;
+ myList->next = newListItem;
+ }
+ }
+ break;
+ case LIST_BY_TAG:
+ default:
+ if (newListItem->tag <= myList->tag) { //add to front
+ newListItem->prev = nullptr;
+ newListItem->next = myList;
+ myList->prev = newListItem;
+ myItem->myList = newListItem;
+ myItem->currItem = newListItem;
+ myItem->viewTop = newListItem;
+ } else {
+ while (myList->next && (newListItem->tag > myList->next->tag)) {
+ myList = myList->next;
+ }
+ if (myList->next) {
+ newListItem->next = myList->next;
+ newListItem->prev = myList;
+ myList->next->prev = newListItem;
+ myList->next = newListItem;
+ } else {
+ newListItem->next = nullptr;
+ newListItem->prev = myList;
+ myList->next = newListItem;
+ }
+ }
+ break;
+ }
+ if (changedItem) {
+ myItem->currItem = myList;
+ myItem->viewTop = myList;
+ }
+ }
+ myItem->myListCount++;
+ if (!Item_SetViewBottom(myItem)) ViewCurrListItem(myItem);
+ else CalculateViewIndex(myItem);
+ return true;
+}
+
+bool ListItemDelete(Item *myItem, ListItem *myListItem, int32 listTag) {
+ ListItem *myList;
+
+ if (!myItem) return false;
+ if (!myListItem) {
+ myList = myItem->myList;
+ while (myList && (myList->tag != listTag)) myList = myList->next;
+ } else myList = myListItem;
+ if (!myList) return false;
+ if (myList == myItem->myList) { //first in the list...
+ myItem->myList = myItem->myList->next;
+ if (myItem->myList) myItem->myList->prev = nullptr;
+ } else {
+ myList->prev->next = myList->next;
+ if (myList->next) myList->next->prev = myList->prev;
+ }
+ if (myList == myItem->currItem) {
+ if (myList->next) myItem->currItem = myList->next;
+ else myItem->currItem = myList->prev;
+ }
+ if (myList == myItem->viewTop) {
+ if (myItem->viewTop->prev) myItem->viewTop = myItem->viewTop->prev;
+ else myItem->viewTop = myItem->viewTop->next;
+ }
+ myItem->myListCount--;
+ Item_SetViewBottom(myItem);
+ if (!myItem->viewBottom) ViewCurrListItem(myItem);
+ else CalculateViewIndex(myItem);
+ mem_free((void *)myList);
+ return true;
+}
+
+bool ListItemChange(Item *myItem, ListItem *myListItem, int32 listTag,
+ char *newPrompt, int32 newTag, int32 changeMode) {
+ ListItem *myList;
+ int32 oldTag;
+
+ if (!myItem) return false;
+ if (!myListItem) {
+ myList = myItem->myList;
+ while (myList && (myList->tag != listTag)) myList = myList->next;
+ } else myList = myListItem;
+ if (!myList) return false;
+ if ((!strcmp(myList->prompt, newPrompt)) && (myList->tag == newTag)) return false;
+ Common::strcpy_s(myList->prompt, newPrompt);
+ oldTag = myList->tag;
+ myList->tag = newTag;
+ if (((changeMode == LIST_BY_TAG) && (oldTag != newTag)) || (changeMode == LIST_ALPH)) {
+ if (myList == myItem->myList) { //first in the list...
+ myItem->myList = myItem->myList->next;
+ if (myItem->myList) myItem->myList->prev = nullptr;
+ } else {
+ myList->prev->next = myList->next;
+ if (myList->next) myList->next->prev = myList->prev;
+ }
+ ListItemAdd(myItem, nullptr, 0, changeMode, myList);
+ }
+ return true;
+}
+
+bool GetNextListItem(Item *myItem) {
+ ListItem *nextItem;
+ if (myItem->currItem) {
+ nextItem = myItem->currItem->next;
+ if (!nextItem) return false;
+ if (myItem->currItem == myItem->viewBottom) {
+ myItem->viewBottom = nextItem;
+ myItem->viewTop = myItem->viewTop->next;
+ myItem->viewIndex++;
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ }
+ myItem->currItem = nextItem;
+ return true;
+ }
+ return false;
+}
+
+bool GetNextPageList(Item *myItem) {
+ int32 i;
+ bool changed = false;
+
+ if (myItem->currItem && myItem->viewBottom) {
+ for (i = 0; i < (myItem->listView - 1); i++) {
+ if (myItem->viewBottom->next) {
+ if (myItem->currItem == myItem->viewTop) myItem->currItem = myItem->currItem->next;
+ myItem->viewTop = myItem->viewTop->next;
+ myItem->viewBottom = myItem->viewBottom->next;
+ myItem->viewIndex++;
+ changed = true;
+ } else break;
+ }
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ }
+ return changed;
+}
+
+bool GetPrevListItem(Item *myItem) {
+ ListItem *prevItem;
+ if (myItem->currItem) {
+ prevItem = myItem->currItem->prev;
+ if (!prevItem) return false;
+ if (myItem->currItem == myItem->viewTop) {
+ myItem->viewTop = prevItem;
+ myItem->viewBottom = myItem->viewBottom->prev;
+ myItem->viewIndex--;
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ }
+ myItem->currItem = prevItem;
+ return true;
+ }
+ return false;
+}
+
+bool GetPrevPageList(Item *myItem) {
+ int32 i;
+ bool changed = false;
+
+ if (myItem->currItem && myItem->viewBottom) {
+ for (i = 0; i < (myItem->listView - 1); i++) {
+ if (myItem->viewTop->prev) {
+ if (myItem->currItem == myItem->viewBottom) myItem->currItem = myItem->currItem->prev;
+ myItem->viewTop = myItem->viewTop->prev;
+ myItem->viewBottom = myItem->viewBottom->prev;
+ myItem->viewIndex--;
+ changed = true;
+ } else break;
+ }
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ }
+ return changed;
+}
+
+void ViewCurrListItem(Item *myItem) {
+ int32 i, j;
+ ListItem *tempItem;
+ bool breakFlag = false;
+
+ if (!myItem->currItem) {
+ myItem->viewTop = nullptr;
+ myItem->viewBottom = nullptr;
+ return;
+ }
+ myItem->viewTop = myItem->currItem;
+ tempItem = myItem->currItem;
+ i = myItem->listView - 2;
+ while (tempItem->next && (i > 0)) {
+ tempItem = tempItem->next;
+ i--;
+ }
+ if (i > 0) {
+ j = 0;
+ while ((j <= i) && (!breakFlag)) {
+ if (myItem->viewTop->prev) {
+ myItem->viewTop = myItem->viewTop->prev;
+ j++;
+ } else breakFlag = true;
+ }
+ if (j > i) myItem->viewBottom = tempItem;
+ else myItem->viewBottom = nullptr;
+ } else if (!tempItem->next) {
+ if (myItem->viewTop->prev) {
+ myItem->viewTop = myItem->viewTop->prev;
+ myItem->viewBottom = tempItem;
+ } else myItem->viewBottom = nullptr;
+ } else myItem->viewBottom = tempItem->next;
+ CalculateViewIndex(myItem);
+}
+
+ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1) {
+ ListItem *myList;
+ int32 i;
+ if (!myItem) return nullptr;
+ myList = myItem->myList;
+ if (searchMode == LIST_BY_TAG) {
+ while (myList && (myList->tag != parm1)) myList = myList->next;
+ } else if (searchMode == LIST_ALPH) {
+ while (myList && scumm_strnicmp(myList->prompt, searchStr, strlen(searchStr)))
+ myList = myList->next;
+ } else if (searchMode == LIST_SEQUN) {
+ i = 0;
+ while (myList && (i < parm1)) {
+ myList = myList->next;
+ i++;
+ }
+ } else return nullptr;
+ return myList;
+}
+
+bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1) {
+ ListItem *myList;
+ myList = ListItemFind(myItem, searchMode, searchStr, parm1);
+ if (!myList) {
+ myItem->currItem = myItem->myList;
+ myItem->viewTop = myItem->myList;
+ Item_SetViewBottom(myItem);
+ CalculateViewIndex(myItem);
+ return false;
+ } else {
+ myItem->currItem = myList;
+ if (!Item_SetViewBottom(myItem)) ViewCurrListItem(myItem);
+ else CalculateViewIndex(myItem);
+ return true;
+ }
+}
+
+bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset) {
+ int32 listboxContentX2, itemOffset, fontHeight;
+ ListItem *myListItem;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
+ Font *currFont;
+
+ if (!myItem)
+ return false;
+ currFont = gr_font_get();
+ if (currFont != myItem->myFont)
+ gr_font_set(myItem->myFont);
+ fontHeight = gr_font_get_height();
+ if (currFont != myItem->myFont)
+ gr_font_set(currFont);
+
+ if (myItem->myListCount > myItem->listView) {
+ listboxContentX2 = myItem->w - scrollUpWidth - _G(items).buttonWidth - 1;
+ } else listboxContentX2 = myItem->w - 1;
+
+ bdr.el_type = LISTBOX;
+ bdr.pressed = true; //since this procedure will only be called myItem is the default item
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = listboxContentX2; bdr.y2 = myItem->h - 1;
+ if (!sizeofGUIelement_interior(&bdr, &interiorRect))
+ return false;
+
+ xOffset -= interiorRect.x1;
+ yOffset -= interiorRect.y1;
+ listboxContentX2 = interiorRect.x2 - interiorRect.x1;
+ if ((xOffset < 0) || (xOffset > listboxContentX2))
+ return false;
+ if ((yOffset < 0) || (yOffset > fontHeight *myItem->listView))
+ return false;
+ itemOffset = 0;
+ myListItem = myItem->viewTop;
+ while (myListItem && (itemOffset + fontHeight <= yOffset)) {
+ myListItem = myListItem->next;
+ itemOffset += fontHeight;
+ }
+ if (!myListItem)
+ return false;
+ myItem->currItem = myListItem;
+ return true;
+}
+
+bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType) {
+ int32 fontHeight, itemOffset, boxWidth;
+ ListItem *myListItem;
+ bool scrollable = false;
+ bool changed = false;
+ int32 newThumbY, i;
+ static int32 thumbOffset;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
+ Font *currFont;
+
+ if (!myItem) return false;
+
+ if (myItem->myListCount > myItem->listView) {
+ scrollable = true;
+ boxWidth = myItem->w - (scrollUpHeight + _G(items).buttonHeight + 1);
+
+ if (myItem->status & THUMB_PRESSED) {
+ newThumbY = yOffset - thumbOffset;
+ if (newThumbY < minThumbY) newThumbY = minThumbY;
+ else if (newThumbY > (myItem->h - maxThumbY)) newThumbY = myItem->h - maxThumbY;
+ myItem->thumbY = newThumbY;
+ SetViewIndex(myItem);
+ return true;
+ } else if (scrollType && (!(myItem->status & BOX_PRESSED)) && (xOffset >= (myItem->w - scrollUpWidth - _G(items).buttonWidth)) && (xOffset < myItem->w)) {
+ if ((yOffset >= 0) && (yOffset <= (scrollUpHeight + _G(items).buttonHeight - 1))) {
+ if (((myItem->status & AREA_PRESSED) == 0) || (myItem->status & SU_PRESSED)) {
+ myItem->status = SU_PRESSED;
+ if (myItem->viewTop->prev) {
+ myItem->viewTop = myItem->viewTop->prev;
+ myItem->viewBottom = myItem->viewBottom->prev;
+ myItem->viewIndex--;
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ changed = true;
+ } else changed = false;
+ } else changed = false;
+ } else if ((yOffset >= (scrollUpHeight + _G(items).buttonHeight)) && (yOffset < myItem->thumbY)) {
+ if ((scrollType & PAGEABLE) && ((myItem->status & AREA_PRESSED) == 0) || (myItem->status & PU_PRESSED)) {
+ myItem->status = PU_PRESSED;
+ for (i = 0; i < myItem->listView - 1; i++) {
+ if (myItem->viewTop->prev) {
+ myItem->viewTop = myItem->viewTop->prev;
+ myItem->viewBottom = myItem->viewBottom->prev;
+ myItem->viewIndex--;
+ changed = true;
+ } else break;
+ }
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else changed = false;
+ } else if ((yOffset >= (myItem->h - (scrollDownHeight + _G(items).buttonHeight))) && (yOffset < myItem->h)) {
+ if (((myItem->status & AREA_PRESSED) == 0) || (myItem->status & SD_PRESSED)) {
+ myItem->status = SD_PRESSED;
+ if (myItem->viewBottom->next) {
+ myItem->viewTop = myItem->viewTop->next;
+ myItem->viewBottom = myItem->viewBottom->next;
+ myItem->viewIndex++;
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ changed = true;
+ } else changed = false;
+ } else changed = false;
+ } else if ((scrollType & PAGEABLE) && (yOffset > (myItem->thumbY + thumbHeight + _G(items).buttonHeight)) && (yOffset < (myItem->h - scrollDownHeight - _G(items).buttonHeight))) {
+ if (((myItem->status & AREA_PRESSED) == 0) || (myItem->status & PD_PRESSED)) {
+ myItem->status = PD_PRESSED;
+ for (i = 0; i < myItem->listView - 1; i++) {
+ if (myItem->viewBottom->next) {
+ myItem->viewTop = myItem->viewTop->next;
+ myItem->viewBottom = myItem->viewBottom->next;
+ myItem->viewIndex++;
+ changed = true;
+ } else break;
+ }
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ } else changed = false;
+ } else if (((myItem->status & AREA_PRESSED) == 0) && (yOffset >= (myItem->thumbY)) && (yOffset < (myItem->thumbY + thumbHeight + _G(items).buttonHeight))) {
+ myItem->status = THUMB_PRESSED;
+ thumbOffset = yOffset - myItem->thumbY;
+ } else changed = false;
+ return changed;
+ }
+ } else boxWidth = myItem->w - 1;
+ if ((xOffset < 0) || (xOffset > boxWidth)) return false;
+ if (((myItem->status & AREA_PRESSED) == 0) || (myItem->status & BOX_PRESSED)) {
+ myItem->status = (BOX_PRESSED | ITEM_PRESSED);
+ currFont = gr_font_get();
+ if (myItem->myFont != currFont)
+ gr_font_set(myItem->myFont);
+ fontHeight = gr_font_get_height();
+ if (myItem->myFont != currFont)
+ gr_font_set(currFont);
+
+ bdr.el_type = LISTBOX;
+ bdr.pressed = true; //since this procedure will only be called myItem is the default item
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = myItem->w - 1; bdr.y2 = myItem->h - 1;
+ if (!sizeofGUIelement_interior(&bdr, &interiorRect)) return false;
+
+ yOffset -= interiorRect.y1;
+ if (yOffset < 0) {
+ if (scrollType && scrollable && myItem->viewTop->prev) {
+ myItem->viewTop = myItem->viewTop->prev;
+ myItem->viewBottom = myItem->viewBottom->prev;
+ myItem->viewIndex--;
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ }
+ myListItem = myItem->viewTop;
+ } else if (yOffset >= fontHeight * myItem->listView) {
+ if (scrollType && scrollable && myItem->viewBottom->next) {
+ myItem->viewTop = myItem->viewTop->next;
+ myItem->viewBottom = myItem->viewBottom->next;
+ myItem->viewIndex++;
+ if (myItem->viewBottom && myItem->viewBottom->next) {
+ myItem->thumbY = minThumbY + (((myItem->h - thumbYRange) * myItem->viewIndex) / (myItem->myListCount - myItem->listView));
+ } else myItem->thumbY = myItem->h - maxThumbY;
+ }
+ myListItem = myItem->viewBottom;
+ } else {
+ itemOffset = 0;
+ myListItem = myItem->viewTop;
+ while (myListItem && (itemOffset + fontHeight <= yOffset)) {
+ myListItem = myListItem->next;
+ itemOffset += fontHeight;
+ }
+ }
+ if ((!myListItem) || (myListItem == myItem->currItem))
+ return false;
+ myItem->currItem = myListItem;
+ return true;
+ }
+ return false;
+}
+
+bool ResetDefaultListBox(Item *myItem) {
+ bool changed;
+ if (!myItem) return false;
+ if ((myItem->status & AREA_PRESSED) == 0) changed = false;
+ else if (myItem->status & BOX_PRESSED) changed = false;
+ else changed = true;
+ myItem->status = ITEM_NORMAL;
+ return changed;
+}
+
+bool Item_change_prompt(Item *myItem, char *newPrompt) {
+ int32 fontHeight;
+ Font *currFont;
+ if (!strcmp(myItem->prompt, newPrompt)) return false;
+ if (myItem->type == TEXTFIELD) {
+ if ((int)strlen(newPrompt) >= myItem->promptMax)
+ myItem->promptMax = strlen(newPrompt) + 1;
+ Common::strcpy_s(myItem->prompt, 256, newPrompt);
+ myItem->aux = &(myItem->prompt[strlen(myItem->prompt)]);
+ myItem->aux2 = myItem->aux;
+ Item_Clear_origPrompt();
+ } else if (myItem->type == LISTBOX) {
+ return false;
+ } else {
+ if (strlen(myItem->prompt) < strlen(newPrompt)) {
+ mem_free(myItem->prompt);
+ myItem->prompt = mem_strdup(newPrompt);
+ } else Common::strcpy_s(myItem->prompt, 256, newPrompt);
+ }
+ currFont = gr_font_get();
+ if (myItem->myFont != currFont)
+ gr_font_set(myItem->myFont);
+ fontHeight = gr_font_get_height();
+ CorrectItemWidthHeight(myItem, fontHeight);
+ if (myItem->myFont != currFont)
+ gr_font_set(currFont);
+ return true;
+}
+
+static void Item_Clear_origPrompt() {
+ if (_G(items).origPrompt) {
+ mem_free(_G(items).origPrompt);
+ _G(items).origPrompt = nullptr;
+ }
+ if (_G(items).undoPrompt) {
+ mem_free(_G(items).undoPrompt);
+ _G(items).undoPrompt = nullptr;
+ }
+}
+
+Item *Item_RestoreTextField(void) {
+ if (!_G(items).origPrompt) return nullptr;
+ Common::strcpy_s(_G(items).currTextField->prompt, 256, _G(items).origPrompt);
+ _G(items).currTextField->aux = &(_G(items).currTextField->prompt[strlen(_G(items).currTextField->prompt)]);
+ _G(items).currTextField->aux2 = _G(items).currTextField->aux;
+ mem_free(_G(items).origPrompt);
+ _G(items).origPrompt = nullptr;
+ if (_G(items).undoPrompt) {
+ mem_free(_G(items).undoPrompt);
+ _G(items).undoPrompt = nullptr;
+ }
+ return _G(items).currTextField;
+}
+
+Item *Item_CheckTextField(void) {
+ Item *myItem = nullptr;
+ if (_G(items).origPrompt) {
+ if (strcmp(_G(items).currTextField->prompt, _G(items).origPrompt)) myItem = _G(items).currTextField;
+ Item_Clear_origPrompt();
+ }
+ return myItem;
+}
+
+void Item_SaveTextField(Item *myItem) {
+ _G(items).origPrompt = mem_strdup(myItem->prompt);
+ _G(items).currTextField = myItem;
+}
+
+static void Item_SaveTextFieldChange(Item *myItem, bool majorChange) {
+ if (_G(items).undoPrompt && (!majorChange)) return;
+ if (_G(items).undoPrompt) mem_free(_G(items).undoPrompt);
+ _G(items).undoPrompt = mem_strdup(myItem->prompt);
+ _G(items).undoAux = _G(items).undoPrompt + (myItem->aux - myItem->prompt);
+ _G(items).undoAux2 = _G(items).undoPrompt + (myItem->aux2 - myItem->prompt);
+}
+
+static bool Item_UndoTextFieldChange(void) {
+ char *tempBuf, *tempAux, *tempAux2;
+ if (_G(items).undoPrompt) {
+ tempBuf = mem_strdup(_G(items).currTextField->prompt);
+ tempAux = tempBuf + (_G(items).currTextField->aux - _G(items).currTextField->prompt);
+ tempAux2 = tempBuf + (_G(items).currTextField->aux2 - _G(items).currTextField->prompt);
+ Common::strcpy_s(_G(items).currTextField->prompt, 256, _G(items).undoPrompt);
+ _G(items).currTextField->aux = _G(items).currTextField->prompt + (_G(items).undoAux - _G(items).undoPrompt);
+ _G(items).currTextField->aux2 = _G(items).currTextField->prompt + (_G(items).undoAux2 - _G(items).undoPrompt);
+ mem_free(_G(items).undoPrompt);
+ _G(items).undoPrompt = tempBuf;
+ _G(items).undoAux = tempAux;
+ _G(items).undoAux2 = tempAux2;
+ return true;
+ }
+ return false;
+}
+
+void SetTextBlockBegin(Item *myItem, int32 relXPos) {
+ char myChar, *scan;
+ bool finished = false;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
+
+ bdr.el_type = TEXTFIELD;
+ bdr.pressed = true; //since this procedure will only be called myItem is the default item
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = myItem->w - 1; bdr.y2 = myItem->h - 1;
+ if (!sizeofGUIelement_interior(&bdr, &interiorRect)) return;
+ relXPos -= interiorRect.x1;
+ if (relXPos <= 0) myItem->aux = myItem->prompt;
+ else if (relXPos >= item_string_width(myItem->prompt, 1)) {
+ myItem->aux = &(myItem->prompt[strlen(myItem->prompt)]);
+ } else {
+ scan = &(myItem->prompt[1]);
+ finished = false;
+ while (!finished) {
+ myChar = *scan;
+ *scan = '\0';
+ if (item_string_width(myItem->prompt, 1) > relXPos) {
+ myItem->aux = scan - 1;
+ finished = true;
+ }
+ *scan++ = myChar;
+ }
+ }
+ myItem->aux2 = myItem->aux;
+}
+
+void SetTextBlockEnd(Item *myItem, int32 relXPos) {
+ char myChar, *scan;
+ bool finished = false;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
+
+ bdr.el_type = TEXTFIELD;
+ bdr.pressed = true; //since this procedure will only be called myItem is the default item
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = myItem->w - 1; bdr.y2 = myItem->h - 1;
+ if (!sizeofGUIelement_interior(&bdr, &interiorRect)) return;
+ relXPos -= interiorRect.x1;
+ if (relXPos <= 0) myItem->aux2 = myItem->prompt;
+ else if (relXPos >= item_string_width(myItem->prompt, 1)) {
+ myItem->aux2 = &(myItem->prompt[strlen(myItem->prompt)]);
+ } else {
+ scan = &(myItem->prompt[1]);
+ finished = false;
+ while (!finished) {
+ myChar = *scan;
+ *scan = '\0';
+ if (item_string_width(myItem->prompt, 1) > relXPos) {
+ myItem->aux2 = scan - 1;
+ finished = true;
+ }
+ *scan++ = myChar;
+ }
+ }
+}
+
+static int32 CopyTextBlock(Item *myItem) {
+ int32 numOfCopiedChars = 0;
+ char *beginBlock, *endBlock;
+
+ if (myItem->aux != myItem->aux2) {
+ if (myItem->aux < myItem->aux2) {
+ beginBlock = myItem->aux;
+ endBlock = myItem->aux2;
+ } else {
+ beginBlock = myItem->aux2;
+ endBlock = myItem->aux;
+ }
+ numOfCopiedChars = endBlock - beginBlock;
+ strncpy(_G(items).clipBoard, beginBlock, 99);
+ if (endBlock - beginBlock <= 99) {
+ _G(items).clipBoard[endBlock - beginBlock] = '\0';
+ } else numOfCopiedChars = 99;
+ }
+ return numOfCopiedChars;
+}
+
+static int32 DeleteTextBlock(Item *myItem) {
+ int32 numOfDeletedChars = 0;
+ char tempBuf[80], *beginBlock, *endBlock;
+
+ if (myItem->aux != myItem->aux2) {
+ Item_SaveTextFieldChange(myItem, true);
+ if (myItem->aux < myItem->aux2) {
+ beginBlock = myItem->aux;
+ endBlock = myItem->aux2;
+ } else {
+ beginBlock = myItem->aux2;
+ endBlock = myItem->aux;
+ }
+ numOfDeletedChars = endBlock - beginBlock;
+ Common::strcpy_s(tempBuf, endBlock);
+ Common::strcpy_s(beginBlock, 80, tempBuf);
+ myItem->aux = beginBlock;
+ myItem->aux2 = beginBlock;
+ }
+ return numOfDeletedChars;
+}
+
+bool Item_TextEdit(Item *myItem, int32 parm1) {
+ char tempBuf[80];
+ bool absorbed = true;
+ switch (parm1) {
+ case KEY_LEFT:
+ if (myItem->aux < myItem->aux2) myItem->aux2 = myItem->aux;
+ else if (myItem->aux > myItem->aux2) myItem->aux = myItem->aux2;
+ else if (myItem->aux != myItem->prompt) {
+ myItem->aux--;
+ myItem->aux2--;
+ }
+ break;
+ case KEY_RIGHT:
+ if (myItem->aux < myItem->aux2) myItem->aux = myItem->aux2;
+ else if (myItem->aux > myItem->aux2) myItem->aux2 = myItem->aux;
+ else if (*(myItem->aux) != '\0') {
+ myItem->aux++;
+ myItem->aux2++;
+ }
+ break;
+ case KEY_ALT_LEFT:
+ if (myItem->aux2 != myItem->prompt) {
+ myItem->aux2--;
+ }
+ break;
+ case KEY_ALT_RIGHT:
+ if (*(myItem->aux2) != '\0') {
+ myItem->aux2++;
+ }
+ break;
+ case KEY_ALT_UP:
+ if (myItem->aux2 != myItem->prompt) {
+ myItem->aux2 = myItem->prompt;
+ }
+ break;
+ case KEY_ALT_DOWN:
+ if (*(myItem->aux2) != '\0') {
+ myItem->aux2 = &(myItem->prompt[strlen(myItem->prompt)]);
+ }
+ break;
+ case KEY_HOME:
+ myItem->aux = myItem->prompt;
+ myItem->aux2 = myItem->aux;
+ break;
+ case KEY_END:
+ myItem->aux = &(myItem->prompt[strlen(myItem->prompt)]);
+ myItem->aux2 = myItem->aux;
+ break;
+ case KEY_DELETE:
+ if (!_G(items).origPrompt) Item_SaveTextField(myItem);
+ if ((DeleteTextBlock(myItem) <= 0) && (*(myItem->aux) != '\0')) {
+ Item_SaveTextFieldChange(myItem, false);
+ if (*(myItem->aux + 1) == '\0') {
+ *(myItem->aux) = '\0';
+ } else {
+ Common::strcpy_s(tempBuf, myItem->aux + 1);
+ Common::strcpy_s(myItem->aux, 80, tempBuf);
+ }
+ myItem->aux2 = myItem->aux;
+ }
+ break;
+ case KEY_BACKSP:
+ if (!_G(items).origPrompt) Item_SaveTextField(myItem);
+ if ((DeleteTextBlock(myItem) <= 0) && (myItem->aux != myItem->prompt)) {
+ Item_SaveTextFieldChange(myItem, false);
+ if (*(myItem->aux) == '\0') {
+ myItem->aux--;
+ *(myItem->aux) = '\0';
+ } else {
+ Common::strcpy_s(tempBuf, myItem->aux);
+ myItem->aux--;
+ Common::strcpy_s(myItem->aux, 80, tempBuf);
+ }
+ myItem->aux2 = myItem->aux;
+ }
+ break;
+ case KEY_ALT_X:
+ if (!_G(items).origPrompt) Item_SaveTextField(myItem);
+ if (CopyTextBlock(myItem) > 0) {
+ DeleteTextBlock(myItem);
+ }
+ break;
+ case KEY_ALT_C:
+ CopyTextBlock(myItem);
+ break;
+ case KEY_ALT_V:
+ if (!_G(items).origPrompt) Item_SaveTextField(myItem);
+ if ((int)strlen(_G(items).clipBoard) && ((int)strlen(myItem->prompt) - abs(myItem->aux2 - myItem->aux) +
+ (int)strlen(_G(items).clipBoard) < myItem->promptMax)) {
+ if (DeleteTextBlock(myItem) <= 0) Item_SaveTextFieldChange(myItem, true);
+ Common::strcpy_s(tempBuf, myItem->aux);
+ Common::strcpy_s(myItem->aux, 100, _G(items).clipBoard);
+ Common::strcat_s(myItem->prompt, 80, tempBuf);
+ myItem->aux = myItem->aux + strlen(_G(items).clipBoard);
+ myItem->aux2 = myItem->aux;
+ }
+ break;
+ case KEY_ALT_Z:
+ Item_UndoTextFieldChange();
+ break;
+ default:
+ if (parm1 >= 32 && parm1 <= 127) { // Visible key character...
+ if (!_G(items).origPrompt) Item_SaveTextField(myItem); // back up original...
+ DeleteTextBlock(myItem); // if a block was highlighted...
+ if ((int)strlen(myItem->prompt) < (myItem->promptMax - 1)) { // room in the string...
+ Item_SaveTextFieldChange(myItem, false); // save a minor change...
+ if (*(myItem->aux) == '\0') { // add to the end of the string...
+ *(myItem->aux++) = (char)parm1;
+ *(myItem->aux) = '\0';
+ } else {
+ Common::strcpy_s(tempBuf, myItem->aux);
+ *(myItem->aux++) = (char)parm1;
+ Common::strcpy_s(myItem->aux, 80, tempBuf);
+ }
+ myItem->aux2 = myItem->aux;
+ }
+ } else absorbed = false;
+ break;
+ }
+ return absorbed;
+}
+
+bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
+ int32 x1, y1, x2, y2;
+ int32 listboxContentX2, fontHeight, viewCount, temp;
+ char myChar, *beginBlock, *endBlock, tempStr[2];
+ ListItem *myList;
+ Buffer pictBuff;
+ const Buffer *tempBuff;
+ ButtonDrawRec bdr;
+ M4Rect interiorRect;
+ Font *currFont;
+
+ if (!i)
+ return false;
+
+
+ tempStr[0] = '~';
+ tempStr[1] = '\0';
+ x1 = i->x;
+ y1 = i->y;
+ x2 = x1 + i->w - 1;
+ y2 = y1 + i->h - 1;
+ if ((x1 < 0) || (y1 < 0) || (x2 >= scrBuf->W) || (y2 >= scrBuf->h)) return false;
+
+ currFont = gr_font_get();
+ if (i->myFont != currFont)
+ gr_font_set(i->myFont);
+ fontHeight = gr_font_get_height();
+
+ gr_color_set(__LTGRAY);
+ gr_buffer_rect_fill(scrBuf, x1, y1, i->w, i->h);
+
+ bdr.el_type = i->type;
+ bdr.dialog = bdrDialog;
+ bdr.scrBuf = scrBuf;
+ bdr.fillMe = FILL_INTERIOR;
+ bdr.x1 = x1;
+ bdr.y1 = y1;
+ bdr.x2 = x2;
+ bdr.y2 = y2;
+ if (((i->type == TEXTFIELD) && (itemType == ITEM_DEFAULT)) || (i->status & ITEM_PRESSED)) {
+ bdr.pressed = true;
+ } else {
+ bdr.pressed = false;
+ }
+ if ((i->type != LISTBOX) && (i->type != PICTURE)) {
+ if (!drawGUIelement(&bdr, &interiorRect)) return false;
+ x1 = interiorRect.x1;
+ y1 = interiorRect.y1;
+ x2 = interiorRect.x2;
+ y2 = interiorRect.y2;
+ }
+
+ switch (i->type) {
+ case MESSAGE:
+ item_string_write(scrBuf, i->prompt, x1, y1, 0, 1, __BLACK, __BLUE);
+ break;
+ case PICTURE:
+ pictBuff.W = i->w;
+ pictBuff.h = i->h;
+ pictBuff.stride = i->w;
+ pictBuff.data = (uint8 *)(i->aux);
+ gr_buffer_rect_copy_2(&pictBuff, scrBuf, 0, 0, x1, y1, pictBuff.W, pictBuff.h);
+ break;
+ case TEXTFIELD:
+ if (itemType == ITEM_DEFAULT) {
+ gr_font_set_color(__GREEN);
+ gr_font_write(scrBuf, i->prompt, x1, y1, 0, 1);
+ if (i->aux == i->aux2) {
+ myChar = *(i->aux);
+ *(i->aux) = '\0';
+ temp = x1 + gr_font_string_width(i->prompt, 1);
+ *(i->aux) = myChar;
+ gr_color_set(__RED);
+ gr_vline(scrBuf, temp, y1, y2);
+ } else {
+ if (i->aux < i->aux2) {
+ beginBlock = i->aux;
+ endBlock = i->aux2;
+ } else {
+ beginBlock = i->aux2;
+ endBlock = i->aux;
+ }
+ myChar = *beginBlock;
+ *beginBlock = '\0';
+ temp = x1 + gr_font_string_width(i->prompt, 1);
+ *beginBlock = myChar;
+ myChar = *endBlock;
+ *endBlock = '\0';
+ gr_color_set(__RED);
+ gr_buffer_rect_fill(scrBuf, temp, y1, gr_font_string_width(beginBlock, 1) + 1, fontHeight + 1);
+ gr_font_set_color(__WHITE);
+ gr_font_write(scrBuf, beginBlock, temp, y1, 0, 1);
+ *endBlock = myChar;
+ }
+ } else {
+ gr_font_set_color(__BLACK);
+ gr_font_write(scrBuf, i->prompt, x1, y1, 0, 1);
+ }
+ break;
+
+ case BUTTON:
+ case REPEAT_BUTTON:
+ gr_color_set(__DKGRAY);
+ if (i->status & ITEM_PRESSED) {
+ item_string_write(scrBuf, i->prompt, x1, y1, 0, 1, __RED, __BLUE);
+ } else {
+ item_string_write(scrBuf, i->prompt, x1, y1, 0, 1, __BLACK, __BLUE);
+ }
+ if (itemType == ITEM_RETURN) {
+ bdr.fillMe = false; bdr.el_type = BUTTON; bdr.pressed = false;
+ bdr.x1 = i->x - _G(items).buttonWidth;
+ bdr.y1 = i->y - _G(items).buttonHeight;
+ bdr.x2 = i->x + i->w + _G(items).buttonWidth - 1;
+ bdr.y2 = i->y + i->h + _G(items).buttonHeight - 1;
+ drawGUIelement(&bdr, nullptr);
+ }
+ break;
+
+ case LISTBOX:
+ if (i->myListCount > i->listView) {
+ listboxContentX2 = x2 - (_G(items).buttonWidth + scrollUpWidth);
+
+ //DRAW IN THE PIPES BEHIND THE THUMB
+ temp = y1 + i->thumbY;
+ bdr.pressed = false;
+ bdr.fillMe = true;
+ bdr.el_type = TEXTFIELD;
+ bdr.x1 = listboxContentX2 + 4; bdr.y1 = y1 + (scrollUpHeight >> 1); bdr.x2 = x2 - 4; bdr.y2 = temp + (thumbHeight >> 1);
+ drawGUIelement(&bdr, nullptr);
+ bdr.x1 = listboxContentX2 + 4; bdr.y1 = temp + (thumbHeight >> 1); bdr.x2 = x2 - 4; bdr.y2 = y2 - (scrollDownHeight >> 1);
+ drawGUIelement(&bdr, nullptr);
+ bdr.el_type = BUTTON;
+
+ if (i->status & THUMB_PRESSED) {
+ bdr.pressed = true;
+ tempBuff = &thumbPressedBuff;
+ } else {
+ bdr.pressed = false;
+ tempBuff = &thumbBuff;
+ }
+ bdr.x1 = listboxContentX2 + 1; bdr.y1 = temp; bdr.x2 = x2; bdr.y2 = temp + thumbHeight + _G(items).buttonHeight - 1;
+ drawGUIelement(&bdr, &interiorRect);
+ gr_buffer_rect_copy_2(tempBuff, scrBuf, 0, 0, (short)interiorRect.x1, interiorRect.y1, thumbWidth, thumbHeight);
+
+ if (i->status & SU_PRESSED) {
+ bdr.pressed = true;
+ tempBuff = &scrollUpPressedBuff;
+ } else {
+ bdr.pressed = false;
+ tempBuff = &scrollUpBuff;
+ }
+ bdr.x1 = listboxContentX2 + 1; bdr.y1 = y1; bdr.x2 = x2; bdr.y2 = y1 + scrollUpHeight + _G(items).buttonHeight - 1;
+ drawGUIelement(&bdr, &interiorRect);
+ gr_buffer_rect_copy_2(tempBuff, scrBuf, 0, 0, (short)interiorRect.x1, interiorRect.y1, scrollUpWidth, scrollUpHeight);
+
+ if (i->status & SD_PRESSED) {
+ bdr.pressed = true;
+ tempBuff = &scrollDownPressedBuff;
+ } else {
+ bdr.pressed = false;
+ tempBuff = &scrollDownBuff;
+ }
+ bdr.x1 = listboxContentX2 + 1; bdr.y1 = y2 - (scrollDownHeight + _G(items).buttonHeight) + 1; bdr.x2 = x2; bdr.y2 = y2;
+ drawGUIelement(&bdr, &interiorRect);
+ gr_buffer_rect_copy_2(tempBuff, scrBuf, 0, 0, (short)interiorRect.x1, interiorRect.y1, scrollDownWidth, scrollDownHeight);
+ } else {
+ listboxContentX2 = x2 + 1;
+ }
+ if (itemType == ITEM_DEFAULT) bdr.pressed = true;
+ else bdr.pressed = false;
+ bdr.el_type = LISTBOX;
+ bdr.x1 = x1; bdr.y1 = y1; bdr.x2 = listboxContentX2 - 1; bdr.y2 = y2;
+ drawGUIelement(&bdr, &interiorRect);
+ x1 = interiorRect.x1;
+ y1 = interiorRect.y1;
+ myList = i->viewTop;
+ viewCount = 0;
+ while (myList && (viewCount < i->listView)) {
+ if (myList == i->currItem) {
+ item_string_write(scrBuf, myList->prompt, x1, y1 + (fontHeight * (viewCount)), 0, 1, __RED, __BLUE);
+ } else if (itemType == ITEM_DEFAULT) {
+ item_string_write(scrBuf, myList->prompt, x1, y1 + (fontHeight * (viewCount)), 0, 1, __WHITE, __BLUE);
+ } else {
+ item_string_write(scrBuf, myList->prompt, x1, y1 + (fontHeight * (viewCount)), 0, 1, __BLACK, __BLUE);
+ }
+ viewCount++;
+ myList = myList->next;
+ }
+ break;
+ }
+ if (i->myFont != currFont)
+ gr_font_set(currFont);
+ return true;
+}
+
+Item *Item_set_pressed(Item *itemList, Item *myItem, int32 tag) {
+ if (!myItem) myItem = ItemFind(itemList, tag);
+ if (myItem) myItem->status = (myItem->status & AREA_PRESSED) + ITEM_PRESSED;
+ else return nullptr;
+ return myItem;
+}
+
+Item *Item_set_unpressed(Item *itemList, Item *myItem, int32 tag) {
+ if (!myItem) myItem = ItemFind(itemList, tag);
+ if (myItem) myItem->status = ITEM_NORMAL;
+ else return nullptr;
+ return myItem;
+}
+
+Item *Item_set_default(Item *itemList, Item *currDefault, int32 tag) {
+ Item *myItem = nullptr;
+ if (tag > 0) {
+ myItem = itemList;
+ while (myItem && (myItem->tag != tag)) myItem = myItem->next;
+ }
+ if (myItem != currDefault) {
+ if (currDefault) {
+ currDefault->status = ITEM_NORMAL;
+ }
+ if (myItem && (myItem->type == TEXTFIELD)) {
+ myItem->aux = myItem->prompt;
+ myItem->aux2 = &(myItem->prompt[strlen(myItem->prompt)]);
+ } else if (myItem && (myItem->type != LISTBOX)) myItem = nullptr;
+ }
+ if (myItem) myItem->status = (myItem->status & AREA_PRESSED) + ITEM_PRESSED;
+ return myItem;
+}
+Item *Item_set_next_default(Item *currDefault, Item *itemList) {
+ Item *nextDefault;
+ if (currDefault) {
+ nextDefault = currDefault->next;
+ while (nextDefault && (nextDefault->type != LISTBOX) && (nextDefault->type != TEXTFIELD)) {
+ nextDefault = nextDefault->next;
+ }
+ if (!nextDefault) nextDefault = itemList;
+ while (nextDefault && (nextDefault->type != LISTBOX) && (nextDefault->type != TEXTFIELD)) {
+ nextDefault = nextDefault->next;
+ }
+ } else {
+ nextDefault = itemList;
+ while (nextDefault && (nextDefault->type != LISTBOX) && (nextDefault->type != TEXTFIELD)) {
+ nextDefault = nextDefault->next;
+ }
+ }
+ if (nextDefault != currDefault) {
+ if (currDefault) {
+ currDefault->status = ITEM_NORMAL;
+ }
+ if (nextDefault->type == TEXTFIELD) {
+ nextDefault->aux = nextDefault->prompt;
+ nextDefault->aux2 = &(nextDefault->prompt[strlen(nextDefault->prompt)]);
+ }
+ nextDefault->status = ITEM_PRESSED;
+ }
+ return nextDefault;
+}
+Item *Item_set_prev_default(Item *currDefault, Item *listBottom) {
+ Item *prevDefault;
+ if (currDefault) {
+ prevDefault = currDefault->prev;
+ while (prevDefault && (prevDefault->type != LISTBOX) && (prevDefault->type != TEXTFIELD)) {
+ prevDefault = prevDefault->prev;
+ }
+ if (!prevDefault) prevDefault = listBottom;
+ while (prevDefault && (prevDefault->type != LISTBOX) && (prevDefault->type != TEXTFIELD)) {
+ prevDefault = prevDefault->prev;
+ }
+ } else {
+ prevDefault = listBottom;
+ while (prevDefault && (prevDefault->type != LISTBOX) && (prevDefault->type != TEXTFIELD)) {
+ prevDefault = prevDefault->prev;
+ }
+ }
+ if (prevDefault != currDefault) {
+ if (currDefault) {
+ currDefault->status = ITEM_NORMAL;
+ }
+ if (prevDefault->type == TEXTFIELD) {
+ prevDefault->aux = prevDefault->prompt;
+ prevDefault->aux2 = &(prevDefault->prompt[strlen(prevDefault->prompt)]);
+ }
+ prevDefault->status = ITEM_PRESSED;
+ }
+ return prevDefault;
+}
} // End of namespace M4
diff --git a/engines/m4/gui/gui_item.h b/engines/m4/gui/gui_item.h
index 358b48e8dfe..395fdbf5436 100644
--- a/engines/m4/gui/gui_item.h
+++ b/engines/m4/gui/gui_item.h
@@ -28,6 +28,27 @@
namespace M4 {
+#define ITEM_NORMAL 0x00000
+#define ITEM_PRESSED 0x00001
+
+#define ITEM_DEFAULT 0x00001
+#define ITEM_RETURN 0x00002
+
+#define SU_PRESSED 0x0100
+#define SD_PRESSED 0x0200
+#define PU_PRESSED 0x0400
+#define PD_PRESSED 0x0800
+#define THUMB_PRESSED 0x1000
+#define BOX_PRESSED 0x2000
+#define AREA_PRESSED 0x3f00
+
+#define NO_SCROLL 0x0000
+#define SCROLLABLE 0x0001
+#define PAGEABLE 0x0002
+
+#define FILL_INTERIOR 1 // a flag for use by DrawTile
+#define BORDER 0
+
enum ItemType {
MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
};
@@ -76,16 +97,16 @@ struct Item {
};
struct Item_Globals {
- char *_origPrompt;
- char *_undoPrompt;
- char *_undoAux;
- char *_undoAux2;
- Item *_currTextField;
+ char *origPrompt = nullptr;
+ char *undoPrompt = nullptr;
+ char *undoAux = nullptr;
+ char *undoAux2 = nullptr;
+ Item *currTextField = nullptr;
- int32 _buttonWidth;
- int32 _buttonHeight;
+ int32 buttonWidth = 0;
+ int32 buttonHeight = 0;
- char _clipBoard[100];
+ char clipBoard[100] = { 0 };
};
extern bool InitItems(void);
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 9432450d414..4e328fe3949 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -24,8 +24,8 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/core/mouse.h"
-#include "m4/mouse/mickey.h"
-#include "m4/mouse/mouse_handler.h"
+#include "m4/events/mickey.h"
+#include "m4/events/mouse_handler.h"
#include "m4/mem/memman.h"
#include "m4/globals.h"
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 557b71d8a71..182a31ea151 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -19,14 +19,18 @@ MODULE_OBJS = \
core/errors.o \
core/imath.o \
core/mouse.o \
+ events/mickey.o \
+ events/mouse_handler.o \
fileio/extensions.o \
fileio/fileio.o \
fileio/fstream.o \
fileio/info.o \
fileio/sys_file.o \
graphics/gr_buff.o \
+ graphics/gr_draw.o \
graphics/gr_color.o \
graphics/gr_font.o \
+ graphics/gr_line.o \
graphics/gr_pal.o \
graphics/gr_series.o \
graphics/graphics.o \
@@ -42,8 +46,6 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
- mouse/mickey.o \
- mouse/mouse_handler.o \
platform/timer.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
Commit: a6584a6677ffa946845a233d74e89d974332f95b
https://github.com/scummvm/scummvm/commit/a6584a6677ffa946845a233d74e89d974332f95b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding gui_dialog.cpp and dependencies
Changed paths:
A engines/m4/graphics/krn_pal.cpp
A engines/m4/graphics/krn_pal.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_buff.h
engines/m4/graphics/gr_font.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_dialog.h
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_item.h
engines/m4/gui/gui_sys.cpp
engines/m4/gui/gui_vmng_core.cpp
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 9a53e4382a4..164cc70d340 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -80,6 +80,7 @@ bool Globals::init() {
error_show(FL, 'FNF!', "stream script");
main_cold_data_init();
+ create_mouse_watch_dialog();
global_menu_system_init();
return true;
@@ -165,7 +166,7 @@ void Globals::game_systems_shutdown() {
f_stream_Shutdown();
term_message("mouse dialog be gone!");
- DialogDestroy(mousePosDialog, NULL);
+ DialogDestroy(_mousePosDialog, NULL);
term_message("sounds stop");
midi_stop();
@@ -221,6 +222,11 @@ bool Globals::woodscript_init() {
return true;
}
+void Globals::woodscript_shutdown() {
+ ShutdownWSAssets();
+ ws_Shutdown();
+}
+
void Globals::grab_fonts() {
term_message("Grabbing fonts");
@@ -233,9 +239,41 @@ void Globals::grab_fonts() {
_font_misc = gr_font_load("FONTMISC.FNT");
}
-void Globals::woodscript_shutdown() {
- ShutdownWSAssets();
- ws_Shutdown();
+void Globals::create_mouse_watch_dialog() {
+ int x_offset;
+
+ gr_font_set(_font_tiny);
+ _mousePosDialog = DialogCreateAbsolute(0, 380, 200, 480, 3 | SF_GET_MOUSE);
+ _showMousePos = false;
+ x_offset = 64;
+
+ Dialog_Add_Message(_mousePosDialog, 4, 4, "Scene:", 0);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 4, "0", 1);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 14, "Mouse:", 0);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 14, "0", 2);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 22, "0", 3);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 32, "Player:", 0);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 32, "0", 4);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 40, "0", 5);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 50, "Scale:", 0);
+ Dialog_Add_Message(_mousePosDialog, 43, 50, "0", 6);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 60, "Depth:", 0);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 60, "0", 7);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 70, "Camera:", 0);
+ Dialog_Add_Message(_mousePosDialog, x_offset, 70, "0", 8);
+
+ Dialog_Add_Message(_mousePosDialog, 4, 80, "D:W:", 0);
+ Dialog_Add_Message(_mousePosDialog, 35, 80, "0", 9);
+
+ Dialog_Add_Message(_mousePosDialog, x_offset, 50, "Facing:", 0);
+ Dialog_Add_Message(_mousePosDialog, 115, 50, "0", 10);
+
+ Dialog_Configure(_mousePosDialog, 0, 0, 0);
}
} // namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 375115dc979..c2485753d25 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -34,6 +34,7 @@
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_color.h"
#include "m4/graphics/gr_font.h"
+#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
@@ -56,8 +57,10 @@ private:
void game_systems_shutdown();
void fire_up_gui();
bool woodscript_init();
- void grab_fonts();
void woodscript_shutdown();
+ void grab_fonts();
+ void create_mouse_watch_dialog();
+
protected:
virtual void main_cold_data_init() = 0;
@@ -79,6 +82,7 @@ public:
Rails_Globals _rails;
Catalog _catalog;
MouseInfo _MouseState;
+ Dialog_Globals _dialog;
Item_Globals _items;
bool _cheat_keys_enabled = false;
@@ -115,11 +119,6 @@ public:
int32 _sizeMem[_MEMTYPE_LIMIT] = { 0 };
int32 _requests[_MEMTYPE_LIMIT] = { 0 };
void *_memBlock[_MEMTYPE_LIMIT] = { nullptr };
- bool _okButton = false;
- bool _movingScreen = false;
- Item *_clickItem = nullptr;
- Item *_doubleClickItem = nullptr;
- char _listboxSearchStr[80] = { 0 };
RGB8 _master_palette[256];
strmRequest *_firstStream = nullptr;
strmRequest *_lastStream = nullptr;
@@ -130,6 +129,8 @@ public:
bool _currScreen = false;
ScreenContext *_eventToScreen = nullptr;
byte _color = 0;
+ Dialog *_mousePosDialog = nullptr;
+ bool _showMousePos = false;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 9225dccbeff..0c4a57ada6a 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -21,11 +21,95 @@
#include "m4/graphics/gr_buff.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/gui/gui_vmng_core.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
+#include "m4/term.h"
namespace M4 {
+GrBuff::GrBuff(int32 _w, int32 _h) {
+ w = _w;
+ h = _h;
+ x_off = y_off = 0;
+ pitch = _w;
+ height = _h;
+ alloc_pixmap();
+}
+
+GrBuff::GrBuff(int32 _w, int32 _h, int32 _x_off, int32 _y_off, int32 _pitch, int32 _height) {
+ w = _w;
+ h = _h;
+ x_off = _x_off;
+ y_off = _y_off;
+ pitch = _pitch;
+ height = _height;
+ alloc_pixmap();
+}
+
+GrBuff::~GrBuff() {
+ if (pixmap)
+ DisposeHandle(pixmap);
+}
+
+void GrBuff::lock() {
+ if (!pixmap)
+ return;
+
+ HLock(pixmap);
+}
+
+void GrBuff::release() {
+ if (pixmap)
+ HUnLock(pixmap);
+}
+
+void GrBuff::alloc_pixmap() {
+ pixmap = NewHandle(pitch * height, "pixmap");
+ if (!pixmap) {
+ term_message("GrBuff::alloc_pixmap(): Trying to free up %ld bytes", pitch * height);
+ if (MakeMem(pitch * height, "pixmap"))
+ {
+ pixmap = NewHandle(pitch * height, "pixmap");
+ if (!pixmap)
+ error_show(FL, 15, "pixmap h:%ld w:%ld bytes:%ld", height, pitch, pitch * height);
+ } else
+ error_show(FL, 1, "GrBuff::alloc_pixmap() x, y: %ld %ld", pitch, height);
+ }
+ HLock(pixmap);
+ memset(*pixmap, __BLACK, pitch * height);
+ HUnLock(pixmap);
+}
+
+uint8 *GrBuff::get_pixmap() {
+ if (pixmap)
+ {
+ lock();
+ return (uint8 *)*pixmap;
+ }
+ return NULL;
+}
+
+Buffer *GrBuff::get_buffer() {
+ if (pixmap)
+ {
+ lock();
+ dummy.data = (uint8 *)*pixmap;
+ dummy.W = w;
+ dummy.h = h;
+ dummy.encoding = 0;
+ dummy.stride = pitch;
+
+ return &dummy;
+ }
+ return NULL;
+}
+
+void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2) {
+ vmng_refresh_video(scrnX, scrnY, x1, y1, x2, y2, get_buffer());
+}
+
+
int32 gr_buffer_free(Buffer *buf) {
buf->W = buf->h = buf->stride = 0;
diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
index 40d01869a4d..5ddd9310cf8 100644
--- a/engines/m4/graphics/gr_buff.h
+++ b/engines/m4/graphics/gr_buff.h
@@ -23,23 +23,31 @@
#define M4_GRAPHICS_GR_BUFF_H
#include "m4/m4_types.h"
+#include "m4/mem/reloc.h"
namespace M4 {
class GrBuff {
+protected:
+ void alloc_pixmap();
+
+ Buffer dummy;
+ MemHandle pixmap;
+public:
+ int32 w, h, x_off, y_off, pitch, height;
+
public:
GrBuff(int32 _w, int32 _h);
GrBuff(int32 _w, int32 _h, int32 _x_off, int32 _y_off, int32 _pitch, int32 _height);
virtual ~GrBuff();
- void *operator new(size_t sz);
- void operator delete(void *ptr, size_t);
-
- // note: get_buffer will return the whole pixmap, not the
- // subrectangle specified via x_off, y_off, w, h, and pitch.
- // get_buffer will lock the pixmap, unlock it after use, SVP.
- // DO NOT FREE THE RETURNED BUFFER!
-
+ /**
+ * Get buffer pointer
+ * @remarks Get_buffer will return the whole pixmap, not the
+ * subrectangle specified via x_off, y_off, w, h, and pitch.
+ * get_buffer will lock the pixmap, unlock it after use, SVP.
+ * DO NOT FREE THE RETURNED BUFFER!
+ */
Buffer *get_buffer();
uint8 *get_pixmap();
@@ -48,16 +56,6 @@ public:
void lock();
void release();
void refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2);
-
- int32 width, Height, x_off, y_off, stride, buffer_lines;
-
- int32 lock_count;
-
-protected:
- void alloc_pixmap();
-
- Buffer dummy;
- Handle pixmap;
};
extern int32 gr_buffer_free(Buffer *buf);
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index cba3a105876..0a9cd2d021c 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -29,8 +29,8 @@
namespace M4 {
-#define font_width 2 /* offset to width array */
-#define font_data 130 /* offset to data array */
+#define font_width 2 /* offset to width array */
+#define font_data 130 /* offset to data array */
#define STR_FONTSTRUCT "font struct"
#define STR_FONTWIDTH "font widths"
#define STR_FONTOFF "font offsets"
@@ -243,6 +243,100 @@ int32 gr_font_get_height() {
return (int32)_G(font)->max_y_size;
}
+
+int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y, int32 w, int32 auto_spacing) {
+ if (!target || !out_string)
+ return x;
+
+ if (_G(custom_ascii_converter)) { // if there is a function to convert the extended ASCII characters
+ _G(custom_ascii_converter)(out_string); // call it with the string
+ }
+
+ int32 i, j;
+ int32 target_w;
+ if (w)
+ target_w = imath_min(target->W, x + w);
+ else
+ target_w = target->W;
+
+ x += 1; y += 1;
+ int32 skipTop = 0;
+ if (y < 0) {
+ skipTop = -y;
+ y = 0;
+ }
+
+ int32 height = imath_max(0, (int32)_G(font)->max_y_size - skipTop);
+ if (!height)
+ return x;
+
+ int32 bottom = y + height - 1;
+ if (bottom > (target->h - 1)) {
+ height -= imath_min((int32)height, (bottom - (target->h - 1)));
+ }
+
+ if (height <= 0)
+ return x;
+
+ byte *target_ptr = gr_buffer_pointer(target, x, y);
+ byte *prev_target_ptr = target_ptr;
+
+ int32 cursX = x;
+ Byte *widthArray = _G(font)->width;
+ Byte *fontPixData = _G(font)->pixData;
+ short *offsetArray = _G(font)->offset;
+
+ while (*out_string)
+ {
+ char c = (*out_string++) & (char)0x7f;
+ int32 wdth = widthArray[c];
+
+ // if width is zero, nothing to draw
+
+ if (wdth) {
+ if ((cursX + wdth) >= target_w) // if character doesn't fit in buffer, abort
+ return cursX;
+
+ int32 offset = offsetArray[c];
+ Byte *charData = &fontPixData[offset];
+
+ int32 bytesInChar = (_G(font)->width[c] >> 2) + 1; //bytesPer[wdth]; // 2 bits per pixel
+ if (skipTop)
+ charData += bytesInChar * skipTop;
+
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < bytesInChar; j++) {
+ Byte workByte = *charData++;
+ if (workByte & 0xc0)
+ *target_ptr = font_colors[(workByte & 0xc0) >> 6];
+ target_ptr++;
+ if (workByte & 0x30)
+ *target_ptr = font_colors[(workByte & 0x30) >> 4];
+ target_ptr++;
+ if (workByte & 0xc)
+ *target_ptr = font_colors[(workByte & 0xc) >> 2];
+ target_ptr++;
+ if (workByte & 0x3)
+ *target_ptr = font_colors[workByte & 0x3];
+ target_ptr++;
+
+ } // end bytes per character line loop
+
+ target_ptr += target->stride - (bytesInChar << 2);
+
+ } // end for height loop
+
+ target_ptr = prev_target_ptr + wdth + auto_spacing; // one pixel space
+ prev_target_ptr = target_ptr;
+
+ } // end if there was a drawable character
+
+ cursX += w;
+ } // end while there is a character to draw loop
+
+ return(cursX);
+}
+
Font *gr_font_load(const char *fontName) {
uint8 buffer[10];
uint32 tag;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
new file mode 100644
index 00000000000..4dee90a9abb
--- /dev/null
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/krn_pal.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
+ int32 x, y, r, g, b, i;
+ uint8 *inverse_palette, pixel, *tempPtr;
+ frac16 fracPercent;
+ RGB8 *pal;
+ uint8 luminancePal[256];
+
+ //paremeter verification
+ if ((!target) || (!target->data)) {
+ return;
+ }
+ if ((percent < 0) || (percent == 100)) {
+ return;
+ }
+
+ if (percent == 0) {
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(target, 0, 0, target->W, target->h);
+ return;
+ }
+
+ //calculate the frac16 form of the percent
+ fracPercent = (percent * 255) / 100;
+
+ //get the palette and the inverse palette
+ pal = &_G(master_palette)[0];
+ inverse_palette = _G(inverse_pal)->get_ptr();
+ if ((!pal) || (!inverse_palette)) {
+ return;
+ }
+
+ //calculate the luminance Pal table
+ for (i = 0; i < 256; i++) {
+ r = ((((pal[i].r * fracPercent) >> 10) >> 1)) & 0x1f;
+ g = ((((pal[i].g * fracPercent) >> 10) >> 1)) & 0x1f;
+ b = ((((pal[i].b * fracPercent) >> 10) >> 1)) & 0x1f;
+ luminancePal[i] = inverse_palette[(r << 10) + (g << 5) + b];
+ }
+
+ // note: this loop should be y0 to y1, x0 to x1, not a stride*h loop.
+ //loop through every pixel replacing it with the index into the luminance table
+ tempPtr = target->data;
+ for (y = 0; y < target->h; y++) {
+ for (x = 0; x < target->stride; x++) {
+ *tempPtr = luminancePal[*tempPtr];
+ tempPtr++;
+ pixel = *tempPtr;
+ }
+ }
+
+ _G(inverse_pal)->release();
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
new file mode 100644
index 00000000000..f277520ce2d
--- /dev/null
+++ b/engines/m4/graphics/krn_pal.h
@@ -0,0 +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/>.
+ *
+ */
+
+#ifndef M4_GRAPHICS_KRN_PAL_H
+#define M4_GRAPHICS_KRN_PAL_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void krn_ChangeBufferLuminance(Buffer *target, int32 percent);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 3f28ed630d9..232de4917f4 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -20,13 +20,31 @@
*/
#include "m4/gui/gui_dialog.h"
+#include "m4/gui/gui_event.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/gui/gui.h"
+#include "m4/core/imath.h"
+#include "m4/events/keys.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/graphics/graphics.h"
+#include "m4/graphics/krn_pal.h"
+#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
#include "m4/globals.h"
namespace M4 {
+#define _GD(X) _G(dialog).X
+#define STR_DIALOG "dialog box"
+#define STR_TEXTSCRN "text screen"
+
+static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY);
+static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
+static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
+
bool gui_dialog_init() {
- _G(listboxSearchStr)[0] = '\0';
+ _GD(listboxSearchStr)[0] = '\0';
return true;
}
@@ -46,15 +64,1329 @@ void vmng_TextScrn_Destroy(TextScrn *myTextScrn) {
}
delete myTextScrn->textScrnBuffer;
- mem_free((void *)myTextScrn);
+ mem_free(myTextScrn);
+}
+
+Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrnFlags) {
+ Buffer *tempBuffer;
+ Dialog *dialog;
+ ButtonDrawRec bdr;
+
+ if ((dialog = (Dialog *)mem_alloc(sizeof(Dialog), STR_DIALOG)) == nullptr) {
+ return nullptr;
+ }
+
+ dialog->w = x2 - x1 + 1;
+ dialog->h = y2 - y1 + 1;
+
+ dialog->dlgBuffer = new GrBuff(x2 - x1 + 1, y2 - y1 + 1);
+
+ if (!dialog->dlgBuffer) {
+ return nullptr;
+ }
+
+ dialog->num_items = 0;
+ dialog->itemList = nullptr;
+
+ dialog->cancel_item = dialog->return_item = dialog->default_item = nullptr;
+
+ if (!vmng_screen_create(x1, y1, x2, y2, SCRN_DLG, scrnFlags, (void *)dialog,
+ (RefreshFunc)DialogShow, (EventHandler)Dialog_EventHandler)) return nullptr;
+
+ // Draw dialog box bounding rectangle
+ tempBuffer = dialog->dlgBuffer->get_buffer();
+ bdr.dialog = (void *)dialog;
+ bdr.scrBuf = tempBuffer;
+ bdr.fillMe = FILL_INTERIOR;
+ bdr.pressed = false; bdr.el_type = DIALOGBOX;
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = dialog->w - 1; bdr.y2 = dialog->h - 1;
+ drawGUIelement(&bdr, nullptr);
+ dialog->dlgBuffer->release();
+
+ return dialog;
+}
+
+Dialog *DialogCreate(M4Rect *r, uint32 scrnFlags) {
+ return DialogCreateAbsolute(r->x1, r->y1, r->x2, r->y2, scrnFlags);
}
void vmng_Dialog_Destroy(Dialog *d) {
- error("TODO: vmng_Dialog_Destroy");
+ Item *myItems;
+ Item *tempItem;
+ tempItem = myItems = d->itemList;
+ while (tempItem) {
+ myItems = myItems->next;
+ Item_destroy(tempItem);
+ tempItem = myItems;
+ }
+ delete d->dlgBuffer;
+ mem_free((void *)d);
+}
+
+void DialogDestroy(Dialog *d, M4Rect *r) {
+ ScreenContext *myScreen;
+
+ if (!d) return;
+ if (r) {
+ if ((myScreen = vmng_screen_find((void *)d, nullptr)) != nullptr) {
+ r->x1 = myScreen->x1;
+ r->x2 = myScreen->x2;
+ r->y1 = myScreen->y1;
+ r->y2 = myScreen->y2;
+ }
+ }
+ vmng_screen_dispose((void *)d);
+ vmng_Dialog_Destroy(d);
+}
+
+bool GetDialogCoords(Dialog *d, M4Rect *r) {
+ ScreenContext *myScreen;
+ if ((!d) || (!r)) return false;
+ if ((myScreen = vmng_screen_find((void *)d, nullptr)) == nullptr) return false;
+ r->x1 = myScreen->x1;
+ r->x2 = myScreen->x2;
+ r->y1 = myScreen->y1;
+ r->y2 = myScreen->y2;
+ return true;
+}
+
+bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 tag) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, MESSAGE, nullptr, 0)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x, y,
+ myBuff->W, myBuff->h, (char *)myBuff->data, tag, PICTURE, nullptr, 0)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, BUTTON, cb, 0)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, REPEAT_BUTTON, cb, 0)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2,
+ M4CALLBACK cb, int32 tag) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, y2 - y1 + 1, nullptr, tag, LISTBOX, cb, 0)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2,
+ char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
+ Item *myItem;
+ if ((myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, 0, defaultPrompt, tag, TEXTFIELD, cb, fieldLength)) == nullptr) {
+ return false;
+ }
+ if (!d->itemList) d->itemList = myItem;
+ d->listBottom = myItem;
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+}
+
+bool Dialog_Add_Key(Dialog *d, long myKey, HotkeyCB cb) {
+ return AddScreenHotkey((void *)d, myKey, cb);
+}
+
+bool Dialog_Remove_Key(Dialog *d, long myKey) {
+ return RemoveScreenHotkey((void *)d, myKey);
+}
+
+bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag) {
+ Buffer *tempBuffer;
+ ScreenContext *myScreen;
+ int32 status;
+
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ if (!myItem) myItem = ItemFind(d->itemList, tag);
+ if (!myItem) return false;
+ //NOTE: if the item removed is the default, cancel, or return item, problems could happen...
+ if (myItem->next) myItem->next->prev = myItem->prev;
+ else d->listBottom = myItem;
+ if (myItem->prev) myItem->prev->next = myItem->next;
+ else d->itemList = myItem->next;
+ gr_color_set(__LTGRAY);
+ tempBuffer = d->dlgBuffer->get_buffer();
+ gr_buffer_rect_fill(tempBuffer, myItem->x, myItem->y, myItem->w, myItem->h);
+ d->dlgBuffer->release();
+ if (status == SCRN_ACTIVE) {
+ RestoreScreens(myScreen->x1 + myItem->x, myScreen->y1 + myItem->y,
+ myScreen->x1 + myItem->x + myItem->w - 1,
+ myScreen->y1 + myItem->y + myItem->h - 1);
+ }
+ Item_destroy(myItem);
+ return true;
+}
+
+bool Dialog_ListItemExists(Dialog *d, Item *myItem, int32 tag, char *prompt, int32 listTag) {
+ if ((!myItem) && (!d)) return false;
+ if (!myItem) myItem = ItemFind(d->itemList, tag);
+ if (!myItem) return false;
+ return ListItemExists(myItem, prompt, listTag);
+}
+
+bool Dialog_Add_List_Item(Dialog *d, Item *myItem, char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh) {
+ ScreenContext *myScreen;
+ int32 status;
+ bool retValue;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ if (!myItem) myItem = ItemFind(d->itemList, tag);
+ retValue = ListItemAdd(myItem, prompt, listTag, addMode, nullptr);
+ if (retValue && refresh) {
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ }
+ return true;
+}
+
+bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag) {
+ ScreenContext *myScreen;
+ int32 status;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return false;
+ if (!myItem) {
+ myItem = ItemFind(d->itemList, tag);
+ myListItem = nullptr;
+ }
+ if (ListItemDelete(myItem, myListItem, listTag)) {
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ }
+ return true;
+}
+
+bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem,
+ int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh) {
+ ScreenContext *myScreen;
+ int32 status;
+ bool retValue;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ if (!myItem) {
+ myItem = ItemFind(d->itemList, tag);
+ myListItem = nullptr;
+ }
+ retValue = ListItemChange(myItem, myListItem, listTag, newPrompt, newListTag, changeMode);
+ if (retValue && refresh) {
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ }
+ return retValue;
+}
+
+void Dialog_Change_Item_Prompt(Dialog *d, char *newPrompt, Item *myItem, int32 tag) {
+ Buffer *tempBuffer;
+ ScreenContext *myScreen;
+ int32 status, tempWidth, tempHeight, itemType;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) {
+ return;
+ }
+ if (!myItem) {
+ myItem = ItemFind(d->itemList, tag);
+ }
+ if (myItem) {
+ tempWidth = myItem->w;
+ tempHeight = myItem->h;
+ if (Item_change_prompt(myItem, newPrompt)) {
+ tempWidth = imath_max(tempWidth, myItem->w);
+ tempHeight = imath_max(tempHeight, myItem->h);
+ gr_color_set(__LTGRAY);
+ tempBuffer = d->dlgBuffer->get_buffer();
+ gr_buffer_rect_fill(tempBuffer, myItem->x, myItem->y, tempWidth, tempHeight);
+ if (myItem == d->default_item) {
+ itemType = ITEM_DEFAULT;
+ } else if (myItem == d->return_item) {
+ itemType = ITEM_RETURN;
+ } else {
+ itemType = ITEM_NORMAL;
+ }
+ if (Item_show(myItem, (void *)d, tempBuffer, itemType)) {
+ if (status == SCRN_ACTIVE) {
+ RestoreScreens(myScreen->x1 + myItem->x, myScreen->y1 + myItem->y,
+ myScreen->x1 + myItem->x + tempWidth - 1,
+ myScreen->y1 + myItem->y + tempHeight - 1);
+ }
+ }
+ d->dlgBuffer->release();
+ }
+ }
+}
+
+bool Dialog_ListboxSearch(Dialog *d, Item *myItem, int32 tag, int32 searchMode, char *searchStr, int32 parm1) {
+ ScreenContext *myScreen;
+ int32 status;
+ bool returnValue;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ if (!myItem) myItem = ItemFind(d->itemList, tag);
+ if (!myItem || (myItem->type != LISTBOX)) return false;
+ returnValue = ListItemSearch(myItem, searchMode, searchStr, parm1);
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return returnValue;
+}
+
+Item *Dialog_Get_Item(Dialog *d, int32 tag) {
+ if (!d) return nullptr;
+ return ItemFind(d->itemList, tag);
+}
+
+void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag) {
+ Buffer *tempBuffer;
+ ScreenContext *myScreen;
+ int32 status, itemType;
+ if (!d) return;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return;
+ if (!myItem) myItem = ItemFind(d->itemList, tag);
+ if (!myItem) return;
+ if (myItem == d->default_item) itemType = ITEM_DEFAULT;
+ else if (myItem == d->return_item) itemType = ITEM_RETURN;
+ else itemType = ITEM_NORMAL;
+ tempBuffer = d->dlgBuffer->get_buffer();
+ if (Item_show(myItem, (void *)d, tempBuffer, itemType)) {
+ if (status == SCRN_ACTIVE) {
+ RestoreScreens(myScreen->x1 + myItem->x, myScreen->y1 + myItem->y,
+ myScreen->x1 + myItem->x + myItem->w - 1,
+ myScreen->y1 + myItem->y + myItem->h - 1);
+ }
+ }
+ d->dlgBuffer->release();
+}
+
+void Dialog_Refresh(Dialog *d) {
+ Buffer *tempBuffer;
+ ScreenContext *myScreen;
+ Item *i;
+ int32 status, itemType;
+ ButtonDrawRec bdr;
+
+ if (!d) return;
+
+ tempBuffer = d->dlgBuffer->get_buffer();
+ bdr.dialog = (void *)d;
+ bdr.scrBuf = tempBuffer; bdr.fillMe = FILL_INTERIOR;
+ bdr.pressed = false; bdr.el_type = DIALOGBOX;
+ bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = d->w - 1; bdr.y2 = d->h - 1;
+ drawGUIelement(&bdr, nullptr);
+
+ for (i = d->itemList; i != nullptr; i = i->next) {
+ if (i == d->default_item) itemType = ITEM_DEFAULT;
+ else if (i == d->return_item) itemType = ITEM_RETURN;
+ else itemType = ITEM_NORMAL;
+ Item_show(i, (void *)d, tempBuffer, itemType);
+ }
+ d->dlgBuffer->release();
+
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return;
+ if (status == SCRN_ACTIVE) {
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+ }
+}
+
+void Dialog_Refresh_All(void) {
+ ScreenContext *myScreen;
+ myScreen = _G(frontScreen);
+
+ while (myScreen) {
+ if (myScreen->scrnType == SCRN_DLG) {
+ Dialog_Refresh((Dialog *)myScreen->scrnContent);
+ }
+ myScreen = myScreen->behind;
+ }
+}
+
+void Dialog_Resize(Dialog *d, int32 newW, int32 newH) {
+ if (!d) {
+ return;
+ }
+ if (newW <= 0) {
+ newW = d->w;
+ }
+ if (newH <= 0) {
+ newH = d->h;
+ }
+
+ delete d->dlgBuffer;
+#if defined(__WIN)
+ d->dlgBuffer = new CDIBSectionBuffer(((CM4App *)GetWigalApp())->GetMainWindow(), newW, newH);
+#else
+ d->dlgBuffer = new GrBuff(newW, newH);
+#endif
+
+ d->w = newW;
+ d->h = newH;
+
+ ResizeScreen(d, newW, newH);
+ Dialog_Refresh(d);
+ return;
+}
+
+static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY) {
+ ScreenContext *myScreen = (ScreenContext *)s;
+ RectList *myRectList = (RectList *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ Buffer *tempBuffer;
+ Dialog *d;
+ RectList *myRect;
+
+ //parameter verification
+ if (!myScreen) return;
+ d = (Dialog *)(myScreen->scrnContent);
+ if (!d) return;
+
+ //if no destBuffer, then draw directly to video
+ if (!destBuffer) {
+ myRect = myRectList;
+ while (myRect) {
+ d->dlgBuffer->refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1);
+ //vmng_refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ // myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, d->dlgBuffer);
+ myRect = myRect->next;
+ }
+ }
+
+ //else draw to the dest buffer
+ else {
+ tempBuffer = d->dlgBuffer->get_buffer();
+ myRect = myRectList;
+ while (myRect) {
+ gr_buffer_rect_copy_2(tempBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
+ myRect = myRect->next;
+ }
+ d->dlgBuffer->release();
+ }
+}
+
+void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancelTag) {
+ if (!d) return;
+ d->return_item = ItemFind(d->itemList, returnTag);
+ d->cancel_item = ItemFind(d->itemList, cancelTag);
+ Dialog_SetDefault(d, defaultTag);
+ if (d->default_item) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+}
+
+void Dialog_SetDefault(Dialog *d, int32 tag) {
+ ScreenContext *myScreen;
+ Item *origItem, *newDefault;
+ int32 status;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return;
+ origItem = d->default_item;
+ newDefault = Item_set_default(d->itemList, d->default_item, tag);
+ if ((!newDefault) || ((newDefault->type != LISTBOX) && (newDefault->type != TEXTFIELD))) {
+ d->default_item = nullptr;
+ } else {
+ d->default_item = newDefault;
+ Item_set_pressed(nullptr, d->default_item, 0);
+ }
+ if (origItem && (origItem != d->default_item)) {
+ Item_set_unpressed(nullptr, origItem, 0);
+ Dialog_Refresh_Item(d, origItem, origItem->tag);
+ }
+}
+
+bool Dialog_SetPressed(Dialog *d, int32 tag) {
+ ScreenContext *myScreen;
+ Item *myItem;
+ int32 status;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ myItem = Item_set_pressed(d->itemList, nullptr, tag);
+ if (myItem) {
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+ } else return false;
+}
+
+static bool Dialog_SetUnpressed(Dialog *d, int32 tag) {
+ ScreenContext *myScreen;
+ Item *myItem;
+ int32 status;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if (!myScreen) return false;
+ myItem = Item_set_unpressed(d->itemList, nullptr, tag);
+ if (myItem) {
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ return true;
+ } else return false;
+}
+
+static bool Dialog_SetNextDefault(ScreenContext *myScreen, Dialog *d) {
+ int32 status;
+ Item *origItem;
+ if (!myScreen) myScreen = vmng_screen_find((void *)d, &status);
+ else status = SCRN_ACTIVE;
+ if (!myScreen) return false;
+ origItem = d->default_item;
+ d->default_item = Item_set_next_default(d->default_item, d->itemList);
+ if (status == SCRN_ACTIVE) {
+ if (origItem && (origItem != d->default_item)) {
+ Dialog_Refresh_Item(d, origItem, origItem->tag);
+ }
+ if (d->default_item) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+ }
+ if (d->default_item) return true;
+ else return false;
+}
+
+static bool Dialog_SetPrevDefault(ScreenContext *myScreen, Dialog *d) {
+ int32 status;
+ Item *origItem;
+ if (!myScreen) myScreen = vmng_screen_find((void *)d, &status);
+ else status = SCRN_ACTIVE;
+ if (!myScreen) return false;
+ origItem = d->default_item;
+ d->default_item = Item_set_prev_default(d->default_item, d->listBottom);
+ if (status == SCRN_ACTIVE) {
+ if (origItem && (origItem != d->default_item)) {
+ Dialog_Refresh_Item(d, origItem, origItem->tag);
+ }
+ if (d->default_item) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+ }
+ if (d->default_item) return true;
+ else return false;
+}
+
+void Dialog_GetNextListItem(Dialog *d) {
+ if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if (GetNextListItem(d->default_item)) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+}
+
+static void Dialog_GetNextPageList(Dialog *d) {
+ if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if (GetNextPageList(d->default_item)) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+}
+
+void Dialog_GetPrevListItem(Dialog *d) {
+ if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if (GetPrevListItem(d->default_item)) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+}
+
+static void Dialog_GetPrevPageList(Dialog *d) {
+ if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if (GetPrevPageList(d->default_item)) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+}
+
+ListItem *Dialog_GetCurrListItem(Dialog *d, Item *i, int32 tag) {
+ if ((!i) && (!d)) return nullptr;
+ if (!i) i = ItemFind(d->itemList, tag);
+ if (!i) return nullptr;
+ return i->currItem;
+}
+
+char *Dialog_GetCurrListItemPrompt(Dialog *d, Item *i, int32 tag) {
+ ListItem *myListItem;
+ if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr) return nullptr;
+ return myListItem->prompt;
+}
+
+bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag) {
+ ListItem *myListItem;
+ if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr) return false;
+ *listTag = myListItem->tag;
+ return true;
+}
+
+char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag) {
+ ListItem *myListItem;
+
+ if (!i) i = ItemFind(d->itemList, tag);
+ if (!i) return nullptr;
+ if ((myListItem = ListItemFind(i, LIST_BY_TAG, nullptr, listTag)) == nullptr) return nullptr;
+ return myListItem->prompt;
+}
+
+void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
+ ScreenContext *myScreen;
+ int32 status;
+ if ((!i) && (!d)) return;
+ if (!i) i = ItemFind(d->itemList, tag);
+ if (!i) return;
+ Item_empty_list(i);
+ myScreen = vmng_screen_find((void *)d, &status);
+ Dialog_Refresh_Item(d, i, i->tag);
+}
+
+void Dialog_RegisterTextField(Dialog *d) {
+ Item *myItem = nullptr;
+ ScreenContext *myScreen;
+ int32 status;
+
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) return;
+ if ((myItem = Item_CheckTextField()) == nullptr) return;
+ if (myItem->callback) {
+ (myItem->callback)((void *)myItem, (void *)d);
+ myScreen = vmng_screen_find((void *)d, &status);
+ Dialog_Refresh_Item(d, myItem, myItem->tag);
+ }
+}
+
+static void SystemErrCallback(void *, void *) {
+ _GD(okButton) = true;
+}
+
+void Dialog_SystemError(char *s) {
+
+ Dialog *aDlog = DialogCreateAbsolute(0, 0, MAX_VIDEO_X, MAX_VIDEO_Y, SF_ALERT);
+ Dialog_Add_Message(aDlog, 20, 60, s, 2);
+ Dialog_Add_Button(aDlog, 50, 80, " OK ", SystemErrCallback, 100);
+
+ Dialog_Configure(aDlog, 0, 100, 0);
+ vmng_screen_show((void *)aDlog);
+ _GD(okButton) = false;
+ while (!_GD(okButton)) {
+ gui_system_event_handler();
+ }
+ DialogDestroy(aDlog, (M4Rect *)nullptr);
}
void Dialog_KeyMouseCollision(void) {
- error("TODO: Dialog_KeyMouseCollision");
+ Item *textItem;
+ _GD(movingScreen) = false;
+ _GD(clickItem) = nullptr;
+ _GD(doubleClickItem) = nullptr;
+ _GD(listboxSearchStr)[0] = '\0';
+ if ((textItem = Item_CheckTextField()) != nullptr) {
+ if (textItem->callback) {
+ (textItem->callback)((void *)textItem, nullptr);
+ }
+ }
+}
+
+static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen) {
+ ScreenContext *myScreen;
+ Dialog *d = (Dialog *)myDialog;
+ Item *myItem, *textItem;
+ int32 status;
+ bool handled;
+ bool clearClickItem;
+ static uint32 repeatTime;
+ int32 scrollable = 0;
+ uint32 tempTime;
+ static int32 movingX;
+ static int32 movingY;
+ char tempStr[2];
+
+ myScreen = vmng_screen_find(myDialog, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) return false;
+
+ if (eventType == EVENT_KEY) {
+ handled = false;
+ if (d->default_item) {
+ if (d->default_item->type == TEXTFIELD) {
+ _GD(listboxSearchStr)[0] = '\0';
+ if (parm1 == KEY_ESCAPE) {
+ if ((textItem = Item_RestoreTextField()) != nullptr) {
+ Dialog_Refresh_Item(d, textItem, textItem->tag);
+ }
+ } else if ((parm1 == KEY_RETURN) || (parm1 == KEY_TAB) || (parm1 == KEY_SHFTTAB)) {
+ if ((textItem = Item_CheckTextField()) != nullptr) {
+ if (textItem->callback) {
+ (textItem->callback)((void *)textItem, (void *)d);
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) handled = true;
+ }
+ }
+ } //will fall out to catch the "set next/prev default"
+ else {
+ handled = Item_TextEdit(d->default_item, parm1);
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+ } else if (d->default_item->type == LISTBOX) {
+ handled = true;
+ switch (parm1) {
+ case KEY_RETURN:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (d->default_item->callback) {
+ handled = true;
+ (d->default_item->callback)((void *)(d->default_item), (void *)d);
+ } else handled = false;
+ break;
+ case KEY_PAGE_UP:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetPrevPageList(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ case KEY_PAGE_DOWN:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetNextPageList(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ case KEY_UP:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetPrevListItem(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ case KEY_DOWN:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetNextListItem(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ case KEY_LEFT:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetPrevListItem(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ case KEY_RIGHT:
+ _GD(listboxSearchStr)[0] = '\0';
+ if (Item_SetViewBottom(d->default_item)) {
+ Dialog_GetNextListItem(d);
+ } else ViewCurrListItem(d->default_item);
+ break;
+ default:
+ if ((parm1 >= 32) && (parm1 <= 127)) {
+ if (strlen(_GD(listboxSearchStr)) < 79) {
+ tempStr[0] = (char)parm1;
+ tempStr[1] = '\0';
+ Common::strcat_s(_GD(listboxSearchStr), 80, tempStr);
+ }
+ if (!ListItemSearch(d->default_item, LIST_ALPH, _GD(listboxSearchStr), 0)) {
+ _GD(listboxSearchStr)[0] = (char)parm1;
+ _GD(listboxSearchStr)[1] = '\0';
+ ListItemSearch(d->default_item, LIST_ALPH, _GD(listboxSearchStr), 0);
+ }
+ } else handled = false;
+ break;
+ }
+ if (handled) {
+ Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
+ }
+ }
+ }
+ if (!handled) {
+ _GD(listboxSearchStr)[0] = '\0';
+ switch (parm1) {
+ case KEY_ESCAPE:
+ if ((d->cancel_item) && (d->cancel_item->callback)) {
+ handled = true;
+ (d->cancel_item->callback)((void *)(d->cancel_item), (void *)d);
+ }
+ break;
+ case KEY_RETURN:
+ if ((d->return_item) && (d->return_item->callback)) {
+ handled = true;
+ (d->return_item->callback)((void *)(d->return_item), (void *)d);
+ }
+ break;
+ case KEY_TAB:
+ handled = Dialog_SetNextDefault(myScreen, d);
+ break;
+ case KEY_SHFTTAB:
+ handled = Dialog_SetPrevDefault(myScreen, d);
+ break;
+ }
+ }
+ return handled;
+ } else if (eventType == EVENT_MOUSE) {
+ if (parm1 != _ME_move) _GD(listboxSearchStr)[0] = '\0';
+ myItem = d->itemList;
+ while (myItem && (!((parm2 - myScreen->x1 >= myItem->x) &&
+ (parm2 - myScreen->x1 <= (myItem->x + myItem->w - 1)) &&
+ (parm3 - myScreen->y1 >= myItem->y) &&
+ (parm3 - myScreen->y1 <= (myItem->y + myItem->h - 1))))) {
+ myItem = myItem->next;
+ }
+ clearClickItem = false;
+ switch (parm1) {
+ case _ME_L_click:
+ if (currScreen) *currScreen = true;
+ repeatTime = timer_read_60();
+ if ((textItem = Item_CheckTextField()) != nullptr) {
+ if (textItem->callback) {
+ (textItem->callback)((void *)textItem, (void *)d);
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ if (currScreen) *currScreen = false;
+ _GD(clickItem) = nullptr;
+ return true;
+ }
+ }
+ }
+ vmng_screen_show(myScreen->scrnContent);
+ if (myItem && (myItem->type != MESSAGE) && (myItem->type != PICTURE)) _GD(clickItem) = myItem;
+ else {
+ _GD(clickItem) = nullptr;
+ Dialog_SetDefault(d, 0);
+ }
+ if (_GD(clickItem)) {
+ if (_GD(clickItem)->type == LISTBOX) {
+ ClickOnListBox(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x, parm3 - myScreen->y1 - _GD(clickItem)->y, SCROLLABLE | PAGEABLE);
+ } else if (_GD(clickItem)->type == TEXTFIELD) {
+ SetTextBlockBegin(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x);
+ }
+ Dialog_SetDefault(d, _GD(clickItem)->tag);
+ Dialog_SetPressed(d, _GD(clickItem)->tag);
+ } else if (!(myScreen->scrnFlags & SF_IMMOVABLE)) {
+ _GD(movingScreen) = true;
+ movingX = parm2;
+ movingY = parm3;
+ }
+ break;
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ tempTime = timer_read_60();
+ if (_GD(clickItem)) {
+ if (_GD(clickItem)->type == LISTBOX) {
+ if (tempTime > (repeatTime + 2)) {
+ repeatTime = tempTime;
+ ClickOnListBox(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x, parm3 - myScreen->y1 - _GD(clickItem)->y, SCROLLABLE);
+ }
+ } else if (_GD(clickItem)->type == REPEAT_BUTTON) {
+ if (tempTime > (repeatTime + 2)) {
+ repeatTime = tempTime;
+ if (_GD(clickItem)->callback) {
+ (_GD(clickItem)->callback)((void *)_GD(clickItem), (void *)d);
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ _GD(clickItem) = nullptr;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case _ME_L_drag:
+ if (_GD(movingScreen)) {
+ MoveScreenDelta(myScreen, parm2 - movingX, parm3 - movingY);
+ movingX = parm2;
+ movingY = parm3;
+ } else if (_GD(clickItem)) {
+ if (_GD(clickItem)->type == LISTBOX) {
+ tempTime = timer_read_60();
+ if (tempTime > (repeatTime + 2)) {
+ scrollable = SCROLLABLE;
+ repeatTime = tempTime;
+ }
+ ClickOnListBox(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x,
+ parm3 - myScreen->y1 - _GD(clickItem)->y, scrollable);
+ } else if (_GD(clickItem)->type == TEXTFIELD) {
+ SetTextBlockEnd(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x);
+ } else if (_GD(clickItem) == myItem) {
+ Dialog_SetPressed(d, _GD(clickItem)->tag);
+ } else {
+ Dialog_SetUnpressed(d, _GD(clickItem)->tag);
+ }
+ }
+ break;
+ case _ME_doubleclick:
+ if (myItem == _GD(doubleClickItem)) {
+ _GD(clickItem) = _GD(doubleClickItem);
+ _GD(doubleClickItem) = nullptr;
+ }
+ if (_GD(clickItem) && (_GD(clickItem)->type == LISTBOX)) {
+ if (DoubleClickOnListBox(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x,
+ parm3 - myScreen->y1 - _GD(clickItem)->y)) {
+ if (_GD(clickItem)->callback) {
+ (_GD(clickItem)->callback)((void *)_GD(clickItem), (void *)d);
+ clearClickItem = true;
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ if (currScreen) *currScreen = false;
+ _GD(clickItem) = nullptr;
+ return true;
+ }
+ }
+ } else {
+ ClickOnListBox(_GD(clickItem), parm2 - myScreen->x1 - _GD(clickItem)->x,
+ parm3 - myScreen->y1 - _GD(clickItem)->y, SCROLLABLE | PAGEABLE);
+ Dialog_SetDefault(d, _GD(clickItem)->tag);
+ Dialog_SetPressed(d, _GD(clickItem)->tag);
+ }
+ } else if (_GD(clickItem) && (_GD(clickItem)->type == TEXTFIELD)) {
+ SetTextBlockBegin(_GD(clickItem), 0);
+ SetTextBlockEnd(_GD(clickItem), 32767);
+ }
+ break;
+ case _ME_L_release:
+ if (currScreen) *currScreen = false;
+ if (_GD(movingScreen)) {
+ _GD(movingScreen) = false;
+ clearClickItem = true;
+ } else if (_GD(clickItem)) {
+ if (_GD(clickItem)->type == LISTBOX) {
+ ResetDefaultListBox(_GD(clickItem));
+ clearClickItem = true;
+ } else if (_GD(clickItem)->type != TEXTFIELD) {
+ Dialog_SetUnpressed(d, _GD(clickItem)->tag);
+ clearClickItem = true;
+ if ((myItem == _GD(clickItem)) && (myItem->callback)) {
+ (myItem->callback)((void *)myItem, (void *)d);
+ myScreen = vmng_screen_find((void *)d, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ _GD(clickItem) = nullptr;
+ return true;
+ }
+ }
+ } else clearClickItem = true;
+ }
+ break;
+ case _ME_doubleclick_release:
+ if (_GD(clickItem) && (_GD(clickItem)->type == LISTBOX)) {
+ ResetDefaultListBox(_GD(clickItem));
+ clearClickItem = true;
+ }
+ break;
+ }
+ if (_GD(clickItem)) {
+ if ((_GD(clickItem) = Dialog_Get_Item(d, _GD(clickItem)->tag)) != nullptr) {
+ Dialog_Refresh_Item(d, _GD(clickItem), _GD(clickItem)->tag);
+ }
+ }
+ if (clearClickItem) {
+ _GD(doubleClickItem) = _GD(clickItem);
+ _GD(clickItem) = nullptr;
+ }
+ return true;
+ }
+ return false;
+}
+
+//TEXTSCRN STUFF...
+
+
+static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
+ ScreenContext *myScreen = (ScreenContext *)s;
+ TextScrn *myTextScrn;
+ TextItem *myItem;
+ matte *myRectList = (matte *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ Buffer *myBuff;
+#if defined(__WIN)
+ CDIBSectionBuffer *myGrBuff;
+#else
+ GrBuff *myGrBuff;
+#endif
+ ScreenContext *tempScreen;
+ matte *myMatte, tempMatte;
+ RectList *updateList, *updateRect;
+ RectList *newUpdateList;
+ Font *currFont;
+
+ //parameter verification
+ if (!myScreen) return;
+ myTextScrn = (TextScrn *)(myScreen->scrnContent);
+ if (!myTextScrn) return;
+
+#if defined(__WIN)
+ myGrBuff = (CDIBSectionBuffer *)(myTextScrn->textScrnBuffer);
+#else
+ myGrBuff = (GrBuff *)(myTextScrn->textScrnBuffer);
+#endif
+
+ if (!myGrBuff) return;
+
+ //if no destBuffer, then draw directly to video
+ if (!destBuffer) {
+
+ tempMatte.nextMatte = nullptr;
+
+ //create an updateRectList to catch the black areas afterwards
+ updateList = vmng_CreateNewRect(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+ updateList->prev = nullptr;
+ updateList->next = nullptr;
+
+ //now loop through all the screens behind myScreen
+ tempScreen = myScreen->behind;
+ while (tempScreen && updateList) {
+
+ //duplicate the updateList
+ newUpdateList = vmng_DuplicateRectList(updateList);
+
+ //loop through the updateList
+ updateRect = updateList;
+ while (updateRect) {
+
+ //see if it intersects
+ tempMatte.x1 = imath_max(updateRect->x1, tempScreen->x1);
+ tempMatte.y1 = imath_max(updateRect->y1, tempScreen->y1);
+ tempMatte.x2 = imath_min(updateRect->x2, tempScreen->x2);
+ tempMatte.y2 = imath_min(updateRect->y2, tempScreen->y2);
+
+ if (tempScreen->redraw && (tempMatte.x1 <= tempMatte.x2) && (tempMatte.y1 <= tempMatte.y2)) {
+ //draw the intersected part of tempScreen onto myBuffer
+ myBuff = myGrBuff->get_buffer();
+ (tempScreen->redraw)(tempScreen, (void *)&tempMatte, myBuff, tempMatte.x1 - myScreen->x1, tempMatte.y1 - myScreen->y1);
+ myGrBuff->release();
+ //remove that rectangle from the update list
+ vmng_RemoveRectFromRectList(&newUpdateList, tempMatte.x1, tempMatte.y1, tempMatte.x2, tempMatte.y2);
+ }
+
+ //get the next updateRect
+ updateRect = updateRect->next;
+ }
+
+ //the newUpdateList now contains all the pieces not covered by tempScreen;
+ //turf the update list, and replace it with the newupdateList
+ vmng_DisposeRectList(&updateList);
+ updateList = newUpdateList;
+
+ //now get the next screen
+ tempScreen = tempScreen->behind;
+ }
+
+ //now we've gone through all the screens, whatever is left in the updateList should be filled in with black
+ gr_color_set(__BLACK);
+ updateRect = updateList;
+ myBuff = myGrBuff->get_buffer();
+ while (updateRect) {
+ gr_buffer_rect_fill(myBuff, updateRect->x1 - myScreen->x1, updateRect->y1 - myScreen->y1,
+ updateRect->x2 - updateRect->x1 + 1, updateRect->y2 - updateRect->y1 + 1);
+ updateRect = updateRect->next;
+ }
+ myGrBuff->release();
+
+ //now dispose of the updateList
+ vmng_DisposeRectList(&updateList);
+
+ //now we darken (or lighten) the screen by the luminance percentage
+ myBuff = myGrBuff->get_buffer();
+ krn_ChangeBufferLuminance(myBuff, myTextScrn->luminance);
+ myGrBuff->release();
+
+ //now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
+ //now would be the time to draw the contents
+ currFont = gr_font_get();
+ gr_font_set(myTextScrn->myFont);
+ myItem = myTextScrn->myTextItems;
+ myBuff = myGrBuff->get_buffer();
+ while (myItem) {
+ if (myItem == myTextScrn->hiliteItem) {
+ //mar4
+ //gr_font_set_color(myTextScrn->hiliteColor);
+ font_set_colors(myTextScrn->hiliteColor_alt1, myTextScrn->hiliteColor_alt2, myTextScrn->hiliteColor);
+ } else {
+ //mar4
+ //gr_font_set_color(myTextScrn->textColor);
+ font_set_colors(myTextScrn->textColor_alt1, myTextScrn->textColor_alt2, myTextScrn->textColor);
+ }
+ gr_font_write(myBuff, myItem->prompt, myItem->x, myItem->y, 0, 0); // MattP no auto spacing
+ myItem = myItem->next;
+ }
+ myGrBuff->release();
+ gr_font_set(currFont);
+
+ //now dump the matte list out to video
+ myMatte = myRectList;
+ while (myMatte) {
+ myGrBuff->refresh_video(myMatte->x1, myMatte->y1, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
+ myMatte->x2 - myScreen->x1, myMatte->y2 - myScreen->y1);
+ //vmng_refresh_video(myMatte->x1, myMatte->y1, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
+ // myMatte->x2 - myScreen->x1, myMatte->y2 - myScreen->y1, myBuff);
+ myMatte = myMatte->nextMatte;
+ }
+ }
+
+ //else draw to the dest buffer
+ else {
+ myMatte = myRectList;
+ myBuff = myGrBuff->get_buffer();
+ while (myMatte) {
+ gr_buffer_rect_copy_2(myBuff, destBuffer, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
+ destX, destY, myMatte->x2 - myMatte->x1 + 1, myMatte->y2 - myMatte->y1 + 1);
+ myMatte = myMatte->nextMatte;
+ }
+ myGrBuff->release();
+ }
+}
+
+
+
+TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminance, uint32 scrnFlags,
+ int32 textColor, int32 hiliteColor,
+ int32 textColorAlt1, int32 hiliteColorAlt1, int32 textColorAlt2, int32 hiliteColorAlt2) {
+
+ TextScrn *myTextScrn;
+
+ if ((myTextScrn = (TextScrn *)mem_alloc(sizeof(TextScrn), STR_TEXTSCRN)) == nullptr)
+ return nullptr;
+
+ myTextScrn->w = x2 - x1 + 1;
+ myTextScrn->h = y2 - y1 + 1;
+ myTextScrn->textColor = textColor;
+ myTextScrn->textColor_alt1 = textColorAlt1; // MattP
+ myTextScrn->textColor_alt2 = textColorAlt2; // MattP
+ myTextScrn->hiliteColor = hiliteColor;
+ myTextScrn->hiliteColor_alt1 = hiliteColorAlt1; // MattP
+ myTextScrn->hiliteColor_alt2 = hiliteColorAlt2; // MattP
+ myTextScrn->luminance = luminance;
+ myTextScrn->myFont = gr_font_get();
+ myTextScrn->myTextItems = nullptr;
+ myTextScrn->hiliteItem = nullptr;
+
+#if defined(__WIN)
+ myTextScrn->textScrnBuffer = new CDIBSectionBuffer(((CM4App *)GetWigalApp())->GetMainWindow(), myTextScrn->w, myTextScrn->h);
+#else
+ myTextScrn->textScrnBuffer = new GrBuff(myTextScrn->w, myTextScrn->h);
+#endif
+ if (!myTextScrn->textScrnBuffer) {
+ return nullptr;
+ }
+
+ if (!vmng_screen_create(x1, y1, x2, y2, SCRN_TEXT, scrnFlags | SF_TRANSPARENT, (void *)myTextScrn, (RefreshFunc)TextScrn_Show, TextScrn_EventHandler)) {
+ return nullptr;
+ }
+ return myTextScrn;
+}
+
+void TextScrn_Destroy(TextScrn *myTextScrn) {
+ if (!myTextScrn) return;
+ vmng_screen_dispose((void *)myTextScrn);
+ vmng_TextScrn_Destroy(myTextScrn);
+ _G(currScreen) = false;
+}
+
+void TextScrn_Activate(TextScrn *myTextScrn) {
+ vmng_screen_show((void *)myTextScrn);
+}
+
+bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb) {
+ return AddScreenHotkey((void *)myTextScrn, myKey, cb);
+}
+
+bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
+ int32 justification, char *prompt, M4CALLBACK callback) {
+ TextItem *myTextItem;
+
+ if (!myTextScrn) {
+ return false;
+ }
+ if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "text item")) == nullptr) return false;
+ myTextItem->w = gr_font_string_width(prompt, 0); // MattP no auto spacing
+ myTextItem->h = gr_font_get_height() + 1;
+ myTextItem->y = y;
+ myTextItem->justification = justification;
+ switch (justification) {
+ case TS_JUST_LEFT:
+ myTextItem->x = 0;
+ break;
+ case TS_JUST_RIGHT:
+ myTextItem->x = myTextScrn->w - myTextItem->w - 1;
+ break;
+ case TS_CENTRE:
+ myTextItem->x = (myTextScrn->w - myTextItem->w) >> 1;
+ break;
+ case TS_GIVEN:
+ default:
+ myTextItem->x = x;
+ break;
+ }
+ myTextItem->tag = tag;
+ myTextItem->type = BUTTON;
+ myTextItem->prompt = mem_strdup(prompt);
+ myTextItem->callback = callback;
+ myTextItem->next = myTextScrn->myTextItems;
+ myTextScrn->myTextItems = myTextItem;
+
+ return true;
+}
+
+bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
+ int32 justification, char *prompt) {
+ TextItem *myTextItem;
+
+ if (!myTextScrn) {
+ return false;
+ }
+ if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "textscrn msg")) == nullptr) return false;
+ myTextItem->w = gr_font_string_width(prompt, 0); // MattP no auto spacing
+ myTextItem->h = gr_font_get_height() + 1;
+ myTextItem->y = y;
+ myTextItem->justification = justification;
+ switch (justification) {
+ case TS_JUST_LEFT:
+ myTextItem->x = 0;
+ break;
+ case TS_JUST_RIGHT:
+ myTextItem->x = myTextScrn->w - myTextItem->w - 1;
+ break;
+ case TS_CENTRE:
+ myTextItem->x = (myTextScrn->w - myTextItem->w) >> 1;
+ break;
+ case TS_GIVEN:
+ default:
+ myTextItem->x = x;
+ break;
+ }
+ myTextItem->tag = tag;
+ myTextItem->type = MESSAGE;
+ myTextItem->prompt = mem_strdup(prompt);
+ myTextItem->next = myTextScrn->myTextItems;
+ myTextScrn->myTextItems = myTextItem;
+
+ return true;
+}
+
+void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag) {
+ ScreenContext *myScreen;
+ int32 status, x, y, w, h;
+ TextItem *myTextItem, *tempTextItem;
+
+ if ((myScreen = vmng_screen_find((void *)myTextScrn, &status)) == nullptr) return;
+ myTextItem = myTextScrn->myTextItems;
+ if (myTextItem->tag == tag) {
+ myTextScrn->myTextItems = myTextItem->next;
+ tempTextItem = myTextItem;
+ } else {
+ while (myTextItem->next && (myTextItem->next->tag != tag)) myTextItem = myTextItem->next;
+ if ((tempTextItem = myTextItem->next) == nullptr) return;
+ myTextItem->next = tempTextItem->next;
+ }
+ x = tempTextItem->x;
+ y = tempTextItem->y;
+ w = tempTextItem->w;
+ h = tempTextItem->h;
+ mem_free(tempTextItem->prompt);
+ mem_free((void *)tempTextItem);
+ if (status == SCRN_ACTIVE) {
+ RestoreScreens(myScreen->x1 + x, myScreen->y1 + y, myScreen->x1 + x + w - 1, myScreen->y1 + y + h - 1);
+ }
+}
+
+static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen) {
+ ScreenContext *myScreen;
+ TextScrn *myTextScrn = (TextScrn *)theTextScrn;
+ TextItem *myTextItem, *oldHiliteItem;
+ int32 status;
+ static int32 movingX;
+ static int32 movingY;
+
+ myScreen = vmng_screen_find(theTextScrn, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) return false;
+
+ if (!(eventType == EVENT_MOUSE)) {
+ return false;
+ }
+ myTextItem = myTextScrn->myTextItems;
+ while (myTextItem && (!((parm2 >= myScreen->x1) &&
+ (parm2 <= myScreen->x2) &&
+ (parm3 - myScreen->y1 >= myTextItem->y) &&
+ (parm3 - myScreen->y1 <= (myTextItem->y + myTextItem->h - 1))))) {
+ myTextItem = myTextItem->next;
+ }
+ if (myTextItem && (myTextItem->type == MESSAGE)) {
+ myTextItem = nullptr;
+ }
+ if (myTextItem != myTextScrn->hiliteItem) {
+ oldHiliteItem = myTextScrn->hiliteItem;
+ myTextScrn->hiliteItem = myTextItem;
+ if (oldHiliteItem) {
+ RestoreScreens(myScreen->x1 + oldHiliteItem->x, myScreen->y1 + oldHiliteItem->y,
+ myScreen->x1 + oldHiliteItem->x + oldHiliteItem->w - 1,
+ myScreen->y1 + oldHiliteItem->y + oldHiliteItem->h - 1);
+ }
+ if (myTextItem) {
+ RestoreScreens(myScreen->x1 + myTextItem->x, myScreen->y1 + myTextItem->y,
+ myScreen->x1 + myTextItem->x + myTextItem->w - 1,
+ myScreen->y1 + myTextItem->y + myTextItem->h - 1);
+ }
+ }
+ switch (parm1) {
+ case _ME_L_click:
+ if (currScreen) {
+ *currScreen = true;
+ }
+ if (!(myScreen->scrnFlags & SF_IMMOVABLE)) {
+ _GD(movingScreen) = true;
+ movingX = parm2;
+ movingY = parm3;
+ }
+ break;
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+ case _ME_L_drag:
+ if (_GD(movingScreen)) {
+ MoveScreenDelta(myScreen, parm2 - movingX, parm3 - movingY);
+ movingX = parm2;
+ movingY = parm3;
+ }
+ break;
+ case _ME_move:
+ if ((parm2 < myScreen->x1) || (parm2 > myScreen->x2) ||
+ (parm3 < myScreen->y1) || (parm3 > myScreen->y2)) {
+ if (currScreen) {
+ *currScreen = false;
+ }
+ return false;
+ }
+ break;
+ case _ME_doubleclick:
+ break;
+ case _ME_L_release:
+ if (currScreen) {
+ *currScreen = false;
+ }
+ _GD(movingScreen) = false;
+ if (myTextItem && myTextItem->callback) {
+ (myTextItem->callback)((void *)myTextItem, (void *)myTextScrn);
+ }
+ myScreen = vmng_screen_find(theTextScrn, &status);
+ break;
+
+ case _ME_doubleclick_release:
+ break;
+ }
+
+ if (myScreen && myTextScrn->hiliteItem && currScreen) {
+ *currScreen = true;
+ }
+
+ return true;
}
} // namespace M4
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index a32e6575c24..56658f90e1e 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -31,6 +31,10 @@
namespace M4 {
+enum {
+ TS_GIVEN = 0, TS_JUST_LEFT, TS_JUST_RIGHT, TS_CENTRE
+};
+
struct Dialog {
int32 w, h;
int32 num_items;
@@ -55,6 +59,15 @@ struct TextScrn {
GrBuff *textScrnBuffer;
};
+struct Dialog_Globals {
+ bool okButton = false;
+ //event handler vars
+ bool movingScreen = false;
+ Item *clickItem = nullptr;
+ Item *doubleClickItem = nullptr;
+ char listboxSearchStr[80] = { 0 };
+};
+
extern bool gui_dialog_init();
extern void gui_dialog_shutdown();
@@ -72,14 +85,14 @@ extern void Dialog_SetDefault(Dialog *d, int32 tag);
extern bool Dialog_SetPressed(Dialog *d, int32 tag);
//MESSAGE TYPE SUPPORT
-extern bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, char *prompt, int32 tag);
+extern bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 tag);
//PICTURE TYPE SUPPORT
extern bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag);
//BUTTON TYPE SUPPORT
-extern bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, char *prompt, M4CALLBACK cb, int32 tag);
-extern bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, char *prompt, M4CALLBACK cb, int32 tag);
+extern bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
+extern bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
//LIST TYPE SUPPORT
extern bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 43698aa2d64..276da57bd78 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -43,12 +43,6 @@ namespace M4 {
#define STR_LIST "gui list item"
#define STR_PROMPT "prompt"
-enum {
- LIST_BY_TAG = 0,
- LIST_ALPH,
- LIST_SEQUN
-};
-
// Interface sprites
#define scrollUpWidth 11
#define scrollUpHeight 12
@@ -444,7 +438,7 @@ static void CorrectItemWidthHeight(Item *item, int32 fontHeight) {
}
}
-Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, char *prompt, int32 tag, enum ItemType type, M4CALLBACK cb, int32 promptMax) {
+Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *prompt, int32 tag, enum ItemType type, M4CALLBACK cb, int32 promptMax) {
Item *item;
int32 fontHeight, listboxWidth, listboxHeight;
Font *myFont;
@@ -474,7 +468,8 @@ Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, char *prompt,
case PICTURE:
item->myFont = nullptr;
item->prompt = nullptr;
- item->aux = prompt;
+ // FIXME: Refactor out const_cast
+ item->aux = const_cast<char *>(prompt);
break;
case TEXTFIELD:
if ((int)strlen(prompt) > (promptMax + 1))
@@ -1221,8 +1216,8 @@ void SetTextBlockEnd(Item *myItem, int32 relXPos) {
}
static int32 CopyTextBlock(Item *myItem) {
- int32 numOfCopiedChars = 0;
- char *beginBlock, *endBlock;
+ int32 numOfCopiedChars = 0;
+ const char *beginBlock, *endBlock;
if (myItem->aux != myItem->aux2) {
if (myItem->aux < myItem->aux2) {
@@ -1243,7 +1238,8 @@ static int32 CopyTextBlock(Item *myItem) {
static int32 DeleteTextBlock(Item *myItem) {
int32 numOfDeletedChars = 0;
- char tempBuf[80], *beginBlock, *endBlock;
+ char tempBuf[80];
+ char *beginBlock, *endBlock;
if (myItem->aux != myItem->aux2) {
Item_SaveTextFieldChange(myItem, true);
diff --git a/engines/m4/gui/gui_item.h b/engines/m4/gui/gui_item.h
index 395fdbf5436..6b1cb093006 100644
--- a/engines/m4/gui/gui_item.h
+++ b/engines/m4/gui/gui_item.h
@@ -53,6 +53,12 @@ enum ItemType {
MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
};
+enum {
+ LIST_BY_TAG = 0,
+ LIST_ALPH,
+ LIST_SEQUN
+};
+
struct ListItem {
char prompt[80];
int32 tag;
@@ -113,7 +119,7 @@ extern bool InitItems(void);
extern Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
extern void Item_destroy(Item *myItem);
extern void Item_empty_list(Item *myItem);
-extern Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, char *prompt, int32 tag,
+extern Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *prompt, int32 tag,
ItemType type, M4CALLBACK cb, int32 promptMax);
extern Item *ItemFind(Item *itemList, int32 tag);
extern bool Item_SetViewBottom(Item *i);
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 4e328fe3949..a3ac1992151 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -51,7 +51,7 @@ void gui_system_shutdown() {
}
}
-void gui_system_event_handler(void) {
+void gui_system_event_handler() {
mausEvent newMouseEvent;
ScreenContext *myScreen;
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index fd429bce3c7..d79db22ea22 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -54,6 +54,8 @@
* WILL ALSO RESTORE THE MONITOR'S IMAGE, TAKING CARE OF A VIDEO REFRESH REQUIREMENTS.
*/
+#include "common/system.h"
+#include "graphics/surface.h"
#include "m4/gui/gui_vmng.h"
#include "m4/gui/gui_dialog.h"
#include "m4/core/errors.h"
@@ -171,6 +173,32 @@ ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32
return myScreen;
}
+void vmng_screen_dispose(void *scrnContent) {
+ ScreenContext *myScreen;
+ Hotkey *myHotkeys, *tempHotkey;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == NULL) return;
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+ myHotkeys = myScreen->scrnHotkeys;
+ tempHotkey = myHotkeys;
+ while (tempHotkey) {
+ myHotkeys = myHotkeys->next;
+ mem_free(tempHotkey);
+ tempHotkey = myHotkeys;
+ }
+ mem_free_to_stash((void *)myScreen, _G(memtypeSCRN));
+}
+
+void vmng_screen_hide(void *scrnContent) {
+ ScreenContext *myScreen;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ACTIVE)) == NULL) return;
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+ myScreen->behind = _G(inactiveScreens);
+ myScreen->infront = nullptr;
+ if (_G(inactiveScreens))
+ _G(inactiveScreens)->infront = myScreen;
+ _G(inactiveScreens) = myScreen;
+}
+
void vmng_screen_show(void *scrnContent) {
ScreenContext *myScreen, *tempScreen;
if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == nullptr)
@@ -238,6 +266,11 @@ ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
return myScreen;
}
+void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer) {
+ g_system->copyRectToScreen(srcBuffer->data, srcBuffer->stride, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ g_system->updateScreen();
+}
+
/**
* Remove the window from either the active list of windows, or the inactive list,
* wherever it was found.
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index 7a227dcc152..831ef87c294 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -29,6 +29,7 @@
namespace M4 {
static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2);
+static bool MoveScreen(ScreenContext *myScreen, int32 parmX, int32 parmY, bool deltaMove);
bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *y2) {
ScreenContext *myScreen;
@@ -191,4 +192,105 @@ static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2) {
g_system->unlockScreen();
}
+bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback) {
+ ScreenContext *myScreen;
+ Hotkey *myHotkey;
+
+ if ((myScreen = vmng_screen_find(scrnContent, nullptr)) == nullptr)
+ return false;
+
+ if ((myHotkey = (Hotkey *)mem_alloc(sizeof(Hotkey), "hotkey")) == nullptr)
+ return false;
+
+ myHotkey->myKey = myKey;
+ myHotkey->callback = callback;
+ myHotkey->next = myScreen->scrnHotkeys;
+ myScreen->scrnHotkeys = myHotkey;
+ return true;
+}
+
+bool RemoveScreenHotkey(void *scrnContent, int32 myKey) {
+ ScreenContext *myScreen;
+ Hotkey *myHotkey, *tempHotkey;
+ if ((myScreen = vmng_screen_find(scrnContent, nullptr)) == nullptr)
+ return false;
+
+ myHotkey = myScreen->scrnHotkeys;
+
+ if (myHotkey->myKey == myKey) {
+ myScreen->scrnHotkeys = myHotkey->next;
+ mem_free(myHotkey);
+
+ } else {
+ while (myHotkey->next && (myHotkey->next->myKey != myKey)) {
+ myHotkey = myHotkey->next;
+ }
+ if (myHotkey->next) {
+ tempHotkey = myHotkey->next;
+ myHotkey->next = tempHotkey->next;
+ mem_free(tempHotkey);
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool MoveScreenAbs(ScreenContext *myScreen, int32 parmX, int32 parmY) {
+ return MoveScreen(myScreen, parmX, parmY, false);
+}
+
+bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY) {
+ return MoveScreen(myScreen, parmX, parmY, true);
+}
+
+static bool MoveScreen(ScreenContext *myScreen, int32 parmX, int32 parmY, bool deltaMove) {
+ int32 origX1, origY1, origX2, origY2;
+ if (!_G(vmng_Initted))
+ return false;
+
+ origX1 = myScreen->x1;
+ origY1 = myScreen->y1;
+ origX2 = myScreen->x2;
+ origY2 = myScreen->y2;
+ if (!deltaMove) {
+ parmX -= origX1;
+ parmY -= origY1;
+ }
+ if (!(myScreen->scrnFlags & SF_OFFSCRN)) {
+ if ((myScreen->x2 + parmX) > MAX_VIDEO_X) parmX = MAX_VIDEO_X - myScreen->x2;
+ else if ((myScreen->x1 + parmX) < 0) parmX = -myScreen->x1;
+ if ((myScreen->y2 + parmY) > MAX_VIDEO_Y) parmY = MAX_VIDEO_Y - myScreen->y2;
+ else if ((myScreen->y1 + parmY) < 0) parmY = -myScreen->y1;
+ }
+ if (!(parmX || parmY)) return false;
+ myScreen->x1 += parmX;
+ myScreen->y1 += parmY;
+ myScreen->x2 += parmX;
+ myScreen->y2 += parmY;
+ if (parmY > 0) {
+ RestoreScreens(origX1, origY1, origX2, myScreen->y1 - 1);
+ if (parmX > 0) {
+ RestoreScreens(origX1, myScreen->y1, myScreen->x1 - 1, origY2);
+ } else if (parmX < 0) {
+ RestoreScreens(myScreen->x2 + 1, myScreen->y1, origX2, origY2);
+ }
+ } else if (parmY < 0) {
+ RestoreScreens(origX1, myScreen->y2 + 1, origX2, origY2);
+ if (parmX > 0) {
+ RestoreScreens(origX1, origY1, myScreen->x1 - 1, myScreen->y2);
+ } else if (parmX < 0) {
+ RestoreScreens(myScreen->x2 + 1, origY1, origX2, myScreen->y2);
+ }
+ } else if (parmX > 0) {
+ RestoreScreens(origX1, origY1, myScreen->x1 - 1, origY2);
+ } else {
+ RestoreScreens(myScreen->x2 + 1, origY1, origX2, origY2);
+ }
+
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+ return true;
+}
+
} // End of namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 182a31ea151..ff1c14358c5 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -34,6 +34,7 @@ MODULE_OBJS = \
graphics/gr_pal.o \
graphics/gr_series.o \
graphics/graphics.o \
+ graphics/krn_pal.o \
gui/gui_buffer.o \
gui/gui_dialog.o \
gui/gui_item.o \
Commit: 7ba1e59e8b8bcff64c552bd0e23c4b227fef90c9
https://github.com/scummvm/scummvm/commit/7ba1e59e8b8bcff64c552bd0e23c4b227fef90c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of interface.cpp
Changed paths:
A engines/m4/gui/interface.cpp
A engines/m4/gui/interface.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_pal.h
engines/m4/graphics/graphics.h
engines/m4/module.mk
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 164cc70d340..8b56c87b0d0 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -44,6 +44,7 @@ Globals::Globals() {
Globals::~Globals() {
game_systems_shutdown();
+ interface_shutdown();
sysfile_shutdown();
player_been_shutdown();
@@ -82,6 +83,7 @@ bool Globals::init() {
main_cold_data_init();
create_mouse_watch_dialog();
global_menu_system_init();
+ interface_init(0, 5, 6, 8, 9);
return true;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index c2485753d25..62910e3691c 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -38,6 +38,7 @@
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
+#include "m4/gui/interface.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
@@ -84,6 +85,7 @@ public:
MouseInfo _MouseState;
Dialog_Globals _dialog;
Item_Globals _items;
+ Interface_Globals _interface;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 32d23428c2b..0909bbc6d4d 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_GRAPHICS_GRAPHICS_H
-#define M4_GRAPHICS_GRAPHICS_H
+#ifndef M4_GRAPHICS_GR_PAL_H
+#define M4_GRAPHICS_GR_PAL_H
#include "m4/m4_types.h"
diff --git a/engines/m4/graphics/graphics.h b/engines/m4/graphics/graphics.h
index 5cc4c086bc3..cac2033e940 100644
--- a/engines/m4/graphics/graphics.h
+++ b/engines/m4/graphics/graphics.h
@@ -26,6 +26,9 @@
namespace M4 {
+constexpr int SCREEN_WIDTH = 640;
+constexpr int SCREEN_HEIGHT = 480;
+
#define FILL_INTERIOR 1 // a flag for use by DrawTile
#define BORDER 0
diff --git a/engines/m4/gui/interface.cpp b/engines/m4/gui/interface.cpp
new file mode 100644
index 00000000000..41b0e1e63ee
--- /dev/null
+++ b/engines/m4/gui/interface.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/interface.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define _GI(X) _G(interface).X
+
+static void sub1();
+
+void interface_init(int arrow, int wait, int look, int grab, int use) {
+ _GI(arrow) = arrow;
+ _GI(wait) = wait;
+ _GI(look) = look;
+ _GI(grab) = grab;
+ _GI(use) = use;
+
+ mouse_set_sprite(wait);
+
+ _GI(gameInterfaceBuff) = new GrBuff(_GI(x2) - _GI(x1), _GI(y2) - _GI(y1));
+ sub1();
+
+ mouse_set_sprite(arrow);
+}
+
+void interface_shutdown() {
+ // TODO
+}
+
+static void sub1() {
+
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
new file mode 100644
index 00000000000..2d989df0400
--- /dev/null
+++ b/engines/m4/gui/interface.h
@@ -0,0 +1,51 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_INTERFACE_H
+#define M4_GUI_INTERFACE_H
+
+#include "m4/m4_types.h"
+#include "m4/graphics/graphics.h"
+#include "m4/graphics/gr_buff.h"
+
+namespace M4 {
+
+struct Interface_Globals {
+ int arrow = 0;
+ int wait = 0;
+ int look = 0;
+ int grab = 0;
+ int use = 0;
+ bool shown = false;
+ int x1 = 0;
+ int y1 = 374;
+ int x2 = SCREEN_WIDTH;
+ int y2 = SCREEN_HEIGHT;
+ GrBuff *gameInterfaceBuff = nullptr;
+};
+
+extern void interface_init(int arrow, int wait, int look, int grab, int use);
+extern void interface_shutdown();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ff1c14358c5..ac94e753c0e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -44,6 +44,7 @@ MODULE_OBJS = \
gui/gui_vmng_core.o \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
+ gui/interface.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
Commit: 8d6e8a732ca7ce46a5cc23fe3cc9a934aa3c9849
https://github.com/scummvm/scummvm/commit/8d6e8a732ca7ce46a5cc23fe3cc9a934aa3c9849
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui_cheapo.cpp
Changed paths:
A engines/m4/adv_r/adv_trigger.cpp
A engines/m4/adv_r/adv_trigger.h
A engines/m4/gui/gui_cheapo.cpp
A engines/m4/gui/gui_cheapo.h
engines/m4/globals.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/gui/interface.h
engines/m4/m4_types.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
new file mode 100644
index 00000000000..95e1e12352c
--- /dev/null
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -0,0 +1,27 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_trigger.h"
+
+namespace M4 {
+
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
new file mode 100644
index 00000000000..3c0d60f86af
--- /dev/null
+++ b/engines/m4/adv_r/adv_trigger.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 M4_ADV_R_ADV_TRIGGER_H
+#define M4_ADV_R_ADV_TRIGGER_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern int32 kernel_trigger_create(int32 trigger_num);
+extern int32 kernel_trigger_create_mode(int32 trigger_num, int32 desired_mode);
+extern bool kernel_trigger_dispatch(int32 trigger_num);
+extern bool kernel_trigger_dispatch_now(int32 trigger_num);
+
+extern void kernel_timing_trigger(int32 ticks, int16 trigger, char *name = NULL);
+
+extern void cisco_dispatch_triggers();
+extern void cisco_clear_triggers();
+extern void kernel_service_timing_trigger_q();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 62910e3691c..78a16c3f0c3 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -105,7 +105,6 @@ public:
void *_custom_interface_setup = nullptr;
void *_custom_interface_button_handler = nullptr;
int _global_sound_room = 0;
- bool _interface_visible = false;
bool _please_hyperwalk = false;
void (*_custom_ascii_converter)(char *string) = nullptr;
bool _vmng_Initted = false;
@@ -133,6 +132,7 @@ public:
byte _color = 0;
Dialog *_mousePosDialog = nullptr;
bool _showMousePos = false;
+ bool _inv_suppress_click_sound = false;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 3b293a6a349..54b938f481c 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -38,4 +38,9 @@ void series_unload(int32 assetIndex) {
ClearWSAssets(_WS_ASSET_CELS, assetIndex, assetIndex);
}
+bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y) {
+ error("TODO: series_draw_sprite");
+ return false;
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index e5daacdf627..49c7e591c58 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -23,11 +23,38 @@
#define M4_GRAPHICS_GR_SERIES_H
#include "m4/m4_types.h"
+#include "m4/wscript/ws_machine.h"
namespace M4 {
extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal);
extern void series_unload(int32 assetIndex);
+extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
+
+extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
+extern machine *series_place_sprite(char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
+extern machine *series_show_sprite(char *seriesName, int32 index, int32 layer); // was simple_show_sprite
+
+extern machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
+ int32 x, int32 y,
+ int32 s, int32 layer, int32 frameRate, int16 triggerNum);
+
+extern machine *series_play(char *seriesName, int32 loopCount, uint32 flags,
+ int32 s, int32 layer, int32 frameRate, int16 triggerNum,
+ bool stick_when_done);
+
+extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
+
+extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
+ int32 firstFrame, int32 lastFrame,
+ int32 s, int32 layer, int32 frameRate,
+ int16 triggerNum, bool stick_when_done);
+
+machine *series_ranged_play_xy(char *seriesName, int32 loopCount, uint32 flags,
+ int32 firstFrame, int32 lastFrame,
+ int32 x, int32 y,
+ int32 s, int32 layer, int32 frameRate,
+ int16 triggerNum, bool stick_when_done);
} // namespace M4
diff --git a/engines/m4/gui/gui_cheapo.cpp b/engines/m4/gui/gui_cheapo.cpp
new file mode 100644
index 00000000000..62ced6470e5
--- /dev/null
+++ b/engines/m4/gui/gui_cheapo.cpp
@@ -0,0 +1,812 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/gui_cheapo.h"
+#include "m4/gui/gui_vmng_core.h"
+#include "m4/gui/gui_vmng_screen.h"
+#include "m4/graphics/gr_font.h"
+#include "m4/graphics/gr_line.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/adv_r/adv_trigger.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/mem/mem.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+#define _GL(X) _G(interface).X
+
+static void refresh_right_arrow() {
+ error("TODO: refresh_right_arrow");
+}
+
+static void refresh_left_arrow() {
+ error("TODO: refresh_left_arrow");
+}
+
+RectClass::RectClass() {
+ x1 = y1 = x2 = y2 = 0;
+}
+
+RectClass::RectClass(RectClass *r) {
+ if (!r)
+ error_show(FL, 'CGNR');
+
+ x1 = r->x1;
+ y1 = r->y1;
+ x2 = r->x2;
+ y2 = r->y2;
+}
+
+RectClass::RectClass(int16 _x1, int16 _y1, int16 _x2, int16 _y2) {
+ x1 = _x1;
+ y1 = _y1;
+ x2 = _x2;
+ y2 = _y2;
+}
+
+RectClass::~RectClass() {
+}
+
+void RectClass::copyInto(RectClass *r) {
+ if (!r)
+ error_show(FL, 'CGNR');
+ r->x1 = x1;
+ r->y1 = y1;
+ r->x2 = x2;
+ r->y2 = y2;
+}
+
+void RectClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2) {
+ x1 = _x1;
+ y1 = _y1;
+ x2 = _x2;
+ y2 = _y2;
+}
+
+void RectClass::set(RectClass *r) {
+ if (!r) error_show(FL, 'CGNR');
+ x1 = r->x1; y1 = r->y1; x2 = r->x2; y2 = r->y2;
+}
+
+int16 RectClass::inside(int16 x, int16 y) {
+ if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2))
+ return 1;
+ return 0;
+}
+
+//-------------------------------------------------------------------------------------------
+
+TextField::TextField(int16 _x1, int16 _y1, int16 _x2, int16 _y2) : RectClass(_x1, _y1, _x2, _y2) {
+ string = NULL;
+ string_len = 0;
+ must_redraw = true;
+}
+
+TextField::~TextField() {
+ if (string != NULL)
+ mem_free(string);
+}
+
+void TextField::set_string(char *_string) {
+
+ must_redraw = true;
+
+ if (_string == NULL && string != NULL) {
+ string[0] = '\0';
+ return;
+ }
+ int16 _string_len = (int16)(cstrlen(_string) + 1);
+ if (string == NULL) {
+ string = (char *)mem_alloc(_string_len, "string");
+ } else {
+ if (string_len < _string_len) {
+ string = (char *)mem_realloc(string, _string_len, "string");
+ }
+ }
+ if (!string)
+ error_show(FL, 'OOM!', "TextField set_string:%s", _string);
+
+ string_len = _string_len;
+ cstrcpy(string, _string);
+}
+
+#if defined (__WIN)
+void TextField::draw(CDIBSectionBuffer *myBuffer)
+#else
+void TextField::draw(GrBuff *myBuffer)
+#endif
+{
+ if (!_GL(visible))
+ return;
+
+ Buffer *myBuff = myBuffer->get_buffer();
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ gr_font_set_color(__WHITE);
+ gr_font_set(_G(font_inter));
+ gr_font_write(myBuff, string, x1, y1, 0, 1);
+ myBuffer->release();
+
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
+ RestoreScreensInContext(x1, y1, x2, y2, iC);
+ must_redraw = false;
+}
+
+//-------------------------------------------------------------------------------------------
+
+void ButtonClass::init() {
+ relaxed = over = picked = 0; tag = 0;
+ must_redraw = true;
+ state = BUTTON_RELAXED;
+ tracking = -1;
+}
+
+ButtonClass::ButtonClass(RectClass *r, const char *btnName, int16 _tag) : RectClass(r) {
+ init();
+ cstrncpy(name, btnName, 19);
+ tag = _tag;
+ hidden = false; //aug21
+}
+
+ButtonClass::ButtonClass() : RectClass() {
+ init();
+ cstrcpy(name, "?");
+ hidden = false; //aug21
+}
+
+ButtonClass::~ButtonClass() {
+ zap_resources();
+}
+
+void ButtonClass::set_name(const char *btnName) {
+ cstrncpy(name, btnName, 19);
+}
+
+//aug23
+bool ButtonClass::is_hidden() {
+ return hidden;
+}
+
+//aug23
+void ButtonClass::set_sprite_relaxed(int16 r) {
+ relaxed = r;
+}
+
+//aug23
+void ButtonClass::set_sprite_picked(int16 p) {
+ picked = p;
+}
+
+//aug23
+void ButtonClass::set_sprite_over(int16 o) {
+ over = o;
+}
+
+int16 ButtonClass::get_tag() {
+ return tag;
+}
+void ButtonClass::zap_resources() {
+ if (relaxed)
+ ClearWSAssets(_WS_ASSET_CELS, relaxed, relaxed);
+ if (over)
+ ClearWSAssets(_WS_ASSET_CELS, over, over);
+ if (picked)
+ ClearWSAssets(_WS_ASSET_CELS, picked, picked);
+}
+
+void ButtonClass::set(ButtonClass *b) {
+ zap_resources();
+ cstrncpy(name, b->name, 19);
+ x1 = b->x1; y1 = b->y1; x2 = b->x2; y2 = b->y2; tag = b->tag;
+ relaxed = b->relaxed; over = b->over; picked = b->picked;
+}
+
+void ButtonClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2, int16 _tag) {
+ x1 = _x1;
+ y1 = _y1;
+ x2 = _x2;
+ y2 = _y2;
+ tag = _tag;
+}
+
+void ButtonClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2, int16 _tag,
+ int16 _relaxed, int16 _over, int16 _picked, int32 _sprite) {
+ zap_resources();
+ x1 = _x1;
+ y1 = _y1;
+ x2 = _x2;
+ y2 = _y2;
+ tag = _tag;
+ relaxed = _relaxed;
+ over = _over;
+ picked = _picked;
+ sprite = _sprite;
+}
+
+int16 ButtonClass::inside(int16 x, int16 y) {
+ if (RectClass::inside(x, y))
+ return tag;
+ return -1;
+}
+
+ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
+ if (!_GL(visible))
+ return NOTHING;
+
+ ButtonState old_state = state;
+ ControlStatus result = NOTHING;
+
+ bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
+
+ //term_message( "BUTTONCLASS::TRACK" );
+
+ int16 overVal = inside(x, y);
+
+ if (overVal == tag) {
+ // if Button is pressed
+ if (button_clicked) {
+ if (tracking == 1) {
+ //term_message( "BUTTON CLICKED and TRACKING" );
+ //state = BUTTON_OVER; //aug23
+
+ result = TRACKING;
+ } else {
+ tracking = 1;
+ result = IN_CONTROL;
+ state = BUTTON_PICKED;
+ //aug28 //sep8 here.
+ //if( !between_rooms && !_G(inv_suppress_click_sound) && !hidden) {
+ // digi_play( inv_click_snd, 2, 255, -1, inv_click_snd_room_lock ); //aug26: single click
+ //term_message( "hidden %d", hidden ); //sep8
+ //}
+ }
+ _G(inv_suppress_click_sound) = false;
+
+ } else { // if Button isn't pressed
+
+ if (tracking == 1) {
+ result = SELECTED;
+ //term_message( "BUTTON RELEASED" );
+ } else
+ result = OVER_CONTROL;
+
+ state = BUTTON_OVER;
+
+ tracking = -1;
+ }
+ } else {
+ result = NOTHING;
+ tracking = -1;
+ state = BUTTON_RELAXED;
+ }
+
+ if (old_state != state)
+ must_redraw = true;
+
+ return result;
+}
+
+#if defined(__WIN)
+void ButtonClass::draw(CDIBSectionBuffer *myBuffer)
+#else
+void ButtonClass::draw(GrBuff *myBuffer)
+#endif
+{
+ if (!_GL(visible))
+ return;
+
+ if (!must_redraw)
+ return;
+
+ Buffer *myBuff = myBuffer->get_buffer();
+
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(myBuff, x1, y1 - 2, x2 - x1, y2 - y1 + 2);
+
+ if (hidden == false) {
+ switch (state) {
+ case BUTTON_RELAXED:
+ series_show_frame(sprite, relaxed, myBuff, x1, y1);
+ break;
+
+ case BUTTON_PICKED:
+ series_show_frame(sprite, picked, myBuff, x1, y1);
+ break;
+
+ case BUTTON_OVER:
+ series_show_frame(sprite, over, myBuff, x1, y1);
+ break;
+ }
+ }
+
+ myBuffer->release();
+
+ must_redraw = false;
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
+ RestoreScreensInContext(x1, y1 - 2, x2, y2, iC);
+}
+
+void ButtonClass::hide() {
+ hidden = true;
+ must_redraw = true;
+}
+
+//aug21
+void ButtonClass::unhide() {
+ hidden = false;
+ must_redraw = true;
+}
+
+//-------------------------------------------------------------------------------------------
+
+Toggler::Toggler() : ButtonClass() {
+ toggle_state = SELECTED; state = BUTTON_PICKED;
+}
+
+ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
+ if (!_GL(visible))
+ return NOTHING;
+
+ ButtonState old_state = state;
+ ControlStatus result = NOTHING;
+
+ bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
+
+ int16 overVal = inside(x, y);
+
+ if (overVal == tag) {
+ // if Button is pressed
+ if (button_clicked) {
+ if (eventType == _ME_L_click) {
+ //aug28
+ //if( !_G(inv_suppress_click_sound) && !between_rooms && !hidden ) {
+ // digi_play( inv_click_snd, 2, 255, -1, inv_click_snd_room_lock ); //aug27: single click
+ //term_message( "hidden %d", hidden ); //sep8
+ //}
+ }
+
+ tracking = 1;
+ result = IN_CONTROL;
+ } else { // if Button isn't pressed
+ if (tracking == 1) {
+ result = SELECTED;
+ toggle_state = (toggle_state == SELECTED) ? NOTHING : SELECTED;
+ } else {
+ result = OVER_CONTROL;
+ }
+ tracking = -1;
+ }
+ } else {
+ if (button_clicked && tracking == 1) {
+ result = TRACKING;
+ } else {
+ result = NOTHING;
+ tracking = -1;
+ }
+ }
+
+ state = (toggle_state == SELECTED) ? BUTTON_PICKED : BUTTON_RELAXED;
+
+ if (old_state != state)
+ must_redraw = true;
+
+ return result;
+}
+
+//-------------------------------------------------------------------------------------------
+
+InterfaceBox::InterfaceBox(RectClass *r) {
+ if (!r) error_show(FL, 'CGNR');
+ r->copyInto(this);
+ highlight_index = -1;
+ must_redraw_all = true;
+ selected = false;
+ index = 0;
+ for (int16 iter = 0; iter < MAX_BUTTONS; iter++)
+ button[iter] = NULL;
+}
+
+InterfaceBox::~InterfaceBox() {
+}
+
+int16 InterfaceBox::inside(int16 x, int16 y) {
+ if (!index)
+ return -1;
+
+ if (!RectClass::inside(x, y))
+ return -1;
+
+ int16 iter;
+ for (iter = 0; iter < index; iter++) {
+ if (button[iter]->inside(x, y))
+ return button[iter]->get_tag();
+ }
+ return -1;
+}
+
+void InterfaceBox::highlight_button(int16 _index) {
+
+ if (highlight_index == _index) {
+ return;
+ }
+
+ if (highlight_index != -1)
+ button[highlight_index]->must_redraw = true;
+
+ if (_index == -1)
+ selected = false;
+
+ highlight_index = _index;
+
+ if (highlight_index != -1)
+ button[highlight_index]->must_redraw = true;
+}
+
+void InterfaceBox::set_selected(bool _s) {
+
+ if (_s == selected)
+ return;
+
+ selected = _s;
+
+ if (highlight_index != -1)
+ button[highlight_index]->must_redraw = true;
+}
+
+void InterfaceBox::add(ButtonClass *b) {
+ if (!b)
+ error_show(FL, 'CGIA');
+ if (index >= MAX_BUTTONS)
+ error_show(FL, 'CGIA');
+
+ // convert to global coordinates
+ b->x1 += x1; b->x2 += x1;
+ b->y1 += y1; b->y2 += y1;
+
+ button[index] = b;
+ button[index]->must_redraw = true;
+ ++index;
+}
+
+ControlStatus InterfaceBox::track(int32 eventType, int16 x, int16 y) {
+ ControlStatus result = NOTHING;
+
+ for (int iter = 0; iter < index; iter++) {
+ if (button[iter]->track(eventType, x, y) == SELECTED) {
+ highlight_index = button[iter]->get_tag();
+ term_message("selected button: %ld", iter);
+ result = SELECTED;
+ }
+ }
+ return result;
+}
+
+void InterfaceBox::draw(GrBuff *myBuffer) {
+ if (!_GL(visible))
+ return;
+#if 0
+ Buffer *myBuff = myBuffer->get_buffer();
+#endif
+
+ if (must_redraw_all) {
+ gr_color_set(__BLACK);
+ //gr_buffer_rect_fill(myBuff, x1, y1+10, x2-x1, y2-y1);
+ }
+ myBuffer->release();
+
+ int16 iter;
+ for (iter = 0; iter < index; iter++) {
+ button[iter]->must_redraw |= must_redraw_all;
+ button[iter]->draw(myBuffer);
+ }
+
+ if (must_redraw_all) {
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
+ RestoreScreensInContext(x1, y1, x2, y2, iC);
+ kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
+ }
+ must_redraw_all = false;
+}
+
+//-------------------------------------------------------------------------------------------
+
+Inventory::Inventory(RectClass *r, int32 _sprite, int16 _cells_h, int16 _cells_v, int16 _cell_w, int16 _cell_h, int16 _tag)
+ : RectClass(r) {
+
+ sprite = _sprite;
+
+ for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
+ cells[iter] = -1;
+ cursors[iter] = -1;
+ names[iter] = NULL;
+ }
+ num_cells = 0;
+ tag = _tag;
+ cells_h = _cells_h; cells_v = _cells_v; cell_w = _cell_w; cell_h = _cell_h;
+
+ // if requested cell configuration doesn't fit, blow up.
+ if ((cells_h * cell_w > (x2 - x1)) || (cells_v * cell_h > (y2 - y1))) {
+ error_show(FL, 'CGIC');
+ }
+
+ hidden = false;
+ highlight = dehighlight = -1;
+ must_redraw_all = true; must_redraw1 = -1; must_redraw2 = -1;
+ scroll = 0;
+ right_arrow_visible = false;
+}
+
+Inventory::~Inventory() {
+}
+
+// Inventory::add always adds at the end
+
+bool Inventory::add(char *name, char *verb, int32 invSprite, int32 cursor) {
+
+ // don't add something twice
+ int iter;
+ for (iter = 0; iter < num_cells; iter++) {
+ if (!strcmp(name, names[iter]))
+ return true;
+ }
+
+ if (num_cells >= INVENTORY_CELLS_COUNT) {
+ error_show(FL, 'CGIA');
+ return false;
+ }
+ names[num_cells] = name;
+ verbs[num_cells] = verb; // DT oct 18
+
+ cells[num_cells] = (int16)invSprite;
+ cursors[num_cells] = (int16)cursor;
+ ++num_cells;
+ must_redraw_all = true;
+ return true;
+}
+
+bool Inventory::need_left() {
+ return (scroll != 0);
+}
+
+bool Inventory::need_right() {
+ //term_message( "num_cells %d scroll %d", num_cells, scroll );
+ if ((num_cells - scroll - MAX_BUTTONS) > 0)
+ return true;
+ return false;
+}
+
+void Inventory::set_scroll(int32 new_scroll) {
+ scroll = new_scroll;
+ must_redraw_all = true;
+}
+
+bool Inventory::remove(char *name) {
+
+ int iter;
+ for (iter = 0; iter < num_cells; iter++) {
+ // found the thing?
+ if (!strcmp(name, names[iter])) {
+
+ // eat up its slot by moving everything down
+ do {
+
+ names[iter] = names[iter + 1];
+ verbs[iter] = verbs[iter + 1]; // DT oct 18
+ cells[iter] = cells[iter + 1];
+ cursors[iter] = cursors[iter + 1];
+
+ ++iter;
+
+ } while (iter < num_cells);
+
+ --num_cells;
+ must_redraw_all = true;
+ scroll = 0;
+ return true;
+ }
+ }
+
+ // didn't find that thing.
+ return false;
+}
+
+
+void Inventory::hide(bool _hidden) {
+ hidden = _hidden;
+ must_redraw_all = true;
+}
+
+int16 Inventory::inside(int16 x, int16 y) {
+ if ((x < x1) || (x >= (x2 - 1)) || (y < y1 + 2) ||
+ (y > y1 + cells_v * cell_h - 2))
+ return -1;
+
+ x -= x1;
+ y -= y1;
+ //term_message( "BOX # %d", (int16)((x/cell_w) * cells_v + (y/cell_h)) );
+ return (int16)((x / cell_w) * cells_v + (y / cell_h));
+}
+
+int16 Inventory::cell_pos_x(int16 index) {
+ if (cells_h > cells_v) { // horizontal orientation, fill left to right
+ return (int16)((index / cells_v) * cell_w);
+ } else { // vertical orientation, fill top to bottom
+ return (int16)((index / cells_h) * cell_w);
+ }
+}
+
+int16 Inventory::cell_pos_y(int16 index) {
+ if (cells_h > cells_v) { // horizontal orientation, fill left to right
+ return (int16)((index % cells_v) * cell_h);
+ } else { // vertical orientation, fill top to bottom
+ return (int16)((index % cells_h) * cell_h);
+ }
+}
+
+void Inventory::highlight_part(int16 _index) {
+
+ if (highlight == _index) {
+ return;
+ }
+
+ must_redraw1 = highlight;
+ highlight = _index;
+ must_redraw2 = highlight;
+}
+
+void Inventory::draw(GrBuff *myBuffer) {
+ if (!_GL(visible))
+ return;
+
+ if (!must_redraw1 && !must_redraw2 && !must_redraw_all)
+ return;
+
+ int16 offx = 0, offy = 0;
+ int cell_iter;
+
+ Buffer *myBuff = myBuffer->get_buffer();
+
+ if (hidden) {
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ goto done;
+ }
+
+ if (must_redraw_all) {
+ kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ }
+
+ offy += 2;
+ offx += 2;
+ right_arrow_visible = false;
+
+ for (cell_iter = 0; (cell_iter + scroll < num_cells) && (cell_iter < MAX_BUTTONS); cell_iter++) {
+ int16 left = (int16)(x1 + offx + cell_pos_x(cell_iter));
+ //int16 right = (int16)(left + cell_w);
+ int16 top = (int16)(y1 + offy + cell_pos_y(cell_iter));
+ //int16 bottom = (int16)(top + cell_h);
+
+ if (must_redraw1 == cell_iter || must_redraw2 == cell_iter || must_redraw_all) {
+ // this does the button update....
+ refresh_right_arrow();
+ refresh_left_arrow();
+
+ // draw_icon_here
+ gr_color_set(__BLACK);
+ gr_buffer_rect_fill(myBuff, left, top, cell_w + 1, cell_h + 1);
+ series_show_frame(sprite, cells[cell_iter + scroll], myBuff, left - 3, top - 3);
+
+ // draw_box around icon
+ if (highlight == cell_iter) {
+ gr_line(left, top, left + cell_w - 2, top + 1, __LTGRAY, myBuff);
+ gr_line(left, top + cell_h - 2, left + cell_w - 2, top + cell_h - 2, __LTGRAY, myBuff);
+ gr_line(left, top, left, top + cell_h - 2, __LTGRAY, myBuff);
+ gr_line(left + cell_w - 2, top + 1, left + cell_w - 2, top + cell_h - 2, __LTGRAY, myBuff);
+ }
+ }
+ }
+done:
+ myBuffer->release();
+
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
+ RestoreScreensInContext(x1, y1, x2, y2, iC);
+ must_redraw1 = must_redraw2 = -1;
+ must_redraw_all = false;
+}
+
+ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
+ if (!_GL(visible))
+ return NOTHING;
+
+ static int16 interface_tracking = -1;
+ ControlStatus result = NOTHING;
+
+ int16 over = inside(x, y);
+ bool button_clicked = eventType == _ME_L_click || eventType == _ME_L_hold || eventType == _ME_L_drag;
+
+ // if Button is pressed
+ if (button_clicked) {
+ // if we are not tracking, start tracking
+ if (interface_tracking == -1) {
+ highlight_part(over);
+ interface_tracking = over;
+ result = IN_CONTROL;
+ }
+ // else if we are over something we are tracking
+ else {
+ if (interface_tracking == over) {
+ highlight_part(over);
+ result = IN_CONTROL;
+ }
+ // else highlight nothing
+ else {
+ highlight_part(-1);
+ result = NOTHING;
+ }
+ }
+ }
+ // if Button isn't pressed
+ else {
+ // if we unpressed on something we were tracking
+ if (interface_tracking == over) {
+ if (interface_tracking == -1)
+ result = NOTHING;
+ else
+ result = SELECTED;
+ } else {
+ if (over + scroll < num_cells)
+ result = OVER_CONTROL;
+ else
+ result = NOTHING;
+ }
+ // stop tracking anything
+ highlight_part(over);
+ interface_tracking = -1;
+ }
+#if 0
+ switch (result) {
+ case OVER_CONTROL:
+ term_message("inv:over %ld", over);
+ break;
+ case SELECTED:
+ term_message("inv:selected %ld", over);
+ break;
+ case IN_CONTROL:
+ term_message("inv:in %ld", over);
+ break;
+ case NOTHING:
+ term_message("inv:nothing %ld", over);
+ break;
+ }
+#endif
+ if (result == NOTHING && button_clicked)
+ return TRACKING;
+
+ return result;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/gui_cheapo.h b/engines/m4/gui/gui_cheapo.h
new file mode 100644
index 00000000000..f91a357624f
--- /dev/null
+++ b/engines/m4/gui/gui_cheapo.h
@@ -0,0 +1,212 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_CHEAPO_H
+#define M4_GUI_GUI_CHEAPO_H
+
+#include "m4/graphics/gr_buff.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+constexpr int16 INVENTORY_CELLS_COUNT = 128;
+constexpr int16 ARROW_WIDTH = 8;
+constexpr int16 MAX_BUTTONS = 20;
+
+constexpr int16 LEFT_ARROW_TAG = 128;
+constexpr int16 RIGHT_ARROW_TAG = 129;
+
+constexpr int16 LEFT_ARROW_TAG_DORMANT = 130;
+constexpr int16 RIGHT_ARROW_TAG_DORMANT = 134;
+constexpr int16 LEFT_ARROW_TAG_ROLL = 131;
+constexpr int16 RIGHT_ARROW_TAG_ROLL = 135;
+constexpr int16 LEFT_ARROW_TAG_DOWN = 132;
+constexpr int16 RIGHT_ARROW_TAG_DOWN = 136;
+constexpr int16 LEFT_ARROW_TAG_NONFUNC = 133;
+constexpr int16 RIGHT_ARROW_TAG_NONFUNC = 137;
+
+enum ControlStatus {
+ NOTHING, IN_CONTROL, OVER_CONTROL, SELECTED, TRACKING
+};
+
+enum ButtonState {
+ BUTTON_RELAXED, BUTTON_OVER, BUTTON_PICKED
+};
+
+class RectClass;
+class ButtonClass;
+class InterfaceBox;
+class Inventory;
+
+class RectClass {
+public:
+ int16 x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+public:
+ RectClass();
+ RectClass(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
+ RectClass(RectClass *);
+ virtual ~RectClass();
+ virtual int16 inside(int16 x, int16 y);
+
+ void copyInto(RectClass *);
+
+ void set(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
+ void set(RectClass *);
+};
+
+class TextField : public RectClass {
+private:
+ char *string = nullptr;
+ int16 string_len = 0;
+public:
+ bool must_redraw = false;
+
+public:
+ TextField(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
+ ~TextField();
+
+ void set_string(char *_string);
+ void draw(GrBuff *interface_buffer);
+};
+
+class ButtonClass : public RectClass {
+protected:
+ int16 tag = 0;
+ int16 relaxed = 0;
+ int16 over = 0;
+ int16 picked = 0;
+ int16 tracking = 0;
+ int32 sprite = 0;
+ bool highlighted = false;
+ bool hidden = false;
+
+ void init();
+ void zap_resources();
+
+public:
+ ButtonState state = BUTTON_RELAXED;
+ char name[20] = { 0 }; // fixme? inventory objects get 40 char strings. use MAX_PLYR_STRING_LEN?
+ bool must_redraw = false;
+
+public:
+ ButtonClass();
+ ButtonClass(RectClass *r, const char *btnName, int16 tag);
+ ~ButtonClass();
+
+ void draw(GrBuff *interface_buffer);
+ int16 inside(int16 x, int16 y);
+ virtual ControlStatus track(int32 eventType, int16 x, int16 y);
+
+ void set(ButtonClass *b);
+ void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag);
+ void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 _relaxed,
+ int16 _over, int16 _picked, int32 _sprite);
+ void set_name(const char *btnName);
+
+ int16 get_tag();
+
+ void hide();
+ void unhide();
+ bool is_hidden();
+ void set_sprite_relaxed(int16 r);
+ void set_sprite_picked(int16 p);
+ void set_sprite_over(int16 o);
+};
+
+class Toggler : public ButtonClass {
+public:
+ Toggler();
+ ControlStatus track(int32 eventType, int16 x, int16 y);
+ ControlStatus toggle_state;
+};
+
+class InterfaceBox : public RectClass {
+private:
+ bool selected = false;
+ int16 index = 0;
+ ButtonClass *button[MAX_BUTTONS] = { nullptr };
+
+public:
+ InterfaceBox(RectClass *r);
+ ~InterfaceBox();
+
+ void draw(GrBuff *interface_buffer);
+ int16 inside(int16 x, int16 y);
+ ControlStatus track(int32 eventType, int16 x, int16 y);
+
+ void add(ButtonClass *b);
+ int16 check_inventory(int16 x, int16 y);
+ void highlight_button(int16 _index);
+ void set_selected(bool);
+
+ int16 highlight_index;
+ bool must_redraw_all;
+};
+
+class Inventory : public RectClass {
+private:
+ int32 sprite = 0;
+ int16 tag = 0;
+ int16 num_cells = 0;
+ bool right_arrow_visible = false;
+
+ int16 cell_pos_x(int16 index);
+ int16 cell_pos_y(int16 index);
+
+public:
+ int16 scroll = 0;
+ int16 cells_h = 0, cells_v = 0;
+ int16 cell_w = 0, cell_h = 0;
+ int16 must_redraw1 = 0, must_redraw2 = 0;
+ int16 highlight = 0, dehighlight = 0;
+ bool must_redraw_all = false;
+ bool hidden = false;
+
+ int16 cells[INVENTORY_CELLS_COUNT] = { 0 };
+ int16 cursors[INVENTORY_CELLS_COUNT] = { 0 };
+ char *names[INVENTORY_CELLS_COUNT] = { nullptr };
+ char *verbs[INVENTORY_CELLS_COUNT] = { nullptr };
+
+public:
+ Inventory(RectClass *, int32 _sprite, int16 _cells_h, int16 _cells_v, int16 _cell_w, int16 _cell_h, int16 _tag);
+ ~Inventory();
+
+ void draw(GrBuff *interface_buffer);
+
+ int16 inside(int16 x, int16 y);
+ ControlStatus track(int32 eventType, int16 x, int16 y);
+
+ bool add(char *name, char *verb, int32 cel, int32 cursor);
+ bool remove(char *name);
+ void hide(bool);
+ void highlight_part(int16 _index);
+
+ bool need_left();
+ bool need_right();
+ void scroll_left();
+ void scroll_right();
+ void set_scroll(int32 new_scroll);
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
index 2d989df0400..014ceba4af9 100644
--- a/engines/m4/gui/interface.h
+++ b/engines/m4/gui/interface.h
@@ -35,6 +35,7 @@ struct Interface_Globals {
int look = 0;
int grab = 0;
int use = 0;
+ bool visible = false;
bool shown = false;
int x1 = 0;
int y1 = 374;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index a0187c499cd..d108c7da2b6 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -52,6 +52,11 @@ typedef uint16 word;
typedef uint16 Word;
typedef uint32 DWord;
+enum {
+ TRIG_INV_CLICK = 32000,
+ TRIG_RESTORE_GAME
+};
+
struct Buffer {
int32 W;
int32 h;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ac94e753c0e..87e7a8afeca 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -14,6 +14,7 @@ MODULE_OBJS = \
adv_r/adv_file.o \
adv_r/adv_inv.o \
adv_r/adv_rails.o \
+ adv_r/adv_trigger.o \
adv_r/db_env.o \
core/cstring.o \
core/errors.o \
@@ -36,6 +37,7 @@ MODULE_OBJS = \
graphics/graphics.o \
graphics/krn_pal.o \
gui/gui_buffer.o \
+ gui/gui_cheapo.o \
gui/gui_dialog.o \
gui/gui_item.o \
gui/gui_mouse.o \
Commit: 1799e1c9a6ac7ebcbdb8d9fe6dbdf2df245f3875
https://github.com/scummvm/scummvm/commit/1799e1c9a6ac7ebcbdb8d9fe6dbdf2df245f3875
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Shift gui_cheapo.cpp into Burger namespace
Changed paths:
A engines/m4/burger/gui_cheapo.cpp
A engines/m4/burger/gui_cheapo.h
R engines/m4/gui/gui_cheapo.cpp
R engines/m4/gui/gui_cheapo.h
engines/m4/module.mk
diff --git a/engines/m4/gui/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
similarity index 99%
rename from engines/m4/gui/gui_cheapo.cpp
rename to engines/m4/burger/gui_cheapo.cpp
index 62ced6470e5..6c0ec78ea37 100644
--- a/engines/m4/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/gui/gui_cheapo.h"
+#include "m4/burger/gui_cheapo.h"
#include "m4/gui/gui_vmng_core.h"
#include "m4/gui/gui_vmng_screen.h"
#include "m4/graphics/gr_font.h"
@@ -34,6 +34,7 @@
#include "m4/globals.h"
namespace M4 {
+namespace Burger {
#define _GL(X) _G(interface).X
@@ -809,4 +810,5 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
return result;
}
+} // End of namespace Burger
} // End of namespace M4
diff --git a/engines/m4/gui/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
similarity index 97%
rename from engines/m4/gui/gui_cheapo.h
rename to engines/m4/burger/gui_cheapo.h
index f91a357624f..874bfa60e10 100644
--- a/engines/m4/gui/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -20,13 +20,14 @@
*
*/
-#ifndef M4_GUI_GUI_CHEAPO_H
-#define M4_GUI_GUI_CHEAPO_H
+#ifndef M4_BURGER_GUI_CHEAPO_H
+#define M4_BURGER_GUI_CHEAPO_H
#include "m4/graphics/gr_buff.h"
#include "m4/m4_types.h"
namespace M4 {
+namespace Burger {
constexpr int16 INVENTORY_CELLS_COUNT = 128;
constexpr int16 ARROW_WIDTH = 8;
@@ -207,6 +208,7 @@ public:
void set_scroll(int32 new_scroll);
};
+} // End of namespace Burger
} // End of namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 87e7a8afeca..d1aa77e5f6f 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -37,7 +37,6 @@ MODULE_OBJS = \
graphics/graphics.o \
graphics/krn_pal.o \
gui/gui_buffer.o \
- gui/gui_cheapo.o \
gui/gui_dialog.o \
gui/gui_item.o \
gui/gui_mouse.o \
@@ -58,7 +57,8 @@ MODULE_OBJS = \
wscript/ws_timer.o \
wscript/wscript.o \
burger/burger.o \
- burger/burger_globals.o
+ burger/burger_globals.o \
+ burger/gui_cheapo.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: e7bf3abfe13ed8b55e56cf1404cc11f76a343976
https://github.com/scummvm/scummvm/commit/e7bf3abfe13ed8b55e56cf1404cc11f76a343976
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of gui_cheapo
Changed paths:
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 6c0ec78ea37..59987372e4b 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -47,52 +47,59 @@ static void refresh_left_arrow() {
}
RectClass::RectClass() {
- x1 = y1 = x2 = y2 = 0;
}
RectClass::RectClass(RectClass *r) {
if (!r)
error_show(FL, 'CGNR');
- x1 = r->x1;
- y1 = r->y1;
- x2 = r->x2;
- y2 = r->y2;
+ _x1 = r->_x1;
+ _y1 = r->_y1;
+ _x2 = r->_x2;
+ _y2 = r->_y2;
}
-RectClass::RectClass(int16 _x1, int16 _y1, int16 _x2, int16 _y2) {
- x1 = _x1;
- y1 = _y1;
- x2 = _x2;
- y2 = _y2;
+RectClass::RectClass(int16 x1, int16 y1, int16 x2, int16 y2) {
+ _x1 = x1;
+ _y1 = y1;
+ _x2 = x2;
+ _y2 = y2;
}
RectClass::~RectClass() {
}
void RectClass::copyInto(RectClass *r) {
- if (!r)
+ if (!r) {
error_show(FL, 'CGNR');
- r->x1 = x1;
- r->y1 = y1;
- r->x2 = x2;
- r->y2 = y2;
+ } else {
+ r->_x1 = _x1;
+ r->_y1 = _y1;
+ r->_x2 = _x2;
+ r->_y2 = _y2;
+ }
}
-void RectClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2) {
- x1 = _x1;
- y1 = _y1;
- x2 = _x2;
- y2 = _y2;
+void RectClass::set(int16 x1, int16 y1, int16 x2, int16 y2) {
+ _x1 = x1;
+ _y1 = y1;
+ _x2 = x2;
+ _y2 = y2;
}
void RectClass::set(RectClass *r) {
- if (!r) error_show(FL, 'CGNR');
- x1 = r->x1; y1 = r->y1; x2 = r->x2; y2 = r->y2;
+ if (!r) {
+ error_show(FL, 'CGNR');
+ } else {
+ _x1 = r->_x1;
+ _y1 = r->_y1;
+ _x2 = r->_x2;
+ _y2 = r->_y2;
+ }
}
-int16 RectClass::inside(int16 x, int16 y) {
- if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2))
+int16 RectClass::inside(int16 x, int16 y) const {
+ if ((x >= _x1) && (x <= _x2) && (y >= _y1) && (y <= _y2))
return 1;
return 0;
}
@@ -100,13 +107,13 @@ int16 RectClass::inside(int16 x, int16 y) {
//-------------------------------------------------------------------------------------------
TextField::TextField(int16 _x1, int16 _y1, int16 _x2, int16 _y2) : RectClass(_x1, _y1, _x2, _y2) {
- string = NULL;
+ string = nullptr;
string_len = 0;
must_redraw = true;
}
TextField::~TextField() {
- if (string != NULL)
+ if (string != nullptr)
mem_free(string);
}
@@ -114,12 +121,12 @@ void TextField::set_string(char *_string) {
must_redraw = true;
- if (_string == NULL && string != NULL) {
+ if (_string == nullptr && string != nullptr) {
string[0] = '\0';
return;
}
int16 _string_len = (int16)(cstrlen(_string) + 1);
- if (string == NULL) {
+ if (string == nullptr) {
string = (char *)mem_alloc(_string_len, "string");
} else {
if (string_len < _string_len) {
@@ -144,37 +151,37 @@ void TextField::draw(GrBuff *myBuffer)
Buffer *myBuff = myBuffer->get_buffer();
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
gr_font_set_color(__WHITE);
gr_font_set(_G(font_inter));
- gr_font_write(myBuff, string, x1, y1, 0, 1);
+ gr_font_write(myBuff, string, _x1, _y1, 0, 1);
myBuffer->release();
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
- RestoreScreensInContext(x1, y1, x2, y2, iC);
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
must_redraw = false;
}
//-------------------------------------------------------------------------------------------
void ButtonClass::init() {
- relaxed = over = picked = 0; tag = 0;
- must_redraw = true;
- state = BUTTON_RELAXED;
- tracking = -1;
+ _relaxed = _over = _picked = 0; _tag = 0;
+ _must_redraw = true;
+ _state = BUTTON_RELAXED;
+ _tracking = -1;
}
-ButtonClass::ButtonClass(RectClass *r, const char *btnName, int16 _tag) : RectClass(r) {
+ButtonClass::ButtonClass(RectClass *r, const char *btnName, int16 tag) : RectClass(r) {
init();
- cstrncpy(name, btnName, 19);
- tag = _tag;
- hidden = false; //aug21
+ cstrncpy(_name, btnName, 19);
+ _tag = tag;
+ _hidden = false;
}
ButtonClass::ButtonClass() : RectClass() {
init();
- cstrcpy(name, "?");
- hidden = false; //aug21
+ cstrcpy(_name, "?");
+ _hidden = false;
}
ButtonClass::~ButtonClass() {
@@ -182,73 +189,77 @@ ButtonClass::~ButtonClass() {
}
void ButtonClass::set_name(const char *btnName) {
- cstrncpy(name, btnName, 19);
+ cstrncpy(_name, btnName, 19);
}
-//aug23
-bool ButtonClass::is_hidden() {
- return hidden;
+bool ButtonClass::is_hidden() const {
+ return _hidden;
}
-//aug23
void ButtonClass::set_sprite_relaxed(int16 r) {
- relaxed = r;
+ _relaxed = r;
}
-//aug23
void ButtonClass::set_sprite_picked(int16 p) {
- picked = p;
+ _picked = p;
}
//aug23
void ButtonClass::set_sprite_over(int16 o) {
- over = o;
+ _over = o;
}
-int16 ButtonClass::get_tag() {
- return tag;
+int16 ButtonClass::get_tag() const {
+ return _tag;
}
void ButtonClass::zap_resources() {
- if (relaxed)
- ClearWSAssets(_WS_ASSET_CELS, relaxed, relaxed);
- if (over)
- ClearWSAssets(_WS_ASSET_CELS, over, over);
- if (picked)
- ClearWSAssets(_WS_ASSET_CELS, picked, picked);
+ if (_relaxed)
+ ClearWSAssets(_WS_ASSET_CELS, _relaxed, _relaxed);
+ if (_over)
+ ClearWSAssets(_WS_ASSET_CELS, _over, _over);
+ if (_picked)
+ ClearWSAssets(_WS_ASSET_CELS, _picked, _picked);
}
void ButtonClass::set(ButtonClass *b) {
zap_resources();
- cstrncpy(name, b->name, 19);
- x1 = b->x1; y1 = b->y1; x2 = b->x2; y2 = b->y2; tag = b->tag;
- relaxed = b->relaxed; over = b->over; picked = b->picked;
-}
-
-void ButtonClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2, int16 _tag) {
- x1 = _x1;
- y1 = _y1;
- x2 = _x2;
- y2 = _y2;
- tag = _tag;
-}
-
-void ButtonClass::set(int16 _x1, int16 _y1, int16 _x2, int16 _y2, int16 _tag,
- int16 _relaxed, int16 _over, int16 _picked, int32 _sprite) {
+ cstrncpy(_name, b->_name, 19);
+ _x1 = b->_x1;
+ _y1 = b->_y1;
+ _x2 = b->_x2;
+ _y2 = b->_y2;
+ _tag = b->_tag;
+ _relaxed = b->_relaxed;
+ _over = b->_over;
+ _picked = b->_picked;
+}
+
+void ButtonClass::set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag) {
+ _x1 = x1;
+ _y1 = y1;
+ _x2 = x2;
+ _y2 = y2;
+ _tag = tag;
+}
+
+void ButtonClass::set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag,
+ int16 relaxed, int16 over, int16 picked, int32 sprite) {
zap_resources();
- x1 = _x1;
- y1 = _y1;
- x2 = _x2;
- y2 = _y2;
- tag = _tag;
- relaxed = _relaxed;
- over = _over;
- picked = _picked;
- sprite = _sprite;
-}
-
-int16 ButtonClass::inside(int16 x, int16 y) {
+ _x1 = x1;
+ _y1 = y1;
+ _x2 = x2;
+ _y2 = y2;
+ _tag = tag;
+ _relaxed = relaxed;
+ _over = over;
+ _picked = picked;
+ _sprite = sprite;
+}
+
+int16 ButtonClass::inside(int16 x, int16 y) const {
if (RectClass::inside(x, y))
- return tag;
+ return _tag;
+
return -1;
}
@@ -256,27 +267,25 @@ ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
if (!_GL(visible))
return NOTHING;
- ButtonState old_state = state;
+ ButtonState old_state = _state;
ControlStatus result = NOTHING;
bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
- //term_message( "BUTTONCLASS::TRACK" );
-
int16 overVal = inside(x, y);
- if (overVal == tag) {
+ if (overVal == _tag) {
// if Button is pressed
if (button_clicked) {
- if (tracking == 1) {
+ if (_tracking == 1) {
//term_message( "BUTTON CLICKED and TRACKING" );
//state = BUTTON_OVER; //aug23
result = TRACKING;
} else {
- tracking = 1;
+ _tracking = 1;
result = IN_CONTROL;
- state = BUTTON_PICKED;
+ _state = BUTTON_PICKED;
//aug28 //sep8 here.
//if( !between_rooms && !_G(inv_suppress_click_sound) && !hidden) {
// digi_play( inv_click_snd, 2, 255, -1, inv_click_snd_room_lock ); //aug26: single click
@@ -285,99 +294,94 @@ ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
}
_G(inv_suppress_click_sound) = false;
- } else { // if Button isn't pressed
+ } else {
+ // if Button isn't pressed
- if (tracking == 1) {
+ if (_tracking == 1) {
result = SELECTED;
//term_message( "BUTTON RELEASED" );
} else
result = OVER_CONTROL;
- state = BUTTON_OVER;
-
- tracking = -1;
+ _state = BUTTON_OVER;
+ _tracking = -1;
}
} else {
result = NOTHING;
- tracking = -1;
- state = BUTTON_RELAXED;
+ _tracking = -1;
+ _state = BUTTON_RELAXED;
}
- if (old_state != state)
- must_redraw = true;
+ if (old_state != _state)
+ _must_redraw = true;
return result;
}
-#if defined(__WIN)
-void ButtonClass::draw(CDIBSectionBuffer *myBuffer)
-#else
-void ButtonClass::draw(GrBuff *myBuffer)
-#endif
-{
+void ButtonClass::draw(GrBuff *myBuffer) {
if (!_GL(visible))
return;
- if (!must_redraw)
+ if (!_must_redraw)
return;
Buffer *myBuff = myBuffer->get_buffer();
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, x1, y1 - 2, x2 - x1, y2 - y1 + 2);
+ gr_buffer_rect_fill(myBuff, _x1, _y1 - 2, _x2 - _x1, _y2 - _y1 + 2);
- if (hidden == false) {
- switch (state) {
+ if (_hidden == false) {
+ switch (_state) {
case BUTTON_RELAXED:
- series_show_frame(sprite, relaxed, myBuff, x1, y1);
+ series_show_frame(_sprite, _relaxed, myBuff, _x1, _y1);
break;
case BUTTON_PICKED:
- series_show_frame(sprite, picked, myBuff, x1, y1);
+ series_show_frame(_sprite, _picked, myBuff, _x1, _y1);
break;
case BUTTON_OVER:
- series_show_frame(sprite, over, myBuff, x1, y1);
+ series_show_frame(_sprite, _over, myBuff, _x1, _y1);
break;
}
}
myBuffer->release();
- must_redraw = false;
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
- RestoreScreensInContext(x1, y1 - 2, x2, y2, iC);
+ _must_redraw = false;
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ RestoreScreensInContext(_x1, _y1 - 2, _x2, _y2, iC);
}
void ButtonClass::hide() {
- hidden = true;
- must_redraw = true;
+ _hidden = true;
+ _must_redraw = true;
}
-//aug21
void ButtonClass::unhide() {
- hidden = false;
- must_redraw = true;
+ _hidden = false;
+ _must_redraw = true;
}
//-------------------------------------------------------------------------------------------
Toggler::Toggler() : ButtonClass() {
- toggle_state = SELECTED; state = BUTTON_PICKED;
+ _toggle_state = SELECTED;
+ _state = BUTTON_PICKED;
}
ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
if (!_GL(visible))
return NOTHING;
- ButtonState old_state = state;
+ ButtonState old_state = _state;
ControlStatus result = NOTHING;
bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
int16 overVal = inside(x, y);
- if (overVal == tag) {
+ if (overVal == _tag) {
// if Button is pressed
if (button_clicked) {
if (eventType == _ME_L_click) {
@@ -388,30 +392,30 @@ ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
//}
}
- tracking = 1;
+ _tracking = 1;
result = IN_CONTROL;
} else { // if Button isn't pressed
- if (tracking == 1) {
+ if (_tracking == 1) {
result = SELECTED;
- toggle_state = (toggle_state == SELECTED) ? NOTHING : SELECTED;
+ _toggle_state = (_toggle_state == SELECTED) ? NOTHING : SELECTED;
} else {
result = OVER_CONTROL;
}
- tracking = -1;
+ _tracking = -1;
}
} else {
- if (button_clicked && tracking == 1) {
+ if (button_clicked && _tracking == 1) {
result = TRACKING;
} else {
result = NOTHING;
- tracking = -1;
+ _tracking = -1;
}
}
- state = (toggle_state == SELECTED) ? BUTTON_PICKED : BUTTON_RELAXED;
+ _state = (_toggle_state == SELECTED) ? BUTTON_PICKED : BUTTON_RELAXED;
- if (old_state != state)
- must_redraw = true;
+ if (old_state != _state)
+ _must_redraw = true;
return result;
}
@@ -421,267 +425,270 @@ ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
InterfaceBox::InterfaceBox(RectClass *r) {
if (!r) error_show(FL, 'CGNR');
r->copyInto(this);
- highlight_index = -1;
- must_redraw_all = true;
- selected = false;
- index = 0;
+ _highlight_index = -1;
+ _must_redraw_all = true;
+ _selected = false;
+ _index = 0;
+
for (int16 iter = 0; iter < MAX_BUTTONS; iter++)
- button[iter] = NULL;
+ _button[iter] = nullptr;
}
InterfaceBox::~InterfaceBox() {
}
-int16 InterfaceBox::inside(int16 x, int16 y) {
- if (!index)
+int16 InterfaceBox::inside(int16 x, int16 y) const {
+ if (!_index)
return -1;
if (!RectClass::inside(x, y))
return -1;
int16 iter;
- for (iter = 0; iter < index; iter++) {
- if (button[iter]->inside(x, y))
- return button[iter]->get_tag();
+ for (iter = 0; iter < _index; iter++) {
+ if (_button[iter]->inside(x, y))
+ return _button[iter]->get_tag();
}
+
return -1;
}
-void InterfaceBox::highlight_button(int16 _index) {
+void InterfaceBox::highlight_button(int16 index) {
- if (highlight_index == _index) {
+ if (_highlight_index == index) {
return;
}
- if (highlight_index != -1)
- button[highlight_index]->must_redraw = true;
+ if (_highlight_index != -1)
+ _button[_highlight_index]->_must_redraw = true;
- if (_index == -1)
- selected = false;
+ if (index == -1)
+ _selected = false;
- highlight_index = _index;
+ _highlight_index = index;
- if (highlight_index != -1)
- button[highlight_index]->must_redraw = true;
+ if (_highlight_index != -1)
+ _button[_highlight_index]->_must_redraw = true;
}
-void InterfaceBox::set_selected(bool _s) {
+void InterfaceBox::set_selected(bool s) {
- if (_s == selected)
+ if (s == _selected)
return;
- selected = _s;
+ _selected = s;
- if (highlight_index != -1)
- button[highlight_index]->must_redraw = true;
+ if (_highlight_index != -1)
+ _button[_highlight_index]->_must_redraw = true;
}
void InterfaceBox::add(ButtonClass *b) {
- if (!b)
+ if (!b) {
error_show(FL, 'CGIA');
- if (index >= MAX_BUTTONS)
+ } else if (_index >= MAX_BUTTONS) {
error_show(FL, 'CGIA');
-
- // convert to global coordinates
- b->x1 += x1; b->x2 += x1;
- b->y1 += y1; b->y2 += y1;
-
- button[index] = b;
- button[index]->must_redraw = true;
- ++index;
+ } else {
+ // convert to global coordinates
+ b->_x1 += _x1;
+ b->_x2 += _x1;
+ b->_y1 += _y1;
+ b->_y2 += _y1;
+
+ _button[_index] = b;
+ _button[_index]->_must_redraw = true;
+ ++_index;
+ }
}
ControlStatus InterfaceBox::track(int32 eventType, int16 x, int16 y) {
ControlStatus result = NOTHING;
- for (int iter = 0; iter < index; iter++) {
- if (button[iter]->track(eventType, x, y) == SELECTED) {
- highlight_index = button[iter]->get_tag();
+ for (int iter = 0; iter < _index; iter++) {
+ if (_button[iter]->track(eventType, x, y) == SELECTED) {
+ _highlight_index = _button[iter]->get_tag();
term_message("selected button: %ld", iter);
result = SELECTED;
}
}
+
return result;
}
void InterfaceBox::draw(GrBuff *myBuffer) {
if (!_GL(visible))
return;
-#if 0
- Buffer *myBuff = myBuffer->get_buffer();
-#endif
- if (must_redraw_all) {
+ if (_must_redraw_all) {
gr_color_set(__BLACK);
//gr_buffer_rect_fill(myBuff, x1, y1+10, x2-x1, y2-y1);
}
myBuffer->release();
int16 iter;
- for (iter = 0; iter < index; iter++) {
- button[iter]->must_redraw |= must_redraw_all;
- button[iter]->draw(myBuffer);
+ for (iter = 0; iter < _index; iter++) {
+ _button[iter]->_must_redraw |= _must_redraw_all;
+ _button[iter]->draw(myBuffer);
}
- if (must_redraw_all) {
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
- RestoreScreensInContext(x1, y1, x2, y2, iC);
+ if (_must_redraw_all) {
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
}
- must_redraw_all = false;
+
+ _must_redraw_all = false;
}
//-------------------------------------------------------------------------------------------
-Inventory::Inventory(RectClass *r, int32 _sprite, int16 _cells_h, int16 _cells_v, int16 _cell_w, int16 _cell_h, int16 _tag)
- : RectClass(r) {
-
- sprite = _sprite;
+Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
+ : RectClass(r) {
+ _sprite = sprite;
for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
- cells[iter] = -1;
- cursors[iter] = -1;
- names[iter] = NULL;
+ _cells[iter] = -1;
+ _cursors[iter] = -1;
+ _names[iter] = nullptr;
}
- num_cells = 0;
- tag = _tag;
- cells_h = _cells_h; cells_v = _cells_v; cell_w = _cell_w; cell_h = _cell_h;
+ _num_cells = 0;
+ _tag = tag;
+ _cells_h = cells_h;
+ _cells_v = cells_v;
+ _cell_w = cell_w;
+ _cell_h = cell_h;
// if requested cell configuration doesn't fit, blow up.
- if ((cells_h * cell_w > (x2 - x1)) || (cells_v * cell_h > (y2 - y1))) {
+ if ((cells_h * cell_w > (_x2 - _x1)) || (cells_v * cell_h > (_y2 - _y1))) {
error_show(FL, 'CGIC');
}
- hidden = false;
- highlight = dehighlight = -1;
- must_redraw_all = true; must_redraw1 = -1; must_redraw2 = -1;
- scroll = 0;
- right_arrow_visible = false;
+ _hidden = false;
+ _highlight = _dehighlight = -1;
+ _must_redraw_all = true;
+ _must_redraw1 = -1;
+ _must_redraw2 = -1;
+ _scroll = 0;
+ _right_arrow_visible = false;
}
Inventory::~Inventory() {
}
-// Inventory::add always adds at the end
-
bool Inventory::add(char *name, char *verb, int32 invSprite, int32 cursor) {
-
- // don't add something twice
+ // Don't add something twice
int iter;
- for (iter = 0; iter < num_cells; iter++) {
- if (!strcmp(name, names[iter]))
+ for (iter = 0; iter < _num_cells; iter++) {
+ if (!strcmp(name, _names[iter]))
return true;
}
- if (num_cells >= INVENTORY_CELLS_COUNT) {
+ if (_num_cells >= INVENTORY_CELLS_COUNT) {
error_show(FL, 'CGIA');
return false;
}
- names[num_cells] = name;
- verbs[num_cells] = verb; // DT oct 18
+ _names[_num_cells] = name;
+ _verbs[_num_cells] = verb;
+
+ _cells[_num_cells] = (int16)invSprite;
+ _cursors[_num_cells] = (int16)cursor;
+ ++_num_cells;
+ _must_redraw_all = true;
- cells[num_cells] = (int16)invSprite;
- cursors[num_cells] = (int16)cursor;
- ++num_cells;
- must_redraw_all = true;
return true;
}
-bool Inventory::need_left() {
- return (scroll != 0);
+bool Inventory::need_left() const {
+ return (_scroll != 0);
}
-bool Inventory::need_right() {
- //term_message( "num_cells %d scroll %d", num_cells, scroll );
- if ((num_cells - scroll - MAX_BUTTONS) > 0)
+bool Inventory::need_right() const {
+ if ((_num_cells - _scroll - MAX_BUTTONS) > 0)
return true;
+
return false;
}
void Inventory::set_scroll(int32 new_scroll) {
- scroll = new_scroll;
- must_redraw_all = true;
+ _scroll = new_scroll;
+ _must_redraw_all = true;
}
bool Inventory::remove(char *name) {
-
int iter;
- for (iter = 0; iter < num_cells; iter++) {
- // found the thing?
- if (!strcmp(name, names[iter])) {
+ for (iter = 0; iter < _num_cells; iter++) {
+ // Found the thing?
+ if (!strcmp(name, _names[iter])) {
- // eat up its slot by moving everything down
+ // Eat up its slot by moving everything down
do {
- names[iter] = names[iter + 1];
- verbs[iter] = verbs[iter + 1]; // DT oct 18
- cells[iter] = cells[iter + 1];
- cursors[iter] = cursors[iter + 1];
+ _names[iter] = _names[iter + 1];
+ _verbs[iter] = _verbs[iter + 1]; // DT oct 18
+ _cells[iter] = _cells[iter + 1];
+ _cursors[iter] = _cursors[iter + 1];
++iter;
- } while (iter < num_cells);
+ } while (iter < _num_cells);
- --num_cells;
- must_redraw_all = true;
- scroll = 0;
+ --_num_cells;
+ _must_redraw_all = true;
+ _scroll = 0;
return true;
}
}
- // didn't find that thing.
+ // Didn't find that thing.
return false;
}
-void Inventory::hide(bool _hidden) {
- hidden = _hidden;
- must_redraw_all = true;
+void Inventory::hide(bool hidden) {
+ _hidden = hidden;
+ _must_redraw_all = true;
}
int16 Inventory::inside(int16 x, int16 y) {
- if ((x < x1) || (x >= (x2 - 1)) || (y < y1 + 2) ||
- (y > y1 + cells_v * cell_h - 2))
+ if ((x < _x1) || (x >= (_x2 - 1)) || (y < _y1 + 2) ||
+ (y > _y1 + _cells_v * _cell_h - 2))
return -1;
- x -= x1;
- y -= y1;
- //term_message( "BOX # %d", (int16)((x/cell_w) * cells_v + (y/cell_h)) );
- return (int16)((x / cell_w) * cells_v + (y / cell_h));
+ x -= _x1;
+ y -= _y1;
+ return (int16)((x / _cell_w) * _cells_v + (y / _cell_h));
}
int16 Inventory::cell_pos_x(int16 index) {
- if (cells_h > cells_v) { // horizontal orientation, fill left to right
- return (int16)((index / cells_v) * cell_w);
- } else { // vertical orientation, fill top to bottom
- return (int16)((index / cells_h) * cell_w);
+ if (_cells_h > _cells_v) { // Horizontal orientation, fill left to right
+ return (int16)((index / _cells_v) * _cell_w);
+ } else { // Vertical orientation, fill top to bottom
+ return (int16)((index / _cells_h) * _cell_w);
}
}
int16 Inventory::cell_pos_y(int16 index) {
- if (cells_h > cells_v) { // horizontal orientation, fill left to right
- return (int16)((index % cells_v) * cell_h);
- } else { // vertical orientation, fill top to bottom
- return (int16)((index % cells_h) * cell_h);
+ if (_cells_h > _cells_v) { // Horizontal orientation, fill left to right
+ return (int16)((index % _cells_v) * _cell_h);
+ } else { // Vertical orientation, fill top to bottom
+ return (int16)((index % _cells_h) * _cell_h);
}
}
void Inventory::highlight_part(int16 _index) {
-
- if (highlight == _index) {
+ if (_highlight == _index) {
return;
}
- must_redraw1 = highlight;
- highlight = _index;
- must_redraw2 = highlight;
+ _must_redraw1 = _highlight;
+ _highlight = _index;
+ _must_redraw2 = _highlight;
}
void Inventory::draw(GrBuff *myBuffer) {
if (!_GL(visible))
return;
- if (!must_redraw1 && !must_redraw2 && !must_redraw_all)
+ if (!_must_redraw1 && !_must_redraw2 && !_must_redraw_all)
return;
int16 offx = 0, offy = 0;
@@ -689,54 +696,52 @@ void Inventory::draw(GrBuff *myBuffer) {
Buffer *myBuff = myBuffer->get_buffer();
- if (hidden) {
+ if (_hidden) {
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
goto done;
}
- if (must_redraw_all) {
+ if (_must_redraw_all) {
kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, x1, y1, x2 - x1, y2 - y1);
+ gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
}
offy += 2;
offx += 2;
- right_arrow_visible = false;
+ _right_arrow_visible = false;
- for (cell_iter = 0; (cell_iter + scroll < num_cells) && (cell_iter < MAX_BUTTONS); cell_iter++) {
- int16 left = (int16)(x1 + offx + cell_pos_x(cell_iter));
- //int16 right = (int16)(left + cell_w);
- int16 top = (int16)(y1 + offy + cell_pos_y(cell_iter));
- //int16 bottom = (int16)(top + cell_h);
+ for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_BUTTONS); cell_iter++) {
+ int16 left = (int16)(_x1 + offx + cell_pos_x(cell_iter));
+ int16 top = (int16)(_y1 + offy + cell_pos_y(cell_iter));
- if (must_redraw1 == cell_iter || must_redraw2 == cell_iter || must_redraw_all) {
- // this does the button update....
+ if (_must_redraw1 == cell_iter || _must_redraw2 == cell_iter || _must_redraw_all) {
+ // This does the button update....
refresh_right_arrow();
refresh_left_arrow();
- // draw_icon_here
+ // Draw_icon_here
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, left, top, cell_w + 1, cell_h + 1);
- series_show_frame(sprite, cells[cell_iter + scroll], myBuff, left - 3, top - 3);
-
- // draw_box around icon
- if (highlight == cell_iter) {
- gr_line(left, top, left + cell_w - 2, top + 1, __LTGRAY, myBuff);
- gr_line(left, top + cell_h - 2, left + cell_w - 2, top + cell_h - 2, __LTGRAY, myBuff);
- gr_line(left, top, left, top + cell_h - 2, __LTGRAY, myBuff);
- gr_line(left + cell_w - 2, top + 1, left + cell_w - 2, top + cell_h - 2, __LTGRAY, myBuff);
+ gr_buffer_rect_fill(myBuff, left, top, _cell_w + 1, _cell_h + 1);
+ series_show_frame(_sprite, _cells[cell_iter + _scroll], myBuff, left - 3, top - 3);
+
+ // Draw_box around icon
+ if (_highlight == cell_iter) {
+ gr_line(left, top, left + _cell_w - 2, top + 1, __LTGRAY, myBuff);
+ gr_line(left, top + _cell_h - 2, left + _cell_w - 2, top + _cell_h - 2, __LTGRAY, myBuff);
+ gr_line(left, top, left, top + _cell_h - 2, __LTGRAY, myBuff);
+ gr_line(left + _cell_w - 2, top + 1, left + _cell_w - 2, top + _cell_h - 2, __LTGRAY, myBuff);
}
}
}
done:
myBuffer->release();
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, NULL);
- RestoreScreensInContext(x1, y1, x2, y2, iC);
- must_redraw1 = must_redraw2 = -1;
- must_redraw_all = false;
+ ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
+ _must_redraw1 = _must_redraw2 = -1;
+ _must_redraw_all = false;
}
ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
@@ -749,42 +754,41 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
int16 over = inside(x, y);
bool button_clicked = eventType == _ME_L_click || eventType == _ME_L_hold || eventType == _ME_L_drag;
- // if Button is pressed
+ // If Button is pressed
if (button_clicked) {
- // if we are not tracking, start tracking
+ // If we are not tracking, start tracking
if (interface_tracking == -1) {
highlight_part(over);
interface_tracking = over;
result = IN_CONTROL;
- }
- // else if we are over something we are tracking
- else {
+ } else {
+ // Else if we are over something we are tracking
if (interface_tracking == over) {
highlight_part(over);
result = IN_CONTROL;
- }
- // else highlight nothing
- else {
+ } else {
+ // Else highlight nothing
highlight_part(-1);
result = NOTHING;
}
}
- }
- // if Button isn't pressed
- else {
- // if we unpressed on something we were tracking
+ } else {
+ // If Button isn't pressed
+
+ // If we unpressed on something we were tracking
if (interface_tracking == over) {
if (interface_tracking == -1)
result = NOTHING;
else
result = SELECTED;
} else {
- if (over + scroll < num_cells)
+ if (over + _scroll < _num_cells)
result = OVER_CONTROL;
else
result = NOTHING;
}
- // stop tracking anything
+
+ // Stop tracking anything
highlight_part(over);
interface_tracking = -1;
}
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 874bfa60e10..036b61a7d85 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -60,13 +60,13 @@ class Inventory;
class RectClass {
public:
- int16 x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+ int16 _x1 = 0, _x2 = 0, _y1 = 0, _y2 = 0;
public:
RectClass();
RectClass(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
RectClass(RectClass *);
virtual ~RectClass();
- virtual int16 inside(int16 x, int16 y);
+ virtual int16 inside(int16 x, int16 y) const;
void copyInto(RectClass *);
@@ -91,22 +91,22 @@ public:
class ButtonClass : public RectClass {
protected:
- int16 tag = 0;
- int16 relaxed = 0;
- int16 over = 0;
- int16 picked = 0;
- int16 tracking = 0;
- int32 sprite = 0;
- bool highlighted = false;
- bool hidden = false;
+ int16 _tag = 0;
+ int16 _relaxed = 0;
+ int16 _over = 0;
+ int16 _picked = 0;
+ int16 _tracking = 0;
+ int32 _sprite = 0;
+ bool _highlighted = false;
+ bool _hidden = false;
void init();
void zap_resources();
public:
- ButtonState state = BUTTON_RELAXED;
- char name[20] = { 0 }; // fixme? inventory objects get 40 char strings. use MAX_PLYR_STRING_LEN?
- bool must_redraw = false;
+ ButtonState _state = BUTTON_RELAXED;
+ char _name[20] = { 0 }; // fixme? inventory objects get 40 char strings. use MAX_PLYR_STRING_LEN?
+ bool _must_redraw = false;
public:
ButtonClass();
@@ -114,7 +114,7 @@ public:
~ButtonClass();
void draw(GrBuff *interface_buffer);
- int16 inside(int16 x, int16 y);
+ int16 inside(int16 x, int16 y) const override;
virtual ControlStatus track(int32 eventType, int16 x, int16 y);
void set(ButtonClass *b);
@@ -123,35 +123,40 @@ public:
int16 _over, int16 _picked, int32 _sprite);
void set_name(const char *btnName);
- int16 get_tag();
+ int16 get_tag() const;
void hide();
void unhide();
- bool is_hidden();
+ bool is_hidden() const;
void set_sprite_relaxed(int16 r);
void set_sprite_picked(int16 p);
void set_sprite_over(int16 o);
};
class Toggler : public ButtonClass {
+public:
+ ControlStatus _toggle_state;
public:
Toggler();
ControlStatus track(int32 eventType, int16 x, int16 y);
- ControlStatus toggle_state;
};
class InterfaceBox : public RectClass {
private:
- bool selected = false;
- int16 index = 0;
- ButtonClass *button[MAX_BUTTONS] = { nullptr };
+ bool _selected = false;
+ int16 _index = 0;
+ ButtonClass *_button[MAX_BUTTONS] = { nullptr };
+
+public:
+ int16 _highlight_index = 0;
+ bool _must_redraw_all = false;
public:
InterfaceBox(RectClass *r);
~InterfaceBox();
void draw(GrBuff *interface_buffer);
- int16 inside(int16 x, int16 y);
+ int16 inside(int16 x, int16 y) const override;
ControlStatus track(int32 eventType, int16 x, int16 y);
void add(ButtonClass *b);
@@ -159,36 +164,34 @@ public:
void highlight_button(int16 _index);
void set_selected(bool);
- int16 highlight_index;
- bool must_redraw_all;
};
class Inventory : public RectClass {
private:
- int32 sprite = 0;
- int16 tag = 0;
- int16 num_cells = 0;
- bool right_arrow_visible = false;
+ int32 _sprite = 0;
+ int16 _tag = 0;
+ int16 _num_cells = 0;
+ bool _right_arrow_visible = false;
int16 cell_pos_x(int16 index);
int16 cell_pos_y(int16 index);
public:
- int16 scroll = 0;
- int16 cells_h = 0, cells_v = 0;
- int16 cell_w = 0, cell_h = 0;
- int16 must_redraw1 = 0, must_redraw2 = 0;
- int16 highlight = 0, dehighlight = 0;
- bool must_redraw_all = false;
- bool hidden = false;
-
- int16 cells[INVENTORY_CELLS_COUNT] = { 0 };
- int16 cursors[INVENTORY_CELLS_COUNT] = { 0 };
- char *names[INVENTORY_CELLS_COUNT] = { nullptr };
- char *verbs[INVENTORY_CELLS_COUNT] = { nullptr };
+ int16 _scroll = 0;
+ int16 _cells_h = 0, _cells_v = 0;
+ int16 _cell_w = 0, _cell_h = 0;
+ int16 _must_redraw1 = 0, _must_redraw2 = 0;
+ int16 _highlight = 0, _dehighlight = 0;
+ bool _must_redraw_all = false;
+ bool _hidden = false;
+
+ int16 _cells[INVENTORY_CELLS_COUNT] = { 0 };
+ int16 _cursors[INVENTORY_CELLS_COUNT] = { 0 };
+ char *_names[INVENTORY_CELLS_COUNT] = { nullptr };
+ char *_verbs[INVENTORY_CELLS_COUNT] = { nullptr };
public:
- Inventory(RectClass *, int32 _sprite, int16 _cells_h, int16 _cells_v, int16 _cell_w, int16 _cell_h, int16 _tag);
+ Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
~Inventory();
void draw(GrBuff *interface_buffer);
@@ -201,8 +204,8 @@ public:
void hide(bool);
void highlight_part(int16 _index);
- bool need_left();
- bool need_right();
+ bool need_left() const;
+ bool need_right() const;
void scroll_left();
void scroll_right();
void set_scroll(int32 new_scroll);
Commit: 95d8e72e0700819411f712178186b114163c8317
https://github.com/scummvm/scummvm/commit/95d8e72e0700819411f712178186b114163c8317
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further gui_cheapo cleanup
Changed paths:
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 59987372e4b..520b945d18a 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -49,21 +49,19 @@ static void refresh_left_arrow() {
RectClass::RectClass() {
}
-RectClass::RectClass(RectClass *r) {
- if (!r)
+RectClass::RectClass(const RectClass *r) {
+ if (!r) {
error_show(FL, 'CGNR');
-
- _x1 = r->_x1;
- _y1 = r->_y1;
- _x2 = r->_x2;
- _y2 = r->_y2;
+ } else {
+ _x1 = r->_x1;
+ _y1 = r->_y1;
+ _x2 = r->_x2;
+ _y2 = r->_y2;
+ }
}
-RectClass::RectClass(int16 x1, int16 y1, int16 x2, int16 y2) {
- _x1 = x1;
- _y1 = y1;
- _x2 = x2;
- _y2 = y2;
+RectClass::RectClass(int16 x1, int16 y1, int16 x2, int16 y2) :
+ _x1(x1), _y1(y1), _x2(x2), _y2(y2) {
}
RectClass::~RectClass() {
@@ -87,7 +85,7 @@ void RectClass::set(int16 x1, int16 y1, int16 x2, int16 y2) {
_y2 = y2;
}
-void RectClass::set(RectClass *r) {
+void RectClass::set(const RectClass *r) {
if (!r) {
error_show(FL, 'CGNR');
} else {
@@ -101,51 +99,49 @@ void RectClass::set(RectClass *r) {
int16 RectClass::inside(int16 x, int16 y) const {
if ((x >= _x1) && (x <= _x2) && (y >= _y1) && (y <= _y2))
return 1;
+
return 0;
}
//-------------------------------------------------------------------------------------------
-TextField::TextField(int16 _x1, int16 _y1, int16 _x2, int16 _y2) : RectClass(_x1, _y1, _x2, _y2) {
- string = nullptr;
- string_len = 0;
- must_redraw = true;
+TextField::TextField(int16 x1, int16 y1, int16 x2, int16 y2) :
+ RectClass(x1, y1, x2, y2) {
+ _string = nullptr;
+ _string_len = 0;
+ _must_redraw = true;
}
TextField::~TextField() {
- if (string != nullptr)
- mem_free(string);
+ if (_string != nullptr)
+ mem_free(_string);
}
-void TextField::set_string(char *_string) {
-
- must_redraw = true;
+void TextField::set_string(const char *string) {
+ _must_redraw = true;
- if (_string == nullptr && string != nullptr) {
- string[0] = '\0';
+ if (string == nullptr && string != nullptr) {
+ _string[0] = '\0';
return;
}
- int16 _string_len = (int16)(cstrlen(_string) + 1);
- if (string == nullptr) {
- string = (char *)mem_alloc(_string_len, "string");
+
+ int16 string_len = (int16)(cstrlen(string) + 1);
+ if (_string == nullptr) {
+ _string = (char *)mem_alloc(_string_len, "string");
} else {
- if (string_len < _string_len) {
- string = (char *)mem_realloc(string, _string_len, "string");
+ if (_string_len < string_len) {
+ _string = (char *)mem_realloc(_string, string_len, "string");
}
}
- if (!string)
+
+ if (!_string)
error_show(FL, 'OOM!', "TextField set_string:%s", _string);
- string_len = _string_len;
- cstrcpy(string, _string);
+ _string_len = string_len;
+ cstrcpy(_string, string);
}
-#if defined (__WIN)
-void TextField::draw(CDIBSectionBuffer *myBuffer)
-#else
-void TextField::draw(GrBuff *myBuffer)
-#endif
-{
+void TextField::draw(GrBuff *myBuffer) {
if (!_GL(visible))
return;
@@ -154,24 +150,25 @@ void TextField::draw(GrBuff *myBuffer)
gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
gr_font_set_color(__WHITE);
gr_font_set(_G(font_inter));
- gr_font_write(myBuff, string, _x1, _y1, 0, 1);
+ gr_font_write(myBuff, _string, _x1, _y1, 0, 1);
myBuffer->release();
ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
- must_redraw = false;
+ _must_redraw = false;
}
//-------------------------------------------------------------------------------------------
void ButtonClass::init() {
- _relaxed = _over = _picked = 0; _tag = 0;
+ _relaxed = _over = _picked = 0;
+ _tag = 0;
_must_redraw = true;
_state = BUTTON_RELAXED;
_tracking = -1;
}
-ButtonClass::ButtonClass(RectClass *r, const char *btnName, int16 tag) : RectClass(r) {
+ButtonClass::ButtonClass(const RectClass *r, const char *btnName, int16 tag) : RectClass(r) {
init();
cstrncpy(_name, btnName, 19);
_tag = tag;
@@ -204,7 +201,6 @@ void ButtonClass::set_sprite_picked(int16 p) {
_picked = p;
}
-//aug23
void ButtonClass::set_sprite_over(int16 o) {
_over = o;
}
@@ -212,6 +208,7 @@ void ButtonClass::set_sprite_over(int16 o) {
int16 ButtonClass::get_tag() const {
return _tag;
}
+
void ButtonClass::zap_resources() {
if (_relaxed)
ClearWSAssets(_WS_ASSET_CELS, _relaxed, _relaxed);
@@ -454,7 +451,6 @@ int16 InterfaceBox::inside(int16 x, int16 y) const {
}
void InterfaceBox::highlight_button(int16 index) {
-
if (_highlight_index == index) {
return;
}
@@ -488,7 +484,7 @@ void InterfaceBox::add(ButtonClass *b) {
} else if (_index >= MAX_BUTTONS) {
error_show(FL, 'CGIA');
} else {
- // convert to global coordinates
+ // Convert to global coordinates
b->_x1 += _x1;
b->_x2 += _x1;
b->_y1 += _y1;
@@ -550,6 +546,7 @@ Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, i
_cursors[iter] = -1;
_names[iter] = nullptr;
}
+
_num_cells = 0;
_tag = tag;
_cells_h = cells_h;
@@ -557,7 +554,7 @@ Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, i
_cell_w = cell_w;
_cell_h = cell_h;
- // if requested cell configuration doesn't fit, blow up.
+ // If requested cell configuration doesn't fit, blow up.
if ((cells_h * cell_w > (_x2 - _x1)) || (cells_v * cell_h > (_y2 - _y1))) {
error_show(FL, 'CGIC');
}
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 036b61a7d85..4d483e933b8 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -63,29 +63,29 @@ public:
int16 _x1 = 0, _x2 = 0, _y1 = 0, _y2 = 0;
public:
RectClass();
- RectClass(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
- RectClass(RectClass *);
+ RectClass(int16 x1, int16 y1, int16 x2, int16 y2);
+ RectClass(const RectClass *);
virtual ~RectClass();
virtual int16 inside(int16 x, int16 y) const;
void copyInto(RectClass *);
- void set(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
- void set(RectClass *);
+ void set(int16 x1, int16 y1, int16 x2, int16 y2);
+ void set(const RectClass *r);
};
class TextField : public RectClass {
private:
- char *string = nullptr;
- int16 string_len = 0;
+ char *_string = nullptr;
+ int16 _string_len = 0;
public:
- bool must_redraw = false;
+ bool _must_redraw = false;
public:
- TextField(int16 _x1, int16 _y1, int16 _x2, int16 _y2);
+ TextField(int16 x1, int16 y1, int16 x2, int16 y2);
~TextField();
- void set_string(char *_string);
+ void set_string(const char *string);
void draw(GrBuff *interface_buffer);
};
@@ -110,7 +110,7 @@ public:
public:
ButtonClass();
- ButtonClass(RectClass *r, const char *btnName, int16 tag);
+ ButtonClass(const RectClass *r, const char *btnName, int16 tag);
~ButtonClass();
void draw(GrBuff *interface_buffer);
@@ -119,8 +119,8 @@ public:
void set(ButtonClass *b);
void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag);
- void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 _relaxed,
- int16 _over, int16 _picked, int32 _sprite);
+ void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 relaxed,
+ int16 over, int16 picked, int32 sprite);
void set_name(const char *btnName);
int16 get_tag() const;
@@ -161,7 +161,7 @@ public:
void add(ButtonClass *b);
int16 check_inventory(int16 x, int16 y);
- void highlight_button(int16 _index);
+ void highlight_button(int16 index);
void set_selected(bool);
};
@@ -202,7 +202,7 @@ public:
bool add(char *name, char *verb, int32 cel, int32 cursor);
bool remove(char *name);
void hide(bool);
- void highlight_part(int16 _index);
+ void highlight_part(int16 index);
bool need_left() const;
bool need_right() const;
Commit: 4343a088de20a5a09e47912ef4a9b4920c325ea3
https://github.com/scummvm/scummvm/commit/4343a088de20a5a09e47912ef4a9b4920c325ea3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Yet more gui_cheapo cleanup
Changed paths:
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
engines/m4/gui/interface.h
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 520b945d18a..54a08f096b8 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -218,7 +218,7 @@ void ButtonClass::zap_resources() {
ClearWSAssets(_WS_ASSET_CELS, _picked, _picked);
}
-void ButtonClass::set(ButtonClass *b) {
+void ButtonClass::set(const ButtonClass *b) {
zap_resources();
cstrncpy(_name, b->_name, 19);
_x1 = b->_x1;
@@ -240,13 +240,14 @@ void ButtonClass::set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag) {
}
void ButtonClass::set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag,
- int16 relaxed, int16 over, int16 picked, int32 sprite) {
+ int16 unknown, int16 relaxed, int16 over, int16 picked, int32 sprite) {
zap_resources();
_x1 = x1;
_y1 = y1;
_x2 = x2;
_y2 = y2;
_tag = tag;
+ _unknown = unknown;
_relaxed = relaxed;
_over = over;
_picked = picked;
@@ -269,36 +270,28 @@ ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
- int16 overVal = inside(x, y);
+ int16 overTag = inside(x, y);
- if (overVal == _tag) {
+ if (overTag == _tag) {
// if Button is pressed
if (button_clicked) {
if (_tracking == 1) {
- //term_message( "BUTTON CLICKED and TRACKING" );
- //state = BUTTON_OVER; //aug23
-
result = TRACKING;
} else {
_tracking = 1;
result = IN_CONTROL;
_state = BUTTON_PICKED;
- //aug28 //sep8 here.
- //if( !between_rooms && !_G(inv_suppress_click_sound) && !hidden) {
- // digi_play( inv_click_snd, 2, 255, -1, inv_click_snd_room_lock ); //aug26: single click
- //term_message( "hidden %d", hidden ); //sep8
- //}
}
+
_G(inv_suppress_click_sound) = false;
} else {
// if Button isn't pressed
-
if (_tracking == 1) {
result = SELECTED;
- //term_message( "BUTTON RELEASED" );
- } else
+ } else {
result = OVER_CONTROL;
+ }
_state = BUTTON_OVER;
_tracking = -1;
@@ -333,13 +326,14 @@ void ButtonClass::draw(GrBuff *myBuffer) {
series_show_frame(_sprite, _relaxed, myBuff, _x1, _y1);
break;
+ case BUTTON_OVER:
+ series_show_frame(_sprite, _over, myBuff, _x1, _y1);
+ break;
+
case BUTTON_PICKED:
series_show_frame(_sprite, _picked, myBuff, _x1, _y1);
break;
- case BUTTON_OVER:
- series_show_frame(_sprite, _over, myBuff, _x1, _y1);
- break;
}
}
@@ -376,22 +370,16 @@ ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
- int16 overVal = inside(x, y);
+ int16 overTag = inside(x, y);
- if (overVal == _tag) {
+ if (overTag == _tag) {
// if Button is pressed
if (button_clicked) {
- if (eventType == _ME_L_click) {
- //aug28
- //if( !_G(inv_suppress_click_sound) && !between_rooms && !hidden ) {
- // digi_play( inv_click_snd, 2, 255, -1, inv_click_snd_room_lock ); //aug27: single click
- //term_message( "hidden %d", hidden ); //sep8
- //}
- }
-
_tracking = 1;
result = IN_CONTROL;
- } else { // if Button isn't pressed
+
+ } else {
+ // Button isn't pressed
if (_tracking == 1) {
result = SELECTED;
_toggle_state = (_toggle_state == SELECTED) ? NOTHING : SELECTED;
@@ -468,7 +456,6 @@ void InterfaceBox::highlight_button(int16 index) {
}
void InterfaceBox::set_selected(bool s) {
-
if (s == _selected)
return;
@@ -514,14 +501,7 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
if (!_GL(visible))
return;
- if (_must_redraw_all) {
- gr_color_set(__BLACK);
- //gr_buffer_rect_fill(myBuff, x1, y1+10, x2-x1, y2-y1);
- }
- myBuffer->release();
-
- int16 iter;
- for (iter = 0; iter < _index; iter++) {
+ for (int iter = 0; iter < _index; iter++) {
_button[iter]->_must_redraw |= _must_redraw_all;
_button[iter]->draw(myBuffer);
}
@@ -537,14 +517,14 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
//-------------------------------------------------------------------------------------------
-Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
+Inventory::Inventory(const RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
: RectClass(r) {
_sprite = sprite;
for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
- _cells[iter] = -1;
- _cursors[iter] = -1;
- _names[iter] = nullptr;
+ _items[iter]._cell = -1;
+ _items[iter]._cursor = -1;
+ _items[iter]._name = nullptr;
}
_num_cells = 0;
@@ -559,7 +539,6 @@ Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, i
error_show(FL, 'CGIC');
}
- _hidden = false;
_highlight = _dehighlight = -1;
_must_redraw_all = true;
_must_redraw1 = -1;
@@ -571,11 +550,11 @@ Inventory::Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, i
Inventory::~Inventory() {
}
-bool Inventory::add(char *name, char *verb, int32 invSprite, int32 cursor) {
+bool Inventory::add(const char *name, const char *verb, int32 invSprite, int32 cursor) {
// Don't add something twice
int iter;
for (iter = 0; iter < _num_cells; iter++) {
- if (!strcmp(name, _names[iter]))
+ if (!strcmp(name, _items[iter]._name))
return true;
}
@@ -583,14 +562,23 @@ bool Inventory::add(char *name, char *verb, int32 invSprite, int32 cursor) {
error_show(FL, 'CGIA');
return false;
}
- _names[_num_cells] = name;
- _verbs[_num_cells] = verb;
- _cells[_num_cells] = (int16)invSprite;
- _cursors[_num_cells] = (int16)cursor;
+ // Shift existing items up by one
+ for (int i = _num_cells; i > 0; --i)
+ _items[i] = _items[i - 1];
+
+ auto &item = _items[0];
+ item._name = name;
+ item._verb = verb;
+ item._cell = invSprite;
+ item._cursor = cursor;
++_num_cells;
+
_must_redraw_all = true;
+ if (_G(interface).visible)
+ _G(interface).show();
+
return true;
}
@@ -610,27 +598,23 @@ void Inventory::set_scroll(int32 new_scroll) {
_must_redraw_all = true;
}
-bool Inventory::remove(char *name) {
+bool Inventory::remove(const char *name) {
int iter;
for (iter = 0; iter < _num_cells; iter++) {
// Found the thing?
- if (!strcmp(name, _names[iter])) {
+ if (!strcmp(name, _items[iter]._name)) {
// Eat up its slot by moving everything down
- do {
-
- _names[iter] = _names[iter + 1];
- _verbs[iter] = _verbs[iter + 1]; // DT oct 18
- _cells[iter] = _cells[iter + 1];
- _cursors[iter] = _cursors[iter + 1];
-
- ++iter;
-
- } while (iter < _num_cells);
+ for (; iter < _num_cells; ++iter)
+ _items[iter] = _items[iter + 1];
--_num_cells;
_must_redraw_all = true;
_scroll = 0;
+
+ if (_G(interface).visible)
+ _G(interface).show();
+
return true;
}
}
@@ -639,12 +623,6 @@ bool Inventory::remove(char *name) {
return false;
}
-
-void Inventory::hide(bool hidden) {
- _hidden = hidden;
- _must_redraw_all = true;
-}
-
int16 Inventory::inside(int16 x, int16 y) {
if ((x < _x1) || (x >= (_x2 - 1)) || (y < _y1 + 2) ||
(y > _y1 + _cells_v * _cell_h - 2))
@@ -671,13 +649,12 @@ int16 Inventory::cell_pos_y(int16 index) {
}
}
-void Inventory::highlight_part(int16 _index) {
- if (_highlight == _index) {
+void Inventory::highlight_part(int16 index) {
+ if (_highlight == index)
return;
- }
_must_redraw1 = _highlight;
- _highlight = _index;
+ _highlight = index;
_must_redraw2 = _highlight;
}
@@ -693,23 +670,14 @@ void Inventory::draw(GrBuff *myBuffer) {
Buffer *myBuff = myBuffer->get_buffer();
- if (_hidden) {
- gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
- goto done;
- }
-
if (_must_redraw_all) {
- kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
}
- offy += 2;
- offx += 2;
_right_arrow_visible = false;
- for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_BUTTONS); cell_iter++) {
+ for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_INVENTORY); cell_iter++) {
int16 left = (int16)(_x1 + offx + cell_pos_x(cell_iter));
int16 top = (int16)(_y1 + offy + cell_pos_y(cell_iter));
@@ -718,12 +686,12 @@ void Inventory::draw(GrBuff *myBuffer) {
refresh_right_arrow();
refresh_left_arrow();
- // Draw_icon_here
+ // Draw icon here
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, left, top, _cell_w + 1, _cell_h + 1);
- series_show_frame(_sprite, _cells[cell_iter + _scroll], myBuff, left - 3, top - 3);
+ series_show_frame(_sprite, _items[cell_iter + _scroll]._cell, myBuff, left - 3, top - 3);
- // Draw_box around icon
+ // Draw box around icon
if (_highlight == cell_iter) {
gr_line(left, top, left + _cell_w - 2, top + 1, __LTGRAY, myBuff);
gr_line(left, top + _cell_h - 2, left + _cell_w - 2, top + _cell_h - 2, __LTGRAY, myBuff);
@@ -732,13 +700,19 @@ void Inventory::draw(GrBuff *myBuffer) {
}
}
}
-done:
- myBuffer->release();
+
+ // Draw inventory slot frames
+ for (cell_iter = 0; cell_iter < 9; ++cell_iter) {
+ series_show_frame(_sprite, 67, myBuff, cell_iter * 39 + 188, 22);
+ series_show_frame(_sprite, 68, myBuff, cell_iter * 39 + 188, 92);
+ }
ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw1 = _must_redraw2 = -1;
_must_redraw_all = false;
+
+ myBuffer->release();
}
ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
@@ -789,22 +763,7 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
highlight_part(over);
interface_tracking = -1;
}
-#if 0
- switch (result) {
- case OVER_CONTROL:
- term_message("inv:over %ld", over);
- break;
- case SELECTED:
- term_message("inv:selected %ld", over);
- break;
- case IN_CONTROL:
- term_message("inv:in %ld", over);
- break;
- case NOTHING:
- term_message("inv:nothing %ld", over);
- break;
- }
-#endif
+
if (result == NOTHING && button_clicked)
return TRACKING;
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 4d483e933b8..dd97d9ec29e 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -32,6 +32,7 @@ namespace Burger {
constexpr int16 INVENTORY_CELLS_COUNT = 128;
constexpr int16 ARROW_WIDTH = 8;
constexpr int16 MAX_BUTTONS = 20;
+constexpr int16 MAX_INVENTORY = 9;
constexpr int16 LEFT_ARROW_TAG = 128;
constexpr int16 RIGHT_ARROW_TAG = 129;
@@ -92,6 +93,7 @@ public:
class ButtonClass : public RectClass {
protected:
int16 _tag = 0;
+ int16 _unknown = 0;
int16 _relaxed = 0;
int16 _over = 0;
int16 _picked = 0;
@@ -117,10 +119,10 @@ public:
int16 inside(int16 x, int16 y) const override;
virtual ControlStatus track(int32 eventType, int16 x, int16 y);
- void set(ButtonClass *b);
+ void set(const ButtonClass *b);
void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag);
- void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 relaxed,
- int16 over, int16 picked, int32 sprite);
+ void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 unknown,
+ int16 relaxed, int16 over, int16 picked, int32 sprite);
void set_name(const char *btnName);
int16 get_tag() const;
@@ -167,6 +169,12 @@ public:
};
class Inventory : public RectClass {
+ struct Entry {
+ const char *_name = nullptr;
+ const char *_verb = nullptr;
+ int16 _cell = -1;
+ int16 _cursor = -1;
+ };
private:
int32 _sprite = 0;
int16 _tag = 0;
@@ -183,15 +191,11 @@ public:
int16 _must_redraw1 = 0, _must_redraw2 = 0;
int16 _highlight = 0, _dehighlight = 0;
bool _must_redraw_all = false;
- bool _hidden = false;
- int16 _cells[INVENTORY_CELLS_COUNT] = { 0 };
- int16 _cursors[INVENTORY_CELLS_COUNT] = { 0 };
- char *_names[INVENTORY_CELLS_COUNT] = { nullptr };
- char *_verbs[INVENTORY_CELLS_COUNT] = { nullptr };
+ Entry _items[INVENTORY_CELLS_COUNT];
public:
- Inventory(RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
+ Inventory(const RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
~Inventory();
void draw(GrBuff *interface_buffer);
@@ -199,15 +203,12 @@ public:
int16 inside(int16 x, int16 y);
ControlStatus track(int32 eventType, int16 x, int16 y);
- bool add(char *name, char *verb, int32 cel, int32 cursor);
- bool remove(char *name);
- void hide(bool);
+ bool add(const char *name, const char *verb, int32 cel, int32 cursor);
+ bool remove(const char *name);
void highlight_part(int16 index);
bool need_left() const;
bool need_right() const;
- void scroll_left();
- void scroll_right();
void set_scroll(int32 new_scroll);
};
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
index 014ceba4af9..783e4a5cb48 100644
--- a/engines/m4/gui/interface.h
+++ b/engines/m4/gui/interface.h
@@ -42,6 +42,10 @@ struct Interface_Globals {
int x2 = SCREEN_WIDTH;
int y2 = SCREEN_HEIGHT;
GrBuff *gameInterfaceBuff = nullptr;
+
+ void show() {
+ assert(0);
+ }
};
extern void interface_init(int arrow, int wait, int look, int grab, int use);
Commit: 77f50c5fe08894221d96da8d81fd6f67e37e347b
https://github.com/scummvm/scummvm/commit/77f50c5fe08894221d96da8d81fd6f67e37e347b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix button state enum for ButtonClass
Changed paths:
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 54a08f096b8..efb57030a63 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -322,6 +322,10 @@ void ButtonClass::draw(GrBuff *myBuffer) {
if (_hidden == false) {
switch (_state) {
+ case BUTTON_0:
+ series_show_frame(_sprite, _unknown, myBuff, _x1, _y1);
+ break;
+
case BUTTON_RELAXED:
series_show_frame(_sprite, _relaxed, myBuff, _x1, _y1);
break;
@@ -333,7 +337,6 @@ void ButtonClass::draw(GrBuff *myBuffer) {
case BUTTON_PICKED:
series_show_frame(_sprite, _picked, myBuff, _x1, _y1);
break;
-
}
}
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index dd97d9ec29e..883399bff57 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -51,7 +51,7 @@ enum ControlStatus {
};
enum ButtonState {
- BUTTON_RELAXED, BUTTON_OVER, BUTTON_PICKED
+ BUTTON_0, BUTTON_RELAXED, BUTTON_OVER, BUTTON_PICKED
};
class RectClass;
Commit: e5cde8dcc341a5875f75ad31559a36a54f2d47f9
https://github.com/scummvm/scummvm/commit/e5cde8dcc341a5875f75ad31559a36a54f2d47f9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change ButtonClass _name to Common::String
Changed paths:
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index efb57030a63..e43b02d5083 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -168,16 +168,16 @@ void ButtonClass::init() {
_tracking = -1;
}
-ButtonClass::ButtonClass(const RectClass *r, const char *btnName, int16 tag) : RectClass(r) {
+ButtonClass::ButtonClass(const RectClass *r, const Common::String &btnName, int16 tag) : RectClass(r) {
init();
- cstrncpy(_name, btnName, 19);
+ _name = btnName;
_tag = tag;
_hidden = false;
}
ButtonClass::ButtonClass() : RectClass() {
init();
- cstrcpy(_name, "?");
+ _name = "?";
_hidden = false;
}
@@ -185,8 +185,8 @@ ButtonClass::~ButtonClass() {
zap_resources();
}
-void ButtonClass::set_name(const char *btnName) {
- cstrncpy(_name, btnName, 19);
+void ButtonClass::set_name(const Common::String &btnName) {
+ _name = btnName;
}
bool ButtonClass::is_hidden() const {
@@ -220,7 +220,7 @@ void ButtonClass::zap_resources() {
void ButtonClass::set(const ButtonClass *b) {
zap_resources();
- cstrncpy(_name, b->_name, 19);
+ _name = b->_name;
_x1 = b->_x1;
_y1 = b->_y1;
_x2 = b->_x2;
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 883399bff57..2de894ad3b5 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -23,6 +23,7 @@
#ifndef M4_BURGER_GUI_CHEAPO_H
#define M4_BURGER_GUI_CHEAPO_H
+#include "common/str.h"
#include "m4/graphics/gr_buff.h"
#include "m4/m4_types.h"
@@ -107,12 +108,12 @@ protected:
public:
ButtonState _state = BUTTON_RELAXED;
- char _name[20] = { 0 }; // fixme? inventory objects get 40 char strings. use MAX_PLYR_STRING_LEN?
+ Common::String _name;
bool _must_redraw = false;
public:
ButtonClass();
- ButtonClass(const RectClass *r, const char *btnName, int16 tag);
+ ButtonClass(const RectClass *r, const Common::String &btnName, int16 tag);
~ButtonClass();
void draw(GrBuff *interface_buffer);
@@ -123,7 +124,7 @@ public:
void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag);
void set(int16 x1, int16 y1, int16 x2, int16 y2, int16 tag, int16 unknown,
int16 relaxed, int16 over, int16 picked, int32 sprite);
- void set_name(const char *btnName);
+ void set_name(const Common::String &btnName);
int16 get_tag() const;
Commit: 22c32f9c49fe9c4e702efe4a2a410566a6c13a45
https://github.com/scummvm/scummvm/commit/22c32f9c49fe9c4e702efe4a2a410566a6c13a45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Set of Burger Interface setup
Changed paths:
A engines/m4/burger/interface.cpp
A engines/m4/burger/interface.h
R engines/m4/gui/interface.cpp
R engines/m4/gui/interface.h
engines/m4/adv_r/adv_trigger.cpp
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_series.cpp
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 95e1e12352c..86db361346d 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -20,8 +20,30 @@
*/
#include "m4/adv_r/adv_trigger.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
namespace M4 {
+int32 kernel_trigger_create(int32 trigger_num) {
+ int32 new_trigger;
+
+ if (trigger_num < 0)
+ return (trigger_num);
+
+ if (trigger_num > 0xffff) { // if room changed, this is an invalid trigger
+ error_show(FL, 'BADT', "bad trigger. %ld > 0xffff", trigger_num);
+ }
+
+ new_trigger = trigger_num + (_G(game).room_id << 16) + (_G(kernel).trigger_mode << 28);
+
+ return new_trigger;
+}
+
+bool kernel_trigger_dispatch(int32 trigger) {
+ error("TODO: kernel_trigger_dispatch");
+ return true;
+}
+
} // End of namespace M4
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index a120fc3c571..ecfa5a5c398 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -33,6 +33,8 @@
namespace M4 {
namespace Burger {
+BurgerGlobals *g_globals;
+
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
/**
@@ -68,6 +70,13 @@ static const ConverterEntry ASCII_CONVERTERS[] = {
{ nullptr, 0 }
};
+BurgerGlobals::BurgerGlobals() {
+ g_globals = this;
+}
+
+BurgerGlobals::~BurgerGlobals() {
+ g_globals = nullptr;
+}
void BurgerGlobals::main_cold_data_init() {
// TODO
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index fec320d6073..f8182ef561f 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -23,6 +23,7 @@
#define M4_BURGER_BURGER_GLOBALS_H
#include "m4/globals.h"
+#include "m4/burger/interface.h"
namespace M4 {
namespace Burger {
@@ -33,8 +34,6 @@ enum GameMode {
class BurgerGlobals : public Globals {
private:
- GameMode _gameMode = WHOLE_GAME;
-
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
void custom_ascii_converter_proc(char *string);
static void escape_key_pressed(void *, void *);
@@ -46,10 +45,19 @@ protected:
void global_menu_system_init() override;
public:
- BurgerGlobals() {}
- virtual ~BurgerGlobals() {}
+ GameMode _gameMode = WHOLE_GAME;
+ Interface _interface;
+
+public:
+ BurgerGlobals();
+ virtual ~BurgerGlobals();
};
+extern BurgerGlobals *g_globals;
+
+#undef _G
+#define _G(X) (::M4::Burger::g_globals->_##X)
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index e43b02d5083..8d7798094e6 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -31,12 +31,12 @@
#include "m4/core/errors.h"
#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
-#define _GL(X) _G(interface).X
+#define _GI(X) _G(interface)._##X
static void refresh_right_arrow() {
error("TODO: refresh_right_arrow");
@@ -67,7 +67,7 @@ RectClass::RectClass(int16 x1, int16 y1, int16 x2, int16 y2) :
RectClass::~RectClass() {
}
-void RectClass::copyInto(RectClass *r) {
+void RectClass::copyInto(RectClass *r) const {
if (!r) {
error_show(FL, 'CGNR');
} else {
@@ -142,7 +142,7 @@ void TextField::set_string(const char *string) {
}
void TextField::draw(GrBuff *myBuffer) {
- if (!_GL(visible))
+ if (!_GI(visible))
return;
Buffer *myBuff = myBuffer->get_buffer();
@@ -153,7 +153,7 @@ void TextField::draw(GrBuff *myBuffer) {
gr_font_write(myBuff, _string, _x1, _y1, 0, 1);
myBuffer->release();
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw = false;
}
@@ -205,6 +205,10 @@ void ButtonClass::set_sprite_over(int16 o) {
_over = o;
}
+void ButtonClass::set_sprite_unknown(int16 val) {
+ _unknown = val;
+}
+
int16 ButtonClass::get_tag() const {
return _tag;
}
@@ -262,7 +266,7 @@ int16 ButtonClass::inside(int16 x, int16 y) const {
}
ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
- if (!_GL(visible))
+ if (!_GI(visible))
return NOTHING;
ButtonState old_state = _state;
@@ -309,7 +313,7 @@ ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
}
void ButtonClass::draw(GrBuff *myBuffer) {
- if (!_GL(visible))
+ if (!_GI(visible))
return;
if (!_must_redraw)
@@ -343,7 +347,7 @@ void ButtonClass::draw(GrBuff *myBuffer) {
myBuffer->release();
_must_redraw = false;
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1 - 2, _x2, _y2, iC);
}
@@ -365,7 +369,7 @@ Toggler::Toggler() : ButtonClass() {
}
ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
- if (!_GL(visible))
+ if (!_GI(visible))
return NOTHING;
ButtonState old_state = _state;
@@ -410,9 +414,8 @@ ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
//-------------------------------------------------------------------------------------------
-InterfaceBox::InterfaceBox(RectClass *r) {
- if (!r) error_show(FL, 'CGNR');
- r->copyInto(this);
+InterfaceBox::InterfaceBox(const RectClass &r) {
+ r.copyInto(this);
_highlight_index = -1;
_must_redraw_all = true;
_selected = false;
@@ -501,7 +504,7 @@ ControlStatus InterfaceBox::track(int32 eventType, int16 x, int16 y) {
}
void InterfaceBox::draw(GrBuff *myBuffer) {
- if (!_GL(visible))
+ if (!_GI(visible))
return;
for (int iter = 0; iter < _index; iter++) {
@@ -510,7 +513,7 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
}
if (_must_redraw_all) {
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
}
@@ -579,7 +582,7 @@ bool Inventory::add(const char *name, const char *verb, int32 invSprite, int32 c
_must_redraw_all = true;
- if (_G(interface).visible)
+ if (_GI(visible))
_G(interface).show();
return true;
@@ -615,7 +618,7 @@ bool Inventory::remove(const char *name) {
_must_redraw_all = true;
_scroll = 0;
- if (_G(interface).visible)
+ if (_GI(visible))
_G(interface).show();
return true;
@@ -662,7 +665,7 @@ void Inventory::highlight_part(int16 index) {
}
void Inventory::draw(GrBuff *myBuffer) {
- if (!_GL(visible))
+ if (!_GI(visible))
return;
if (!_must_redraw1 && !_must_redraw2 && !_must_redraw_all)
@@ -710,7 +713,7 @@ void Inventory::draw(GrBuff *myBuffer) {
series_show_frame(_sprite, 68, myBuff, cell_iter * 39 + 188, 92);
}
- ScreenContext *iC = vmng_screen_find(_G(interface).gameInterfaceBuff, nullptr);
+ ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw1 = _must_redraw2 = -1;
_must_redraw_all = false;
@@ -719,7 +722,7 @@ void Inventory::draw(GrBuff *myBuffer) {
}
ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
- if (!_GL(visible))
+ if (!_GI(visible))
return NOTHING;
static int16 interface_tracking = -1;
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 2de894ad3b5..9bb6716f60a 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -70,7 +70,7 @@ public:
virtual ~RectClass();
virtual int16 inside(int16 x, int16 y) const;
- void copyInto(RectClass *);
+ void copyInto(RectClass *r) const;
void set(int16 x1, int16 y1, int16 x2, int16 y2);
void set(const RectClass *r);
@@ -134,6 +134,7 @@ public:
void set_sprite_relaxed(int16 r);
void set_sprite_picked(int16 p);
void set_sprite_over(int16 o);
+ void set_sprite_unknown(int16 val);
};
class Toggler : public ButtonClass {
@@ -155,7 +156,7 @@ public:
bool _must_redraw_all = false;
public:
- InterfaceBox(RectClass *r);
+ InterfaceBox(const RectClass &r);
~InterfaceBox();
void draw(GrBuff *interface_buffer);
diff --git a/engines/m4/gui/interface.cpp b/engines/m4/burger/interface.cpp
similarity index 66%
rename from engines/m4/gui/interface.cpp
rename to engines/m4/burger/interface.cpp
index 41b0e1e63ee..65d50d25c60 100644
--- a/engines/m4/gui/interface.cpp
+++ b/engines/m4/burger/interface.cpp
@@ -19,36 +19,38 @@
*
*/
-#include "m4/gui/interface.h"
+#include "m4/burger/interface.h"
#include "m4/globals.h"
namespace M4 {
+namespace Burger {
-#define _GI(X) _G(interface).X
-
-static void sub1();
-
-void interface_init(int arrow, int wait, int look, int grab, int use) {
- _GI(arrow) = arrow;
- _GI(wait) = wait;
- _GI(look) = look;
- _GI(grab) = grab;
- _GI(use) = use;
+void Interface::init(int arrow, int wait, int look, int grab, int use) {
+ _arrow = arrow;
+ _wait = wait;
+ _look = look;
+ _grab = grab;
+ _use = use;
mouse_set_sprite(wait);
- _GI(gameInterfaceBuff) = new GrBuff(_GI(x2) - _GI(x1), _GI(y2) - _GI(y1));
- sub1();
+ _gameInterfaceBuff = new GrBuff(_x2 - _x1, _y2 - _y1);
+ setup();
mouse_set_sprite(arrow);
}
-void interface_shutdown() {
+Interface::~Interface() {
// TODO
}
-static void sub1() {
+void Interface::show() {
+ error("TODO: Interface::show");
+}
+void Interface::setup() {
+ _interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
}
-} // End of namespace M4
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/gui/interface.h b/engines/m4/burger/interface.h
similarity index 66%
rename from engines/m4/gui/interface.h
rename to engines/m4/burger/interface.h
index 783e4a5cb48..d60d058b0b8 100644
--- a/engines/m4/gui/interface.h
+++ b/engines/m4/burger/interface.h
@@ -26,31 +26,36 @@
#include "m4/m4_types.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
+#include "m4/burger/gui_cheapo.h"
namespace M4 {
-
-struct Interface_Globals {
- int arrow = 0;
- int wait = 0;
- int look = 0;
- int grab = 0;
- int use = 0;
- bool visible = false;
- bool shown = false;
- int x1 = 0;
- int y1 = 374;
- int x2 = SCREEN_WIDTH;
- int y2 = SCREEN_HEIGHT;
- GrBuff *gameInterfaceBuff = nullptr;
-
- void show() {
- assert(0);
- }
+namespace Burger {
+
+struct Interface {
+private:
+ void setup();
+public:
+ int _arrow = 0;
+ int _wait = 0;
+ int _look = 0;
+ int _grab = 0;
+ int _use = 0;
+ bool _visible = false;
+ bool _shown = false;
+ int _x1 = 0;
+ int _y1 = 374;
+ int _x2 = SCREEN_WIDTH;
+ int _y2 = SCREEN_HEIGHT;
+ GrBuff *_gameInterfaceBuff = nullptr;
+ InterfaceBox *_interfaceBox = nullptr;
+
+ ~Interface();
+ void init(int arrow, int wait, int look, int grab, int use);
+
+ void show();
};
-extern void interface_init(int arrow, int wait, int look, int grab, int use);
-extern void interface_shutdown();
-
-} // End of namespace M4
+} // namespace Burger
+} // namespace M4
#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 8b56c87b0d0..164cc70d340 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -44,7 +44,6 @@ Globals::Globals() {
Globals::~Globals() {
game_systems_shutdown();
- interface_shutdown();
sysfile_shutdown();
player_been_shutdown();
@@ -83,7 +82,6 @@ bool Globals::init() {
main_cold_data_init();
create_mouse_watch_dialog();
global_menu_system_init();
- interface_init(0, 5, 6, 8, 9);
return true;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 78a16c3f0c3..06ba195687d 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -38,7 +38,6 @@
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
-#include "m4/gui/interface.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
@@ -85,7 +84,6 @@ public:
MouseInfo _MouseState;
Dialog_Globals _dialog;
Item_Globals _items;
- Interface_Globals _interface;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 54b938f481c..91d9988c332 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -43,4 +43,8 @@ bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x
return false;
}
+bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y) {
+ return series_draw_sprite(spriteHash, index, destBuff, x, y);
+}
+
} // namespace M4
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index 831ef87c294..b274b359d60 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -159,6 +159,33 @@ void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 update
}
}
+void RestoreScreensInContext(int32 x1, int32 y1, int32 x2, int32 y2, ScreenContext *myScreen) {
+ ScreenContext *tempScreen;
+
+ //verify the gui has been initted
+ if (!_G(vmng_Initted)) {
+ return;
+ }
+
+ //verify parameters
+ tempScreen = _G(frontScreen);
+ while (tempScreen && (tempScreen != myScreen)) {
+ tempScreen = tempScreen->behind;
+ }
+ if (!tempScreen) {
+ return;
+ }
+
+ //now restore screens
+ x1 += myScreen->x1;
+ y1 += myScreen->y1;
+ x2 += myScreen->x1;
+ y2 += myScreen->y1;
+
+ //restore video
+ RestoreScreens(x1, y1, x2, y2);
+}
+
bool ResizeScreen(void *scrnContent, int32 newW, int32 newH) {
ScreenContext *myScreen;
int32 status, oldX2, oldY2;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index d1aa77e5f6f..ce9ed9b829a 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -45,7 +45,6 @@ MODULE_OBJS = \
gui/gui_vmng_core.o \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
- gui/interface.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
@@ -58,7 +57,8 @@ MODULE_OBJS = \
wscript/wscript.o \
burger/burger.o \
burger/burger_globals.o \
- burger/gui_cheapo.o
+ burger/gui_cheapo.o \
+ burger/interface.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: be681a7e95dea975c342eaa3f68fe4f06e9b1124
https://github.com/scummvm/scummvm/commit/be681a7e95dea975c342eaa3f68fe4f06e9b1124
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Initialize Burger interface elements
Changed paths:
engines/m4/burger/burger_globals.cpp
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
engines/m4/burger/interface.cpp
engines/m4/burger/interface.h
engines/m4/globals.h
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index ecfa5a5c398..2ea9e3d201b 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -106,15 +106,11 @@ void BurgerGlobals::main_cold_data_init() {
}
void BurgerGlobals::global_menu_system_init() {
- _main_interface_sprite = series_load("999intr", 22, nullptr);
- if (_main_interface_sprite != 22)
- error_show(FL, 'SLF!');
-
AddSystemHotkey(Common::KEYCODE_ESCAPE, escape_key_pressed);
AddSystemHotkey(Common::KEYCODE_F2, cb_F2);
AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
- // TODO
+ _interface.init(0, 5, 6, 8, 9);
}
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 8d7798094e6..27ab40547e8 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -168,17 +168,20 @@ void ButtonClass::init() {
_tracking = -1;
}
-ButtonClass::ButtonClass(const RectClass *r, const Common::String &btnName, int16 tag) : RectClass(r) {
+ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag) : RectClass(r) {
init();
_name = btnName;
_tag = tag;
- _hidden = false;
+}
+
+ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
+ int16 unknown, int16 relaxed, int16 over, int16 picked) : RectClass(r),
+ _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked) {
}
ButtonClass::ButtonClass() : RectClass() {
init();
_name = "?";
- _hidden = false;
}
ButtonClass::~ButtonClass() {
@@ -523,7 +526,7 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
//-------------------------------------------------------------------------------------------
-Inventory::Inventory(const RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
+Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
: RectClass(r) {
_sprite = sprite;
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index 9bb6716f60a..e81b046d055 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -113,7 +113,9 @@ public:
public:
ButtonClass();
- ButtonClass(const RectClass *r, const Common::String &btnName, int16 tag);
+ ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag);
+ ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
+ int16 unknown, int16 relaxed, int16 over, int16 picked);
~ButtonClass();
void draw(GrBuff *interface_buffer);
@@ -197,7 +199,7 @@ public:
Entry _items[INVENTORY_CELLS_COUNT];
public:
- Inventory(const RectClass *r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
+ Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
~Inventory();
void draw(GrBuff *interface_buffer);
diff --git a/engines/m4/burger/interface.cpp b/engines/m4/burger/interface.cpp
index 65d50d25c60..9fe96340066 100644
--- a/engines/m4/burger/interface.cpp
+++ b/engines/m4/burger/interface.cpp
@@ -20,7 +20,9 @@
*/
#include "m4/burger/interface.h"
-#include "m4/globals.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
@@ -32,6 +34,11 @@ void Interface::init(int arrow, int wait, int look, int grab, int use) {
_grab = grab;
_use = use;
+ _sprite = series_load("999intr", 22, nullptr);
+ if (_sprite != 22)
+ error_show(FL, 'SLF!');
+
+
mouse_set_sprite(wait);
_gameInterfaceBuff = new GrBuff(_x2 - _x1, _y2 - _y1);
@@ -41,7 +48,17 @@ void Interface::init(int arrow, int wait, int look, int grab, int use) {
}
Interface::~Interface() {
- // TODO
+ delete _gameInterfaceBuff;
+ delete _interfaceBox;
+ delete _inventory;
+ delete _textField;
+ delete _btnTake;
+ delete _btnManipulate;
+ delete _btnHandle;
+ delete _btnAbductFail;
+ delete _btnMenu;
+ delete _btnScrollLeft;
+ delete _btnScrollRight;
}
void Interface::show() {
@@ -50,6 +67,32 @@ void Interface::show() {
void Interface::setup() {
_interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
+ _inventory = new Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
+ _textField = new TextField(200, 1, 450, 21);
+ _btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5);
+ _btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8);
+ _btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2);
+
+ _interfaceBox->add(_btnTake);
+ _interfaceBox->add(_btnManipulate);
+ _interfaceBox->add(_btnHandle);
+
+
+ if (_G(gameMode) == WHOLE_GAME) {
+ _btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71);
+ _btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78);
+ _interfaceBox->add(_btnAbductFail);
+ _interfaceBox->add(_btnMenu);
+
+ } else {
+ _btnAbductFail = new ButtonClass(RectClass(580, 22, 620, 75), "abductfail", 10, 69, 69, 70, 71);
+ _interfaceBox->add(_btnAbductFail);
+ }
+
+ _btnScrollLeft = new ButtonClass(RectClass(168, 22, 188, 97), "scroll left", 8, 59, 60, 61, 62);
+ _btnScrollRight = new ButtonClass(RectClass(539, 22, 559, 97), "scroll right", 9, 63, 64, 65, 66);
+ _interfaceBox->add(_btnScrollLeft);
+ _interfaceBox->add(_btnScrollRight);
}
} // namespace Burger
diff --git a/engines/m4/burger/interface.h b/engines/m4/burger/interface.h
index d60d058b0b8..4d55f8bf7a1 100644
--- a/engines/m4/burger/interface.h
+++ b/engines/m4/burger/interface.h
@@ -35,6 +35,7 @@ struct Interface {
private:
void setup();
public:
+ int _sprite = 22; // main_interface_sprite;
int _arrow = 0;
int _wait = 0;
int _look = 0;
@@ -48,6 +49,15 @@ public:
int _y2 = SCREEN_HEIGHT;
GrBuff *_gameInterfaceBuff = nullptr;
InterfaceBox *_interfaceBox = nullptr;
+ Inventory *_inventory = nullptr;
+ TextField *_textField = nullptr;
+ ButtonClass *_btnTake = nullptr;
+ ButtonClass *_btnManipulate = nullptr;
+ ButtonClass *_btnHandle = nullptr;
+ ButtonClass *_btnAbductFail = nullptr;
+ ButtonClass *_btnMenu = nullptr;
+ ButtonClass *_btnScrollLeft = nullptr;
+ ButtonClass *_btnScrollRight = nullptr;
~Interface();
void init(int arrow, int wait, int look, int grab, int use);
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 06ba195687d..b94f3ccc712 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -124,7 +124,6 @@ public:
InvPal *_inverse_pal = nullptr;
InventoryRec _inventory;
int32 _inv_obj_mem_type = 0;
- int _main_interface_sprite = 22;
bool _currScreen = false;
ScreenContext *_eventToScreen = nullptr;
byte _color = 0;
Commit: 10ceea29e120249afbc23bd97525a9803346544a
https://github.com/scummvm/scummvm/commit/10ceea29e120249afbc23bd97525a9803346544a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Burger inventory list
Changed paths:
A engines/m4/burger/inventory.cpp
A engines/m4/burger/inventory.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/burger/interface.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index dbb29756786..b75a131ebcb 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -60,18 +60,23 @@ void inv_shutdown(void) {
mem_free((char *)_G(inventory).objects);
}
-bool inv_register_thing(char *name, char *verbs, int32 scene, int32 cel, int32 cursor) {
- cstrupr(name);
- cstrupr(verbs);
+bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32 cel, int32 cursor) {
+ assert(name && verbs);
+
+ char *s_name = mem_strdup(name);
+ char *s_verbs = mem_strdup(verbs);
+
+ cstrupr(s_name);
+ cstrupr(s_verbs);
_G(inventory).objects[_G(inventory).tail]->name = nullptr;
_G(inventory).objects[_G(inventory).tail]->verbs = nullptr;
- if (name)
- _G(inventory).objects[_G(inventory).tail]->name = mem_strdup(name);
+ if (s_name)
+ _G(inventory).objects[_G(inventory).tail]->name = s_name;
- if (verbs)
- _G(inventory).objects[_G(inventory).tail]->verbs = mem_strdup(verbs);
+ if (s_verbs)
+ _G(inventory).objects[_G(inventory).tail]->verbs = s_verbs;
_G(inventory).objects[_G(inventory).tail]->scene = scene;
_G(inventory).objects[_G(inventory).tail]->cel = cel;
@@ -80,7 +85,7 @@ bool inv_register_thing(char *name, char *verbs, int32 scene, int32 cel, int32 c
_G(inventory).tail++;
if (scene == BACKPACK) {
- inventory_add(name, verbs, cel, cursor);
+ inventory_add(s_name, s_verbs, cel, cursor);
}
return true;
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index 28569c447f9..48434618548 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -58,7 +58,7 @@ extern void inv_shutdown();
* @param cel Index into the inventory sprite series for use when displaying inventory
* @param cursor Cel index into the cursor sprite series when the player is "holding" a thing
*/
-extern bool inv_register_thing(char *name, char *verbs, int32 scene, int32 cel, int32 cursor);
+extern bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32 cel, int32 cursor);
extern int32 inv_where_is(const char *name);
extern bool inv_player_has(const char *name);
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 2ea9e3d201b..6eb49a89429 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -111,6 +111,7 @@ void BurgerGlobals::global_menu_system_init() {
AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
_interface.init(0, 5, 6, 8, 9);
+ _inventory.init();
}
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index f8182ef561f..89d6ea13bb3 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -24,6 +24,7 @@
#include "m4/globals.h"
#include "m4/burger/interface.h"
+#include "m4/burger/inventory.h"
namespace M4 {
namespace Burger {
@@ -47,6 +48,7 @@ protected:
public:
GameMode _gameMode = WHOLE_GAME;
Interface _interface;
+ BurgerInventory _inventory;
public:
BurgerGlobals();
diff --git a/engines/m4/burger/interface.h b/engines/m4/burger/interface.h
index 4d55f8bf7a1..b9f46583306 100644
--- a/engines/m4/burger/interface.h
+++ b/engines/m4/burger/interface.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef M4_GUI_INTERFACE_H
-#define M4_GUI_INTERFACE_H
+#ifndef M4_BURGER_INTERFACE_H
+#define M4_BURGER_INTERFACE_H
#include "m4/m4_types.h"
#include "m4/graphics/graphics.h"
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
new file mode 100644
index 00000000000..3b93e448598
--- /dev/null
+++ b/engines/m4/burger/inventory.cpp
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_inv.h"
+#include "m4/burger/inventory.h"
+
+namespace M4 {
+namespace Burger {
+
+struct InvObject {
+ const char *_name;
+ const char *_verbs;
+ int32 _scene, _cel, _cursor;
+};
+
+static const InvObject INVENTORY_ITEMS[] = {
+ { "money", "GELD", 998, 55, 55 },
+ { "block of ice", "EISBLOCK", 142, 51, 51 },
+ { "pantyhose", "STRUMPFHOSE", 142, 45, 45 },
+ { "phone bill", "TELEFONRECHNUNG", 170, 49, 49 },
+ { "whistle", "PFEIFE", 170, 40, 40 },
+ { "carrot juice", "M\xd6""HRENSAFT", 172, 25, 25 },
+ { "deed", "URKUNDE", 105, 38, 38 },
+ { "laxative", "ABF\xdcHRMITTEL", 174, 54, 54 },
+ { "amplifier", "VERST\xc4""RKER", 145, 34, 34 },
+ { "jawz o' life", "KLEMMBACKE", 137, 37, 37 },
+ { "broken puz dispenser", "Bonbonspender,kaputt", 176, 16, 16 },
+ { "spring", "SPRUNGFEDER", 999, 47, 47 },
+ { "puz dispenser", "BONBONSPENDER", 999, 17, 17 },
+ { "broken mouse trap", "KAPUTTE MAUSEFALLE", 143, 18, 18 },
+ { "keys", "SCHL\xdc""SSEL", 138, 31, 31 },
+ { "ray gun", "STRAHLENPISTOLE", 604, 50, 50 },
+ { "kibble", "TROCKENFUTTER", 602, 44, 44 },
+ { "burger morsel", "HAMBURGERST\xdc""CK", 999, 39, 39 },
+ { "matches", "STREICHH\xd6""LZER", 999, 42, 42 },
+ { "jug", "KRUG", 303, 14, 14 },
+ { "distilled carrot juice", "DESTILLIERTER SAFT", 999, 15, 15 },
+ { "gizmo", "GER\xc4""T", 999, 58, 58 },
+ { "kindling", "ANZ\xdc""NDHOLZ", 999, 20, 20 },
+ { "burning kindling", "BRENNENDES HOLZ", 999, 21, 21 },
+ { "christmas lights", "LICHTERKETTE", 508, 22, 22 },
+ { "christmas lights ", "LICHTERKETTE", 508, 23, 23 },
+ { "bottle", "FLASCHE", 999, 24, 24 },
+ { "soapy water", "SEIFENWASSER", 999, 26, 26 },
+ { "rubber gloves", "GUMMIHANDSCHUHE", 503, 35, 35 },
+ { "dirty sock", "DRECKIGE SOCKE", 504, 36, 36 },
+ { "rubber ducky", "GUMMIENTCHEN", 507, 53, 53 },
+ { "rolling pin", "NUDELHOLZ", 999, 52, 52 },
+ { "fish", "FISCH", 999, 29, 29 },
+ { "hook", "HAKEN", 999, 30, 30 },
+ { "quarter", "VIERTELDOLLAR", 999, 41, 41 },
+ { "dog collar", "HUNDEHALSBAND", 999, 33, 33 },
+ { "records", "SCHALLPLATTEN", 405, 32, 32 },
+ { "mirror", "SPIEGEL", 999, 48, 48 },
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void BurgerInventory::init() {
+ for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item) {
+ inv_register_thing(item->_name, item->_verbs, item->_scene, item->_cel, item->_cursor);
+
+ _items.push_back(InventoryItem(item->_name, item->_scene));
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/inventory.h b/engines/m4/burger/inventory.h
new file mode 100644
index 00000000000..15349b2bf45
--- /dev/null
+++ b/engines/m4/burger/inventory.h
@@ -0,0 +1,51 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_INVENTORY_H
+#define M4_BURGER_INVENTORY_H
+
+#include "common/array.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+struct InventoryItem {
+ const char *_asset = nullptr;
+ const char *_name = nullptr;
+ int _scene = 0;
+
+ InventoryItem() {}
+ InventoryItem(const char *name, int scene) : _asset(name), _name(name), _scene(scene) {}
+};
+
+struct BurgerInventory {
+public:
+ Common::Array<InventoryItem> _items;
+public:
+ void init();
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ce9ed9b829a..09bd04108df 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -58,7 +58,8 @@ MODULE_OBJS = \
burger/burger.o \
burger/burger_globals.o \
burger/gui_cheapo.o \
- burger/interface.o
+ burger/interface.o \
+ burger/inventory.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 3e14acef9db82a2a93f8c77843ce34e411e8f351
https://github.com/scummvm/scummvm/commit/3e14acef9db82a2a93f8c77843ce34e411e8f351
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Make Burger inventory a derived class from an InventoryBase base
Changed paths:
engines/m4/adv_r/adv.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
engines/m4/burger/interface.cpp
engines/m4/burger/interface.h
engines/m4/burger/inventory.cpp
engines/m4/burger/inventory.h
engines/m4/globals.h
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index ade987642bb..603f411cb71 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -183,17 +183,6 @@ struct GameControl {
int16 previous_room;
};
-
-inline void inventory_add(char *name, char *verb, int32 sprite, int32 cursor) {
- error("TODO: inventory_add");
-}
-inline void inventory_set_scroll(int32 scroll) {
- error("TODO: inventory_set_scroll");
-}
-inline void inventory_remove(char *name) {
- error("TODO: inventory_remove");
-}
-
} // namespace M4
#endif
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index b75a131ebcb..8ebaef357af 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -32,32 +32,27 @@ bool inv_init(int32 num_objects) {
term_message("Fluffing up the backpack", nullptr);
int i;
- _G(inventory).num_objects = num_objects;
- _G(inventory).objects = (InvObj **)mem_alloc(sizeof(InvObj *) * num_objects, "inventory store");
- if (!_G(inventory).objects)
- error_show(FL, 'OOM!', "%ld bytes", (int32)sizeof(InvObj *) * num_objects);
+ _G(inventory)->_objects.resize(num_objects);
if (!mem_register_stash_type(&_G(inv_obj_mem_type), sizeof(InvObj), num_objects, "obj"))
error_show(FL, 'OOM!', "fail to mem_register_stash_type for inv_obj");
for (i = 0; i < num_objects; i++) {
- _G(inventory).objects[i] = (InvObj *)mem_get_from_stash(_G(inv_obj_mem_type), "obj");
- if (!_G(inventory).objects[i])
+ _G(inventory)->_objects[i] = (InvObj *)mem_get_from_stash(_G(inv_obj_mem_type), "obj");
+ if (!_G(inventory)->_objects[i])
error_show(FL, 'OOM!', "%ld bytes", (int32)sizeof(InvObj));
}
- _G(inventory).tail = 0;
+ _G(inventory)->_tail = 0;
return true;
}
void inv_shutdown(void) {
int i;
- for (i = 0; i < _G(inventory).tail; i++) {
- mem_free_to_stash((void *)_G(inventory).objects[i], _G(inv_obj_mem_type));
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ mem_free_to_stash((void *)_G(inventory)->_objects[i], _G(inv_obj_mem_type));
}
-
- mem_free((char *)_G(inventory).objects);
}
bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32 cel, int32 cursor) {
@@ -66,26 +61,27 @@ bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32
char *s_name = mem_strdup(name);
char *s_verbs = mem_strdup(verbs);
- cstrupr(s_name);
- cstrupr(s_verbs);
-
- _G(inventory).objects[_G(inventory).tail]->name = nullptr;
- _G(inventory).objects[_G(inventory).tail]->verbs = nullptr;
+ _G(inventory)->_objects[_G(inventory)->_tail]->name = nullptr;
+ _G(inventory)->_objects[_G(inventory)->_tail]->verbs = nullptr;
- if (s_name)
- _G(inventory).objects[_G(inventory).tail]->name = s_name;
+ if (s_name) {
+ cstrupr(s_name);
+ _G(inventory)->_objects[_G(inventory)->_tail]->name = s_name;
+ }
- if (s_verbs)
- _G(inventory).objects[_G(inventory).tail]->verbs = s_verbs;
+ if (s_verbs) {
+ cstrupr(s_verbs);
+ _G(inventory)->_objects[_G(inventory)->_tail]->verbs = s_verbs;
+ }
- _G(inventory).objects[_G(inventory).tail]->scene = scene;
- _G(inventory).objects[_G(inventory).tail]->cel = cel;
- _G(inventory).objects[_G(inventory).tail]->cursor = cursor;
+ _G(inventory)->_objects[_G(inventory)->_tail]->scene = scene;
+ _G(inventory)->_objects[_G(inventory)->_tail]->cel = cel;
+ _G(inventory)->_objects[_G(inventory)->_tail]->cursor = cursor;
- _G(inventory).tail++;
+ _G(inventory)->_tail++;
if (scene == BACKPACK) {
- inventory_add(s_name, s_verbs, cel, cursor);
+ _G(inventory)->add(s_name, s_verbs, cel, cursor);
}
return true;
@@ -97,10 +93,10 @@ int32 inv_where_is(char *name) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
- return _G(inventory).objects[i]->scene;
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ return _G(inventory)->_objects[i]->scene;
}
}
}
@@ -116,19 +112,19 @@ bool inv_put_thing_in(char *name, int32 scene) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
// Remove object from backpack?
- if (_G(inventory).objects[i]->scene == BACKPACK && scene != BACKPACK) {
- inventory_remove(name);
+ if (_G(inventory)->_objects[i]->scene == BACKPACK && scene != BACKPACK) {
+ _G(inventory)->remove(name);
}
- _G(inventory).objects[i]->scene = scene;
+ _G(inventory)->_objects[i]->scene = scene;
// Put object in backpack?
if (scene == BACKPACK) {
- inventory_add(name, _G(inventory).objects[i]->verbs, _G(inventory).objects[i]->cel, _G(inventory).objects[i]->cursor);
+ _G(inventory)->add(name, _G(inventory)->_objects[i]->verbs, _G(inventory)->_objects[i]->cel, _G(inventory)->_objects[i]->cursor);
}
return true;
}
@@ -141,10 +137,10 @@ bool inv_put_thing_in(char *name, int32 scene) {
int32 inv_get_cursor(char *name) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
- return _G(inventory).objects[i]->cursor;
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ return _G(inventory)->_objects[i]->cursor;
}
}
}
@@ -154,10 +150,10 @@ int32 inv_get_cursor(char *name) {
int32 inv_get_cel(char *name) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
- return _G(inventory).objects[i]->cel;
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ return _G(inventory)->_objects[i]->cel;
}
}
}
@@ -167,10 +163,10 @@ int32 inv_get_cel(char *name) {
char *inv_get_verbs(char *name) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
- return _G(inventory).objects[i]->verbs;
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ return _G(inventory)->_objects[i]->verbs;
}
}
}
@@ -184,10 +180,10 @@ char *inv_get_verbs(char *name) {
static char *inv_get_name(char *name) {
int i;
cstrupr(name);
- for (i = 0; i < _G(inventory).tail; i++) {
- if (_G(inventory).objects[i]->name) {
- if (!strcmp(_G(inventory).objects[i]->name, name)) {
- return _G(inventory).objects[i]->name;
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (_G(inventory)->_objects[i]->name) {
+ if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ return _G(inventory)->_objects[i]->name;
}
}
}
@@ -256,20 +252,20 @@ void inv_save_game(Common::WriteStream *fp_save) {
if (!fp_save)
error_show(FL, 'ISGF');
- inv_size = _G(inventory).tail * (40 * sizeof(char) + sizeof(long));
+ inv_size = _G(inventory)->_tail * (40 * sizeof(char) + sizeof(long));
fp_save->writeUint32LE(inv_size);
inv_save_buff = (char *)mem_alloc(inv_size, "inv save buff");
cstrcpy(inv_save_buff, "\0");
- for (i = 0; i < _G(inventory).tail; i++) {
- if (cstrlen(_G(inventory).objects[i]->name) > 39)
- error_show(FL, 'ISGF', "inventory name '%s' > 39 chars:", _G(inventory).objects[i]->name);
+ for (i = 0; i < _G(inventory)->_tail; i++) {
+ if (cstrlen(_G(inventory)->_objects[i]->name) > 39)
+ error_show(FL, 'ISGF', "inventory name '%s' > 39 chars:", _G(inventory)->_objects[i]->name);
- Common::strcpy_s(&inv_save_buff[index], 256, _G(inventory).objects[i]->name);
+ Common::strcpy_s(&inv_save_buff[index], 256, _G(inventory)->_objects[i]->name);
index += 40;
- memcpy(&inv_save_buff[index], &(_G(inventory).objects[i]->scene), sizeof(int32));
+ memcpy(&inv_save_buff[index], &(_G(inventory)->_objects[i]->scene), sizeof(int32));
index += sizeof(long);
}
@@ -316,8 +312,7 @@ void inv_restore_game(Common::SeekableReadStream *fp_restore) {
if (inv_restore_buff)
mem_free(inv_restore_buff);
- inventory_set_scroll(0); // MattP
- //myInventory->set_scroll(0); in above function
+ _G(inventory)->set_scroll(0);
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index 48434618548..bf4e23da0a4 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -23,6 +23,7 @@
#ifndef M4_ADV_R_ADV_INV_H
#define M4_ADV_R_ADV_INV_H
+#include "common/array.h"
#include "common/stream.h"
namespace M4 {
@@ -33,10 +34,16 @@ struct InvObj {
int32 scene = 0, cel = 0, cursor = 0;
};
-struct InventoryRec {
- InvObj **objects = nullptr;
- int32 num_objects = 0;
- int32 tail = 0;
+struct InventoryBase {
+ Common::Array<InvObj *> _objects;
+ int32 _tail = 0;
+
+ InventoryBase() {}
+ virtual ~InventoryBase() {}
+
+ virtual void add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) = 0;
+ virtual void set_scroll(int32 scroll) = 0;
+ virtual void remove(const Common::String &name) = 0;
};
/**
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 6eb49a89429..af8c1b9b042 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -72,10 +72,14 @@ static const ConverterEntry ASCII_CONVERTERS[] = {
BurgerGlobals::BurgerGlobals() {
g_globals = this;
+
+ Inventory *inv = new Inventory();
+ _inventory = inv;
}
BurgerGlobals::~BurgerGlobals() {
g_globals = nullptr;
+ delete _inventory;
}
void BurgerGlobals::main_cold_data_init() {
@@ -111,7 +115,8 @@ void BurgerGlobals::global_menu_system_init() {
AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
_interface.init(0, 5, 6, 8, 9);
- _inventory.init();
+
+ static_cast<Inventory *>(_inventory)->init();
}
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 89d6ea13bb3..43200e95cc1 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -48,7 +48,6 @@ protected:
public:
GameMode _gameMode = WHOLE_GAME;
Interface _interface;
- BurgerInventory _inventory;
public:
BurgerGlobals();
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 27ab40547e8..4e0121804bd 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -35,6 +35,7 @@
namespace M4 {
namespace Burger {
+namespace GUI {
#define _GI(X) _G(interface)._##X
@@ -61,7 +62,7 @@ RectClass::RectClass(const RectClass *r) {
}
RectClass::RectClass(int16 x1, int16 y1, int16 x2, int16 y2) :
- _x1(x1), _y1(y1), _x2(x2), _y2(y2) {
+ _x1(x1), _y1(y1), _x2(x2), _y2(y2) {
}
RectClass::~RectClass() {
@@ -106,7 +107,7 @@ int16 RectClass::inside(int16 x, int16 y) const {
//-------------------------------------------------------------------------------------------
TextField::TextField(int16 x1, int16 y1, int16 x2, int16 y2) :
- RectClass(x1, y1, x2, y2) {
+ RectClass(x1, y1, x2, y2) {
_string = nullptr;
_string_len = 0;
_must_redraw = true;
@@ -175,8 +176,8 @@ ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int1
}
ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
- int16 unknown, int16 relaxed, int16 over, int16 picked) : RectClass(r),
- _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked) {
+ int16 unknown, int16 relaxed, int16 over, int16 picked) : RectClass(r),
+ _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked) {
}
ButtonClass::ButtonClass() : RectClass() {
@@ -527,7 +528,7 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
//-------------------------------------------------------------------------------------------
Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
- : RectClass(r) {
+ : RectClass(r) {
_sprite = sprite;
for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
@@ -779,5 +780,6 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
return result;
}
-} // End of namespace Burger
-} // End of namespace M4
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index e81b046d055..ff98bd63daa 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -29,6 +29,7 @@
namespace M4 {
namespace Burger {
+namespace GUI {
constexpr int16 INVENTORY_CELLS_COUNT = 128;
constexpr int16 ARROW_WIDTH = 8;
@@ -216,7 +217,8 @@ public:
void set_scroll(int32 new_scroll);
};
-} // End of namespace Burger
-} // End of namespace M4
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
#endif
diff --git a/engines/m4/burger/interface.cpp b/engines/m4/burger/interface.cpp
index 9fe96340066..5e70add57d8 100644
--- a/engines/m4/burger/interface.cpp
+++ b/engines/m4/burger/interface.cpp
@@ -27,6 +27,8 @@
namespace M4 {
namespace Burger {
+using namespace Burger::GUI;
+
void Interface::init(int arrow, int wait, int look, int grab, int use) {
_arrow = arrow;
_wait = wait;
@@ -67,7 +69,7 @@ void Interface::show() {
void Interface::setup() {
_interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
- _inventory = new Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
+ _inventory = new GUI::Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
_textField = new TextField(200, 1, 450, 21);
_btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5);
_btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8);
diff --git a/engines/m4/burger/interface.h b/engines/m4/burger/interface.h
index b9f46583306..d53a44ca722 100644
--- a/engines/m4/burger/interface.h
+++ b/engines/m4/burger/interface.h
@@ -48,16 +48,16 @@ public:
int _x2 = SCREEN_WIDTH;
int _y2 = SCREEN_HEIGHT;
GrBuff *_gameInterfaceBuff = nullptr;
- InterfaceBox *_interfaceBox = nullptr;
- Inventory *_inventory = nullptr;
- TextField *_textField = nullptr;
- ButtonClass *_btnTake = nullptr;
- ButtonClass *_btnManipulate = nullptr;
- ButtonClass *_btnHandle = nullptr;
- ButtonClass *_btnAbductFail = nullptr;
- ButtonClass *_btnMenu = nullptr;
- ButtonClass *_btnScrollLeft = nullptr;
- ButtonClass *_btnScrollRight = nullptr;
+ GUI::InterfaceBox *_interfaceBox = nullptr;
+ GUI::Inventory *_inventory = nullptr;
+ GUI::TextField *_textField = nullptr;
+ GUI::ButtonClass *_btnTake = nullptr;
+ GUI::ButtonClass *_btnManipulate = nullptr;
+ GUI::ButtonClass *_btnHandle = nullptr;
+ GUI::ButtonClass *_btnAbductFail = nullptr;
+ GUI::ButtonClass *_btnMenu = nullptr;
+ GUI::ButtonClass *_btnScrollLeft = nullptr;
+ GUI::ButtonClass *_btnScrollRight = nullptr;
~Interface();
void init(int arrow, int wait, int look, int grab, int use);
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
index 3b93e448598..6ac5df3549e 100644
--- a/engines/m4/burger/inventory.cpp
+++ b/engines/m4/burger/inventory.cpp
@@ -73,7 +73,7 @@ static const InvObject INVENTORY_ITEMS[] = {
{ nullptr, nullptr, 0, 0, 0 }
};
-void BurgerInventory::init() {
+void Inventory::init() {
for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item) {
inv_register_thing(item->_name, item->_verbs, item->_scene, item->_cel, item->_cursor);
@@ -81,5 +81,17 @@ void BurgerInventory::init() {
}
}
+void Inventory::add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) {
+
+}
+
+void Inventory::set_scroll(int32 scroll) {
+
+}
+
+void Inventory::remove(const Common::String &name) {
+
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/inventory.h b/engines/m4/burger/inventory.h
index 15349b2bf45..563213c1cae 100644
--- a/engines/m4/burger/inventory.h
+++ b/engines/m4/burger/inventory.h
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "m4/m4_types.h"
+#include "m4/adv_r/adv_inv.h"
namespace M4 {
namespace Burger {
@@ -38,11 +39,15 @@ struct InventoryItem {
InventoryItem(const char *name, int scene) : _asset(name), _name(name), _scene(scene) {}
};
-struct BurgerInventory {
+struct Inventory : public InventoryBase {
public:
Common::Array<InventoryItem> _items;
public:
void init();
+
+ void add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) override;
+ void set_scroll(int32 scroll) override;
+ void remove(const Common::String &name) override;
};
} // namespace Burger
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index b94f3ccc712..a78e6119214 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -98,6 +98,7 @@ public:
Font *_font = nullptr;
bool _system_shutting_down = false;
+ InventoryBase *_inventory = nullptr;
size_t _mem_to_alloc = 0;
void *_gameInterfaceBuff = nullptr;
void *_custom_interface_setup = nullptr;
@@ -122,7 +123,6 @@ public:
strmRequest *_firstStream = nullptr;
strmRequest *_lastStream = nullptr;
InvPal *_inverse_pal = nullptr;
- InventoryRec _inventory;
int32 _inv_obj_mem_type = 0;
bool _currScreen = false;
ScreenContext *_eventToScreen = nullptr;
Commit: 4da51ee89b2539ee5ea010478dbf0589d11a9565
https://github.com/scummvm/scummvm/commit/4da51ee89b2539ee5ea010478dbf0589d11a9565
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Hook up engine inventory to Burger Inventory widget
Changed paths:
engines/m4/burger/burger_globals.h
engines/m4/burger/gui_cheapo.cpp
engines/m4/burger/gui_cheapo.h
engines/m4/burger/inventory.cpp
engines/m4/burger/inventory.h
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 43200e95cc1..74358b2ebf3 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -58,6 +58,7 @@ extern BurgerGlobals *g_globals;
#undef _G
#define _G(X) (::M4::Burger::g_globals->_##X)
+#define _GI(X) _G(interface)._##X
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui_cheapo.cpp
index 4e0121804bd..3701fd830a9 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui_cheapo.cpp
@@ -37,8 +37,6 @@ namespace M4 {
namespace Burger {
namespace GUI {
-#define _GI(X) _G(interface)._##X
-
static void refresh_right_arrow() {
error("TODO: refresh_right_arrow");
}
@@ -534,7 +532,6 @@ Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cell
for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
_items[iter]._cell = -1;
_items[iter]._cursor = -1;
- _items[iter]._name = nullptr;
}
_num_cells = 0;
@@ -560,11 +557,11 @@ Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cell
Inventory::~Inventory() {
}
-bool Inventory::add(const char *name, const char *verb, int32 invSprite, int32 cursor) {
+bool Inventory::add(const Common::String &name, const Common::String &verb, int32 invSprite, int32 cursor) {
// Don't add something twice
int iter;
for (iter = 0; iter < _num_cells; iter++) {
- if (!strcmp(name, _items[iter]._name))
+ if (name.equals(_items[iter]._name))
return true;
}
@@ -608,12 +605,11 @@ void Inventory::set_scroll(int32 new_scroll) {
_must_redraw_all = true;
}
-bool Inventory::remove(const char *name) {
+bool Inventory::remove(const Common::String &name) {
int iter;
for (iter = 0; iter < _num_cells; iter++) {
// Found the thing?
- if (!strcmp(name, _items[iter]._name)) {
-
+ if (name.equals(_items[iter]._name)) {
// Eat up its slot by moving everything down
for (; iter < _num_cells; ++iter)
_items[iter] = _items[iter + 1];
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui_cheapo.h
index ff98bd63daa..b5b77c312ec 100644
--- a/engines/m4/burger/gui_cheapo.h
+++ b/engines/m4/burger/gui_cheapo.h
@@ -175,8 +175,8 @@ public:
class Inventory : public RectClass {
struct Entry {
- const char *_name = nullptr;
- const char *_verb = nullptr;
+ Common::String _name;
+ Common::String _verb;
int16 _cell = -1;
int16 _cursor = -1;
};
@@ -208,8 +208,8 @@ public:
int16 inside(int16 x, int16 y);
ControlStatus track(int32 eventType, int16 x, int16 y);
- bool add(const char *name, const char *verb, int32 cel, int32 cursor);
- bool remove(const char *name);
+ bool add(const Common::String &name, const Common::String &verb, int32 cel, int32 cursor);
+ bool remove(const Common::String &name);
void highlight_part(int16 index);
bool need_left() const;
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
index 6ac5df3549e..3b5cccf79c2 100644
--- a/engines/m4/burger/inventory.cpp
+++ b/engines/m4/burger/inventory.cpp
@@ -21,6 +21,7 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/burger/inventory.h"
+#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
@@ -82,15 +83,17 @@ void Inventory::init() {
}
void Inventory::add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) {
-
+ _GI(inventory)->add(name, verb, sprite, cursor);
+ _GI(inventory)->_must_redraw_all = true;
}
void Inventory::set_scroll(int32 scroll) {
-
+ _GI(inventory)->set_scroll(scroll);
}
void Inventory::remove(const Common::String &name) {
-
+ _GI(inventory)->remove(name);
+ _GI(inventory)->_must_redraw_all = true;
}
} // namespace Burger
diff --git a/engines/m4/burger/inventory.h b/engines/m4/burger/inventory.h
index 563213c1cae..f2a192b2b65 100644
--- a/engines/m4/burger/inventory.h
+++ b/engines/m4/burger/inventory.h
@@ -45,7 +45,7 @@ public:
public:
void init();
- void add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) override;
+ void add(const Common::String &name, const Common::String &verbs, int32 sprite, int32 cursor) override;
void set_scroll(int32 scroll) override;
void remove(const Common::String &name) override;
};
Commit: d87cab7e1626fc5c2b4f16a4f5d643dc896ceb73
https://github.com/scummvm/scummvm/commit/d87cab7e1626fc5c2b4f16a4f5d643dc896ceb73
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Stubbed initialize_game method
Changed paths:
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/globals.cpp
engines/m4/globals.h
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index af8c1b9b042..6f8f88a18bd 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -119,6 +119,10 @@ void BurgerGlobals::global_menu_system_init() {
static_cast<Inventory *>(_inventory)->init();
}
+void BurgerGlobals::initialize_game() {
+ // TODO
+}
+
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
int32 maxW, maxH;
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 74358b2ebf3..83591da21ef 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -44,6 +44,7 @@ private:
protected:
void main_cold_data_init() override;
void global_menu_system_init() override;
+ void initialize_game() override;
public:
GameMode _gameMode = WHOLE_GAME;
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 164cc70d340..c904557d220 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -82,6 +82,7 @@ bool Globals::init() {
main_cold_data_init();
create_mouse_watch_dialog();
global_menu_system_init();
+ initialize_game();
return true;
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index a78e6119214..8656a3d96d2 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -65,6 +65,7 @@ private:
protected:
virtual void main_cold_data_init() = 0;
virtual void global_menu_system_init() = 0;
+ virtual void initialize_game() = 0;
public:
Globals();
Commit: bf4e0b1c78cef3f342d75e3c8e63874e66f028db
https://github.com/scummvm/scummvm/commit/bf4e0b1c78cef3f342d75e3c8e63874e66f028db
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleaning up adv_inv use of strings
Changed paths:
A engines/m4/burger/vars.cpp
A engines/m4/burger/vars.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 8ebaef357af..52be4c89891 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -47,7 +47,7 @@ bool inv_init(int32 num_objects) {
return true;
}
-void inv_shutdown(void) {
+void inv_shutdown() {
int i;
for (i = 0; i < _G(inventory)->_tail; i++) {
@@ -55,11 +55,10 @@ void inv_shutdown(void) {
}
}
-bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32 cel, int32 cursor) {
- assert(name && verbs);
-
- char *s_name = mem_strdup(name);
- char *s_verbs = mem_strdup(verbs);
+bool inv_register_thing(const Common::String &itemName, const Common::String &itemVerbs,
+ int32 scene, int32 cel, int32 cursor) {
+ char *s_name = mem_strdup(itemName.c_str());
+ char *s_verbs = mem_strdup(itemVerbs.c_str());
_G(inventory)->_objects[_G(inventory)->_tail]->name = nullptr;
_G(inventory)->_objects[_G(inventory)->_tail]->verbs = nullptr;
@@ -89,13 +88,14 @@ bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32
//-------------------------------------------------------------------
-int32 inv_where_is(char *name) {
+int32 inv_where_is(const Common::String &itemName) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
return _G(inventory)->_objects[i]->scene;
}
}
@@ -104,18 +104,18 @@ int32 inv_where_is(char *name) {
return UNKNOWN_OBJECT;
}
-bool inv_player_has(char *name) {
- return (inv_where_is(name) == BACKPACK);
+bool inv_player_has(const Common::String &itemName) {
+ return (inv_where_is(itemName) == BACKPACK);
}
-bool inv_put_thing_in(char *name, int32 scene) {
+bool inv_put_thing_in(const Common::String &itemName, int32 scene) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
-
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
// Remove object from backpack?
if (_G(inventory)->_objects[i]->scene == BACKPACK && scene != BACKPACK) {
_G(inventory)->remove(name);
@@ -134,25 +134,30 @@ bool inv_put_thing_in(char *name, int32 scene) {
return false;
}
-int32 inv_get_cursor(char *name) {
+int32 inv_get_cursor(const Common::String &itemName) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
+
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
return _G(inventory)->_objects[i]->cursor;
}
}
}
+
return UNKNOWN_OBJECT;
}
-int32 inv_get_cel(char *name) {
+int32 inv_get_cel(const Common::String &itemName) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
+
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
return _G(inventory)->_objects[i]->cel;
}
}
@@ -160,16 +165,19 @@ int32 inv_get_cel(char *name) {
return UNKNOWN_OBJECT;
}
-char *inv_get_verbs(char *name) {
+const char *inv_get_verbs(const Common::String &itemName) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
+
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
return _G(inventory)->_objects[i]->verbs;
}
}
}
+
return nullptr;
}
@@ -177,33 +185,36 @@ char *inv_get_verbs(char *name) {
// we store a pointer to the registered name, not to an unmanaged
// memory pointer.
-static char *inv_get_name(char *name) {
+static char *inv_get_name(const Common::String &itemName) {
int i;
- cstrupr(name);
+ Common::String name = itemName;
+ name.toUppercase();
+
for (i = 0; i < _G(inventory)->_tail; i++) {
if (_G(inventory)->_objects[i]->name) {
- if (!strcmp(_G(inventory)->_objects[i]->name, name)) {
+ if (name.equals(_G(inventory)->_objects[i]->name)) {
return _G(inventory)->_objects[i]->name;
}
}
}
+
return nullptr;
}
-void inv_give_to_player(char *name) {
- inv_put_thing_in(name, BACKPACK);
+void inv_give_to_player(const Common::String &itemName) {
+ inv_put_thing_in(itemName, BACKPACK);
}
-void inv_move_object(char *name, int32 scene) {
- inv_put_thing_in(name, scene);
+void inv_move_object(const Common::String &itemName, int32 scene) {
+ inv_put_thing_in(itemName, scene);
}
-bool inv_object_is_here(char *name) {
- return (inv_where_is(name) == _G(game).room_id);
+bool inv_object_is_here(const Common::String &itemName) {
+ return (inv_where_is(itemName) == _G(game).room_id);
}
-bool inv_object_in_scene(char *name, int32 scene) {
- return (inv_where_is(name) == scene);
+bool inv_object_in_scene(const Common::String &itemName, int32 scene) {
+ return (inv_where_is(itemName) == scene);
}
void MoveBP(char *s, int32 from, int32 to) {
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index bf4e23da0a4..2d327b77703 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -58,25 +58,25 @@ extern void inv_shutdown();
/**
* Register things during init of the game
- * @param name Name of the object as it should appear as a sentence is built
- * @param verbs Verbs should have this format: verbs = "slit,peel,fricasee,examine"
+ * @param itemName Name of the object as it should appear as a sentence is built
+ * @param itemVerbs Verbs should have this format: verbs = "slit,peel,fricasee,examine"
* There can be any number of verbs in the string.
* @param scene The place for the thing to appear initially (BACKPACK is one place)
* @param cel Index into the inventory sprite series for use when displaying inventory
* @param cursor Cel index into the cursor sprite series when the player is "holding" a thing
*/
-extern bool inv_register_thing(const char *name, const char *verbs, int32 scene, int32 cel, int32 cursor);
-
-extern int32 inv_where_is(const char *name);
-extern bool inv_player_has(const char *name);
-extern bool inv_put_thing_in(const char *name, int32 scene);
-extern int32 inv_get_cursor(const char *name);
-extern int32 inv_get_cel(const char *name);
-extern char *inv_get_verbs(const char *name);
-extern void inv_give_to_player(const char *name);
-extern void inv_move_object(const char *name, int32 scene);
-extern bool inv_object_is_here(const char *name);
-extern bool inv_object_in_scene(const char *name, int32 scene);
+extern bool inv_register_thing(const Common::String &itemName, const Common::String &itemVerbs, int32 scene, int32 cel, int32 cursor);
+
+extern int32 inv_where_is(const Common::String &itemName);
+extern bool inv_player_has(const Common::String &itemName);
+extern bool inv_put_thing_in(const Common::String &itemName, int32 scene);
+extern int32 inv_get_cursor(const Common::String &itemName);
+extern int32 inv_get_cel(const Common::String &itemName);
+extern const char *inv_get_verbs(const Common::String &itemName);
+extern void inv_give_to_player(const Common::String &itemName);
+extern void inv_move_object(const Common::String &itemName, int32 scene);
+extern bool inv_object_is_here(const Common::String &itemName);
+extern bool inv_object_in_scene(const Common::String &itemName, int32 scene);
// private
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 6f8f88a18bd..c4461d5e2c2 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -120,6 +120,14 @@ void BurgerGlobals::global_menu_system_init() {
}
void BurgerGlobals::initialize_game() {
+ // Put all the inventory items back in their original scenes
+ for (const auto &item : _inventory->_objects)
+ inv_put_thing_in(item->name, item->scene);
+ inv_give_to_player("MONEY");
+
+ // Clear the global variables
+ //_vars.reset();
+
// TODO
}
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 83591da21ef..c98eb3a9196 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -25,6 +25,7 @@
#include "m4/globals.h"
#include "m4/burger/interface.h"
#include "m4/burger/inventory.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
@@ -47,8 +48,11 @@ protected:
void initialize_game() override;
public:
+ //GlobalVars _globalVars;
GameMode _gameMode = WHOLE_GAME;
+ int _wilburTerm = 2;
Interface _interface;
+ Common::String _wilbur = "WILBUR";
public:
BurgerGlobals();
@@ -60,6 +64,7 @@ extern BurgerGlobals *g_globals;
#undef _G
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
+#define VAL(X) _G(_globalVars)[X]
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
new file mode 100644
index 00000000000..dafdf9c5b33
--- /dev/null
+++ b/engines/m4/burger/vars.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 "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+#define GLOBAL_VARS_COUNT 512
+
+Vars::Vars() {
+ resize(GLOBAL_VARS_COUNT);
+}
+
+void Vars::reset() {
+
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
new file mode 100644
index 00000000000..0564ecb17ba
--- /dev/null
+++ b/engines/m4/burger/vars.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_VARS_H
+#define M4_BURGER_VARS_H
+
+#include "common/array.h"
+#include "m4/burger/burger_globals.h"
+
+namespace M4 {
+namespace Burger {
+
+class Vars : public Common::Array<int32> {
+private:
+
+public:
+ Vars();
+
+ /**
+ * Reset the variables back to initial game state
+ */
+ void reset();
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 09bd04108df..5b1fd8c44e4 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -59,7 +59,8 @@ MODULE_OBJS = \
burger/burger_globals.o \
burger/gui_cheapo.o \
burger/interface.o \
- burger/inventory.o
+ burger/inventory.o \
+ burger/vars.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 43ce880515aa849299776c71a64312616042c58a
https://github.com/scummvm/scummvm/commit/43ce880515aa849299776c71a64312616042c58a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: First global vars setup method
Changed paths:
A engines/m4/core/term.cpp
A engines/m4/core/term.h
R engines/m4/term.cpp
R engines/m4/term.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/graphics/gr_buff.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index c4461d5e2c2..72bd54c5dbb 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -125,8 +125,9 @@ void BurgerGlobals::initialize_game() {
inv_put_thing_in(item->name, item->scene);
inv_give_to_player("MONEY");
- // Clear the global variables
- //_vars.reset();
+ // Reset the global variables
+ _vars.reset();
+ _vars.reset1();
// TODO
}
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index c98eb3a9196..7b99fba4f3c 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -48,7 +48,7 @@ protected:
void initialize_game() override;
public:
- //GlobalVars _globalVars;
+ Burger::Vars _vars;
GameMode _gameMode = WHOLE_GAME;
int _wilburTerm = 2;
Interface _interface;
@@ -64,7 +64,7 @@ extern BurgerGlobals *g_globals;
#undef _G
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
-#define VAL(X) _G(_globalVars)[X]
+#define VAL(X) _G(_vars)[X]
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index dafdf9c5b33..1bf12600b16 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -20,6 +20,9 @@
*/
#include "m4/burger/vars.h"
+#include "m4/core/term.h"
+#include "m4/adv_r/adv.h"
+#include "m4/adv_r/adv_inv.h"
namespace M4 {
namespace Burger {
@@ -31,7 +34,96 @@ Vars::Vars() {
}
void Vars::reset() {
+ Common::fill(&(*this)[0], &(*this)[0] + GLOBAL_VARS_COUNT, 0);
+}
+
+int32 Vars::get_boonsville_time_and_display(bool showTime) {
+ if (showTime) {
+ int time = (*this)[BOONSVILLE_TIME];
+ int seconds = time % 60;
+ time /= 60;
+ int minutes = time % 60;
+ time /= 60;
+
+ term_message("Boonsville time: %d:%d:%d", time, minutes, seconds);
+ }
+
+ return (*this)[BOONSVILLE_TIME];
+}
+
+void Vars::set_boonsville_time(int32 time) {
+ (*this)[BOONSVILLE_TIME] = time;
+ (*this)[BOONSVILLE_TIME2] = time - 1;
+}
+
+void Vars::reset1() {
+ set_boonsville_time(0);
+ (*this)[V000] = 1000;
+ inv_give_to_player("money");
+
+ (*this)[V001] = 20;
+ (*this)[V005] = 0;
+ (*this)[V010] = 0;
+ (*this)[V011] = 0;
+ (*this)[V012] = 0;
+ (*this)[V013] = 0;
+ (*this)[V014] = 0;
+ (*this)[V015] = 0;
+ (*this)[V017] = 0;
+ (*this)[V018] = 0;
+ (*this)[V019] = 0;
+ (*this)[V023] = 0;
+ (*this)[V027] = 0;
+ (*this)[V028] = 0;
+ (*this)[V031] = 0;
+ (*this)[V032] = 0;
+ (*this)[V033] = 2;
+ (*this)[V034] = 0;
+
+ inv_move_object("deed", 105);
+
+ (*this)[V172] = 10023;
+ (*this)[V037] = 1;
+ (*this)[V039] = 0;
+ (*this)[V043] = 0;
+ (*this)[V046] = 0;
+ (*this)[V047] = 0;
+ (*this)[V048] = 0;
+ (*this)[V049] = 0;
+
+ inv_move_object("jawz o' life", 137);
+ inv_move_object("keys", 138);
+
+ (*this)[V112] = 0;
+ (*this)[V058] = 0;
+ (*this)[V059] = 0;
+ (*this)[V245] = 10027;
+
+ inv_move_object("pantyhose", 142);
+ inv_move_object("block of ice", 142);
+ inv_move_object("broken mouse trap", 143);
+ inv_move_object("spring", NOWHERE);
+ inv_move_object("amplifier", 145);
+
+ (*this)[V079] = 1;
+ inv_move_object("phone bill", 170);
+ inv_move_object("whistle", 170);
+
+ (*this)[V083] = 0;
+ (*this)[V084] = 0;
+ (*this)[V085] = 0;
+ (*this)[V086] = 0;
+ (*this)[V087] = 0;
+ (*this)[V088] = 0;
+ (*this)[V092] = 0;
+ (*this)[V091] = 0;
+
+ inv_move_object("carrot juice", 172);
+ inv_move_object("laxative", 174);
+ inv_move_object("broken puz dispenser", 176);
+ inv_move_object("puz dispenser", NOWHERE);
+ conv_reset_all();
}
} // namespace Burger
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 0564ecb17ba..de0b4ee99e9 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -23,14 +23,533 @@
#define M4_BURGER_VARS_H
#include "common/array.h"
-#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
+enum {
+ V000 = 0,
+ V001 = 1,
+ V002 = 2,
+ V003 = 3,
+ V004 = 4,
+ V005 = 5,
+ V006 = 6,
+ V007 = 7,
+ V008 = 8,
+ V009 = 9,
+ V010 = 10,
+ V011 = 11,
+ V012 = 12,
+ V013 = 13,
+ V014 = 14,
+ V015 = 15,
+ V016 = 16,
+ V017 = 17,
+ V018 = 18,
+ V019 = 19,
+ V020 = 20,
+ V021 = 21,
+ V022 = 22,
+ V023 = 23,
+ V024 = 24,
+ V025 = 25,
+ V026 = 26,
+ V027 = 27,
+ V028 = 28,
+ V029 = 29,
+ V030 = 30,
+ V031 = 31,
+ V032 = 32,
+ V033 = 33,
+ V034 = 34,
+ V035 = 35,
+ V036 = 36,
+ V037 = 37,
+ V038 = 38,
+ V039 = 39,
+ V040 = 40,
+ V041 = 41,
+ V042 = 42,
+ V043 = 43,
+ V044 = 44,
+ V045 = 45,
+ V046 = 46,
+ V047 = 47,
+ V048 = 48,
+ V049 = 49,
+ V050 = 50,
+ V051 = 51,
+ V052 = 52,
+ V053 = 53,
+ V054 = 54,
+ V055 = 55,
+ V056 = 56,
+ V057 = 57,
+ V058 = 58,
+ V059 = 59,
+ V060 = 60,
+ V061 = 61,
+ V062 = 62,
+ V063 = 63,
+ V064 = 64,
+ V065 = 65,
+ V066 = 66,
+ V067 = 67,
+ V068 = 68,
+ V069 = 69,
+ V070 = 70,
+ V071 = 71,
+ V072 = 72,
+ V073 = 73,
+ V074 = 74,
+ V075 = 75,
+ V076 = 76,
+ V077 = 77,
+ V078 = 78,
+ V079 = 79,
+ V080 = 80,
+ V081 = 81,
+ V082 = 82,
+ V083 = 83,
+ V084 = 84,
+ V085 = 85,
+ V086 = 86,
+ V087 = 87,
+ V088 = 88,
+ V089 = 89,
+ V090 = 90,
+ V091 = 91,
+ V092 = 92,
+ V093 = 93,
+ V094 = 94,
+ V095 = 95,
+ V096 = 96,
+ V097 = 97,
+ V098 = 98,
+ V099 = 99,
+
+ V100 = 100,
+ V101 = 101,
+ V102 = 102,
+ V103 = 103,
+ V104 = 104,
+ V105 = 105,
+ V106 = 106,
+ V107 = 107,
+ V108 = 108,
+ V109 = 109,
+ V110 = 110,
+ V111 = 111,
+ V112 = 112,
+ V113 = 113,
+ V114 = 114,
+ V115 = 115,
+ V116 = 116,
+ V117 = 117,
+ V118 = 118,
+ V119 = 119,
+ V120 = 120,
+ V121 = 121,
+ V122 = 122,
+ V123 = 123,
+ V124 = 124,
+ V125 = 125,
+ V126 = 126,
+ V127 = 127,
+ V128 = 128,
+ V129 = 129,
+ V130 = 130,
+ V131 = 131,
+ V132 = 132,
+ V133 = 133,
+ V134 = 134,
+ V135 = 135,
+ V136 = 136,
+ V137 = 137,
+ V138 = 138,
+ V139 = 139,
+ V140 = 140,
+ V141 = 141,
+ V142 = 142,
+ V143 = 143,
+ V144 = 144,
+ V145 = 145,
+ V146 = 146,
+ V147 = 147,
+ V148 = 148,
+ V149 = 149,
+ V150 = 150,
+ V151 = 151,
+ V152 = 152,
+ V153 = 153,
+ V154 = 154,
+ V155 = 155,
+ V156 = 156,
+ V157 = 157,
+ V158 = 158,
+ V159 = 159,
+ V160 = 160,
+ V161 = 161,
+ V162 = 162,
+ V163 = 163,
+ V164 = 164,
+ V165 = 165,
+ V166 = 166,
+ V167 = 167,
+ V168 = 168,
+ V169 = 169,
+ V170 = 170,
+ V171 = 171,
+ V172 = 172,
+ V173 = 173,
+ V174 = 174,
+ V175 = 175,
+ V176 = 176,
+ V177 = 177,
+ V178 = 178,
+ V179 = 179,
+ V180 = 180,
+ V181 = 181,
+ V182 = 182,
+ V183 = 183,
+ V184 = 184,
+ V185 = 185,
+ V186 = 186,
+ V187 = 187,
+ V188 = 188,
+ V189 = 189,
+ V190 = 190,
+ V191 = 191,
+ V192 = 192,
+ V193 = 193,
+ V194 = 194,
+ V195 = 195,
+ V196 = 196,
+ V197 = 197,
+ V198 = 198,
+ V199 = 199,
+
+ V200 = 200,
+ V201 = 201,
+ V202 = 202,
+ V203 = 203,
+ V204 = 204,
+ V205 = 205,
+ V206 = 206,
+ V207 = 207,
+ V208 = 208,
+ V209 = 209,
+ V210 = 210,
+ V211 = 211,
+ V212 = 212,
+ V213 = 213,
+ V214 = 214,
+ V215 = 215,
+ V216 = 216,
+ V217 = 217,
+ V218 = 218,
+ V219 = 219,
+ V220 = 220,
+ V221 = 221,
+ V222 = 222,
+ V223 = 223,
+ V224 = 224,
+ V225 = 225,
+ V226 = 226,
+ V227 = 227,
+ V228 = 228,
+ V229 = 229,
+ V230 = 230,
+ V231 = 231,
+ V232 = 232,
+ V233 = 233,
+ V234 = 234,
+ V235 = 235,
+ V236 = 236,
+ V237 = 237,
+ V238 = 238,
+ V239 = 239,
+ V240 = 240,
+ V241 = 241,
+ V242 = 242,
+ V243 = 243,
+ V244 = 244,
+ V245 = 245,
+ V246 = 246,
+ V247 = 247,
+ V248 = 248,
+ V249 = 249,
+ V250 = 250,
+ V251 = 251,
+ V252 = 252,
+ V253 = 253,
+ V254 = 254,
+ V255 = 255,
+ V256 = 256,
+ V257 = 257,
+ V258 = 258,
+ V259 = 259,
+ V260 = 260,
+ V261 = 261,
+ V262 = 262,
+ V263 = 263,
+ V264 = 264,
+ V265 = 265,
+ V266 = 266,
+ V267 = 267,
+ V268 = 268,
+ V269 = 269,
+ V270 = 270,
+ V271 = 271,
+ V272 = 272,
+ V273 = 273,
+ V274 = 274,
+ V275 = 275,
+ V276 = 276,
+ V277 = 277,
+ V278 = 278,
+ V279 = 279,
+ V280 = 280,
+ V281 = 281,
+ V282 = 282,
+ V283 = 283,
+ V284 = 284,
+ V285 = 285,
+ V286 = 286,
+ V287 = 287,
+ V288 = 288,
+ V289 = 289,
+ V290 = 290,
+ V291 = 291,
+ V292 = 292,
+ V293 = 293,
+ V294 = 294,
+ V295 = 295,
+ V296 = 296,
+ V297 = 297,
+ V298 = 298,
+ V299 = 299,
+
+ V300 = 300,
+ V301 = 301,
+ V302 = 302,
+ V303 = 303,
+ V304 = 304,
+ V305 = 305,
+ V306 = 306,
+ V307 = 307,
+ BOONSVILLE_TIME = 308,
+ BOONSVILLE_TIME2 = 309,
+ V310 = 310,
+ V311 = 311,
+ V312 = 312,
+ V313 = 313,
+ V314 = 314,
+ V315 = 315,
+ V316 = 316,
+ V317 = 317,
+ V318 = 318,
+ V319 = 319,
+ V320 = 320,
+ V321 = 321,
+ V322 = 322,
+ V323 = 323,
+ V324 = 324,
+ V325 = 325,
+ V326 = 326,
+ V327 = 327,
+ V328 = 328,
+ V329 = 329,
+ V330 = 330,
+ V331 = 331,
+ V332 = 332,
+ V333 = 333,
+ V334 = 334,
+ V335 = 335,
+ V336 = 336,
+ V337 = 337,
+ V338 = 338,
+ V339 = 339,
+ V340 = 340,
+ V341 = 341,
+ V342 = 342,
+ V343 = 343,
+ V344 = 344,
+ V345 = 345,
+ V346 = 346,
+ V347 = 347,
+ V348 = 348,
+ V349 = 349,
+ V350 = 350,
+ V351 = 351,
+ V352 = 352,
+ V353 = 353,
+ V354 = 354,
+ V355 = 355,
+ V356 = 356,
+ V357 = 357,
+ V358 = 358,
+ V359 = 359,
+ V360 = 360,
+ V361 = 361,
+ V362 = 362,
+ V363 = 363,
+ V364 = 364,
+ V365 = 365,
+ V366 = 366,
+ V367 = 367,
+ V368 = 368,
+ V369 = 369,
+ V370 = 370,
+ V371 = 371,
+ V372 = 372,
+ V373 = 373,
+ V374 = 374,
+ V375 = 375,
+ V376 = 376,
+ V377 = 377,
+ V378 = 378,
+ V379 = 379,
+ V380 = 380,
+ V381 = 381,
+ V382 = 382,
+ V383 = 383,
+ V384 = 384,
+ V385 = 385,
+ V386 = 386,
+ V387 = 387,
+ V388 = 388,
+ V389 = 389,
+ V390 = 390,
+ V391 = 391,
+ V392 = 392,
+ V393 = 393,
+ V394 = 394,
+ V395 = 395,
+ V396 = 396,
+ V397 = 397,
+ V398 = 398,
+ V399 = 399,
+
+ V400 = 400,
+ V401 = 401,
+ V402 = 402,
+ V403 = 403,
+ V404 = 404,
+ V405 = 405,
+ V406 = 406,
+ V407 = 407,
+ V408 = 408,
+ V409 = 409,
+ V410 = 410,
+ V411 = 411,
+ V412 = 412,
+ V413 = 413,
+ V414 = 414,
+ V415 = 415,
+ V416 = 416,
+ V417 = 417,
+ V418 = 418,
+ V419 = 419,
+ V420 = 420,
+ V421 = 421,
+ V422 = 422,
+ V423 = 423,
+ V424 = 424,
+ V425 = 425,
+ V426 = 426,
+ V427 = 427,
+ V428 = 428,
+ V429 = 429,
+ V430 = 430,
+ V431 = 431,
+ V432 = 432,
+ V433 = 433,
+ V434 = 434,
+ V435 = 435,
+ V436 = 436,
+ V437 = 437,
+ V438 = 438,
+ V439 = 439,
+ V440 = 440,
+ V441 = 441,
+ V442 = 442,
+ V443 = 443,
+ V444 = 444,
+ V445 = 445,
+ V446 = 446,
+ V447 = 447,
+ V448 = 448,
+ V449 = 449,
+ V450 = 450,
+ V451 = 451,
+ V452 = 452,
+ V453 = 453,
+ V454 = 454,
+ V455 = 455,
+ V456 = 456,
+ V457 = 457,
+ V458 = 458,
+ V459 = 459,
+ V460 = 460,
+ V461 = 461,
+ V462 = 462,
+ V463 = 463,
+ V464 = 464,
+ V465 = 465,
+ V466 = 466,
+ V467 = 467,
+ V468 = 468,
+ V469 = 469,
+ V470 = 470,
+ V471 = 471,
+ V472 = 472,
+ V473 = 473,
+ V474 = 474,
+ V475 = 475,
+ V476 = 476,
+ V477 = 477,
+ V478 = 478,
+ V479 = 479,
+ V480 = 480,
+ V481 = 481,
+ V482 = 482,
+ V483 = 483,
+ V484 = 484,
+ V485 = 485,
+ V486 = 486,
+ V487 = 487,
+ V488 = 488,
+ V489 = 489,
+ V490 = 490,
+ V491 = 491,
+ V492 = 492,
+ V493 = 493,
+ V494 = 494,
+ V495 = 495,
+ V496 = 496,
+ V497 = 497,
+ V498 = 498,
+ V499 = 499,
+
+ V500 = 500,
+ V501 = 501,
+ V502 = 502,
+ V503 = 503,
+ V504 = 504,
+ V505 = 505,
+ V506 = 506,
+ V507 = 507,
+ V508 = 508,
+ V509 = 509,
+ V510 = 510,
+ V511 = 511
+};
+
class Vars : public Common::Array<int32> {
private:
-
+ Common::Array<byte> _convSave;
public:
Vars();
@@ -38,6 +557,16 @@ public:
* Reset the variables back to initial game state
*/
void reset();
+
+ void reset1();
+
+ void conv_reset_all() {
+ _convSave.clear();
+ }
+
+ int32 get_boonsville_time_and_display(bool showTime = false);
+ void set_boonsville_time(int32 time);
+
};
} // namespace Burger
diff --git a/engines/m4/term.cpp b/engines/m4/core/term.cpp
similarity index 98%
rename from engines/m4/term.cpp
rename to engines/m4/core/term.cpp
index 4a3fb3a430e..a723e3f0091 100644
--- a/engines/m4/term.cpp
+++ b/engines/m4/core/term.cpp
@@ -22,7 +22,7 @@
#include "common/debug.h"
#include "common/savefile.h"
#include "common/system.h"
-#include "m4/term.h"
+#include "m4/core/term.h"
#include "m4/globals.h"
namespace M4 {
diff --git a/engines/m4/term.h b/engines/m4/core/term.h
similarity index 97%
rename from engines/m4/term.h
rename to engines/m4/core/term.h
index b5a3f8ae123..4f929730f59 100644
--- a/engines/m4/term.h
+++ b/engines/m4/core/term.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_TERM_H
-#define M4_TERM_H
+#ifndef M4_CORE_TERM_H
+#define M4_CORE_TERM_H
#include "common/stream.h"
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index c904557d220..775a633d294 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -161,7 +161,6 @@ void Globals::game_systems_shutdown() {
gr_font_dealloc(_font_misc);
gr_font_system_shutdown();
#ifdef TODO
- conv_reset_all(); //mar4 from mattp
term_message("tin streams be gone!");
f_stream_Shutdown();
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 8656a3d96d2..c87509c3217 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -23,7 +23,7 @@
#define M4_GLOBALS_H
#include "m4/kernel.h"
-#include "m4/term.h"
+#include "m4/core/term.h"
#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 0c4a57ada6a..82f25732f4e 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -24,7 +24,7 @@
#include "m4/gui/gui_vmng_core.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
-#include "m4/term.h"
+#include "m4/core/term.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 5b1fd8c44e4..d15efbb5067 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -8,7 +8,6 @@ MODULE_OBJS = \
metaengine.o \
param.o \
res.o \
- term.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
adv_r/adv_file.o \
@@ -20,6 +19,7 @@ MODULE_OBJS = \
core/errors.o \
core/imath.o \
core/mouse.o \
+ core/term.o \
events/mickey.o \
events/mouse_handler.o \
fileio/extensions.o \
Commit: f4db8661012c377cfea6e4876a7b7c0864407057
https://github.com/scummvm/scummvm/commit/f4db8661012c377cfea6e4876a7b7c0864407057
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further global vars reset methods
Changed paths:
engines/m4/burger/burger_globals.cpp
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 72bd54c5dbb..694ca02c515 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -128,6 +128,10 @@ void BurgerGlobals::initialize_game() {
// Reset the global variables
_vars.reset();
_vars.reset1();
+ _vars.reset2();
+ _vars.reset3();
+ _vars.reset4();
+ _vars.reset5();
// TODO
}
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 1bf12600b16..5ed465070b7 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -23,6 +23,7 @@
#include "m4/core/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_inv.h"
+#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
@@ -126,5 +127,149 @@ void Vars::reset1() {
conv_reset_all();
}
+void Vars::reset2() {
+ if ((*this)[V245] != 10027)
+ inv_give_to_player("BLOCK OF ICE");
+ if ((*this)[V277] == 6003)
+ inv_give_to_player("PANTYHOSE");
+
+ (*this)[V243] = 6000;
+ (*this)[V244] = 6000;
+ (*this)[V245] = 10027;
+ (*this)[V246] = 0;
+ (*this)[V255] = 0;
+ (*this)[V256] = 0;
+ (*this)[V257] = 0;
+ (*this)[V258] = 0;
+ (*this)[V263] = 0;
+ (*this)[V265] = 0;
+ (*this)[V266] = 0;
+ (*this)[V269] = 1;
+ (*this)[V270] = 6000;
+ (*this)[V273] = 0;
+ (*this)[V274] = 0;
+ (*this)[V277] = 6000;
+ (*this)[V278] = 0;
+
+ if (_G(gameMode) != WHOLE_GAME) {
+ inv_give_to_player("BLOCK OF ICE");
+ inv_give_to_player("PANTYHOSE");
+ }
+}
+
+void Vars::reset3() {
+ if (inv_player_has("BOTTLE")) {
+ inv_give_to_player("CARROT JUICE");
+ inv_move_object("BOTTLE", NOWHERE);
+ }
+
+ (*this)[V107] = 0;
+ (*this)[V111] = 0;
+ inv_move_object("BURGER MORSEL", NOWHERE);
+
+ (*this)[V117] = 0;
+ (*this)[V124] = 0;
+ (*this)[V118] = 3001;
+ (*this)[V119] = 0;
+ (*this)[V120] = 0;
+ (*this)[V121] = 3001;
+ (*this)[V122] = 0;
+ (*this)[V124] = 0;
+
+ inv_move_object("JUG", 303);
+ inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
+
+ (*this)[V130] = 0;
+ inv_move_object("MATCHES", 304);
+
+ (*this)[V134] = 0;
+ (*this)[V140] = 0;
+ (*this)[V144] = 0;
+ (*this)[V145] = 0;
+}
+
+void Vars::reset4() {
+ (*this)[V186] = 0;
+ (*this)[V234] = 0;
+ (*this)[V196] = 0;
+ (*this)[V197] = 0;
+ (*this)[V198] = 0;
+ (*this)[V199] = 0;
+ (*this)[V200] = 5000;
+
+ inv_move_object("KINDLING", 502);
+ inv_move_object("BURNING KINDLING", 502);
+ inv_move_object("GIZMO", 502);
+
+ (*this)[V203] = 0;
+ (*this)[V204] = 5000;
+ (*this)[V205] = 0;
+ (*this)[V207] = 0;
+
+ inv_move_object("ROLLING PIN", 503);
+ inv_move_object("RUBBER GLOVES", 503);
+
+ (*this)[V210] = 5000;
+ (*this)[V211] = 5000;
+ (*this)[V212] = 5001;
+ (*this)[V213] = 2;
+ (*this)[V214] = 0;
+
+ inv_move_object("DIRTY SOCK", 504);
+
+ (*this)[V218] = 5000;
+ (*this)[V219] = 0;
+ (*this)[V223] = 0;
+ (*this)[V224] = 0;
+
+ inv_move_object("RUBBER DUCKY", 507);
+
+ if (inv_player_has("SOAPY WATER")) {
+ inv_move_object("SOAPY WATER", 507);
+ inv_give_to_player("BOTTLE");
+ }
+
+ (*this)[V227] = 0;
+ (*this)[V228] = 0;
+ (*this)[V229] = 1;
+
+ inv_move_object("CHRISTMAS LIGHTS", 508);
+ inv_move_object("CHRISTMAS LIGHTS ", 508);
+
+ (*this)[V237] = 0;
+}
+
+void Vars::reset5() {
+ if ((*this)[V159])
+ inv_give_to_player("DEED");
+
+ (*this)[V157] = 0;
+ (*this)[V158] = 0;
+ (*this)[V159] = 0;
+ (*this)[V162] = 0;
+
+ inv_move_object("FISH", 402);
+ inv_move_object("QUARTER", 404);
+
+ (*this)[V175] = 0;
+ (*this)[V171] = 4000;
+ (*this)[V172] = 10023;
+ (*this)[V173] = 0;
+ (*this)[V174] = 4000;
+ (*this)[V176] = 0;
+
+ inv_move_object("COLLAR", 406);
+ inv_move_object("HOOK", 406);
+
+ (*this)[V166] = 0;
+ (*this)[V168] = 0;
+ (*this)[V167] = 0;
+
+ inv_move_object("RECORDS", 405);
+
+ (*this)[V180] = 0;
+ (*this)[V181] = 0;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index de0b4ee99e9..3e1135498b0 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -559,6 +559,10 @@ public:
void reset();
void reset1();
+ void reset2();
+ void reset3();
+ void reset4();
+ void reset5();
void conv_reset_all() {
_convSave.clear();
Commit: 12aed0e48bcb25d619d108cc357218317ec8ed93
https://github.com/scummvm/scummvm/commit/12aed0e48bcb25d619d108cc357218317ec8ed93
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add remaining game initialize ending
Changed paths:
engines/m4/burger/burger_globals.cpp
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 694ca02c515..2212629cec2 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -132,8 +132,7 @@ void BurgerGlobals::initialize_game() {
_vars.reset3();
_vars.reset4();
_vars.reset5();
-
- // TODO
+ _vars.conv_reset_all();
}
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
Commit: 29edd4fc7a5412cc2cc6e9acbf7a21fa54422d06
https://github.com/scummvm/scummvm/commit/29edd4fc7a5412cc2cc6e9acbf7a21fa54422d06
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of main game loop support methods
Changed paths:
A engines/m4/adv_r/adv_control.cpp
A engines/m4/adv_r/adv_control.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
new file mode 100644
index 00000000000..6fd285a77bf
--- /dev/null
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_control.h"
+#include "m4/core/errors.h"
+#include "m4/mem/memman.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void m4FirstRun() {
+#if TODO
+ add_hot_keys();
+
+ // restore a game?
+
+ if (!_G(kernel).restore_game)
+ _G(interface).show();
+
+ _G(kernel).going = true;
+#endif
+}
+
+void m4SectionStartup() {
+ // TODO
+}
+
+void m4LastRun() {
+ // TODO
+}
+
+void m4SceneLoad() {
+ // TODO
+}
+
+void m4EndScene() {
+ // TODO
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
new file mode 100644
index 00000000000..cb8f0ca488d
--- /dev/null
+++ b/engines/m4/adv_r/adv_control.h
@@ -0,0 +1,39 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_CONTROL_H
+#define M4_ADV_R_ADV_CONTROL_H
+
+#include "common/stream.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void m4FirstRun();
+extern void m4SectionStartup();
+extern void m4LastRun();
+extern void m4SceneLoad();
+extern void m4EndScene();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index bfc73b76096..3451626aba0 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -27,6 +27,7 @@
#include "engines/util.h"
#include "graphics/palette.h"
#include "m4/m4.h"
+#include "m4/adv_r/adv_control.h"
#include "m4/detection.h"
#include "m4/console.h"
#include "m4/param.h"
@@ -61,14 +62,17 @@ Common::Error M4Engine::run() {
if (globals->init()) {
// Run game here
- warning("TODO: game loop");
+ m4_inflight();
}
-
delete globals;
return Common::kNoError;
}
+void M4Engine::m4_inflight() {
+ // TODO
+}
+
Common::Error M4Engine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 4863eb02baf..ab4a068d33c 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -42,9 +42,24 @@ namespace M4 {
struct M4GameDescription;
class M4Engine : public Engine {
+ enum GamePhase {
+ FirstRun,
+ SectionStartup,
+ SceneLoad,
+ SceneRun,
+ EndScene,
+ LastRun,
+ GameFinished
+ };
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+ GamePhase _gamePhase = FirstRun;
+
+ /**
+ * Main game loop
+ */
+ void m4_inflight();
protected:
// Engine APIs
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index d15efbb5067..80989d990d3 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
res.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
+ adv_r/adv_control.o \
adv_r/adv_file.o \
adv_r/adv_inv.o \
adv_r/adv_rails.o \
Commit: d6c9d986176c966a821386793f9e20961d11ac43
https://github.com/scummvm/scummvm/commit/d6c9d986176c966a821386793f9e20961d11ac43
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of hotkey handlers, support code
Changed paths:
A engines/m4/adv_r/adv_player.cpp
A engines/m4/adv_r/adv_player.h
A engines/m4/adv_r/adv_walk.cpp
A engines/m4/adv_r/adv_walk.h
A engines/m4/burger/gui/game_menu.cpp
A engines/m4/burger/gui/game_menu.h
A engines/m4/burger/hotkeys.cpp
A engines/m4/burger/hotkeys.h
A engines/m4/burger/other.cpp
A engines/m4/burger/other.h
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/adv_db_r/db_catalog.h
engines/m4/adv_r/adv.h
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/burger/interface.cpp
engines/m4/burger/vars.cpp
engines/m4/globals.h
engines/m4/kernel.h
engines/m4/module.mk
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 1077d761f7d..773a9cfcde8 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -31,7 +31,7 @@
namespace M4 {
static void sort_catalog();
-static char *catalog_search(char *name);
+static char *catalog_search(const char *name);
static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name, char *path, short *c_size);
static int compare_catalog_entries_for_search(const void *n1, const void *n2);
@@ -64,7 +64,7 @@ char *db_get_catalog() {
return _G(catalog)._data;
}
-char *db_rmlst_get_asset_room_path(char *asset_name, char *result, int32 *sceneCode) {
+char *db_rmlst_get_asset_room_path(const char *asset_name, char *result, int32 *sceneCode) {
char name[MAX_FILENAME_SIZE], path[MAX_FILENAME_SIZE];
short tag = 0, room = 0;
short c_size = 0;
@@ -171,7 +171,7 @@ static void sort_catalog() {
qsort(_G(catalog)._catalog, _G(catalog)._size, sizeof(char *), compare_catalog_entries_for_sort);
}
-static char *catalog_search(char *name) {
+static char *catalog_search(const char *name) {
char myString[80];
cstrcpy(myString, name);
cstrupr(myString);
diff --git a/engines/m4/adv_db_r/db_catalog.h b/engines/m4/adv_db_r/db_catalog.h
index 2c462ca8384..d9a8b21d3ed 100644
--- a/engines/m4/adv_db_r/db_catalog.h
+++ b/engines/m4/adv_db_r/db_catalog.h
@@ -50,7 +50,7 @@ extern char *db_get_catalog();
* if path starts or ends with a '\', the '\' characters at those places
* are deleted.
*/
-extern char *db_rmlst_get_asset_room_path(char *s, char *result, int32 *sceneCode);
+extern char *db_rmlst_get_asset_room_path(const char *s, char *result, int32 *sceneCode);
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 603f411cb71..2dc0eb3e07a 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -112,75 +112,20 @@ struct SceneDef {
int32 numRailNodes = 0; // # of rails
};
-struct Player {
- int32 x = 0, y = 0; // Player's current screen location
- int32 facing = 0; // Player's current directional facing
-
- char verb[MAX_PLYR_STRING_LEN] = { 0 };
- char noun[MAX_PLYR_STRING_LEN] = { 0 };
- char prep[MAX_PLYR_STRING_LEN] = { 0 };
- char object[MAX_PLYR_STRING_LEN] = { 0 };
- char ws_asset_name[32] = { 0 };
- char ws_shadow_name[32] = { 0 };
- int16 walker_type = 0; // Type of walker (ripley, mei_chin, safari, etc.)
- int16 shadow_type = 0; // Type of walker (ripley shadow, candleman shadow, etc.)
-
- // If he walks off edge, this holds the number of the room he goes to
- int32 walk_off_edge_to_room; // Player should walk off edge unless told otherwise
-
- // if false player won't walk - totally aborts a walk
- bool need_to_walk = false; // Player needs to walk somewhere
-
- // if FALSE player won't walk yet - walk suspended until TRUE
- bool ready_to_walk = false; // Player is ready to perform that walk
-
- bool waiting_for_walk = false;
-
- // Default TRUE for every room
- // Flag if accepting player input
- bool comm_allowed = true;
-
- // Means a parser command is ready. When apps programmer finishes
- // parsing command, the programmer must set this to FALSE. If this
- // doesn't get set, the command falls through to the error handling code.
- int32 command_ready = 0;
-
- // Default TRUE, if set to FALSE walker disappears instantly, and vv
- bool walker_visible = false; // Flag if player's sprite is visible
-
- // if TRUE, then apps programmer must display look messages
- bool look_around = false; // Flag for special "look around" command
-
- // Tested by the apps programmer to check if player has been here before
- bool been_here_before = false;
-
- // Walker sprites dumped on switching scenes if TRUE in room preload code
- bool walker_reload_palette = false;
- bool disable_hyperwalk = false;
- bool walker_loads_first = false;
- bool walker_in_this_scene = false;
-
- int32 walker_trigger = false;
-
- int32 walk_x = 0, walk_y = 0; // where to walk to when player.ready_to_walk
- int32 walk_facing = 0;
-
- int32 click_x = 0, click_y = 0;
-};
-
struct GameControl {
uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
int32 digi_overall_volume_percent;
int32 midi_overall_volume_percent;
- bool camera_pan_instant;
-
- int16 room_id;
- int16 new_room;
- int16 previous_section;
- int16 section_id;
- int16 new_section;
- int16 previous_room;
+ bool camera_pan_instant = false;
+ bool going = false;
+
+ int16 room_id = 0;
+ int16 new_room = 0;
+ int16 previous_section = 0;
+ int16 section_id = 0;
+ int16 new_section = 0;
+ int16 previous_room = 0;
};
} // namespace M4
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
new file mode 100644
index 00000000000..bf98dfb6c5e
--- /dev/null
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -0,0 +1,154 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_player.h"
+#include "m4/adv_r/adv_walk.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/gui/gui_vmng_core.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+bool player_said(const char *w0, const char *w1, const char *w2) {
+ const char *ptrs[3] = { w0, w1, w2 };
+
+ for (int i = 0; i < 3; i++) {
+ if (ptrs[i])
+ if ((scumm_strnicmp(_G(player).noun, ptrs[i], MAX_PLYR_STRING_LEN))
+ && (scumm_strnicmp(_G(player).object, ptrs[i], MAX_PLYR_STRING_LEN))
+ && (scumm_strnicmp(_G(player).verb, ptrs[i], MAX_PLYR_STRING_LEN)))
+ return false;
+ }
+
+ return true;
+}
+
+bool player_said_any(const char *w0, const char *w1, const char *w2,
+ const char *w3, const char *w4, const char *w5, const char *w6,
+ const char *w7, const char *w8, const char *w9) {
+ const char *ptrs[10] = { w0, w1, w2, w3, w4, w5, w6, w7, w8, w9 };
+
+ for (int i = 0; i < 10; i++) {
+ if (ptrs[i]) {
+ if (!scumm_strnicmp(_G(player).noun, ptrs[i], MAX_PLYR_STRING_LEN))
+ return true;
+ if (!scumm_strnicmp(_G(player).object, ptrs[i], MAX_PLYR_STRING_LEN))
+ return true;
+ if (!scumm_strnicmp(_G(player).verb, ptrs[i], MAX_PLYR_STRING_LEN))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int32 backS) {
+ _G(globals)[GLB_MIN_Y] = backY << 16;
+ _G(globals)[GLB_MAX_Y] = frontY << 16;
+ _G(globals)[GLB_MIN_SCALE] = FixedDiv(backS << 16, 100 << 16);
+ _G(globals)[GLB_MAX_SCALE] = FixedDiv(frontS << 16, 100 << 16);
+ if (_G(globals)[GLB_MIN_Y] == _G(globals)[GLB_MAX_Y])
+ _G(globals)[GLB_SCALER] = 0;
+ else
+ _G(globals)[GLB_SCALER] = FixedDiv(_G(globals)[GLB_MAX_SCALE] - _G(globals)[GLB_MIN_SCALE], _G(globals)[GLB_MAX_Y] - _G(globals)[GLB_MIN_Y]);
+}
+
+
+// this routine must also load shadow animations
+
+bool player_load_series(const char *walkerName, const char *shadowName, bool load_palette) {
+ int i;
+ int32 thatRoomCode;
+ char assetPath[MAX_FILENAME_SIZE];
+ char *tempPtr;
+
+ //LOAD WALKER
+ db_rmlst_get_asset_room_path(walkerName, assetPath, &thatRoomCode);
+ tempPtr = strrchr(assetPath, '.');
+ if (!tempPtr)
+ return false;
+
+ tempPtr--;
+ if ((*tempPtr < '0') || (*tempPtr > '9'))
+ return false;
+
+ for (i = 1; i <= 5; i++) {
+ *tempPtr = (char)((int32)'0' + i);
+ //env_get_path(fullPath, thatRoomCode, assetPath);
+ AddWSAssetCELS(assetPath, i - 1, load_palette ? _G(master_palette) : nullptr);
+ }
+
+ //LOAD WALKER SHADOW
+ db_rmlst_get_asset_room_path(shadowName, assetPath, &thatRoomCode);
+ tempPtr = strrchr(assetPath, '.');
+ if (!tempPtr)
+ return false;
+
+ tempPtr--;
+ if ((*tempPtr < '0') || (*tempPtr > '9'))
+ return false;
+
+ for (i = 1; i <= 5; i++) {
+ *tempPtr = (char)((int32)'0' + i);
+ AddWSAssetCELS(assetPath, i + 4, nullptr);
+ }
+
+ SendWSMessage(0, 0, nullptr, 6, nullptr, 1); // Hash 6 is the shadow machine
+ return true;
+}
+
+void player_first_walk(int32 x1, int32 y1, int32 /*f1*/, int32 x2, int32 y2, int32 /*f2*/, bool /*enable_commands_at_destination*/) {
+ player_demand_location(x1, y1);
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+ _G(player).walk_x = x2;
+ _G(player).walk_y = y2;
+}
+
+void player_set_defaults() {
+ _G(player).walker_visible = false;
+ _G(player).disable_hyperwalk = false;
+ _G(player).walker_loads_first = true;
+ _G(player).walker_reload_palette = true;
+ _G(player).walker_in_this_scene = true;
+}
+
+bool player_commands_allowed() {
+ return _G(player).comm_allowed;
+}
+
+PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info) {
+ if (!myWalker)
+ return nullptr;
+
+ ws_get_walker_info(myWalker, &player_info->x, &player_info->y,
+ &player_info->scale, &player_info->depth, &player_info->facing);
+
+ int32 status;
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+ player_info->camera_x = game_buff_ptr->x1;
+ player_info->camera_y = game_buff_ptr->y1;
+ return player_info;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
new file mode 100644
index 00000000000..74e5f44d7d2
--- /dev/null
+++ b/engines/m4/adv_r/adv_player.h
@@ -0,0 +1,112 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_PLAYER_H
+#define M4_ADV_R_ADV_PLAYER_H
+
+#include "m4/m4_types.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+#define MAX_PLYR_STRING_LEN 40
+
+struct Player {
+ int32 x = 0, y = 0; // Player's current screen location
+ int32 facing = 0; // Player's current directional facing
+
+ char verb[MAX_PLYR_STRING_LEN] = { 0 };
+ char noun[MAX_PLYR_STRING_LEN] = { 0 };
+ char prep[MAX_PLYR_STRING_LEN] = { 0 };
+ char object[MAX_PLYR_STRING_LEN];
+ char ws_asset_name[32] = { 0 }; // Name of the walker sprite series holder
+ char ws_shadow_name[32] = { 0 }; // Name of the walker sprite series shadow holder
+ int16 walker_type = 0; // Type of walker (ripley, mei_chin, safari, etc.)
+ int16 shadow_type = 0; // Type of walker (ripley shadow, candleman shadow, etc.)
+
+ // If he walks off edge, this holds the number of the room he goes to
+ int32 walk_off_edge_to_room = 0; // Player should walk off edge unless told otherwise
+
+ // If False player won't walk - totally aborts a walk
+ bool need_to_walk = false; // Player needs to walk somewhere
+
+ // If False player won't walk yet - walk suspended until TRUE
+ bool ready_to_walk = false; // Player is ready to perform that walk
+
+ bool waiting_for_walk = false;
+
+ // Default True for every room
+ // Flag if accepting player input
+ bool comm_allowed = false;
+
+ // Means a parser command is ready. When apps programmer finishes
+ // parsing command, the programmer must set this to FALSE. If this
+ // doesn't get set, the command falls through to the error handling code.
+ int32 command_ready = 0;
+
+ // Default True, if set to FALSE walker disappears instantly, and vv
+ bool walker_visible = false; // Flag if player's sprite is visible
+
+ // If True, then apps programmer must display look messages
+ bool look_around = false; // Flag for special "look around" command
+
+ // Tested by the apps programmer to check if player has been here before
+ bool been_here_before = false;
+
+ // Walker sprites dumped on switching scenes if TRUE in room preload code
+ bool walker_reload_palette = false;
+ bool disable_hyperwalk = false;
+ bool walker_loads_first = false;
+ bool walker_in_this_scene = false;
+
+ int32 walker_trigger = 0;
+
+ int32 walk_x = 0, walk_y = 0; // Where to walk to when player.ready_to_walk
+ int32 walk_facing = 0;
+
+ int32 click_x = 0, click_y = 0;
+};
+
+struct PlayerInfo {
+ int32 x = 0, y = 0, facing = 0, scale = 0, depth = 0;
+ int32 camera_x = 0, camera_y = 0;
+};
+
+extern bool player_said(const char *w0, const char *w1 = NULL, const char *w2 = NULL);
+
+extern void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int32 backS);
+
+extern bool player_load_series(const char *walkerName, const char *shadowName, bool load_palette);
+extern void player_first_walk(int32 x1, int32 y1, int32 f1, int32 x2, int32 y2, int32 f2, bool enable_commands_at_destination);
+extern void player_set_commands_allowed(bool t_or_f);
+extern void player_set_defaults();
+extern void player_noun_becomes_verb(int32 spriteNum);
+
+extern void player_hotspot_walk_override(int32 x, int32 y, int32 facing, int32 trigger = -1);
+extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1); //mar4
+
+extern bool player_commands_allowed();
+extern PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
new file mode 100644
index 00000000000..89fcdc3c3fd
--- /dev/null
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -0,0 +1,29 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/ad_walk.h"
+#include "m4/core/errors.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
new file mode 100644
index 00000000000..ff3b2f69edb
--- /dev/null
+++ b/engines/m4/adv_r/adv_walk.h
@@ -0,0 +1,81 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_WALK_H
+#define M4_ADV_R_ADV_WALK_H
+
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+extern void set_walker_scaling(SceneDef *rdef);
+extern bool walker_has_walk_finished(machine *sender);
+extern void ws_demand_location(machine *myWalker, int32 x, int32 y);
+extern void ws_demand_facing(machine *myWalker, int32 newFacing);
+extern void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger);
+extern void ws_nosepick(machine *myWalker, int32 seriesHash);
+
+extern void ws_hide_walker(machine *myWalker);
+extern void ws_unhide_walker(machine *myWalker);
+extern void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing);
+
+extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int32 finalFacing, bool complete_walk = true);
+
+extern bool ws_walk_init_system();
+
+extern bool ws_walk_load_series(int16 *dir_array, char *name_array[], bool shadow_flag, bool load_palette);
+extern bool ws_walk_load_walker_series(int16 *dir_array, char *name_array[], bool load_palette);
+extern bool ws_walk_load_shadow_series(int16 *dir_array, char *name_array[]);
+
+extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
+#define ws_walk_dump_walker_series(xx, yy) (ws_walk_dump_series (xx, yy))
+#define ws_walk_dump_shadow_series(xx, yy) (ws_walk_dump_series (xx, yy))
+
+#define player_walk(xx, yy, ff, tt) (ws_walk(_G(kernel).myWalker, xx, yy, NULL, tt, ff, true))
+#define player_walk_no_finish(xx, yy, ff, tt) (ws_walk(_G(kernel).myWalker, xx, yy, NULL, tt, ff, FALSE))
+#define player_demand_facing(dd) (ws_demand_facing(_G(kernel).myWalker, dd))
+#define player_demand_location(xx, yy) (ws_demand_location(_G(kernel).myWalker, xx, yy))
+#define player_turn_to_face(dd, tt) (ws_turn_to_face(_G(kernel).myWalker, dd, tt))
+#define player_hide() (ws_hide_walker(_G(kernel).myWalker))
+#define player_unhide() (ws_unhide_walker(_G(kernel).myWalker))
+#define player_get_info() (player_update_info(_G(kernel).myWalker, &player_info))
+#define player_nosepick(aa) (ws_nosepick(_G(kernel).myWalker, aa))
+
+
+// New walking stuff
+extern void ws_custom_walk(machine *myWalker, int32 finalFacing, int32 trigger, bool complete_walk = true);
+#define adv_walker_custom_walk(ww, ff, tt) (ws_custom_walk(ww, ff, tt, true))
+#define adv_walker_custom_walk_no_finish(ww, ff, tt) (ws_custom_walk(ww, ff, tt, FALSE))
+#define adv_walker_walk(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, NULL, tt, ff, true))
+#define adv_walker_walk_no_finish(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, NULL, tt, ff, FALSE))
+#define adv_walker_face(ww, dd) (ws_demand_facing(ww, dd))
+#define adv_walker_turn_to_face(ww, dd, tt) (ws_turn_to_face(ww, dd, tt))
+#define adv_walker_move(ww, xx, yy) (ws_demand_location(ww, xx, yy))
+#define adv_walker_hide(ww) (ws_hide_walker(ww))
+#define adv_walker_unhide(ww) (ws_unhide_walker(ww))
+extern bool adv_walker_path_exists(machine *myWalker, int32 x, int32 y);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index 2212629cec2..d2d76de529e 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -87,12 +87,12 @@ void BurgerGlobals::main_cold_data_init() {
initMouseSeries("cursor", nullptr);
_kernel.first_fade = 32;
- debugC(1, kDebugCore, "executing - %s", GAME_MODES[_gameMode]);
+ debugC(1, kDebugCore, "executing - %s", GAME_MODES[_executing]);
// Set up game mode and starting room
- _gameMode = WHOLE_GAME;
+ _executing = WHOLE_GAME;
- switch (_gameMode) {
+ switch (_executing) {
case JUST_OVERVIEW:
_game.new_room = 971; // Burger overview starts right in at 971
break;
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 7b99fba4f3c..f3b76835dba 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -49,7 +49,7 @@ protected:
public:
Burger::Vars _vars;
- GameMode _gameMode = WHOLE_GAME;
+ GameMode _executing = WHOLE_GAME;
int _wilburTerm = 2;
Interface _interface;
Common::String _wilbur = "WILBUR";
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
new file mode 100644
index 00000000000..c0917ee85a3
--- /dev/null
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/gui/game_menu.h"
+#include "m4/adv_r/adv_player.h"
+#include "m4/burger/interface.h"
+#include "m4/burger/burger_globals.h"
+
+namespace M4 {
+namespace Burger {
+
+void CreateGameMenu(RGB8 *myPalette) {
+#ifdef TODO
+ if ((!player_commands_allowed()) || (!interface_visible) ||
+ pal_fade_in_progress || menuSystemInitialized) {
+ return;
+ }
+ gameMenuFromMain = FALSE;
+ CreateGameMenuMain(myPalette);
+#else
+ error("TODO: CreateGameMenu");
+#endif
+}
+
+void CreateGameMenuFromMain(RGB8 *myPalette) {
+#ifdef TODO
+ if (pal_fade_in_progress || menuSystemInitialized) {
+ return;
+ }
+ gameMenuFromMain = TRUE;
+ CreateGameMenuMain(myPalette);
+#else
+ error("TODO: CreateGameMenuFromMain");
+#endif
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
new file mode 100644
index 00000000000..15d1bb64cb3
--- /dev/null
+++ b/engines/m4/burger/gui/game_menu.h
@@ -0,0 +1,39 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_GUI_GAME_MENU_H
+#define M4_BURGER_GUI_GAME_MENU_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+namespace GUI {
+
+extern void CreateGameMenu(RGB8 *myPalette);
+extern void CreateGameMenuFromMain(RGB8 *myPalette);
+
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
new file mode 100644
index 00000000000..c805fa0ec9d
--- /dev/null
+++ b/engines/m4/burger/hotkeys.cpp
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/hotkeys.h"
+#include "m4/burger/burger_globals.h"
+#include "m4/burger/gui/game_menu.h"
+#include "m4/burger/other.h"
+
+namespace M4 {
+namespace Burger {
+
+void escape_key_pressed(void *, void *) {
+ // Decide what to do depending on what kind of game is playing
+ switch (_G(executing)) {
+ case JUST_OVERVIEW:
+ // Stop playing the overview
+ _G(game).going = false;
+ break;
+
+ case INTERACTIVE_DEMO:
+ case MAGAZINE_DEMO:
+ if (_G(game).room_id == 901) {
+ // Already on the demo menu screen, so quit game
+ _G(game).going = false;
+ } else {
+ // In-game, so go back to demo menu screen
+ _G(game).new_section = 9;
+ _G(game).new_room = 901;
+ }
+ break;
+
+ case WHOLE_GAME:
+ // The real thing is playing
+ switch (_G(game).room_id) {
+ case 902:
+ case 904:
+ case 951:
+ case 971:
+ // Switch to main menu
+ _G(game).new_section = 9;
+ _G(game).new_room = 901;
+ break;
+
+ case 903:
+ // Quit game
+ _G(game).going = false;
+ break;
+
+ default:
+ if (player_commands_allowed()) {
+ // Bring up the main menu
+ other_save_game_for_resurrection();
+ GUI::CreateGameMenu(&_G(master_palette)[0]);
+ }
+ break;
+ }
+ break;
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
new file mode 100644
index 00000000000..e9024bbf1ef
--- /dev/null
+++ b/engines/m4/burger/hotkeys.h
@@ -0,0 +1,41 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_HOTKEYS_H
+#define M4_BURGER_HOTKEYS_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+struct Hotkeys {
+ /**
+ * Called when the Escape key is pressed
+ */
+ static void escape_key_pressed(void *, void *);
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/interface.cpp b/engines/m4/burger/interface.cpp
index 5e70add57d8..84fb43c2232 100644
--- a/engines/m4/burger/interface.cpp
+++ b/engines/m4/burger/interface.cpp
@@ -80,7 +80,7 @@ void Interface::setup() {
_interfaceBox->add(_btnHandle);
- if (_G(gameMode) == WHOLE_GAME) {
+ if (_G(executing) == WHOLE_GAME) {
_btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71);
_btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78);
_interfaceBox->add(_btnAbductFail);
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
new file mode 100644
index 00000000000..68b51ea8165
--- /dev/null
+++ b/engines/m4/burger/other.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 "m4/burger/other.h"
+#include "m4/burger/burger_globals.h"
+#include "m4/adv_r/adv_file.h"
+#include "m4/core/errors.h"
+
+namespace M4 {
+namespace Burger {
+
+
+void other_save_game_for_resurrection(void) {
+ if (kernel_save_game(0, NULL, 0, NULL, 0)) {
+ error_show(FL, 0, "couldn't other_save_game_for_res");
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/other.h b/engines/m4/burger/other.h
new file mode 100644
index 00000000000..ae2ea4fffff
--- /dev/null
+++ b/engines/m4/burger/other.h
@@ -0,0 +1,36 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_OTHER_H
+#define M4_BURGER_OTHER_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+extern void other_save_game_for_resurrection();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 5ed465070b7..83687e15498 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -151,7 +151,7 @@ void Vars::reset2() {
(*this)[V277] = 6000;
(*this)[V278] = 0;
- if (_G(gameMode) != WHOLE_GAME) {
+ if (_G(executing) != WHOLE_GAME) {
inv_give_to_player("BLOCK OF ICE");
inv_give_to_player("PANTYHOSE");
}
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index c87509c3217..0d7d837dac5 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -28,6 +28,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_inv.h"
+#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
#include "m4/core/mouse.h"
#include "m4/fileio/fstream.h"
@@ -47,6 +48,53 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
+enum {
+ GLB_TIME = 0,
+ GLB_WATCH_DOG = 1,
+ GLB_MIN_Y = 2,
+ GLB_MAX_Y = 3,
+ GLB_MIN_SCALE = 4,
+ GLB_MAX_SCALE = 5,
+ GLB_SCALER = 6,
+
+ GLB_TEMP_1 = 7,
+ GLB_TEMP_2 = 8,
+ GLB_TEMP_3 = 9,
+ GLB_TEMP_4 = 10,
+ GLB_TEMP_5 = 11,
+ GLB_TEMP_6 = 12,
+ GLB_TEMP_7 = 13,
+ GLB_TEMP_8 = 14,
+ GLB_TEMP_9 = 15,
+ GLB_TEMP_10 = 16,
+ GLB_TEMP_11 = 17,
+ GLB_TEMP_12 = 18,
+ GLB_TEMP_13 = 19,
+ GLB_TEMP_14 = 20,
+ GLB_TEMP_15 = 21,
+ GLB_TEMP_16 = 22,
+ GLB_TEMP_17 = 23,
+ GLB_TEMP_18 = 24,
+ GLB_TEMP_19 = 25,
+ GLB_TEMP_20 = 26,
+ GLB_TEMP_21 = 27,
+ GLB_TEMP_22 = 28,
+ GLB_TEMP_23 = 29,
+ GLB_TEMP_24 = 30,
+ GLB_TEMP_25 = 31,
+ GLB_TEMP_26 = 32,
+ GLB_TEMP_27 = 33,
+ GLB_TEMP_28 = 34,
+ GLB_TEMP_29 = 35,
+ GLB_TEMP_30 = 36,
+ GLB_TEMP_31 = 37,
+ GLB_TEMP_32 = 38,
+
+ GLB_SCRATCH_VARS = 7, // 19-16 globals reserved for the compiler
+ GLB_USER_VARS = 17 // 17+ globals for the applications programmer
+};
+constexpr int GLOB_COUNT = 39;
+
class Globals;
extern Globals *g_globals;
@@ -79,6 +127,7 @@ public:
SceneDef _currentSceneDef;
Scene_list _scene_list;
frac16 _globals[GLB_SHARED_VARS];
+ Player _player;
Resources _resources;
Rails_Globals _rails;
Catalog _catalog;
@@ -102,6 +151,7 @@ public:
InventoryBase *_inventory = nullptr;
size_t _mem_to_alloc = 0;
void *_gameInterfaceBuff = nullptr;
+ GrBuff *_gameDrawBuff = nullptr;
void *_custom_interface_setup = nullptr;
void *_custom_interface_button_handler = nullptr;
int _global_sound_room = 0;
diff --git a/engines/m4/kernel.h b/engines/m4/kernel.h
index aa54b0049bd..532688c106c 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/kernel.h
@@ -42,7 +42,6 @@ struct Kernel {
char save_file_name[8] = { 0 };
bool restore_game = false; // TRUE if we wanna restore
- bool force_restart = false; // Forces restart of room if true
bool teleported_in = false; // Flag if player teleported to room
int32 fade_up_time = 0;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 80989d990d3..9a8d617c903 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS = \
adv_r/adv_control.o \
adv_r/adv_file.o \
adv_r/adv_inv.o \
+ adv_r/adv_player.o \
adv_r/adv_rails.o \
adv_r/adv_trigger.o \
adv_r/db_env.o \
@@ -56,11 +57,14 @@ MODULE_OBJS = \
wscript/ws_machine.o \
wscript/ws_timer.o \
wscript/wscript.o \
+ burger/gui/game_menu.o \
burger/burger.o \
burger/burger_globals.o \
burger/gui_cheapo.o \
+ burger/hotkeys.o \
burger/interface.o \
burger/inventory.o \
+ burger/other.o \
burger/vars.o
# This module can be built as a plugin
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index c28645f4a73..960f83278c0 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -150,7 +150,13 @@ static void clear_persistent_msg_list(machine *m) {
nextMsg = nextMsg->nextMsg;
dispose_msgRequest(freeMsg);
}
+
m->usedPersistentMsgs = NULL;
}
+void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
+ uint32 machHash, machine *sendM, int32 msgCount) {
+ error("TODO: SendWSMessage");
+}
+
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 1fad0efacf9..abf904cd647 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -161,6 +161,12 @@ extern bool ws_Initialize(frac16 *theGlobals);
extern void ws_Shutdown();
extern void TerminateMachinesByHash(int32 machHash);
+/**
+ * This proc is what allows a machine to send a message to another machine(s)
+ */
+extern void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
+ uint32 machHash, machine *sendM, int32 msgCount);
+
} // End of namespace M4
#endif
Commit: 7f39b6a0a140b34537140ea6dddd9df152f8044b
https://github.com/scummvm/scummvm/commit/7f39b6a0a140b34537140ea6dddd9df152f8044b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move gui_cheapo & interface into Burger::GUI namespace
Changed paths:
A engines/m4/burger/gui/gui_cheapo.cpp
A engines/m4/burger/gui/gui_cheapo.h
A engines/m4/burger/gui/interface.cpp
A engines/m4/burger/gui/interface.h
R engines/m4/burger/gui_cheapo.cpp
R engines/m4/burger/gui_cheapo.h
R engines/m4/burger/interface.cpp
R engines/m4/burger/interface.h
engines/m4/burger/burger_globals.h
engines/m4/burger/gui/game_menu.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index f3b76835dba..56358dde230 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -23,7 +23,7 @@
#define M4_BURGER_BURGER_GLOBALS_H
#include "m4/globals.h"
-#include "m4/burger/interface.h"
+#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/vars.h"
@@ -51,7 +51,7 @@ public:
Burger::Vars _vars;
GameMode _executing = WHOLE_GAME;
int _wilburTerm = 2;
- Interface _interface;
+ GUI::Interface _interface;
Common::String _wilbur = "WILBUR";
public:
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index c0917ee85a3..484d346d3e8 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -20,8 +20,8 @@
*/
#include "m4/burger/gui/game_menu.h"
+#include "m4/burger/gui/interface.h"
#include "m4/adv_r/adv_player.h"
-#include "m4/burger/interface.h"
#include "m4/burger/burger_globals.h"
namespace M4 {
diff --git a/engines/m4/burger/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
similarity index 99%
rename from engines/m4/burger/gui_cheapo.cpp
rename to engines/m4/burger/gui/gui_cheapo.cpp
index 3701fd830a9..ea306226e5a 100644
--- a/engines/m4/burger/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/gui_cheapo.h"
+#include "m4/burger/gui/gui_cheapo.h"
#include "m4/gui/gui_vmng_core.h"
#include "m4/gui/gui_vmng_screen.h"
#include "m4/graphics/gr_font.h"
diff --git a/engines/m4/burger/gui_cheapo.h b/engines/m4/burger/gui/gui_cheapo.h
similarity index 100%
rename from engines/m4/burger/gui_cheapo.h
rename to engines/m4/burger/gui/gui_cheapo.h
diff --git a/engines/m4/burger/interface.cpp b/engines/m4/burger/gui/interface.cpp
similarity index 97%
rename from engines/m4/burger/interface.cpp
rename to engines/m4/burger/gui/interface.cpp
index 84fb43c2232..a4130589175 100644
--- a/engines/m4/burger/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -19,15 +19,14 @@
*
*/
-#include "m4/burger/interface.h"
+#include "m4/burger/gui/interface.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
#include "m4/burger/burger_globals.h"
namespace M4 {
namespace Burger {
-
-using namespace Burger::GUI;
+namespace GUI {
void Interface::init(int arrow, int wait, int look, int grab, int use) {
_arrow = arrow;
@@ -97,5 +96,6 @@ void Interface::setup() {
_interfaceBox->add(_btnScrollRight);
}
+} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/interface.h b/engines/m4/burger/gui/interface.h
similarity index 96%
rename from engines/m4/burger/interface.h
rename to engines/m4/burger/gui/interface.h
index d53a44ca722..bfa2be8cc1e 100644
--- a/engines/m4/burger/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -26,10 +26,11 @@
#include "m4/m4_types.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
-#include "m4/burger/gui_cheapo.h"
+#include "m4/burger/gui/gui_cheapo.h"
namespace M4 {
namespace Burger {
+namespace GUI {
struct Interface {
private:
@@ -65,6 +66,7 @@ public:
void show();
};
+} // namespace Interface
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9a8d617c903..e0c3fc61dcf 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -58,11 +58,11 @@ MODULE_OBJS = \
wscript/ws_timer.o \
wscript/wscript.o \
burger/gui/game_menu.o \
+ burger/gui/gui_cheapo.o \
+ burger/gui/interface.o \
burger/burger.o \
burger/burger_globals.o \
- burger/gui_cheapo.o \
burger/hotkeys.o \
- burger/interface.o \
burger/inventory.o \
burger/other.o \
burger/vars.o
Commit: 86a5d004b21fa2c7d4691bad8ef4b7d4ed335122
https://github.com/scummvm/scummvm/commit/86a5d004b21fa2c7d4691bad8ef4b7d4ed335122
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton Hotkeys class to hold all hotkey methods
Changed paths:
A engines/m4/gui/hotkeys.cpp
A engines/m4/gui/hotkeys.h
engines/m4/burger/burger_globals.h
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/game_menu.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index 56358dde230..e8e1f552130 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -52,7 +52,9 @@ public:
GameMode _executing = WHOLE_GAME;
int _wilburTerm = 2;
GUI::Interface _interface;
- Common::String _wilbur = "WILBUR";
+ const Common::String _wilbur = "WILBUR";
+ bool _menuSystemInitialized = false;
+ bool _gameMenuFromMain = false;
public:
BurgerGlobals();
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 484d346d3e8..cbb6f7cf5f4 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -27,29 +27,23 @@
namespace M4 {
namespace Burger {
+void CreateGameMenuMain(RGB8 *myPalette) {
+ error("TODO: CreateGameMenuMain");
+}
+
void CreateGameMenu(RGB8 *myPalette) {
-#ifdef TODO
- if ((!player_commands_allowed()) || (!interface_visible) ||
- pal_fade_in_progress || menuSystemInitialized) {
- return;
+ if (player_commands_allowed() && _GI(visible) && !_G(pal_fade_in_progress)
+ && !_G(menuSystemInitialized)) {
+ _G(gameMenuFromMain) = false;
+ CreateGameMenuMain(myPalette);
}
- gameMenuFromMain = FALSE;
- CreateGameMenuMain(myPalette);
-#else
- error("TODO: CreateGameMenu");
-#endif
}
void CreateGameMenuFromMain(RGB8 *myPalette) {
-#ifdef TODO
- if (pal_fade_in_progress || menuSystemInitialized) {
- return;
+ if (!_G(pal_fade_in_progress) && _G(menuSystemInitialized)) {
+ _G(gameMenuFromMain) = true;
+ CreateGameMenuMain(myPalette);
}
- gameMenuFromMain = TRUE;
- CreateGameMenuMain(myPalette);
-#else
- error("TODO: CreateGameMenuFromMain");
-#endif
}
} // namespace Burger
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 15d1bb64cb3..0d769fdb645 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -31,6 +31,7 @@ namespace GUI {
extern void CreateGameMenu(RGB8 *myPalette);
extern void CreateGameMenuFromMain(RGB8 *myPalette);
+extern void CreateGameMenuMain(RGB8 *myPalette);
} // namespace GUI
} // namespace Burger
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index 775a633d294..ffa9739cdf6 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -40,6 +40,7 @@ Globals *g_globals;
Globals::Globals() {
g_globals = this;
+ _cheating_enabled = gDebugLevel > 0;
}
Globals::~Globals() {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 0d7d837dac5..1bddda0ce43 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -135,6 +135,7 @@ public:
Dialog_Globals _dialog;
Item_Globals _items;
+ bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
@@ -171,6 +172,7 @@ public:
int32 _requests[_MEMTYPE_LIMIT] = { 0 };
void *_memBlock[_MEMTYPE_LIMIT] = { nullptr };
RGB8 _master_palette[256];
+ bool _pal_fade_in_progress = false;
strmRequest *_firstStream = nullptr;
strmRequest *_lastStream = nullptr;
InvPal *_inverse_pal = nullptr;
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
new file mode 100644
index 00000000000..aa3dfae5a5c
--- /dev/null
+++ b/engines/m4/gui/hotkeys.cpp
@@ -0,0 +1,344 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/hotkeys.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/events/keys.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void Hotkeys::restore_hot_keys() {
+ AddSystemHotkey(KEY_HOME, capture_wrap);
+ AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
+ AddSystemHotkey(KEY_PAGE_DOWN, debug_memory_prev_column);
+ AddSystemHotkey(KEY_END, debug_memory_last_column);
+
+ AddSystemHotkey(KEY_ALT_UP, player_step_up);
+ AddSystemHotkey(KEY_ALT_DOWN, player_step_down);
+ AddSystemHotkey(KEY_ALT_LEFT, player_step_left);
+ AddSystemHotkey(KEY_ALT_RIGHT, player_step_right);
+
+ AddSystemHotkey(KEY_CTRL_UP, player_jump_up);
+ AddSystemHotkey(KEY_CTRL_DOWN, player_jump_down);
+ AddSystemHotkey(KEY_CTRL_LEFT, player_jump_left);
+ AddSystemHotkey(KEY_CTRL_RIGHT, player_jump_right);
+
+ AddSystemHotkey(KEY_F4, term_next_mode);
+
+ AddSystemHotkey('[', camera_step_left);
+ AddSystemHotkey(']', camera_step_right);
+ AddSystemHotkey('{', camera_jump_left);
+ AddSystemHotkey('}', camera_jump_right);
+
+ //AddSystemHotkey( KEY_ALT_B, toggle_inv_visible);
+ AddSystemHotkey(KEY_ALT_C, toggle_commands_allowed);
+ AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
+ AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
+ AddSystemHotkey(KEY_ALT_G, change_global_var);
+ AddSystemHotkey(KEY_ALT_I, cb_MouseDialog);
+ AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects); // was O
+ AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
+ AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
+ AddSystemHotkey(KEY_ALT_R, f_io_report);
+ AddSystemHotkey(KEY_ALT_S, scale_editor_toggle);
+ AddSystemHotkey(KEY_ALT_T, teleport);
+ AddSystemHotkey(KEY_ALT_W, paint_walk_codes);
+ AddSystemHotkey(KEY_ALT_Z, pal_override);
+}
+
+void Hotkeys::disable_hot_keys() {
+ RemoveSystemHotkey(KEY_HOME);
+ RemoveSystemHotkey(KEY_PAGE_UP);
+ RemoveSystemHotkey(KEY_PAGE_DOWN);
+ RemoveSystemHotkey(KEY_END);
+
+ RemoveSystemHotkey(KEY_ALT_UP);
+ RemoveSystemHotkey(KEY_ALT_DOWN);
+ RemoveSystemHotkey(KEY_ALT_LEFT);
+ RemoveSystemHotkey(KEY_ALT_RIGHT);
+
+ RemoveSystemHotkey(KEY_CTRL_UP);
+ RemoveSystemHotkey(KEY_CTRL_DOWN);
+ RemoveSystemHotkey(KEY_CTRL_LEFT);
+ RemoveSystemHotkey(KEY_CTRL_RIGHT);
+
+ RemoveSystemHotkey(KEY_F4);
+
+ RemoveSystemHotkey('[');
+ RemoveSystemHotkey(']');
+ RemoveSystemHotkey('{');
+ RemoveSystemHotkey('}');
+
+ //RemoveSystemHotkey( KEY_ALT_B);
+ RemoveSystemHotkey(KEY_ALT_C);
+ RemoveSystemHotkey(KEY_ALT_D);
+ RemoveSystemHotkey(KEY_ALT_F);
+ RemoveSystemHotkey(KEY_ALT_G);
+ RemoveSystemHotkey(KEY_ALT_I);
+ RemoveSystemHotkey(KEY_ALT_B);
+ RemoveSystemHotkey(KEY_ALT_M);
+ RemoveSystemHotkey(KEY_ALT_P);
+ RemoveSystemHotkey(KEY_ALT_R);
+ RemoveSystemHotkey(KEY_ALT_S);
+ RemoveSystemHotkey(KEY_ALT_T);
+ RemoveSystemHotkey(KEY_ALT_W);
+ RemoveSystemHotkey(KEY_ALT_Z);
+}
+
+void Hotkeys::add_hot_keys() {
+ AddSystemHotkey(KEY_F2, cb_F2);
+ AddSystemHotkey(KEY_F3, cb_F3);
+
+ AddSystemHotkey('t', t_cb);
+ AddSystemHotkey('u', u_cb);
+ AddSystemHotkey('l', l_cb);
+
+ AddSystemHotkey('T', t_cb);
+ AddSystemHotkey('U', u_cb);
+ AddSystemHotkey('L', l_cb);
+
+ AddSystemHotkey('A', l_cb);
+ AddSystemHotkey('S', t_cb);
+ AddSystemHotkey('D', u_cb);
+ AddSystemHotkey('F', adv_hyperwalk_to_final_destination);
+ AddSystemHotkey('a', l_cb);
+ AddSystemHotkey('s', t_cb);
+ AddSystemHotkey('d', u_cb);
+ AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
+
+ AddSystemHotkey(KEY_ALT_V, show_version);
+ AddSystemHotkey(KEY_CTRL_V, show_version);
+ AddSystemHotkey(KEY_ALT_X, exit_program);
+ AddSystemHotkey(KEY_CTRL_X, exit_program);
+ AddSystemHotkey(KEY_ALT_Q, exit_program);
+ AddSystemHotkey(KEY_CTRL_Q, exit_program);
+ AddSystemHotkey(KEY_SPACE, adv_hyperwalk_to_final_destination);
+
+ if (_G(cheating_enabled)) {
+ adv_enable_system_hot_keys();
+ }
+}
+
+void Hotkeys::adv_enable_system_hot_keys(void) {
+ term_message("System Cheats On");
+
+ AddSystemHotkey(KEY_HOME, capture_wrap);
+ AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
+ AddSystemHotkey(KEY_PAGE_DOWN, debug_memory_prev_column);
+ AddSystemHotkey(KEY_END, debug_memory_last_column);
+
+ AddSystemHotkey(KEY_ALT_UP, player_step_up);
+ AddSystemHotkey(KEY_ALT_DOWN, player_step_down);
+ AddSystemHotkey(KEY_ALT_LEFT, player_step_left);
+ AddSystemHotkey(KEY_ALT_RIGHT, player_step_right);
+
+ AddSystemHotkey(KEY_CTRL_UP, player_jump_up);
+ AddSystemHotkey(KEY_CTRL_DOWN, player_jump_down);
+ AddSystemHotkey(KEY_CTRL_LEFT, player_jump_left);
+ AddSystemHotkey(KEY_CTRL_RIGHT, player_jump_right);
+
+ AddSystemHotkey(KEY_F4, term_next_mode);
+
+ AddSystemHotkey('[', camera_step_left);
+ AddSystemHotkey(']', camera_step_right);
+ AddSystemHotkey('{', camera_jump_left);
+ AddSystemHotkey('}', camera_jump_right);
+
+ AddSystemHotkey(KEY_ALT_B, toggle_inv_visible);
+ AddSystemHotkey(KEY_ALT_C, toggle_commands_allowed);
+ AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
+ AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
+ AddSystemHotkey(KEY_ALT_G, change_global_var);
+ AddSystemHotkey(KEY_ALT_I, (HotkeyCB)cb_MouseDialog);
+ AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects); // was O
+ AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
+ AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
+ AddSystemHotkey(KEY_ALT_R, f_io_report);
+ AddSystemHotkey(KEY_ALT_S, scale_editor_toggle);
+ AddSystemHotkey(KEY_ALT_T, teleport);
+ AddSystemHotkey(KEY_ALT_W, paint_walk_codes);
+ AddSystemHotkey(KEY_ALT_Z, pal_override);
+}
+
+void Hotkeys::exit_program(void *, void *) {
+ _G(kernel).going = false;
+}
+
+void Hotkeys::cb_F2(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::cb_F3(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::show_version(void *a, void *b) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::version_ok_button(void *a, void *b) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::t_cb(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::u_cb(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::l_cb(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::a_cb(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::f_io_report(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::capture_wrap(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::debug_memory_next_column(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::debug_memory_prev_column(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::debug_memory_last_column(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_step_up(void *, void *) {}
+
+void Hotkeys::player_step_down(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_step_left(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_step_right(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_jump_up(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_jump_down(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_jump_left(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::player_jump_right(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::term_next_mode(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::camera_step_left(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::camera_step_right(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::camera_jump_left(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::camera_jump_right(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::toggle_inv_visible(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::toggle_commands_allowed(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::debug_memory_dumpcore_to_disk(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::dbg_mem_set_search(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::change_global_var(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::cb_MouseDialog(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::other_cheat_with_inventory_objects(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::debug_memory_toggle(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::dbg_pal_toggle(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::scale_editor_toggle(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::teleport(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::paint_walk_codes(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+void Hotkeys::pal_override(void *, void *) {
+ warning("TODO: hotkey");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
new file mode 100644
index 00000000000..2b17c556fa5
--- /dev/null
+++ b/engines/m4/gui/hotkeys.h
@@ -0,0 +1,90 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_HOTKEYS_H
+#define M4_GUI_HOTKEYS_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct Hotkeys {
+private:
+ static void adv_enable_system_hot_keys();
+
+private:
+ static void exit_program(void *, void *);
+ static void cb_F2(void *, void *);
+ static void cb_F3(void *, void *);
+ static void show_version(void *a, void *b);
+ static void version_ok_button(void *a, void *b);
+ static void t_cb(void *, void *);
+ static void u_cb(void *, void *);
+ static void l_cb(void *, void *);
+ static void a_cb(void *, void *);
+ static void adv_hyperwalk_to_final_destination(void *a, void *b);
+ static void capture_wrap(void *, void *);
+ static void debug_memory_next_column(void *, void *);
+ static void debug_memory_prev_column(void *, void *);
+ static void debug_memory_last_column(void *, void *);
+
+ static void player_step_up(void *, void *);
+ static void player_step_down(void *, void *);
+ static void player_step_left(void *, void *);
+ static void player_step_right(void *, void *);
+
+ static void player_jump_up(void *, void *);
+ static void player_jump_down(void *, void *);
+ static void player_jump_left(void *, void *);
+ static void player_jump_right(void *, void *);
+
+ static void term_next_mode(void *, void *);
+
+ static void camera_step_left(void *, void *);
+ static void camera_step_right(void *, void *);
+ static void camera_jump_left(void *, void *);
+ static void camera_jump_right(void *, void *);
+
+ static void toggle_inv_visible(void *, void *);
+ static void toggle_commands_allowed(void *, void *);
+ static void debug_memory_dumpcore_to_disk(void *, void *);
+ static void dbg_mem_set_search(void *, void *);
+ static void change_global_var(void *, void *);
+ static void cb_MouseDialog(void *, void *);
+ static void other_cheat_with_inventory_objects(void *, void *); // was O
+ static void debug_memory_toggle(void *, void *);
+ static void dbg_pal_toggle(void *, void *);
+ static void f_io_report(void *, void *);
+ static void scale_editor_toggle(void *, void *);
+ static void teleport(void *, void *);
+ static void paint_walk_codes(void *, void *);
+ static void pal_override(void *, void *);
+
+public:
+ static void add_hot_keys();
+ static void disable_hot_keys();
+ static void restore_hot_keys();
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 3451626aba0..8dd625ad179 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -28,6 +28,7 @@
#include "graphics/palette.h"
#include "m4/m4.h"
#include "m4/adv_r/adv_control.h"
+#include "m4/gui/hotkeys.h"
#include "m4/detection.h"
#include "m4/console.h"
#include "m4/param.h"
@@ -70,7 +71,8 @@ Common::Error M4Engine::run() {
}
void M4Engine::m4_inflight() {
- // TODO
+ Hotkeys::add_hot_keys();
+
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e0c3fc61dcf..fee21ebfcdc 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -47,6 +47,7 @@ MODULE_OBJS = \
gui/gui_vmng_core.o \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
+ gui/hotkeys.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
Commit: b258c02deafe09b55197aa40531eb882ae4da27c
https://github.com/scummvm/scummvm/commit/b258c02deafe09b55197aa40531eb882ae4da27c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of savegame code
Changed paths:
A engines/m4/adv_r/adv_game.cpp
A engines/m4/adv_r/adv_game.h
A engines/m4/platform/sound.cpp
A engines/m4/platform/sound.h
engines/m4/adv_r/adv.h
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_file.h
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 2dc0eb3e07a..3eaa0e13866 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -33,7 +33,6 @@ namespace M4 {
#define MAXRAILNODES 32
#define PATH_END 0xffff
#define MAX_PLYR_STRING_LEN 40
-#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
#define STR_FADEPAL "fade palette"
#define STR_RAILNODE "rail node"
@@ -112,22 +111,6 @@ struct SceneDef {
int32 numRailNodes = 0; // # of rails
};
-struct GameControl {
- uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
-
- int32 digi_overall_volume_percent;
- int32 midi_overall_volume_percent;
- bool camera_pan_instant = false;
- bool going = false;
-
- int16 room_id = 0;
- int16 new_room = 0;
- int16 previous_section = 0;
- int16 section_id = 0;
- int16 new_section = 0;
- int16 previous_room = 0;
-};
-
} // namespace M4
#endif
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 30673eae064..4b0be0d3628 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -26,13 +26,22 @@
namespace M4 {
-bool kernel_save_game_exists(int32 slot) {
+static Common::SeekableReadStream *openForLoading(int slot) {
Common::String slotName = g_engine->getSaveStateName(slot);
- Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(slotName);
+ return g_system->getSavefileManager()->openForLoading(slotName);
+}
+
+bool kernel_save_game_exists(int32 slot) {
+ Common::SeekableReadStream *save = openForLoading(slot);
bool result = save != nullptr;
delete save;
return result;
}
+bool kernel_load_game(int slot) {
+ return g_engine->loadGameState(slot).getCode() == Common::kNoError;
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_file.h b/engines/m4/adv_r/adv_file.h
index e02f4439865..0ee5d3c9021 100644
--- a/engines/m4/adv_r/adv_file.h
+++ b/engines/m4/adv_r/adv_file.h
@@ -26,35 +26,34 @@
#include "common/stream.h"
#include "m4/adv_r/adv.h"
#include "m4/fileio/sys_file.h"
+#include "m4/graphics/gr_buff.h"
#include "m4/gui/gui.h"
#include "m4/m4_types.h"
namespace M4 {
-M4sprite *kernel_CreateThumbnail(int32 *spriteSize);
-bool kernel_CreateSSFromGrBuff(GrBuff *myBuff, RGB8 *myPalette, bool completePal, const char *ssName);
+extern M4sprite *kernel_CreateThumbnail(int32 *spriteSize);
+extern bool kernel_CreateSSFromGrBuff(GrBuff *myBuff, RGB8 *myPalette, bool completePal, const char *ssName);
-bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff **scr_orig_data, GrBuff **scr_orig);
-void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **loadBuffer);
+extern bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff **scr_orig_data, GrBuff **scr_orig);
+extern void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **loadBuffer);
-int kernel_save_game(Common::SeekableReadStream *save_file, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
-int kernel_save_game(int slot, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
-int kernel_load_game(Common::SeekableReadStream *save_file);
-int kernel_load_game(int slot);
-bool kernel_save_game_exists(int32 slot);
+extern int kernel_save_game(int slot, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
+extern bool kernel_load_game(int slot);
+extern bool kernel_save_game_exists(int32 slot);
-bool kernel_load_variant(char *variant);
-GrBuff *load_codes(SysFile *code_file);
-bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette);
+extern bool kernel_load_variant(char *variant);
+extern GrBuff *load_codes(SysFile *code_file);
+extern bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette);
-bool load_picture_and_codes(SysFile *pic_file, SysFile *code_file,
+extern bool load_picture_and_codes(SysFile *pic_file, SysFile *code_file,
GrBuff **loadBuf, GrBuff **code_data, uint8 minPalEntry, uint8 maxPalEntry);
-bool kernel_load_code_variant(SceneDef *rdef, char *variant, GrBuff **codeData);
+extern bool kernel_load_code_variant(SceneDef *rdef, char *variant, GrBuff **codeData);
-void kernel_current_background_name(char *result);
-void kernel_current_codes_name(char *result);
-void screen_capture(RGB8 *masterPalette);
+extern void kernel_current_background_name(char *result);
+extern void kernel_current_codes_name(char *result);
+extern void screen_capture(RGB8 *masterPalette);
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
new file mode 100644
index 00000000000..2c27608935a
--- /dev/null
+++ b/engines/m4/adv_r/adv_game.cpp
@@ -0,0 +1,30 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_game.h"
+
+namespace M4 {
+
+void GameControl::syncGame(Common::Serializer &s) {
+
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_game.h b/engines/m4/adv_r/adv_game.h
new file mode 100644
index 00000000000..4589ba89cd1
--- /dev/null
+++ b/engines/m4/adv_r/adv_game.h
@@ -0,0 +1,53 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_GAME_H
+#define M4_ADV_R_ADV_GAME_H
+
+#include "common/serializer.h"
+#include "m4/adv_r/adv.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
+
+struct GameControl {
+ uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
+ int16 room_id = 0;
+ int16 new_room = 0;
+ int16 previous_section = 0;
+ int16 section_id = 0;
+ int16 new_section = 0;
+ int16 previous_room = 0;
+
+ int32 digi_overall_volume_percent = 100;
+ int32 midi_overall_volume_percent = 100;
+ bool camera_pan_instant = false;
+ bool going = false;
+
+ void syncGame(Common::Serializer &s);
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 1bddda0ce43..ce568573506 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -27,6 +27,7 @@
#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
+#include "m4/adv_r/adv_game.h"
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
@@ -183,6 +184,7 @@ public:
Dialog *_mousePosDialog = nullptr;
bool _showMousePos = false;
bool _inv_suppress_click_sound = false;
+ bool _between_rooms = false;
};
#define _G(X) (g_globals->_##X)
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 8dd625ad179..c9c0f177e02 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -28,7 +28,9 @@
#include "graphics/palette.h"
#include "m4/m4.h"
#include "m4/adv_r/adv_control.h"
+#include "m4/adv_r/adv_file.h"
#include "m4/gui/hotkeys.h"
+#include "m4/platform/sound.h"
#include "m4/detection.h"
#include "m4/console.h"
#include "m4/param.h"
@@ -73,15 +75,58 @@ Common::Error M4Engine::run() {
void M4Engine::m4_inflight() {
Hotkeys::add_hot_keys();
+ while (_G(game).going) {
+ if (_G(game).previous_room == -2) {
+ midi_stop();
+ kernel_load_game(_G(kernel).restore_slot);
+ }
+#ifdef TODO
+ // Start up next section
+ _G(between_rooms) = true;
+ global_section_constructor();
+ util_exec_function(section_preload_code_pointer);
+ kernel.going = kernel_section_startup();
+ util_exec_function(section_init_code_pointer);
+#endif
+ // TODO
+ }
}
Common::Error M4Engine::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);
+ _G(game).syncGame(s);
+
+#ifdef TODO
+
+ if (!fread(&game, sizeof(GameControl), 1, handle))
+ goto done;
+
+ // kernel.myWalker = walker_ptr; // restore walker engine pointer
+
+ if (!fread(&player, sizeof(Player), 1, handle)) goto done;
+ if (!fread(&player_info, sizeof(PlayerInfo), 1, handle)) goto done;
+ if (!fread(&global[0], sizeof(int32) * MAX_APPS_GLOBAL_VARS, 1, handle)) goto done;
+ if (!player_been_restore(handle)) goto done;
+
+ conv_restore_game(handle);
+ inv_restore_game(handle);
+
+ if (extra_restore_code_pointer)
+ extra_restore_code_pointer(handle);
+
+ error_flag = TRUE; // some bytes restored, so OK!
+
+ // set up variables so everyone knows we've teleported.
+ kernel.restore_game = TRUE;
+ game.previous_room = KERNEL_RESTORING_GAME;
+
+ if (!game.digi_overall_volume_percent)
+ game.digi_overall_volume_percent = 100;
+ digi_set_overall_volume(game.digi_overall_volume_percent);
+
+ if (!game.midi_overall_volume_percent)
+ game.midi_overall_volume_percent = 100;
+ midi_set_overall_volume(game.midi_overall_volume_percent);
+#endif
return Common::kNoError;
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index fee21ebfcdc..5c3fc8385ab 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS = \
adv_r/adv_been.o \
adv_r/adv_control.o \
adv_r/adv_file.o \
+ adv_r/adv_game.o \
adv_r/adv_inv.o \
adv_r/adv_player.o \
adv_r/adv_rails.o \
@@ -51,6 +52,7 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ platform/sound.o \
platform/timer.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
diff --git a/engines/m4/platform/sound.cpp b/engines/m4/platform/sound.cpp
new file mode 100644
index 00000000000..e9362c09a37
--- /dev/null
+++ b/engines/m4/platform/sound.cpp
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/platform/sound.h"
+#include "m4/globals.h"
+
+namespace M4 {
+
+void midi_stop() {
+ warning("TODO: midi_stop");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/platform/sound.h b/engines/m4/platform/sound.h
new file mode 100644
index 00000000000..617eab1cde4
--- /dev/null
+++ b/engines/m4/platform/sound.h
@@ -0,0 +1,34 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_PLATFORM_SOUND_H
+#define M4_PLATFORM_SOUND_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void midi_stop();
+
+} // End of namespace M4
+
+#endif
Commit: 922d8cccd14ed1fe93a29d9764d1758d1f81550b
https://github.com/scummvm/scummvm/commit/922d8cccd14ed1fe93a29d9764d1758d1f81550b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Compilation fixes from eriktorbjorn
Changed paths:
engines/m4/fileio/sys_file.cpp
engines/m4/graphics/gr_draw.cpp
engines/m4/module.mk
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 1b4f99b2275..5a401c3de53 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -256,7 +256,7 @@ bool SysFile::open_hash_file() {
hashfp = dynamic_cast<Common::SeekableReadStream *>(f_io_open(_G(hag).hash_file, "rb"));
if (!hashfp) {
- warning("open_hash_file: %s %s", _G(hag).hash_file.c_str());
+ warning("open_hash_file: %s", _G(hag).hash_file.c_str());
hag_success = false;
return false;
}
diff --git a/engines/m4/graphics/gr_draw.cpp b/engines/m4/graphics/gr_draw.cpp
index 84a3da2a5ce..7ace999711b 100644
--- a/engines/m4/graphics/gr_draw.cpp
+++ b/engines/m4/graphics/gr_draw.cpp
@@ -30,7 +30,7 @@ void buffer_put_pixel(Buffer *buf, int32 x, int32 y, byte c) {
}
byte buffer_get_pixel(Buffer *buf, int32 x, int32 y) {
- return(*(byte *)((int32)(buf->data) + x + (y * buf->stride)));
+ return *(buf->data + x + (y * buf->stride));
}
void buffer_draw_box(Buffer *buf, int32 x1, int32 y1, int32 x2, int32 y2, byte color) {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 5c3fc8385ab..e4eedb85591 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -7,7 +7,6 @@ MODULE_OBJS = \
kernel.o \
metaengine.o \
param.o \
- res.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
adv_r/adv_control.o \
@@ -44,7 +43,6 @@ MODULE_OBJS = \
gui/gui_item.o \
gui/gui_mouse.o \
gui/gui_sys.o \
- gui/gui_vmng.o \
gui/gui_vmng_core.o \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
@@ -52,6 +50,7 @@ MODULE_OBJS = \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
+ mem/res.o \
platform/sound.o \
platform/timer.o \
wscript/ws_cruncher.o \
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 5ec911c6d37..665f0b44afe 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -61,7 +61,7 @@ bool ws_InitCruncher(void) {
error_show(FL, 'OOM!', "%ld bytes.", _G(stackSize));
}
_G(stackTop) = _G(stackBase);
- _G(stackLimit) = (uint32 *)((uint32)_G(stackBase) + (uint32)_G(stackSize));
+ _G(stackLimit) = (uint32 *)((byte *)_G(stackBase) + (uint32)_G(stackSize));
_G(cruncherInitialized) = true;
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 65ebd78b7d5..fb92f006e99 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -243,7 +243,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
HLock(workHandle);
mainAssetPtr = (char *)(*workHandle);
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((byte *)mainAssetPtr + (uint32)assetSize);
parseAssetPtr = mainAssetPtr;
@@ -286,7 +286,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the resource name, and the offset into the resource block
_G(globalMACHnames)[*chunkHash] = mem_strdup(wsAssetName);
_G(globalMACHHandles)[*chunkHash] = workHandle;
- _G(globalMACHoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+ _G(globalMACHoffsets)[*chunkHash] = parseAssetPtr - mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
Commit: 046975bb9bd5306a3cea307d47a23fac2eef210d
https://github.com/scummvm/scummvm/commit/046975bb9bd5306a3cea307d47a23fac2eef210d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move some files into subfolders
Changed paths:
A engines/m4/adv_r/kernel.cpp
A engines/m4/adv_r/kernel.h
A engines/m4/core/param.cpp
A engines/m4/core/param.h
R engines/m4/kernel.cpp
R engines/m4/kernel.h
R engines/m4/param.cpp
R engines/m4/param.h
engines/m4/globals.cpp
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/mem/memman.cpp
engines/m4/module.mk
diff --git a/engines/m4/kernel.cpp b/engines/m4/adv_r/kernel.cpp
similarity index 96%
rename from engines/m4/kernel.cpp
rename to engines/m4/adv_r/kernel.cpp
index 65f69d705fd..17d8adeec43 100644
--- a/engines/m4/kernel.cpp
+++ b/engines/m4/adv_r/kernel.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/kernel.h"
+#include "m4/adv_r/kernel.h"
namespace M4 {
diff --git a/engines/m4/kernel.h b/engines/m4/adv_r/kernel.h
similarity index 97%
rename from engines/m4/kernel.h
rename to engines/m4/adv_r/kernel.h
index 532688c106c..571e984a2b0 100644
--- a/engines/m4/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_KERNEL_H
-#define M4_KERNEL_H
+#ifndef M4_ADV_R_KERNEL_H
+#define M4_ADV_R_KERNEL_H
#include "m4/adv_r/adv.h"
#include "m4/wscript/ws_machine.h"
diff --git a/engines/m4/param.cpp b/engines/m4/core/param.cpp
similarity index 98%
rename from engines/m4/param.cpp
rename to engines/m4/core/param.cpp
index 87eb8f39208..7d4a2fc0718 100644
--- a/engines/m4/param.cpp
+++ b/engines/m4/core/param.cpp
@@ -20,7 +20,7 @@
*/
#include "common/config-manager.h"
-#include "m4/param.h"
+#include "m4/core/param.h"
#include "m4/globals.h"
#include "m4/m4.h"
diff --git a/engines/m4/param.h b/engines/m4/core/param.h
similarity index 100%
rename from engines/m4/param.h
rename to engines/m4/core/param.h
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index ffa9739cdf6..42effa7c824 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -32,7 +32,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/detection.h"
-#include "m4/param.h"
+#include "m4/core/param.h"
namespace M4 {
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index ce568573506..276ffdc0687 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -22,7 +22,7 @@
#ifndef M4_GLOBALS_H
#define M4_GLOBALS_H
-#include "m4/kernel.h"
+#include "m4/adv_r/kernel.h"
#include "m4/core/term.h"
#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/adv.h"
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index c9c0f177e02..1eaa043bec2 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -33,7 +33,7 @@
#include "m4/platform/sound.h"
#include "m4/detection.h"
#include "m4/console.h"
-#include "m4/param.h"
+#include "m4/core/param.h"
namespace M4 {
diff --git a/engines/m4/mem/memman.cpp b/engines/m4/mem/memman.cpp
index 65f69d705fd..dbbdbc250a4 100644
--- a/engines/m4/mem/memman.cpp
+++ b/engines/m4/mem/memman.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/kernel.h"
+#include "m4/mem/memman.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e4eedb85591..8f636b0ade3 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -4,9 +4,7 @@ MODULE_OBJS = \
m4.o \
console.o \
globals.o \
- kernel.o \
metaengine.o \
- param.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
adv_r/adv_control.o \
@@ -17,10 +15,12 @@ MODULE_OBJS = \
adv_r/adv_rails.o \
adv_r/adv_trigger.o \
adv_r/db_env.o \
+ adv_r/kernel.o \
core/cstring.o \
core/errors.o \
core/imath.o \
core/mouse.o \
+ core/param.o \
core/term.o \
events/mickey.o \
events/mouse_handler.o \
Commit: 20ebb900ff961dec2cf367c7dd0daa0fcbc9f83b
https://github.com/scummvm/scummvm/commit/20ebb900ff961dec2cf367c7dd0daa0fcbc9f83b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Globals need to be available in base class
Changed paths:
A engines/m4/burger/globals.cpp
A engines/m4/burger/globals.h
A engines/m4/core/globals.cpp
A engines/m4/core/globals.h
R engines/m4/burger/vars.cpp
R engines/m4/burger/vars.h
engines/m4/adv_r/adv_game.cpp
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/adv_player.h
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/burger_globals.cpp
engines/m4/burger/burger_globals.h
engines/m4/globals.h
engines/m4/m4.cpp
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
index 2c27608935a..ef52144cb3a 100644
--- a/engines/m4/adv_r/adv_game.cpp
+++ b/engines/m4/adv_r/adv_game.cpp
@@ -24,7 +24,21 @@
namespace M4 {
void GameControl::syncGame(Common::Serializer &s) {
+ // TODO: Ensure this matches the original structure
+ for (uint i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
+ s.syncAsUint32LE(scratch[i]);
+ s.syncAsSint16LE(room_id);
+ s.syncAsSint16LE(new_room);
+ s.syncAsSint16LE(previous_section);
+ s.syncAsSint16LE(section_id);
+ s.syncAsSint16LE(new_section);
+ s.syncAsSint16LE(previous_room);
+
+ s.syncAsUint32LE(digi_overall_volume_percent);
+ s.syncAsUint32LE(midi_overall_volume_percent);
+ s.syncAsByte(camera_pan_instant);
+ s.syncAsByte(going);
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index bf98dfb6c5e..e03023cf6c9 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -28,6 +28,56 @@
namespace M4 {
+void Player::syncGame(Common::Serializer &s) {
+ // TODO: Make this match the original's field ordering
+ s.syncAsSint32LE(x);
+ s.syncAsSint32LE(y);
+ s.syncAsSint32LE(facing);
+
+ s.syncBytes((byte *)verb, MAX_PLYR_STRING_LEN);
+ s.syncBytes((byte *)noun, MAX_PLYR_STRING_LEN);
+ s.syncBytes((byte *)prep, MAX_PLYR_STRING_LEN);
+ s.syncBytes((byte *)object, MAX_PLYR_STRING_LEN);
+ s.syncBytes((byte *)ws_asset_name, 32);
+ s.syncBytes((byte *)ws_shadow_name, 32);
+
+ s.syncAsSint16LE(walker_type);
+ s.syncAsSint16LE(shadow_type);
+ s.syncAsSint32LE(walk_off_edge_to_room);
+ s.syncAsByte(need_to_walk);
+ s.syncAsByte(ready_to_walk);
+ s.syncAsByte(waiting_for_walk);
+ s.syncAsByte(comm_allowed);
+
+ s.syncAsSint32LE(command_ready);
+ s.syncAsByte(walker_visible);
+ s.syncAsByte(look_around);
+ s.syncAsByte(been_here_before);
+
+ s.syncAsByte(walker_reload_palette);
+ s.syncAsByte(disable_hyperwalk);
+ s.syncAsByte(walker_loads_first);
+ s.syncAsByte(walker_in_this_scene);
+
+ s.syncAsSint32LE(walker_trigger);
+ s.syncAsSint32LE(walk_x);
+ s.syncAsSint32LE(walk_y);
+ s.syncAsSint32LE(walk_facing);
+ s.syncAsSint32LE(click_x);
+ s.syncAsSint32LE(click_y);
+}
+
+void PlayerInfo::syncGame(Common::Serializer &s) {
+ s.syncAsSint32LE(x);
+ s.syncAsSint32LE(y);
+ s.syncAsSint32LE(facing);
+ s.syncAsSint32LE(scale);
+ s.syncAsSint32LE(depth);
+ s.syncAsSint32LE(camera_x);
+ s.syncAsSint32LE(camera_y);
+}
+
+
bool player_said(const char *w0, const char *w1, const char *w2) {
const char *ptrs[3] = { w0, w1, w2 };
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 74e5f44d7d2..2f9e543ab3e 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -23,6 +23,7 @@
#ifndef M4_ADV_R_ADV_PLAYER_H
#define M4_ADV_R_ADV_PLAYER_H
+#include "common/serializer.h"
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"
@@ -84,11 +85,15 @@ struct Player {
int32 walk_facing = 0;
int32 click_x = 0, click_y = 0;
+
+ void syncGame(Common::Serializer &s);
};
struct PlayerInfo {
int32 x = 0, y = 0, facing = 0, scale = 0, depth = 0;
int32 camera_x = 0, camera_y = 0;
+
+ void syncGame(Common::Serializer &s);
};
extern bool player_said(const char *w0, const char *w1 = NULL, const char *w2 = NULL);
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 89fcdc3c3fd..8ae762add86 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -19,11 +19,18 @@
*
*/
-#include "m4/adv_r/ad_walk.h"
+#include "m4/adv_r/adv_walk.h"
#include "m4/core/errors.h"
#include "m4/globals.h"
namespace M4 {
+void ws_demand_location(machine *myWalker, int32 x, int32 y) {
+ error("TODO: ws_demand_location");
+}
+
+void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing) {
+ error("TODO: ws_get_walker_info");
+}
} // End of namespace M4
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/burger_globals.cpp
index d2d76de529e..884797e0e70 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/burger_globals.cpp
@@ -126,13 +126,13 @@ void BurgerGlobals::initialize_game() {
inv_give_to_player("MONEY");
// Reset the global variables
- _vars.reset();
- _vars.reset1();
- _vars.reset2();
- _vars.reset3();
- _vars.reset4();
- _vars.reset5();
- _vars.conv_reset_all();
+ _globals.reset();
+ _globals.reset1();
+ _globals.reset2();
+ _globals.reset3();
+ _globals.reset4();
+ _globals.reset5();
+ _globals.conv_reset_all();
}
void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/burger_globals.h
index e8e1f552130..48ae6e674ff 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/burger_globals.h
@@ -25,7 +25,7 @@
#include "m4/globals.h"
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
-#include "m4/burger/vars.h"
+#include "m4/burger/globals.h"
namespace M4 {
namespace Burger {
@@ -48,7 +48,7 @@ protected:
void initialize_game() override;
public:
- Burger::Vars _vars;
+ Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
int _wilburTerm = 2;
GUI::Interface _interface;
@@ -59,6 +59,10 @@ public:
public:
BurgerGlobals();
virtual ~BurgerGlobals();
+
+ GlobalVars *getGlobals() override {
+ return &_globals;
+ }
};
extern BurgerGlobals *g_globals;
@@ -66,7 +70,7 @@ extern BurgerGlobals *g_globals;
#undef _G
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
-#define VAL(X) _G(_vars)[X]
+#define VAL(X) _G(_globals)[X]
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/globals.cpp
similarity index 92%
rename from engines/m4/burger/vars.cpp
rename to engines/m4/burger/globals.cpp
index 83687e15498..75612a31e24 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/globals.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/vars.h"
+#include "m4/burger/globals.h"
#include "m4/core/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_inv.h"
@@ -28,17 +28,17 @@
namespace M4 {
namespace Burger {
-#define GLOBAL_VARS_COUNT 512
+#define MAX_APPS_GLOBAL_VARS 512
-Vars::Vars() {
- resize(GLOBAL_VARS_COUNT);
+GlobalVars::GlobalVars() {
+ resize(MAX_APPS_GLOBAL_VARS);
}
-void Vars::reset() {
- Common::fill(&(*this)[0], &(*this)[0] + GLOBAL_VARS_COUNT, 0);
+void GlobalVars::reset() {
+ Common::fill(&(*this)[0], &(*this)[0] + MAX_APPS_GLOBAL_VARS, 0);
}
-int32 Vars::get_boonsville_time_and_display(bool showTime) {
+int32 GlobalVars::get_boonsville_time_and_display(bool showTime) {
if (showTime) {
int time = (*this)[BOONSVILLE_TIME];
int seconds = time % 60;
@@ -52,12 +52,12 @@ int32 Vars::get_boonsville_time_and_display(bool showTime) {
return (*this)[BOONSVILLE_TIME];
}
-void Vars::set_boonsville_time(int32 time) {
+void GlobalVars::set_boonsville_time(int32 time) {
(*this)[BOONSVILLE_TIME] = time;
(*this)[BOONSVILLE_TIME2] = time - 1;
}
-void Vars::reset1() {
+void GlobalVars::reset1() {
set_boonsville_time(0);
(*this)[V000] = 1000;
inv_give_to_player("money");
@@ -127,7 +127,7 @@ void Vars::reset1() {
conv_reset_all();
}
-void Vars::reset2() {
+void GlobalVars::reset2() {
if ((*this)[V245] != 10027)
inv_give_to_player("BLOCK OF ICE");
if ((*this)[V277] == 6003)
@@ -157,7 +157,7 @@ void Vars::reset2() {
}
}
-void Vars::reset3() {
+void GlobalVars::reset3() {
if (inv_player_has("BOTTLE")) {
inv_give_to_player("CARROT JUICE");
inv_move_object("BOTTLE", NOWHERE);
@@ -188,7 +188,7 @@ void Vars::reset3() {
(*this)[V145] = 0;
}
-void Vars::reset4() {
+void GlobalVars::reset4() {
(*this)[V186] = 0;
(*this)[V234] = 0;
(*this)[V196] = 0;
@@ -239,7 +239,7 @@ void Vars::reset4() {
(*this)[V237] = 0;
}
-void Vars::reset5() {
+void GlobalVars::reset5() {
if ((*this)[V159])
inv_give_to_player("DEED");
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/globals.h
similarity index 98%
rename from engines/m4/burger/vars.h
rename to engines/m4/burger/globals.h
index 3e1135498b0..462aa41920c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/globals.h
@@ -19,10 +19,10 @@
*
*/
-#ifndef M4_BURGER_VARS_H
-#define M4_BURGER_VARS_H
+#ifndef M4_BURGER_GLOBALS_H
+#define M4_BURGER_GLOBALS_H
-#include "common/array.h"
+#include "m4/core/globals.h"
namespace M4 {
namespace Burger {
@@ -547,11 +547,11 @@ enum {
V511 = 511
};
-class Vars : public Common::Array<int32> {
+class GlobalVars : public M4::GlobalVars {
private:
Common::Array<byte> _convSave;
public:
- Vars();
+ GlobalVars();
/**
* Reset the variables back to initial game state
diff --git a/engines/m4/core/globals.cpp b/engines/m4/core/globals.cpp
new file mode 100644
index 00000000000..429686aa4e8
--- /dev/null
+++ b/engines/m4/core/globals.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/core/globals.h"
+
+namespace M4 {
+
+void GlobalVars::syncGame(Common::Serializer &s) {
+ size_t count = size();
+ for (uint i = 0; i < count; ++i)
+ s.syncAsSint32LE((*this)[i]);
+}
+
+} // namespace M4
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
new file mode 100644
index 00000000000..90cdc9d3b28
--- /dev/null
+++ b/engines/m4/core/globals.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_CORE_GLOBALS_H
+#define M4_CORE_GLOBALS_H
+
+#include "common/array.h"
+#include "common/serializer.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct GlobalVars : public Common::Array<int32> {
+ void syncGame(Common::Serializer &s);
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 276ffdc0687..4eb36ff388f 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -23,6 +23,7 @@
#define M4_GLOBALS_H
#include "m4/adv_r/kernel.h"
+#include "m4/core/globals.h"
#include "m4/core/term.h"
#include "m4/adv_db_r/db_catalog.h"
#include "m4/adv_r/adv.h"
@@ -121,6 +122,8 @@ public:
virtual ~Globals();
bool init();
+ virtual GlobalVars *getGlobals() = 0;
+
GameControl _game;
Kernel _kernel;
Term _term;
@@ -129,6 +132,7 @@ public:
Scene_list _scene_list;
frac16 _globals[GLB_SHARED_VARS];
Player _player;
+ PlayerInfo _player_info;
Resources _resources;
Rails_Globals _rails;
Catalog _catalog;
@@ -185,9 +189,11 @@ public:
bool _showMousePos = false;
bool _inv_suppress_click_sound = false;
bool _between_rooms = false;
+ bool _completeWalk = false;
};
#define _G(X) (g_globals->_##X)
+#define _GV() g_globals->getGlobals()
} // namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 1eaa043bec2..374a0e5a5ad 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -94,17 +94,12 @@ void M4Engine::m4_inflight() {
Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(game).syncGame(s);
+ _G(player).syncGame(s);
+ _G(player_info).syncGame(s);
+ g_globals->getGlobals()->syncGame(s);
-#ifdef TODO
-
- if (!fread(&game, sizeof(GameControl), 1, handle))
- goto done;
- // kernel.myWalker = walker_ptr; // restore walker engine pointer
-
- if (!fread(&player, sizeof(Player), 1, handle)) goto done;
- if (!fread(&player_info, sizeof(PlayerInfo), 1, handle)) goto done;
- if (!fread(&global[0], sizeof(int32) * MAX_APPS_GLOBAL_VARS, 1, handle)) goto done;
+#ifdef TODO
if (!player_been_restore(handle)) goto done;
conv_restore_game(handle);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8f636b0ade3..e9f41ecb9f0 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -14,10 +14,12 @@ MODULE_OBJS = \
adv_r/adv_player.o \
adv_r/adv_rails.o \
adv_r/adv_trigger.o \
+ adv_r/adv_walk.o \
adv_r/db_env.o \
adv_r/kernel.o \
core/cstring.o \
core/errors.o \
+ core/globals.o \
core/imath.o \
core/mouse.o \
core/param.o \
@@ -64,10 +66,10 @@ MODULE_OBJS = \
burger/gui/interface.o \
burger/burger.o \
burger/burger_globals.o \
+ burger/globals.o \
burger/hotkeys.o \
burger/inventory.o \
- burger/other.o \
- burger/vars.o
+ burger/other.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 51ee74786b4eebd7c6fb6c1d41c9947d502dcf7e
https://github.com/scummvm/scummvm/commit/51ee74786b4eebd7c6fb6c1d41c9947d502dcf7e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change existingi Globals class to Vars class
The M4 engine has it's own globals array and constants,
so it was cleaner to have it remain as Globals, and change
the ScummVM Globals class to Vars to disambiguate it
Changed paths:
A engines/m4/burger/vars.cpp
A engines/m4/burger/vars.h
A engines/m4/vars.cpp
A engines/m4/vars.h
R engines/m4/burger/burger_globals.cpp
R engines/m4/burger/burger_globals.h
R engines/m4/globals.cpp
R engines/m4/globals.h
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/adv_r/adv_been.cpp
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/globals.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/hotkeys.cpp
engines/m4/burger/inventory.cpp
engines/m4/burger/other.cpp
engines/m4/core/globals.h
engines/m4/core/param.cpp
engines/m4/core/term.cpp
engines/m4/fileio/fstream.cpp
engines/m4/fileio/sys_file.cpp
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_line.cpp
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_sys.cpp
engines/m4/gui/gui_vmng_core.cpp
engines/m4/gui/gui_vmng_rectangles.cpp
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/mem/mem.cpp
engines/m4/mem/res.cpp
engines/m4/module.mk
engines/m4/platform/sound.cpp
engines/m4/platform/timer.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_timer.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 773a9cfcde8..604c6e450a8 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -26,7 +26,7 @@
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
index a0b1f6e9fc6..0a0c9922b21 100644
--- a/engines/m4/adv_r/adv_been.cpp
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -22,7 +22,7 @@
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 6fd285a77bf..24e0eb73f2d 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -22,7 +22,7 @@
#include "m4/adv_r/adv_control.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 52be4c89891..27d8f6e83be 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -24,7 +24,7 @@
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index e03023cf6c9..86f13f39bdf 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -24,7 +24,7 @@
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/gui/gui_vmng_core.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index f4707bf9aa8..4f75fa3c0c1 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -23,7 +23,7 @@
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 86db361346d..7eae0b94d86 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -21,7 +21,7 @@
#include "m4/adv_r/adv_trigger.h"
#include "m4/core/errors.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 8ae762add86..2f9c66523e6 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -21,7 +21,7 @@
#include "m4/adv_r/adv_walk.h"
#include "m4/core/errors.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 1c5285178b5..7b33d239f06 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -21,13 +21,13 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
-Globals *BurgerEngine::createGlobals() {
- return new BurgerGlobals();
+M4::Vars *BurgerEngine::createVars() {
+ return new Burger::Vars();
}
void BurgerEngine::showEngineInfo() {
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 7c271101a6a..5257fc45cbc 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -29,9 +29,9 @@ namespace Burger {
class BurgerEngine : public M4Engine {
/**
- * Creates globals
+ * Creates the structure that holds all the global variables
*/
- Globals *createGlobals() override;
+ M4::Vars *createVars() override;
public:
BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
diff --git a/engines/m4/burger/globals.cpp b/engines/m4/burger/globals.cpp
index 75612a31e24..f7657b4e82f 100644
--- a/engines/m4/burger/globals.cpp
+++ b/engines/m4/burger/globals.cpp
@@ -23,7 +23,7 @@
#include "m4/core/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_inv.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index cbb6f7cf5f4..c861b8317fe 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -22,7 +22,7 @@
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/gui/interface.h"
#include "m4/adv_r/adv_player.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index ea306226e5a..bfeae991c1b 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -31,7 +31,7 @@
#include "m4/core/errors.h"
#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index a4130589175..01741bd4a7b 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -22,7 +22,7 @@
#include "m4/burger/gui/interface.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index c805fa0ec9d..14391a6d0a5 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/burger/hotkeys.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/other.h"
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
index 3b5cccf79c2..519700a7762 100644
--- a/engines/m4/burger/inventory.cpp
+++ b/engines/m4/burger/inventory.cpp
@@ -21,7 +21,7 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/burger/inventory.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
index 68b51ea8165..811ff8656be 100644
--- a/engines/m4/burger/other.cpp
+++ b/engines/m4/burger/other.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/burger/other.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
#include "m4/adv_r/adv_file.h"
#include "m4/core/errors.h"
diff --git a/engines/m4/burger/burger_globals.cpp b/engines/m4/burger/vars.cpp
similarity index 88%
rename from engines/m4/burger/burger_globals.cpp
rename to engines/m4/burger/vars.cpp
index 884797e0e70..8d0d90266af 100644
--- a/engines/m4/burger/burger_globals.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -21,7 +21,7 @@
#include "common/debug.h"
#include "common/events.h"
-#include "m4/burger/burger_globals.h"
+#include "m4/burger/vars.h"
#include "m4/adv_r/adv_file.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
@@ -33,7 +33,7 @@
namespace M4 {
namespace Burger {
-BurgerGlobals *g_globals;
+Vars *g_globals;
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
@@ -70,19 +70,19 @@ static const ConverterEntry ASCII_CONVERTERS[] = {
{ nullptr, 0 }
};
-BurgerGlobals::BurgerGlobals() {
+Vars::Vars() {
g_globals = this;
Inventory *inv = new Inventory();
_inventory = inv;
}
-BurgerGlobals::~BurgerGlobals() {
+Vars::~Vars() {
g_globals = nullptr;
delete _inventory;
}
-void BurgerGlobals::main_cold_data_init() {
+void Vars::main_cold_data_init() {
// TODO
initMouseSeries("cursor", nullptr);
@@ -109,7 +109,7 @@ void BurgerGlobals::main_cold_data_init() {
font_set_colors(2, 1, 3);
}
-void BurgerGlobals::global_menu_system_init() {
+void Vars::global_menu_system_init() {
AddSystemHotkey(Common::KEYCODE_ESCAPE, escape_key_pressed);
AddSystemHotkey(Common::KEYCODE_F2, cb_F2);
AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
@@ -119,7 +119,7 @@ void BurgerGlobals::global_menu_system_init() {
static_cast<Inventory *>(_inventory)->init();
}
-void BurgerGlobals::initialize_game() {
+void Vars::initialize_game() {
// Put all the inventory items back in their original scenes
for (const auto &item : _inventory->_objects)
inv_put_thing_in(item->name, item->scene);
@@ -135,7 +135,7 @@ void BurgerGlobals::initialize_game() {
_globals.conv_reset_all();
}
-void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
+void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
int32 maxW, maxH;
_mouseSeriesHandle = nullptr;
@@ -168,7 +168,7 @@ void BurgerGlobals::initMouseSeries(const Common::String &assetName, RGB8 *myPal
}
}
-void BurgerGlobals::custom_ascii_converter_proc(char *string) {
+void Vars::custom_ascii_converter_proc(char *string) {
char *str;
for (const auto &entry : ASCII_CONVERTERS) {
@@ -177,15 +177,15 @@ void BurgerGlobals::custom_ascii_converter_proc(char *string) {
}
}
-void BurgerGlobals::escape_key_pressed(void *, void *) {
+void Vars::escape_key_pressed(void *, void *) {
}
-void BurgerGlobals::cb_F2(void *, void *) {
+void Vars::cb_F2(void *, void *) {
}
-void BurgerGlobals::cb_F3(void *, void *) {
+void Vars::cb_F3(void *, void *) {
}
diff --git a/engines/m4/burger/burger_globals.h b/engines/m4/burger/vars.h
similarity index 90%
rename from engines/m4/burger/burger_globals.h
rename to engines/m4/burger/vars.h
index 48ae6e674ff..a2327269e16 100644
--- a/engines/m4/burger/burger_globals.h
+++ b/engines/m4/burger/vars.h
@@ -19,10 +19,10 @@
*
*/
-#ifndef M4_BURGER_BURGER_GLOBALS_H
-#define M4_BURGER_BURGER_GLOBALS_H
+#ifndef M4_BURGER_BURGER_VARS_H
+#define M4_BURGER_BURGER_VARS_H
-#include "m4/globals.h"
+#include "m4/vars.h"
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
@@ -34,7 +34,7 @@ enum GameMode {
JUST_OVERVIEW = 0, INTERACTIVE_DEMO = 1, MAGAZINE_DEMO = 2, WHOLE_GAME = 3
};
-class BurgerGlobals : public Globals {
+class Vars : public M4::Vars {
private:
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
void custom_ascii_converter_proc(char *string);
@@ -57,15 +57,15 @@ public:
bool _gameMenuFromMain = false;
public:
- BurgerGlobals();
- virtual ~BurgerGlobals();
+ Vars();
+ virtual ~Vars();
GlobalVars *getGlobals() override {
return &_globals;
}
};
-extern BurgerGlobals *g_globals;
+extern Vars *g_globals;
#undef _G
#define _G(X) (::M4::Burger::g_globals->_##X)
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index 90cdc9d3b28..59da575d385 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -28,6 +28,54 @@
namespace M4 {
+enum {
+ GLB_TIME = 0,
+ GLB_WATCH_DOG = 1,
+ GLB_MIN_Y = 2,
+ GLB_MAX_Y = 3,
+ GLB_MIN_SCALE = 4,
+ GLB_MAX_SCALE = 5,
+ GLB_SCALER = 6,
+
+ GLB_TEMP_1 = 7,
+ GLB_TEMP_2 = 8,
+ GLB_TEMP_3 = 9,
+ GLB_TEMP_4 = 10,
+ GLB_TEMP_5 = 11,
+ GLB_TEMP_6 = 12,
+ GLB_TEMP_7 = 13,
+ GLB_TEMP_8 = 14,
+ GLB_TEMP_9 = 15,
+ GLB_TEMP_10 = 16,
+ GLB_TEMP_11 = 17,
+ GLB_TEMP_12 = 18,
+ GLB_TEMP_13 = 19,
+ GLB_TEMP_14 = 20,
+ GLB_TEMP_15 = 21,
+ GLB_TEMP_16 = 22,
+ GLB_TEMP_17 = 23,
+ GLB_TEMP_18 = 24,
+ GLB_TEMP_19 = 25,
+ GLB_TEMP_20 = 26,
+ GLB_TEMP_21 = 27,
+ GLB_TEMP_22 = 28,
+ GLB_TEMP_23 = 29,
+ GLB_TEMP_24 = 30,
+ GLB_TEMP_25 = 31,
+ GLB_TEMP_26 = 32,
+ GLB_TEMP_27 = 33,
+ GLB_TEMP_28 = 34,
+ GLB_TEMP_29 = 35,
+ GLB_TEMP_30 = 36,
+ GLB_TEMP_31 = 37,
+ GLB_TEMP_32 = 38,
+
+ GLB_SCRATCH_VARS = 7, // 19-16 globals reserved for the compiler
+ GLB_USER_VARS = 17 // 17+ globals for the applications programmer
+};
+
+constexpr int GLOB_COUNT = 39;
+
struct GlobalVars : public Common::Array<int32> {
void syncGame(Common::Serializer &s);
};
diff --git a/engines/m4/core/param.cpp b/engines/m4/core/param.cpp
index 7d4a2fc0718..d8d9f444468 100644
--- a/engines/m4/core/param.cpp
+++ b/engines/m4/core/param.cpp
@@ -21,7 +21,7 @@
#include "common/config-manager.h"
#include "m4/core/param.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
#include "m4/m4.h"
namespace M4 {
diff --git a/engines/m4/core/term.cpp b/engines/m4/core/term.cpp
index a723e3f0091..174a07304a1 100644
--- a/engines/m4/core/term.cpp
+++ b/engines/m4/core/term.cpp
@@ -23,7 +23,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "m4/core/term.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 999ae2e6bc4..107d466e045 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/fileio/fstream.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 5a401c3de53..c19d6733390 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -24,7 +24,7 @@
#include "m4/fileio/fileio.h"
#include "m4/adv_r/db_env.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
#include "m4/m4.h"
namespace M4 {
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index 0a9cd2d021c..79886b8ab6a 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -25,7 +25,7 @@
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/graphics/gr_line.cpp b/engines/m4/graphics/gr_line.cpp
index f2d72a36479..5940327d9c7 100644
--- a/engines/m4/graphics/gr_line.cpp
+++ b/engines/m4/graphics/gr_line.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/graphics/gr_line.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 4b8b99a4099..ced5f4dc8b4 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -23,7 +23,7 @@
#include "graphics/palette.h"
#include "common/textconsole.h"
#include "m4/graphics/gr_pal.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 4dee90a9abb..f3a65ff2733 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -21,7 +21,7 @@
#include "m4/graphics/krn_pal.h"
#include "m4/graphics/gr_pal.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index d293a3aa838..f7b80dbc642 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/gui/gui_buffer.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 232de4917f4..45aed49ca9e 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -31,7 +31,7 @@
#include "m4/graphics/krn_pal.h"
#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 276da57bd78..9c8da35b59f 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -25,7 +25,7 @@
#include "m4/graphics/gr_line.h"
#include "m4/graphics/gr_pal.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index 4cbeefd7ec2..e4e93102e1f 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -23,7 +23,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/core/mouse.h"
#include "m4/mem/res.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index a3ac1992151..6162584ddbb 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -27,7 +27,7 @@
#include "m4/events/mickey.h"
#include "m4/events/mouse_handler.h"
#include "m4/mem/memman.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index d79db22ea22..7187adc540b 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -62,7 +62,7 @@
#include "m4/core/imath.h"
#include "m4/mem/memman.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_vmng_rectangles.cpp b/engines/m4/gui/gui_vmng_rectangles.cpp
index 170baf7768f..ef8e3fa840f 100644
--- a/engines/m4/gui/gui_vmng_rectangles.cpp
+++ b/engines/m4/gui/gui_vmng_rectangles.cpp
@@ -24,7 +24,7 @@
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index b274b359d60..e9ed933729c 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -24,7 +24,7 @@
#include "graphics/surface.h"
#include "m4/gui/gui_vmng_screen.h"
#include "m4/gui/gui_vmng.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index aa3dfae5a5c..edcf44e7d2a 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -22,7 +22,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
#include "m4/events/keys.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 374a0e5a5ad..e38d59cfd0a 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -61,14 +61,14 @@ Common::Error M4Engine::run() {
initGraphics(640, 480);
// Instantiate globals and setup
- Globals *globals = createGlobals();
+ Vars *vars = createVars();
- if (globals->init()) {
+ if (vars->init()) {
// Run game here
m4_inflight();
}
- delete globals;
+ delete vars;
return Common::kNoError;
}
@@ -96,7 +96,7 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(game).syncGame(s);
_G(player).syncGame(s);
_G(player_info).syncGame(s);
- g_globals->getGlobals()->syncGame(s);
+ g_vars->getGlobals()->syncGame(s);
#ifdef TODO
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index ab4a068d33c..854180eaca4 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -35,7 +35,7 @@
#include "graphics/screen.h"
#include "m4/detection.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
@@ -68,7 +68,7 @@ protected:
/**
* Creates globals
*/
- virtual Globals *createGlobals() = 0;
+ virtual Vars *createVars() = 0;
public:
Graphics::Screen *_screen = nullptr;
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 0b38c315ee9..e8c0d3feb26 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -21,7 +21,7 @@
#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
#include "m4/core/errors.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index 337af772f2e..530d982e093 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -25,7 +25,7 @@
#include "m4/mem/memman.h"
#include "m4/mem/reloc.h"
#include "m4/core/errors.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e9f41ecb9f0..6795184ae09 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -3,8 +3,8 @@ MODULE := engines/m4
MODULE_OBJS = \
m4.o \
console.o \
- globals.o \
metaengine.o \
+ vars.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
adv_r/adv_control.o \
@@ -65,11 +65,11 @@ MODULE_OBJS = \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
burger/burger.o \
- burger/burger_globals.o \
burger/globals.o \
burger/hotkeys.o \
burger/inventory.o \
- burger/other.o
+ burger/other.o \
+ burger/vars.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
diff --git a/engines/m4/platform/sound.cpp b/engines/m4/platform/sound.cpp
index e9362c09a37..be3c8416578 100644
--- a/engines/m4/platform/sound.cpp
+++ b/engines/m4/platform/sound.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/platform/sound.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
index ed315f9ae97..56803d4a118 100644
--- a/engines/m4/platform/timer.cpp
+++ b/engines/m4/platform/timer.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/platform/timer.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/globals.cpp b/engines/m4/vars.cpp
similarity index 94%
rename from engines/m4/globals.cpp
rename to engines/m4/vars.cpp
index 42effa7c824..aaf0896d508 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/vars.cpp
@@ -20,7 +20,7 @@
*/
#include "common/debug.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
@@ -36,14 +36,14 @@
namespace M4 {
-Globals *g_globals;
+Vars *g_vars;
-Globals::Globals() {
- g_globals = this;
+Vars::Vars() {
+ g_vars = this;
_cheating_enabled = gDebugLevel > 0;
}
-Globals::~Globals() {
+Vars::~Vars() {
game_systems_shutdown();
sysfile_shutdown();
@@ -55,10 +55,10 @@ Globals::~Globals() {
param_shutdown();
woodscript_shutdown();
- g_globals = nullptr;
+ g_vars = nullptr;
}
-bool Globals::init() {
+bool Vars::init() {
param_init();
parse_all_flags();
@@ -89,7 +89,7 @@ bool Globals::init() {
}
-void Globals::game_systems_initialize(byte flags) {
+void Vars::game_systems_initialize(byte flags) {
_G(term).init(_G(kernel).use_debug_monitor, _G(kernel).use_log_file);
size_t totalMem = _G(kernel).mem_avail();
@@ -144,7 +144,7 @@ void Globals::game_systems_initialize(byte flags) {
_inverse_pal = nullptr;
}
-void Globals::game_systems_shutdown() {
+void Vars::game_systems_shutdown() {
_system_shutting_down = true;
#ifdef TODO
term_message("asset list be gone!");
@@ -197,7 +197,7 @@ void Globals::game_systems_shutdown() {
#endif
}
-void Globals::fire_up_gui() {
+void Vars::fire_up_gui() {
if (!gui_system_init())
error_show(FL, 'GUI0');
if (!vmng_init())
@@ -214,7 +214,7 @@ void Globals::fire_up_gui() {
error_show(FL, 'GUI5');
}
-bool Globals::woodscript_init() {
+bool Vars::woodscript_init() {
if (!InitWSAssets())
return false;
if (!ws_Initialize(_G(globals)))
@@ -223,12 +223,12 @@ bool Globals::woodscript_init() {
return true;
}
-void Globals::woodscript_shutdown() {
+void Vars::woodscript_shutdown() {
ShutdownWSAssets();
ws_Shutdown();
}
-void Globals::grab_fonts() {
+void Vars::grab_fonts() {
term_message("Grabbing fonts");
_font_tiny_prop = gr_font_load("4X6PP.FNT");
@@ -240,7 +240,7 @@ void Globals::grab_fonts() {
_font_misc = gr_font_load("FONTMISC.FNT");
}
-void Globals::create_mouse_watch_dialog() {
+void Vars::create_mouse_watch_dialog() {
int x_offset;
gr_font_set(_font_tiny);
diff --git a/engines/m4/globals.h b/engines/m4/vars.h
similarity index 77%
rename from engines/m4/globals.h
rename to engines/m4/vars.h
index 4eb36ff388f..ccc2bcf1465 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/vars.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_GLOBALS_H
-#define M4_GLOBALS_H
+#ifndef M4_VARS_H
+#define M4_VARS_H
#include "m4/adv_r/kernel.h"
#include "m4/core/globals.h"
@@ -50,58 +50,11 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
-enum {
- GLB_TIME = 0,
- GLB_WATCH_DOG = 1,
- GLB_MIN_Y = 2,
- GLB_MAX_Y = 3,
- GLB_MIN_SCALE = 4,
- GLB_MAX_SCALE = 5,
- GLB_SCALER = 6,
-
- GLB_TEMP_1 = 7,
- GLB_TEMP_2 = 8,
- GLB_TEMP_3 = 9,
- GLB_TEMP_4 = 10,
- GLB_TEMP_5 = 11,
- GLB_TEMP_6 = 12,
- GLB_TEMP_7 = 13,
- GLB_TEMP_8 = 14,
- GLB_TEMP_9 = 15,
- GLB_TEMP_10 = 16,
- GLB_TEMP_11 = 17,
- GLB_TEMP_12 = 18,
- GLB_TEMP_13 = 19,
- GLB_TEMP_14 = 20,
- GLB_TEMP_15 = 21,
- GLB_TEMP_16 = 22,
- GLB_TEMP_17 = 23,
- GLB_TEMP_18 = 24,
- GLB_TEMP_19 = 25,
- GLB_TEMP_20 = 26,
- GLB_TEMP_21 = 27,
- GLB_TEMP_22 = 28,
- GLB_TEMP_23 = 29,
- GLB_TEMP_24 = 30,
- GLB_TEMP_25 = 31,
- GLB_TEMP_26 = 32,
- GLB_TEMP_27 = 33,
- GLB_TEMP_28 = 34,
- GLB_TEMP_29 = 35,
- GLB_TEMP_30 = 36,
- GLB_TEMP_31 = 37,
- GLB_TEMP_32 = 38,
-
- GLB_SCRATCH_VARS = 7, // 19-16 globals reserved for the compiler
- GLB_USER_VARS = 17 // 17+ globals for the applications programmer
-};
-constexpr int GLOB_COUNT = 39;
-
-class Globals;
+class Vars;
-extern Globals *g_globals;
+extern Vars *g_vars;
-class Globals : public Mouse_Globals, public WS_Globals, public Timer_Globals {
+class Vars : public Mouse_Globals, public WS_Globals, public Timer_Globals {
private:
void game_systems_initialize(byte flags);
void game_systems_shutdown();
@@ -111,15 +64,14 @@ private:
void grab_fonts();
void create_mouse_watch_dialog();
-
protected:
virtual void main_cold_data_init() = 0;
virtual void global_menu_system_init() = 0;
virtual void initialize_game() = 0;
public:
- Globals();
- virtual ~Globals();
+ Vars();
+ virtual ~Vars();
bool init();
virtual GlobalVars *getGlobals() = 0;
@@ -192,8 +144,8 @@ public:
bool _completeWalk = false;
};
-#define _G(X) (g_globals->_##X)
-#define _GV() g_globals->getGlobals()
+#define _G(X) (g_vars->_##X)
+#define _GV() g_vars->getGlobals()
} // namespace M4
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 665f0b44afe..6587fd00642 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -23,7 +23,7 @@
#include "m4/wscript/ws_hal.h"
#include "m4/core/errors.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 5f0c615de1d..ac1182852d4 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -22,7 +22,7 @@
#include "m4/wscript/ws_hal.h"
#include "m4/core/errors.h"
#include "m4/gui/gui_vmng.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index fb92f006e99..d57e5c3a67b 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -25,7 +25,7 @@
#include "m4/core/imath.h"
#include "m4/graphics/graphics.h"
#include "m4/mem/mem.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 960f83278c0..e8a2b70e122 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -24,7 +24,7 @@
#include "m4/wscript/wscript.h"
#include "m4/core/errors.h"
#include "m4/platform/timer.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/wscript/ws_timer.cpp b/engines/m4/wscript/ws_timer.cpp
index 666a0e6fe38..1618579a9e0 100644
--- a/engines/m4/wscript/ws_timer.cpp
+++ b/engines/m4/wscript/ws_timer.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/wscript/ws_timer.h"
-#include "m4/globals.h"
+#include "m4/vars.h"
namespace M4 {
Commit: 6468e1231ddf1504ac0de1a48c502252d11a2a0d
https://github.com/scummvm/scummvm/commit/6468e1231ddf1504ac0de1a48c502252d11a2a0d
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Make EGAcolors constexpr
Changed paths:
engines/m4/graphics/gr_pal.cpp
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index ced5f4dc8b4..20ea8c6ced7 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -27,7 +27,7 @@
namespace M4 {
-static const uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+static constexpr uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
constexpr uint8 gr_pal_get_ega_color(uint8 myColor) {
return EGAcolors[myColor];
Commit: 8296cf026c0971627bb4e267ec308f91b417e424
https://github.com/scummvm/scummvm/commit/8296cf026c0971627bb4e267ec308f91b417e424
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix GCC warnings about potentially undefined behavior
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index d57e5c3a67b..465c7525ecc 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -841,7 +841,8 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
if (byteSwap) {
tempPtr = (uint32 *)&numColors[1];
for (i = 0; i < *numColors; i++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
}
@@ -908,7 +909,8 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
// byte-swap the entire chunk header
tempPtr = &(data[2]);
for (i = 0; i < SS_HEAD_SIZE - 2; i++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
if ((int32)(data[CELS_COUNT]) <= 0) {
@@ -921,7 +923,8 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
offsetPtr = &(data[CELS_OFFSETS]);
tempPtr = offsetPtr;
for (i = 0; i < data[CELS_COUNT]; i++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
// dataPtr points to the beginning of the block which is a concatenation of
@@ -934,7 +937,8 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
// Byteswap the individual sprite's header
for (j = 0; j < SS_INDV_HEAD; j++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
}
}
Commit: fc50e95070ac588f46c47fe65f5e93532ea96097
https://github.com/scummvm/scummvm/commit/fc50e95070ac588f46c47fe65f5e93532ea96097
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add syncing of player_been
Changed paths:
engines/m4/adv_r/adv_been.cpp
engines/m4/adv_r/adv_been.h
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
index 0a0c9922b21..699fa79b489 100644
--- a/engines/m4/adv_r/adv_been.cpp
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -47,56 +47,41 @@ void player_reset_been() {
_G(scene_list).tail = 0;
}
-int32 player_been_restore(Common::SeekableReadStream *file_ptr) {
- // Read chunk type marker
- int32 size;
-
- if (file_ptr->readUint32BE() != 'BEEN')
- error_show(FL, 'PBR1');
-
- // Skip chunk size and read number of scenes
- file_ptr->skip(4);
- size = file_ptr->readUint32LE();
-
- // Do we need to reallocate the scene table?
- if (size != _G(scene_list).total_scenes) {
- _G(scene_list).table = (int16 *)mem_realloc(_G(scene_list).table, size * sizeof(int16), "been_scenes");
+Common::Error player_been_sync(Common::Serializer &s) {
+ uint32 val;
+
+ // Handle chunk identity
+ val = 'BEEN';
+ s.syncAsUint32BE(val);
+ if (s.isLoading() && val != 'BEEN')
+ return Common::kReadingFailed;
+
+ // Handle chunk size
+ val = 4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes;
+ s.syncAsUint32LE(val);
+
+ // Handle number of scenes
+ val = _G(scene_list).total_scenes;
+ s.syncAsUint32LE(val);
+
+ if ((int)val != _G(scene_list).total_scenes) {
+ // Need to reallocate the scene table
+ _G(scene_list).table = (int16 *)mem_realloc(_G(scene_list).table, val * sizeof(int16), "been_scenes");
if (!_G(scene_list).table)
- error_show(FL, 'OOM!');
+ return Common::kUnknownError;
}
- _G(scene_list).total_scenes = size;
-
- // Read the tail
- _G(scene_list).tail = file_ptr->readUint32LE();
-
- // Read in the scene list
- for (int i = 0; i < _G(scene_list).total_scenes; ++i)
- _G(scene_list).table[i] = file_ptr->readUint16LE();
-
- return (4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes);
-}
-
-int32 player_been_save(Common::WriteStream *handle) {
- int32 size;
-
- // write chunk identity
- handle->writeUint32BE('BEEN');
-
- // Write chunk size
- size = 4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes;
- handle->writeUint32LE(size);
- // write number of scenes
- handle->writeUint32LE(_G(scene_list).total_scenes);
+ if (s.isLoading())
+ _G(scene_list).total_scenes = val;
- // write current tail
- handle->writeUint32LE(_G(scene_list).tail);
+ // Handle current tail
+ s.syncAsUint32LE(_G(scene_list).tail);
- // Write scene list
+ // Handle scene list
for (int i = 0; i < _G(scene_list).total_scenes; ++i)
- handle->writeUint16LE(_G(scene_list).table[i]);
+ s.syncAsUint16LE(_G(scene_list).table[i]);
- return (sizeof(int32) + (sizeof(int16) * _G(scene_list).total_scenes));
+ return Common::kNoError;
}
/**
diff --git a/engines/m4/adv_r/adv_been.h b/engines/m4/adv_r/adv_been.h
index f66eb4aca7a..5a7825a42f3 100644
--- a/engines/m4/adv_r/adv_been.h
+++ b/engines/m4/adv_r/adv_been.h
@@ -23,6 +23,8 @@
#ifndef M4_ADV_R_ADV_BEEN_H
#define M4_ADV_R_ADV_BEEN_H
+#include "common/error.h"
+#include "common/serializer.h"
#include "common/stream.h"
#include "m4/m4_types.h"
@@ -53,21 +55,9 @@ extern void player_been_shutdown();
extern void player_reset_been(void);
/**
- * Restores player_been information
- *
- * A file must already been open for reading and seeked to the right place
- * returns the number of bytes read. player_been_init must have been called
- * previously with a sufficient number of scenes to hold the record being read.
- */
-extern int32 player_been_restore(Common::SeekableReadStream *handle);
-
-/**
- * Saves player_been information
- *
- * A file must already been open for writing and seeked to the right place
- * @returns The number of bytes written
+ * Saves/loads player_been information
*/
-extern int32 player_been_save(Common::WriteStream *handle);
+extern Common::Error player_been_sync(Common::Serializer &s);
/**
* Called whenever player enters a scene
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e38d59cfd0a..e2917b02b6b 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -98,20 +98,18 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(player_info).syncGame(s);
g_vars->getGlobals()->syncGame(s);
+ if (player_been_sync(s).getCode() != Common::kNoError)
+ return Common::kUnknownError;
#ifdef TODO
- if (!player_been_restore(handle)) goto done;
-
conv_restore_game(handle);
inv_restore_game(handle);
if (extra_restore_code_pointer)
extra_restore_code_pointer(handle);
- error_flag = TRUE; // some bytes restored, so OK!
-
// set up variables so everyone knows we've teleported.
- kernel.restore_game = TRUE;
+ kernel.restore_game = true;
game.previous_room = KERNEL_RESTORING_GAME;
if (!game.digi_overall_volume_percent)
@@ -122,7 +120,6 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
game.midi_overall_volume_percent = 100;
midi_set_overall_volume(game.midi_overall_volume_percent);
#endif
-
return Common::kNoError;
}
Commit: 47ed56069e6e290c24092c7e223c6f207576bb2f
https://github.com/scummvm/scummvm/commit/47ed56069e6e290c24092c7e223c6f207576bb2f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added conv data syncing
Changed paths:
A engines/m4/adv_r/conv.h
A engines/m4/adv_r/conv_io.cpp
A engines/m4/adv_r/conv_io.h
engines/m4/m4.cpp
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
new file mode 100644
index 00000000000..6a09d8dc4fa
--- /dev/null
+++ b/engines/m4/adv_r/conv.h
@@ -0,0 +1,307 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_CONV_H
+#define M4_ADV_R_CONV_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+#define CONV_WAIT_FOR_INPUT 1
+#define CONV_HALT_FOREVER 2
+#define CONV_HALT 3
+#define CONV_INPUT_OK 4
+#define CONV_DO_NOTHING 5
+
+#define CONV_PLAYER_TALKING 1
+#define CONV_NON_PLAYER_TALKING 0
+
+#define DLG_FLUSH_LEFT -1
+#define DLG_FLUSH_RIGHT -2
+#define DLG_FLUSH_TOP -3
+#define DLG_FLUSH_BOTTOM -4
+#define DLG_CENTER_H -5
+#define DLG_CENTER_V -6
+
+
+//from: prochunk.h
+#define C_ASGN_CHUNK ((long) ('C' << 24) | ('A' << 16) | ('S' << 8) | 'N')
+
+#define ASGN_CHUNK ((long) ('A' << 24) | ('S' << 16) | ('G' << 8) | 'N')
+
+#define HIDE_CHUNK ((long) ('H' << 24) | ('I' << 16) | ('D' << 8) | 'E')
+#define UHID_CHUNK ((long) ('U' << 24) | ('H' << 16) | ('I' << 8) | 'D')
+#define DSTR_CHUNK ((long) ('D' << 24) | ('S' << 16) | ('T' << 8) | 'R')
+#define CHDE_CHUNK ((long) ('C' << 24) | ('H' << 16) | ('D' << 8) | 'E')
+#define CUHD_CHUNK ((long) ('C' << 24) | ('U' << 16) | ('H' << 8) | 'D')
+#define CDST_CHUNK ((long) ('D' << 24) | ('D' << 16) | ('T' << 8) | 'S')
+
+#define CONV_CHUNK ((long) ('C' << 24) | ('O' << 16) | ('N' << 8) | 'V')
+#define DECL_CHUNK ((long) ('D' << 24) | ('E' << 16) | ('C' << 8) | 'L')
+
+//mar22
+#define FALL_CHUNK ((long) ('F' << 24) | ('A' << 16) | ('L' << 8) | 'L')
+//mar15
+#define LNODE_CHUNK ((long) ('L' << 24) | ('N' << 16) | ('O' << 8) | 'D')
+#define NODE_CHUNK ((long) ('N' << 24) | ('O' << 16) | ('D' << 8) | 'E')
+#define ENTRY_CHUNK ((long) ('E' << 24) | ('T' << 16) | ('R' << 8) | 'Y')
+#define TEXT_CHUNK ((long) ('T' << 24) | ('E' << 16) | ('X' << 8) | 'T')
+
+//reply
+#define REPLY_CHUNK ((long) ('R' << 24) | ('P' << 16) | ('L' << 8) | 'Y')
+#define WEIGHT_REPLY_CHUNK ((long) ('W' << 24) | ('R' << 16) | ('P' << 8) | 'L')
+#define WEIGHT_PREPLY_CHUNK ((long) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L') //jun27
+#define COND_REPLY_CHUNK ((long) ('C' << 24) | ('R' << 16) | ('P' << 8) | 'L')
+
+#define MESSAGE_CHUNK ((long) ('M' << 24) | ('E' << 16) | ('S' << 8) | 'G')
+
+// goto
+#define GOTO_CHUNK ((long) ('G' << 24) | ('O' << 16) | ('T' << 8) | 'O')
+#define EXIT_GOTO_CHUNK ((long) ('E' << 24) | ('X' << 16) | ('I' << 8) | 'T')
+#define COND_GOTO_CHUNK ((long) ('C' << 24) | ('C' << 16) | ('G' << 8) | 'O')
+
+#define COND_EXIT_GOTO_CHUNK ((long) ('C' << 24) | ('E' << 16) | ('G' << 8) | 'O')
+
+// from: chunkhed.h
+struct Conv {
+ long chunkSize;
+ char *conv;
+ long myCNode;
+ long exit_now;
+ long node_hash;
+
+ long mode;
+ long c_entry_num;
+};
+
+struct ConvDisplayData {
+ char *text[16];
+ char *snd_files[16];
+ char mesg[1024];
+ char *mesg_snd_file;
+ int num_txt_ents;
+ int player_non_player;
+ int player_choice;
+};
+
+struct conv_chunk {
+ long tag;
+ long size;
+};
+
+struct decl_chunk {
+ long tag;
+ long val;
+ long flags;
+ long *addr;
+};
+
+struct fall_chunk {
+ long tag;
+ long val;
+ long index;
+};
+
+struct node_chunk {
+ long tag;
+ long hash;
+ long size;
+ long num_entries;
+};
+
+struct lnode_chunk {
+ long tag;
+ long hash;
+ long size;
+ long entry_num;
+ long num_entries;
+};
+
+struct entry_chunk {
+ long tag;
+ long size;
+ long status;
+};
+
+struct text_chunk {
+ long tag;
+ long size;
+};
+
+struct mesg_chunk {
+ long tag;
+ long size;
+};
+
+struct reply_chunk {
+ long tag;
+ long index; // Where the message is located.
+};
+
+struct c_reply_chunk {
+ long tag;
+ long op_l;
+ long op;
+ long op_r;
+ long index; // Where the message is located.
+};
+
+struct w_reply_chunk {
+ long tag;
+ long num_replies;
+};
+
+struct w_entry_chunk {
+ long weight;
+ long index; // Where the message is located.
+};
+
+struct goto_chunk {
+ long tag;
+ long index; // Where the node is located.
+};
+
+struct c_goto_chunk {
+ long tag;
+ long opnd1; // Where the decl is located.
+ long op;
+ long opnd2; // Integer value.
+ long index; // Where the node is located.
+};
+
+struct misc_chunk {
+ long tag;
+ long index; // Where the entry is located.
+};
+
+struct c_misc_chunk {
+ long tag;
+
+ long c_op_l; // Where the decl is located.
+ long c_op;
+ long c_op_r; // Integer value.
+
+ long index; // Where the entry is located.
+};
+
+struct assign_chunk {
+ long tag;
+ long index; // Where the decl is located.
+ long op;
+ long opnd1; // Integer value.
+};
+
+struct c_assign_chunk {
+ long tag;
+
+ long c_op_l; // Where the decl is located.
+ long c_op;
+ long c_op_r; // Integer value.
+
+ long index; // Where the decl is located.
+ long op;
+ long opnd1; // Integer value.
+};
+
+extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
+
+extern void conv_unload(Conv *c);
+extern void conv_shutdown();
+
+extern Conv *conv_get_handle();
+extern void conv_set_handle(Conv *c);
+
+extern void conv_resume(Conv *c);
+
+extern void set_conv_name(char *s);
+extern char *get_conv_name();
+extern char *conv_sound_to_play();
+extern int32 conv_whos_talking();
+
+extern void conv_snap_on_hotspots();
+extern void conv_snap_off_hotspots();
+extern void conv_init_hotspots();
+
+extern long conv_current_node();
+extern long conv_current_entry();
+
+//from: chunkops.cpp
+extern long get_dechunk_type(char *s, long cSize);
+
+extern conv_chunk *get_conv(Conv *c, long cSize);
+extern decl_chunk *get_decl(Conv *c, long cSize);
+extern node_chunk *get_node(Conv *c, long cSize);
+extern fall_chunk *get_fall(Conv *c, long cSize);
+extern lnode_chunk *get_lnode(Conv *c, long cSize);
+extern entry_chunk *get_entry(Conv *c, long cSize);
+extern entry_chunk *get_hash_entry(Conv *c, long cSize);
+
+extern text_chunk *get_text(Conv *c, long cSize);
+extern mesg_chunk *get_mesg(Conv *c, long cSize);
+extern reply_chunk *get_reply(Conv *c, long cSize);
+extern c_reply_chunk *get_c_reply(Conv *c, long cSize);
+extern goto_chunk *get_goto(Conv *c, long cSize);
+extern c_goto_chunk *get_c_goto(Conv *c, long cSize);
+extern c_assign_chunk *get_c_asgn(Conv *c, long cSize);
+extern w_reply_chunk *get_w_reply(Conv *c, long cSize);
+extern w_entry_chunk *get_w_entry(Conv *c, long cSize);
+extern misc_chunk *get_misc(Conv *c, long cSize);
+extern c_misc_chunk *get_c_misc(Conv *c, long cSize);
+extern assign_chunk *get_asgn(Conv *c, long cSize);
+extern long get_long(Conv *c, long cSize);
+extern char *get_string(Conv *c, long cSize);
+
+extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
+
+extern int conv_ops_cond_successful(long l_op, long op, long r_op);
+extern long conv_ops_process_asgn(long val, long oprtr, long opnd);
+extern void conv_ops_unknown_chunk(long tag, char *s);
+extern long conv_ops_text_strlen(char *s);
+
+extern long conv_get_decl_val(decl_chunk *decl);
+extern void conv_set_decl_val(decl_chunk *decl, long val);
+extern void conv_export_value(Conv *c, long val, int index);
+extern void conv_export_pointer(Conv *c, long *val, int index);
+
+extern void conv_set_font_spacing(int32 h, int32 v);
+extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
+
+extern void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
+ int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2);
+
+extern void conv_set_shading(int32 shade);
+extern void conv_set_box_xy(int32 x, int32 y);
+extern void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2);
+extern void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2);
+extern void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour);
+extern void conv_set_default_hv(int32 h, int32 v);
+
+extern int conv_get_event();
+extern void conv_set_event(int e);
+extern int conv_is_event_ready();
+
+extern void conv_swap_words(Conv *c);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
new file mode 100644
index 00000000000..10ce4881257
--- /dev/null
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/conv_io.h"
+
+namespace M4 {
+
+Common::Error Converstation_Globals::syncGame(Common::Serializer &s) {
+// FILE *fp = NULL;
+ uint32 val;
+
+ conv_reset_all();
+
+ // Handle size
+ val = conv_save_buff.size();
+ s.syncAsUint32LE(val);
+ if (s.isLoading())
+ conv_save_buff.resize(val);
+
+ // Read in the buffer
+ s.syncBytes(&conv_save_buff[0], conv_save_buff.size());
+
+ return Common::kNoError;
+}
+
+void Converstation_Globals::conv_reset_all() {
+ conv_save_buff.clear();
+}
+
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
new file mode 100644
index 00000000000..69cd2b224ed
--- /dev/null
+++ b/engines/m4/adv_r/conv_io.h
@@ -0,0 +1,76 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_CONV_IO_H
+#define M4_ADV_R_CONV_IO_H
+
+#include "common/array.h"
+#include "common/error.h"
+#include "common/serializer.h"
+#include "m4/m4_types.h"
+#include "m4/adv_r/conv.h"
+#include "m4/graphics/gr_pal.h"
+
+namespace M4 {
+
+struct Converstation_Globals {
+ Common::Array<byte> conv_save_buff;
+ int event = 0;
+ int event_ready = 0;
+ char conv_file_name[MAX_FILENAME_SIZE] = { 0 };
+ char conv_name[16];
+ Conv *globConv = nullptr;
+ bool playerCommAllowed = false;
+ long myFinalTrigger = 0;
+ bool interface_was_visible = false; // to remember to turn it back on or
+ int restore_conv = 1;
+ int32 glob_x = 0, glob_y = 0;
+
+ const int32 conv_font_spacing_h = 0;
+ const int32 conv_font_spacing_v = 5;
+ const int32 conv_default_h = conv_font_spacing_h;
+ const int32 conv_default_v = conv_font_spacing_v;
+ const int32 conv_shading = 65;
+
+ const int32 conv_normal_colour = __BLACK;
+ const int32 conv_normal_colour_alt1 = __GREEN;
+ const int32 conv_normal_colour_alt2 = __GREEN;
+ const int32 conv_hilite_colour = __YELLOW;
+ const int32 conv_default_hilite_colour = __YELLOW;
+ const int32 conv_hilite_colour_alt1 = __YELLOW;
+ const int32 conv_hilite_colour_alt2 = __YELLOW;
+ const int32 conv_default_normal_colour = __BLACK;
+
+
+ Common::Error syncGame(Common::Serializer &s);
+
+ void conv_reset_all();
+ void conv_reset(const char *filename);
+
+ void conv_play(Conv *c);
+ void conv_go(Conv *c);
+};
+
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e2917b02b6b..c661797d298 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -29,6 +29,7 @@
#include "m4/m4.h"
#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/adv_r/conv_io.h"
#include "m4/gui/hotkeys.h"
#include "m4/platform/sound.h"
#include "m4/detection.h"
@@ -101,8 +102,9 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
if (player_been_sync(s).getCode() != Common::kNoError)
return Common::kUnknownError;
+ _G(conversations).syncGame(s);
+
#ifdef TODO
- conv_restore_game(handle);
inv_restore_game(handle);
if (extra_restore_code_pointer)
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6795184ae09..f858d73dc16 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS = \
adv_r/adv_rails.o \
adv_r/adv_trigger.o \
adv_r/adv_walk.o \
+ adv_r/conv_io.o \
adv_r/db_env.o \
adv_r/kernel.o \
core/cstring.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index ccc2bcf1465..c020b8eeedf 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -32,6 +32,7 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/adv_r/conv_io.h"
#include "m4/core/mouse.h"
#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
@@ -91,6 +92,7 @@ public:
MouseInfo _MouseState;
Dialog_Globals _dialog;
Item_Globals _items;
+ Converstation_Globals _conversations;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
Commit: 5f2fdf9bc8022a3e9e73ca61854bef35301a61f5
https://github.com/scummvm/scummvm/commit/5f2fdf9bc8022a3e9e73ca61854bef35301a61f5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added fall through comments to LoadWSAssets
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 465c7525ecc..09efb239740 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -275,6 +275,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
*chunkSize = SWAP_INT32(*chunkSize);
*chunkHash = SWAP_INT32(*chunkHash);
chunkSwap = true;
+ // Fall through
case CHUNK_MACH:
// Check the validity of the machine hash number, and clear it
@@ -304,16 +305,16 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Update the assetPtr to the beginning of the next chunk
parseAssetPtr += *chunkSize - 12;
-
break;
- // Chunk is a machine chunk
case CHUNK_UQES:
+ // Chunk is a machine chunk
// Byte swap the type, size and hash and continue through case CHUNK_SEQU.
*chunkType = SWAP_INT32(*chunkType);
*chunkSize = SWAP_INT32(*chunkSize);
*chunkHash = SWAP_INT32(*chunkHash);
chunkSwap = true;
+ // Fall through
case CHUNK_SEQU:
// Check the validity of the sequence hash number, and clear it
@@ -345,13 +346,14 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
parseAssetPtr += *chunkSize - 12;
break;
- // Chunk is a data chunk
case CHUNK_ATAD:
+ // Chunk is a data chunk
// Byte swap the type, size and hash and continue through case CHUNK_DATA.
*chunkType = SWAP_INT32(*chunkType);
*chunkSize = SWAP_INT32(*chunkSize);
*chunkHash = SWAP_INT32(*chunkHash);
chunkSwap = true;
+ // Fall through
case CHUNK_DATA:
// Check the validity of the data block hash number, and clear it
@@ -389,6 +391,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
*chunkSize = SWAP_INT32(*chunkSize);
*chunkHash = SWAP_INT32(*chunkHash);
chunkSwap = true;
+ // Fall through
case CHUNK_CELS:
// Check the validity of the cels hash number, and clear it
Commit: 7aa98e56ac2c1a4d13e1f5c11876dc8838774a1d
https://github.com/scummvm/scummvm/commit/7aa98e56ac2c1a4d13e1f5c11876dc8838774a1d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added inventory list sync
Changed paths:
engines/m4/adv_r/adv_been.cpp
engines/m4/adv_r/adv_been.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/adv_r/kernel.h
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
index 699fa79b489..11a5fca2896 100644
--- a/engines/m4/adv_r/adv_been.cpp
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -27,7 +27,7 @@
namespace M4 {
bool player_been_init(int16 num_scenes) {
- _G(scene_list).table = (int16 *)mem_alloc(sizeof(int16) * num_scenes, "been_scenes");
+ _G(scene_list).table = (byte *)mem_alloc(sizeof(byte) * num_scenes, "been_scenes");
if (!_G(scene_list).table)
error_show(FL, 'OOM!', "player_been_init");
@@ -47,41 +47,15 @@ void player_reset_been() {
_G(scene_list).tail = 0;
}
-Common::Error player_been_sync(Common::Serializer &s) {
- uint32 val;
-
- // Handle chunk identity
- val = 'BEEN';
- s.syncAsUint32BE(val);
- if (s.isLoading() && val != 'BEEN')
- return Common::kReadingFailed;
-
- // Handle chunk size
- val = 4 * sizeof(int32) + sizeof(int16) * _G(scene_list).total_scenes;
- s.syncAsUint32LE(val);
-
+void player_been_sync(Common::Serializer &s) {
// Handle number of scenes
- val = _G(scene_list).total_scenes;
- s.syncAsUint32LE(val);
-
- if ((int)val != _G(scene_list).total_scenes) {
- // Need to reallocate the scene table
- _G(scene_list).table = (int16 *)mem_realloc(_G(scene_list).table, val * sizeof(int16), "been_scenes");
- if (!_G(scene_list).table)
- return Common::kUnknownError;
- }
-
- if (s.isLoading())
- _G(scene_list).total_scenes = val;
+ s.syncAsUint32LE(_G(scene_list).total_scenes);
// Handle current tail
s.syncAsUint32LE(_G(scene_list).tail);
- // Handle scene list
- for (int i = 0; i < _G(scene_list).total_scenes; ++i)
- s.syncAsUint16LE(_G(scene_list).table[i]);
-
- return Common::kNoError;
+ // Handle scene list table
+ s.syncBytes(_G(scene_list).table, _G(scene_list).total_scenes);
}
/**
diff --git a/engines/m4/adv_r/adv_been.h b/engines/m4/adv_r/adv_been.h
index 5a7825a42f3..4db3b87a94b 100644
--- a/engines/m4/adv_r/adv_been.h
+++ b/engines/m4/adv_r/adv_been.h
@@ -23,7 +23,6 @@
#ifndef M4_ADV_R_ADV_BEEN_H
#define M4_ADV_R_ADV_BEEN_H
-#include "common/error.h"
#include "common/serializer.h"
#include "common/stream.h"
#include "m4/m4_types.h"
@@ -33,7 +32,7 @@ namespace M4 {
struct Scene_list {
int32 total_scenes = 0;
int32 tail = 0;
- int16 *table = nullptr;
+ byte *table = nullptr;
};
/**
@@ -57,7 +56,7 @@ extern void player_reset_been(void);
/**
* Saves/loads player_been information
*/
-extern Common::Error player_been_sync(Common::Serializer &s);
+extern void player_been_sync(Common::Serializer &s);
/**
* Called whenever player enters a scene
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 27d8f6e83be..3f845889174 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -28,6 +28,36 @@
namespace M4 {
+#define MAX_NAME_LENGTH 40
+
+void InventoryBase::syncGame(Common::Serializer &s) {
+ char invName[MAX_NAME_LENGTH];
+ uint32 inv_size;
+ int32 i;
+
+ inv_size = _tail * MAX_NAME_LENGTH;
+ s.syncAsUint32LE(inv_size);
+ if (s.isLoading()) {
+ assert((inv_size % (MAX_NAME_LENGTH + sizeof(uint32))) == 0);
+ _tail = inv_size / (MAX_NAME_LENGTH + sizeof(uint32));
+ }
+
+ for (i = 0; i < _tail; ++i) {
+ char *objName = _G(inventory)->_objects[i]->name;
+
+ if (s.isLoading()) {
+ s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
+ Common::strcpy_s(objName, MAX_NAME_LENGTH, invName);
+ } else {
+ Common::strcpy_s(invName, MAX_NAME_LENGTH, objName);
+ s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
+ }
+
+ s.syncAsUint32LE(_objects[i]->scene);
+ }
+}
+
+
bool inv_init(int32 num_objects) {
term_message("Fluffing up the backpack", nullptr);
int i;
@@ -255,75 +285,4 @@ void MoveBP(char *s, int32 from, int32 to) {
#endif
}
-void inv_save_game(Common::WriteStream *fp_save) {
- char *inv_save_buff = nullptr;
- uint32 inv_size = 0, index = 0;
- int32 i;
-
- if (!fp_save)
- error_show(FL, 'ISGF');
-
- inv_size = _G(inventory)->_tail * (40 * sizeof(char) + sizeof(long));
- fp_save->writeUint32LE(inv_size);
-
- inv_save_buff = (char *)mem_alloc(inv_size, "inv save buff");
-
- cstrcpy(inv_save_buff, "\0");
- for (i = 0; i < _G(inventory)->_tail; i++) {
- if (cstrlen(_G(inventory)->_objects[i]->name) > 39)
- error_show(FL, 'ISGF', "inventory name '%s' > 39 chars:", _G(inventory)->_objects[i]->name);
-
- Common::strcpy_s(&inv_save_buff[index], 256, _G(inventory)->_objects[i]->name);
- index += 40;
-
- memcpy(&inv_save_buff[index], &(_G(inventory)->_objects[i]->scene), sizeof(int32));
- index += sizeof(long);
- }
-
- if (fp_save->write(inv_save_buff, inv_size) != inv_size)
- error_show(FL, 'ISGF', "Could not write save game size.");
-
- if (inv_save_buff)
- mem_free(inv_save_buff);
-}
-
-void inv_restore_game(Common::SeekableReadStream *fp_restore) {
- char *inv_restore_buff = nullptr;
- uint32 inv_size = 0, index = 0;
- char *name;
- int32 scene;
-
- if (!fp_restore)
- error_show(FL, 'IRGF', "fp_save is nullptr");
-
- inv_size = fp_restore->readUint32LE();
-
- inv_restore_buff = (char *)mem_alloc(inv_size, "inv restore buff");
- if (!inv_restore_buff)
- error_show(FL, 'IRGF', "Couldn't alloc game restore buffer");
-
- if (fp_restore->read(inv_restore_buff, inv_size) != inv_size)
- error_show(FL, 'IRGF', "Couldn't read restored _G(game).");
-
- while (index < inv_size) {
- name = inv_get_name(&inv_restore_buff[index]);
- if (!name) {
- term_message("inv_restore unknown object: %s", &inv_restore_buff[index]);
- index += 40;
- } else {
- index += 40;
- memcpy(&scene, &inv_restore_buff[index], sizeof(int32));
- index += sizeof(long); //jul21
- if (!inv_put_thing_in(name, scene)) {
- error_show(FL, 'IPTI', "could not put '%s' in %d", name, scene);
- }
- }
- }
-
- if (inv_restore_buff)
- mem_free(inv_restore_buff);
-
- _G(inventory)->set_scroll(0);
-}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index 2d327b77703..be073b10949 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -24,6 +24,7 @@
#define M4_ADV_R_ADV_INV_H
#include "common/array.h"
+#include "common/serializer.h"
#include "common/stream.h"
namespace M4 {
@@ -41,6 +42,8 @@ struct InventoryBase {
InventoryBase() {}
virtual ~InventoryBase() {}
+ void syncGame(Common::Serializer &s);
+
virtual void add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) = 0;
virtual void set_scroll(int32 scroll) = 0;
virtual void remove(const Common::String &name) = 0;
@@ -85,8 +88,7 @@ extern void InsertBP(const char *s, int32 where);
// private
-extern void inv_save_game(Common::WriteStream *fp_save);
-extern void inv_restore_game(Common::SeekableReadStream *fp_restore);
+extern void inv_sync_game(Common::Serializer &s);
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 10ce4881257..455169425a3 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -23,7 +23,7 @@
namespace M4 {
-Common::Error Converstation_Globals::syncGame(Common::Serializer &s) {
+void Converstation_Globals::syncGame(Common::Serializer &s) {
// FILE *fp = NULL;
uint32 val;
@@ -37,8 +37,6 @@ Common::Error Converstation_Globals::syncGame(Common::Serializer &s) {
// Read in the buffer
s.syncBytes(&conv_save_buff[0], conv_save_buff.size());
-
- return Common::kNoError;
}
void Converstation_Globals::conv_reset_all() {
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 69cd2b224ed..4541f488d70 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -24,7 +24,6 @@
#define M4_ADV_R_CONV_IO_H
#include "common/array.h"
-#include "common/error.h"
#include "common/serializer.h"
#include "m4/m4_types.h"
#include "m4/adv_r/conv.h"
@@ -61,7 +60,7 @@ struct Converstation_Globals {
const int32 conv_default_normal_colour = __BLACK;
- Common::Error syncGame(Common::Serializer &s);
+ void syncGame(Common::Serializer &s);
void conv_reset_all();
void conv_reset(const char *filename);
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 571e984a2b0..a10e46da425 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -28,6 +28,7 @@
namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
+#define KERNEL_RESTORING_GAME -2
struct Kernel {
bool hag_mode = true;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index c661797d298..eb0f90a339a 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -98,30 +98,22 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(player).syncGame(s);
_G(player_info).syncGame(s);
g_vars->getGlobals()->syncGame(s);
-
- if (player_been_sync(s).getCode() != Common::kNoError)
- return Common::kUnknownError;
-
+ player_been_sync(s);
_G(conversations).syncGame(s);
+ _G(inventory)->syncGame(s);
-#ifdef TODO
- inv_restore_game(handle);
-
- if (extra_restore_code_pointer)
- extra_restore_code_pointer(handle);
- // set up variables so everyone knows we've teleported.
- kernel.restore_game = true;
- game.previous_room = KERNEL_RESTORING_GAME;
+ if (s.isLoading()) {
+ // set up variables so everyone knows we've teleported
+ _G(kernel).restore_game = true;
+ _G(game).previous_room = KERNEL_RESTORING_GAME;
- if (!game.digi_overall_volume_percent)
- game.digi_overall_volume_percent = 100;
- digi_set_overall_volume(game.digi_overall_volume_percent);
-
- if (!game.midi_overall_volume_percent)
- game.midi_overall_volume_percent = 100;
- midi_set_overall_volume(game.midi_overall_volume_percent);
+#ifdef TODO
+ digi_set_overall_volume(game.digi_overall_volume_percent);
+ midi_set_overall_volume(game.midi_overall_volume_percent);
#endif
+ }
+
return Common::kNoError;
}
Commit: c3ee5acc5c9c1f8af40e036aab68eadf1bdc8c46
https://github.com/scummvm/scummvm/commit/c3ee5acc5c9c1f8af40e036aab68eadf1bdc8c46
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton section/room classes
Changed paths:
A engines/m4/burger/rooms/section1.cpp
A engines/m4/burger/rooms/section1.h
A engines/m4/core/rooms.cpp
A engines/m4/core/rooms.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 3f845889174..e7ee9b377a0 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -30,9 +30,12 @@ namespace M4 {
#define MAX_NAME_LENGTH 40
+// TODO: Move more stuff into InventoryBase class
+static char *inv_get_name(const Common::String &itemName);
+
void InventoryBase::syncGame(Common::Serializer &s) {
char invName[MAX_NAME_LENGTH];
- uint32 inv_size;
+ uint32 inv_size, scene;
int32 i;
inv_size = _tail * MAX_NAME_LENGTH;
@@ -47,13 +50,17 @@ void InventoryBase::syncGame(Common::Serializer &s) {
if (s.isLoading()) {
s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
- Common::strcpy_s(objName, MAX_NAME_LENGTH, invName);
+ char *item = inv_get_name(invName);
+ assert(item);
+
+ s.syncAsUint32LE(scene);
+ inv_put_thing_in(item, scene);
+
} else {
Common::strcpy_s(invName, MAX_NAME_LENGTH, objName);
s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
}
- s.syncAsUint32LE(_objects[i]->scene);
}
}
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 7b33d239f06..d590dc5b954 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -26,6 +26,11 @@
namespace M4 {
namespace Burger {
+BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+ M4Engine(syst, gameDesc) {
+ _sections = &_SECTIONS[0];
+}
+
M4::Vars *BurgerEngine::createVars() {
return new Burger::Vars();
}
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 5257fc45cbc..50b79a157c6 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -23,19 +23,24 @@
#define M4_BURGER_BURGER_H
#include "m4/m4.h"
+#include "m4/burger/rooms/section1.h"
namespace M4 {
namespace Burger {
class BurgerEngine : public M4Engine {
+private:
+ const Section _SECTIONS[1] = {
+ Rooms::Section1()
+ };
+protected:
/**
* Creates the structure that holds all the global variables
*/
M4::Vars *createVars() override;
public:
- BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
- M4Engine(syst, gameDesc) {}
+ BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc);
~BurgerEngine() override {}
/**
diff --git a/engines/m4/burger/rooms/section1.cpp b/engines/m4/burger/rooms/section1.cpp
new file mode 100644
index 00000000000..b5f85eb41fa
--- /dev/null
+++ b/engines/m4/burger/rooms/section1.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1.h b/engines/m4/burger/rooms/section1.h
new file mode 100644
index 00000000000..bab99a12ac9
--- /dev/null
+++ b/engines/m4/burger/rooms/section1.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 M4_BURGER_ROOMS_SECTION1_H
+#define M4_BURGER_ROOMS_SECTION1_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section1 : public Section {
+public:
+ virtual ~Section1() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
new file mode 100644
index 00000000000..614c495af6f
--- /dev/null
+++ b/engines/m4/core/rooms.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/core/rooms.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
+ warning("TODO: walker_spotter");
+ return nullptr;
+}
+
+void Sections::global_section_constructor() {
+ uint sectionNum = _G(game).new_section;
+ assert(sectionNum >= 1 && sectionNum <= 9);
+
+ _activeSection = &_sections[sectionNum - 1];
+}
+
+} // namespace M4
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
new file mode 100644
index 00000000000..7ad2bdc7fb8
--- /dev/null
+++ b/engines/m4/core/rooms.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_CORE_ROOMS_H
+#define M4_CORE_ROOMS_H
+
+#include "m4/adv_r/adv.h"
+
+namespace M4 {
+
+class Room {
+public:
+ Room() {
+ }
+ virtual ~Room() {
+ }
+};
+
+class Section {
+public:
+ Section() {}
+ virtual ~Section() {}
+
+ virtual void preLoad() {}
+
+ /**
+ * Used to tell if x,y is over the walker hotspot
+ */
+ virtual HotSpotRec *walker_spotter(int32 x, int32 y);
+};
+
+class Sections {
+public:
+ const Section *_sections = nullptr;
+ const Section *_activeSection = nullptr;
+public:
+ Sections() {}
+
+ void global_section_constructor();
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index eb0f90a339a..13d994c84d7 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -81,10 +81,11 @@ void M4Engine::m4_inflight() {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
}
-#ifdef TODO
+
// Start up next section
_G(between_rooms) = true;
global_section_constructor();
+#ifdef TODO
util_exec_function(section_preload_code_pointer);
kernel.going = kernel_section_startup();
util_exec_function(section_init_code_pointer);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 854180eaca4..fff59e20cba 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -36,12 +36,13 @@
#include "m4/detection.h"
#include "m4/vars.h"
+#include "m4/core/rooms.h"
namespace M4 {
struct M4GameDescription;
-class M4Engine : public Engine {
+class M4Engine : public Engine, public Sections {
enum GamePhase {
FirstRun,
SectionStartup,
@@ -72,6 +73,8 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
+ const Section *_sections = nullptr;
+
public:
M4Engine(OSystem *syst, const ADGameDescription *gameDesc);
~M4Engine() override;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index f858d73dc16..e2754956b2f 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -24,6 +24,7 @@ MODULE_OBJS = \
core/imath.o \
core/mouse.o \
core/param.o \
+ core/rooms.o \
core/term.o \
events/mickey.o \
events/mouse_handler.o \
@@ -65,6 +66,7 @@ MODULE_OBJS = \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
+ burger/rooms/section1.o \
burger/burger.o \
burger/globals.o \
burger/hotkeys.o \
Commit: e5e3fd6f70c36261df04c8942d47da1e3864a562
https://github.com/scummvm/scummvm/commit/e5e3fd6f70c36261df04c8942d47da1e3864a562
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding section preload code
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/adv_r/kernel.h
engines/m4/burger/rooms/section1.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/gui/hotkeys.cpp
engines/m4/m4.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 24e0eb73f2d..74139f767c1 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -26,6 +26,13 @@
namespace M4 {
+bool kernel_section_startup() {
+ _G(game).previous_section = _G(game).section_id;
+ _G(game).section_id = _G(game).new_section;
+
+ return true;
+}
+
void m4FirstRun() {
#if TODO
add_hot_keys();
@@ -47,12 +54,23 @@ void m4LastRun() {
// TODO
}
-void m4SceneLoad() {
+void m4EndScene() {
// TODO
}
-void m4EndScene() {
- // TODO
+void player_set_commands_allowed(bool t_or_f) {
+#ifdef TODO
+ _G(set_commands_allowed_since_last_checked) = true;
+ _G(player).comm_allowed = t_or_f;
+
+ if (t_or_f) {
+ mouse_set_sprite(kArrowCursor); // OK to do something
+ track_hotspots_refresh();
+ } else
+ mouse_set_sprite(waitPointer); // hour glass
+#else
+ error("TODO: player_set_commands_allowed");
+#endif
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index cb8f0ca488d..7f207ed44db 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -28,10 +28,11 @@
namespace M4 {
+extern bool kernel_section_startup();
+
extern void m4FirstRun();
extern void m4SectionStartup();
extern void m4LastRun();
-extern void m4SceneLoad();
extern void m4EndScene();
} // End of namespace M4
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index a10e46da425..c4e5adedb15 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -49,11 +49,11 @@ struct Kernel {
int16 first_fade = 0;
bool fading_to_grey = false;
bool supress_fadeup = false;
+ bool force_restart = false;
int32 minPalEntry = 0;
int32 maxPalEntry = 0;
- bool going = false; // Game is running OK
bool pause = false;
machine* myWalker = nullptr;
diff --git a/engines/m4/burger/rooms/section1.h b/engines/m4/burger/rooms/section1.h
index bab99a12ac9..7cbdc05b189 100644
--- a/engines/m4/burger/rooms/section1.h
+++ b/engines/m4/burger/rooms/section1.h
@@ -28,8 +28,18 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+class DummyRoom : public Room {
+public:
+ DummyRoom() : Room(666) {}
+};
+
class Section1 : public Section {
+private:
+ Room _ROOMS[1] = {
+ DummyRoom()
+ };
public:
+ Section1() : Section(&_ROOMS[0], 1) {}
virtual ~Section1() {}
};
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 614c495af6f..8a6b0fdaa85 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -24,6 +24,8 @@
namespace M4 {
+constexpr int kScaleEditor = 1;
+
HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
warning("TODO: walker_spotter");
return nullptr;
@@ -36,4 +38,132 @@ void Sections::global_section_constructor() {
_activeSection = &_sections[sectionNum - 1];
}
+void Sections::section_room_constructor() {
+ _activeRoom = (*_activeSection)[_G(game).new_room];
+}
+
+void Sections::m4SceneLoad() {
+ _G(between_rooms) = true;
+ cameraShiftAmount = 0;
+ cameraShift_vert_Amount = 0;
+ _G(art_base_override) = nullptr;
+ _G(use_alternate_attribute_file) = true;
+ shut_down_digi_tracks_between_rooms = true;
+ camera_pan_step = 10;
+ _G(camera_reacts_to_player) = true;
+
+ _G(kernel).force_restart = false;
+ player_set_defaults();
+ player_set_commands_allowed(false); // Also sets "Wait" cursor
+
+ //-------------------- SECTION CONSTRUCTOR and ROOM PRELOAD ------------------
+ section_room_constructor();
+#ifdef TODO
+ _G(kernel).supress_fadeup = false;
+ HEAPCHECK
+ util_exec_function(room_preload_code_pointer);
+ HEAPCHECK
+
+ // we load the walker now because the head is going to seek for kernel_load_room,
+ // and then it's going to seek to the walker directory, then it's going to seek
+ // all the way back to the room again during the room_init_code_pointer call.
+ // somewhere>roomDir>walkerDir>roomDir
+ // but if we move the call it'll potentially only go somewhere>walkerDir>roomDir
+ // unless they load more walkers. oh well. It'll be faster for *some* rooms.
+
+ // Load current player walker set if not pre-loaded
+ if (player.walker_in_this_scene)
+ get_walker();
+
+ //-------------------- ROOM LOAD ------------------
+ intr_cancel_sentence();
+
+ gr_pal_clear_range(master_palette, _G(kernel).first_fade, 255);
+
+ term_message("Calling kernel_load_room");
+ _G(kernel).going = kernel_load_room(_G(kernel).minPalEntry, _G(kernel).maxPalEntry, ¤tSceneDef, &screenCodeBuff, &game_bgBuff);
+ if (!_G(kernel).going)
+ error_show(FL, 'IMP!'); // this should never ever happen
+
+ HEAPCHECK
+ get_ipl();
+
+ // moved above. see explanation there.
+ // if (player.walker_in_this_scene)
+ // get_walker();
+
+ // must reset event handler because loading a room re-initalizes gameBuff
+ gui_buffer_set_event_handler((Buffer *)gameDrawBuff, intr_EventHandler);
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ _G(kernel).call_daemon_every_loop = false;
+ _G(kernel).fade_up_time = 30;
+
+ if (myInterface) {
+ myInterface->must_redraw_all = true;
+ myInterface->draw(gameInterfaceBuff);
+ }
+
+ //-------------------- GLOBAL ROOM INIT and ROOM INIT ------------------
+
+ player_set_commands_allowed(false);
+ set_commands_allowed_since_last_checked = false;
+
+ _G(between_rooms) = false;
+
+ global_room_init(); // supplied by game programmer
+ player.walker_trigger = -1;
+
+ if (game.previous_room == KERNEL_RESTORING_GAME)
+ {
+ if (player.walker_in_this_scene) {
+ // if restoring game, restore player position and facing
+ player_demand_location(player_info.x, player_info.y);
+ player_demand_facing(player_info.facing);
+ }
+ // restore camera position
+ MoveScreenAbs(game_buff_ptr, player_info.camera_x, player_info.camera_y);
+ }
+
+ //enable_end_user_hot_keys();
+ term_message("calling room_init_code");
+ util_exec_function(room_init_code_pointer);
+
+ if (game.previous_room == KERNEL_RESTORING_GAME) {
+ interface_show();
+ game.previous_room = -1;
+ }
+
+ // init for fade up screen
+ if (!_G(kernel).supress_fadeup) {
+ pal_fade_set_start(&master_palette[0], 0); //set fade to black instantly (0 ticks)
+ pal_fade_init(&master_palette[0], _G(kernel).first_fade, 255, 100, _G(kernel).fade_up_time, 32765); // 30 ticks
+ }
+
+ if (!set_commands_allowed_since_last_checked)
+ player_set_commands_allowed(true);
+
+ if (player_been_here(game.room_id))
+ player.been_here_before = true;
+ else {
+ player.been_here_before = false;
+ player_enters_scene(game.room_id);
+ }
+
+ //-------------------- PLAY ROOM ------------------
+#endif
+}
+
+/*------------------------------------------------------------------------*/
+
+Room *Section::operator[](uint roomNum) {
+ for (uint i = 0; i < _roomsCount; ++i) {
+ if (_rooms[i]._roomNum == roomNum)
+ return &_rooms[i];
+ }
+
+ error("Unknown room number - %d", roomNum);
+}
+
+
} // namespace M4
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 7ad2bdc7fb8..c8873f4b0bb 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -28,19 +28,43 @@ namespace M4 {
class Room {
public:
- Room() {
+ uint _roomNum;
+public:
+ Room(uint roomNum) : _roomNum(roomNum) {
}
virtual ~Room() {
}
+
+ virtual void preload() {}
+ virtual void init() {}
+ virtual void daemon() {}
+ virtual void pre_parser() {}
+ virtual void parser() {}
+ virtual void error() {}
+ virtual void shutdown() {}
+ virtual void custom_hotspot_which() {}
};
class Section {
+private:
+ Room *const _rooms;
+ const size_t _roomsCount = 0;
public:
- Section() {}
+ Section(Room *rooms, size_t count) : _rooms(rooms), _roomsCount(count) {}
virtual ~Section() {}
virtual void preLoad() {}
+ /**
+ * Section initialization
+ */
+ virtual void init() {}
+
+ /**
+ * Iterates through the rooms array to find a given room
+ */
+ Room *operator[](uint roomNum);
+
/**
* Used to tell if x,y is over the walker hotspot
*/
@@ -48,13 +72,51 @@ public:
};
class Sections {
+private:
+ int32 cameraShiftAmount = 0;
+ int32 cameraShift_vert_Amount = 0;
+ bool shut_down_digi_tracks_between_rooms = true;
+ int32 camera_pan_step = 10;
+
public:
- const Section *_sections = nullptr;
- const Section *_activeSection = nullptr;
+ Section *_sections = nullptr;
+ Section *_activeSection = nullptr;
+ Room *_activeRoom = nullptr;
public:
Sections() {}
void global_section_constructor();
+ void section_room_constructor();
+
+ void section_init() {
+ _activeSection->init();
+ }
+ void room_preload() {
+ _activeRoom->preload();
+ }
+ void room_init() {
+ _activeRoom->init();
+ }
+ void room_daemon() {
+ _activeRoom->daemon();
+ }
+ void room_pre_parser() {
+ _activeRoom->pre_parser();
+ }
+ void room_parser() {
+ _activeRoom->parser();
+ }
+ void room_error() {
+ _activeRoom->error();
+ }
+ void room_shutdown() {
+ _activeRoom->shutdown();
+ }
+ void custom_hotspot_which() {
+ _activeRoom->custom_hotspot_which();
+ }
+
+ void m4SceneLoad();
};
} // namespace M4
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index edcf44e7d2a..3cb4db60fe7 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -180,7 +180,7 @@ void Hotkeys::adv_enable_system_hot_keys(void) {
}
void Hotkeys::exit_program(void *, void *) {
- _G(kernel).going = false;
+ _G(game).going = false;
}
void Hotkeys::cb_F2(void *, void *) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 13d994c84d7..10316df77c5 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -84,12 +84,14 @@ void M4Engine::m4_inflight() {
// Start up next section
_G(between_rooms) = true;
- global_section_constructor();
-#ifdef TODO
- util_exec_function(section_preload_code_pointer);
- kernel.going = kernel_section_startup();
- util_exec_function(section_init_code_pointer);
-#endif
+ global_section_constructor(); // Sets the active section
+ _G(game).going = kernel_section_startup();
+ section_init();
+
+ while (_G(game).section_id == _G(game).new_section && _G(game).going) {
+
+ }
+
// TODO
}
}
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index c020b8eeedf..a268cba6a24 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -144,6 +144,9 @@ public:
bool _inv_suppress_click_sound = false;
bool _between_rooms = false;
bool _completeWalk = false;
+ const char *_art_base_override = nullptr;
+ bool _use_alternate_attribute_file = false;
+ bool _camera_reacts_to_player = false;
};
#define _G(X) (g_vars->_##X)
Commit: 3a4175a1b450b4e9ec4b900bfa069d70aaba2f8c
https://github.com/scummvm/scummvm/commit/3a4175a1b450b4e9ec4b900bfa069d70aaba2f8c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Create a base Interface class
Changed paths:
A engines/m4/gui/interface.cpp
A engines/m4/gui/interface.h
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/vars.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 74139f767c1..8bd8c15c549 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -33,44 +33,25 @@ bool kernel_section_startup() {
return true;
}
-void m4FirstRun() {
-#if TODO
- add_hot_keys();
-
- // restore a game?
-
- if (!_G(kernel).restore_game)
- _G(interface).show();
-
- _G(kernel).going = true;
-#endif
-}
-
-void m4SectionStartup() {
- // TODO
-}
-
-void m4LastRun() {
- // TODO
-}
-
-void m4EndScene() {
- // TODO
-}
-
void player_set_commands_allowed(bool t_or_f) {
-#ifdef TODO
_G(set_commands_allowed_since_last_checked) = true;
_G(player).comm_allowed = t_or_f;
if (t_or_f) {
- mouse_set_sprite(kArrowCursor); // OK to do something
+ // OK to do something
+ mouse_set_sprite(kArrowCursor);
+ g_vars->getInterface()->cancel_sentence();
+
track_hotspots_refresh();
- } else
- mouse_set_sprite(waitPointer); // hour glass
-#else
- error("TODO: player_set_commands_allowed");
-#endif
+
+ } else {
+ // Hour glass
+ g_vars->getInterface()->showWaitCursor();
+ }
+}
+
+void track_hotspots_refresh() {
+ warning("TODO: track_hotspots_refresh");
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 7f207ed44db..882f19ace4e 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -28,12 +28,10 @@
namespace M4 {
-extern bool kernel_section_startup();
-extern void m4FirstRun();
-extern void m4SectionStartup();
-extern void m4LastRun();
-extern void m4EndScene();
+extern bool kernel_section_startup();
+extern void player_set_commands_allowed(bool t_or_f);
+extern void track_hotspots_refresh();
} // End of namespace M4
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 01741bd4a7b..587ae88db2e 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -29,17 +29,12 @@ namespace Burger {
namespace GUI {
void Interface::init(int arrow, int wait, int look, int grab, int use) {
- _arrow = arrow;
- _wait = wait;
- _look = look;
- _grab = grab;
- _use = use;
+ M4::Interface::init(arrow, wait, look, grab, use);
_sprite = series_load("999intr", 22, nullptr);
if (_sprite != 22)
error_show(FL, 'SLF!');
-
mouse_set_sprite(wait);
_gameInterfaceBuff = new GrBuff(_x2 - _x1, _y2 - _y1);
@@ -96,6 +91,10 @@ void Interface::setup() {
_interfaceBox->add(_btnScrollRight);
}
+void Interface::cancel_sentence() {
+ warning("TODO: cancel_sentence");
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index bfa2be8cc1e..2d2a39da858 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -23,7 +23,7 @@
#ifndef M4_BURGER_INTERFACE_H
#define M4_BURGER_INTERFACE_H
-#include "m4/m4_types.h"
+#include "m4/gui/interface.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
#include "m4/burger/gui/gui_cheapo.h"
@@ -32,16 +32,11 @@ namespace M4 {
namespace Burger {
namespace GUI {
-struct Interface {
+struct Interface : public M4::Interface {
private:
void setup();
public:
int _sprite = 22; // main_interface_sprite;
- int _arrow = 0;
- int _wait = 0;
- int _look = 0;
- int _grab = 0;
- int _use = 0;
bool _visible = false;
bool _shown = false;
int _x1 = 0;
@@ -60,8 +55,11 @@ public:
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
- ~Interface();
- void init(int arrow, int wait, int look, int grab, int use);
+ ~Interface() override;
+
+ void init(int arrow, int wait, int look, int grab, int use) override;
+
+ void cancel_sentence() override;
void show();
};
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index a2327269e16..8f2dce01ae9 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -63,6 +63,9 @@ public:
GlobalVars *getGlobals() override {
return &_globals;
}
+ M4::Interface *getInterface() override {
+ return &_interface;
+ }
};
extern Vars *g_globals;
diff --git a/engines/m4/gui/interface.cpp b/engines/m4/gui/interface.cpp
new file mode 100644
index 00000000000..d94e0c44ddd
--- /dev/null
+++ b/engines/m4/gui/interface.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/gui/interface.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+void Interface::init(int arrow, int wait, int look, int grab, int use) {
+ _arrow = arrow;
+ _wait = wait;
+ _look = look;
+ _grab = grab;
+ _use = use;
+}
+
+void Interface::showWaitCursor() {
+ mouse_set_sprite(_wait);
+}
+
+} // End of namespace M4
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
new file mode 100644
index 00000000000..75d3dae5493
--- /dev/null
+++ b/engines/m4/gui/interface.h
@@ -0,0 +1,53 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GUI_GUI_INTERFACE_H
+#define M4_GUI_GUI_INTERFACE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+class Interface {
+public:
+ int _arrow = 0;
+ int _wait = 0;
+ int _look = 0;
+ int _grab = 0;
+ int _use = 0;
+
+public:
+ virtual ~Interface() {}
+
+ virtual void init(int arrow, int wait, int look, int grab, int use);
+
+ virtual void cancel_sentence() = 0;
+
+ /**
+ * Show the wait cursor
+ */
+ void showWaitCursor();
+};
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index e2754956b2f..6c71462fc97 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -51,6 +51,7 @@ MODULE_OBJS = \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
gui/hotkeys.o \
+ gui/interface.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index a268cba6a24..e4abf8f63ad 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -42,6 +42,7 @@
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
+#include "m4/gui/interface.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
@@ -76,6 +77,7 @@ public:
bool init();
virtual GlobalVars *getGlobals() = 0;
+ virtual Interface *getInterface() = 0;
GameControl _game;
Kernel _kernel;
@@ -147,6 +149,7 @@ public:
const char *_art_base_override = nullptr;
bool _use_alternate_attribute_file = false;
bool _camera_reacts_to_player = false;
+ bool _set_commands_allowed_since_last_checked = false;
};
#define _G(X) (g_vars->_##X)
Commit: 9364fffa749517a11089fa9c024c77343c1445ca
https://github.com/scummvm/scummvm/commit/9364fffa749517a11089fa9c024c77343c1445ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More scene/room startup
Changed paths:
engines/m4/adv_r/adv_game.cpp
engines/m4/adv_r/adv_game.h
engines/m4/adv_r/kernel.h
engines/m4/burger/hotkeys.cpp
engines/m4/core/rooms.cpp
engines/m4/graphics/gr_pal.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
index ef52144cb3a..4e683f1813e 100644
--- a/engines/m4/adv_r/adv_game.cpp
+++ b/engines/m4/adv_r/adv_game.cpp
@@ -38,7 +38,6 @@ void GameControl::syncGame(Common::Serializer &s) {
s.syncAsUint32LE(digi_overall_volume_percent);
s.syncAsUint32LE(midi_overall_volume_percent);
s.syncAsByte(camera_pan_instant);
- s.syncAsByte(going);
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_game.h b/engines/m4/adv_r/adv_game.h
index 4589ba89cd1..26bf316cb8d 100644
--- a/engines/m4/adv_r/adv_game.h
+++ b/engines/m4/adv_r/adv_game.h
@@ -43,7 +43,6 @@ struct GameControl {
int32 digi_overall_volume_percent = 100;
int32 midi_overall_volume_percent = 100;
bool camera_pan_instant = false;
- bool going = false;
void syncGame(Common::Serializer &s);
};
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index c4e5adedb15..c0c793f3dd6 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -67,6 +67,7 @@ struct Kernel {
bool use_debug_monitor = false;
bool use_log_file = false;
bool track_open_close = false;
+ bool going = false;
size_t mem_avail() const { return 7999999; }
};
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 14391a6d0a5..49ef83d3e86 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -32,14 +32,14 @@ void escape_key_pressed(void *, void *) {
switch (_G(executing)) {
case JUST_OVERVIEW:
// Stop playing the overview
- _G(game).going = false;
+ _G(kernel).going = false;
break;
case INTERACTIVE_DEMO:
case MAGAZINE_DEMO:
if (_G(game).room_id == 901) {
// Already on the demo menu screen, so quit game
- _G(game).going = false;
+ _G(kernel).going = false;
} else {
// In-game, so go back to demo menu screen
_G(game).new_section = 9;
@@ -61,7 +61,7 @@ void escape_key_pressed(void *, void *) {
case 903:
// Quit game
- _G(game).going = false;
+ _G(kernel).going = false;
break;
default:
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 8a6b0fdaa85..a110b2d88eb 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -56,32 +56,22 @@ void Sections::m4SceneLoad() {
player_set_defaults();
player_set_commands_allowed(false); // Also sets "Wait" cursor
- //-------------------- SECTION CONSTRUCTOR and ROOM PRELOAD ------------------
+ // -------------------- SECTION CONSTRUCTOR and ROOM PRELOAD ------------------
+
section_room_constructor();
-#ifdef TODO
_G(kernel).supress_fadeup = false;
- HEAPCHECK
- util_exec_function(room_preload_code_pointer);
- HEAPCHECK
- // we load the walker now because the head is going to seek for kernel_load_room,
- // and then it's going to seek to the walker directory, then it's going to seek
- // all the way back to the room again during the room_init_code_pointer call.
- // somewhere>roomDir>walkerDir>roomDir
- // but if we move the call it'll potentially only go somewhere>walkerDir>roomDir
- // unless they load more walkers. oh well. It'll be faster for *some* rooms.
+ room_preload();
- // Load current player walker set if not pre-loaded
- if (player.walker_in_this_scene)
- get_walker();
+ // -------------------- ROOM LOAD ------------------
- //-------------------- ROOM LOAD ------------------
- intr_cancel_sentence();
-
- gr_pal_clear_range(master_palette, _G(kernel).first_fade, 255);
+ g_vars->getInterface()->cancel_sentence();
+ gr_pal_clear_range(_G(master_palette), _G(kernel).first_fade, 255);
term_message("Calling kernel_load_room");
+#ifdef TODO
_G(kernel).going = kernel_load_room(_G(kernel).minPalEntry, _G(kernel).maxPalEntry, ¤tSceneDef, &screenCodeBuff, &game_bgBuff);
+
if (!_G(kernel).going)
error_show(FL, 'IMP!'); // this should never ever happen
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 20ea8c6ced7..6e223b2b7de 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -79,4 +79,16 @@ void gr_pal_set_entry(int32 index, RGB8 *entry) {
g_system->getPaletteManager()->setPalette((const byte *)entry, index, 1);
}
+void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color) {
+ RGB8 x = { 0, 0, 0 };
+
+ for (int i = first_color; i <= last_color; i++) {
+ palette[i].r = 0;
+ palette[i].g = 0;
+ palette[i].b = 0;
+ }
+
+ gr_pal_set_range(palette, first_color, last_color - first_color);
+}
+
} // namespace M4
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 3cb4db60fe7..edcf44e7d2a 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -180,7 +180,7 @@ void Hotkeys::adv_enable_system_hot_keys(void) {
}
void Hotkeys::exit_program(void *, void *) {
- _G(game).going = false;
+ _G(kernel).going = false;
}
void Hotkeys::cb_F2(void *, void *) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 10316df77c5..10ef63c3d04 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -76,7 +76,7 @@ Common::Error M4Engine::run() {
void M4Engine::m4_inflight() {
Hotkeys::add_hot_keys();
- while (_G(game).going) {
+ while (_G(kernel).going) {
if (_G(game).previous_room == -2) {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
@@ -85,10 +85,10 @@ void M4Engine::m4_inflight() {
// Start up next section
_G(between_rooms) = true;
global_section_constructor(); // Sets the active section
- _G(game).going = kernel_section_startup();
+ _G(kernel).going = kernel_section_startup();
section_init();
- while (_G(game).section_id == _G(game).new_section && _G(game).going) {
+ while (_G(game).section_id == _G(game).new_section && _G(kernel).going) {
}
Commit: 030e482ab80ea3c5360afa535daa8a0ad2baff1f
https://github.com/scummvm/scummvm/commit/030e482ab80ea3c5360afa535daa8a0ad2baff1f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added palette methods
Changed paths:
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 6e223b2b7de..d1935b96e32 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -71,6 +71,12 @@ void gr_pal_set(RGB8 *pal) {
gr_pal_set_range(pal, 0, 256);
}
+void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b) {
+ entry->r = (byte)r;
+ entry->g = (byte)g;
+ entry->b = (byte)b;
+}
+
void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors) {
g_system->getPaletteManager()->setPalette((const byte *)pal, first_color, num_colors);
}
@@ -91,4 +97,46 @@ void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color) {
gr_pal_set_range(palette, first_color, last_color - first_color);
}
+uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b) {
+ int i, index = 0, Rdiff, Gdiff, Bdiff;
+ uint32 minDist = 0x7fffffff;
+
+ for (i = 0; i < 256; ++i) {
+ Rdiff = r - pal[i].r;
+ Gdiff = g - pal[i].g;
+ Bdiff = b - pal[i].b;
+ if (Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff < (int)minDist) {
+ minDist = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff;
+ index = i;
+ }
+ }
+
+ return (uint8)index;
+}
+
+void gr_pal_reset_ega_colors(RGB8 *pal) {
+#ifdef TODO
+ EGAcolors[0] = gr_pal_find_best_match(pal, 0, 0, 0); //__BLACK
+ EGAcolors[1] = gr_pal_find_best_match(pal, 0, 0, 255); //__BLUE
+ EGAcolors[2] = gr_pal_find_best_match(pal, 0, 255, 0); //__GREEN
+ EGAcolors[3] = gr_pal_find_best_match(pal, 0, 255, 255); //__CYAN
+ EGAcolors[4] = gr_pal_find_best_match(pal, 255, 0, 0); //__RED
+ EGAcolors[5] = gr_pal_find_best_match(pal, 255, 0, 255); //__VIOLET
+ EGAcolors[6] = gr_pal_find_best_match(pal, 168, 84, 84); //__BROWN
+ EGAcolors[7] = gr_pal_find_best_match(pal, 168, 168, 168); //__LTGRAY
+ EGAcolors[8] = gr_pal_find_best_match(pal, 84, 84, 84); //__DKGRAY
+ EGAcolors[9] = gr_pal_find_best_match(pal, 0, 0, 127); //__LTBLUE
+ EGAcolors[10] = gr_pal_find_best_match(pal, 0, 127, 0); //__LTGREEN
+ EGAcolors[11] = gr_pal_find_best_match(pal, 0, 127, 127); //__LTCYAN
+ EGAcolors[12] = gr_pal_find_best_match(pal, 84, 0, 0); //__LTRED
+ EGAcolors[13] = gr_pal_find_best_match(pal, 84, 0, 0); //__PINK
+ EGAcolors[14] = gr_pal_find_best_match(pal, 0, 84, 84); //__YELLOW
+ EGAcolors[15] = gr_pal_find_best_match(pal, 255, 255, 255); //__WHITE
+#else
+ // TODO: See if this is really needed. It's better if we can keep the
+ // array as constexpr, since arrays use it's constexpr accessor method
+ warning("TODO: gr_pal_reset_ega_colors");
+#endif
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 0909bbc6d4d..87609a325bb 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -45,23 +45,18 @@ namespace M4 {
extern constexpr uint8 gr_pal_get_ega_color(uint8 myColor);
-uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color);
-void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
+void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
-void gr_color_set(int32 c);
-byte gr_color_get_current();
-
-void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
-void gr_pal_set(RGB8 *pal);
-void gr_pal_interface(RGB8 *fixpal);
-void gr_pal_set_RGB6(RGB8 *entry, int r, int g, int b);
-void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
-void gr_pal_set_entry(int32 index, RGB8 *entry);
-void gr_pal_clear(RGB8 *palette);
+void gr_color_set(int32 c);
+byte gr_color_get_current();
+
+void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
+void gr_pal_set(RGB8 *pal);
+void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
+void gr_pal_set_entry(int32 index, RGB8 *entry);
+void gr_pal_clear(RGB8 *palette);
void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color);
uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b);
-uint8 gr_pal_find_best_match_by_index(RGB8 *pal, uint8 r, uint8 g, uint8 b, int begin_color, int end_color);
-void gr_pal_copy(RGB8 *dest, RGB8 *src, uint8 firstIndex, uint8 lastIndex);
} // namespace M4
Commit: b0103c8a9afae148519e1493b9d31743fab0e5fc
https://github.com/scummvm/scummvm/commit/b0103c8a9afae148519e1493b9d31743fab0e5fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui_buffer.cpp methods
Changed paths:
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_buffer.h
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index f7b80dbc642..79eb4d290b7 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/gui/gui_buffer.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
namespace M4 {
@@ -31,4 +32,119 @@ bool gui_buffer_system_init() {
void gui_buffer_system_shutdown() {
}
+static void Buffer_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
+ ScreenContext *myScreen = (ScreenContext *)s;
+ RectList *myRectList = (RectList *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ Buffer *myBuffer;
+ RectList *myRect;
+
+ // Parameter verification
+ if (!myScreen) return;
+ myBuffer = (Buffer *)(myScreen->scrnContent);
+ if (!myBuffer)
+ return;
+
+ // If no destBuffer, then draw directly to video
+ if (!destBuffer) {
+ myRect = myRectList;
+ while (myRect) {
+ vmng_refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, myBuffer);
+ myRect = myRect->next;
+ }
+ } else {
+ // Draw to the dest buffer
+ myRect = myRectList;
+ while (myRect) {
+ gr_buffer_rect_copy_2(myBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
+ myRect = myRect->next;
+ }
+ }
+}
+
+bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler) {
+ int32 x2, y2;
+
+ x2 = x1 + myBuf->W - 1;
+ y2 = y1 + myBuf->h - 1;
+
+ if (!vmng_screen_create(x1, y1, x2, y2, SCRN_BUF, scrnFlags | SF_OFFSCRN, (void *)myBuf,
+ (RefreshFunc)Buffer_Show, evtHandler))
+ return false;
+
+ return true;
+}
+
+void GrBuff_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
+ ScreenContext *myScreen = (ScreenContext *)s;
+ RectList *myRectList = (RectList *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ GrBuff *myGrBuffer;
+ Buffer *myBuffer;
+ RectList *myRect;
+
+ // Parameter verification
+ if (!myScreen)
+ return;
+
+ myGrBuffer = (GrBuff *)myScreen->scrnContent;
+
+ if (!myGrBuffer)
+ return;
+
+ myBuffer = myGrBuffer->get_buffer();
+ if (!myBuffer)
+ return;
+
+ // If no destBuffer, then draw directly to video
+ if (!destBuffer) {
+ myRect = myRectList;
+ while (myRect) {
+ myGrBuffer->refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1);
+ myRect = myRect->next;
+ }
+ } else {
+ // Else draw to the dest buffer
+ myRect = myRectList;
+ while (myRect) {
+ gr_buffer_rect_copy_2(myBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
+ myRect = myRect->next;
+ }
+ }
+
+ myGrBuffer->release();
+}
+
+bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler) {
+ return (vmng_screen_create(x1, y1, x1 + myBuf->w - 1, y1 + myBuf->h - 1,
+ SCRN_BUF, scrnFlags | SF_OFFSCRN, (void *)myBuf,
+ (RefreshFunc)GrBuff_Show, evtHandler) == nullptr) ? false : true;
+}
+
+bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler) {
+ ScreenContext *myScreen = vmng_screen_find((void *)myBuf, nullptr);
+
+ if (myScreen == nullptr)
+ return false;
+
+ myScreen->evtHandler = evtHandler;
+ return true;
+}
+
+void gui_buffer_deregister(Buffer *myBuf) {
+ vmng_screen_dispose((void *)myBuf);
+}
+
+void gui_buffer_activate(Buffer *myBuf) {
+ vmng_screen_show((void *)myBuf);
+}
+
+bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb) {
+ return AddScreenHotkey((void *)myBuf, myKey, cb);
+}
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_buffer.h b/engines/m4/gui/gui_buffer.h
index 3dd3e4eb063..39729032e2e 100644
--- a/engines/m4/gui/gui_buffer.h
+++ b/engines/m4/gui/gui_buffer.h
@@ -34,7 +34,24 @@ namespace M4 {
*/
extern bool gui_buffer_system_init();
+/**
+ * Shutdown any code associated with buffers management
+ */
extern void gui_buffer_system_shutdown();
+
+/**
+ * Register a Buffer with the view manager by creating a view mananger screen
+ * @param x1 Where the screen should initially be placed, coords relative
+ to the top left hand monitor corner.
+ * @param y1 The screens initial "y" coord
+ * @param scrnFlags Flags defining the screens: layer, transparency,
+ moveability, etc.
+ * @param evtHandler A pointer to the procedure to be executed when
+ the view manager registers a keyboard or mouse event
+ * @returns The success of the call
+ * @remarks The user is responsible for keeping the Buffer *.
+ Any changes to the contents will be made by the user.
+ */
extern bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler);
extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
@@ -44,6 +61,13 @@ extern void gui_buffer_deregister(Buffer *myBuf);
extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
extern void gui_buffer_activate(Buffer *myBuf);
extern bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb);
+
+/**
+ * Change which procedure will handle the events sent to the screen, which was
+ * created to managed the Buffer specified.
+ * @param myBuf The Buffer specified.
+ * @param evtHandler The new procedure to handle keyboard and mouse events.
+ */
extern bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler);
} // End of namespace M4
Commit: c1de1750981f04c362f986550bb61d5669b2966b
https://github.com/scummvm/scummvm/commit/c1de1750981f04c362f986550bb61d5669b2966b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added adv_hotspots.cpp
Changed paths:
A engines/m4/adv_r/adv_hotspot.cpp
A engines/m4/adv_r/adv_hotspot.h
engines/m4/adv_r/adv.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 3eaa0e13866..b751aa33428 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -24,6 +24,7 @@
#define M4_ADV_R_ADV_H
#include "common/textconsole.h"
+#include "m4/adv_r/adv_hotspot.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -36,7 +37,6 @@ namespace M4 {
#define STR_FADEPAL "fade palette"
#define STR_RAILNODE "rail node"
-#define STR_HOT_SPOT "hot spot"
#define STR_PATH_NODE "path node"
enum {
@@ -60,23 +60,6 @@ enum KernelTriggerType {
KT_DAEMON, KT_PREPARSE, KT_EXPIRE, KT_LOOP
};
-
-struct HotSpotRec {
- int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
- int32 feet_x = 0, feet_y = 0; // Walk-to target for player
- int8 facing = 0; // Direction player should face
- bool active = false; // Flag if hotspot is active
- char cursor_number = 0; // Mouse cursor number
- char syntax = 0; // Word syntax
- int32 vocabID = 0, verbID = 0; // ids of name and verb
- char *vocab = nullptr; // Vocabulary name of hotspot
- char *verb = nullptr; // Vocabulary default verb name
- char *prep = nullptr; // Preposition
- char *sprite = nullptr; // Sprite name
- int16 hash = 0; // woodscript sprite hash (runtime only)
- HotSpotRec *next = nullptr;
-};
-
struct pathNode {
pathNode *next = nullptr;
byte nodeID = 0;
diff --git a/engines/m4/adv_r/adv_hotspot.cpp b/engines/m4/adv_r/adv_hotspot.cpp
new file mode 100644
index 00000000000..09aaefbc45c
--- /dev/null
+++ b/engines/m4/adv_r/adv_hotspot.cpp
@@ -0,0 +1,298 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_hotspot.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/core/term.h"
+#include "m4/mem/mem.h"
+#include "m4/mem/memman.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+#define STR_HOT_SPOT "hot spot"
+#define _MAXPOSINT 0x7fffffff
+
+void hotspot_new_sprite(HotSpotRec *h, const char *sprite) {
+ if (!h)
+ return;
+
+ if (h->sprite)
+ mem_free(h->sprite);
+
+ h->sprite = mem_strdup(sprite);
+}
+
+void hotspot_newVerb(HotSpotRec *h, const char *verb) {
+ if (!h)
+ return;
+
+ if (h->verb)
+ mem_free(h->verb);
+
+ h->verb = mem_strdup(verb);
+}
+
+void hotspot_newVocab(HotSpotRec *h, const char *vocab) {
+ if (!h)
+ return;
+
+ if (h->vocab)
+ mem_free(h->vocab);
+
+ h->vocab = mem_strdup(vocab);
+}
+
+void hotspot_newPrep(HotSpotRec *h, const char *prep) {
+ if (!h)
+ return;
+
+ if (h->prep)
+ mem_free(h->prep);
+
+ h->prep = mem_strdup(prep);
+}
+
+HotSpotRec *hotspot_new(int x1, int y1, int x2, int y2) {
+ HotSpotRec *newSpot = (HotSpotRec *)mem_alloc(sizeof(HotSpotRec), STR_HOT_SPOT);
+ if (!newSpot)
+ return newSpot;
+
+ newSpot->ul_x = x1;
+ newSpot->ul_y = y1;
+ newSpot->lr_x = x2;
+ newSpot->lr_y = y2;
+ newSpot->sprite = nullptr;
+ newSpot->vocab = nullptr;
+ newSpot->verb = nullptr;
+ newSpot->prep = nullptr;
+ newSpot->syntax = 0; // Unused field
+ newSpot->cursor_number = 0;
+ newSpot->facing = 5;
+ newSpot->feet_x = 32767;
+ newSpot->feet_y = 32767;
+ newSpot->next = nullptr;
+ newSpot->active = true;
+ return newSpot;
+}
+
+HotSpotRec *hotspot_duplicate(HotSpotRec *dupMe) {
+ HotSpotRec *newSpot = (HotSpotRec *)mem_alloc(sizeof(HotSpotRec), STR_HOT_SPOT);
+ if (!newSpot)
+ return newSpot;
+
+ newSpot->ul_x = dupMe->ul_x;
+ newSpot->ul_y = dupMe->ul_y;
+ newSpot->lr_x = dupMe->lr_x;
+ newSpot->lr_y = dupMe->lr_y;
+ newSpot->sprite = mem_strdup(dupMe->sprite);
+ newSpot->vocab = mem_strdup(dupMe->vocab);
+ newSpot->verb = mem_strdup(dupMe->verb);
+ newSpot->prep = mem_strdup(dupMe->prep);
+ newSpot->syntax = dupMe->syntax;
+ newSpot->cursor_number = dupMe->cursor_number;
+ newSpot->facing = dupMe->facing;
+ newSpot->feet_x = dupMe->feet_x;
+ newSpot->feet_y = dupMe->feet_y;
+ newSpot->next = nullptr;
+ return newSpot;
+}
+
+static int32 hotspot_area(HotSpotRec *h) {
+ if (!h)
+ return _MAXPOSINT;
+
+ return (h->lr_x - h->ul_x) * (h->lr_y - h->ul_y);
+}
+
+HotSpotRec *hotspot_add(HotSpotRec *head, HotSpotRec *h, bool new_head) {
+ int hArea = hotspot_area(h);
+ int iArea;
+ HotSpotRec *i;
+
+ // Is head nullptr?
+ if (!head)
+ return h;
+
+ // Is the incoming spot the new head?
+ if (new_head || hArea < hotspot_area(head)) {
+ h->next = head;
+ return h;
+ }
+
+ i = head;
+ while (i) {
+ iArea = hotspot_area(i->next);
+ if (hArea < iArea) {
+ h->next = i->next;
+ i->next = h;
+ i = nullptr;
+ } else
+ i = i->next;
+ }
+
+ return head;
+}
+
+void kill_hotspot_node(HotSpotRec *h) {
+ if (!h)
+ return;
+
+ if (h->vocab)
+ mem_free(h->vocab);
+ if (h->verb)
+ mem_free(h->verb);
+ if (h->sprite)
+ mem_free(h->sprite);
+ if (h->prep)
+ mem_free(h->prep);
+ mem_free(h);
+}
+
+HotSpotRec *hotspot_delete_record(HotSpotRec *head, HotSpotRec *h) {
+ HotSpotRec *i;
+
+ if (!(h || head))
+ return head;
+
+ // Are we deleting the head node?
+ if (head == h) {
+ head = h->next;
+ kill_hotspot_node(h);
+ return head; // This will of course be nullptr if the head was the only thing in the list.
+ }
+
+ // Find parent of current selection
+ for (i = head; i; i = i->next)
+ if (i->next == h)
+ break;
+
+ i->next = h->next;
+
+ kill_hotspot_node(h);
+ return head;
+}
+
+HotSpotRec *hotspot_unlink(HotSpotRec *head, HotSpotRec *h) {
+ HotSpotRec *i;
+
+ if (!(h || head))
+ return head;
+
+ // Are we deleting the head node?
+ if (head == h) {
+ head = h->next;
+ return (head); // This will of course be nullptr if the head was the only thing in the list.
+ }
+
+ // Find parent of current selection
+ for (i = head; i; i = i->next)
+ if (i->next == h)
+ break;
+
+ i->next = h->next;
+ return head;
+}
+
+void hotspot_delete_all(HotSpotRec *head) {
+ HotSpotRec *i;
+ HotSpotRec *next;
+
+ for (i = head; i; i = next) {
+ next = i->next;
+ kill_hotspot_node(i);
+ }
+}
+
+HotSpotRec *hotspot_which(HotSpotRec *head, int x, int y) {
+ HotSpotRec *i;
+ for (i = head; i; i = i->next)
+ if ((x >= i->ul_x) && (x <= i->lr_x) && (y >= i->ul_y) && (y <= i->lr_y) && i->active)
+ return i;
+
+ return nullptr;
+}
+
+void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not) {
+ char name_str[MAX_FILENAME_SIZE];
+ HotSpotRec *i;
+ bool hotspot_found = false;
+
+ cstrncpy(name_str, name, MAX_FILENAME_SIZE);
+ cstrupr(name_str);
+
+ for (i = head; i; i = i->next) {
+ if (!scumm_strnicmp(i->vocab, name_str, MAX_FILENAME_SIZE)) {
+ i->active = active_or_not;
+ hotspot_found = true;
+ }
+ }
+ if (hotspot_found != true)
+ term_message("hotspot '%s' not found!", name_str);
+}
+
+void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y, bool active_or_not) {
+ char name_str[MAX_FILENAME_SIZE];
+ HotSpotRec *i;
+
+ cstrncpy(name_str, name, MAX_FILENAME_SIZE);
+
+ cstrupr(name_str);
+
+ for (i = head; i; i = i->next)
+ if (!scumm_strnicmp(i->vocab, name_str, MAX_FILENAME_SIZE))
+ if ((x >= i->ul_x) && (x <= i->lr_x) && (y >= i->ul_y) && (y <= i->lr_y))
+ i->active = active_or_not;
+}
+
+
+//-----------------------------------------------------------------------
+
+static HotSpotRec *saved_hotspots = nullptr;
+
+void hotspot_hide_all() {
+ if (saved_hotspots)
+ error_show(FL, 'HNST');
+
+ saved_hotspots = _G(currentSceneDef).hotspots;
+ _G(currentSceneDef).hotspots = nullptr;
+}
+
+void hotspot_restore_all() {
+ if (!saved_hotspots) {
+ error_show(FL, 'HNON');
+ }
+
+ if (_G(currentSceneDef).hotspots)
+ hotspot_delete_all(_G(currentSceneDef).hotspots);
+
+ _G(currentSceneDef).hotspots = saved_hotspots;
+ saved_hotspots = nullptr;
+}
+
+void hotspot_unhide_and_dump() {
+ if (saved_hotspots) {
+ hotspot_restore_all();
+ }
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
new file mode 100644
index 00000000000..8b55632b7f3
--- /dev/null
+++ b/engines/m4/adv_r/adv_hotspot.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 M4_ADV_R_ADV_HOTSPOT_H
+#define M4_ADV_R_ADV_HOTSPOT_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+struct HotSpotRec {
+ int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
+ int32 feet_x = 0, feet_y = 0; // Walk-to target for player
+ int8 facing = 0; // Direction player should face
+ bool active = false; // Flag if hotspot is active
+ char cursor_number = 0; // Mouse cursor number
+ char syntax = 0; // Word syntax
+ int32 vocabID = 0, verbID = 0; // ids of name and verb
+ char *vocab = nullptr; // Vocabulary name of hotspot
+ char *verb = nullptr; // Vocabulary default verb name
+ char *prep = nullptr; // Preposition
+ char *sprite = nullptr; // Sprite name
+ int16 hash = 0; // woodscript sprite hash (runtime only)
+ HotSpotRec *next = nullptr;
+};
+
+extern HotSpotRec *hotspot_add_dynamic(
+ char *verb, char *noun,
+ int32 x1, int32 y1, int32 x2, int32 y2,
+ int32 cursor,
+ bool new_head = true,
+ int32 walkto_x = 32767, int32 walkto_y = 32767, int32 facing = 0);
+
+/**
+ * Creates a new hot spot, doesn't add it to any list. Takes coords, sets everything
+ * else to default values.
+ * @returns The new hotspot
+ */
+extern HotSpotRec *hotspot_new(int x1, int y1, int x2, int y2);
+
+/**
+ * Given a list and a hotspot to insert in that list, inserts the spot ordered by size,
+ * unless new_head is true, in which case the hotspot is the head regardless of size.
+ * @returns The new head of the list.
+ */
+extern HotSpotRec *hotspot_add(HotSpotRec *head, HotSpotRec *h, bool new_head);
+extern HotSpotRec *hotspot_duplicate(HotSpotRec *dupMe);
+
+/**
+ * Takes the head of a list of hot spots, and a pointer to a spot to delete.
+ * @returns The new head of the list.
+ */
+extern HotSpotRec *hotspot_delete_record(HotSpotRec *head, HotSpotRec *h);
+
+/**
+ * Takes the head of a list of hot spots, and a pointer to a spot to unlink.
+ * @returns The new head of the list.
+ */
+extern HotSpotRec *hotspot_unlink(HotSpotRec *head, HotSpotRec *h);
+extern void hotspot_delete_all(HotSpotRec *head);
+
+extern void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not);
+extern void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y, bool active_or_not);
+#define kernel_flip_hotspot(aa,bb) (hotspot_set_active(currentSceneDef.hotspots,aa,bb))
+#define kernel_flip_hotspot_xy(aa,bb,xx,yy) (hotspot_set_active_xy(currentSceneDef.hotspots,aa,xx,yy,bb))
+#define kernel_flip_hotspot_loc(aa,bb,xx,yy) (hotspot_set_active_xy(currentSceneDef.hotspots,aa,xx,yy,bb))
+
+extern void hotspot_new_sprite(HotSpotRec *h, const char *verb);
+extern void hotspot_newVerb(HotSpotRec *h, const char *verb);
+extern void hotspot_newVocab(HotSpotRec *h, const char *vocab);
+extern void hotspot_newPrep(HotSpotRec *h, const char *prep);
+
+/**
+ * Given a list of spots to check, and an x,y coordinate pair,
+ * @returns A pointer to the hotspot we're inside, or nullptr if there's nothing.
+ */
+extern HotSpotRec *hotspot_which(HotSpotRec *head, int x, int y);
+extern void kill_hotspot_node(HotSpotRec *h);
+
+extern void hotspot_restore_all();
+extern void hotspot_hide_all();
+extern void hotspot_unhide_and_dump();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6c71462fc97..cadb6312871 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
adv_r/adv_control.o \
adv_r/adv_file.o \
adv_r/adv_game.o \
+ adv_r/adv_hotspot.o \
adv_r/adv_inv.o \
adv_r/adv_player.o \
adv_r/adv_rails.o \
Commit: ad8bac34188655c88fc7a9bd0c1a132ff22bf232
https://github.com/scummvm/scummvm/commit/ad8bac34188655c88fc7a9bd0c1a132ff22bf232
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added adv_chk.cpp
Changed paths:
A engines/m4/adv_r/adv_chk.cpp
A engines/m4/adv_r/adv_chk.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_chk.cpp b/engines/m4/adv_r/adv_chk.cpp
new file mode 100644
index 00000000000..67d7bcf9c38
--- /dev/null
+++ b/engines/m4/adv_r/adv_chk.cpp
@@ -0,0 +1,254 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_chk.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/fileio/sys_file.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+static HotSpotRec *read_hotspots(SysFile *fpdef, HotSpotRec *h, int32 num) {
+ int32 str_len = 0;
+ int32 a;
+ int8 b;
+ int16 c;
+ bool d;
+ char e;
+ char s[MAX_FILENAME_SIZE];
+ int32 x1, x2, y1, y2;
+ HotSpotRec *head = nullptr;
+ void *buffPtr;
+ int32 i = 0;
+
+ for (i = 0; i < num; i++) {
+ buffPtr = &x1;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->ul_x");
+ x1 = convert_intel32(x1);
+
+ buffPtr = &y1;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->ul_y");
+ y1 = convert_intel32(y1);
+
+ buffPtr = &x2;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->lr_x");
+ x2 = convert_intel32(x2);
+
+ buffPtr = &y2;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->lr_y");
+ y2 = convert_intel32(y2);
+
+ h = hotspot_new(x1, y1, x2, y2);
+ if (!head)
+ head = h;
+ else
+ head = hotspot_add(head, h, false);
+
+ buffPtr = &a;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->feet_x");
+ a = convert_intel32(a);
+ h->feet_x = a;
+
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->feet_y");
+ a = convert_intel32(a);
+ h->feet_y = a;
+
+ buffPtr = &b;
+ if (!fpdef->read(&buffPtr, sizeof(int8)))
+ error_show(FL, 0, "Could not read h->facing");
+ h->facing = b;
+
+ buffPtr = &d;
+ if (!fpdef->read(&buffPtr, sizeof(bool)))
+ error_show(FL, 0, "Could not read h->active");
+ h->active = d;
+
+ buffPtr = &e;
+ if (!fpdef->read(&buffPtr, sizeof(char)))
+ error_show(FL, 0, "Could not read h->cursor_number");
+ h->cursor_number = e;
+
+ if (!fpdef->read(&buffPtr, sizeof(char)))
+ error_show(FL, 0, "Could not read h->syntax");
+ h->syntax = e;
+
+ buffPtr = &a;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->vocabID");
+ a = convert_intel32(a);
+ h->vocabID = a;
+
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->verbID");
+ a = convert_intel32(a);
+ h->verbID = a;
+
+ // -------
+
+ buffPtr = &str_len;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->vocab length");
+ str_len = convert_intel32(str_len);
+
+ if (str_len) {
+ buffPtr = &s[0];
+ if (!fpdef->read(&buffPtr, str_len))
+ error_show(FL, 0, "Could not read h->vocab");
+ hotspot_newVocab(h, s);
+ }
+
+ buffPtr = &str_len;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->verb length");
+ str_len = convert_intel32(str_len);
+
+ if (str_len) {
+ buffPtr = &s[0];
+ if (!fpdef->read(&buffPtr, str_len))
+ error_show(FL, 0, "Could not read h->verb");
+ hotspot_newVerb(h, s);
+ }
+
+ buffPtr = &str_len;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->prep length");
+ str_len = convert_intel32(str_len);
+
+ if (str_len) {
+ buffPtr = &s[0];
+ if (!fpdef->read(&buffPtr, str_len))
+ error_show(FL, 0, "Could not read h->prep");
+ hotspot_newPrep(h, s);
+ }
+
+ buffPtr = &str_len;
+ if (!fpdef->read(&buffPtr, sizeof(int32)))
+ error_show(FL, 0, "Could not read h->sprite");
+ str_len = convert_intel32(str_len);
+
+ if (str_len) {
+ buffPtr = &s[0];
+ if (!fpdef->read(&buffPtr, str_len))
+ error_show(FL, 0, "Could not read h->sprite");
+ hotspot_new_sprite(h, s);
+ }
+
+ buffPtr = &c;
+ if (!fpdef->read(&buffPtr, sizeof(int16)))
+ error_show(FL, 0, "Could not read h->sprite");
+ c = convert_intel16(c);
+ h->hash = c;
+ }
+
+ return head;
+}
+
+static void load_def(SysFile *fpdef) {
+ int32 i, a;
+ int16 b;
+ int32 c, x, y;
+ char s[MAX_FILENAME_SIZE];
+ void *buffPtr;
+
+ buffPtr = &s[0];
+ fpdef->read(&buffPtr, MAX_FILENAME_SIZE);
+ strncpy(_G(myDef)->art_base, s, MAX_FILENAME_SIZE);
+
+ fpdef->read(&buffPtr, MAX_FILENAME_SIZE);
+ strncpy(_G(myDef)->picture_base, s, MAX_FILENAME_SIZE);
+
+ buffPtr = &a;
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->num_hotspots = a;
+
+ buffPtr = &a;
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->num_parallax = a;
+
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->num_props = a;
+
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->front_y = a;
+
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->back_y = a;
+
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->front_scale = a;
+
+ fpdef->read(&buffPtr, sizeof(int32));
+ a = convert_intel32(a);
+ _G(myDef)->back_scale = a;
+
+ buffPtr = &b;
+ for (i = 0; i < 16; i++) {
+ fpdef->read(&buffPtr, sizeof(int16));
+ b = convert_intel16(b);
+ _G(myDef)->depth_table[i] = b;
+ }
+
+ buffPtr = &c;
+ fpdef->read(&buffPtr, sizeof(int32));
+ c = convert_intel32(c);
+ _G(myDef)->numRailNodes = c;
+ for (i = 0; i < _G(myDef)->numRailNodes; i++) {
+ fpdef->read(&buffPtr, sizeof(int32));
+ c = convert_intel32(c);
+ x = c;
+ fpdef->read(&buffPtr, sizeof(int32));
+ c = convert_intel32(c);
+ y = c;
+
+ if (AddRailNode(x, y, nullptr, true) < 0)
+ error_show(FL, 0, "more than %d (defn. in intrrail.h) nodes", MAXRAILNODES);
+ }
+
+ _G(myDef)->hotspots = read_hotspots(fpdef, nullptr, _G(myDef)->num_hotspots);
+ _G(myDef)->parallax = read_hotspots(fpdef, nullptr, _G(myDef)->num_parallax);
+ _G(myDef)->props = read_hotspots(fpdef, nullptr, _G(myDef)->num_props);
+}
+
+int db_def_chk_read(int16 room_code, SceneDef *rdef) {
+ _G(myDef) = rdef;
+
+ _G(def_filename) = Common::String::format("%03d.chk", room_code);
+ SysFile fpdef(_G(def_filename), BINARY);
+
+ load_def(&fpdef);
+ fpdef.close();
+ return -1; // everything happy code
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_chk.h b/engines/m4/adv_r/adv_chk.h
new file mode 100644
index 00000000000..6df46eac1da
--- /dev/null
+++ b/engines/m4/adv_r/adv_chk.h
@@ -0,0 +1,41 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_CHK_H
+#define M4_ADV_R_ADV_CHK_H
+
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv.h"
+
+namespace M4 {
+
+/**
+ * Reads the .DEF file for the specified room into the "room" structure.
+ * @param room_code room number
+ * @param rdef Output def to populate
+ * @returns Returns 0 if successful, or -1 for error
+ */
+extern int db_def_chk_read(int16 room_code, SceneDef *rdef);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index cadb6312871..37237887996 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS = \
vars.o \
adv_db_r/db_catalog.o \
adv_r/adv_been.o \
+ adv_r/adv_chk.o \
adv_r/adv_control.o \
adv_r/adv_file.o \
adv_r/adv_game.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index e4abf8f63ad..af955d9a882 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -150,6 +150,8 @@ public:
bool _use_alternate_attribute_file = false;
bool _camera_reacts_to_player = false;
bool _set_commands_allowed_since_last_checked = false;
+ SceneDef *_myDef = nullptr;
+ Common::String _def_filename;
};
#define _G(X) (g_vars->_##X)
Commit: 3d11300609b053b90000cedc7a4bba0d2376e29a
https://github.com/scummvm/scummvm/commit/3d11300609b053b90000cedc7a4bba0d2376e29a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added kernel_load_room and dependencies
Changed paths:
A engines/m4/platform/tile/tile_read.cpp
A engines/m4/platform/tile/tile_read.h
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/vars.h
engines/m4/core/rooms.cpp
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_buff.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
engines/m4/gui/gui_vmng_core.cpp
engines/m4/gui/gui_vmng_core.h
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/gui/interface.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 8bd8c15c549..d1dce5636cf 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -40,13 +40,13 @@ void player_set_commands_allowed(bool t_or_f) {
if (t_or_f) {
// OK to do something
mouse_set_sprite(kArrowCursor);
- g_vars->getInterface()->cancel_sentence();
+ _GI().cancel_sentence();
track_hotspots_refresh();
} else {
// Hour glass
- g_vars->getInterface()->showWaitCursor();
+ _GI().showWaitCursor();
}
}
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 4b0be0d3628..80ba1ee61ff 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -21,11 +21,252 @@
#include "common/system.h"
#include "common/savefile.h"
+#include "common/util.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/adv_r/adv_chk.h"
+#include "m4/adv_r/adv_walk.h"
+#include "m4/adv_r/db_env.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/fileio/extensions.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/gui/gui_buffer.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/platform/tile/tile_read.h"
#include "m4/m4.h"
namespace M4 {
+static int32 extract_room_num(const char *name);
+static Common::String get_background_filename(const SceneDef *rdef);
+static Common::String get_attribute_filename(const SceneDef *rdef);
+static void recreate_animation_draw_screen(GrBuff **loadBuf);
+static void troll_for_colors(RGB8 *newPal, uint8 minPalEntry, uint8 maxPalEntry);
+
+void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **loadBuffer) {
+ term_message("Unloading scene %d", _G(game).room_id);
+
+ if (_G(gameDrawBuff)) {
+ gui_buffer_deregister((Buffer *)_G(gameDrawBuff));
+ delete _G(gameDrawBuff);
+ _G(gameDrawBuff) = nullptr;
+ }
+
+ if (*code_data)
+ delete *code_data;
+ *code_data = nullptr;
+
+ if (*loadBuffer)
+ delete *loadBuffer;
+ *loadBuffer = nullptr;
+
+ if (!rdef)
+ return;
+
+ // Must we deallocate existing hot spots?
+ if (rdef->hotspots != nullptr) {
+ hotspot_delete_all(rdef->hotspots);
+ rdef->hotspots = nullptr;
+ }
+ rdef->num_hotspots = 0;
+
+ // Must we deallocate existing parallax?
+ if (rdef->parallax != nullptr) {
+ hotspot_delete_all(rdef->parallax);
+ rdef->parallax = nullptr;
+ }
+ rdef->num_parallax = 0;
+
+ // Must we deallocate existing props?
+ if (rdef->props != nullptr) {
+ hotspot_delete_all(rdef->props);
+ rdef->props = nullptr;
+ }
+ rdef->num_props = 0;
+
+ ClearRails();
+}
+
+
+bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff **scr_orig_data, GrBuff **scr_orig) {
+ char *tempName;
+
+ if (!scr_orig_data || !scr_orig) {
+ error_show(FL, 'BUF!', "load_picture_and_codes");
+ return false;
+ }
+
+ term_message("Reading scene %d", _G(game).new_room);
+
+ if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
+ _G(game).previous_room = _G(game).room_id;
+ }
+
+ // Read DEF file
+ if (db_def_chk_read(_G(game).new_room, rdef) != -1) {
+ error_show(FL, 'DF:(', "trying to find %ld.CHK", (uint32)_G(game).new_room);
+ return false;
+ }
+
+ set_walker_scaling(rdef);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Select background picture
+
+ _G(currBackgroundFN) = get_background_filename(rdef);
+
+ tempName = env_find(_G(currBackgroundFN));
+ if (tempName) {
+ // In normal rooms.db mode
+ _G(currBackgroundFN) = f_extension_new(tempName, "TT");
+ } else {
+ // In concat hag mode
+ _G(currBackgroundFN) = f_extension_new(_G(currBackgroundFN), "TT");
+ }
+
+ SysFile *pic_file = new SysFile(_G(currBackgroundFN), BINARY);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Select attributes code file
+
+ _G(currCodeFN) = get_attribute_filename(rdef);
+
+ tempName = env_find(_G(currCodeFN));
+ if (tempName) {
+ // In normal rooms.db mode
+ _G(currCodeFN) = f_extension_new(tempName, "COD");
+ } else {
+ // In concat hag mode
+ _G(currCodeFN) = f_extension_new(_G(currCodeFN), "COD");
+ }
+
+ SysFile *code_file = new SysFile(_G(currCodeFN), BINARY);
+ if (!code_file->exists()) {
+ delete code_file;
+ code_file = nullptr;
+ }
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Load background picture
+
+ term_message("load background");
+ RGB8 newPal[256];
+ load_background(pic_file, scr_orig, newPal);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Load attributes code file
+
+ term_message("load codes");
+ *scr_orig_data = load_codes(code_file);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Prepare buffers for display
+
+ recreate_animation_draw_screen(scr_orig);
+ troll_for_colors(newPal, minPalEntry, maxPalEntry);
+
+ gr_pal_reset_ega_colors(&_G(master_palette)[0]);
+
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ if (pic_file) {
+ pic_file->close();
+ delete pic_file;
+ }
+ if (code_file) {
+ code_file->close();
+ delete code_file;
+ }
+
+ if (*scr_orig_data) {
+ Buffer *scr_orig_data_buffer = (**scr_orig_data).get_buffer();
+ RestoreEdgeList(scr_orig_data_buffer);
+ (**scr_orig_data).release();
+ } else
+ RestoreEdgeList(nullptr);
+
+ _G(game).room_id = _G(game).new_room;
+ return true;
+}
+
+GrBuff *load_codes(SysFile *code_file) {
+ // No this is not a cheat to allow bugs to live,
+ // if there is no code file, then we don't need a code buffer, either.
+ // it's perfectly acceptable, so there, NYAH!
+ if (!code_file)
+ return nullptr;
+
+ int buffer_size;
+ int16 x_size, y_size;
+ char *bufferHandle;
+
+ bufferHandle = (char *)&x_size;
+ code_file->read((MemHandle)&bufferHandle, sizeof(int16));
+ bufferHandle = (char *)&y_size;
+ code_file->read((MemHandle)&bufferHandle, sizeof(int16));
+
+ x_size = convert_intel16(x_size);
+ y_size = convert_intel16(y_size);
+
+ buffer_size = (int)(x_size * y_size);
+
+ GrBuff *temp = new GrBuff(x_size, y_size);
+ if (!temp) {
+ error_show(FL, 'OOM!', "load_codes: %d bytes", (int16)(x_size * y_size));
+ return nullptr;
+ }
+
+ Buffer *mybuff = temp->get_buffer();
+
+ uint8 *buffer = mybuff->data;
+ bufferHandle = (char *)buffer;
+ for (int i = 0; i < y_size; i++) {
+ code_file->read((MemHandle)&bufferHandle, x_size);
+ bufferHandle += mybuff->stride;
+ }
+
+ // Let the memory float
+ temp->release();
+ return temp;
+}
+
+bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette) {
+ Buffer *out;
+ int i, j;
+ int count = 0;
+ long num_x_tiles, num_y_tiles, tile_x, tile_y, file_x, file_y, x_end, y_end;
+
+ tt_read_header(pic_file, &file_x, &file_y,
+ &num_x_tiles, &num_y_tiles, &tile_x, &tile_y, palette);
+
+ *loadBuffer = new GrBuff(file_x, file_y);
+
+ if (!*loadBuffer)
+ error_show(FL, 'OOM!');
+
+ Buffer *theBuff = (**loadBuffer).get_buffer();
+
+ for (i = 0; i < num_y_tiles; i++)
+ for (j = 0; j < num_x_tiles; j++)
+ {
+ out = tt_read(pic_file, count, tile_x, tile_y);
+ count++;
+ if (out && (out->data))
+ {
+ x_end = imath_min(file_x, (1 + j) * tile_x);
+ y_end = imath_min(file_y, (1 + i) * tile_y);
+ gr_buffer_rect_copy_2(out, theBuff, 0, 0, j * tile_x, i * tile_y, x_end, y_end);
+ mem_free(out->data);
+ }
+ if (out)
+ mem_free(out);
+ }
+
+ (**loadBuffer).release();
+ return true;
+}
+
static Common::SeekableReadStream *openForLoading(int slot) {
Common::String slotName = g_engine->getSaveStateName(slot);
return g_system->getSavefileManager()->openForLoading(slotName);
@@ -43,5 +284,76 @@ bool kernel_load_game(int slot) {
return g_engine->loadGameState(slot).getCode() == Common::kNoError;
}
+static int32 extract_room_num(const char *name) {
+ if ((name[0] == 'C' || name[0] == 'c') &&
+ (name[1] == 'O' || name[1] == 'o') &&
+ (name[2] == 'M' || name[2] == 'm'))
+ return _G(global_sound_room);
+
+ if (Common::isDigit(name[0]) && Common::isDigit(name[1]) && Common::isDigit(name[2])) {
+ return ((int32)(name[0] - '0')) * 100 + ((int32)(name[1] - '0')) * 10 + ((int32)(name[2] - '0'));
+ } else
+ return _G(game).room_id;
+}
+
+static Common::String get_background_filename(const SceneDef *rdef) {
+ if (_G(art_base_override) != nullptr) {
+ return _G(art_base_override);
+ } else {
+ return rdef->art_base;
+ }
+}
+
+static Common::String get_attribute_filename(const SceneDef *rdef) {
+ if (_G(art_base_override) == nullptr || !_G(use_alternate_attribute_file)) {
+ return rdef->art_base;
+ } else {
+ return _G(art_base_override);
+ }
+}
+
+static void recreate_animation_draw_screen(GrBuff **loadBuf) {
+ // remove previous animation draw screen
+
+ if (_G(gameDrawBuff)) {
+ gui_buffer_deregister((Buffer *)_G(gameDrawBuff));
+ delete _G(gameDrawBuff);
+ _G(gameDrawBuff) = nullptr;
+ _G(game_buff_ptr) = nullptr;
+ }
+ _G(gameDrawBuff) = new GrBuff((**loadBuf).w, (**loadBuf).h);
+ if (!_G(gameDrawBuff)) error_show(FL, 'OOM!', "no memory for GrBuff");
+ gui_GrBuff_register(_G(kernel).letter_box_x, _G(kernel).letter_box_y, _G(gameDrawBuff),
+ SF_BACKGRND | SF_GET_ALL | SF_BLOCK_NONE, nullptr);
+ gui_buffer_activate((Buffer *)_G(gameDrawBuff));
+ vmng_screen_to_back((void *)_G(gameDrawBuff));
+ _G(game_buff_ptr) = vmng_screen_find(_G(gameDrawBuff), nullptr);
+
+ Buffer *theBuff = (**loadBuf).get_buffer();
+ Buffer *game_buff = (*_G(gameDrawBuff)).get_buffer();
+ gr_buffer_rect_copy_2(theBuff, game_buff, 0, 0, 0, 0,
+ imath_min((**loadBuf).w, game_buff->W), imath_min((**loadBuf).h, game_buff->h));
+
+ (**loadBuf).release();
+ (*_G(gameDrawBuff)).release();
+}
+
+static void troll_for_colors(RGB8 *newPal, uint8 minPalEntry, uint8 maxPalEntry) {
+ bool gotOne = false;
+ int16 pal_iter;
+ for (pal_iter = minPalEntry; pal_iter <= maxPalEntry; pal_iter++) // accept any colours that came with the background
+ if (gotOne || (newPal[pal_iter].r | newPal[pal_iter].g | newPal[pal_iter].b))
+ {
+ gotOne = true;
+ // colors are 6 bit...
+ _G(master_palette)[pal_iter].r = newPal[pal_iter].r << 2;
+ _G(master_palette)[pal_iter].g = newPal[pal_iter].g << 2;
+ _G(master_palette)[pal_iter].b = newPal[pal_iter].b << 2;
+ }
+ if (gotOne) {
+ gr_pal_interface(&_G(master_palette)[0]); // enforce interface colours
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 2f9c66523e6..49e54b4e1a2 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -21,6 +21,7 @@
#include "m4/adv_r/adv_walk.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/vars.h"
namespace M4 {
@@ -33,4 +34,16 @@ void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *
error("TODO: ws_get_walker_info");
}
+void set_walker_scaling(SceneDef *rdef) {
+ _G(globals)[GLB_MIN_Y] = rdef->back_y << 16;
+ _G(globals)[GLB_MAX_Y] = rdef->front_y << 16;
+ _G(globals)[GLB_MIN_SCALE] = FixedDiv(rdef->back_scale << 16, 100 << 16);
+ _G(globals)[GLB_MAX_SCALE] = FixedDiv(rdef->front_scale << 16, 100 << 16);
+ if (_G(globals)[GLB_MIN_Y] == _G(globals)[GLB_MAX_Y])
+ _G(globals)[GLB_SCALER] = 0;
+ else
+ _G(globals)[GLB_SCALER] = FixedDiv(_G(globals)[GLB_MAX_SCALE] - _G(globals)[GLB_MIN_SCALE], _G(globals)[GLB_MAX_Y] - _G(globals)[GLB_MIN_Y]);
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 587ae88db2e..4ef76e022ff 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -95,6 +95,43 @@ void Interface::cancel_sentence() {
warning("TODO: cancel_sentence");
}
+bool Interface::set_interface_palette(RGB8 *myPalette) {
+ gr_pal_set_RGB8(&myPalette[1], 0, 68, 0);
+ gr_pal_set_RGB8(&myPalette[2], 0, 134, 0);
+ gr_pal_set_RGB8(&myPalette[3], 0, 204, 0);
+ gr_pal_set_RGB8(&myPalette[4], 28, 8, 90);
+ gr_pal_set_RGB8(&myPalette[5], 204, 204, 250);
+ gr_pal_set_RGB8(&myPalette[6], 204, 204, 102);
+ gr_pal_set_RGB8(&myPalette[7], 5, 1, 0);
+ gr_pal_set_RGB8(&myPalette[8], 102, 51, 222);
+ gr_pal_set_RGB8(&myPalette[9], 85, 117, 255);
+ gr_pal_set_RGB8(&myPalette[10], 68, 68, 68);
+ gr_pal_set_RGB8(&myPalette[11], 51, 255, 0);
+ gr_pal_set_RGB8(&myPalette[12], 51, 51, 115);
+ gr_pal_set_RGB8(&myPalette[13], 119, 119, 119);
+ gr_pal_set_RGB8(&myPalette[14], 151, 153, 150);
+ gr_pal_set_RGB8(&myPalette[15], 153, 0, 0);
+ gr_pal_set_RGB8(&myPalette[16], 153, 53, 9);
+ gr_pal_set_RGB8(&myPalette[17], 117, 246, 255);
+ gr_pal_set_RGB8(&myPalette[18], 88, 0, 0);
+ gr_pal_set_RGB8(&myPalette[19], 195, 0, 83);
+ gr_pal_set_RGB8(&myPalette[20], 204, 102, 61);
+ gr_pal_set_RGB8(&myPalette[21], 204, 153, 118);
+ gr_pal_set_RGB8(&myPalette[22], 204, 255, 204);
+ gr_pal_set_RGB8(&myPalette[23], 207, 158, 73);
+ gr_pal_set_RGB8(&myPalette[24], 238, 0, 0);
+ gr_pal_set_RGB8(&myPalette[25], 248, 51, 31);
+ gr_pal_set_RGB8(&myPalette[26], 255, 131, 0);
+ gr_pal_set_RGB8(&myPalette[27], 255, 153, 102);
+ gr_pal_set_RGB8(&myPalette[28], 255, 204, 153);
+ gr_pal_set_RGB8(&myPalette[29], 255, 252, 144);
+ gr_pal_set_RGB8(&myPalette[30], 255, 255, 0);
+ gr_pal_set_RGB8(&myPalette[31], 255, 255, 255);
+ gr_pal_set_range(myPalette, 1, 31);
+
+ return true;
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 2d2a39da858..d13ca07d99f 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -61,6 +61,8 @@ public:
void cancel_sentence() override;
+ bool set_interface_palette(RGB8 *myPalette) override;
+
void show();
};
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8f2dce01ae9..0906cfb71e3 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -71,6 +71,7 @@ public:
extern Vars *g_globals;
#undef _G
+#undef _GI
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
#define VAL(X) _G(_globals)[X]
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index a110b2d88eb..f2ed4a97fad 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -20,6 +20,8 @@
*/
#include "m4/core/rooms.h"
+#include "m4/core/errors.h"
+#include "m4/adv_r/adv_file.h"
#include "m4/vars.h"
namespace M4 {
@@ -65,17 +67,17 @@ void Sections::m4SceneLoad() {
// -------------------- ROOM LOAD ------------------
- g_vars->getInterface()->cancel_sentence();
+ _GI().cancel_sentence();
gr_pal_clear_range(_G(master_palette), _G(kernel).first_fade, 255);
term_message("Calling kernel_load_room");
-#ifdef TODO
- _G(kernel).going = kernel_load_room(_G(kernel).minPalEntry, _G(kernel).maxPalEntry, ¤tSceneDef, &screenCodeBuff, &game_bgBuff);
+ _G(kernel).going = kernel_load_room(_G(kernel).minPalEntry, _G(kernel).maxPalEntry,
+ &_G(currentSceneDef), &_G(screenCodeBuff), &_G(game_bgBuff));
if (!_G(kernel).going)
error_show(FL, 'IMP!'); // this should never ever happen
- HEAPCHECK
+#ifdef TODO
get_ipl();
// moved above. see explanation there.
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 82f25732f4e..d3f18ce8eb1 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -141,7 +141,7 @@ const byte *gr_buffer_pointer(const Buffer *buf, int32 x, int32 y) {
return (byte *)(buf->data + x + (y * buf->stride));
}
-int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h) {
+int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
if (buf->data)
error_show(FL, 'BUFR', "buffer_init %s", name);
diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
index 5ddd9310cf8..c8a593a86dd 100644
--- a/engines/m4/graphics/gr_buff.h
+++ b/engines/m4/graphics/gr_buff.h
@@ -61,7 +61,7 @@ public:
extern int32 gr_buffer_free(Buffer *buf);
extern byte *gr_buffer_pointer(Buffer *buf, int32 x, int32 y);
extern const byte *gr_buffer_pointer(const Buffer *buf, int32 x, int32 y);
-extern int32 gr_buffer_init(Buffer *buf, char *name, int32 w, int32 h);
+extern int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h);
/**
* Copies a "rectangular" buffer area from "from" to "unto". Size
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index d1935b96e32..5ee133a2a34 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -114,6 +114,33 @@ uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b) {
return (uint8)index;
}
+void gr_pal_interface(RGB8 *fixpal) {
+ if (_GI().set_interface_palette(fixpal))
+ return;
+
+ // Low intesity
+ gr_pal_set_RGB8(&fixpal[0], 0, 0, 0); // r0 g0 b0 black
+ gr_pal_set_RGB8(&fixpal[1], 0, 0, 168); // r0 g0 b2 blue
+ gr_pal_set_RGB8(&fixpal[2], 0, 168, 0); // r0 g2 b0 green
+ gr_pal_set_RGB8(&fixpal[3], 0, 168, 168); // r0 g2 b2 cyan
+
+ gr_pal_set_RGB8(&fixpal[4], 168, 0, 0); // r2 g0 b0 red
+ gr_pal_set_RGB8(&fixpal[5], 168, 0, 168); // r2 g0 b2 violet
+ gr_pal_set_RGB8(&fixpal[6], 168, 92, 0); // r2 g1 b0 brown
+ gr_pal_set_RGB8(&fixpal[7], 168, 168, 168); // r2 g2 b2 light grey
+
+ // high intensity
+ gr_pal_set_RGB8(&fixpal[8], 92, 92, 92); // r1 g1 b1 dark grey
+ gr_pal_set_RGB8(&fixpal[9], 92, 92, 255); // r1 g1 b2 light blue
+ gr_pal_set_RGB8(&fixpal[10], 92, 255, 92); // r1 g2 b1 light green
+ gr_pal_set_RGB8(&fixpal[11], 92, 255, 255); // r1 g2 b2 light cyan
+
+ gr_pal_set_RGB8(&fixpal[12], 255, 92, 92); // r2 g1 b1 light red
+ gr_pal_set_RGB8(&fixpal[13], 255, 92, 255); // r2 g1 b2 pink
+ gr_pal_set_RGB8(&fixpal[14], 255, 255, 23); // r2 g2 b1 yellow
+ gr_pal_set_RGB8(&fixpal[15], 255, 255, 255);// r1 g1 b1 white
+}
+
void gr_pal_reset_ega_colors(RGB8 *pal) {
#ifdef TODO
EGAcolors[0] = gr_pal_find_best_match(pal, 0, 0, 0); //__BLACK
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 87609a325bb..3a35f2f100e 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -45,18 +45,20 @@ namespace M4 {
extern constexpr uint8 gr_pal_get_ega_color(uint8 myColor);
-void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
-uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
-void gr_color_set(int32 c);
-byte gr_color_get_current();
-
-void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
-void gr_pal_set(RGB8 *pal);
-void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
-void gr_pal_set_entry(int32 index, RGB8 *entry);
-void gr_pal_clear(RGB8 *palette);
-void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color);
-uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b);
+extern void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
+extern uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
+extern void gr_color_set(int32 c);
+extern byte gr_color_get_current();
+
+extern void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
+extern void gr_pal_set(RGB8 *pal);
+extern void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
+extern void gr_pal_set_entry(int32 index, RGB8 *entry);
+extern void gr_pal_clear(RGB8 *palette);
+extern void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color);
+extern uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b);
+extern void gr_pal_interface(RGB8 *fixpal);
+extern void gr_pal_reset_ega_colors(RGB8 *pal);
} // namespace M4
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 7187adc540b..10681dc93ba 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -66,8 +66,6 @@
namespace M4 {
-static ScreenContext *ExtractScreen(void *scrnContent, int32 status);
-
bool vmng_init() {
if (_G(vmng_Initted))
return false;
@@ -271,11 +269,7 @@ void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2,
g_system->updateScreen();
}
-/**
- * Remove the window from either the active list of windows, or the inactive list,
- * wherever it was found.
- */
-static ScreenContext *ExtractScreen(void *scrnContent, int32 status) {
+ScreenContext *ExtractScreen(void *scrnContent, int32 status) {
ScreenContext *myScreen = nullptr, *tempScreen;
if (!_G(vmng_Initted))
return nullptr;
diff --git a/engines/m4/gui/gui_vmng_core.h b/engines/m4/gui/gui_vmng_core.h
index 6ad3ad89d6b..9de1f197aa3 100644
--- a/engines/m4/gui/gui_vmng_core.h
+++ b/engines/m4/gui/gui_vmng_core.h
@@ -111,6 +111,12 @@ extern void vmng_screen_dispose(void *scrnContent); // was DestroyScreen
extern void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer);
+/**
+ * Remove the window from either the active list of windows, or the inactive list,
+ * wherever it was found.
+ */
+extern ScreenContext *ExtractScreen(void *scrnContent, int32 status);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index e9ed933729c..23bc81e3129 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -272,6 +272,41 @@ bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY) {
return MoveScreen(myScreen, parmX, parmY, true);
}
+void vmng_screen_to_back(void *scrnContent) {
+ ScreenContext *myScreen, *tempScreen;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == NULL) return;
+ if (!_G(backScreen)) {
+ myScreen->infront = NULL;
+ myScreen->behind = NULL;
+ _G(frontScreen) = myScreen;
+ _G(backScreen) = myScreen;
+ } else {
+ tempScreen = _G(backScreen);
+ while (tempScreen &&
+ ((tempScreen->scrnFlags & SF_LAYER) < (myScreen->scrnFlags & SF_LAYER))) {
+ tempScreen = tempScreen->infront;
+ }
+ if (!tempScreen) {
+ myScreen->infront = NULL;
+ myScreen->behind = _G(frontScreen);
+ _G(frontScreen)->infront = myScreen;
+ _G(frontScreen) = myScreen;
+ } else if (tempScreen == _G(backScreen)) {
+ myScreen->infront = _G(backScreen);
+ myScreen->behind = NULL;
+ _G(backScreen)->behind = myScreen;
+ _G(backScreen) = myScreen;
+ } else {
+ myScreen->infront = tempScreen;
+ myScreen->behind = tempScreen->behind;
+ tempScreen->behind = myScreen;
+ myScreen->behind->infront = myScreen;
+ }
+ }
+
+ RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
+}
+
static bool MoveScreen(ScreenContext *myScreen, int32 parmX, int32 parmY, bool deltaMove) {
int32 origX1, origY1, origX2, origY2;
if (!_G(vmng_Initted))
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
index 75d3dae5493..861c51f9dc4 100644
--- a/engines/m4/gui/interface.h
+++ b/engines/m4/gui/interface.h
@@ -42,6 +42,8 @@ public:
virtual void cancel_sentence() = 0;
+ virtual bool set_interface_palette(RGB8 *myPalette) = 0;
+
/**
* Show the wait cursor
*/
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 37237887996..cb62c94b4f7 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -60,6 +60,7 @@ MODULE_OBJS = \
mem/res.o \
platform/sound.o \
platform/timer.o \
+ platform/tile/tile_read.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
wscript/ws_load.o \
diff --git a/engines/m4/platform/tile/tile_read.cpp b/engines/m4/platform/tile/tile_read.cpp
new file mode 100644
index 00000000000..fb0e264ed15
--- /dev/null
+++ b/engines/m4/platform/tile/tile_read.cpp
@@ -0,0 +1,155 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/platform/tile/tile_read.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_buff.h"
+#include "m4/mem/memman.h"
+//include "m4/vars.h"
+
+namespace M4 {
+
+void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
+ long *num_x_tiles, long *num_y_tiles, long *tile_x, long *tile_y, RGB8 *pal) {
+ long value;
+ uint8 buf[4];
+ int i;
+ byte *byte_ptr;
+ void *bufferHandle;
+
+ // Initalize return parameters
+ *num_x_tiles = 0;
+ *num_y_tiles = 0;
+ *tile_x = 0;
+ *tile_y = 0;
+ *file_x = 0;
+ *file_y = 0;
+
+ // Open file
+ if (!ifp->exists())
+ error_show(FL, 'FNF!', ".TT file");
+
+ // Read chunk id
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ value = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0]; //because in intel chip, swap order of high bits and low bits
+
+ // Read chunk size
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ value = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read file_x size
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *file_x = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read file_y size
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *file_y = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read number of x tiles
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *num_x_tiles = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read number of y tiles
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *num_y_tiles = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read size of tile_x
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *tile_x = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Read size of tile_y
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ *tile_y = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ // Write color table
+ for (i = 0; i < 256; i++) {
+ byte_ptr = (byte *)&value;
+ bufferHandle = &buf[0];
+ ifp->read((MemHandle)&bufferHandle, 4);
+ value = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
+ byte_ptr++;
+ pal[i].r = (value >> 16) & 0x0ff;
+ byte_ptr++;
+ pal[i].g = (value >> 8) & 0x0ff;
+ byte_ptr++;
+ pal[i].b = (value) & 0x0ff;
+ }
+}
+
+Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y) {
+ long tile_size;
+ int offset;
+ Buffer *out;
+ void *bufferHandle;
+
+ out = (Buffer *)mem_alloc(sizeof(Buffer), "tile buffer");
+ if (!out)
+ error_show(FL, 'OOM!', "fail to allocate mem for buffer structure");
+
+ out->data = nullptr;
+ out->W = 0;
+ out->stride = 0;
+ out->h = 0;
+
+ // Check parameters
+ if (index < 0)
+ error_show(FL, 'TILI');
+
+ tile_size = tile_x * tile_y;
+
+ if (index == 0) {
+ // First tile data
+ if (!ifp->exists())
+ error_show(FL, 'FNF!', ".TT file");
+
+ // Read data of tiles to file
+ offset = index * tile_size + 256 * 4 + 32; // Get rid of color table and header stuff
+ ifp->seek((uint32)offset);
+ }
+
+ gr_buffer_init(out, "back tile", tile_x, tile_y);
+ if (out->data == nullptr) {
+ out->W = 0;
+ out->stride = 0;
+ out->h = 0;
+ error_show(FL, 'OOM!', "fail to allocate mem for .TT buffer");
+ return out;
+ }
+
+ out->W = out->stride = tile_x;
+ out->h = tile_y;
+
+ bufferHandle = out->data;
+ ifp->read((MemHandle)&bufferHandle, tile_size);
+
+ return out;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/platform/tile/tile_read.h b/engines/m4/platform/tile/tile_read.h
new file mode 100644
index 00000000000..528f153cb37
--- /dev/null
+++ b/engines/m4/platform/tile/tile_read.h
@@ -0,0 +1,46 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_PLATFORM_TILE_READ_H
+#define M4_PLATFORM_TILE_READ_H
+
+#include "m4/m4_types.h"
+#include "m4/fileio/sys_file.h"
+
+namespace M4 {
+
+/**
+ * Gets some information about a tt file
+ */
+extern void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
+ long *num_x_tiles, long *num_y_tiles, long *tile_x, long *tile_y, RGB8 *pal);
+
+/**
+ * Returns a pointer to an initialized buffer containing the image data.
+ * If an error occurs, out.x contains the error number while out.y is zero,
+ * and out.data is NULL.
+ */
+extern Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index af955d9a882..b8178103710 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -112,8 +112,10 @@ public:
bool _system_shutting_down = false;
InventoryBase *_inventory = nullptr;
size_t _mem_to_alloc = 0;
- void *_gameInterfaceBuff = nullptr;
+ GrBuff *_screenCodeBuff = nullptr;
+ GrBuff *_game_bgBuff = nullptr;
GrBuff *_gameDrawBuff = nullptr;
+ GrBuff *_gameInterfaceBuff = nullptr;
void *_custom_interface_setup = nullptr;
void *_custom_interface_button_handler = nullptr;
int _global_sound_room = 0;
@@ -152,10 +154,14 @@ public:
bool _set_commands_allowed_since_last_checked = false;
SceneDef *_myDef = nullptr;
Common::String _def_filename;
+ Common::String _currBackgroundFN;
+ Common::String _currCodeFN;
+ ScreenContext *_game_buff_ptr = nullptr;
};
#define _G(X) (g_vars->_##X)
#define _GV() g_vars->getGlobals()
+#define _GI() (*g_vars->getInterface())
} // namespace M4
Commit: 37ba837557e17de365fa14a6db827c38ffe6e173
https://github.com/scummvm/scummvm/commit/37ba837557e17de365fa14a6db827c38ffe6e173
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added get_ipl method
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index f2ed4a97fad..16980502661 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -22,6 +22,8 @@
#include "m4/core/rooms.h"
#include "m4/core/errors.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/adv_r/db_env.h"
+#include "m4/fileio/extensions.h"
#include "m4/vars.h"
namespace M4 {
@@ -77,14 +79,9 @@ void Sections::m4SceneLoad() {
if (!_G(kernel).going)
error_show(FL, 'IMP!'); // this should never ever happen
+ get_ipl();
#ifdef TODO
- get_ipl();
-
- // moved above. see explanation there.
- // if (player.walker_in_this_scene)
- // get_walker();
-
- // must reset event handler because loading a room re-initalizes gameBuff
+ // Must reset event handler because loading a room re-initalizes gameBuff
gui_buffer_set_event_handler((Buffer *)gameDrawBuff, intr_EventHandler);
_G(kernel).trigger_mode = KT_DAEMON;
@@ -146,6 +143,29 @@ void Sections::m4SceneLoad() {
#endif
}
+void Sections::get_ipl() {
+ if (_G(inverse_pal))
+ delete _G(inverse_pal);
+ _G(inverse_pal) = NULL;
+
+ char *name;
+ Common::String filename;
+
+ name = env_find(_G(currentSceneDef).art_base);
+ if (name) {
+ // Means found in database
+ filename = f_extension_new(name, "ipl");
+
+ } else {
+ // Concat hag mode
+ filename = Common::String::format("%s.IPL", _G(currentSceneDef).art_base);
+ }
+
+ _G(inverse_pal) = new InvPal(filename.c_str());
+ if (!_G(inverse_pal))
+ error_show(FL, 'OOM!', "loading ipl: %s", filename.c_str());
+}
+
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index c8873f4b0bb..a1ae3bb2714 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -78,6 +78,8 @@ private:
bool shut_down_digi_tracks_between_rooms = true;
int32 camera_pan_step = 10;
+ void get_ipl();
+
public:
Section *_sections = nullptr;
Section *_activeSection = nullptr;
Commit: d3b979cfb3bff9afec3cd229760bb5aafe1c6bd2
https://github.com/scummvm/scummvm/commit/d3b979cfb3bff9afec3cd229760bb5aafe1c6bd2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gui_buffer_set_event_handler
Changed paths:
A engines/m4/adv_r/adv_interface.cpp
A engines/m4/adv_r/adv_interface.h
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/core/rooms.cpp
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index d1dce5636cf..706860958a3 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/adv_r/adv_control.h"
+#include "m4/adv_r/adv_interface.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
#include "m4/vars.h"
@@ -50,8 +51,4 @@ void player_set_commands_allowed(bool t_or_f) {
}
}
-void track_hotspots_refresh() {
- warning("TODO: track_hotspots_refresh");
-}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 882f19ace4e..1f7400a5893 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -28,10 +28,8 @@
namespace M4 {
-
extern bool kernel_section_startup();
extern void player_set_commands_allowed(bool t_or_f);
-extern void track_hotspots_refresh();
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
new file mode 100644
index 00000000000..f4caf41e153
--- /dev/null
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY {} without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_interface.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+void interface_hide() {
+ warning("TODO: interface_hide");
+}
+
+void interface_show() {
+ warning("TODO: interface_show");
+}
+
+void track_hotspots_refresh() {
+}
+
+bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+ warning("TODO: intr_EventHandler");
+ return true;
+}
+
+void intr_set_verb(char *name) {
+ warning("TODO: intr_set_verb");
+}
+
+void intr_set_object(char *name) {
+ warning("TODO: intr_set_object");
+}
+
+void intr_set_prep(char *name) {
+ warning("TODO: intr_set_prep");
+}
+
+void intr_set_ind_object(char *name) {
+ warning("TODO: intr_set_ind_object");
+}
+
+void intr_cancel_sentence() {
+ _GI().cancel_sentence();
+}
+
+void intr_show_sentence() {
+ warning("TODO: inter_inv_button_callback");
+}
+
+void inter_callback(void *a, void *b) {
+ warning("TODO: inter_inv_button_callback");
+}
+
+void inter_inv_button_callback(void *myItem, void *myDlog) {
+ warning("TODO: inter_inv_button_callback");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
new file mode 100644
index 00000000000..02ecd4ac49a
--- /dev/null
+++ b/engines/m4/adv_r/adv_interface.h
@@ -0,0 +1,49 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_INTERFACE_H
+#define M4_ADV_R_ADV_INTERFACE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void interface_hide();
+extern void interface_show();
+
+extern void track_hotspots_refresh();
+extern bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z);
+
+extern void intr_set_verb(char *name);
+extern void intr_set_object(char *name);
+extern void intr_set_prep(char *name);
+extern void intr_set_ind_object(char *name);
+
+extern void intr_cancel_sentence();
+extern void intr_show_sentence();
+
+extern void inter_callback(void *a, void *b);
+extern void inter_inv_button_callback(void *myItem, void *myDlog);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 16980502661..ddbe68fcfd8 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -22,8 +22,10 @@
#include "m4/core/rooms.h"
#include "m4/core/errors.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/adv_r/adv_interface.h"
#include "m4/adv_r/db_env.h"
#include "m4/fileio/extensions.h"
+#include "m4/gui/gui_buffer.h"
#include "m4/vars.h"
namespace M4 {
@@ -80,14 +82,14 @@ void Sections::m4SceneLoad() {
error_show(FL, 'IMP!'); // this should never ever happen
get_ipl();
-#ifdef TODO
+
// Must reset event handler because loading a room re-initalizes gameBuff
- gui_buffer_set_event_handler((Buffer *)gameDrawBuff, intr_EventHandler);
+ gui_buffer_set_event_handler((Buffer *)_G(gameDrawBuff), intr_EventHandler);
_G(kernel).trigger_mode = KT_DAEMON;
_G(kernel).call_daemon_every_loop = false;
_G(kernel).fade_up_time = 30;
-
+#ifdef TODO
if (myInterface) {
myInterface->must_redraw_all = true;
myInterface->draw(gameInterfaceBuff);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index cb62c94b4f7..3cfd7f0b524 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS = \
adv_r/adv_file.o \
adv_r/adv_game.o \
adv_r/adv_hotspot.o \
+ adv_r/adv_interface.o \
adv_r/adv_inv.o \
adv_r/adv_player.o \
adv_r/adv_rails.o \
Commit: a37500bc357bf18c4a19532690e8dd0d9cc1ddf3
https://github.com/scummvm/scummvm/commit/a37500bc357bf18c4a19532690e8dd0d9cc1ddf3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding Interface methods
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/gui/interface.cpp
engines/m4/gui/interface.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 706860958a3..691f35f95c4 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -41,8 +41,7 @@ void player_set_commands_allowed(bool t_or_f) {
if (t_or_f) {
// OK to do something
mouse_set_sprite(kArrowCursor);
- _GI().cancel_sentence();
-
+ intr_cancel_sentence();
track_hotspots_refresh();
} else {
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index f4caf41e153..2f160ded6f7 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -25,14 +25,15 @@
namespace M4 {
void interface_hide() {
- warning("TODO: interface_hide");
+ _GI().hide();
}
void interface_show() {
- warning("TODO: interface_show");
+ _GI().show();
}
void track_hotspots_refresh() {
+ _GI().track_hotspots_refresh();
}
bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
@@ -40,36 +41,8 @@ bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, i
return true;
}
-void intr_set_verb(char *name) {
- warning("TODO: intr_set_verb");
-}
-
-void intr_set_object(char *name) {
- warning("TODO: intr_set_object");
-}
-
-void intr_set_prep(char *name) {
- warning("TODO: intr_set_prep");
-}
-
-void intr_set_ind_object(char *name) {
- warning("TODO: intr_set_ind_object");
-}
-
void intr_cancel_sentence() {
_GI().cancel_sentence();
}
-void intr_show_sentence() {
- warning("TODO: inter_inv_button_callback");
-}
-
-void inter_callback(void *a, void *b) {
- warning("TODO: inter_inv_button_callback");
-}
-
-void inter_inv_button_callback(void *myItem, void *myDlog) {
- warning("TODO: inter_inv_button_callback");
-}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index 02ecd4ac49a..933d05baa25 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -33,16 +33,7 @@ extern void interface_show();
extern void track_hotspots_refresh();
extern bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z);
-extern void intr_set_verb(char *name);
-extern void intr_set_object(char *name);
-extern void intr_set_prep(char *name);
-extern void intr_set_ind_object(char *name);
-
extern void intr_cancel_sentence();
-extern void intr_show_sentence();
-
-extern void inter_callback(void *a, void *b);
-extern void inter_inv_button_callback(void *myItem, void *myDlog);
} // End of namespace M4
diff --git a/engines/m4/gui/interface.cpp b/engines/m4/gui/interface.cpp
index d94e0c44ddd..68239a5473f 100644
--- a/engines/m4/gui/interface.cpp
+++ b/engines/m4/gui/interface.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/gui/interface.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
namespace M4 {
@@ -36,4 +37,20 @@ void Interface::showWaitCursor() {
mouse_set_sprite(_wait);
}
+void Interface::show() {
+ warning("TODO: Interface::show");
+}
+
+void Interface::hide() {
+ if (_shown) {
+ vmng_screen_hide(_G(gameInterfaceBuff));
+ _visible = false;
+ }
+}
+
+void Interface::track_hotspots_refresh() {
+ warning("TODO: track_hotspots_refresh");
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
index 861c51f9dc4..20e7c41fe04 100644
--- a/engines/m4/gui/interface.h
+++ b/engines/m4/gui/interface.h
@@ -29,6 +29,9 @@ namespace M4 {
class Interface {
public:
+ bool _shown = false;
+ bool _visible = false;
+
int _arrow = 0;
int _wait = 0;
int _look = 0;
@@ -44,10 +47,22 @@ public:
virtual bool set_interface_palette(RGB8 *myPalette) = 0;
+ void track_hotspots_refresh();
+
/**
* Show the wait cursor
*/
void showWaitCursor();
+
+ /**
+ * Show the interface
+ */
+ void show();
+
+ /**
+ * Hide the interface
+ */
+ void hide();
};
} // End of namespace M4
Commit: a88f14c6888fcf83de9196745d3187c932484337
https://github.com/scummvm/scummvm/commit/a88f14c6888fcf83de9196745d3187c932484337
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merge interface.cpp into adv_interface.cpp
Changed paths:
R engines/m4/gui/interface.cpp
R engines/m4/gui/interface.h
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/burger/gui/interface.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index 2f160ded6f7..3fa9c0fc86a 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -20,10 +20,39 @@
*/
#include "m4/adv_r/adv_interface.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
namespace M4 {
+void Interface::init(int arrow, int wait, int look, int grab, int use) {
+ _arrow = arrow;
+ _wait = wait;
+ _look = look;
+ _grab = grab;
+ _use = use;
+}
+
+void Interface::showWaitCursor() {
+ mouse_set_sprite(_wait);
+}
+
+void Interface::show() {
+ warning("TODO: Interface::show");
+}
+
+void Interface::hide() {
+ if (_shown) {
+ vmng_screen_hide(_G(gameInterfaceBuff));
+ _visible = false;
+ }
+}
+
+void Interface::track_hotspots_refresh() {
+ warning("TODO: track_hotspots_refresh");
+}
+
+
void interface_hide() {
_GI().hide();
}
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index 933d05baa25..1f0091faf81 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -27,6 +27,45 @@
namespace M4 {
+class Interface {
+public:
+ bool _shown = false;
+ bool _visible = false;
+
+ int _arrow = 0;
+ int _wait = 0;
+ int _look = 0;
+ int _grab = 0;
+ int _use = 0;
+
+public:
+ virtual ~Interface() {
+ }
+
+ virtual void init(int arrow, int wait, int look, int grab, int use);
+
+ virtual void cancel_sentence() = 0;
+
+ virtual bool set_interface_palette(RGB8 *myPalette) = 0;
+
+ void track_hotspots_refresh();
+
+ /**
+ * Show the wait cursor
+ */
+ void showWaitCursor();
+
+ /**
+ * Show the interface
+ */
+ void show();
+
+ /**
+ * Hide the interface
+ */
+ void hide();
+};
+
extern void interface_hide();
extern void interface_show();
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index d13ca07d99f..2753946dd3d 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -23,7 +23,7 @@
#ifndef M4_BURGER_INTERFACE_H
#define M4_BURGER_INTERFACE_H
-#include "m4/gui/interface.h"
+#include "m4/adv_r/adv_interface.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
#include "m4/burger/gui/gui_cheapo.h"
diff --git a/engines/m4/gui/interface.cpp b/engines/m4/gui/interface.cpp
deleted file mode 100644
index 68239a5473f..00000000000
--- a/engines/m4/gui/interface.cpp
+++ /dev/null
@@ -1,56 +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/>.
- *
- */
-
-#include "m4/gui/interface.h"
-#include "m4/gui/gui_vmng.h"
-#include "m4/vars.h"
-
-namespace M4 {
-
-void Interface::init(int arrow, int wait, int look, int grab, int use) {
- _arrow = arrow;
- _wait = wait;
- _look = look;
- _grab = grab;
- _use = use;
-}
-
-void Interface::showWaitCursor() {
- mouse_set_sprite(_wait);
-}
-
-void Interface::show() {
- warning("TODO: Interface::show");
-}
-
-void Interface::hide() {
- if (_shown) {
- vmng_screen_hide(_G(gameInterfaceBuff));
- _visible = false;
- }
-}
-
-void Interface::track_hotspots_refresh() {
- warning("TODO: track_hotspots_refresh");
-}
-
-
-} // End of namespace M4
diff --git a/engines/m4/gui/interface.h b/engines/m4/gui/interface.h
deleted file mode 100644
index 20e7c41fe04..00000000000
--- a/engines/m4/gui/interface.h
+++ /dev/null
@@ -1,70 +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/>.
- *
- */
-
-#ifndef M4_GUI_GUI_INTERFACE_H
-#define M4_GUI_GUI_INTERFACE_H
-
-#include "m4/m4_types.h"
-
-namespace M4 {
-
-class Interface {
-public:
- bool _shown = false;
- bool _visible = false;
-
- int _arrow = 0;
- int _wait = 0;
- int _look = 0;
- int _grab = 0;
- int _use = 0;
-
-public:
- virtual ~Interface() {}
-
- virtual void init(int arrow, int wait, int look, int grab, int use);
-
- virtual void cancel_sentence() = 0;
-
- virtual bool set_interface_palette(RGB8 *myPalette) = 0;
-
- void track_hotspots_refresh();
-
- /**
- * Show the wait cursor
- */
- void showWaitCursor();
-
- /**
- * Show the interface
- */
- void show();
-
- /**
- * Hide the interface
- */
- void hide();
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 3cfd7f0b524..dd163815e01 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -54,7 +54,6 @@ MODULE_OBJS = \
gui/gui_vmng_rectangles.o \
gui/gui_vmng_screen.o \
gui/hotkeys.o \
- gui/interface.o \
mem/mem.o \
mem/memman.o \
mem/reloc.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index b8178103710..e48a2c81225 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -29,6 +29,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_game.h"
+#include "m4/adv_r/adv_interface.h"
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
@@ -42,7 +43,6 @@
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
-#include "m4/gui/interface.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
Commit: 27795d8ffa7b652fffb27c362a948a67460e3b85
https://github.com/scummvm/scummvm/commit/27795d8ffa7b652fffb27c362a948a67460e3b85
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented Interface::show, eventHandler stub
Changed paths:
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index 3fa9c0fc86a..674bd48c643 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/adv_r/adv_interface.h"
+#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
@@ -38,7 +39,12 @@ void Interface::showWaitCursor() {
}
void Interface::show() {
- warning("TODO: Interface::show");
+ if (!_shown) {
+ gui_GrBuff_register(_x1, _y1, _G(gameInterfaceBuff),
+ SF_DRIFTER | SF_GET_KEY | SF_GET_MOUSE | SF_IMMOVABLE,
+ intr_EventHandler);
+ _shown = true;
+ }
}
void Interface::hide() {
@@ -66,8 +72,7 @@ void track_hotspots_refresh() {
}
bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
- warning("TODO: intr_EventHandler");
- return true;
+ return _GI().eventHandler(bufferPtr, eventType, event, x, y, z);
}
void intr_cancel_sentence() {
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index 1f0091faf81..f6c895110a7 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -31,6 +31,7 @@ class Interface {
public:
bool _shown = false;
bool _visible = false;
+ int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
int _arrow = 0;
int _wait = 0;
@@ -48,22 +49,24 @@ public:
virtual bool set_interface_palette(RGB8 *myPalette) = 0;
- void track_hotspots_refresh();
+ virtual bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) = 0;
- /**
- * Show the wait cursor
- */
- void showWaitCursor();
+ void track_hotspots_refresh();
/**
* Show the interface
*/
- void show();
+ virtual void show();
/**
* Hide the interface
*/
void hide();
+
+ /**
+ * Show the wait cursor
+ */
+ void showWaitCursor();
};
extern void interface_hide();
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 4ef76e022ff..28c8d715757 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -22,12 +22,20 @@
#include "m4/burger/gui/interface.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace GUI {
+Interface::Interface() : M4::Interface() {
+ _x1 = 0;
+ _y1 = 374;
+ _x2 = SCREEN_WIDTH;
+ _y2 = SCREEN_HEIGHT;
+}
+
void Interface::init(int arrow, int wait, int look, int grab, int use) {
M4::Interface::init(arrow, wait, look, grab, use);
@@ -58,7 +66,11 @@ Interface::~Interface() {
}
void Interface::show() {
- error("TODO: Interface::show");
+ M4::Interface::show();
+ _interfaceBox->_must_redraw_all = true;
+ vmng_screen_show(_G(gameInterfaceBuff));
+ _visible = true;
+ track_hotspots_refresh();
}
void Interface::setup() {
@@ -132,6 +144,11 @@ bool Interface::set_interface_palette(RGB8 *myPalette) {
return true;
}
+bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+ warning("TODO: Interface::eventHandler");
+ return true;
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 2753946dd3d..8ff9f44e088 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -39,10 +39,6 @@ public:
int _sprite = 22; // main_interface_sprite;
bool _visible = false;
bool _shown = false;
- int _x1 = 0;
- int _y1 = 374;
- int _x2 = SCREEN_WIDTH;
- int _y2 = SCREEN_HEIGHT;
GrBuff *_gameInterfaceBuff = nullptr;
GUI::InterfaceBox *_interfaceBox = nullptr;
GUI::Inventory *_inventory = nullptr;
@@ -55,6 +51,7 @@ public:
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
+ Interface();
~Interface() override;
void init(int arrow, int wait, int look, int grab, int use) override;
@@ -63,7 +60,9 @@ public:
bool set_interface_palette(RGB8 *myPalette) override;
- void show();
+ bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
+
+ void show() override;
};
} // namespace Interface
Commit: 5c786490148bb0cd6d65e437dfe77576f172481b
https://github.com/scummvm/scummvm/commit/5c786490148bb0cd6d65e437dfe77576f172481b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added track_hotspots_refresh
Changed paths:
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index 674bd48c643..081f9d2c4c7 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -54,11 +54,6 @@ void Interface::hide() {
}
}
-void Interface::track_hotspots_refresh() {
- warning("TODO: track_hotspots_refresh");
-}
-
-
void interface_hide() {
_GI().hide();
}
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index f6c895110a7..eaac95b139e 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -51,7 +51,7 @@ public:
virtual bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) = 0;
- void track_hotspots_refresh();
+ virtual void track_hotspots_refresh() = 0;
/**
* Show the interface
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 28c8d715757..2274ac00e6b 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/gui/interface.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/burger/vars.h"
@@ -144,6 +145,15 @@ bool Interface::set_interface_palette(RGB8 *myPalette) {
return true;
}
+void Interface::track_hotspots_refresh() {
+ _hotspot = nullptr;
+ --_counter;
+
+ bool z = false;
+ eventHandler(_G(gameInterfaceBuff), EVENT_MOUSE, 1,
+ _G(MouseState).CursorColumn, _G(MouseState).CursorRow, &z);
+}
+
bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
warning("TODO: Interface::eventHandler");
return true;
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 8ff9f44e088..7086f782437 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -50,6 +50,8 @@ public:
GUI::ButtonClass *_btnMenu = nullptr;
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
+ void *_hotspot = nullptr;
+ uint32 _counter = 0;
Interface();
~Interface() override;
@@ -60,6 +62,8 @@ public:
bool set_interface_palette(RGB8 *myPalette) override;
+ void track_hotspots_refresh() override;
+
bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
void show() override;
Commit: 6389a7e32e3427463d110706e99b1657191cf823
https://github.com/scummvm/scummvm/commit/6389a7e32e3427463d110706e99b1657191cf823
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added cancel_sentence
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 2274ac00e6b..112e333e45a 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -105,7 +105,17 @@ void Interface::setup() {
}
void Interface::cancel_sentence() {
- warning("TODO: cancel_sentence");
+ _textField->set_string(" ");
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = false;
+ _G(player).command_ready = false;
+
+ _pointer1 = nullptr;
+ _pointer2 = nullptr;
+ _pointer3 = nullptr;
+ _flag1 = false;
+
+ track_hotspots_refresh();
}
bool Interface::set_interface_palette(RGB8 *myPalette) {
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 7086f782437..e6781d1a170 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -52,6 +52,10 @@ public:
GUI::ButtonClass *_btnScrollRight = nullptr;
void *_hotspot = nullptr;
uint32 _counter = 0;
+ void *_pointer1 = nullptr;
+ void *_pointer2 = nullptr;
+ void *_pointer3 = nullptr;
+ bool _flag1 = false;
Interface();
~Interface() override;
Commit: 18ff62d9ef420dcc1f7aaff71857df5a64157900
https://github.com/scummvm/scummvm/commit/18ff62d9ef420dcc1f7aaff71857df5a64157900
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix invalid cast of GrBuff * to Buffer *
The vmng buffer methods seem to handle both Buffer and GrBUffer.
But in the m4Preflight, a GrBuffer is cast to a BUffer to pass
to a method that turns around and casts it back to a void * to
pass it to vmng_screen_find. As such, I've made several methods
simply take in a void * directly that can be either
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_buffer.h
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index ddbe68fcfd8..3ac5fbdfbb8 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -84,7 +84,9 @@ void Sections::m4SceneLoad() {
get_ipl();
// Must reset event handler because loading a room re-initalizes gameBuff
- gui_buffer_set_event_handler((Buffer *)_G(gameDrawBuff), intr_EventHandler);
+ gui_buffer_set_event_handler(_G(gameDrawBuff), intr_EventHandler);
+
+
_G(kernel).trigger_mode = KT_DAEMON;
_G(kernel).call_daemon_every_loop = false;
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index 79eb4d290b7..9e84ecceac4 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -125,8 +125,8 @@ bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, Ev
(RefreshFunc)GrBuff_Show, evtHandler) == nullptr) ? false : true;
}
-bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler) {
- ScreenContext *myScreen = vmng_screen_find((void *)myBuf, nullptr);
+bool gui_buffer_set_event_handler(void *myBuf, EventHandler evtHandler) {
+ ScreenContext *myScreen = vmng_screen_find(myBuf, nullptr);
if (myScreen == nullptr)
return false;
@@ -135,8 +135,8 @@ bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler) {
return true;
}
-void gui_buffer_deregister(Buffer *myBuf) {
- vmng_screen_dispose((void *)myBuf);
+void gui_buffer_deregister(void *myBuf) {
+ vmng_screen_dispose(myBuf);
}
void gui_buffer_activate(Buffer *myBuf) {
diff --git a/engines/m4/gui/gui_buffer.h b/engines/m4/gui/gui_buffer.h
index 39729032e2e..cfc36edb18d 100644
--- a/engines/m4/gui/gui_buffer.h
+++ b/engines/m4/gui/gui_buffer.h
@@ -56,7 +56,7 @@ extern bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFl
extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
-extern void gui_buffer_deregister(Buffer *myBuf);
+extern void gui_buffer_deregister(void *myBuf);
extern bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
extern void gui_buffer_activate(Buffer *myBuf);
@@ -68,7 +68,7 @@ extern bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb);
* @param myBuf The Buffer specified.
* @param evtHandler The new procedure to handle keyboard and mouse events.
*/
-extern bool gui_buffer_set_event_handler(Buffer *myBuf, EventHandler evtHandler);
+extern bool gui_buffer_set_event_handler(void *myBuf, EventHandler evtHandler);
} // End of namespace M4
Commit: c8090c4e996c17ac7540cf86ec10b0c39a6706cc
https://github.com/scummvm/scummvm/commit/c8090c4e996c17ac7540cf86ec10b0c39a6706cc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added walker methods
Changed paths:
A engines/m4/burger/walker.cpp
A engines/m4/burger/walker.h
A engines/m4/wscript/wst_regs.h
engines/m4/adv_r/adv.h
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/burger/vars.h
engines/m4/core/globals.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/module.mk
engines/m4/vars.h
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index b751aa33428..126b6b970d9 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -30,7 +30,6 @@
namespace M4 {
#define MAX_SCENES 180
-#define GLB_SHARED_VARS 512
#define MAXRAILNODES 32
#define PATH_END 0xffff
#define MAX_PLYR_STRING_LEN 40
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 49e54b4e1a2..7dca7c47ea8 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -20,20 +20,15 @@
*/
#include "m4/adv_r/adv_walk.h"
+#include "m4/adv_r/adv_trigger.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/vars.h"
namespace M4 {
-void ws_demand_location(machine *myWalker, int32 x, int32 y) {
- error("TODO: ws_demand_location");
-}
-
-void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing) {
- error("TODO: ws_get_walker_info");
-}
-
void set_walker_scaling(SceneDef *rdef) {
_G(globals)[GLB_MIN_Y] = rdef->back_y << 16;
_G(globals)[GLB_MAX_Y] = rdef->front_y << 16;
@@ -45,5 +40,466 @@ void set_walker_scaling(SceneDef *rdef) {
_G(globals)[GLB_SCALER] = FixedDiv(_G(globals)[GLB_MAX_SCALE] - _G(globals)[GLB_MIN_SCALE], _G(globals)[GLB_MAX_Y] - _G(globals)[GLB_MIN_Y]);
}
+static void ws_walkto_node(machine *myWalker, railNode *destNode, bool firstTime) {
+ frac16 x, y, s;
+
+ // Parameter verification
+ if (!myWalker) {
+ error_show(FL, 'W:-(');
+ return;
+ }
+ if (!destNode) {
+ error_show(FL, 'WNDN');
+ return;
+ }
+
+ // Calculate the destination values x, y, s
+ x = destNode->x << 16;
+ y = destNode->y << 16;
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul(y - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+
+ // Plug in the destination x, y, and s
+ _G(globals)[GLB_TEMP_1] = x;
+ _G(globals)[GLB_TEMP_2] = y;
+ _G(globals)[GLB_TEMP_3] = s;
+
+ // Final direction (GLB_TEMP_4) and trigger (GLB_TEMP_5) are set in ws_walk() below
+ if (firstTime) {
+ if (_G(completeWalk)) {
+ _G(globals)[GLB_TEMP_6] = 0x10000; // so the feet will come together
+ } else {
+ _G(globals)[GLB_TEMP_6] = 0; // so the walker will freeze when he reaches the last node
+ }
+ SendWSMessage(STARTWALK << 16, 0, myWalker, 0, nullptr, 1);
+ } else {
+ SendWSMessage(WALKSEQ << 16, 0, myWalker, 0, nullptr, 1);
+ }
+}
+
+bool walker_has_walk_finished(machine *sender) {
+ railNode *tempNode;
+
+ // Parameter verification
+ if ((!sender) || (!sender->myAnim8)) {
+ error_show(FL, 'W:-(');
+ return false;
+ }
+
+ // Remove the node we just arrived at from the sender's walkPath
+ if (sender->walkPath) {
+ tempNode = sender->walkPath;
+ sender->walkPath = sender->walkPath->shortPath;
+ mem_free((void *)tempNode);
+ }
+
+ // If no more nodes to traverse (a canadian word), check if he's standing.
+ // If not standing, let him finish standing, then when he finishes standing
+ if (!sender->walkPath) {
+ return true;
+ } else {
+ // Else there are more nodes, so keep walking
+ ws_walkto_node(sender, sender->walkPath, false);
+ return false;
+ }
+}
+
+/**
+ * Called by player_walk
+ */
+void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int32 finalFacing, bool complete_walk) {
+ int8 directions[14] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
+ int32 currX, currY;
+ int32 currNodeID, destNodeID;
+ bool result;
+
+ if (!myWalker || !myWalker->myAnim8)
+ error_show(FL, 'W:-(');
+
+ if (!_G(globals))
+ error_show(FL, 'OOM1');
+
+ // Get walker's current location
+ currX = myWalker->myAnim8->myRegs[IDX_X] >> 16;
+ currY = myWalker->myAnim8->myRegs[IDX_Y] >> 16;
+
+ // Add the walker's current location and the destination to the rail nodes...
+ Buffer *walkerCodes = nullptr;
+ if (_G(screenCodeBuff))
+ walkerCodes = _G(screenCodeBuff)->get_buffer();
+ if ((currNodeID = AddRailNode(currX, currY, walkerCodes, true)) < 0) {
+ error_show(FL, 'WCAN', "Walker's curr posn: %ld %ld", currX, currY);
+ }
+ if ((destNodeID = AddRailNode(x, y, walkerCodes, true)) < 0) {
+ error_show(FL, 'WCAN', "Trying to walk to: %ld %ld", x, y);
+ }
+
+ // Dispose of the current path myWalker is following
+ if (myWalker->walkPath) {
+ DisposePath(myWalker->walkPath);
+ }
+
+ // Find the shortest path between currNodeID, and destNodeID
+ result = GetShortestPath(currNodeID, destNodeID, &(myWalker->walkPath));
+
+ // Now that a path has been found, remove the two extra added nodes
+ RemoveRailNode(currNodeID, walkerCodes, true);
+ RemoveRailNode(destNodeID, walkerCodes, true);
+ if (_G(screenCodeBuff))
+ _G(screenCodeBuff)->release();
+
+ // Check the success of GetShortestPath
+ if (!result) {
+ term_message("Player: Can't walk there!!!");
+ _G(player).waiting_for_walk = false;
+ return;
+ }
+
+ // If the result was true, but no path was returned, we are already there
+ if (!myWalker->walkPath) {
+ _G(player).need_to_walk = false;
+
+ //we can only turn to face the final direction
+ ws_turn_to_face(myWalker, finalFacing, trigger);
+ } else {
+ // Otherwise we have a path to follow, so get going...
+
+ // Verify that finalFacing is valid or set -1
+ if (finalFacing > 0 && finalFacing < 13) {
+ _G(globals)[GLB_TEMP_4] = directions[finalFacing] << 16;
+ } else {
+ _G(globals)[GLB_TEMP_4] = (uint)-1 << 16;
+ }
+
+ // Set the trigger to be returned when the walk is finished
+ _G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
+
+ _G(completeWalk) = complete_walk;
+ ws_walkto_node(myWalker, myWalker->walkPath, true);
+ }
+}
+
+bool adv_walker_path_exists(machine *myWalker, int32 x, int32 y) {
+ int32 currX, currY;
+ int32 currNodeID, destNodeID;
+ bool result;
+
+ if (!myWalker || !myWalker->myAnim8) {
+ error_show(FL, 'W:-(');
+ return false;
+ }
+
+ // Get walker's current location
+ currX = myWalker->myAnim8->myRegs[IDX_X] >> 16;
+ currY = myWalker->myAnim8->myRegs[IDX_Y] >> 16;
+
+ // Add the walker's current location and the destination to the rail nodes...
+ Buffer *walkerCodes = nullptr;
+ if (_G(screenCodeBuff)) {
+ walkerCodes = _G(screenCodeBuff)->get_buffer();
+ }
+ if ((currNodeID = AddRailNode(currX, currY, walkerCodes, true)) < 0) {
+ error_show(FL, 'WCAN', "Walker's curr posn: %ld %ld", currX, currY);
+ }
+ if ((destNodeID = AddRailNode(x, y, walkerCodes, true)) < 0) {
+ error_show(FL, 'WCAN', "Trying to walk to: %ld %ld", x, y);
+ }
+
+ // Dispose of the current path myWalker is following
+ if (myWalker->walkPath) {
+ DisposePath(myWalker->walkPath);
+ }
+
+ // Find the shortest path between currNodeID, and destNodeID
+ result = GetShortestPath(currNodeID, destNodeID, &(myWalker->walkPath));
+
+ // Now that a path has been attempted, remove the two extra added nodes
+ RemoveRailNode(currNodeID, walkerCodes, true);
+ RemoveRailNode(destNodeID, walkerCodes, true);
+ if (_G(screenCodeBuff))
+ _G(screenCodeBuff)->release();
+
+ return result;
+}
+
+
+void ws_custom_walk(machine *myWalker, int32 finalFacing, int32 trigger, bool complete_walk) {
+ const int8 directions[14] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
+
+ // Verify parameters
+ if ((!myWalker) || (!myWalker->walkPath)) {
+ return;
+ }
+
+ // Verify that finalFacing is valid or set -1
+ if (finalFacing > 0 && finalFacing < 13) {
+ _G(globals)[GLB_TEMP_4] = directions[finalFacing] << 16;
+ } else {
+ _G(globals)[GLB_TEMP_4] = (uint)-1 << 16;
+ }
+
+ // Set the trigger to be returned when the walk is finished
+ _G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
+
+ // Begin the walk...
+ _G(completeWalk) = complete_walk;
+ ws_walkto_node(myWalker, myWalker->walkPath, true);
+}
+
+
+void ws_demand_facing(machine *myWalker, int32 facing) {
+ const int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
+
+ if ((!myWalker) || (!myWalker->myAnim8)) {
+ term_message("demand facing, but no walker");
+ return;
+ }
+
+ if (facing > 0 && facing < 13) {
+ _G(globals)[GLB_TEMP_4] = directions[facing] << 16;
+ SendWSMessage(DEMAND_FACING << 16, 0, myWalker, 0, nullptr, 1);
+ }
+}
+
+void ws_demand_location(machine *myWalker, int32 x, int32 y) {
+ frac16 s;
+
+ if (!myWalker || !myWalker->myAnim8 || !_G(globals)) {
+ term_message("demand locn, no walker");
+ return;
+ }
+
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul((y << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+
+ _G(globals)[GLB_TEMP_1] = x << 16;
+ _G(globals)[GLB_TEMP_2] = y << 16;
+ _G(globals)[GLB_TEMP_3] = s;
+
+ SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+}
+
+
+static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, int32 facing) {
+ const int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
+ frac16 s;
+
+ if ((!myWalker) || (!myWalker->myAnim8)) {
+ term_message("demand f & l, no walker");
+ return;
+ }
+
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul((y << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+
+ _G(globals)[GLB_TEMP_1] = x << 16;
+ _G(globals)[GLB_TEMP_2] = y << 16;
+ _G(globals)[GLB_TEMP_3] = s;
+
+ if (facing > 0 && facing < 13) {
+ // If there is a facing to be set
+ _G(globals)[GLB_TEMP_4] = directions[facing] << 16;
+ SendWSMessage(747 << 16, 0, myWalker, 0, nullptr, 1);
+ } else {
+ SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+ _G(player).waiting_for_walk = false; // lets parse code get called when there is no facing set (from scenedit)
+ }
+}
+
+void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger) {
+ int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
+
+ if (!myWalker || !myWalker->myAnim8) {
+ error_show(FL, 'W:-(', "demand facing: %ld", facing);
+ return;
+ }
+
+ // Verify that facing is valid or set -1
+ if (facing > 0 && facing < 13) {
+ _G(globals)[GLB_TEMP_4] = directions[facing] << 16;
+ } else {
+ _G(globals)[GLB_TEMP_4] = (uint)-1 << 16;
+ }
+
+ // Set the trigger to be returned when the walk is finished
+ _G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
+
+ // Make sure the _G(completeWalk) flag is set
+ _G(globals)[GLB_TEMP_6] = 0x10000;
+
+ SendWSMessage(TURN_TO_FACE << 16, 0, myWalker, 0, nullptr, 1);
+}
+
+
+void ws_nosepick(machine *myWalker, int32 seriesHash) {
+ Anim8 *myAnim8;
+ if ((!myWalker) || (!myWalker->myAnim8)) {
+ error_show(FL, 'W:-(');
+ return;
+ }
+ myAnim8 = myWalker->myAnim8;
+ myAnim8->myRegs[IDX_CELS_HASH] = seriesHash << 16;
+ SendWSMessage(NOSEPICK << 16, 0, myWalker, 0, nullptr, 1);
+}
+
+
+void ws_hide_walker(machine *myWalker) {
+ if (!myWalker) {
+ error_show(FL, 'W:-(');
+ return;
+ }
+
+ SendWSMessage(PLAYER_HIDE << 16, 0, myWalker, 0, nullptr, 1);
+}
+
+void ws_unhide_walker(machine *myWalker) {
+ if (!myWalker) {
+ error_show(FL, 'W:-(');
+ return;
+ }
+
+ SendWSMessage(PLAYER_UNHIDE << 16, 0, myWalker, 0, nullptr, 1);
+}
+
+
+void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing) {
+ Anim8 *myAnim8;
+ int8 facings[10] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
+
+ if (!myWalker || !myWalker->myAnim8 || !_G(globals)) {
+ error_show(FL, 'W:-(');
+ return;
+ }
+
+ myAnim8 = myWalker->myAnim8;
+
+ if (x) {
+ *x = myAnim8->myRegs[IDX_X] >> 16;
+ }
+ if (y) {
+ *y = myAnim8->myRegs[IDX_Y] >> 16;
+ }
+ if (s) {
+ *s = MulSF16(100 << 16, myAnim8->myRegs[IDX_S]) >> 16;
+ }
+ if (layer) {
+ *layer = myAnim8->myRegs[IDX_LAYER] >> 16;
+ }
+ if (facing) {
+ if (myAnim8->myRegs[IDX_W] < 0) {
+ *facing = facings[9 - (myAnim8->myRegs[IDX_CELS_HASH] >> 24)]; // currently walker final facing can be found in 55
+ } else {
+ *facing = facings[(myAnim8->myRegs[IDX_CELS_HASH] >> 24)]; // currently walker final facing can be found in 55
+ }
+ }
+}
+
+
+bool ws_walk_init_system() {
+ // Initialize walker
+ _G(globals)[GLB_MIN_Y] = _G(currentSceneDef).back_y << 16;
+ _G(globals)[GLB_MAX_Y] = _G(currentSceneDef).front_y << 16;
+ _G(globals)[GLB_MIN_SCALE] = FixedDiv(_G(currentSceneDef).back_scale << 16, 100 << 16);
+ _G(globals)[GLB_MAX_SCALE] = FixedDiv(_G(currentSceneDef).front_scale << 16, 100 << 16);
+ if (_G(globals)[GLB_MIN_Y] == _G(globals)[GLB_MAX_Y]) {
+ _G(globals)[GLB_SCALER] = 0;
+ } else {
+ _G(globals)[GLB_SCALER] = FixedDiv(_G(globals)[GLB_MAX_SCALE] - _G(globals)[GLB_MIN_SCALE], _G(globals)[GLB_MAX_Y] - _G(globals)[GLB_MIN_Y]);
+ }
+
+ _G(kernel).myWalker = _GW().walk_initialize_walker();
+
+ if (!_G(kernel).myWalker) {
+ error_show(FL, 'W:-(');
+ return false;
+ }
+ return true;
+}
+
+bool ws_walk_load_series(int16 *dir_array, char *name_array[], bool shadow_flag, bool load_palette) {
+ int32 i = 0;
+
+ while (dir_array[i] >= 0) {
+ int32 result = AddWSAssetCELS(name_array[i], dir_array[i],
+ (load_palette && !shadow_flag) ? _G(master_palette) : nullptr);
+ if (result < 0) {
+ error_show(FL, 'W:-(');
+ return false;
+ }
+ i++;
+ }
+
+ return true;
+}
+
+bool ws_walk_load_walker_series(int16 *dir_array, char *name_array[], bool load_palette) {
+ return (ws_walk_load_series(dir_array, name_array, false, load_palette));
+}
+
+bool ws_walk_load_shadow_series(int16 *dir_array, char *name_array[]) {
+ return (ws_walk_load_series(dir_array, name_array, true, false));
+}
+
+void ws_walk_dump_series(int16 num_directions, int16 start_hash) {
+ int32 i;
+
+ for (i = 0; i < num_directions; i++) {
+ series_unload(start_hash++);
+ }
+}
+
+void adv_get_walker_destination(machine *my_walker, int32 *x, int32 *y, int32 *final_facing) {
+ railNode *current_node;
+ int32 face;
+ int8 directions[11] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
+
+ // If there is no walker, or the walker is not on a walk path, return
+ if (!my_walker || !my_walker->walkPath) {
+ *x = 0;
+ *y = 0;
+ *final_facing = 0;
+ return;
+ }
+
+ // Find the end of the path
+ current_node = my_walker->walkPath;
+ while (current_node->shortPath) {
+ current_node = current_node->shortPath;
+ }
+
+ // Set the destination coords
+ *x = current_node->x;
+ *y = current_node->y;
+
+ // Get final facing from l.v.6 = myRegs[6 + IDX_COUNT]
+ face = my_walker->myAnim8->myRegs[6 + IDX_COUNT] >> 16;
+ *final_facing = directions[face];
+}
+
+
+void adv_hyperwalk_to_final_destination(void *, void *) {
+ int32 x, y;
+ int32 facing;
+ int8 directions[11] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
+
+ _G(i_just_hyperwalked) = true;
+
+ // Make sure we have a walker, that it can walk in this scene, and that we can hyperwalk
+ if ((!_G(kernel).myWalker) || (!_G(player).walker_in_this_scene) || _G(player).disable_hyperwalk) {
+ return;
+ }
+
+ // If the walker is not currently walking anywhere, return
+ if (!_G(kernel).myWalker->walkPath) {
+ return;
+ }
+
+ //get the final direction and facing
+ adv_get_walker_destination(_G(kernel).myWalker, &x, &y, &facing);
+
+ // Nuke the rail node path
+ DisposePath(_G(kernel).myWalker->walkPath);
+ _G(kernel).myWalker->walkPath = nullptr;
+
+ // This will make player goto x,y,facing. when that happens, trigger will return
+ ws_demand_location_and_facing(_G(kernel).myWalker, x, y, facing);
+}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index ff3b2f69edb..9a6c0c18eab 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -29,7 +29,19 @@
namespace M4 {
+class Walker {
+public:
+ virtual ~Walker() {}
+
+ virtual bool walk_load_walker_and_shadow_series() = 0;
+ virtual machine *walk_initialize_walker() = 0;
+};
+
extern void set_walker_scaling(SceneDef *rdef);
+
+/**
+ * Called every time s/he hits a node
+ */
extern bool walker_has_walk_finished(machine *sender);
extern void ws_demand_location(machine *myWalker, int32 x, int32 y);
extern void ws_demand_facing(machine *myWalker, int32 newFacing);
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 0906cfb71e3..c61f864139e 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -26,6 +26,7 @@
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
@@ -50,8 +51,9 @@ protected:
public:
Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
- int _wilburTerm = 2;
GUI::Interface _interface;
+ Burger::Walker _walker;
+ int _wilburTerm = 2;
const Common::String _wilbur = "WILBUR";
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
@@ -66,6 +68,10 @@ public:
M4::Interface *getInterface() override {
return &_interface;
}
+ M4::Walker *getWalker() override {
+ return &_walker;
+ }
+
};
extern Vars *g_globals;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
new file mode 100644
index 00000000000..9825e445efe
--- /dev/null
+++ b/engines/m4/burger/walker.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/walker.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+bool Walker::walk_load_walker_and_shadow_series() {
+ // TODO
+ warning("TODO: walk_load_walker_and_shadow_series");
+ return true;
+}
+
+machine *Walker::walk_initialize_walker() {
+ // TODO
+ warning("TODO: walk_initialize_walker");
+ return nullptr;
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
new file mode 100644
index 00000000000..bb63bb28c69
--- /dev/null
+++ b/engines/m4/burger/walker.h
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_WALKER_H
+#define M4_BURGER_WALKER_H
+
+#include "m4/adv_r/adv_walk.h"
+
+namespace M4 {
+namespace Burger {
+
+class Walker : public M4::Walker {
+public:
+ ~Walker() override {}
+
+ bool walk_load_walker_and_shadow_series() override;
+ machine *walk_initialize_walker() override;
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index 59da575d385..9a586cf443c 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -28,6 +28,7 @@
namespace M4 {
+
enum {
GLB_TIME = 0,
GLB_WATCH_DOG = 1,
@@ -74,6 +75,7 @@ enum {
GLB_USER_VARS = 17 // 17+ globals for the applications programmer
};
+constexpr int GLB_SHARED_VARS = 256;
constexpr int GLOB_COUNT = 39;
struct GlobalVars : public Common::Array<int32> {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 3ac5fbdfbb8..9344503cd9c 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -86,7 +86,8 @@ void Sections::m4SceneLoad() {
// Must reset event handler because loading a room re-initalizes gameBuff
gui_buffer_set_event_handler(_G(gameDrawBuff), intr_EventHandler);
-
+ if (_G(player).walker_in_this_scene)
+ get_walker();
_G(kernel).trigger_mode = KT_DAEMON;
_G(kernel).call_daemon_every_loop = false;
@@ -170,6 +171,13 @@ void Sections::get_ipl() {
error_show(FL, 'OOM!', "loading ipl: %s", filename.c_str());
}
+void Sections::get_walker() {
+ term_message("Loading walker sprites");
+ if (!_GW().walk_load_walker_and_shadow_series())
+ error_show(FL, 'WLOD');
+ ws_walk_init_system();
+}
+
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index a1ae3bb2714..4e20f7e6d93 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -79,6 +79,7 @@ private:
int32 camera_pan_step = 10;
void get_ipl();
+ void get_walker();
public:
Section *_sections = nullptr;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index dd163815e01..eab0a0569ed 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -76,7 +76,8 @@ MODULE_OBJS = \
burger/hotkeys.o \
burger/inventory.o \
burger/other.o \
- burger/vars.o
+ burger/vars.o \
+ burger/walker.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index e48a2c81225..08cd83b4990 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -33,7 +33,9 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/conv_io.h"
+#include "m4/core/globals.h"
#include "m4/core/mouse.h"
#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
@@ -78,6 +80,7 @@ public:
virtual GlobalVars *getGlobals() = 0;
virtual Interface *getInterface() = 0;
+ virtual Walker *getWalker() = 0;
GameControl _game;
Kernel _kernel;
@@ -120,6 +123,7 @@ public:
void *_custom_interface_button_handler = nullptr;
int _global_sound_room = 0;
bool _please_hyperwalk = false;
+ bool _i_just_hyperwalked = false;
void (*_custom_ascii_converter)(char *string) = nullptr;
bool _vmng_Initted = false;
ScreenContext *_frontScreen = nullptr;
@@ -162,6 +166,7 @@ public:
#define _G(X) (g_vars->_##X)
#define _GV() g_vars->getGlobals()
#define _GI() (*g_vars->getInterface())
+#define _GW() (*g_vars->getWalker())
} // namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index abf904cd647..d4d2b8bc83c 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -28,6 +28,19 @@
namespace M4 {
+enum {
+ NOSEPICK = 0,
+ STARTWALK = 1,
+ WALKSEQ = 2,
+ ENDWALK = 3,
+ DEMAND_FACING = 4,
+ DEMAND_LOCATION = 5,
+ TERMINATE = 6,
+ PLAYER_HIDE = 7,
+ PLAYER_UNHIDE = 8,
+ TURN_TO_FACE = 9
+};
+
// A message request
struct msgRequest {
msgRequest *nextMsg = nullptr;
diff --git a/engines/m4/wscript/wst_regs.h b/engines/m4/wscript/wst_regs.h
new file mode 100644
index 00000000000..cd563389fd4
--- /dev/null
+++ b/engines/m4/wscript/wst_regs.h
@@ -0,0 +1,94 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_WSCRIPT_WST_REGS_H
+#define M4_WSCRIPT_WST_REGS_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+enum {
+ IDX_TIMER = 0,
+ IDX_TAG = 1,
+ IDX_LAYER = 2,
+
+ IDX_W = 3,
+ IDX_H = 4,
+ IDX_X = 5,
+ IDX_Y = 6,
+ IDX_S = 7,
+ IDX_R = 8,
+
+ IDX_CELS_HASH = 9,
+ IDX_CELS_INDEX = 10,
+ IDX_CELS_COUNT = 11,
+ IDX_CELS_FRAME_RATE = 12,
+ IDX_CELS_PIX_SPEED = 13,
+
+ IDX_TARG_S = 14,
+ IDX_TARG_R = 15,
+ IDX_TARG_X = 16,
+ IDX_TARG_Y = 17,
+
+ IDX_DELTA_S = 18,
+ IDX_DELTA_R = 19,
+ IDX_DELTA_X = 20,
+ IDX_DELTA_Y = 21,
+
+ IDX_VELOCITY = 22,
+ IDX_THETA = 23,
+
+ IDX_ZTEMP1 = 24,
+ IDX_ZTEMP2 = 25,
+ IDX_ZTEMP3 = 26,
+ IDX_ZTEMP4 = 27,
+ IDX_ZTEMP5 = 28,
+ IDX_ZTEMP6 = 29,
+ IDX_ZTEMP7 = 30,
+ IDX_ZTEMP8 = 31,
+
+ IDX_MACH_ID = 32
+};
+
+#define IDX_COUNT 33
+
+#define IDX_BEZ_CTRL IDX_TARG_X
+#define IDX_BEZ_COEFF IDX_ZTEMP1
+
+#define TAG_COUNT 8
+#define TAG_NONE 0x00000000
+#define TAG_TARGS 0x00000001
+#define TAG_BEZ 0x00000002
+#define TAG_DELTAS 0x00000004
+#define TAG_VECTORS 0x00000008
+#define TAG_TEXT 0x00000010
+#define TAG_MOVE_CEL 0x00004000
+#define TAG_MAP_CEL 0x00002000
+
+extern char *myRegLabels[];
+extern char *myGlobLabels[];
+extern char *tagLabels[];
+
+} // End of namespace M4
+
+#endif
Commit: cac6e2ba353bccd5de1a9312c88c77ea1573b029
https://github.com/scummvm/scummvm/commit/cac6e2ba353bccd5de1a9312c88c77ea1573b029
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding Burger room init code
Changed paths:
A engines/m4/burger/rooms/room.cpp
A engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1.h
engines/m4/burger/vars.h
engines/m4/core/rooms.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_mouse.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
new file mode 100644
index 00000000000..54a3a100f0b
--- /dev/null
+++ b/engines/m4/burger/rooms/room.cpp
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/room.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room::init() {
+ int roomId = _G(game).room_id;
+
+ if (roomId <= 800)
+ _GINT().show();
+ else
+ _GINT().hide();
+
+ // Disable commands for certain rooms
+ if (roomId == 201 || roomId == 301 || roomId == 306 || roomId == 307 ||
+ roomId == 401 || roomId == 501 || roomId == 511 || roomId == 512 ||
+ roomId == 513 || roomId == 601 || roomId == 605 || roomId == 606 ||
+ roomId == 608 || roomId == 609 || roomId == 610 || roomId == 801 ||
+ roomId == 902) {
+ player_set_commands_allowed(false);
+ }
+
+ if (roomId >= 950 || roomId == 902)
+ mouse_hide();
+ else
+ mouse_show();
+
+ // Do stuff that needs to be done each time a scene is started
+ init_series_players();
+
+ // TODO: Further room init
+}
+
+void Room::shutdown() {
+ _GV()[298] = 0;
+}
+
+void Room::init_series_players() {
+#ifdef TODO
+ term_message("Initializing %d series_players...", MAX_SERIES_PLAYERS);
+
+ for (int i = 0; i < MAX_SERIES_PLAYERS; ++i) {
+ seriesPlayer_clear(&series_player[i]);
+ }
+#endif
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
new file mode 100644
index 00000000000..24dbeaa73ea
--- /dev/null
+++ b/engines/m4/burger/rooms/room.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_ROOM_H
+#define M4_BURGER_ROOMS_ROOM_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room : public M4::Room {
+private:
+ void init_series_players();
+
+public:
+ Room(uint roomNum) : M4::Room(roomNum) {}
+ ~Room() override {}
+
+ void init() override;
+ void shutdown() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1.h b/engines/m4/burger/rooms/section1.h
index 7cbdc05b189..76f7a87f659 100644
--- a/engines/m4/burger/rooms/section1.h
+++ b/engines/m4/burger/rooms/section1.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION1_H
#define M4_BURGER_ROOMS_SECTION1_H
-#include "m4/core/rooms.h"
+#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class DummyRoom : public Room {
+class DummyRoom : public Rooms::Room {
public:
- DummyRoom() : Room(666) {}
+ DummyRoom() : Rooms::Room(666) {}
};
class Section1 : public Section {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index c61f864139e..8c6d458f09e 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -80,6 +80,7 @@ extern Vars *g_globals;
#undef _GI
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
+#define _GINT() _G(interface)
#define VAL(X) _G(_globals)[X]
} // namespace Burger
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 9344503cd9c..0b2b39c7944 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -92,25 +92,20 @@ void Sections::m4SceneLoad() {
_G(kernel).trigger_mode = KT_DAEMON;
_G(kernel).call_daemon_every_loop = false;
_G(kernel).fade_up_time = 30;
-#ifdef TODO
- if (myInterface) {
- myInterface->must_redraw_all = true;
- myInterface->draw(gameInterfaceBuff);
- }
//-------------------- GLOBAL ROOM INIT and ROOM INIT ------------------
player_set_commands_allowed(false);
- set_commands_allowed_since_last_checked = false;
-
+ _G(set_commands_allowed_since_last_checked) = false;
_G(between_rooms) = false;
- global_room_init(); // supplied by game programmer
- player.walker_trigger = -1;
+ room_init();
+#ifdef TODO
+ _G(player).walker_trigger = -1;
- if (game.previous_room == KERNEL_RESTORING_GAME)
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME)
{
- if (player.walker_in_this_scene) {
+ if (_G(player).walker_in_this_scene) {
// if restoring game, restore player position and facing
player_demand_location(player_info.x, player_info.y);
player_demand_facing(player_info.facing);
@@ -123,9 +118,9 @@ void Sections::m4SceneLoad() {
term_message("calling room_init_code");
util_exec_function(room_init_code_pointer);
- if (game.previous_room == KERNEL_RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
interface_show();
- game.previous_room = -1;
+ _G(game).previous_room = -1;
}
// init for fade up screen
@@ -134,14 +129,14 @@ void Sections::m4SceneLoad() {
pal_fade_init(&master_palette[0], _G(kernel).first_fade, 255, 100, _G(kernel).fade_up_time, 32765); // 30 ticks
}
- if (!set_commands_allowed_since_last_checked)
+ if (!_G(set_commands_allowed_since_last_checked))
player_set_commands_allowed(true);
- if (player_been_here(game.room_id))
- player.been_here_before = true;
+ if (player_been_here(_G(game).room_id))
+ _G(player).been_here_before = true;
else {
- player.been_here_before = false;
- player_enters_scene(game.room_id);
+ _G(player).been_here_before = false;
+ player_enters_scene(_G(game).room_id);
}
//-------------------- PLAY ROOM ------------------
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index e4e93102e1f..b203ace8300 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -308,4 +308,12 @@ void gui_mouse_refresh() {
warning("TODO: gui_mouse_refresh");
}
+void mouse_hide() {
+ vmng_screen_hide(_G(mouseScreenSource));
+}
+
+void mouse_show() {
+ vmng_screen_show(_G(mouseScreenSource));
+}
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
index d9ed3c5fa24..46d685f9dd6 100644
--- a/engines/m4/gui/gui_mouse.h
+++ b/engines/m4/gui/gui_mouse.h
@@ -70,6 +70,8 @@ extern bool gui_mouse_init();
extern void gui_mouse_shutdown();
extern bool mouse_set_sprite(int32 spriteNum);
extern void gui_mouse_refresh();
+extern void mouse_hide();
+extern void mouse_show();
} // End of namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index eab0a0569ed..88b8eefe96e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -70,6 +70,7 @@ MODULE_OBJS = \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
+ burger/rooms/room.o \
burger/rooms/section1.o \
burger/burger.o \
burger/globals.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 08cd83b4990..113745d8732 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -164,7 +164,7 @@ public:
};
#define _G(X) (g_vars->_##X)
-#define _GV() g_vars->getGlobals()
+#define _GV() (*g_vars->getGlobals())
#define _GI() (*g_vars->getInterface())
#define _GW() (*g_vars->getWalker())
Commit: 13a1d6f9fdc87aeac79ea45ebc030d2baa5ea43d
https://github.com/scummvm/scummvm/commit/13a1d6f9fdc87aeac79ea45ebc030d2baa5ea43d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of series_player.cpp
Changed paths:
A engines/m4/burger/series_player.cpp
A engines/m4/burger/series_player.h
engines/m4/burger/rooms/room.cpp
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 54a3a100f0b..6aa56d3b18c 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -59,13 +59,7 @@ void Room::shutdown() {
}
void Room::init_series_players() {
-#ifdef TODO
- term_message("Initializing %d series_players...", MAX_SERIES_PLAYERS);
-
- for (int i = 0; i < MAX_SERIES_PLAYERS; ++i) {
- seriesPlayer_clear(&series_player[i]);
- }
-#endif
+ _G(seriesPlayers).clear();
}
} // namespace Rooms
diff --git a/engines/m4/burger/series_player.cpp b/engines/m4/burger/series_player.cpp
new file mode 100644
index 00000000000..25c3c5ed94e
--- /dev/null
+++ b/engines/m4/burger/series_player.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/series_player.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+void SeriesPlayers::clear() {
+ term_message("Initializing %d series_players...", MAX_SERIES_PLAYERS);
+
+ for (int i = 0; i < MAX_SERIES_PLAYERS; ++i)
+ _players[i].clear();
+}
+
+void seriesPlayer::clear() {
+ break_list = nullptr;
+ series_machine = nullptr;
+ shadow_machine = nullptr;
+ series = -1;
+ shadow_series = -1;
+ index = -1;
+ name = nullptr;
+ in_use = false;
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/series_player.h b/engines/m4/burger/series_player.h
new file mode 100644
index 00000000000..380a04160a6
--- /dev/null
+++ b/engines/m4/burger/series_player.h
@@ -0,0 +1,111 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_SERIES_PLAYER_H
+#define M4_BURGER_SERIES_PLAYER_H
+
+#include "m4/m4_types.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+namespace Burger {
+
+struct seriesStreamBreak {
+ int32 frame = 0;
+ char *sound = nullptr;
+ int32 channel = 0;
+ int32 volume = 0;
+ int32 trigger = 0;
+ uint32 flags = 0;
+ int32 *variable = nullptr;
+ int32 value = 0;
+};
+// Used as last line of seriesStreamBreak arrays
+#define SERIES_STREAM_BREAK_END -1,nullptr,0,0,NO_TRIGGER,nullptr,nullptr,nullptr
+
+struct seriesPlayBreak {
+ int32 firstFrame = 0;
+ int32 lastFrame = 0;
+ char *sound = nullptr;
+ int32 channel = 0;
+ int32 volume = 0;
+ int32 trigger = 0;
+ uint32 flags = 0;
+ int32 loopCount = 0;
+ int32 *variable = nullptr;
+ int32 value = 0;
+};
+#define WITH_SHADOW 1 // Flag for seriesPlayBreak
+#define PRELOAD_SOUNDS 2 // Flag for seriesPlayBreak
+#define SERIES_PLAY_BREAK_END -1,-1,nullptr,0,0,NO_TRIGGER,nullptr,0,nullptr,nullptr // used as last line of seriesPlayBreak arrays
+
+struct seriesPlayer {
+ seriesPlayBreak *break_list = nullptr; // Holds the list of breaks for digi plays
+ seriesPlayBreak current_break; // Current play break
+ machine *series_machine = nullptr; // Series' playback machine
+ machine *shadow_machine = nullptr; // Shadow series' playback machine
+ int32 series = 0; // Holds the series handle upon loading so it can be unloaded at the end
+ int32 shadow_series = 0; // Holds the series handle for the shadow
+ int32 index = 0; // Holds which line of the list currently waiting for a play break
+ char *name = nullptr; // Name of series to play
+ char shadow_name[80] = { 0 };
+ int32 framerate = 0;
+ int32 trigger = 0;
+ frac16 depth = 0;
+ int32 scale = 0;
+ int32 x = 0;
+ int32 y = 0;
+ bool with_shadow = false; // True if a shadow is to be played in unison with series
+ bool preload_sounds = false; // True if you want to preload and unload the sounds automatically
+ bool digi_trigger = false; // True if gSERIES_PLAY_BREAK trigger has come from a digi_play and not a series_play
+ bool in_use = false; // Stops two calls from happening at the same time
+
+ /**
+ * Clear the player
+ */
+ void clear();
+};
+#define MAX_SERIES_PLAYERS 3
+
+class SeriesPlayers {
+private:
+ seriesPlayer _players[MAX_SERIES_PLAYERS];
+public:
+ seriesPlayer &operator[](uint idx) {
+ assert(idx < MAX_SERIES_PLAYERS);
+ return _players[idx];
+ }
+ const seriesPlayer &operator[](uint idx) const {
+ assert(idx < MAX_SERIES_PLAYERS);
+ return _players[idx];
+ }
+
+ /**
+ * Clear the players
+ */
+ void clear();
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8c6d458f09e..cb7d8c8fcee 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -26,6 +26,7 @@
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
+#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
namespace M4 {
@@ -52,6 +53,7 @@ public:
Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
+ SeriesPlayers _seriesPlayers;
Burger::Walker _walker;
int _wilburTerm = 2;
const Common::String _wilbur = "WILBUR";
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 88b8eefe96e..8d021fd66e1 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -77,6 +77,7 @@ MODULE_OBJS = \
burger/hotkeys.o \
burger/inventory.o \
burger/other.o \
+ burger/series_player.o \
burger/vars.o \
burger/walker.o
Commit: 413c544875ec1cc2eeae2adb30233626d0458b2b
https://github.com/scummvm/scummvm/commit/413c544875ec1cc2eeae2adb30233626d0458b2b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of digi.cpp
Changed paths:
A engines/m4/burger/digi.cpp
A engines/m4/burger/digi.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/digi.cpp b/engines/m4/burger/digi.cpp
new file mode 100644
index 00000000000..da467c23076
--- /dev/null
+++ b/engines/m4/burger/digi.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/digi.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+void Digi::preload_sounds(const char **names) {
+ if (!_names.empty()) {
+ unload_sounds();
+ _names.clear();
+ }
+
+ if (names) {
+ for (; *names; ++names) {
+ _names.push_back(*names);
+ preload(*names, NOWHERE);
+ }
+ }
+}
+
+void Digi::unload_sounds() {
+ for (uint i = 0; i < _names.size(); ++i)
+ unload(_names[i]);
+}
+
+void Digi::preload(const Common::String &name, int roomNum) {
+ warning("TODO: Digi::preload - %s, %d", name.c_str(), roomNum);
+}
+
+void Digi::unload(const Common::String &name) {
+ warning("TODO: Digi::unload");
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/digi.h b/engines/m4/burger/digi.h
new file mode 100644
index 00000000000..96fef8c21b4
--- /dev/null
+++ b/engines/m4/burger/digi.h
@@ -0,0 +1,48 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_DIGI_H
+#define M4_BURGER_DIGI_H
+
+#include "common/str-array.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+class Digi {
+private:
+ Common::StringArray _names;
+
+private:
+ void preload(const Common::String &name, int roomNum);
+ void unload(const Common::String &name);
+
+public:
+ void preload_sounds(const char **names);
+ void unload_sounds();
+};
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index cb7d8c8fcee..5eb07c44163 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -24,6 +24,7 @@
#include "m4/vars.h"
#include "m4/burger/gui/interface.h"
+#include "m4/burger/digi.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
@@ -50,6 +51,7 @@ protected:
void initialize_game() override;
public:
+ Digi _digi;
Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8d021fd66e1..4f5cb75093d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -73,6 +73,7 @@ MODULE_OBJS = \
burger/rooms/room.o \
burger/rooms/section1.o \
burger/burger.o \
+ burger/digi.o \
burger/globals.o \
burger/hotkeys.o \
burger/inventory.o \
Commit: 91879a0a7db00c71b389dc468f7abfa52466c2d2
https://github.com/scummvm/scummvm/commit/91879a0a7db00c71b389dc468f7abfa52466c2d2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room load digi switch
Changed paths:
engines/m4/burger/rooms/room.cpp
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 6aa56d3b18c..e4174b69f0f 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -51,6 +51,79 @@ void Room::init() {
// Do stuff that needs to be done each time a scene is started
init_series_players();
+ // Preload digi sounds
+ if (_G(player).walker_in_this_scene) {
+ switch (roomId) {
+ case 102:
+ case 103:
+ case 105:
+ case 134:
+ case 135:
+ case 143:
+ case 174:
+ case 175:
+ case 176:
+ case 304:
+ case 505:
+ case 506:
+ case 507:
+ case 509:
+ case 602:
+ case 603:
+ case 604:
+ case 612:
+ {
+ static const char *NAMES[] = {
+ "fs_wood1", "fs_wood2", "fs_wood3", "fs_wood4", "fs_wood5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 106:
+ case 139:
+ case 144:
+ case 145:
+ case 302:
+ case 303:
+ case 305:
+ {
+ static const char *NAMES[] = {
+ "fs_dirt1", "fs_dirt2", "fs_dirt3", "fs_dirt4", "fs_dirt5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ case 314:
+ case 315:
+ case 316:
+ case 317:
+ case 318:
+ case 319:
+ {
+ static const char *NAMES[] = {
+ "fs_mine1", "fs_mine2", "fs_mine3", "fs_mine4", "fs_mine5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ default:
+ {
+ static const char *NAMES[] = {
+ "fs_hard1", "fs_hard2", "fs_hard3", "fs_hard4", "fs_hard5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+ }
+ }
+
// TODO: Further room init
}
Commit: 1582cdee3b982a4e36d213f4471f41e57a5fab0c
https://github.com/scummvm/scummvm/commit/1582cdee3b982a4e36d213f4471f41e57a5fab0c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added adv_trigger.cpp methods
Changed paths:
A engines/m4/burger/rooms/section.cpp
A engines/m4/burger/rooms/section.h
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_trigger.h
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1.h
engines/m4/core/rooms.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 7eae0b94d86..d5d675a04fb 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -22,16 +22,21 @@
#include "m4/adv_r/adv_trigger.h"
#include "m4/core/errors.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
+#define _GT(X) _G(triggers)._##X
+
+static bool kernel_trigger_dispatchx(int32 trigger_num);
+
int32 kernel_trigger_create(int32 trigger_num) {
int32 new_trigger;
if (trigger_num < 0)
return (trigger_num);
- if (trigger_num > 0xffff) { // if room changed, this is an invalid trigger
+ if (trigger_num > 0xffff) { // If room changed, this is an invalid trigger
error_show(FL, 'BADT', "bad trigger. %ld > 0xffff", trigger_num);
}
@@ -40,10 +45,149 @@ int32 kernel_trigger_create(int32 trigger_num) {
return new_trigger;
}
+bool kernel_trigger_dispatch_now(int32 trigger_num) {
+ return kernel_trigger_dispatchx(kernel_trigger_create(trigger_num));
+}
+
bool kernel_trigger_dispatch(int32 trigger) {
- error("TODO: kernel_trigger_dispatch");
+ if (trigger == -1 || trigger == 65535 || _G(between_rooms))
+ return true;
+
+ _GT(sound_trigger_q)[_GT(q_end)++] = trigger;
+ if (_GT(q_end) == _GT(q_start))
+ error_show(FL, 'QOVF');
+
return true;
}
+void cisco_dispatch_triggers() {
+ for (int i = 0; i < _GT(q_end); ++i) {
+ kernel_trigger_dispatchx(_GT(sound_trigger_q)[i]);
+ }
+
+ _GT(q_end) = 0;
+}
+
+void cisco_clear_triggers() {
+ _GT(q_end) = _GT(q_start) = 0;
+}
+
+/**
+ * Dispatches a trigger.
+ * @returns Returns true if the trigger was handled. If the trigger is for
+ * a different room that current room_id, returns false. If no trigger_mode was
+ * attached to the trigger, returns false
+ */
+static bool kernel_trigger_dispatchx(int32 trigger_num) {
+ if (_G(between_rooms))
+ return true;
+
+ KernelTriggerType old_trigger_mode = _G(kernel).trigger_mode;
+ int32 old_trigger = _G(kernel).trigger;
+ bool result = false;
+
+ if (trigger_num < 0)
+ return false;
+
+ if (((trigger_num >> 16) & 0xfff) != _G(game).room_id) { // if room changed, this is an invalid trigger
+ term_message("orphan scene trigger:mode: %ld, scene: %ld, trigger: %ld",
+ trigger_num >> 28, (trigger_num >> 16) & 0xffff, trigger_num & 0xffff);
+ return false;
+ }
+
+ _G(kernel).trigger = trigger_num & 0xffff; // If no command in Q, must be here because of code
+
+ switch (trigger_num >> 28) {
+ case KT_PREPARSE:
+ if (_G(kernel).trigger >= 32000)
+ break;
+ _G(kernel).trigger_mode = KT_PREPARSE;
+
+ g_engine->room_pre_parser();
+ result = true;
+ break;
+
+ case KT_PARSE:
+ if (_G(kernel).trigger >= 32000)
+ break;
+ _G(kernel).trigger_mode = KT_PARSE;
+ _G(player).command_ready = true;
+ g_engine->room_parser();
+
+ if (_G(player).command_ready) {
+ g_engine->parser_code();
+ }
+ result = true;
+ break;
+
+ case KT_DAEMON:
+ g_engine->daemon_code();
+ result = true;
+ break;
+
+ default:
+ term_message("orphan mode trigger: mode: %ld, scene: %ld, trigger: %ld",
+ trigger_num >> 28, (trigger_num >> 16) & 0xffff, trigger_num & 0xffff);
+ result = false;
+ break;
+ }
+
+ _G(kernel).trigger_mode = old_trigger_mode;
+ _G(kernel).trigger = old_trigger;
+ return result;
+}
+
+void kernel_timing_trigger(int32 ticks, int16 trigger, char * /*name*/) {
+ if (ticks < 0)
+ error_show(FL, 'TICK');
+
+ int32 done_time = ticks + timer_read_60();
+ _GT(time_q)[_GT(time_q_end)] = done_time;
+ _GT(time_trigger_q)[_GT(time_q_end)] = kernel_trigger_create(trigger);
+ ++_GT(time_q_end);
+ if (_GT(time_q_end) == MAX_TIMERS)
+ error_show(FL, 'QOVF');
+
+ // bubble the new entry up in the q to its proper place
+
+ for (int32 iter = _GT(time_q_end) - 1; iter > 0; iter--) {
+ if (_GT(time_q)[iter] < _GT(time_q)[iter - 1]) {
+ int32 temp = _GT(time_q)[iter];
+ _GT(time_q)[iter] = _GT(time_q)[iter - 1];
+ _GT(time_q)[iter - 1] = temp;
+
+ temp = _GT(time_trigger_q)[iter];
+ _GT(time_trigger_q)[iter] = _GT(time_trigger_q)[iter - 1];
+ _GT(time_trigger_q)[iter - 1] = temp;
+ }
+ }
+}
+
+void kernel_service_timing_trigger_q() {
+ // Dispatch pending timing triggers
+ int32 iter = 0;
+ int32 now = timer_read_60();
+
+ while (iter < _GT(time_q_end) && _GT(time_q)[iter] <= now)
+ {
+ kernel_trigger_dispatch(_GT(time_trigger_q)[iter]);
+ ++iter;
+ }
+ if (!iter)
+ return;
+
+ // Remove dispatched triggers from the q
+ int32 total = iter;
+ int32 dispatched = iter;
+ iter = 0;
+ while (dispatched < _GT(time_q_end)) {
+ _GT(time_q)[iter] = _GT(time_q)[dispatched];
+ _GT(time_trigger_q)[iter] = _GT(time_trigger_q)[dispatched];
+ ++iter;
+ ++dispatched;
+ }
+
+ _GT(time_q_end) -= total;
+}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 3c0d60f86af..782ebe937a5 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -27,7 +27,29 @@
namespace M4 {
+constexpr int MAX_TIMERS = 32;
+
+struct Triggers {
+ int32 _time_q[MAX_TIMERS];
+ int32 _time_trigger_q[MAX_TIMERS];
+ int32 _time_q_end = 0;
+
+ int32 _sound_trigger_q[MAX_TIMERS];
+ int32 _q_start = 0;
+ int32 _q_end = 0;
+};
+
+/**
+ * Create a new trigger
+ * Trigger usage:
+ * [31-28][27-16][15-0]
+ * | | |
+ * | | +--- trigger_num (0 - 0xffff)
+ * | +--- room_id (0 - 4096) (0 - 0xfff)
+ * +--- trigger_mode (0-16)
+ */
extern int32 kernel_trigger_create(int32 trigger_num);
+
extern int32 kernel_trigger_create_mode(int32 trigger_num, int32 desired_mode);
extern bool kernel_trigger_dispatch(int32 trigger_num);
extern bool kernel_trigger_dispatch_now(int32 trigger_num);
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index e4174b69f0f..38a13a1e18c 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -135,6 +135,10 @@ void Room::init_series_players() {
_G(seriesPlayers).clear();
}
+void Room::parser_code() {
+ warning("TODO: global_parser_code");
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 24dbeaa73ea..351ea9088ed 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -38,6 +38,8 @@ public:
void init() override;
void shutdown() override;
+ void parser_code() override;
+
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
new file mode 100644
index 00000000000..7c73a2d04c5
--- /dev/null
+++ b/engines/m4/burger/rooms/section.cpp
@@ -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/>.
+ *
+ */
+
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Section::daemon_code() {
+ warning("TODO: global_daemon_code");
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
new file mode 100644
index 00000000000..e366ca771b9
--- /dev/null
+++ b/engines/m4/burger/rooms/section.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 M4_BURGER_ROOMS_SECTION_H
+#define M4_BURGER_ROOMS_SECTION_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section : public M4::Section {
+public:
+ Section(Room *rooms, size_t count) : M4::Section(rooms, count) {}
+ ~Section() override {}
+
+ void daemon_code() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1.h b/engines/m4/burger/rooms/section1.h
index 76f7a87f659..8610fff4541 100644
--- a/engines/m4/burger/rooms/section1.h
+++ b/engines/m4/burger/rooms/section1.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION1_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
namespace M4 {
namespace Burger {
@@ -33,13 +34,13 @@ public:
DummyRoom() : Rooms::Room(666) {}
};
-class Section1 : public Section {
+class Section1 : public Rooms::Section {
private:
Room _ROOMS[1] = {
DummyRoom()
};
public:
- Section1() : Section(&_ROOMS[0], 1) {}
+ Section1() : Rooms::Section(&_ROOMS[0], 1) {}
virtual ~Section1() {}
};
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 4e20f7e6d93..4fcef8463f3 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -40,6 +40,7 @@ public:
virtual void daemon() {}
virtual void pre_parser() {}
virtual void parser() {}
+ virtual void parser_code() {}
virtual void error() {}
virtual void shutdown() {}
virtual void custom_hotspot_which() {}
@@ -69,6 +70,8 @@ public:
* Used to tell if x,y is over the walker hotspot
*/
virtual HotSpotRec *walker_spotter(int32 x, int32 y);
+
+ virtual void daemon_code() {}
};
class Sections {
@@ -94,6 +97,10 @@ public:
void section_init() {
_activeSection->init();
}
+ void daemon_code() {
+ _activeSection->daemon_code();
+ }
+
void room_preload() {
_activeRoom->preload();
}
@@ -109,6 +116,9 @@ public:
void room_parser() {
_activeRoom->parser();
}
+ void parser_code() {
+ _activeRoom->parser_code();
+ }
void room_error() {
_activeRoom->error();
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 4f5cb75093d..cede0a9e019 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -71,6 +71,7 @@ MODULE_OBJS = \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
burger/rooms/room.o \
+ burger/rooms/section.o \
burger/rooms/section1.o \
burger/burger.o \
burger/digi.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 113745d8732..87fddf65f1f 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -33,6 +33,7 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/adv_r/adv_trigger.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/conv_io.h"
#include "m4/core/globals.h"
@@ -98,6 +99,7 @@ public:
Dialog_Globals _dialog;
Item_Globals _items;
Converstation_Globals _conversations;
+ Triggers _triggers;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
Commit: 90a2444439ef0f001081df8555ed3f5c2fb9ce45
https://github.com/scummvm/scummvm/commit/90a2444439ef0f001081df8555ed3f5c2fb9ce45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Comment out unused for now function
Changed paths:
engines/m4/adv_r/adv_file.cpp
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 80ba1ee61ff..16a3ecb84d8 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -284,6 +284,7 @@ bool kernel_load_game(int slot) {
return g_engine->loadGameState(slot).getCode() == Common::kNoError;
}
+#if 0
static int32 extract_room_num(const char *name) {
if ((name[0] == 'C' || name[0] == 'c') &&
(name[1] == 'O' || name[1] == 'o') &&
@@ -295,7 +296,7 @@ static int32 extract_room_num(const char *name) {
} else
return _G(game).room_id;
}
-
+#endif
static Common::String get_background_filename(const SceneDef *rdef) {
if (_G(art_base_override) != nullptr) {
return _G(art_base_override);
Commit: f9490f9b9195ff355e601dfd237d303b2919bcb3
https://github.com/scummvm/scummvm/commit/f9490f9b9195ff355e601dfd237d303b2919bcb3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move Digi into M4 Vars, skeleton Midi class
Changed paths:
A engines/m4/platform/sound/digi.cpp
A engines/m4/platform/sound/digi.h
A engines/m4/platform/sound/midi.cpp
A engines/m4/platform/sound/midi.h
R engines/m4/burger/digi.cpp
R engines/m4/burger/digi.h
engines/m4/burger/vars.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 5eb07c44163..cb7d8c8fcee 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -24,7 +24,6 @@
#include "m4/vars.h"
#include "m4/burger/gui/interface.h"
-#include "m4/burger/digi.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
@@ -51,7 +50,6 @@ protected:
void initialize_game() override;
public:
- Digi _digi;
Burger::GlobalVars _globals;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index cede0a9e019..1459cba097d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -60,6 +60,8 @@ MODULE_OBJS = \
mem/res.o \
platform/sound.o \
platform/timer.o \
+ platform/sound/digi.o \
+ platform/sound/midi.o \
platform/tile/tile_read.o \
wscript/ws_cruncher.o \
wscript/ws_hal.o \
@@ -74,7 +76,6 @@ MODULE_OBJS = \
burger/rooms/section.o \
burger/rooms/section1.o \
burger/burger.o \
- burger/digi.o \
burger/globals.o \
burger/hotkeys.o \
burger/inventory.o \
diff --git a/engines/m4/burger/digi.cpp b/engines/m4/platform/sound/digi.cpp
similarity index 93%
rename from engines/m4/burger/digi.cpp
rename to engines/m4/platform/sound/digi.cpp
index da467c23076..5612baf203e 100644
--- a/engines/m4/burger/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -19,11 +19,11 @@
*
*/
-#include "m4/burger/digi.h"
-#include "m4/burger/vars.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/vars.h"
namespace M4 {
-namespace Burger {
+namespace Sound {
void Digi::preload_sounds(const char **names) {
if (!_names.empty()) {
@@ -52,5 +52,5 @@ void Digi::unload(const Common::String &name) {
warning("TODO: Digi::unload");
}
-} // namespace Burger
+} // namespace Sound
} // namespace M4
diff --git a/engines/m4/burger/digi.h b/engines/m4/platform/sound/digi.h
similarity index 92%
rename from engines/m4/burger/digi.h
rename to engines/m4/platform/sound/digi.h
index 96fef8c21b4..89b51d50cbc 100644
--- a/engines/m4/burger/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -20,14 +20,14 @@
*
*/
-#ifndef M4_BURGER_DIGI_H
-#define M4_BURGER_DIGI_H
+#ifndef M4_PLATFORM_SOUND_DIGI_H
+#define M4_PLATFORM_SOUND_DIGI_H
#include "common/str-array.h"
#include "m4/m4_types.h"
namespace M4 {
-namespace Burger {
+namespace Sound {
class Digi {
private:
@@ -42,7 +42,7 @@ public:
void unload_sounds();
};
-} // namespace Burger
+} // namespace Sound
} // namespace M4
#endif
diff --git a/engines/m4/platform/sound/midi.cpp b/engines/m4/platform/sound/midi.cpp
new file mode 100644
index 00000000000..5d4bede4e8e
--- /dev/null
+++ b/engines/m4/platform/sound/midi.cpp
@@ -0,0 +1,29 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/platform/sound/midi.h"
+#include "m4/vars.h"
+
+namespace M4 {
+namespace Sound {
+
+} // namespace Sound
+} // namespace M4
diff --git a/engines/m4/platform/sound/midi.h b/engines/m4/platform/sound/midi.h
new file mode 100644
index 00000000000..2d092041895
--- /dev/null
+++ b/engines/m4/platform/sound/midi.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_SOUND_PLATFORM_MIDI_H
+#define M4_SOUND_PLATFORM_MIDI_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Sound {
+
+class Midi {
+public:
+};
+
+} // namespace Sound
+} // namespace M4
+
+#endif
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 87fddf65f1f..3cfb8a15e31 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -49,6 +49,8 @@
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/platform/sound/midi.h"
#include "m4/wscript/wscript.h"
namespace M4 {
@@ -100,6 +102,8 @@ public:
Item_Globals _items;
Converstation_Globals _conversations;
Triggers _triggers;
+ Sound::Digi _digi;
+ Sound::Midi _midi;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
Commit: fd4e2883b1cd0ca657ed2f703950b4efa5fbd9dd
https://github.com/scummvm/scummvm/commit/fd4e2883b1cd0ca657ed2f703950b4efa5fbd9dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing lots of wscript and dependencies
Oh, soooo many dependencies.
Changed paths:
A engines/m4/dbg/dbg_defs.h
A engines/m4/dbg/dbg_wscript.cpp
A engines/m4/dbg/dbg_wscript.h
A engines/m4/dbg/debug.h
A engines/m4/graphics/rend.cpp
A engines/m4/graphics/rend.h
A engines/m4/wscript/wst_regs.cpp
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/core/errors.cpp
engines/m4/core/errors.h
engines/m4/core/globals.h
engines/m4/core/imath.cpp
engines/m4/core/imath.h
engines/m4/fileio/fstream.cpp
engines/m4/fileio/fstream.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
engines/m4/gui/gui.h
engines/m4/m4_types.h
engines/m4/mem/reloc.cpp
engines/m4/mem/reloc.h
engines/m4/module.mk
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
engines/m4/platform/sound/midi.cpp
engines/m4/platform/sound/midi.h
engines/m4/vars.cpp
engines/m4/vars.h
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_cruncher.h
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_hal.h
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_load.h
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
engines/m4/wscript/ws_timer.cpp
engines/m4/wscript/wst_regs.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 691f35f95c4..0234cfd15ad 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -50,4 +50,14 @@ void player_set_commands_allowed(bool t_or_f) {
}
}
+void game_pause(bool flag) {
+ if (flag) {
+ _G(kernel).pause = true;
+ PauseEngines();
+ } else {
+ _G(kernel).pause = false;
+ UnpauseEngines();
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 1f7400a5893..45e0ebb8014 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -30,6 +30,7 @@ namespace M4 {
extern bool kernel_section_startup();
extern void player_set_commands_allowed(bool t_or_f);
+extern void game_pause(bool flag);
} // End of namespace M4
diff --git a/engines/m4/core/errors.cpp b/engines/m4/core/errors.cpp
index 119af547b59..5eaca4fedf5 100644
--- a/engines/m4/core/errors.cpp
+++ b/engines/m4/core/errors.cpp
@@ -19,12 +19,16 @@
*
*/
-#include "common/str.h"
+#include "common/file.h"
#include "common/textconsole.h"
#include "m4/core/errors.h"
namespace M4 {
+inline static bool quadchar_equals_string(uint32 code, const Common::String &str) {
+ return READ_BE_UINT32(str.c_str()) == code;
+}
+
void error_show(const char *filename, uint32 line, quadchar errorcode, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
@@ -38,4 +42,33 @@ void error_show(const char *filename, uint32 line, quadchar errorcode) {
error_show(filename, line, errorcode, "No extra description");
}
+void error_look_up(quadchar errorcode, char *result_string) {
+ Common::File f;
+ *result_string = '\0';
+
+ if (!f.open(ERROR_FILE))
+ return;
+
+ Common::String buffer;
+
+ while (!f.eos()) {
+ buffer = f.readString();
+ const char *mark = buffer.c_str() + 1;
+
+ if (quadchar_equals_string(errorcode, buffer) || quadchar_equals_string(errorcode, mark)) {
+ const char *src = (const char *)buffer.c_str() + 5;
+ int16 count = 0;
+
+ do {
+ *result_string++ = *src;
+ ++count;
+ } while (*src++ && (count < MAX_STRING_LEN));
+
+ break;
+ }
+ }
+}
+
+
+
} // namespace M4
diff --git a/engines/m4/core/errors.h b/engines/m4/core/errors.h
index a755cf63314..9d07e094b9f 100644
--- a/engines/m4/core/errors.h
+++ b/engines/m4/core/errors.h
@@ -27,9 +27,11 @@
namespace M4 {
#define FL __FILE__,__LINE__
+#define ERROR_FILE "error.m4"
extern void error_show(const char *filename, uint32 line, quadchar errorcode, const char *fmt, ...);
extern void error_show(const char *filename, uint32 line, quadchar errorcode);
+extern void error_look_up(quadchar errorcode, char *result_string);
} // namespace M4
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index 9a586cf443c..9443a7db63d 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -76,7 +76,6 @@ enum {
};
constexpr int GLB_SHARED_VARS = 256;
-constexpr int GLOB_COUNT = 39;
struct GlobalVars : public Common::Array<int32> {
void syncGame(Common::Serializer &s);
diff --git a/engines/m4/core/imath.cpp b/engines/m4/core/imath.cpp
index bfdeb7bd947..8bb2ffff789 100644
--- a/engines/m4/core/imath.cpp
+++ b/engines/m4/core/imath.cpp
@@ -117,6 +117,21 @@ frac16 SqrtF16(frac16 n) {
return (frac16)r;
}
+#define DIV_128_PI 0x28be61
+
+frac16 ArcTan(frac16 x, frac16 y) {
+ double floatX, floatY, result;
+ frac16 fracResult;
+
+ floatX = (float)(x >> 16) + (float)((float)(x & 0xffff) / (float)65536);
+ floatY = (float)(y >> 16) + (float)((float)(y & 0xffff) / (float)65536);
+ result = atan2(floatY, floatX);
+ fracResult = (((int32)(floor(result))) << 16) + (int32)(floor((result - floor(result)) * 65536));
+ fracResult = MulSF16(fracResult, DIV_128_PI);
+ if (fracResult < 0) fracResult += 0x1000000;
+ return fracResult;
+}
+
uint16 HighWord(uint32 n) {
return (uint16)(n >> 16);
}
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
index de8e5573e4f..7afdf03d48c 100644
--- a/engines/m4/core/imath.h
+++ b/engines/m4/core/imath.h
@@ -56,7 +56,7 @@ frac16 imath_ranged_rand16(frac16 a, frac16 b);
frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2);
frac16 SqrtF16(frac16 n);
-//frac16 ArcTan(frac16 x, frac16 y);
+frac16 ArcTan(frac16 x, frac16 y);
uint16 HighWord(uint32 n);
uint16 LowWord(uint32 n);
diff --git a/engines/m4/dbg/dbg_defs.h b/engines/m4/dbg/dbg_defs.h
new file mode 100644
index 00000000000..b426cbcb799
--- /dev/null
+++ b/engines/m4/dbg/dbg_defs.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_DBG_DBG_DEFS_H
+#define M4_DBG_DBG_DEFS_H
+
+#include "m4/m4_types.h"
+#include "m4/dbg/dbg_defs.h"
+#include "m4/gui/gui_dialog.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+struct DBGSequSR {
+ DBGSequSR *next;
+ int32 prevSequHash;
+ int32 returnOffset;
+};
+
+struct DBGWatch {
+ DBGWatch *next;
+ DBGWatch *prev;
+ machine *m;
+ Dialog *d;
+ bool moreInfo;
+ bool machStep;
+ int32 sequHash;
+ bool sequStep;
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/dbg/dbg_wscript.cpp b/engines/m4/dbg/dbg_wscript.cpp
new file mode 100644
index 00000000000..c0b7e0b061d
--- /dev/null
+++ b/engines/m4/dbg/dbg_wscript.cpp
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/dbg/dbg_wscript.h"
+
+namespace M4 {
+
+bool dbg_ws_init(bool showTheScreen, Font *useThisFont, frac16 *theGlobals) {
+ return true;
+}
+
+void dbg_ws_shutdown() {
+ // No implementation
+}
+
+void dbg_ws_update() {
+ // No implementation
+}
+
+void dbg_LaunchSequence(Anim8 *myAnim8) {
+ // No implementation
+}
+
+void dbg_DebugWSMach(machine *m, bool debug) {
+ // No implementation
+}
+
+void dbg_DebugNextCycle() {
+ // No implementation
+}
+
+void dbg_RemoveWSMach(machine *m) {
+ // No implementation
+}
+
+void dbg_SetCurrMachInstr(machine *m, int32 pcOffset) {
+ // No implementation
+}
+
+void dbg_SetCurrSequInstr(Anim8 *myAnim8, int32 compareCCR) {
+ // No implementation
+}
+
+void dbg_WSError(Common::WriteStream *logFile, machine *m, int32 errorType,
+ const char *errDesc, const char *errMsg, int32 pcOffset) {
+ // No implementation
+}
+
+} // namespace M4
diff --git a/engines/m4/dbg/dbg_wscript.h b/engines/m4/dbg/dbg_wscript.h
new file mode 100644
index 00000000000..7fa4a3c0158
--- /dev/null
+++ b/engines/m4/dbg/dbg_wscript.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_DBG_DBG_WSCRIPT_H
+#define M4_DBG_DBG_WSCRIPT_H
+
+#include "common/stream.h"
+#include "m4/m4_types.h"
+#include "m4/dbg/dbg_defs.h"
+#include "m4/graphics/gr_font.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+
+extern bool dbg_ws_init(bool showTheScreen, Font *useThisFont, frac16 *theGlobals);
+extern void dbg_ws_shutdown();
+extern void dbg_ws_update();
+
+extern void dbg_LaunchSequence(Anim8 *myAnim8);
+extern void dbg_DebugWSMach(machine *m, bool debug);
+extern void dbg_DebugNextCycle();
+extern void dbg_RemoveWSMach(machine *m);
+extern void dbg_SetCurrMachInstr(machine *m, int32 pcOffset);
+extern void dbg_SetCurrSequInstr(Anim8 *myAnim8, int32 compareCCR);
+extern void dbg_WSError(Common::WriteStream *logFile, machine *m, int32 errorType,
+ const char *errDesc, const char *errMsg, int32 pcOffset);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/dbg/debug.h b/engines/m4/dbg/debug.h
new file mode 100644
index 00000000000..f26de6b4ae4
--- /dev/null
+++ b/engines/m4/dbg/debug.h
@@ -0,0 +1,27 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_DBG_DEBUG_H
+#define M4_DBG_DEBUG_H
+
+#include "m4/dbg/dbg_wscript.h"
+
+#endif
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 107d466e045..92a52828f64 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -20,15 +20,13 @@
*/
#include "m4/fileio/fstream.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/vars.h"
namespace M4 {
-bool f_stream_Init() {
- _G(firstStream) = nullptr;
- _G(lastStream) = nullptr;
- return true;
-}
+#define STR_STRMREQ "stream request"
StreamFile::StreamFile(const Common::String &filename) {
if (!_file.open(filename))
@@ -43,7 +41,7 @@ bool StreamFile::seek(uint32 n) {
return _file.seek(n);
}
-bool StreamFile::seek_ahead(uint32 n) {
+bool StreamFile::seek_ahead(int32 n) {
return _file.skip(n);
}
@@ -51,4 +49,537 @@ uint32 StreamFile::get_pos() {
return _file.pos();
}
+bool f_stream_Init() {
+ _G(firstStream) = nullptr;
+ _G(lastStream) = nullptr;
+ return true;
+}
+
+void f_stream_Shutdown(void) {
+ strmRequest *myStream;
+
+ // Loop through the list, closing all stream requests, which also deallocs the request
+ myStream = _G(firstStream);
+ while (myStream) {
+ _G(firstStream) = _G(firstStream)->next;
+ f_stream_Close(myStream);
+ myStream = _G(firstStream);
+ }
+}
+
+strmRequest *f_stream_Open(StreamFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
+ int32 numBlocksToRead, int32 *blockSizeArray, int32 initialRead, bool wrapStream) {
+
+ strmRequest *newStream;
+ int32 bytesRead, i, bytesToRead;
+ bool finished;
+ void *bufferHandle;
+ int32 memAvail;
+
+ const int32 PADDING = 256;
+
+ // Parameter verification
+ if (!srcFile) {
+ error_show(FL, 'FSF!');
+ }
+
+ if (strmMinBuffSize < 0) {
+ error_show(FL, 'FSF1', "neg min buffsize: %ld", strmMinBuffSize);
+ }
+
+ // Allocate a new stream request struct
+ if ((newStream = (strmRequest *)mem_alloc(sizeof(strmRequest), STR_STRMREQ)) == nullptr) {
+ error_show(FL, 'OOM!', "%ld", sizeof(strmRequest));
+ return nullptr;
+ }
+
+ // Try to get memory
+ newStream->strmHandle = NewHandle(strmBuffSize, "stream buff");
+ if (newStream->strmHandle) {
+ goto got_mem;
+ }
+
+ // Maximize available memory
+ MaxMem((Size *)&memAvail); // param on PC is max mem avail in one block
+
+ // try to get requested size
+ if (memAvail >= strmBuffSize) {
+ /*
+ if ((newStream->strmBuff = (uint8*)mem_alloc(strmBuffSize, STR_STRMBUFF)) != nullptr) {
+ goto got_mem;
+ }
+ */
+ // try to get memory
+ newStream->strmHandle = NewHandle(strmBuffSize, "stream buff");
+ if (newStream->strmHandle) {
+ goto got_mem;
+ }
+ }
+
+ // try to get what's left if it's enough
+ // get a compromise between free and requested.
+ // if we get it all, system gets unstable...
+ if (memAvail > strmMinBuffSize) {
+ int32 alloc_me = ((memAvail - strmMinBuffSize) / 2) + strmMinBuffSize;
+ /*
+ if ((newStream->strmBuff = (uint8*)mem_alloc(alloc_me, STR_STRMBUFF)) != nullptr) {
+ strmBuffSize = alloc_me;
+ goto got_mem;
+ }
+ */
+ // try to get memory
+ newStream->strmHandle = NewHandle(alloc_me, "stream buff");
+ if (newStream->strmHandle) {
+ strmBuffSize = alloc_me;
+ goto got_mem;
+ }
+
+ }
+
+ // sorry, bud.
+ error_show(FL, 'FSOM', "want: %ld, have: %ld", strmMinBuffSize, memAvail);
+
+got_mem:
+ //lock the buffer - to be locked until the stream is closed
+ HLock(newStream->strmHandle);
+ newStream->strmBuff = (uint8 *) * (newStream->strmHandle);
+
+ // Initialize the stream request
+ newStream->strmSize = strmBuffSize;
+ newStream->strmHead = newStream->strmBuff;
+ newStream->strmTail = newStream->strmBuff;
+ newStream->endStrmBuff = newStream->strmBuff + strmBuffSize;
+ newStream->strmWrap = newStream->endStrmBuff;
+ newStream->strmLastRead = newStream->endStrmBuff;
+ newStream->numBlocksToRead = numBlocksToRead;
+ newStream->blockSizeArray = blockSizeArray;
+ newStream->wrapStream = wrapStream;
+ newStream->srcFile = srcFile;
+
+ // If the streaming should begin part way into the file, seek to the beginning of where to start streaming
+ if (fileOffset > 0) {
+ // If (fseek(newStream->srcFile, fileOffset, SEEK_SET) != 0) {
+ if (!newStream->srcFile->seek(fileOffset)) {
+ delete newStream->srcFile;
+ mem_free(newStream);
+ return nullptr;
+ }
+ }
+
+ // Check if we are to initially read the stream
+ if (initialRead > 0) {
+
+ // If the blockSizeArray exists, then initialRead is the number of blocks to read
+ if (newStream->blockSizeArray) {
+ // Calculate the total number of bytes to read in initially
+ initialRead = (int32)imath_min(initialRead, numBlocksToRead);
+ finished = false;
+ bytesToRead = 0;
+ i = 0;
+ while ((i < initialRead) && (!finished)) {
+ if ((bytesToRead + blockSizeArray[i]) <= strmBuffSize) {
+ bytesToRead += blockSizeArray[i];
+ i++;
+ } else {
+ finished = true;
+ }
+ }
+
+ // Update the blockSizeArray, and numBlocksToRead entries. We plan to read in "i" blocks so far.
+ newStream->numBlocksToRead -= i;
+ newStream->blockSizeArray += i;
+ }
+
+ // Else the initialRead refers to the number of bytes to initially read
+ else {
+
+ //bounds check the initialRead and set the nextReadSize field
+ bytesToRead = (int32)imath_min(initialRead, strmBuffSize);
+ newStream->nextReadSize = bytesToRead;
+ }
+
+ // Make sure we still have something to read
+ if (bytesToRead > 0) {
+
+ // Read in the initial bytes to read
+ //bytesRead = fread((void*)newStream->strmHead, 1, bytesToRead, newStream->srcFile);
+ bufferHandle = newStream->strmHead;
+ bytesRead = newStream->srcFile->read((Handle)&bufferHandle, bytesToRead);
+
+ //did we actually read that many? If not, close the file
+ if (bytesRead < bytesToRead) {
+ delete newStream->srcFile;
+ newStream->srcFile = nullptr;
+ }
+
+ // Update the strmHead pointer
+ newStream->strmHead += bytesRead;
+ }
+ }
+
+ //link the stream request into the list of requests
+ newStream->prev = nullptr;
+ newStream->next = _G(firstStream);
+ if (_G(firstStream)) {
+ _G(firstStream)->prev = newStream;
+ } else {
+ _G(lastStream) = newStream;
+ }
+ _G(firstStream) = newStream;
+
+ // Return the stream request
+ return newStream;
+}
+
+
+static bool UnwrapStream(strmRequest *myStream) {
+ int32 bytesToMove = 0, bytesAvail;
+ uint8 *tempBuff;
+
+ // Using tempBuff as a flag to determine whether data needs to be temporarily stored
+ tempBuff = nullptr;
+
+ // Since strmTail is never allowed to be equal to strmWrap if it is > strmHead, there must be a
+ // Non-zero amount of data at the end which we must move.
+ //Therefore, we may have to temporarily store anything at the beginning of the buffer
+ if (myStream->strmHead > myStream->strmBuff) {
+
+ // Calculate how many bytes to store and copy to a temporary buffer
+ bytesToMove = (int32)myStream->strmHead - (int32)myStream->strmBuff;
+
+ if ((tempBuff = (uint8 *)mem_alloc(bytesToMove, "stream temp buff")) == nullptr)
+ error_show(FL, 'OOM!', "UnwrapStream() failed - temp buff avail: %ld", bytesToMove);
+
+ memcpy(tempBuff, myStream->strmBuff, bytesToMove);
+ }
+
+ // Move the data at the end of the buffer to the beginning and reset the strmWrap pointer
+ bytesAvail = (int32)myStream->strmWrap - (int32)myStream->strmTail;
+ memmove(myStream->strmBuff, myStream->strmTail, bytesAvail);
+ myStream->strmTail = myStream->strmBuff;
+ myStream->strmHead = (uint8 *)((int32)(myStream->strmTail) + bytesAvail);
+ myStream->strmWrap = myStream->endStrmBuff;
+
+ // Now check if we temporarily store data. if so, copy it back to the stream and turf the temp buffer
+ if (tempBuff) {
+ memcpy(myStream->strmHead, tempBuff, bytesToMove);
+ myStream->strmHead += bytesToMove;
+ mem_free(tempBuff);
+ }
+ return true;
+}
+
+
+void f_stream_DumpPreviouslyRead(strmRequest *myStream) {
+ // This is used to allow the f_stream_Process() function to overwrite the stream buffer space where
+ // the previously read data was stored. ie. If you call f_stream_Read(), and then make a copy,
+ // you wouldn't care if the data in the stream buffer was overwritten, so call this procedure.
+ if (myStream) {
+ myStream->strmLastRead = myStream->strmTail;
+ if (myStream->strmTail == myStream->strmHead) {
+ myStream->strmTail = myStream->strmBuff;
+ myStream->strmHead = myStream->strmBuff;
+ }
+ }
+}
+
+
+int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes) {
+ int32 bytesAvail, bytesNeeded, bytesRead;
+ void *bufferHandle;
+
+ // Parameter verification
+ if (!myStream)
+ error_show(FL, 'FSIS', "f_stream_Read() failed - invalid stream request");
+
+ if ((numBytes <= 0) || (numBytes >= myStream->strmSize))
+ error_show(FL, 'FSR!', "%ld stream size %ld", numBytes, myStream->strmSize);
+
+ // If the stream tail is > the stream head, and the number of bytes at the end of the buffer is < numBytes
+ // we must unwrap the stream, moving the data at the end of the buffer to the beginning, and slide the beginning down
+ if ((myStream->strmTail > myStream->strmHead) && (((int32)myStream->strmWrap - (int32)myStream->strmTail) < numBytes)) {
+ UnwrapStream(myStream);
+ }
+
+ // Now either the strmHead is >= the strmTail, or there is enough data at the end of the buffer to fulfill numBytes
+
+ // Calculate the number of bytes available
+ if (myStream->strmTail <= myStream->strmHead) {
+ bytesAvail = (int32)(myStream->strmHead - myStream->strmTail);
+ } else {
+ // No extra data is available at the beginning of the stream buffer, since we "unwrapped" the stream
+ bytesAvail = (int32)(myStream->strmWrap - myStream->strmTail);
+ }
+
+ // Now check and see if we have enough bytes available
+ if (bytesAvail >= numBytes) {
+ // Set the destination pointer
+ *dest = (uint8 *)myStream->strmTail;
+ myStream->strmLastRead = myStream->strmTail;
+
+ // Update the strmTail pointer
+ myStream->strmTail += numBytes;
+
+ // If there is no data left at the end of the stream buffer, reset the strmTail and strmWrap pointers
+ if (myStream->strmTail == myStream->strmWrap) {
+ myStream->strmTail = myStream->strmBuff;
+ myStream->strmWrap = myStream->endStrmBuff;
+ }
+
+ return numBytes;
+ } else {
+ // Else we will have to read more data from disc
+ // If this has happened, since we "unwrapped" the stream buff, we can guarantee that strmTail < strmHead
+
+ // Calculate how much more must be read in
+ bytesNeeded = numBytes - bytesAvail;
+
+ // Make sure we have enough room at the end of the buffer to accommodate
+ if ((int32)(myStream->endStrmBuff - myStream->strmHead) < bytesNeeded) {
+ // We need to memmove the contents of the stream to the beginning of the buff to allow
+ // F_stream_read() to return a pointer to a contiguous block
+
+ // Move the data to the beginning of the stream buffer, and reset the head and tail pointers
+ memmove((void *)myStream->strmBuff, myStream->strmTail, bytesAvail);
+ myStream->strmTail = myStream->strmBuff;
+ myStream->strmHead = (uint8 *)((int32)myStream->strmTail + bytesAvail);
+ }
+
+ // If the client is using a blockSizeArray, hopefully bytesNeeded will be equal to the next blockSize
+ if (myStream->blockSizeArray && (*myStream->blockSizeArray == bytesNeeded) && (myStream->numBlocksToRead > 0)) {
+ myStream->blockSizeArray++;
+ myStream->numBlocksToRead--;
+ } else {
+ // Otherwise we just trashed the whole point of using a calculated blockSizeArray
+ myStream->blockSizeArray = nullptr;
+ myStream->numBlocksToRead = -1;
+ myStream->nextReadSize = numBytes;
+ }
+
+ // Read in the bytesNeeded
+ bufferHandle = myStream->strmHead;
+ bytesRead = myStream->srcFile->read((Handle)&bufferHandle, bytesNeeded);
+
+ if (bytesRead < bytesNeeded) {
+ // If we could not read that much in, close the srcFile
+ delete myStream->srcFile;
+ myStream->srcFile = nullptr;
+ }
+
+ // Set the destination pointer and update the stream pointers
+ *dest = (uint8 *)myStream->strmTail;
+ myStream->strmLastRead = myStream->strmTail;
+ myStream->strmHead += bytesRead;
+ myStream->strmTail = myStream->strmHead;
+
+ // Return the number of bytes successfully available
+ return (bytesRead + bytesAvail);
+ }
+}
+
+void f_stream_Close(strmRequest *myStream) {
+ // Parameter verification
+ if (!myStream) {
+ return;
+ }
+
+ // Close the stream and throw out the stream buffer
+ if (myStream->srcFile) {
+ delete myStream->srcFile;
+ }
+
+ // Kill the stream buffer
+ HUnLock(myStream->strmHandle);
+ DisposeHandle(myStream->strmHandle);
+ myStream->strmBuff = nullptr;
+
+
+ // Remove the stream request from the list of requests
+ if (myStream->next) {
+ myStream->next->prev = myStream->prev;
+ } else {
+ _G(lastStream) = myStream->prev;
+ }
+ if (myStream->prev) {
+ myStream->prev->next = myStream->next;
+ } else {
+ _G(firstStream) = myStream->next;
+ }
+
+ // Final, turf the stream request
+ mem_free(myStream);
+}
+
+void f_stream_Process(int32 numToProcess) {
+ strmRequest *myStream, *firstProcessStream;
+ int32 buffEndBytesAvail = 0, buffStartBytesAvail = 0;
+ int32 bytesRead, bytesAvail, nextReadSize;
+ bool buffWrap, useBlockSizeArray;
+ void *bufferHandle;
+
+ // No sense wasting time if there are no stream requests to process
+ if (!_G(firstStream)) {
+ return;
+ }
+
+ // Loop through until either the end of the list of requests, or we've serviced the "numToProcess"
+ firstProcessStream = _G(firstStream);
+ myStream = _G(firstStream);
+ while (myStream && (numToProcess > 0)) {
+
+ // Make sure we still have an open srcFile
+ if (myStream->srcFile && (myStream->numBlocksToRead != 0)) {
+ buffWrap = false;
+ useBlockSizeArray = false;
+
+ // Calculate the amount of empty space in the stream buff
+ // If all the empty space in the stream buff is between the head and the lastRead...
+ if (myStream->strmLastRead >= myStream->strmHead) {
+ bytesAvail = (int32)myStream->strmLastRead - (int32)myStream->strmHead;
+
+ // strmTail and strmHead can never equal unless the buffer is completely empty, therefore,
+ // make sure the amout of bytes available won't cause strmHead to become equal to strmTail
+ if ((bytesAvail > 0) && (myStream->strmLastRead == myStream->strmTail)) {
+ bytesAvail--;
+ }
+ } else {
+ // Else all the empty space is wrapped around the end of the buffer
+ buffWrap = true;
+
+ // Calculate how much space is available at the start and at the end of the buffer
+ buffEndBytesAvail = (int32)myStream->endStrmBuff - (int32)myStream->strmHead;
+ buffStartBytesAvail = (int32)myStream->strmLastRead - (int32)myStream->strmBuff;
+
+ // As above, ensure strmHead won't become equal to strmTail
+ if ((buffStartBytesAvail > 0) && (myStream->strmLastRead == myStream->strmTail)) {
+ buffStartBytesAvail--;
+ }
+
+ // Calculate the total bytes available
+ bytesAvail = buffEndBytesAvail + buffStartBytesAvail;
+ }
+
+ // Now find the number of bytes to read - either from the blockSizeArray...
+ if (myStream->blockSizeArray) {
+ useBlockSizeArray = true;
+ nextReadSize = *myStream->blockSizeArray;
+ } else {
+ // ...or directly from the nextReadSize field of the stream request
+ nextReadSize = myStream->nextReadSize;
+ }
+
+ // See if we can simply read the next chunk into the strmHead, without worrying about "wrapping" the buffer
+ if ((buffWrap && (buffEndBytesAvail >= nextReadSize)) ||
+ ((!buffWrap) && (bytesAvail >= nextReadSize))) {
+ // Read the bytes into the stream buffer
+ bufferHandle = myStream->strmHead;
+ bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize);
+
+ // If we could not read that much in, close the srcFile
+ if (bytesRead < nextReadSize) {
+ delete myStream->srcFile;
+ myStream->srcFile = nullptr;
+ }
+
+ // Update the stream head
+ myStream->strmHead += bytesRead;
+
+ // Update the blockSizeArray pointer if necessary
+ if (useBlockSizeArray) {
+ myStream->blockSizeArray++;
+ myStream->numBlocksToRead--;
+ }
+ } else if (buffWrap) {
+ // Else if the empty space is wrapped, we may still be able to store the next data chunk, otherwise no more room
+
+ // See if we can wrap the next data chunk around
+ if (!myStream->wrapStream) {
+
+ // No wrapping allowed, so do we have room for it at the beginning of the stream
+ if (buffStartBytesAvail >= nextReadSize) {
+
+ //we can read it in at the beginning, so set the strmWrap pointer
+ myStream->strmWrap = myStream->strmHead;
+
+ // Read the bytes into the stream buffer
+ //bytesRead = (int32)fread((void*)myStream->strmBuff, 1, nextReadSize, myStream->srcFile);
+ bufferHandle = myStream->strmBuff;
+ bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize);
+
+ // If we could not read that much in, close the srcFile
+ if (bytesRead < nextReadSize) {
+ delete myStream->srcFile;
+ myStream->srcFile = nullptr;
+ }
+
+ // Update the stream head
+ myStream->strmHead = (uint8 *)((int32)myStream->strmBuff + bytesRead);
+
+ // Update the blockSizeArray pointer if necessary
+ if (useBlockSizeArray) {
+ myStream->blockSizeArray++;
+ myStream->numBlocksToRead--;
+ }
+ }
+ } else if (bytesAvail >= nextReadSize) {
+ // Else we might have to read in part at the end, and part at the beginning of the stream buffer
+
+ // Read into the end of the stream buffer
+ if (buffEndBytesAvail > 0) {
+
+ // Read into the end of the buffer
+ bufferHandle = myStream->strmHead;
+ bytesRead = (int32)myStream->srcFile->read((Handle)&bufferHandle, buffEndBytesAvail);
+
+ // If we could not read that much in, close the srcFile and update the head pointer
+ if (bytesRead < buffEndBytesAvail) {
+ delete myStream->srcFile;
+ myStream->srcFile = nullptr;
+ myStream->strmHead += bytesRead;
+ }
+ }
+
+ // Make sure we didn't close the srcFile in the last read
+ if (myStream->srcFile) {
+
+ // Read into the beginning of the buffer
+ bufferHandle = myStream->strmBuff;
+ bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize - buffEndBytesAvail);
+
+ // If we could not read that much in, close the srcFile
+ if (bytesRead < (nextReadSize - buffEndBytesAvail)) {
+ delete myStream->srcFile;
+ myStream->srcFile = nullptr;
+ }
+
+ // Update the head pointer
+ myStream->strmHead = (uint8 *)((int32)myStream->strmBuff + bytesRead);
+
+ // Update the blockSizeArray pointer if necessary
+ if (useBlockSizeArray) {
+ myStream->blockSizeArray++;
+ myStream->numBlocksToRead--;
+ }
+ }
+ }
+ }
+ }
+
+ // If we were able, we serviced the above stream request. Get the next request and decriment the counter
+ myStream = myStream->next;
+ numToProcess--;
+ }
+
+ // See if we ran out of processes or if the counter ran out
+ if (myStream) {
+ // This implies the counter ran out. Move the front of the list to myStream->prev to the end of the list
+ myStream->prev->next = nullptr;
+ _G(lastStream)->next = _G(firstStream);
+ _G(firstStream)->prev = _G(lastStream);
+ _G(lastStream) = myStream->prev;
+ myStream->prev = nullptr;
+ _G(firstStream) = myStream;
+ }
+}
+
} // namespace M4
diff --git a/engines/m4/fileio/fstream.h b/engines/m4/fileio/fstream.h
index ff8936895e9..6729f53d339 100644
--- a/engines/m4/fileio/fstream.h
+++ b/engines/m4/fileio/fstream.h
@@ -23,6 +23,7 @@
#define M4_FILEIO_FSTREAM_H
#include "common/file.h"
+#include "m4/mem/reloc.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -36,7 +37,7 @@ public:
int32 read(Handle bufferHandle, int32 n);
bool seek(uint32 n);
- bool seek_ahead(uint32 n);
+ bool seek_ahead(int32 n);
uint32 get_pos();
};
@@ -45,7 +46,7 @@ struct strmRequest {
strmRequest *prev;
StreamFile *srcFile;
int32 strmSize;
- Handle strmHandle;
+ MemHandle strmHandle;
uint8 *strmBuff;
uint8 *endStrmBuff;
uint8 *strmHead;
@@ -59,6 +60,13 @@ struct strmRequest {
};
extern bool f_stream_Init();
+extern void f_stream_Shutdown();
+
+extern strmRequest *f_stream_Open(StreamFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
+ int32 numBlocksToRead, int32 *blockSizeArray, int32 initialRead, bool wrapStream);
+extern int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes);
+extern void f_stream_Close(strmRequest *myStream);
+extern void f_stream_Process(int32 numToProcess);
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 91d9988c332..f106cdb9683 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -47,4 +47,10 @@ bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x,
return series_draw_sprite(spriteHash, index, destBuff, x, y);
}
+machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
+ int32 x, int32 y, int32 s, int32 layer, int32 frameRate, int16 triggerNum) {
+ error("TODO: series_play_xy");
+ return nullptr;
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 49c7e591c58..7359ef12434 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -27,6 +27,12 @@
namespace M4 {
+constexpr uint32 FORWARD = 0;
+constexpr uint32 PINGPONG = 1;
+constexpr uint32 BACKWARD = 2;
+constexpr uint32 STICK = 4;
+constexpr uint32 NO_TOSS = 8;
+
extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal);
extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index f3a65ff2733..70344c9c854 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -19,20 +19,501 @@
*
*/
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv_control.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/events/keys.h"
#include "m4/graphics/krn_pal.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
namespace M4 {
+#define _GP(X) _G(krnPal)._##X
+
+#define BACKGROUND_HEIGHT (int32)639
+
+#define GREY_START 32
+#define NUM_GREYS 32 // gotta have 32 greys to fade to (hardcoded algorithm)
+#define GREY_END GREY_START+NUM_GREYS
+
+#define FREE_START GREY_END+1
+#define FREE_END 255
+#define NUM_FREE FREE_END-(FREE_START)+1
+
+static void krn_pal_game_task() {
+ int32 status;
+
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+ if (!game_buff_ptr)
+ error_show(FL, 'BUF!');
+
+ CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
+ _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+
+ _G(inverse_pal)->release();
+ _G(game_bgBuff)->release();
+
+ _G(digi).task();
+ _G(midi).task();
+
+ gui_system_event_handler();
+
+ f_stream_Process(2);
+}
+
+static int32 screen_height(Buffer *grey_screen) {
+ return imath_min(BACKGROUND_HEIGHT + _G(kernel).letter_box_y, grey_screen->h);
+}
+
+static void grey_fade(RGB8 *pal, int32 to_from_flag, int32 from, int32 to, int32 steps, int32 delay) {
+ int i;
+#ifdef TODO
+ int j;
+ clock_t begin_time;
+ RGB8 *working = (RGB8 *)mem_alloc(sizeof(RGB8) * 256, STR_FADEPAL);
+
+ // perform the fade
+ for (i = 1; i < steps; i++) {
+ for (j = from; j <= to; j++) {
+ if (to_from_flag == TO_GREY) { // fade to grey from full color
+ working[j].r = (Byte)((int)pal[j].r + ((((int)_GP(fadeToMe)[j].r - (int)pal[j].r) * i) / steps));
+ working[j].g = (Byte)((int)pal[j].g + ((((int)_GP(fadeToMe)[j].g - (int)pal[j].g) * i) / steps));
+ working[j].b = (Byte)((int)pal[j].b + ((((int)_GP(fadeToMe)[j].b - (int)pal[j].b) * i) / steps));
+ } else if (to_from_flag == TO_COLOR) { // fade from grey to full color
+ working[j].r = (Byte)((int)_GP(fadeToMe)[j].r + ((((int)pal[j].r - (int)_GP(fadeToMe)[j].r) * i) / steps));
+ working[j].g = (Byte)((int)_GP(fadeToMe)[j].g + ((((int)pal[j].g - (int)_GP(fadeToMe)[j].g) * i) / steps));
+ working[j].b = (Byte)((int)_GP(fadeToMe)[j].b + ((((int)pal[j].b - (int)_GP(fadeToMe)[j].b) * i) / steps));
+ } else { //fade from grey to black
+ working[j].r = (Byte)((int)_GP(fadeToMe)[j].r - ((((int)_GP(fadeToMe)[j].r) * i) / steps));
+ working[j].g = (Byte)((int)_GP(fadeToMe)[j].g - ((((int)_GP(fadeToMe)[j].g) * i) / steps));
+ working[j].b = (Byte)((int)_GP(fadeToMe)[j].b - ((((int)_GP(fadeToMe)[j].b) * i) / steps));
+ }
+ }
+
+ gr_pal_set_range(working, from, to - from + 1); ///set pal 21-255
+
+ // Time delay of "delay" milliseconds
+ begin_time = clock();
+ while ((((clock() - begin_time) * 1000) / CLOCKS_PER_SEC) < delay)
+ krn_pal_game_task();
+ }
+#else
+ error("TODO: grey_fade");
+#endif
+
+ // Eliminate round off error
+ if (to_from_flag == TO_GREY) {
+ gr_pal_set_range(_GP(fadeToMe), from, to - from + 1); ///set pal 21-255
+ } else if (to_from_flag == TO_COLOR) {
+ gr_pal_set_range(pal, from, to - from + 1); ///set pal 21-255
+ } else {
+ for (i = from; i <= to; i++) {
+ pal[i].r = pal[i].g = pal[i].b = 0;
+ }
+ gr_pal_set_range(pal, from, to - from + 1); ///set pal 21-255
+ }
+#ifdef TODO
+ mem_free(working);
+#endif
+}
+
+
+
+// screen is the currently displayed screen
+// screenPicture is the data to restore the screen with
+// note: color 0 doesn't fade.
+
+static void create_luminance_map(RGB8 *pal) {
+ for (int i = GREY_START; i <= FREE_END; i++) {
+ Byte luminance = (Byte)((pal[i].r + pal[i].g + pal[i].b) / 3);
+ _GP(fadeToMe)[i].g = (Byte)imath_min(255, luminance); // MattP new green screen!
+ _GP(fadeToMe)[i].r = _GP(fadeToMe)[i].b = 0;
+ }
+}
+
+
+static HotkeyCB remember_esc_key;
+
+
+// finds the best macthes for the in the greys in the grey ramp range using the free range greys
+// used to map greys out of the grey ramp area, and then again to map the grey ramp out of the grey ramp area!
+static void make_translation_table(RGB8 *pal) {
+ int32 i, j, bestMatch, minDist;
+
+ for (i = 0; i < NUM_GREYS; i++) {
+ bestMatch = FREE_START; // assume the first of the free indexes is best match to start with
+ minDist = 255; // assume that it's really far away to start with
+
+ if (!(i & 0x3ff)) {
+ digi_read_another_chunk();
+ midi_loop();
+ }
+
+ // look for best match in the free indexes for the greys in GREY_START-GREY_END range (we need these available)
+ int32 matchGrey = pal[GREY_START + i].g; // MattP use green instead of red cause we're having a green screen
+
+ for (j = FREE_START; j <= FREE_END; j++) {
+ int32 tryGrey = pal[j].g;
+ if (imath_abs(tryGrey - matchGrey) < minDist) {
+ minDist = imath_abs(tryGrey - matchGrey);
+ bestMatch = j;
+ }
+ if (minDist == 0)
+ break; // no need to continue searching if we found a perfect match
+ }
+ _GP(translation)[i] = (uint8)bestMatch;
+ }
+}
+
+void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay) {
+ int32 i, j, bestMatch, minDist;
+ uint8 *tempPtr;
+
+ if (_G(kernel).fading_to_grey) {
+ return;
+ }
+ _G(kernel).fading_to_grey = true;
+
+ Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
+
+ _GP(fadeToMe) = (RGB8 *)mem_alloc(sizeof(RGB8) * 256, STR_FADEPAL);
+ _GP(trick) = (RGB8 *)mem_alloc(sizeof(RGB8) * 256, STR_FADEPAL);
+ _GP(picPal) = (RGB8 *)mem_alloc(sizeof(RGB8) * 256, STR_FADEPAL);
+
+ memcpy(_GP(picPal), pal, sizeof(RGB8) * 256);
+ create_luminance_map(pal);
+
+ grey_fade(pal, TO_GREY, 21, 255, steps, delay);
+
+ // make _GP(translation) table
+ // to translate colors using entries 59-255 into 21-58 range
+
+ for (i = 0; i < 64; i++) {
+ bestMatch = 63;
+ minDist = 255;
+
+ if (!(i & 0x3ff)) {
+ _G(digi).task();
+ _G(midi).task();
+ }
+
+ for (j = 59; j <= 255; j++) {
+ if (imath_abs((_GP(fadeToMe)[j].r >> 2) - i) < minDist) {
+ minDist = imath_abs((_GP(fadeToMe)[j].r >> 2) - i);
+ bestMatch = j;
+ }
+ if (minDist == 0)
+ break; // no need to continue searching if we found a perfect match
+ }
+
+ _GP(translation)[i] = (uint8)bestMatch;
+ }
+
+ // palette now grey scale. Remap any pixels which are in the range 21-58 to the range 53-255
+ // because we need to use those palette entries soon
+
+ tempPtr = grey_screen->data;
+ // note: this loop should be y0 to y1, x0 to x1, not a stride*h loop.
+ for (i = 0; i < (grey_screen->stride * grey_screen->h); i++) {
+ if ((*tempPtr >= GREY_START) && (*tempPtr <= GREY_END)) {
+ // must move the pixel index to the best match in FREE_START-FREE_END range with _GP(translation) table
+ *tempPtr = _GP(translation)[*tempPtr - GREY_START];
+ }
+ tempPtr++;
+
+ if (!(i & 0x3ff)) {
+ _G(digi).task();
+ _G(midi).task();
+ }
+
+ }
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ // make new trickPal with grey-scale ramp entries and load it into VGA registers
+ memcpy(_GP(trick), _GP(fadeToMe), sizeof(RGB8) * 256); // MattP _GP(trick) pal is the greyed version plus the grey ramp overlayed on top
+ int8 grey_step = 256 / NUM_GREYS;
+ int8 grey_ramp = 0;
+ for (i = GREY_START; i <= GREY_END; i++) {
+ // _GP(trick)[i].r = _GP(trick)[i].g = _GP(trick)[i].b = (Byte) (grey_ramp); old grey ramp
+ _GP(trick)[i].g = (Byte)(grey_ramp); // MattP new green screen
+ _GP(trick)[i].r = _GP(trick)[i].b = 0;
+ grey_ramp += grey_step;
+ }
+ gr_pal_set_range(_GP(trick), GREY_START, NUM_GREYS); ///set pal GREY_START-GREY_END
+
+ remap_buffer_with_luminance_map(grey_screen, 0, 0, grey_screen->W - 1, screen_height(grey_screen) - 1);
+ _G(gameDrawBuff)->release();
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+}
+
+
+void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
+ uint8 *tempPtr;
+ int32 i;
+
+ if (!_G(kernel).fading_to_grey) {
+ return;
+ }
+
+ // Get the screen
+ Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
+
+ // load original faded greys into the free indexes (no pixels have these indexs yet)
+ gr_pal_set_range(_GP(fadeToMe), FREE_START, NUM_FREE); // Load _GP(fadeToMe) colors into VGA
+
+ make_translation_table(_GP(trick)); // Mattp this is used in fade_to_grey too!
+
+ // for every pixel in the screen, move any pixel in the GREY_START-GREY_END range out in to the free range
+ tempPtr = grey_screen->data;
+ // note: this loop should be y0 to y1, x0 to x1, not a stride*h loop.
+ for (i = 0; i < (grey_screen->stride * grey_screen->h); ++i) {
+ if (!(i & 0x3ff)) {
+ _G(digi).task();
+ _G(midi).task();
+ }
+
+ // if the pixel is within the GREY range, move it to where the _GP(translation) table says
+ if ((*tempPtr >= GREY_START) && (*tempPtr <= GREY_END)) {
+ *tempPtr = _GP(translation)[*tempPtr - GREY_START];
+ }
+ tempPtr++;
+ }
+
+ // Term_message ("remaped indexes out of grey ramp");
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+ // Term_message ("setting grey ramp indexes back to picture greys");
+ gr_pal_set_range(_GP(fadeToMe), GREY_START, NUM_GREYS); // get the rest of the original re-luminance colors
+
+ //recopy screenPicture to screen to restore original pixels
+ krn_UnsetGreyVideoMode();
+ RestoreScreens(0, 0, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ memcpy(pal, _GP(picPal), sizeof(RGB8) * 256);
+
+ ws_RefreshWoodscriptBuffer(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]), _G(screenCodeBuff),
+ (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr());
+ _G(game_bgBuff)->release();
+ _G(inverse_pal)->release();
+
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ grey_fade(pal, fadeType, GREY_START, FREE_END, steps, delay);
+
+ mem_free((char *)_GP(trick));
+ mem_free((char *)_GP(fadeToMe));
+ mem_free((char *)_GP(picPal));
+ _G(kernel).fading_to_grey = false;
+ _G(gameDrawBuff)->release();
+ gr_pal_set(_G(master_palette));
+}
+
+bool examining_inventory_object = false;
+
+
+void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
+ int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger) {
+
+ remember_esc_key = GetSystemHotkey(KEY_ESCAPE);
+ RemoveSystemHotkey(KEY_ESCAPE);
+
+ interface_hide();
+
+ _GP(exam_saved_hotspots) = _G(currentSceneDef).hotspots;
+ _G(currentSceneDef).hotspots = NULL;
+
+ _GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
+
+ krn_fade_to_grey(pal, steps, delay);
+
+ _GP(seriesHash) = series_load(picName, -1, pal); // Preload sprite so we can unload it
+ gr_pal_set_range(pal, FREE_START, 197); // Set that series colors into VGA
+ RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
+ krn_SetGreyVideoMode(
+ // Grey rectangle
+ 0, 0, MAX_VIDEO_X, screen_height(grey_screen) + _G(kernel).letter_box_y,
+ // Color rectangle
+ x, y, x + ws_get_sprite_width(_GP(seriesHash), 0) - 1, y + ws_get_sprite_height(_GP(seriesHash), 0) - 1);
+ _G(gameDrawBuff)->release();
+
+ // Play the sprite series as a loop
+ int32 status;
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+ _GP(seriesAnim8) = series_play_xy(picName, -1, FORWARD,
+ x - game_buff_ptr->x1, y - game_buff_ptr->y1, 100, 0, 7, -1);
+
+ if (digi_name) {
+ digi_play(digi_name, 1, 255, digi_trigger);
+ }
+
+ player_set_commands_allowed(true);
+
+ CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
+ _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+
+ game_pause(true);
+
+ _G(inverse_pal)->release();
+ _G(game_bgBuff)->release();
+
+ PauseEngines();
+}
+
+void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
+ if (!_GP(seriesAnim8) || _GP(seriesHash) < 0)
+ return;
+
+ player_set_commands_allowed(false);
+ game_pause(false);
+ UnpauseEngines();
+
+ TerminateMachine(_GP(seriesAnim8));
+ series_unload(_GP(seriesHash));
+ _GP(seriesAnim8) = NULL;
+ _GP(seriesHash) = 0;
+
+ Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
+ krn_SetGreyVideoMode(0, 0, MAX_VIDEO_X, screen_height(grey_screen) + _G(kernel).letter_box_y, -1, -1, -1, -1);
+ _G(gameDrawBuff)->release();
+
+ krn_pal_game_task();
+
+ krn_fade_from_grey(pal, steps, delay, TO_COLOR);
+
+ krn_pal_game_task();
+
+ // set in kernel_examine_inventory_object (above)
+ kernel_trigger_dispatch(_GP(myFadeTrigger));
+
+ // gr_pal_set(master_palette);
+
+ RestoreScreens(0, 0, MAX_VIDEO_X, MAX_VIDEO_Y);
+
+ _G(currentSceneDef).hotspots = _GP(exam_saved_hotspots);
+
+ interface_show();
+ AddSystemHotkey(KEY_ESCAPE, remember_esc_key);
+}
+
+
+// This is an inplace remap
+// _GP(fadeToMe) must already have been set up to correspond to the image on the screen
+void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2) {
+ uint8 *ptr;
+ int32 x, y;
+ if ((!src) || (!src->data)) return;
+ if ((x2 - x1 < 0) || (y2 - y1 < 0)) return;
+ if (x2 - x1 + 1 > src->W) x2 = src->W - 1;
+ if (y2 - y1 + 1 > src->h) y2 = src->h - 1;
+
+ x2 -= x1;
+ y2 -= y1;
+ for (y = 0; y <= y2; y++) {
+ ptr = &src->data[(y + y1) * src->stride + x1];
+ for (x = 0; x <= x2; x++) // for each pixel in row
+
+ // remap the greyed out pixel to the closest grey in GREY_START to GREY_END range
+ // shift right 3, takes a 255 value and makes it out of 32 (the number of greys in reduced grey ramp)
+ ptr[x] = (uint8)(GREY_START + (_GP(fadeToMe)[ptr[x]].g >> 3)); // MattP use green instead of red cause we're having a green screen
+
+ if (!(y & 0xff)) {
+ _G(digi).task();
+ _G(midi).task();
+ }
+ }
+}
+
+void krn_SetGreyVideoMode(int32 grey_x1, int32 grey_y1, int32 grey_x2, int32 grey_y2, int32 color_x1, int32 color_y1, int32 color_x2, int32 color_y2) {
+ _GP(greyAreaX1) = grey_x1;
+ _GP(greyAreaY1) = grey_y1;
+ _GP(greyAreaX2) = grey_x2;
+ _GP(greyAreaY2) = grey_y2;
+
+ _GP(colorAreaX1) = color_x1;
+ _GP(colorAreaY1) = color_y1;
+ _GP(colorAreaX2) = color_x2;
+ _GP(colorAreaY2) = color_y2;
+
+ _GP(greyVideoMode) = true;
+}
+
+void krn_UnsetGreyVideoMode() {
+ _GP(greyAreaX1) = -1;
+ _GP(greyAreaY1) = -1;
+ _GP(greyAreaX2) = -1;
+ _GP(greyAreaY2) = -1;
+
+ _GP(colorAreaX1) = -1;
+ _GP(colorAreaY1) = -1;
+ _GP(colorAreaX2) = -1;
+ _GP(colorAreaY2) = -1;
+
+ _GP(greyVideoMode) = false;
+}
+
+bool krn_GetGreyMode() {
+ return _GP(greyVideoMode);
+}
+
+void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scrnY, int32 greyX1, int32 greyY1, int32 greyX2, int32 greyY2) {
+ bool finished;
+ int32 x1, y1, x2, y2;
+
+ if ((!_GP(greyVideoMode)) || (!greyOutThisBuffer) || (!greyOutThisBuffer->data)) {
+ return;
+ }
+ x1 = imath_max(greyX1 + scrnX, _GP(greyAreaX1));
+ y1 = imath_max(greyY1 + scrnY, _GP(greyAreaY1));
+ x2 = imath_min(greyX2 + scrnX, _GP(greyAreaX2));
+ y2 = imath_min(greyY2 + scrnY, _GP(greyAreaY2));
+ if ((x1 > x2) || (y1 > y2)) return;
+ finished = false;
+ if (!finished) {
+ if (y1 < _GP(colorAreaY1)) {
+ remap_buffer_with_luminance_map(greyOutThisBuffer,
+ x1 - scrnX, y1 - scrnY, x2 - scrnX, imath_min(y2, _GP(colorAreaY1) - 1) - scrnY);
+ y1 = imath_min(y2, _GP(colorAreaY1));
+ if (y1 >= y2) finished = true;
+ }
+ }
+ if (!finished) {
+ if (y2 > _GP(colorAreaY2)) {
+ remap_buffer_with_luminance_map(greyOutThisBuffer,
+ x1 - scrnX, imath_max(y1, _GP(colorAreaY2) + 1) - scrnY, x2 - scrnX, y2 - scrnY);
+ y2 = imath_max(y1, _GP(colorAreaY2));
+ if (y1 >= y2) finished = true;
+ }
+ }
+ if (!finished) {
+ if (x1 < _GP(colorAreaX1)) {
+ remap_buffer_with_luminance_map(greyOutThisBuffer,
+ x1 - scrnX, y1 - scrnY, imath_min(x2, _GP(colorAreaX1) - 1) - scrnX, y2 - scrnY);
+ x1 = imath_min(x2, _GP(colorAreaX1));
+ if (x1 >= x2) finished = true;
+ }
+ }
+ if (!finished) {
+ if (x2 > _GP(colorAreaX2)) {
+ remap_buffer_with_luminance_map(greyOutThisBuffer,
+ imath_max(x1, _GP(colorAreaX2) + 1) - scrnX, y1 - scrnY, x2 - scrnX, y2 - scrnY);
+ }
+ }
+}
+
void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
- int32 x, y, r, g, b, i;
+ int32 x, y, r, g, b, i;
uint8 *inverse_palette, pixel, *tempPtr;
- frac16 fracPercent;
+ frac16 fracPercent;
RGB8 *pal;
- uint8 luminancePal[256];
+ uint8 luminancePal[256];
- //paremeter verification
+ // Paremeter verification
if ((!target) || (!target->data)) {
return;
}
@@ -46,17 +527,17 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
return;
}
- //calculate the frac16 form of the percent
+ // Calculate the frac16 form of the percent
fracPercent = (percent * 255) / 100;
- //get the palette and the inverse palette
+ // Get the palette and the inverse palette
pal = &_G(master_palette)[0];
inverse_palette = _G(inverse_pal)->get_ptr();
if ((!pal) || (!inverse_palette)) {
return;
}
- //calculate the luminance Pal table
+ // Calculate the luminance Pal table
for (i = 0; i < 256; i++) {
r = ((((pal[i].r * fracPercent) >> 10) >> 1)) & 0x1f;
g = ((((pal[i].g * fracPercent) >> 10) >> 1)) & 0x1f;
@@ -64,8 +545,8 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
luminancePal[i] = inverse_palette[(r << 10) + (g << 5) + b];
}
- // note: this loop should be y0 to y1, x0 to x1, not a stride*h loop.
- //loop through every pixel replacing it with the index into the luminance table
+ // Note: this loop should be y0 to y1, x0 to x1, not a stride*h loop.
+ // Loop through every pixel replacing it with the index into the luminance table
tempPtr = target->data;
for (y = 0; y < target->h; y++) {
for (x = 0; x < target->stride; x++) {
@@ -78,4 +559,340 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
_G(inverse_pal)->release();
}
+
+static void pal_fade_callback(frac16 myMessage) {
+ _G(pal_fade_in_progress) = false;
+ kernel_trigger_dispatch((uint32)myMessage);
+}
+
+void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
+ int32 targetPercent, int32 numTicks, uint32 triggerNum) {
+ if ((!origPalette) || (firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry))
+ return;
+ if ((targetPercent < 0) || (targetPercent > 100))
+ return;
+
+ _GP(myFadeReq) = true;
+ _GP(myFadeFinished) = false;
+ _GP(myFadeStartTime) = timer_read_60();
+ _GP(myFadeEndDelayTime) = timer_read_60();
+ _GP(myFadeStartIndex) = firstPalEntry;
+ _GP(myFadeEndIndex) = lastPalEntry;
+ _GP(myFadeEndTime) = _GP(myFadeStartTime) + numTicks;
+ _GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
+ _GP(myFadeStartPercentFrac) = _GP(myFadeCurrPercentFrac);
+ _GP(myFadePercentFrac) = DivSF16(targetPercent << 16, 0x640000);
+
+ // Disable_end_user_hot_keys();
+ _G(pal_fade_in_progress) = true;
+}
+
+static void pal_fade_update(RGB8 *origPalette) {
+ int32 i, currTime;
+ frac16 tempFrac, tempFrac2;
+
+ currTime = timer_read_60();
+
+ if (currTime >= _GP(myFadeEndDelayTime)) { // If the delay has expired, fade more
+ if (currTime >= _GP(myFadeEndTime)) {
+ tempFrac2 = _GP(myFadePercentFrac);
+ _GP(myFadeStartPercentFrac) = _GP(myFadePercentFrac);
+ _GP(myFadeFinished) = true;
+ } else if (currTime <= _GP(myFadeStartTime)) return;
+ else {
+ tempFrac = DivSF16((currTime - _GP(myFadeStartTime)) << 16, (_GP(myFadeEndTime) - _GP(myFadeStartTime)) << 16);
+ tempFrac2 = MulSF16(tempFrac, _GP(myFadePercentFrac) - _GP(myFadeStartPercentFrac)) + _GP(myFadeStartPercentFrac);
+ }
+
+ _GP(myFadeCurrPercentFrac) = tempFrac2;
+
+ for (i = _GP(myFadeStartIndex); i <= _GP(myFadeEndIndex); i++) {
+ _GP(myFXPalette)[i].r = (Byte)(MulSF16(origPalette[i].r << 16, tempFrac2) >> 16);
+ _GP(myFXPalette)[i].g = (Byte)(MulSF16(origPalette[i].g << 16, tempFrac2) >> 16);
+ _GP(myFXPalette)[i].b = (Byte)(MulSF16(origPalette[i].b << 16, tempFrac2) >> 16);
+ }
+
+ // Recalculate the end delay time again
+ _GP(myFadeEndDelayTime) = currTime + _GP(myFadeDelayTicks); // Recalculate the end delay time again
+
+ // Must reresh the DAC
+ _GP(myFadeDACrefresh) = true;
+ }
+}
+
+void clear_DAC() {
+ RGB8 color;
+
+ color.r = color.b = color.g = 0;
+ for (int i = 0; i < 256; i++)
+ gr_pal_set_entry(i, &color);
+}
+
+void pal_fade_set_start(RGB8 *origPalette, int32 percent) {
+ pal_fade_init(origPalette, _G(kernel).first_fade, 255, percent, 0, (uint)-1);
+ pal_fade_update(origPalette);
+ pal_fx_update();
+}
+
+static void pal_cycle_callback(frac16 myMessage) {
+ kernel_trigger_dispatch((uint32)myMessage);
+}
+
+void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry,
+ int32 delayTicks, int32 totalTicks, uint32 triggerNum) {
+ if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry)) {
+ // This should generate an error
+ return;
+ }
+ if (delayTicks <= 0) {
+ // This should generate an error (Nick debug plarg MattP)
+ return;
+ }
+
+ _GP(myCycleReq) = true;
+ _GP(myCycleFinished) = false;
+ _GP(myCycleDelayTicks) = delayTicks;
+ _GP(myCycleStartTime) = timer_read_60();
+ _GP(myCycleEndDelayTime) = timer_read_60();
+ _GP(myCycleStartIndex) = firstPalEntry;
+ _GP(myCycleEndIndex) = lastPalEntry;
+ _GP(myCycleTrigger) = kernel_trigger_create(triggerNum); // Returned when _GP(myCycleEndTime) is reached
+
+ if (totalTicks > 0) { // If totalTicks > 0, calculate end time
+ _GP(myCycleEndTime) = _GP(myCycleStartTime) + totalTicks;
+ _GP(myCycleNeverStopCycling) = false;
+
+ } else if (totalTicks < 0) { // If totalTicks < 0, never stop the cycling
+ _GP(myCycleNeverStopCycling) = true;
+
+ } else { // If totalTicks is 0, stop cycling now
+ _GP(myCycleReq) = false;
+ _GP(myCycleFinished) = true;
+ }
+}
+
+bool pal_cycle_active() {
+ return _GP(myCycleReq);
+}
+
+void pal_cycle_stop() {
+ _GP(myCycleReq) = false;
+}
+
+void pal_cycle_resume() {
+ _GP(myCycleReq) = true;
+}
+
+static void pal_cycle_update() {
+ int32 i, currTime;
+ RGB8 firstColour;
+
+ currTime = timer_read_60(); // Get current time
+
+ if (_GP(myCycleNeverStopCycling) == false) { // If there is an end time to get to...
+
+ if (currTime >= _GP(myCycleEndTime)) { // See if we have reached it
+ _GP(myCycleFinished) = true; // Mark cycling as finished
+ return; // Return
+ }
+ } else {
+ // See if we should colour cycle right now
+ if (currTime >= _GP(myCycleEndDelayTime)) { // If the delay has expired, colour cycle
+ // Cycle the master palette
+ firstColour.r = _G(master_palette)[_GP(myCycleStartIndex)].r; // Remember first colour
+ firstColour.g = _G(master_palette)[_GP(myCycleStartIndex)].g;
+ firstColour.b = _G(master_palette)[_GP(myCycleStartIndex)].b;
+ for (i = _GP(myCycleStartIndex); i < _GP(myCycleEndIndex); ++i) { // Shift colours down one in palette
+ _G(master_palette)[i].r = _G(master_palette)[i + 1].r;
+ _G(master_palette)[i].g = _G(master_palette)[i + 1].g;
+ _G(master_palette)[i].b = _G(master_palette)[i + 1].b;
+ }
+ _G(master_palette)[_GP(myCycleEndIndex)].r = firstColour.r; // Set last colour to the first colour
+ _G(master_palette)[_GP(myCycleEndIndex)].g = firstColour.g;
+ _G(master_palette)[_GP(myCycleEndIndex)].b = firstColour.b;
+
+ // Then cycle the FX palette
+ firstColour.r = _GP(myFXPalette)[_GP(myCycleStartIndex)].r; // Remember first colour
+ firstColour.g = _GP(myFXPalette)[_GP(myCycleStartIndex)].g;
+ firstColour.b = _GP(myFXPalette)[_GP(myCycleStartIndex)].b;
+ for (i = _GP(myCycleStartIndex); i < _GP(myCycleEndIndex); ++i) { // Shift colours down one in palette
+ _GP(myFXPalette)[i].r = _GP(myFXPalette)[i + 1].r;
+ _GP(myFXPalette)[i].g = _GP(myFXPalette)[i + 1].g;
+ _GP(myFXPalette)[i].b = _GP(myFXPalette)[i + 1].b;
+ }
+ _GP(myFXPalette)[_GP(myCycleEndIndex)].r = firstColour.r; // Set last colour to the first colour
+ _GP(myFXPalette)[_GP(myCycleEndIndex)].g = firstColour.g;
+ _GP(myFXPalette)[_GP(myCycleEndIndex)].b = firstColour.b;
+
+
+ // Recalculate the end delay time again
+ _GP(myCycleEndDelayTime) = currTime + _GP(myCycleDelayTicks); // Recalculate the end delay time again
+
+ // must reresh the DAC
+ _GP(myCycleDACrefresh) = true;
+ }
+ }
+}
+
+// pal_fx_update() is called each game loop
+//
+void pal_fx_update() {
+ int32 startA = 0, endA = 0, startB = 0, endB = 0, startDAC = 0, endDAC = 0;
+
+ if (!_GP(myCycleReq) && !_GP(myFadeReq))
+ // Crap out quickly if no effects required
+ return;
+
+ // Perform any effect required and track index ranges
+ if (_GP(myCycleReq)) {
+ pal_cycle_update(); // Do the cycling (cycles master_palette and _GP(myFXPalette))
+ if (_GP(myCycleDACrefresh)) { // If it needs the DAC to be refreshed,
+ startA = _GP(myCycleStartIndex); // remember the range
+ endA = _GP(myCycleEndIndex);
+ _GP(myCycleDACrefresh) = false;
+ }
+ }
+
+ if (_GP(myFadeReq)) {
+ pal_fade_update(&_G(master_palette)[0]); // Do the fading (sets myFXPalette to faded master_palette)
+ if (_GP(myFadeDACrefresh)) { // If it needs the DAC to be refreshed,
+ startB = _GP(myFadeStartIndex); // remember the range
+ endB = _GP(myFadeEndIndex);
+ _GP(myFadeDACrefresh) = false;
+ }
+ }
+
+ // Check ranges to perform minimum calls of gr_pal_set_range() (to minimize snow on monitor due to OUT instructions)
+ if (endA < startB || endB < startA) { // if A and B ranges don't overlap
+
+ if (!(startA == 0 && endA == 0)) // if this is not the degenerate case (just the transparent color)
+ gr_pal_set_range(&_GP(myFXPalette)[0], startA, endA - startA + 1); // set A range of the DAC
+
+ if (!(startB == 0 && endB == 0)) // if this is not the degenerate case (just the transparent color)
+ gr_pal_set_range(&_GP(myFXPalette)[0], startB, endB - startB + 1); // set B range of the DAC
+
+ } else {
+ // They overlap, so find the extent of the overlap
+ (startA < startB) ? (startDAC = startA) : (startDAC = startB); // which start is less
+ (endA > endB) ? (endDAC = endA) : (endDAC = endB); // which end is more
+
+ if (!(startDAC == 0 && endDAC == 0)) // if this is not the degenerate case (just the transparent color)
+ gr_pal_set_range(&_GP(myFXPalette)[0], startDAC, endDAC - startDAC + 1); // set the whole range of the DAC
+ }
+
+ // Turn off flags and call callbacks if effects are finished
+ if (_GP(myFadeReq) && _GP(myFadeFinished)) {
+ _GP(myFadeReq) = false;
+ pal_fade_callback(_GP(myFadeTrigger));
+ }
+
+ if (_GP(myCycleReq) && _GP(myCycleFinished)) {
+ _GP(myCycleReq) = false;
+ pal_cycle_callback(_GP(myCycleTrigger));
+ }
+}
+
+//==========================================================================================
+//
+// DAC_tint_effect() is used to effect the screen colours (not the master palette) temporarily
+// until something else updates the DAC e.g. refresh_DAC()
+//
+
+void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent) {
+ int32 i;
+ int32 r, g, b, dr, dg, db;
+ RGB8 color, targetColor;
+ int32 percent_r, percent_g, percent_b;
+
+ if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry)) {
+ // this should generate an error (Nick debug plarg MattP)
+ term_message("*** palette index error");
+ return;
+ }
+
+ term_message("Colour tint DAC to: %d %d %d, %d percent, range (%d - %d)",
+ tintColor->r, tintColor->g, tintColor->b, percent, firstPalEntry, lastPalEntry); // debug
+ percent = DivSF16(percent << 16, 100 << 16); // convert percent to frac16 format
+
+ targetColor.r = tintColor->r;
+ targetColor.g = tintColor->g;
+ targetColor.b = tintColor->b;
+
+ term_message("Doing palette.....");
+
+ if (!transparent) {
+ for (i = firstPalEntry; i <= lastPalEntry; ++i) {
+
+ // calculate deltas for RGB's and put them in frac16 format
+ dr = (targetColor.r - _G(master_palette)[i].r) << 16;
+ dg = (targetColor.g - _G(master_palette)[i].g) << 16;
+ db = (targetColor.b - _G(master_palette)[i].b) << 16;
+
+ // new = orig + (delta * percent)
+ r = _G(master_palette)[i].r + (MulSF16(percent, dr) >> 16);
+ g = _G(master_palette)[i].g + (MulSF16(percent, dg) >> 16);
+ b = _G(master_palette)[i].b + (MulSF16(percent, db) >> 16);
+
+ // check for under/overflow
+ if (r > 255) r = 255; if (r < 0) r = 0;
+ if (g > 255) g = 255; if (g < 0) g = 0;
+ if (b > 255) b = 255; if (b < 0) b = 0;
+
+ color.r = (byte)r;
+ color.g = (byte)g;
+ color.b = (byte)b;
+
+ gr_pal_set_entry(i, &color); // set the new colour to the DAC
+ }
+
+ } else {
+
+ // This is for filtering colors. For example, a completely red filter
+ // (255, 0, 0) will block out the blue and green parts of the palette.
+ // 50% of the same filter will block out only 50% of the blue and
+ // green, but leaving all of the rest blue.
+ for (i = firstPalEntry; i <= lastPalEntry; ++i) {
+
+ // Converting rgb to a frac16 ( << 16) dividing by 256 ( >> 8)
+ // (the range of the palette values)
+ percent_r = (targetColor.r) << 8;
+ percent_g = (targetColor.g) << 8;
+ percent_b = (targetColor.b) << 8;
+
+ // This is the difference between the color and the full effect
+ // of the filter at 100%, as a frac16.
+ dr = (_G(master_palette)[i].r << 16) - (MulSF16(percent_r, _G(master_palette)[i].r << 16));
+ dg = (_G(master_palette)[i].g << 16) - (MulSF16(percent_g, _G(master_palette)[i].g << 16));
+ db = (_G(master_palette)[i].b << 16) - (MulSF16(percent_b, _G(master_palette)[i].b << 16));
+
+ // Scaling the effect to the right percentage. This is a frac16.
+ dr = MulSF16(dr, percent);
+ dg = MulSF16(dg, percent);
+ db = MulSF16(db, percent);
+
+ // Subtract the result to palette.
+ r = (_G(master_palette)[i].r - (dr >> 16));
+ g = (_G(master_palette)[i].g - (dg >> 16));
+ b = (_G(master_palette)[i].b - (db >> 16));
+
+ // check for under/overflow
+ if (r > 255) r = 255; if (r < 0) r = 0;
+ if (g > 255) g = 255; if (g < 0) g = 0;
+ if (b > 255) b = 255; if (b < 0) b = 0;
+
+ color.r = (byte)r;
+ color.g = (byte)g;
+ color.b = (byte)b;
+
+ gr_pal_set_entry(i, &color); // Set new colors to DAC.
+ }
+ }
+
+}
+
+void DAC_restore() {
+ term_message("DAC restored");//debug
+ gr_pal_set_range(&_G(master_palette)[0], 0, 256);
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index f277520ce2d..d87efc36086 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -23,9 +23,85 @@
#define M4_GRAPHICS_KRN_PAL_H
#include "m4/m4_types.h"
+#include "m4/adv_r/adv_hotspot.h"
+#include "m4/wscript/ws_machine.h"
namespace M4 {
+#define TO_GREY (int32)0
+#define TO_COLOR (int32)1
+#define TO_BLACK (int32)2
+
+struct KernelPal_Globals {
+ RGB8 _myFXPalette[256];
+
+ bool _myCycleReq = false;
+ bool _myCycleFinished = true;
+ bool _myCycleDACrefresh = false;
+ int32 _myCycleDelayTicks = 6; // 10 times a second
+ int32 _myCycleStartTime = 0;
+ int32 _myCycleEndTime = 0;
+ int32 _myCycleEndDelayTime = 0;
+ int32 _myCycleStartIndex;
+ int32 _myCycleEndIndex;
+ uint32 _myCycleTrigger = 0;
+ int32 _myCycleNeverStopCycling = false;
+
+ bool _myFadeReq = false;
+ bool _myFadeFinished = true;
+ bool _myFadeDACrefresh = false;
+ int32 _myFadeDelayTicks = 3; // 20 times a second
+ int32 _myFadeStartTime = 0;
+ int32 _myFadeEndTime = 0;
+ int32 _myFadeEndDelayTime = 0;
+ int32 _myFadeStartIndex = 0;
+ int32 _myFadeEndIndex = 0;
+ uint32 _myFadeTrigger = 0;
+ frac16 _myFadeStartPercentFrac = 0x10000;
+ frac16 _myFadeCurrPercentFrac = 0x10000;
+ frac16 _myFadePercentFrac = 0;
+
+ HotSpotRec *_exam_saved_hotspots = nullptr;
+
+ RGB8 *_fadeToMe = nullptr;
+ RGB8 *_trick = nullptr;
+ RGB8 *_picPal = nullptr;
+ int32 _seriesHash = 0;
+ machine *_seriesAnim8 = nullptr;
+ uint8 _translation[32]; // Only 32 greys in ramp
+
+ int32 _colorAreaX1 = -1;
+ int32 _colorAreaY1 = -1;
+ int32 _colorAreaX2 = -1;
+ int32 _colorAreaY2 = -1;
+
+ int32 _greyAreaX1 = -1;
+ int32 _greyAreaY1 = -1;
+ int32 _greyAreaX2 = -1;
+ int32 _greyAreaY2 = -1;
+
+ bool _greyVideoMode = false;
+};
+
+extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
+extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, uint32 triggerNum);
+
+extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, uint32 triggerNum);
+extern bool pal_cycle_active(); // Returns true if color cycling is on
+extern void pal_cycle_stop(); // Stops color cycling
+extern void pal_cycle_resume(); // Starts color cycling
+extern void pal_fx_update(); // Handles fading and cycling MattP
+
+extern void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
+ int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger);
+extern void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay);
+
+extern void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2);
+extern void krn_SetGreyVideoMode(int32 grey_x1, int32 grey_y1, int32 grey_x2, int32 grey_y2, int32 color_x1, int32 color_y1, int32 color_x2, int32 color_y2);
+extern void krn_UnsetGreyVideoMode(void);
+extern bool krn_GetGreyMode(void);
+extern void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scrnY,
+ int32 greyX1, int32 greyY1, int32 greyX2, int32 greyY2);
extern void krn_ChangeBufferLuminance(Buffer *target, int32 percent);
} // namespace M4
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
new file mode 100644
index 00000000000..6c83d83eff3
--- /dev/null
+++ b/engines/m4/graphics/rend.cpp
@@ -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/>.
+ *
+ */
+
+#include "common/textconsole.h"
+#include "m4/graphics/rend.h"
+
+namespace M4 {
+
+void GetUpdateRectangle(int32 x, int32 y, int32 hot_x, int32 hot_y, int32 scale_x, int32 scale_y, int32 Width, int32 Height, M4Rect *UpdateRect) {
+ error("TODO: GetUpdateRectangle");
+}
+
+void render_sprite_to_8BBM(RendGrBuff *Destination, DrawRequestX *dr, RendCell *Frame, M4Rect *ClipRectangle, M4Rect *UpdateRect) {
+ error("TODO: render_sprite_to_8BBM");
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/rend.h b/engines/m4/graphics/rend.h
new file mode 100644
index 00000000000..e0815d8e82d
--- /dev/null
+++ b/engines/m4/graphics/rend.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_REND_H
+#define M4_GRAPHICS_REND_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui.h"
+
+namespace M4 {
+
+struct RGBcolor {
+ uint8 b, g, r;
+};
+
+struct RendGrBuff {
+ uint32 Width;
+ uint32 Height;
+ void *PixMap;
+};
+
+struct DrawRequestX {
+ int32 x; // X position relative to GrBuff(0, 0)
+ int32 y; // Y position relative to GrBuff(0, 0)
+ int32 scale_x; // X scale factor (can be negative for reverse draw)
+ int32 scale_y; // Y scale factor (can't be negative)
+ uint8 *depth_map; // Depth code array for destination (doesn't care if srcDepth is 0)
+ RGBcolor *Pal; // Palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding)
+ uint8 *ICT; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding)
+ uint8 depth; // Depth code for source (0 if no depth processing)
+};
+
+struct RendCell {
+ uint32 Pack;
+ uint32 Stream;
+ long hot_x;
+ long hot_y;
+ uint32 Width;
+ uint32 Height;
+ uint32 Comp;
+ uint32 Reserved[8];
+ uint8 *data;
+};
+
+extern void GetUpdateRectangle(int32 x, int32 y, int32 hot_x, int32 hot_y, int32 scale_x, int32 scale_y, int32 Width, int32 Height, M4Rect *UpdateRect);
+extern void render_sprite_to_8BBM(RendGrBuff *Destination, DrawRequestX *dr, RendCell *Frame, M4Rect *ClipRectangle, M4Rect *UpdateRect);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/gui/gui.h b/engines/m4/gui/gui.h
index 3bf4dea8fc1..b30b5c30e1e 100644
--- a/engines/m4/gui/gui.h
+++ b/engines/m4/gui/gui.h
@@ -29,8 +29,8 @@
namespace M4 {
struct M4sprite {
- struct M4sprite *next;
- struct M4sprite *prev;
+ M4sprite *next;
+ M4sprite *prev;
int32 x;
int32 y;
int32 w;
@@ -39,7 +39,7 @@ struct M4sprite {
int32 yOffset;
uint8 encoding;
uint8 *data;
- Handle sourceHandle;
+ MemHandle sourceHandle;
int32 sourceOffset;
};
@@ -60,7 +60,7 @@ struct RectList {
};
struct matte {
- struct matte *nextMatte;
+ matte *nextMatte;
void *myScreen;
int32 x1;
int32 y1;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index d108c7da2b6..e1ee094163b 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -26,6 +26,8 @@
namespace M4 {
+#define MAX_STRING_SIZE 144
+#define MAX_STRING_LEN 144
#define MAX_FILENAME_SIZE 144
#define MIN_VIDEO_X 0
#define MIN_VIDEO_Y 0
diff --git a/engines/m4/mem/reloc.cpp b/engines/m4/mem/reloc.cpp
index 75d0adcfce0..05ade98b876 100644
--- a/engines/m4/mem/reloc.cpp
+++ b/engines/m4/mem/reloc.cpp
@@ -51,4 +51,8 @@ void DisposeHandle(MemHandle handle) {
free(handle);
}
+uint32 MaxMem(Size *growBytes) {
+ return 7999999;
+}
+
} // namespace M4
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
index ce2dea6a7ce..e957a50d19b 100644
--- a/engines/m4/mem/reloc.h
+++ b/engines/m4/mem/reloc.h
@@ -28,6 +28,7 @@
namespace M4 {
typedef void **MemHandle;
+typedef int32 Size;
inline void HLock(Handle h) {}
inline void HUnLock(Handle h) {}
@@ -42,6 +43,7 @@ extern MemHandle MakeNewHandle(size_t size, const Common::String &);
extern bool mem_ReallocateHandle(MemHandle h, size_t size, const Common::String &name);
extern MemHandle NewHandle(size_t size, const Common::String &);
extern void DisposeHandle(MemHandle handle);
+extern uint32 MaxMem(Size *growBytes);
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 1459cba097d..0381e7e300f 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -29,6 +29,7 @@ MODULE_OBJS = \
core/param.o \
core/rooms.o \
core/term.o \
+ dbg/dbg_wscript.o \
events/mickey.o \
events/mouse_handler.o \
fileio/extensions.o \
@@ -45,6 +46,7 @@ MODULE_OBJS = \
graphics/gr_series.o \
graphics/graphics.o \
graphics/krn_pal.o \
+ graphics/rend.o \
gui/gui_buffer.o \
gui/gui_dialog.o \
gui/gui_item.o \
@@ -69,6 +71,7 @@ MODULE_OBJS = \
wscript/ws_machine.o \
wscript/ws_timer.o \
wscript/wscript.o \
+ wscript/wst_regs.o \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 5612baf203e..fc48ec70dc2 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -52,5 +52,36 @@ void Digi::unload(const Common::String &name) {
warning("TODO: Digi::unload");
}
+void Digi::task() {
+ warning("TODO: Digi::task");
+}
+
+int32 Digi::play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+ error("TODO: Digi::play");
+ return 0;
+}
+
+int32 Digi::play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+ error("TODO: Digi::play_loop");
+ return 0;
+}
+
+void Digi::read_another_chunk() {
+ warning("TODO: Digi::read_another_chunk");
+}
+
} // namespace Sound
+
+int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+ return _G(digi).play(name, channel, vol, trigger, room_num);
+}
+
+int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+ return _G(digi).play_loop(name, channel, vol, trigger, room_num);
+}
+
+void digi_read_another_chunk() {
+ return _G(digi).read_another_chunk();
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 89b51d50cbc..93f297bee35 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -40,9 +40,27 @@ private:
public:
void preload_sounds(const char **names);
void unload_sounds();
+ void task();
+
+ // digi_play and digi_play_loop play a particular sound file in a given channel,
+ // at a particular volume. The room_num parameter tells us what directory the sound
+ // is stored in (all sounds are AIFFs). Trigger is an integer that is fed into
+ // kernel_dispatch_trigger when the sound has finished playing
+ // If the sound has been preloaded it will be played from memory, otherwise it will
+ // be streamed from disk
+
+ int32 play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+ int32 play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+
+ void read_another_chunk();
};
} // namespace Sound
+
+extern int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+extern int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+extern void digi_read_another_chunk();
+
} // namespace M4
#endif
diff --git a/engines/m4/platform/sound/midi.cpp b/engines/m4/platform/sound/midi.cpp
index 5d4bede4e8e..79833e18f54 100644
--- a/engines/m4/platform/sound/midi.cpp
+++ b/engines/m4/platform/sound/midi.cpp
@@ -25,5 +25,18 @@
namespace M4 {
namespace Sound {
+void Midi::task() {
+ warning("TODO: Midi::task");
+}
+
+void Midi::loop() {
+ warning("TODO: Midi::loop");
+}
+
} // namespace Sound
+
+void midi_loop() {
+ _G(midi).loop();
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/midi.h b/engines/m4/platform/sound/midi.h
index 2d092041895..b14e1e53992 100644
--- a/engines/m4/platform/sound/midi.h
+++ b/engines/m4/platform/sound/midi.h
@@ -30,9 +30,14 @@ namespace Sound {
class Midi {
public:
+ void task();
+ void loop();
};
} // namespace Sound
+
+extern void midi_loop();
+
} // namespace M4
#endif
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index aaf0896d508..70a215047a0 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -24,6 +24,7 @@
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_been.h"
#include "m4/core/errors.h"
+#include "m4/dbg/debug.h"
#include "m4/graphics/gr_pal.h"
#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_dialog.h"
@@ -47,6 +48,7 @@ Vars::~Vars() {
game_systems_shutdown();
sysfile_shutdown();
+ f_stream_Shutdown();
player_been_shutdown();
gui_system_shutdown();
gui_buffer_system_shutdown();
@@ -54,6 +56,7 @@ Vars::~Vars() {
mem_stash_shutdown();
param_shutdown();
woodscript_shutdown();
+ dbg_ws_shutdown();
g_vars = nullptr;
}
@@ -80,6 +83,14 @@ bool Vars::init() {
if (!LoadWSAssets("stream script", &_master_palette[0]))
error_show(FL, 'FNF!', "stream script");
+ grab_fonts();
+ gr_font_set(_font_inter);
+
+ if (_cheat_keys_enabled) {
+ if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals))
+ error(FL, 'DWIF');
+ }
+
main_cold_data_init();
create_mouse_watch_dialog();
global_menu_system_init();
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 3cfb8a15e31..1019934148f 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -42,6 +42,7 @@
#include "m4/fileio/sys_file.h"
#include "m4/graphics/gr_color.h"
#include "m4/graphics/gr_font.h"
+#include "m4/graphics/krn_pal.h"
#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
@@ -61,7 +62,7 @@ class Vars;
extern Vars *g_vars;
-class Vars : public Mouse_Globals, public WS_Globals, public Timer_Globals {
+class Vars : public Mouse_Globals, public Timer_Globals {
private:
void game_systems_initialize(byte flags);
void game_systems_shutdown();
@@ -101,9 +102,11 @@ public:
Dialog_Globals _dialog;
Item_Globals _items;
Converstation_Globals _conversations;
+ WS_Globals _ws;
Triggers _triggers;
Sound::Digi _digi;
Sound::Midi _midi;
+ KernelPal_Globals _krnPal;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
@@ -173,6 +176,7 @@ public:
#define _GV() (*g_vars->getGlobals())
#define _GI() (*g_vars->getInterface())
#define _GW() (*g_vars->getWalker())
+#define _GWS(X) _G(ws)._##X
} // namespace M4
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 6587fd00642..8e9a731b98a 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -21,75 +21,1575 @@
#include "m4/wscript/ws_cruncher.h"
#include "m4/wscript/ws_hal.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/dbg/debug.h"
#include "m4/mem/mem.h"
#include "m4/vars.h"
namespace M4 {
-#define VERIFY_INTIALIZED(s) if (!_G(cruncherInitialized)) error_show(FL, 'WSCI', "%s failed.", s);
+#define VERIFY_INTIALIZED(s) if (!_GWS(cruncherInitialized)) error_show(FL, 'WSCI', "%s failed.", s);
static int32 dataFormats[] = { 0, 5, 8, 12, 16 };
+static const frac16 sinCosTable[320] = {
+ (frac16)0, (frac16)1608, (frac16)3215, (frac16)4821,
+ (frac16)6423, (frac16)8022, (frac16)9616, (frac16)11204,
+ (frac16)12785, (frac16)14359, (frac16)15923, (frac16)17479,
+ (frac16)19024, (frac16)20557, (frac16)22078, (frac16)23586,
+ (frac16)25079, (frac16)26557, (frac16)28020, (frac16)29465,
+ (frac16)30893, (frac16)32302, (frac16)33692, (frac16)35061,
+ (frac16)36409, (frac16)37736, (frac16)39039, (frac16)40319,
+ (frac16)41575, (frac16)42806, (frac16)44011, (frac16)45189,
+ (frac16)46340, (frac16)47464, (frac16)48558, (frac16)49624,
+ (frac16)50660, (frac16)51665, (frac16)52639, (frac16)53581,
+ (frac16)54491, (frac16)55368, (frac16)56212, (frac16)57022,
+ (frac16)57797, (frac16)58538, (frac16)59243, (frac16)59913,
+ (frac16)60547, (frac16)61144, (frac16)61705, (frac16)62228,
+ (frac16)62714, (frac16)63162, (frac16)63571, (frac16)63943,
+ (frac16)64276, (frac16)64571, (frac16)64826, (frac16)65043,
+ (frac16)65220, (frac16)65358, (frac16)65457, (frac16)65516,
+ (frac16)65536, (frac16)65516, (frac16)65457, (frac16)65358,
+ (frac16)65220, (frac16)65043, (frac16)64826, (frac16)64571,
+ (frac16)64276, (frac16)63943, (frac16)63571, (frac16)63162,
+ (frac16)62714, (frac16)62228, (frac16)61705, (frac16)61144,
+ (frac16)60547, (frac16)59913, (frac16)59243, (frac16)58538,
+ (frac16)57797, (frac16)57022, (frac16)56212, (frac16)55368,
+ (frac16)54491, (frac16)53581, (frac16)52639, (frac16)51665,
+ (frac16)50660, (frac16)49624, (frac16)48558, (frac16)47464,
+ (frac16)46340, (frac16)45189, (frac16)44011, (frac16)42806,
+ (frac16)41575, (frac16)40319, (frac16)39039, (frac16)37736,
+ (frac16)36409, (frac16)35061, (frac16)33692, (frac16)32302,
+ (frac16)30893, (frac16)29465, (frac16)28020, (frac16)26557,
+ (frac16)25079, (frac16)23586, (frac16)22078, (frac16)20557,
+ (frac16)19024, (frac16)17479, (frac16)15923, (frac16)14359,
+ (frac16)12785, (frac16)11204, (frac16)9616, (frac16)8022,
+ (frac16)6423, (frac16)4821, (frac16)3215, (frac16)1608,
+ (frac16)0, (frac16)-1608, (frac16)-3215, (frac16)-4821,
+ (frac16)-6423, (frac16)-8022, (frac16)-9616, (frac16)-11204,
+ (frac16)-12785, (frac16)-14359, (frac16)-15923, (frac16)-17479,
+ (frac16)-19024, (frac16)-20557, (frac16)-22078, (frac16)-23586,
+ (frac16)-25079, (frac16)-26557, (frac16)-28020, (frac16)-29465,
+ (frac16)-30893, (frac16)-32302, (frac16)-33692, (frac16)-35061,
+ (frac16)-36409, (frac16)-37736, (frac16)-39039, (frac16)-40319,
+ (frac16)-41575, (frac16)-42806, (frac16)-44011, (frac16)-45189,
+ (frac16)-46340, (frac16)-47464, (frac16)-48558, (frac16)-49624,
+ (frac16)-50660, (frac16)-51665, (frac16)-52639, (frac16)-53581,
+ (frac16)-54491, (frac16)-55368, (frac16)-56212, (frac16)-57022,
+ (frac16)-57797, (frac16)-58538, (frac16)-59243, (frac16)-59913,
+ (frac16)-60547, (frac16)-61144, (frac16)-61705, (frac16)-62228,
+ (frac16)-62714, (frac16)-63162, (frac16)-63571, (frac16)-63943,
+ (frac16)-64276, (frac16)-64571, (frac16)-64826, (frac16)-65043,
+ (frac16)-65220, (frac16)-65358, (frac16)-65457, (frac16)-65516,
+ (frac16)-65536, (frac16)-65516, (frac16)-65457, (frac16)-65358,
+ (frac16)-65220, (frac16)-65043, (frac16)-64826, (frac16)-64571,
+ (frac16)-64276, (frac16)-63943, (frac16)-63571, (frac16)-63162,
+ (frac16)-62714, (frac16)-62228, (frac16)-61705, (frac16)-61144,
+ (frac16)-60547, (frac16)-59913, (frac16)-59243, (frac16)-58538,
+ (frac16)-57797, (frac16)-57022, (frac16)-56212, (frac16)-55368,
+ (frac16)-54491, (frac16)-53581, (frac16)-52639, (frac16)-51665,
+ (frac16)-50660, (frac16)-49624, (frac16)-48558, (frac16)-47464,
+ (frac16)-46340, (frac16)-45189, (frac16)-44011, (frac16)-42806,
+ (frac16)-41575, (frac16)-40319, (frac16)-39039, (frac16)-37736,
+ (frac16)-36409, (frac16)-35061, (frac16)-33692, (frac16)-32302,
+ (frac16)-30893, (frac16)-29465, (frac16)-28020, (frac16)-26557,
+ (frac16)-25079, (frac16)-23586, (frac16)-22078, (frac16)-20557,
+ (frac16)-19024, (frac16)-17479, (frac16)-15923, (frac16)-14359,
+ (frac16)-12785, (frac16)-11204, (frac16)-9616, (frac16)-8022,
+ (frac16)-6423, (frac16)-4821, (frac16)-3215, (frac16)-1608,
+ (frac16)0, (frac16)1608, (frac16)3215, (frac16)4821,
+ (frac16)6423, (frac16)8022, (frac16)9616, (frac16)11204,
+ (frac16)12785, (frac16)14359, (frac16)15923, (frac16)17479,
+ (frac16)19024, (frac16)20557, (frac16)22078, (frac16)23586,
+ (frac16)25079, (frac16)26557, (frac16)28020, (frac16)29465,
+ (frac16)30893, (frac16)32302, (frac16)33692, (frac16)35061,
+ (frac16)36409, (frac16)37736, (frac16)39039, (frac16)40319,
+ (frac16)41575, (frac16)42806, (frac16)44011, (frac16)45189,
+ (frac16)46340, (frac16)47464, (frac16)48558, (frac16)49624,
+ (frac16)50660, (frac16)51665, (frac16)52639, (frac16)53581,
+ (frac16)54491, (frac16)55368, (frac16)56212, (frac16)57022,
+ (frac16)57797, (frac16)58538, (frac16)59243, (frac16)59913,
+ (frac16)60547, (frac16)61144, (frac16)61705, (frac16)62228,
+ (frac16)62714, (frac16)63162, (frac16)63571, (frac16)63943,
+ (frac16)64276, (frac16)64571, (frac16)64826, (frac16)65043,
+ (frac16)65220, (frac16)65358, (frac16)65457, (frac16)65516
+};
+
+static const frac16 *sinTable = &(sinCosTable[0]);
+static const frac16 *cosTable = &(sinCosTable[64]);
+
int32 *ws_GetDataFormats() {
return &dataFormats[0];
}
bool ws_InitCruncher(void) {
- // int32 i;
-
- //make sure the cruncher has not been initialized
- if (_G(cruncherInitialized))
+ // Make sure the cruncher has not been initialized
+ if (_GWS(cruncherInitialized))
error_show(FL, 'WSCR');
// Register the end of sequence struct with the stash manager
- mem_register_stash_type(&_G(memtypeEOS), sizeof(EOSreq), 32, "+EOS");
- if (_G(memtypeEOS) < 0)
+ mem_register_stash_type(&_GWS(memtypeEOS), sizeof(EOSreq), 32, "+EOS");
+ if (_GWS(memtypeEOS) < 0)
error_show(FL, 'WSCE');
- if ((_G(myCruncher) = (cruncher *)mem_alloc(sizeof(cruncher), "cruncher")) == NULL)
+ if ((_GWS(myCruncher) = (cruncher *)mem_alloc(sizeof(cruncher), "cruncher")) == nullptr)
error_show(FL, 'OOM!', "%ld bytes.", sizeof(cruncher));
- _G(myCruncher)->backLayerAnim8 = NULL;
- _G(myCruncher)->frontLayerAnim8 = NULL;
- _G(myCruncher)->firstAnim8ToCrunch = NULL;
- _G(myCruncher)->lastAnim8ToCrunch = NULL;
+ _GWS(myCruncher)->backLayerAnim8 = nullptr;
+ _GWS(myCruncher)->frontLayerAnim8 = nullptr;
+ _GWS(myCruncher)->firstAnim8ToCrunch = nullptr;
+ _GWS(myCruncher)->lastAnim8ToCrunch = nullptr;
// Set up stack
- _G(stackSize) = 2048;
- if ((_G(stackBase) = (uint32 *)mem_alloc(_G(stackSize), "crunchstack")) == NULL) {
- error_show(FL, 'OOM!', "%ld bytes.", _G(stackSize));
+ _GWS(stackSize) = 2048;
+ if ((_GWS(stackBase) = (uint32 *)mem_alloc(_GWS(stackSize), "crunchstack")) == nullptr) {
+ error_show(FL, 'OOM!', "%ld bytes.", _GWS(stackSize));
+ }
+ _GWS(stackTop) = _GWS(stackBase);
+ _GWS(stackLimit) = (uint32 *)((byte *)_GWS(stackBase) + (uint32)_GWS(stackSize));
+
+ _GWS(cruncherInitialized) = true;
+
+ return true;
+}
+
+Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash) {
+ Anim8 *myAnim8;
+ frac16 *myRegs;
+ int32 numLocalVars;
+ int32 i;
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_AddAnim8ToCruncher()");
+
+ // Allocate an anim8 structure
+ if ((myAnim8 = (Anim8 *)mem_alloc(sizeof(Anim8), "Anim8")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(Anim8));
+ return nullptr;
+ }
+
+ // Find the sequence
+ if ((myAnim8->sequHandle = ws_GetSEQU((uint32)sequHash, &numLocalVars, &myAnim8->pcOffset)) == nullptr) {
+ return nullptr;
+ }
+
+ // Allocate an array of registers
+ if ((myRegs = (frac16 *)mem_alloc(sizeof(frac16) * (IDX_COUNT + numLocalVars), "Anim8 regs")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(frac16) * (IDX_COUNT + numLocalVars));
+ return nullptr;
+ }
+
+ // Initialize the Anim8 structure
+ myAnim8->active = true;
+ myAnim8->sequHash = sequHash;
+ myAnim8->myMachine = m; // Pointer back to myMachine
+ myAnim8->eosReqOffset = -1;
+ myAnim8->myParent = m->parentAnim8; // The parent anim8
+ myAnim8->myCCB = nullptr;
+ myAnim8->dataHash = m->dataHash; // The array of data
+ myAnim8->dataHandle = m->dataHandle;
+ myAnim8->dataOffset = m->dataOffset;
+ myAnim8->startTime = 0;
+ myAnim8->switchTime = 0;
+ myAnim8->flags = 0;
+ myAnim8->numLocalVars = numLocalVars;
+ myAnim8->myRegs = myRegs;
+ myAnim8->returnStackIndex = 0;
+
+ // Link it into the execution list
+ myAnim8->next = nullptr;
+ myAnim8->prev = _GWS(myCruncher)->lastAnim8ToCrunch;
+ if (_GWS(myCruncher)->lastAnim8ToCrunch) {
+ _GWS(myCruncher)->lastAnim8ToCrunch->next = myAnim8;
+ } else {
+ _GWS(myCruncher)->firstAnim8ToCrunch = myAnim8;
+ }
+ _GWS(myCruncher)->lastAnim8ToCrunch = myAnim8;
+
+ // Now link it into the layering list
+ myAnim8->myLayer = 0;
+ myAnim8->infront = nullptr;
+ myAnim8->behind = _GWS(myCruncher)->frontLayerAnim8;
+ if (_GWS(myCruncher)->frontLayerAnim8) {
+ _GWS(myCruncher)->frontLayerAnim8->infront = myAnim8;
+ } else {
+ _GWS(myCruncher)->backLayerAnim8 = myAnim8;
+ }
+ _GWS(myCruncher)->frontLayerAnim8 = myAnim8;
+
+ // Now clear the registers, but set the scale = 100%
+ for (i = 0; i < IDX_COUNT + numLocalVars; i++) {
+ myAnim8->myRegs[i] = 0;
+ }
+ myAnim8->myRegs[IDX_S] = 0x10000;
+ myAnim8->myRegs[IDX_MACH_ID] = m->machID;
+
+ return myAnim8;
+}
+
+bool ws_ChangeAnim8Program(machine *m, int32 newSequHash) {
+ Anim8 *myAnim8;
+ int32 numLocalVars;
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_ChangeAnim8Program()");
+
+ // Parameter verification
+ if ((!m) || (!m->myAnim8)) {
+ error_show(FL, 'WSMI');
+ }
+
+ myAnim8 = m->myAnim8;
+
+ // Find the sequence
+ if ((myAnim8->sequHandle = ws_GetSEQU((uint32)newSequHash, &numLocalVars, &myAnim8->pcOffset)) == nullptr) {
+ return false;
+ }
+
+ // Now see if we've started a sequence requiring more vars than the prev
+ if (myAnim8->numLocalVars < numLocalVars) {
+ ws_LogErrorMsg(FL, "Can't launch a sequence with more local vars than the previous sequence.");
+ return false;
+ }
+
+ // Intialize the Anim8
+ myAnim8->switchTime = 0;
+ myAnim8->active = 1;
+ myAnim8->eosReqOffset = -1;
+ myAnim8->sequHash = newSequHash;
+ myAnim8->returnStackIndex = 0;
+
+ return true;
+}
+
+void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8) {
+ EOSreq *tempEOSreq, *prevEOSreq;
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_RemoveAnim8FromCruncher()");
+
+ if (!myAnim8)
+ error_show(FL, 'WSAI');
+
+ // In case we are crunching the current list of EOS requests, remove any for this machine
+ tempEOSreq = _GWS(EOSreqList);
+ prevEOSreq = nullptr;
+ while (tempEOSreq && (tempEOSreq->myAnim8 != myAnim8)) {
+ tempEOSreq = tempEOSreq->next;
+ }
+
+ if (tempEOSreq) {
+ if (tempEOSreq->next) {
+ tempEOSreq->next->prev = tempEOSreq->prev;
+ }
+ if (tempEOSreq->prev) {
+ tempEOSreq->prev->next = tempEOSreq->next;
+ } else {
+ _GWS(EOSreqList) = tempEOSreq->next;
+ }
+
+ mem_free_to_stash((void *)tempEOSreq, _GWS(memtypeEOS));
+ }
+
+ // Incase we are in the middle of crunching
+ if (myAnim8 == _GWS(crunchNext)) {
+ _GWS(crunchNext) = myAnim8->next;
+ }
+
+ // Remove myAnim8 from the crunch list
+ if (myAnim8->prev) {
+ myAnim8->prev->next = myAnim8->next;
+ } else {
+ _GWS(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
+ }
+
+ if (myAnim8->next) {
+ myAnim8->next->prev = myAnim8->prev;
+ } else {
+ _GWS(myCruncher)->lastAnim8ToCrunch = myAnim8->prev;
+ }
+
+ // Now remove it from the anim8 layer
+ if (myAnim8->infront) {
+ myAnim8->infront->behind = myAnim8->behind;
+ } else {
+ _GWS(myCruncher)->frontLayerAnim8 = myAnim8->behind;
+ }
+ if (myAnim8->behind) {
+ myAnim8->behind->infront = myAnim8->infront;
+ } else {
+ _GWS(myCruncher)->backLayerAnim8 = myAnim8->infront;
+ }
+
+ // Clean up and free the CCB for this anim8
+ if (myAnim8->myCCB) {
+ KillCCB(myAnim8->myCCB, true);
+ }
+
+ // Deallocate the register list
+ mem_free(myAnim8->myRegs);
+
+ // Finally, turf myAnim8
+ mem_free(myAnim8);
+}
+
+
+// This procedure flags the anim8 slot as inactive, but still owned by the machine
+bool ws_PauseAnim8(Anim8 *myAnim8) {
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_PauseAnim8()");
+
+ if (!myAnim8)
+ error_show(FL, 'WSAI');
+
+ myAnim8->active = false;
+ HideCCB(myAnim8->myCCB);
+ return true;
+}
+
+// This procedure reactivates the anim8 slot owned by the machine
+bool ws_ResumeAnim8(Anim8 *myAnim8) {
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_PauseAnim8()");
+
+ if (!myAnim8)
+ error_show(FL, 'WSAI');
+
+ myAnim8->active = true;
+ if (myAnim8->myCCB) {
+ ShowCCB(myAnim8->myCCB);
+ myAnim8->myCCB->flags |= CCB_SKIP;
+ }
+
+ return true;
+}
+
+static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **argPtr, frac16 *argValue) {
+ int32 myIndex;
+ Anim8 *parentAnim8;
+ frac16 *dataArray;
+
+ // If the format indicates the argument is a local source (parent, register, or data)
+ if (myFormat == FMT_LOCAL_SRC) {
+ if (!myAnim8) {
+ ws_LogErrorMsg(FL, "INTERNAL ERROR - ExtractArg() failed - An invalid Anim8* was passed.");
+ return false;
+ }
+
+ // Find out if the index has been previously stored in a special index register
+ if (myData & REG_SET_IDX_REG) {
+ myIndex = _GWS(indexReg);
+ } else {
+ // Else the index is part of the data segment for this arg
+ myIndex = myData & REG_SET_IDX;
+ }
+
+ // Find the right register set
+ switch (myData & LOCAL_FMT) {
+ case LOCAL_FMT_PARENT:
+ parentAnim8 = myAnim8->myParent;
+
+ // Range check to make sure we don't index off into hyperspace
+ if ((!parentAnim8) || (myIndex >= IDX_COUNT + parentAnim8->numLocalVars)) {
+ if (!parentAnim8) {
+ ws_LogErrorMsg(FL, "Trying to access a parent register - no parent exists");
+ } else {
+ ws_LogErrorMsg(FL, "Parent Reg Index out of range - max: %ld, requested %ld.",
+ IDX_COUNT + parentAnim8->numLocalVars, myIndex);
+ }
+ return false;
+ }
+ *argPtr = (frac16 *)((uint32)parentAnim8->myRegs + (myIndex << 2));
+ break;
+
+ case LOCAL_FMT_REG:
+ // Range check to make sure we don't index off into hyperspace
+ if ((myIndex >= IDX_COUNT + myAnim8->numLocalVars)) {
+ ws_LogErrorMsg(FL, "Register Index out of range - max: %ld, requested %ld.",
+ IDX_COUNT + myAnim8->numLocalVars, myIndex);
+ return false;
+ }
+ *argPtr = (frac16 *)((uint32)myAnim8->myRegs + (myIndex << 2));
+ break;
+
+ case LOCAL_FMT_DATA:
+ // Ensure we have a dataHandle
+ if ((!myAnim8->dataHandle) || (!*(myAnim8->dataHandle))) {
+ ws_LogErrorMsg(FL, "Trying to access a DATA field when no DATA has been set");
+ return false;
+ }
+
+ // Dereferrence the dataHandle, add the offset to find the array of data for this anim8
+ dataArray = (frac16 *)((int32) * (myAnim8->dataHandle) + myAnim8->dataOffset);
+
+ // Copy the data field into _GWS(dataArg1), and set _GWS(myArg1) to point to this location
+ *argValue = dataArray[myIndex];
+ *argPtr = argValue;
+ break;
+ }
+ } else if (myFormat == FMT_GLOBAL_SRC) {
+ // Else if the format indicates the argument is from the _GWS(ws_globals) register set
+ // Find out if the index has been previously stored in a special index register
+ if (myData & REG_SET_IDX_REG) {
+ myIndex = _GWS(indexReg);
+ } else {
+ // Else the index is part of the data segment for this arg
+ myIndex = myData & REG_SET_IDX;
+ }
+
+ // Finally, set _GWS(myArg1) to point to the location in the _GWS(ws_globals) array, whichever index
+ *argPtr = &(_GWS(ws_globals)[myIndex]);
+ } else {
+ // Else the argument is not a variable, but an actual value
+
+ // The top bit of the data segment is a negative flag, the format determines how far the other
+ // 15 bits of the data segment are shifted left, so the value requested is in frac16 format.
+ // The value is stored in a static frac16 (_GWS(dataArg1)), and...
+ if (myData & OP_DATA_SIGN) {
+ *argValue = -(myData & OP_DATA_VALUE) << (dataFormats[myFormat - 3]);
+ } else {
+ *argValue = (myData & OP_DATA_VALUE) << (dataFormats[myFormat - 3]);
+ }
+
+ //_GWS(myArg1) will point to this location
+ *argPtr = argValue;
+ }
+
+ return true;
+}
+
+// The instruction number is returned by this function, and the arguments are pointed to by these externable globals
+// Frac16 *_GWS(myArg1);
+// Frac16 *_GWS(myArg2);
+// Frac16 *_GWS(myArg3);
+//
+//
+
+int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8) {
+ int32 myInstruction, myFormat, myData; // myIndex;
+ uint32 *myPC, opCode, word2;
+
+ if (!PC) {
+ ws_LogErrorMsg(FL, "INTERNAL ERROR - ws_PreProcessPcode() failed - An invalid PC was passed.");
+ return -1;
+ }
+
+ myPC = *PC;
+
+ // Get the opCode
+ opCode = *myPC++;
+
+ // Get the instruction number
+ myInstruction = (opCode & OP_INSTR) >> 25;
+
+ // Get the format for the first arg
+ myFormat = (opCode & OP_FORMAT1) >> 22;
+
+ // Get the data for the first arg
+ myData = opCode & OP_LOW_DATA;
+
+ // Verify we have an argument
+ if (myFormat) {
+ if (!ExtractArg(myAnim8, myFormat, myData, &_GWS(myArg1), &_GWS(dataArg1))) {
+ return -1;
+ }
+ } else {
+ // Otherwise this argument is called with no args
+ _GWS(myArg1) = nullptr;
+ _GWS(myArg2) = nullptr;
+ _GWS(myArg3) = nullptr;
+ *PC = myPC;
+ return myInstruction;
+ }
+
+ // Check for arg2
+ myFormat = (opCode & OP_FORMAT2) >> 19;
+ if (myFormat) {
+ word2 = *myPC++;
+ myData = (word2 & OP_HIGH_DATA) >> 16;
+ if (!ExtractArg(myAnim8, myFormat, myData, &_GWS(myArg2), &_GWS(dataArg2))) {
+ return -1;
+ }
+ } else {
+ _GWS(myArg2) = nullptr;
+ _GWS(myArg3) = nullptr;
+ *PC = myPC;
+ return myInstruction;
+ }
+
+ // Finally check for arg3
+ myFormat = (opCode & OP_FORMAT3) >> 16;
+ if (myFormat) {
+ myData = word2 & OP_LOW_DATA;
+ if (!ExtractArg(myAnim8, myFormat, myData, &_GWS(myArg3), &_GWS(dataArg3))) {
+ return -1;
+ }
+ } else {
+ _GWS(myArg3) = nullptr;
+ *PC = myPC;
+ return myInstruction;
+ }
+
+ *PC = myPC;
+ return myInstruction;
+}
+
+
+static void op_END(Anim8 *myAnim8) {
+ _GWS(terminated) = true;
+ _GWS(keepProcessing) = false;
+}
+
+static void op_CLEAR(Anim8 *myAnim8) {
+ int32 i;
+
+ // Now clear the registers, but set the scale = 100%
+ for (i = 0; i <= IDX_COUNT + myAnim8->numLocalVars; i++) {
+ myAnim8->myRegs[i] = 0;
+ }
+ myAnim8->myRegs[IDX_S] = 0x10000;
+ myAnim8->myRegs[IDX_MACH_ID] = myAnim8->myMachine->machID;
+}
+
+static void op_SET(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = arg2 or arg1 = rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ *_GWS(myArg1) = *_GWS(myArg2);
+ }
+}
+
+static void op_COMPARE(Anim8 *myAnim8) {
+ frac16 myArg;
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: cmp arg1, arg2 or cmp arg1, rand(arg2, arg3) **sets CCR");
+ }
+ if (_GWS(myArg3)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ myArg = *_GWS(myArg2);
+ }
+ if (*_GWS(myArg1) < myArg) {
+ _GWS(compareCCR) = -1;
+ } else if (*_GWS(myArg1) > myArg) {
+ _GWS(compareCCR) = 1;
+ } else {
+ _GWS(compareCCR) = 0;
+ }
+}
+
+static void op_ADD(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 += arg2 or arg1 += rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) += imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ *_GWS(myArg1) += *_GWS(myArg2);
+ }
+}
+
+static void op_SUB(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 -= arg2 or arg1 -= rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) -= imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ *_GWS(myArg1) -= *_GWS(myArg2);
+ }
+}
+
+static void op_MULT(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 *= arg2 or arg1 *= rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) = MulSF16(*_GWS(myArg1), imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)));
+ } else {
+ *_GWS(myArg1) = MulSF16(*_GWS(myArg1), *_GWS(myArg2));
+ }
+}
+
+static void op_DIV(Anim8 *myAnim8) {
+ frac16 divisor;
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 /= arg2 or arg1 /= rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ divisor = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ divisor = *_GWS(myArg2);
+ }
+ if (divisor == 0) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0253, nullptr);
+ } else {
+ *_GWS(myArg1) = DivSF16(*_GWS(myArg1), divisor);
+ }
+}
+
+static void op_SIN(Anim8 *myAnim8) {
+ int32 tempAngle;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = sin(arg2) or arg1 = sin(rand(arg2, arg3))");
+ }
+ if (_GWS(myArg3)) {
+ tempAngle = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)) >> 16;
+ } else {
+ tempAngle = *_GWS(myArg2) >> 16;
+ }
+ if (tempAngle < 0) {
+ tempAngle = 0x0100 - ((-tempAngle) & 0xff);
+ } else {
+ tempAngle &= 0xff;
+ }
+
+ *_GWS(myArg1) = -(int)cosTable[tempAngle];
+}
+
+static void op_COS(Anim8 *myAnim8) {
+ int32 tempAngle;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = cos(arg2) or arg1 = cos(rand(arg2, arg3))");
+ }
+ if (_GWS(myArg3)) {
+ tempAngle = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)) >> 16;
+ } else {
+ tempAngle = *_GWS(myArg2) >> 16;
+ }
+ if (tempAngle < 0) {
+ tempAngle = 0x0100 - ((-tempAngle) & 0xff);
+ } else {
+ tempAngle &= 0xff;
+ }
+
+ *_GWS(myArg1) = sinTable[tempAngle];
+}
+
+static void op_AND(Anim8 *myAnim8) {
+ frac16 myArg;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 &= arg2 or arg1 &= rand(arg2, arg3) **also sets CCR");
+ }
+ if (_GWS(myArg3)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ myArg = *_GWS(myArg2);
+ }
+ if ((*_GWS(myArg1)) & myArg) {
+ _GWS(compareCCR) = 0;
+ } else {
+ _GWS(compareCCR) = 1;
+ }
+
+ *_GWS(myArg1) &= myArg;
+}
+
+static void op_OR(Anim8 *myAnim8) {
+ frac16 myArg;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 |= arg2 or arg1 |= rand(arg2, arg3) **also sets CCR");
+ }
+ if (_GWS(myArg3)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ myArg = *_GWS(myArg2);
+ }
+ if ((*_GWS(myArg1)) | myArg) {
+ _GWS(compareCCR) = 0;
+ } else {
+ _GWS(compareCCR) = 1;
+ }
+
+ *_GWS(myArg1) |= myArg;
+}
+
+static void op_NOT(Anim8 *myAnim8) {
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: arg1 = (arg1 ? 0 : 1) **also sets CCR");
+ }
+ if (*_GWS(myArg1) == 0) {
+ *_GWS(myArg1) = 0x10000;
+ _GWS(compareCCR) = 1;
+ } else {
+ *_GWS(myArg1) = 0;
+ _GWS(compareCCR) = 0;
+ }
+}
+
+static void op_ABS(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = abs(arg2)");
+ }
+ if (*_GWS(myArg2) < 0) {
+ *_GWS(myArg1) = -(int)(*_GWS(myArg2));
+ } else {
+ *_GWS(myArg1) = *_GWS(myArg2);
+ }
+}
+
+static void op_MIN(Anim8 *myAnim8) {
+ if (!_GWS(myArg3)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0252, "functionality: arg1 = min(arg2, arg3)");
+ }
+ if (*_GWS(myArg2) < *_GWS(myArg3)) {
+ *_GWS(myArg1) = *_GWS(myArg2);
+ } else {
+ *_GWS(myArg1) = *_GWS(myArg3);
+ }
+}
+
+static void op_MAX(Anim8 *myAnim8) {
+ if (!_GWS(myArg3)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0252, "functionality: arg1 = max(arg2, arg3)");
+ }
+ if (*_GWS(myArg2) < *_GWS(myArg3)) {
+ *_GWS(myArg1) = *_GWS(myArg3);
+ } else {
+ *_GWS(myArg1) = *_GWS(myArg2);
+ }
+}
+
+static void op_MOD(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 %= arg2 or arg1 = arg2%arg3");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) = (*_GWS(myArg1)) % (imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)));
+ } else {
+ *_GWS(myArg1) = (*_GWS(myArg1)) % (*_GWS(myArg2));
+ }
+}
+
+static void op_FLOOR(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = floor(arg2) or arg1 = floor(rand(arg2,arg3))");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) = (imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3))) & 0xffff0000;
+ } else {
+ *_GWS(myArg1) = (*_GWS(myArg2)) & 0xffff0000;
+ }
+}
+
+static void op_ROUND(Anim8 *myAnim8) {
+ frac16 myArg;
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = round(arg2) or arg1 = round(rand(arg2,arg3))");
+ }
+ if (_GWS(myArg3)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ myArg = *_GWS(myArg2);
+ }
+ if ((myArg & 0xffff) >= 0x8000) {
+ *_GWS(myArg1) = (myArg + 0x10000) & 0xffff0000;
+ } else {
+ *_GWS(myArg1) = myArg & 0xffff0000;
+ }
+}
+
+static void op_CEIL(Anim8 *myAnim8) {
+ frac16 myArg;
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = ceil(arg2) or arg1 = ceil(rand(arg2,arg3))");
+ }
+ if (_GWS(myArg3)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ myArg = *_GWS(myArg2);
+ }
+ if ((myArg & 0xffff) > 0) {
+ *_GWS(myArg1) = (myArg + 0x10000) & 0xffff0000;
+ } else {
+ *_GWS(myArg1) = myArg & 0xffff0000;
+ }
+}
+
+static void op_POINT(Anim8 *myAnim8) {
+ if (!_GWS(myArg3)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0252, "functionality: arg1 = angle of line segment (x, y) , (arg2, arg3)");
+ }
+ *_GWS(myArg1) = Atan2F16(-(int)(*_GWS(myArg3)) + myAnim8->myRegs[IDX_Y], *_GWS(myArg2) - myAnim8->myRegs[IDX_X]);
+}
+
+static void op_DIST2D(Anim8 *myAnim8) {
+ int32 temp1, temp2;
+ if (!_GWS(myArg3)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0252, "functionality: arg1 = distance from (x, y) to (arg2, arg3)");
+ }
+ temp1 = (int32)(imath_abs(*_GWS(myArg2) - myAnim8->myRegs[IDX_X]));
+ temp2 = (int32)(imath_abs(*_GWS(myArg3) - myAnim8->myRegs[IDX_Y]));
+ if ((temp1 >= 0x800000) || (temp2 >= 0x800000)) {
+ temp1 >>= 16;
+ temp2 >>= 16;
+ *_GWS(myArg1) = (frac16)(SqrtF16(temp1 * temp1 + temp2 * temp2) << 16);
+ } else {
+ *_GWS(myArg1) = SqrtF16(SquareSF16(temp1) + SquareSF16(temp2)) << 8;
+ }
+}
+
+static void op_CRUNCH(Anim8 *myAnim8) {
+ frac16 myArg;
+ if (_GWS(myArg2)) {
+ myArg = imath_ranged_rand16(*_GWS(myArg1), *_GWS(myArg2));
+ } else if (_GWS(myArg1)) {
+ myArg = *_GWS(myArg1);
+ } else {
+ myArg = 0;
+ }
+ myAnim8->startTime = _GWS(ws_globals)[GLB_TIME];
+ if (myArg >= 0) {
+ myAnim8->switchTime = _GWS(ws_globals)[GLB_TIME] + (myArg >> 16);
+ } else {
+ myAnim8->switchTime = -1;
+ }
+ if (myAnim8->transTime <= 0x10000) {
+ myAnim8->flags &= ~((TAG_BEZ | TAG_TARGS) << 16);
+ }
+ _GWS(keepProcessing) = false;
+}
+
+static void op_BRANCH(Anim8 *myAnim8) {
+ int32 myOffset;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "check the CCR, arg1 is the branch type, arg2 is the PC offset");
+ }
+ myOffset = *_GWS(myArg2) >> 14;
+ switch (*_GWS(myArg1) >> 16) {
+ case BRANCH_BR:
+ myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BLT:
+ if (_GWS(compareCCR) < 0) myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BLE:
+ if (_GWS(compareCCR) <= 0) myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BE:
+ if (_GWS(compareCCR) == 0) myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BNE:
+ if (_GWS(compareCCR) != 0) myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BGE:
+ if (_GWS(compareCCR) >= 0) myAnim8->pcOffset += myOffset;
+ break;
+ case BRANCH_BGT:
+ if (_GWS(compareCCR) > 0) myAnim8->pcOffset += myOffset;
+ break;
+ }
+}
+
+static void op_SETCEL(Anim8 *myAnim8) {
+ int32 myIndex;
+ CCB *myCCB;
+ frac16 *myRegs;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "setcel(arg1, arg2) or setcel(arg1, rand(arg2, arg3))");
+ }
+ if (_GWS(myArg3)) {
+ myIndex = imath_ranged_rand(*_GWS(myArg2) >> 16, *_GWS(myArg3) >> 16);
+ } else if (_GWS(myArg2)) {
+ myIndex = *_GWS(myArg2) >> 16;
+ } else {
+ myIndex = (*_GWS(myArg1) & 0xff0000) >> 16;
+ }
+
+ if (!myAnim8->myCCB) {
+ // Allocate and initialize a CCB structure
+ if ((myAnim8->myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes.", sizeof(CCB));
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02fe, "setcel() failed.");
+ }
+ if (!InitCCB(myAnim8->myCCB)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025d, "setcel() failed.");
+ }
+ }
+
+ myCCB = myAnim8->myCCB;
+ if (myCCB->flags & CCB_DISC_STREAM) {
+ ws_CloseSSstream(myCCB);
+ }
+ ShowCCB(myCCB);
+ myCCB->flags |= CCB_SKIP;
+ if ((myAnim8->myCCB = GetWSAssetCEL((uint32)(*_GWS(myArg1)) >> 24, (uint32)myIndex, myCCB)) == nullptr) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025b, "setcel() failed.");
+ }
+ myRegs = myAnim8->myRegs;
+ if (myRegs[IDX_W] < 0) {
+ myRegs[IDX_W] = -myCCB->source->w << 16;
+ } else {
+ myRegs[IDX_W] = myCCB->source->w << 16;
+ }
+ myRegs[IDX_H] = myCCB->source->h << 16;
+ // MyRegs[IDX_CELS_HASH] = ((uint32)*_GWS(myArg1)) >> 8;
+ // MyRegs[IDX_CELS_INDEX] = myIndex << 16;
+ _GWS(mapTheCel) = true;
+}
+
+
+static void op_SEQ_SEND_MSG(Anim8 *myAnim8) {
+ frac16 msgValue;
+
+ //_GWS(myArg1) is the recipient machine hash, _GWS(myArg2) is the msg hash, _GWS(myArg3) (if exists) is the msg value
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: send to machine arg1, the message arg2 or the message arg2, arg3");
+ }
+
+ if (_GWS(myArg3)) {
+ msgValue = *_GWS(myArg3);
+ } else {
+ msgValue = 0;
+ }
+
+ SendWSMessage(*_GWS(myArg2), msgValue, nullptr, (*_GWS(myArg1)) >> 16, nullptr, 1);
+ return;
+}
+
+
+static void op_PUSH(Anim8 *myAnim8) {
+ uint32 *data;
+ int32 direction, numOfArgs, i; //,startReg
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: push arg1 or start with arg1, and push a total of arg2 values");
+ }
+ direction = 1;
+ if (_GWS(myArg2)) {
+ if (*_GWS(myArg2) > 0) numOfArgs = (*_GWS(myArg2)) >> 16;
+ else {
+ numOfArgs = -(int)(*_GWS(myArg2)) >> 16;
+ direction = -1;
+ }
+ } else {
+ numOfArgs = 1;
+ }
+
+ if (((byte *)_GWS(stackLimit) - (byte *)_GWS(stackTop)) < (numOfArgs << 2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0254, "overflow during push instruction");
+ return;
+ }
+ if (_GWS(myArg2)) {
+ data = (uint32 *)_GWS(myArg1);
+ for (i = 0; i < numOfArgs; i++) {
+ *_GWS(stackTop)++ = *data;
+ data += direction;
+ }
+ } else {
+ *_GWS(stackTop)++ = (uint32)(*_GWS(myArg1));
+ }
+}
+
+static void op_POP(Anim8 *myAnim8) {
+ uint32 *data;
+ int32 direction, numOfArgs, i; // startReg,
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: pop into arg1 or start with arg1, and pop a total of arg2 values");
+ }
+ direction = 1;
+ if (_GWS(myArg2)) {
+ if (*_GWS(myArg2) > 0) numOfArgs = (*_GWS(myArg2)) >> 16;
+ else {
+ numOfArgs = -(int)(*_GWS(myArg2)) >> 16;
+ direction = -1;
+ }
+ } else numOfArgs = 1;
+ if (((byte *)_GWS(stackTop) - (byte *)_GWS(stackBase)) < (numOfArgs << 2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0255, "underflow during pop instruction");
+ }
+ if (_GWS(myArg2)) {
+ data = (uint32 *)_GWS(myArg1);
+ for (i = 0; i < numOfArgs; i++) {
+ *data = *(--_GWS(stackTop));
+ data += direction;
+ }
+ } else {
+ *_GWS(myArg1) = (frac16)(*(--_GWS(stackTop)));
+ }
+}
+
+static void op_JSR(Anim8 *myAnim8) {
+ int32 dummy;
+
+ if (myAnim8->returnStackIndex >= JSR_STACK_MAX) {
+ ws_LogErrorMsg(FL, "Max number of nested jsr instructions is: %ld", JSR_STACK_MAX);
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0256, "jsr() failed");
+ }
+ myAnim8->returnHashes[myAnim8->returnStackIndex] = myAnim8->sequHash;
+ myAnim8->returnOffsets[myAnim8->returnStackIndex] = myAnim8->pcOffset;
+ myAnim8->returnStackIndex++;
+
+ // Find the sequence
+ if ((myAnim8->sequHandle = ws_GetSEQU((uint32)*_GWS(myArg1) >> 16, &dummy, &myAnim8->pcOffset)) == nullptr) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025f, "jsr() failed");
+ }
+ myAnim8->sequHash = (uint32)*_GWS(myArg1) >> 16;
+
+ dbg_LaunchSequence(myAnim8);
+}
+
+static void op_RETURN(Anim8 *myAnim8) {
+ int32 dummy, dummy2;
+ uint32 returnSequHash, returnOffset;
+
+ if (myAnim8->returnStackIndex <= 0) {
+ op_END(myAnim8);
+ return;
+ }
+
+ myAnim8->returnStackIndex--;
+ returnSequHash = myAnim8->returnHashes[myAnim8->returnStackIndex];
+ returnOffset = myAnim8->returnOffsets[myAnim8->returnStackIndex];
+
+ // Find the sequence
+ if ((myAnim8->sequHandle = ws_GetSEQU((uint32)returnSequHash, &dummy, &dummy2)) == nullptr) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025f, "return() failed");
+ }
+ myAnim8->sequHash = returnSequHash;
+ myAnim8->pcOffset = returnOffset;
+
+ dbg_LaunchSequence(myAnim8);
+}
+
+static void op_GET_CELS_COUNT(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = series_count(arg2)");
+ }
+ *_GWS(myArg1) = GetWSAssetCELCount((uint32)(*_GWS(myArg2)) >> 24) << 16;
+}
+
+static void op_GET_CELS_FRAME_RATE(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = series_frame_rate(arg2)");
+ }
+ *_GWS(myArg1) = GetWSAssetCELFrameRate((uint32)(*_GWS(myArg2)) >> 24);
+}
+
+static void op_GET_CELS_PIX_SPEED(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: arg1 = series_pix_speed(arg2)");
+ }
+ *_GWS(myArg1) = GetWSAssetCELPixSpeed((uint32)(*_GWS(myArg2)) >> 24);
+}
+
+static void op_SET_INDEX(Anim8 *myAnim8) {
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: index_reg = arg1");
+ }
+ _GWS(indexReg) = *_GWS(myArg1) >> 16;
+}
+
+static void op_SET_LAYER(Anim8 *myAnim8) {
+ Anim8 *tempAnim8;
+ int32 myLayer, newLayer;
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: set_layer(arg1)");
}
- _G(stackTop) = _G(stackBase);
- _G(stackLimit) = (uint32 *)((byte *)_G(stackBase) + (uint32)_G(stackSize));
- _G(cruncherInitialized) = true;
+ newLayer = *_GWS(myArg1) >> 16;
+ myLayer = myAnim8->myLayer;
+ if (myLayer == newLayer) {
+ return;
+ }
+
+ // If we are moving myAnim8 closer to the front (screen)
+ if ((newLayer < myLayer) && (myAnim8->infront)) {
+
+ //search "upward" to find the new position for myAnim8
+ tempAnim8 = myAnim8->infront;
+ while (tempAnim8 && (tempAnim8->myLayer > newLayer)) {
+ tempAnim8 = tempAnim8->infront;
+ }
+
+ // If myAnim8 is to be moved
+ if (tempAnim8 != myAnim8->infront) {
+
+ // Remove myAnim8 from the list
+ myAnim8->infront->behind = myAnim8->behind;
+ if (myAnim8->behind) {
+ myAnim8->behind->infront = myAnim8->infront;
+ } else {
+ _GWS(myCruncher)->backLayerAnim8 = myAnim8->infront;
+ }
+
+ // If it belongs at the top layer of the list
+ if (!tempAnim8) {
+ myAnim8->infront = nullptr;
+ myAnim8->behind = _GWS(myCruncher)->frontLayerAnim8;
+ _GWS(myCruncher)->frontLayerAnim8->infront = myAnim8;
+ _GWS(myCruncher)->frontLayerAnim8 = myAnim8;
+ }
+
+ // Else it belongs after tempAnim8
+ else {
+ myAnim8->infront = tempAnim8;
+ myAnim8->behind = tempAnim8->behind;
+ tempAnim8->behind->infront = myAnim8;
+ tempAnim8->behind = myAnim8;
+ }
+ }
+ }
+
+ // Else we are moving myAnim8 close to the back (further from the screen)
+ else if ((newLayer > myLayer) && (myAnim8->behind)) {
+
+ //search "downward" to find the new position for myAnim8
+ tempAnim8 = myAnim8->behind;
+ while (tempAnim8 && (tempAnim8->myLayer < newLayer)) {
+ tempAnim8 = tempAnim8->behind;
+ }
+
+ // If myAnim8 is to be moved
+ if (tempAnim8 != myAnim8->behind) {
+
+ // Remove it from the list
+ if (myAnim8->infront) {
+ myAnim8->infront->behind = myAnim8->behind;
+ } else {
+ _GWS(myCruncher)->frontLayerAnim8 = myAnim8->behind;
+ }
+ myAnim8->behind->infront = myAnim8->infront;
+
+ // If it belongs at the bottom of the list
+ if (!tempAnim8) {
+ myAnim8->infront = _GWS(myCruncher)->backLayerAnim8;
+ myAnim8->behind = nullptr;
+ _GWS(myCruncher)->backLayerAnim8->behind = myAnim8;
+ _GWS(myCruncher)->backLayerAnim8 = myAnim8;
+ }
+
+ // Else it belongs right before tempAnim8
+ else {
+ myAnim8->infront = tempAnim8->infront;
+ myAnim8->behind = tempAnim8;
+ tempAnim8->infront->behind = myAnim8;
+ tempAnim8->infront = myAnim8;
+ }
+ }
+ }
+
+ // Now, make sure the layer is set in both myAnim8, and the register
+ myAnim8->myLayer = newLayer;
+ myAnim8->myRegs[IDX_LAYER] = newLayer << 16;
+}
+
+static void op_SET_DEPTH(Anim8 *myAnim8) {
+ int32 myDepth;
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: set_depth(arg1)");
+ }
+ if (!_GWS(myDepthTable)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02ff, "op_SET_DEPTH() failed - no depth table.");
+ }
+ for (myDepth = 0; myDepth < 15; myDepth++) {
+ if (_GWS(myDepthTable)[myDepth + 1] < (int)(*_GWS(myArg1) >> 16)) break;
+ }
+ _GWS(dataArg1) = (myAnim8->myRegs[IDX_LAYER] & 0xffffff) + (myDepth << 24);
+ _GWS(myArg1) = &_GWS(dataArg1);
+ op_SET_LAYER(myAnim8);
+}
+
+static void op_SET_DATA(Anim8 *myAnim8) {
+ if (!_GWS(myArg2)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "functionality: set_data(arg1, arg2)");
+ }
+ if ((myAnim8->dataHandle = ws_GetDATA(*_GWS(myArg1) >> 16, *_GWS(myArg2) >> 16, &myAnim8->dataOffset)) == nullptr) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025f, "set_data() failed.");
+ }
+}
+
+static void op_OPEN_STREAM_SS(Anim8 *myAnim8) {
+ CCB *myCCB;
+
+ if (!_GWS(myArg1)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: stream_series(arg1)");
+ }
+
+ if (!myAnim8->myCCB) {
+ // Allocate and initialize a CCB structure
+ if ((myAnim8->myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(CCB));
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02fe, "open_ss_stream() failed.");
+ }
+ if (!InitCCB(myAnim8->myCCB)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025d, "open_ss_stream() failed.");
+ }
+ }
+
+ myCCB = myAnim8->myCCB;
+ ShowCCB(myCCB);
+ myCCB->flags |= CCB_SKIP;
+ if (!ws_OpenSSstream((StreamFile *)(*_GWS(myArg1)), myAnim8)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0258, "open_ss_stream() failed.");
+ }
+ if (myAnim8->myRegs[IDX_W] < 0) myAnim8->myRegs[IDX_W] = -myCCB->source->w << 16;
+ else myAnim8->myRegs[IDX_W] = myCCB->source->w << 16;
+ myAnim8->myRegs[IDX_H] = myCCB->source->h << 16;
+ _GWS(mapTheCel) = true;
+}
+
+static void op_NEXT_STREAM_SS(Anim8 *myAnim8) {
+ CCB *myCCB;
+ if (!myAnim8->myCCB) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0253, "next_ss_stream() failed.");
+ }
+ myCCB = myAnim8->myCCB;
+ myCCB->flags |= CCB_SKIP;
+ if (!ws_GetNextSSstreamCel(myAnim8)) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0259, "next_ss_stream() failed.");
+ }
+ if (myAnim8->myRegs[IDX_W] < 0) {
+ myAnim8->myRegs[IDX_W] = -myCCB->source->w << 16;
+ } else {
+ myAnim8->myRegs[IDX_W] = myCCB->source->w << 16;
+ }
+ myAnim8->myRegs[IDX_H] = myCCB->source->h << 16;
+ _GWS(mapTheCel) = true;
+}
+
+static void op_CLOSE_STREAM_SS(Anim8 *myAnim8) {
+ CCB *myCCB;
+ if (!myAnim8->myCCB) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02f3, "close_ss_stream() failed.");
+ }
+ myCCB = myAnim8->myCCB;
+ ws_CloseSSstream(myCCB);
+ HideCCB(myCCB);
+}
+
+
+void (*pCodeJmpTable[])(Anim8 *myAnim8) = {
+ &op_END, //0
+ &op_CLEAR, //1
+ &op_SET, //2
+ &op_COMPARE, //3
+ &op_ADD, //4
+ &op_SUB, //5
+ &op_MULT, //6
+ &op_DIV, //7
+ &op_AND, //8
+ &op_OR, //9
+ &op_NOT, //10
+ &op_SIN, //11
+ &op_COS, //12
+ &op_ABS, //13
+ &op_MIN, //14
+ &op_MAX, //15
+ &op_MOD, //16
+ &op_FLOOR, //17
+ &op_ROUND, //18
+ &op_CEIL, //19
+ &op_POINT, //20
+ &op_DIST2D, //21
+ &op_CRUNCH, //22
+ &op_BRANCH, //23
+ &op_SETCEL, //24
+ &op_SEQ_SEND_MSG, //25
+ &op_PUSH, //26
+ &op_POP, //27
+ &op_JSR, //28
+ &op_RETURN, //29
+ &op_GET_CELS_COUNT, //30
+ &op_GET_CELS_FRAME_RATE, //31
+ &op_GET_CELS_PIX_SPEED, //32
+ &op_SET_INDEX, //33
+ &op_SET_LAYER, //34
+ &op_SET_DEPTH, //35
+ &op_SET_DATA, //36
+ &op_OPEN_STREAM_SS, //37
+ &op_NEXT_STREAM_SS, //38
+ &op_CLOSE_STREAM_SS //39
+};
+
+
+// The guts of the engine. This proc executes an anim8s program.
+bool CrunchAnim8(Anim8 *myAnim8);
+bool CrunchAnim8(Anim8 *myAnim8) {
+ bool moveTheCel = false;
+ frac16 timeElapsed, percentDist;
+ int32 tempAngle;
+ frac16 oldX, oldY, oldS;
+ int32 oldW, oldH, oldR;
+ int32 myInstruction;
+ frac16 *myRegs;
+ uint32 *myPC, *oldPC;
+
+ // Get the register set for myAnim8
+ myRegs = myAnim8->myRegs;
+
+ // Initialize the globals (flags, mostly) used in processing op codes
+ _GWS(keepProcessing) = false;
+ _GWS(terminated) = false;
+ _GWS(mapTheCel) = false;
+ _GWS(compareCCR) = 0;
+
+ //store the old values, so we can tell if we need to remap the Sprite
+ oldX = myRegs[IDX_X];
+ oldY = myRegs[IDX_Y];
+ oldS = myRegs[IDX_S];
+ oldW = myRegs[IDX_W] >> 16;
+ oldH = myRegs[IDX_H] >> 16;
+ oldR = myRegs[IDX_R] >> 16;
+
+ // Check to see if we are still in an execution loop, or if it is time to
+ // Interpret further instructions
+ if ((myAnim8->switchTime >= 0) && ((int)_GWS(ws_globals)[GLB_TIME] >= myAnim8->switchTime)) {
+ _GWS(keepProcessing) = true;
+ }
+
+ // Decrement the timer register
+ myRegs[IDX_TIMER] -= (_GWS(ws_globals)[GLB_WATCH_DOG] << 16);
+
+ // Interpret pCode instructions until we hit something signalling to stop
+ while (_GWS(keepProcessing)) {
+ dbg_SetCurrSequInstr(myAnim8, _GWS(compareCCR));
+
+ myPC = (uint32 *)((int32)*(myAnim8->sequHandle) + myAnim8->pcOffset);
+ oldPC = myPC;
+ _GWS(pcOffsetOld) = myAnim8->pcOffset;
+
+ if ((myInstruction = ws_PreProcessPcode(&myPC, myAnim8)) < 0) {
+ ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025c, nullptr);
+ }
+
+ myAnim8->pcOffset += (int32)myPC - (int32)oldPC;
+ pCodeJmpTable[myInstruction](myAnim8);
+ }
+
+ if (_GWS(terminated)) {
+ if (_GWS(mapTheCel) || (oldR != (int)(myRegs[IDX_R] >> 16)) ||
+ (oldW != (int)(myRegs[IDX_W] >> 16)) || (oldH != (int)(myRegs[IDX_H] >> 16)) ||
+ (oldS != (int)myRegs[IDX_S])) {
+ myAnim8->flags |= TAG_MAP_CEL;
+ } else if ((oldX != myRegs[IDX_X]) || (oldY != myRegs[IDX_Y])) {
+ myAnim8->flags |= TAG_MOVE_CEL;
+ }
+
+ return false;
+ }
+
+ if (myAnim8->flags) {
+ timeElapsed = (_GWS(ws_globals)[GLB_TIME] - myAnim8->startTime) << 16;
+
+ // This must be checked before TAG_TARGS because a bez path can use a target scale and rotate
+ // And we don't want to accidently setup a target x or y.
+ // NOTE: for both bez paths, and targets, the time for the anim8 to reach the target or traverse
+ // the path is stored in IDX_TRANS_TIME, however, in order to determine how far aint32 the
+ // path we should be, we normally compute the elapsed time divided by the trans time.
+ // therefore we eliminate a division if we store the reciprocated trans time.
+ // This also serves as an initialization flag - if the trans time is > 1.
+ if ((myAnim8->flags >> 16) &TAG_BEZ) {
+ if (myAnim8->transTime > 0x10000) {
+ myAnim8->transTime = RecipUF16(myAnim8->transTime);
+ GetBezCoeffs(&myRegs[IDX_BEZ_CTRL], &myRegs[IDX_BEZ_COEFF]);
+ if ((myAnim8->flags >> 16) &TAG_TARGS) {
+ myAnim8->start_s = myRegs[IDX_S];
+ myAnim8->start_r = myRegs[IDX_R];
+ }
+ }
+ percentDist = MulSF16(timeElapsed, myAnim8->transTime);
+ if (percentDist < 0x10000) {
+ GetBezPoint(&myRegs[IDX_X], &myRegs[IDX_Y], &myRegs[IDX_BEZ_COEFF], percentDist);
+ if ((myAnim8->flags >> 16) &TAG_TARGS) {
+ myRegs[IDX_S] = myAnim8->start_s + MulSF16(percentDist, myRegs[IDX_TARG_S] - myAnim8->start_s);
+ myRegs[IDX_R] = myAnim8->start_r + MulSF16(percentDist, myRegs[IDX_TARG_R] - myAnim8->start_r);
+ _GWS(mapTheCel) = true;
+ } else moveTheCel = true;
+ } else if ((myRegs[IDX_X] != myRegs[IDX_BEZ_CTRL + 6]) || (myRegs[IDX_Y] != myRegs[IDX_BEZ_CTRL + 7])) {
+ myRegs[IDX_X] = myRegs[IDX_BEZ_CTRL + 6];
+ myRegs[IDX_Y] = myRegs[IDX_BEZ_CTRL + 7];
+ if ((myAnim8->flags >> 16) &TAG_TARGS) {
+ myRegs[IDX_S] = myRegs[IDX_TARG_S];
+ myRegs[IDX_R] = myRegs[IDX_TARG_R];
+ _GWS(mapTheCel) = true;
+ } else moveTheCel = true;
+ }
+ }
+ // Vectors must be checked before deltas, since vectors are converted to deltas at
+ // Initialization.
+ else if (((myAnim8->flags >> 16) &TAG_VECTORS) && (timeElapsed == 0)) {
+ myAnim8->start_x = myRegs[IDX_X];
+ myAnim8->start_y = myRegs[IDX_Y];
+ if ((myAnim8->flags >> 16) &TAG_DELTAS) {
+ myAnim8->start_s = myRegs[IDX_S];
+ myAnim8->start_r = myRegs[IDX_R];
+ }
+ tempAngle = (myRegs[IDX_THETA] >> 16) & 0xff;
+ myRegs[IDX_DELTA_X] = MulSF16(myRegs[IDX_VELOCITY], sinTable[tempAngle]);
+ myRegs[IDX_DELTA_Y] = MulSF16(myRegs[IDX_VELOCITY], -(int)cosTable[tempAngle]);
+ myAnim8->flags |= (TAG_DELTAS << 16);
+ } else if ((myAnim8->flags >> 16) &TAG_DELTAS) {
+ if (timeElapsed == 0) {
+ myAnim8->start_x = myRegs[IDX_X];
+ myAnim8->start_y = myRegs[IDX_Y];
+ myAnim8->start_s = myRegs[IDX_S];
+ myAnim8->start_r = myRegs[IDX_R];
+ } else {
+ myRegs[IDX_X] = myAnim8->start_x + MulSF16(timeElapsed, myRegs[IDX_DELTA_X]);
+ myRegs[IDX_Y] = myAnim8->start_y + MulSF16(timeElapsed, myRegs[IDX_DELTA_Y]);
+ if (myRegs[IDX_DELTA_R] || myRegs[IDX_DELTA_S]) {
+ myRegs[IDX_S] = myAnim8->start_s + MulSF16(timeElapsed, myRegs[IDX_DELTA_S]);
+ myRegs[IDX_R] = myAnim8->start_r + MulSF16(timeElapsed, myRegs[IDX_DELTA_R]);
+ _GWS(mapTheCel) = true;
+ } else moveTheCel = true;
+ }
+ } else if ((myAnim8->flags >> 16) &TAG_TARGS) {
+ if (myAnim8->transTime > 0x10000) {
+ myAnim8->start_s = myRegs[IDX_S];
+ myAnim8->start_r = myRegs[IDX_R];
+ myAnim8->start_x = myRegs[IDX_X];
+ myAnim8->start_y = myRegs[IDX_Y];
+ myAnim8->transTime = RecipUF16(myAnim8->transTime);
+ }
+ percentDist = MulSF16(timeElapsed, myAnim8->transTime);
+ if (percentDist < 0x10000) {
+ myRegs[IDX_X] = myAnim8->start_x + MulSF16(percentDist, myRegs[IDX_TARG_X] - myAnim8->start_x);
+ myRegs[IDX_Y] = myAnim8->start_y + MulSF16(percentDist, myRegs[IDX_TARG_Y] - myAnim8->start_y);
+ if (myRegs[IDX_TARG_R] || (myRegs[IDX_TARG_S] != myRegs[IDX_S])) {
+ myRegs[IDX_S] = myAnim8->start_s + MulSF16(percentDist, myRegs[IDX_TARG_S] - myAnim8->start_s);
+ myRegs[IDX_R] = myAnim8->start_r + MulSF16(percentDist, myRegs[IDX_TARG_R] - myAnim8->start_r);
+ _GWS(mapTheCel) = true;
+ } else moveTheCel = true;
+ } else {
+ myRegs[IDX_X] = myRegs[IDX_TARG_X];
+ myRegs[IDX_Y] = myRegs[IDX_TARG_Y];
+ myRegs[IDX_S] = myRegs[IDX_TARG_S];
+ myRegs[IDX_R] = myRegs[IDX_TARG_R];
+ myAnim8->flags &= ~TAG_TARGS;
+ _GWS(mapTheCel) = true;
+ }
+ }
+ }
+ if (_GWS(mapTheCel) || (oldR != (int)(myRegs[IDX_R] >> 16)) || (oldW != (int)(myRegs[IDX_W] >> 16)) ||
+ (oldH != (int)(myRegs[IDX_H] >> 16)) || (oldS != (int)myRegs[IDX_S])) {
+ _GWS(mapTheCel) = true;
+ } else if ((oldX != myRegs[IDX_X]) || (oldY != myRegs[IDX_Y])) {
+ moveTheCel = true;
+ }
+ if (moveTheCel || _GWS(mapTheCel) || (myAnim8->flags & (TAG_MAP_CEL | TAG_MOVE_CEL))) {
+ Cel_msr(myAnim8);
+ }
return true;
}
-void ws_KillCruncher(void) {
+void ws_CrunchAnim8s(int16 *depth_table) {
+ Anim8 *currAnim8;
+ EOSreq *tempEOSreq;
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_CrunchAnim8s()");
+
+ //set up some of the _GWS(ws_globals) vars used for processing
+ _GWS(myDepthTable) = depth_table;
+
+ _GWS(crunchNext) = nullptr;
+ currAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
+ while (currAnim8) {
+ _GWS(crunchNext) = currAnim8->next;
+ if (currAnim8->active) {
+ if (!CrunchAnim8(currAnim8)) {
+ // If false was returned, this implies that an "END" op has been reached.
+ // Remove from the active list. Note: the machine still points to the anim8.
+ currAnim8->active = false;
+ if (currAnim8->eosReqOffset >= 0) {
+ // If the above field has a value, this implies that an On end sequence
+ //signal has been requested. If so, report back to the machine.
+ if ((tempEOSreq = (EOSreq *)mem_get_from_stash(_GWS(memtypeEOS), "+EOS")) == nullptr) return;
+ tempEOSreq->myAnim8 = currAnim8;
+ tempEOSreq->prev = nullptr;
+ tempEOSreq->next = _GWS(EOSreqList);
+ if (_GWS(EOSreqList)) {
+ _GWS(EOSreqList)->prev = tempEOSreq;
+ }
+ _GWS(EOSreqList) = tempEOSreq;
+ }
+ }
+ }
+ currAnim8 = _GWS(crunchNext);
+ }
+ _GWS(crunchNext) = nullptr;
+}
+
+void ws_CrunchEOSreqs(void) {
+ int32 pcOffset, pcCount;
+ machine *myXM;
+ EOSreq *tempEOSreq;
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_CrunchEOSreqs()");
+
+ // Loop through, and handle all the eos requests
+ tempEOSreq = _GWS(EOSreqList);
+ while (tempEOSreq) {
+ _GWS(EOSreqList) = _GWS(EOSreqList)->next;
+ if (_GWS(EOSreqList)) {
+ _GWS(EOSreqList)->prev = nullptr;
+ }
+ pcOffset = tempEOSreq->myAnim8->eosReqOffset;
+ pcCount = tempEOSreq->myAnim8->eosReqCount;
+ myXM = tempEOSreq->myAnim8->myMachine;
+ tempEOSreq->myAnim8->eosReqOffset = -1;
+ mem_free_to_stash((void *)tempEOSreq, _GWS(memtypeEOS));
+ ws_StepWhile(myXM, pcOffset, pcCount);
+ tempEOSreq = _GWS(EOSreqList);
+ }
+}
+
+void ws_KillCruncher() {
Anim8 *myAnim8;
- //make sure the cruncher has been initialized
+ // Make sure the cruncher has been initialized
VERIFY_INTIALIZED("ws_KillCruncher()");
- myAnim8 = _G(myCruncher)->firstAnim8ToCrunch;
+ myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
while (myAnim8) {
- _G(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
+ _GWS(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
if (myAnim8->myCCB) {
KillCCB(myAnim8->myCCB, false);
}
- mem_free((void *)myAnim8->myRegs);
- myAnim8 = _G(myCruncher)->firstAnim8ToCrunch;
+ mem_free(myAnim8->myRegs);
+ myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
+ }
+ mem_free(_GWS(myCruncher));
+ if (_GWS(stackBase)) {
+ mem_free(_GWS(stackBase));
}
- mem_free(_G(myCruncher));
+ _GWS(cruncherInitialized) = false;
+}
+
+// This proc was designed to allow the state machine to issue an OnEndSeq request
+// In which the cruncher will signal the state machine should an anim8 ever finish.
+bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount) {
+
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_OnEndSeqRequest()");
+
+ myAnim8->eosReqOffset = pcOffset;
+ myAnim8->eosReqCount = pcCount;
+
+ return true;
+}
+
+
+void ws_CancelOnEndSeq(Anim8 *myAnim8) {
- if (_G(stackBase))
- mem_free(_G(stackBase));
+ // Make sure the cruncher has been initialized
+ VERIFY_INTIALIZED("ws_CancelOnEndSeq()");
- _G(cruncherInitialized) = false;
+ myAnim8->eosReqOffset = -1;
}
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_cruncher.h b/engines/m4/wscript/ws_cruncher.h
index 5b95ea397ac..af1572bfb87 100644
--- a/engines/m4/wscript/ws_cruncher.h
+++ b/engines/m4/wscript/ws_cruncher.h
@@ -28,6 +28,38 @@
namespace M4 {
+#define OP_INSTR 0xfe000000
+#define OP_FORMAT1 0x01c00000
+#define OP_FORMAT2 0x00380000
+#define OP_FORMAT3 0x00070000
+#define OP_HIGH_DATA 0xffff0000
+#define OP_LOW_DATA 0x0000ffff
+#define OP_DATA_SIGN 0x8000
+#define OP_DATA_VALUE 0x7fff
+
+#define FMT_NOTHING 0
+#define FMT_LOCAL_SRC 1
+#define FMT_GLOBAL_SRC 2
+#define FMT_INT15 3
+#define FMT_4_11 4
+#define FMT_7_8 5
+#define FMT_11_4 6
+#define FMT_15_0 7
+#define REG_SET_IDX 0x0fff
+#define REG_SET_IDX_REG 0x8000
+#define LOCAL_FMT 0x7000
+#define LOCAL_FMT_PARENT 0x0000
+#define LOCAL_FMT_REG 0x1000
+#define LOCAL_FMT_DATA 0x2000
+
+#define BRANCH_BR 0
+#define BRANCH_BLT 1
+#define BRANCH_BLE 2
+#define BRANCH_BE 3
+#define BRANCH_BNE 4
+#define BRANCH_BGE 5
+#define BRANCH_BGT 6
+
struct EOSreq {
EOSreq *next = nullptr;
EOSreq *prev = nullptr;
@@ -70,10 +102,29 @@ struct WSCruncher_Globals {
};
extern int32 *ws_GetDataFormats();
-
extern bool ws_InitCruncher();
extern void ws_KillCruncher();
+extern Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash);
+
+/**
+ * This procedure assumes a machine has a slot with it's own memory
+ */
+extern bool ws_ChangeAnim8Program(machine *m, int32 newSequHash);
+
+/**
+ * This procedure flags the anim8 slot as empty
+ */
+extern void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8);
+
+extern bool ws_PauseAnim8(Anim8 *myAnim8);
+extern bool ws_ResumeAnim8(Anim8 *myAnim8);
+extern int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8);
+extern void ws_CrunchAnim8s(int16 *depth_table);
+extern void ws_CrunchEOSreqs();
+extern bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount);
+extern void ws_CancelOnEndSeq(Anim8 *myAnim8);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index ac1182852d4..1ee7effe65f 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -19,34 +19,454 @@
*
*/
+#include "common/savefile.h"
+#include "common/textconsole.h"
#include "m4/wscript/ws_hal.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/dbg/debug.h"
+#include "m4/graphics/rend.h"
#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
bool ws_InitHAL() {
- _G(deadRectList) = NULL;
+ _GWS(deadRectList) = nullptr;
return true;
}
void ws_KillHAL() {
- vmng_DisposeRectList(&_G(deadRectList));
+ vmng_DisposeRectList(&_GWS(deadRectList));
}
-void KillCCB(CCB *myCCB, bool restoreFlag) {
- error("TODO: KillCCB");
+void ws_DumpMachine(machine *m, Common::WriteStream *logFile) {
+ Anim8 *myAnim8;
+ CCB *myCCB;
+ frac16 *myRegs;
+ int32 i;
+ double tempFloat;
+
+ if (!m || !logFile)
+ return;
+
+ // Print out the machine name, hash, and physical address
+ logFile->writeString(Common::String::format("Machine Name: %s\n\tHash: %ld\n\tAddress: 0x%08lx\n\n", m->machName, m->myHash, (int32)m));
+
+ // If we have an anim8 for this machine
+ if (m->myAnim8) {
+ myAnim8 = m->myAnim8;
+
+ // Print out the anim8 hash, and physical address
+ logFile->writeString(Common::String::format("Sequence Hash: %ld\n\tAddress: 0x%08lx\n\n", myAnim8->sequHash, (int32)myAnim8));
+
+ // And if this anim8 has registers
+ if (myAnim8->myRegs) {
+ myRegs = myAnim8->myRegs;
+ logFile->writeString("Registers:\n");
+
+ // Loop through the main set of registers, and dump out the contents
+ for (i = 0; i < IDX_COUNT; i++) {
+ tempFloat = (float)(myRegs[i] >> 16) + (float)((float)(myRegs[i] & 0xffff) / (float)65536);
+ logFile->writeString(Common::String::format("\t%ld\t%s:\t\t%.2f\t\t0x%08lx\n", i, myRegLabels[i], tempFloat, myRegs[i]));
+ }
+
+ // If the anim8 has extra local regs
+ if (myAnim8->numLocalVars > 0) {
+ for (i = IDX_COUNT; i < IDX_COUNT + myAnim8->numLocalVars; i++) {
+ tempFloat = (float)(myRegs[i] >> 16) + (float)((float)(myRegs[i] & 0xffff) / (float)65536);
+ logFile->writeString(Common::String::format("\t%ld\tlocal.%ld:\t\t%.2f\t\t0x%08lx\n", i, i - IDX_COUNT, tempFloat, myRegs[i]));
+ }
+ }
+ logFile->writeString(Common::String::format("\n"));
+ }
+
+ // If this anim8 has a CCB
+ if (myAnim8->myCCB) {
+ myCCB = myAnim8->myCCB;
+
+ logFile->writeString(Common::String::format("Sprite Series Name: %s\tAddress:0x%08lx\tFlags0x%08lx\n", myCCB->seriesName, (uint32)myCCB, myCCB->flags));
+ logFile->writeString(Common::String::format("\tCurrent Location: (%ld, %ld), (%ld, %ld)\n", myCCB->currLocation->x1, myCCB->currLocation->y1,
+ myCCB->currLocation->x2, myCCB->currLocation->y2));
+ logFile->writeString(Common::String::format("\tNew Location: (%ld, %ld), (%ld, %ld)\n", myCCB->newLocation->x1, myCCB->newLocation->y1,
+ myCCB->newLocation->x2, myCCB->newLocation->y2));
+ logFile->writeString(Common::String::format("\tscale: %ld\n", myCCB->scaleX));
+ logFile->writeString(Common::String::format("\tlayer: %ld\n", myCCB->layer));
+ }
+ }
+}
+
+void ws_Error(machine *m, int32 errorType, trigraph errorCode, const char *errMsg) {
+ Common::OutSaveFile *logFile;
+ char description[MAX_STRING_SIZE];
+
+ // Find the error description
+ error_look_up(errorCode, description);
+
+ // Open the logFile
+ logFile = g_system->getSavefileManager()->openForSaving("ws_mach.log");
+
+ // Give the WS debugger a chance to indicate the error to the apps programmer
+ dbg_WSError(logFile, m, errorType, description, errMsg, _GWS(pcOffsetOld));
+
+ // Dump out the machine to the logFile
+ ws_DumpMachine(m, logFile);
+
+ // Close the logFile
+ if (logFile)
+ f_io_close(logFile);
+
+ // Now we fatal abort
+ error_show(FL, errorCode, errMsg);
+}
+
+void ws_LogErrorMsg(char *sourceFile, int32 lineNum, const char *fmt, ...) {
+ Common::OutSaveFile *logFile;
+ Common::String msgBuff;
+ va_list ap;
+
+ va_start(ap, fmt);
+ msgBuff == Common::String::vformat(fmt, ap);
+ va_end(ap);
+
+ logFile = g_system->getSavefileManager()->openForSaving("ws_mach.log");
+ if (logFile) {
+ logFile->writeString(Common::String::format("Source Code Index: %s:%ld\n", sourceFile, lineNum));
+ logFile->writeString(Common::String::format("%s\n\n", msgBuff.c_str()));
+
+ logFile->finalize();
+ delete logFile;
+ }
+
+ term_message("Source Code Index: %s:%ld", sourceFile, lineNum);
+ term_message("%s", msgBuff.c_str());
+}
+
+machine *kernel_timer_callback(int32 ticks, int16 trigger, MessageCB callMe) {
+ _GWS(ws_globals)[GLB_TEMP_1] = (frac16)(ticks << 16);
+ _GWS(ws_globals)[GLB_TEMP_2] = (frac16)trigger;
+
+ return (TriggerMachineByHash(1, nullptr, -1, -1, callMe, false, "timer callback"));
+}
+
+void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff, uint8 *myPalette, uint8 *ICT,
+ M4Rect *clipRect, M4Rect *updateRect) {
+#ifdef TODO
+ M4sprite *source;
+
+ // Temporary var to prevent excessive dereferences
+ source = myCCB->source;
+
+ if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ //make sure the sprite is still in memory
+ if (!source->sourceHandle || !*(source->sourceHandle)) {
+ ws_LogErrorMsg(FL, "Sprite series is no longer in memory.");
+ ws_Error(myAnim8->myMachine, ERR_INTERNAL, 0x02ff, "Error during ws_DoDisplay()");
+ }
+ // Lock the sprite handle
+ HLock(source->sourceHandle);
+ source->data = (uint8 *)((int32) * (source->sourceHandle) + source->sourceOffset);
+ }
+
+ RendGrBuff Destination;
+ DrawRequestX dr;
+ RendCell Frame;
+
+ Destination.Width = halScrnBuf->stride;
+ Destination.Height = halScrnBuf->h;
+ Destination.PixMap = (void *)halScrnBuf->data;
+
+ dr.x = myAnim8->myRegs[IDX_X] >> 16;
+ dr.y = myAnim8->myRegs[IDX_Y] >> 16;
+ dr.scale_x = myCCB->scaleX;
+ dr.scale_y = myCCB->scaleY;
+ dr.depth_map = screenCodeBuff->data;
+ dr.Pal = (RGBcolor *)myPalette;
+ dr.ICT = ICT;
+ dr.depth = myCCB->layer >> 8;
+
+ Frame.hot_x = myCCB->source->xOffset;
+ Frame.hot_y = myCCB->source->yOffset;
+ Frame.Width = source->w;
+ Frame.Height = source->h;
+ if ((!myPalette) || (!ICT)) {
+ Frame.Comp = (uint32)(source->encoding & 0x7f);
+ } else {
+ Frame.Comp = (uint32)source->encoding;
+ }
+ Frame.data = source->data;
+
+ // And draw the sprite
+ render_sprite_to_8BBM(&Destination, &dr, &Frame, clipRect, updateRect);
+ myCCB->flags &= ~CCB_REDRAW;
+
+ if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ //unlock the sprite's handle
+ HUnLock(source->sourceHandle);
+ }
+
+#else
+ error("TODO: DrawSprite");
+#endif
+}
+
+void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
+ uint8 *myPalette, uint8 *ICT, bool updateVideo) {
+ CCB *myCCB;
+ ScreenContext *myScreen;
+ RectList *myRect;
+ RectList *drawRectList = nullptr;
+ int32 status, scrnX1, scrnY1;
+ int32 restoreBgndX1, restoreBgndY1, restoreBgndX2, restoreBgndY2;
+ Anim8 *myAnim8;
+ M4Rect *currRect, intersectRect, noClipRect, dummyRect;
+ bool greyMode;
#ifdef TODO
+ Buffer drawSpriteBuff;
+ bool finished;
+ M4sprite *source;
+ uint8 myDepth;
+ M4Rect *newRect;
+ DrawRequest spriteDrawReq;
+#endif
+
+ if (((myScreen = vmng_screen_find(_G(gameDrawBuff), &status)) == nullptr) || (status != SCRN_ACTIVE)) {
+ return;
+ }
+
+ Buffer *halScrnBuf = _G(gameDrawBuff)->get_buffer();
+ noClipRect.x1 = 0;
+ noClipRect.y1 = 0;
+ noClipRect.x2 = halScrnBuf->W - 1;
+ noClipRect.y2 = halScrnBuf->h - 1;
+
+ scrnX1 = myScreen->x1;
+ scrnY1 = myScreen->y1;
+
+ greyMode = krn_GetGreyMode();
+
+ // Intialize the drawRectList to the deadRectList
+ drawRectList = _GWS(deadRectList);
+ _GWS(deadRectList) = nullptr;
+
+ // The drawRectList already contains all the areas of the screen that need the
+ // background updated
+ // Update the background behind the current rect list - if we are in greyMode, we do this later
+ if (background && background->data) {
+ myRect = drawRectList;
+ while (myRect) {
+ restoreBgndX1 = imath_max(myRect->x1, 0);
+ restoreBgndY1 = imath_max(myRect->y1, 0);
+ restoreBgndX2 = imath_min(myRect->x2, background->W - 1);
+ restoreBgndY2 = imath_min(myRect->y2, background->h - 1);
+ gr_buffer_rect_copy(background, halScrnBuf, restoreBgndX1, restoreBgndY1,
+ restoreBgndX2 - restoreBgndX1 + 1, restoreBgndY2 - restoreBgndY1 + 1);
+ myRect = myRect->next;
+ }
+ }
+
+ // Now we loop back to front and update the area of each sprite that intersects the update list,
+ // or simply draw the sprite if it has been marked for redraw
+ myAnim8 = _GWS(myCruncher)->backLayerAnim8;
+ while (myAnim8) {
+
+ myCCB = myAnim8->myCCB;
+ currRect = myCCB->currLocation;
+ if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW))) {
+ if (myCCB->flags & CCB_REDRAW) {
+
+ // Draw the sprite
+ DrawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT, &noClipRect, currRect);
+
+ // Add it's new location to the update list
+ vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1, currRect->x2, currRect->y2);
+ } else {
+
+ // Loop through the update list, intersect each rect with the sprites
+ // current location, and update redraw all overlapping areas
+ myRect = drawRectList;
+ while (myRect) {
+ intersectRect.x1 = imath_max(myRect->x1, currRect->x1);
+ intersectRect.y1 = imath_max(myRect->y1, currRect->y1);
+ intersectRect.x2 = imath_min(myRect->x2, currRect->x2);
+ intersectRect.y2 = imath_min(myRect->y2, currRect->y2);
+
+ // Now see if there was an intersection
+ if ((intersectRect.x1 <= intersectRect.x2) && (intersectRect.y1 <= intersectRect.y2)) {
+ // Draw just the intersected region
+ DrawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT, &intersectRect, &dummyRect);
+ }
+
+ // Next rect
+ myRect = myRect->next;
+ }
+ }
+ }
+ myAnim8 = myAnim8->infront;
+ }
+
+ myRect = drawRectList;
+ while (myRect) {
+ if (updateVideo) {
+ if (greyMode) {
+ krn_UpdateGreyArea(halScrnBuf, scrnX1, scrnY1, myRect->x1, myRect->y1, myRect->x2, myRect->y2);
+ }
+ RestoreScreens(scrnX1 + myRect->x1, scrnY1 + myRect->y1, scrnX1 + myRect->x2, scrnY1 + myRect->y2);
+ }
+ myRect = myRect->next;
+ }
+
+ _G(gameDrawBuff)->release();
+
+ // Turf the drawRectList
+ vmng_DisposeRectList(&drawRectList);
+}
+
+void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT) {
+ error("TODO: ws_hal_RefreshWoodscriptBuffer");
+}
+
+void GetBezCoeffs(frac16 *ctrlPoints, frac16 *coeffs) {
+ frac16 x0, x0mult3, x1mult3, x1mult6, x2mult3, x3;
+ frac16 y0, y0mult3, y1mult3, y1mult6, y2mult3, y3;
+
+ x0 = ctrlPoints[0];
+ x0mult3 = (x0 << 1) + x0;
+ x1mult3 = (ctrlPoints[2] << 1) + ctrlPoints[2];
+ x1mult6 = x1mult3 << 1;
+ x2mult3 = (ctrlPoints[4] << 1) + ctrlPoints[4];
+ x3 = ctrlPoints[6];
+
+ y0 = ctrlPoints[1];
+ y0mult3 = (y0 << 1) + y0;
+ y1mult3 = (ctrlPoints[3] << 1) + ctrlPoints[3];
+ y1mult6 = y1mult3 << 1;
+ y2mult3 = (ctrlPoints[5] << 1) + ctrlPoints[5];
+ y3 = ctrlPoints[7];
+
+ coeffs[0] = -(int)x0 + x1mult3 - x2mult3 + x3;
+ coeffs[2] = x0mult3 - x1mult6 + x2mult3;
+ coeffs[4] = -(int)x0mult3 + x1mult3;
+ coeffs[6] = x0;
+
+ coeffs[1] = -(int)y0 + y1mult3 - y2mult3 + y3;
+ coeffs[3] = y0mult3 - y1mult6 + y2mult3;
+ coeffs[5] = -(int)y0mult3 + y1mult3;
+ coeffs[7] = y0;
+
+ return;
+}
+
+void GetBezPoint(frac16 *x, frac16 *y, frac16 *coeffs, frac16 tVal) {
+
+ *x = coeffs[6] +
+ MulSF16(tVal, (coeffs[4] +
+ MulSF16(tVal, (coeffs[2] +
+ MulSF16(tVal, coeffs[0])))));
+
+ *y = coeffs[7] +
+ MulSF16(tVal, (coeffs[5] +
+ MulSF16(tVal, (coeffs[3] +
+ MulSF16(tVal, coeffs[1])))));
+
+ return;
+}
+
+bool InitCCB(CCB *myCCB) {
+ myCCB->flags = CCB_SKIP;
+ myCCB->source = nullptr;
+ if ((myCCB->currLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "Rectangle")) == nullptr) {
+ return false;
+ }
+ myCCB->currLocation->x1 = -1;
+ myCCB->currLocation->y1 = -1;
+ myCCB->currLocation->x2 = -1;
+ myCCB->currLocation->y2 = -1;
+ if ((myCCB->newLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "Rectangle")) == nullptr) {
+ return false;
+ }
+ myCCB->newLocation->x1 = -1;
+ myCCB->newLocation->y1 = -1;
+ myCCB->newLocation->x2 = -1;
+ myCCB->newLocation->y2 = -1;
+
+ myCCB->maxArea = nullptr;
+ myCCB->scaleX = 0;
+ myCCB->scaleY = 0;
+ myCCB->layer = 0;
+ myCCB->streamSSHeader = nullptr;
+ myCCB->streamSpriteSource = nullptr;
+ myCCB->myStream = nullptr;
+ myCCB->seriesName = nullptr;
+
+ return true;
+}
+
+void HideCCB(CCB *myCCB) {
+ if (!myCCB)
+ return;
+ myCCB->flags |= CCB_HIDE;
+
+ if ((myCCB->flags & CCB_STREAM) && myCCB->maxArea) {
+ vmng_AddRectToRectList(&_GWS(deadRectList), myCCB->maxArea->x1, myCCB->maxArea->y1, myCCB->maxArea->x2, myCCB->maxArea->y2);
+ mem_free(myCCB->maxArea);
+ myCCB->maxArea = nullptr;
+ } else {
+ vmng_AddRectToRectList(&_GWS(deadRectList), myCCB->currLocation->x1, myCCB->currLocation->y1, myCCB->currLocation->x2, myCCB->currLocation->y2);
+ }
+}
+
+void ShowCCB(CCB *myCCB) {
+ if (!myCCB)
+ return;
+
+ myCCB->flags &= ~CCB_HIDE;
+}
+
+void MoveCCB(CCB *myCCB, frac16 deltaX, frac16 deltaY) {
+ if (!myCCB || !myCCB->source) {
+ error_show(FL, 'WSIC');
+ }
+
+ myCCB->newLocation->x1 = myCCB->currLocation->x1 + (deltaX >> 16);
+ myCCB->newLocation->y1 = myCCB->currLocation->y1 + (deltaY >> 16);
+ myCCB->newLocation->x2 = myCCB->currLocation->x2 + (deltaX >> 16);
+ myCCB->newLocation->y2 = myCCB->currLocation->y2 + (deltaY >> 16);
+
+ if (myCCB->flags & CCB_STREAM) {
+ if (!myCCB->maxArea) {
+ if ((myCCB->maxArea = (M4Rect *)mem_alloc(sizeof(M4Rect), "Rectangle")) == nullptr) {
+ error_show(FL, 'OOM!');
+ }
+ myCCB->maxArea->x1 = myCCB->newLocation->x1;
+ myCCB->maxArea->y1 = myCCB->newLocation->y1;
+ myCCB->maxArea->x2 = myCCB->newLocation->x2;
+ myCCB->maxArea->y2 = myCCB->newLocation->y2;
+ } else {
+ myCCB->maxArea->x1 = imath_min(myCCB->maxArea->x1, myCCB->newLocation->x1);
+ myCCB->maxArea->y1 = imath_min(myCCB->maxArea->y1, myCCB->newLocation->y1);
+ myCCB->maxArea->x2 = imath_max(myCCB->maxArea->x2, myCCB->newLocation->x2);
+ myCCB->maxArea->y2 = imath_max(myCCB->maxArea->y2, myCCB->newLocation->y2);
+ }
+ }
+
+ if ((myCCB->source->w != 0) && (myCCB->source->h != 0)) {
+ myCCB->flags |= CCB_REDRAW;
+ }
+}
+
+void KillCCB(CCB *myCCB, bool restoreFlag) {
if (!myCCB) {
error_show(FL, 'WSIC');
}
if (restoreFlag && (!(myCCB->flags & CCB_SKIP)) && (!(myCCB->flags & CCB_HIDE))) {
if ((myCCB->flags & CCB_STREAM) && myCCB->maxArea) {
- vmng_AddRectToRectList(&_G(deadRectList), myCCB->maxArea->x1, myCCB->maxArea->y1,
+ vmng_AddRectToRectList(&_GWS(deadRectList), myCCB->maxArea->x1, myCCB->maxArea->y1,
myCCB->maxArea->x2, myCCB->maxArea->y2);
} else {
- vmng_AddRectToRectList(&_G(deadRectList), myCCB->currLocation->x1, myCCB->currLocation->y1,
+ vmng_AddRectToRectList(&_GWS(deadRectList), myCCB->currLocation->x1, myCCB->currLocation->y1,
myCCB->currLocation->x2, myCCB->currLocation->y2);
}
}
@@ -54,19 +474,83 @@ void KillCCB(CCB *myCCB, bool restoreFlag) {
ws_CloseSSstream(myCCB);
}
if (myCCB->currLocation) {
- mem_free((void *)myCCB->currLocation);
+ mem_free(myCCB->currLocation);
}
if (myCCB->newLocation) {
- mem_free((void *)myCCB->newLocation);
+ mem_free(myCCB->newLocation);
}
if (myCCB->maxArea) {
- mem_free((void *)myCCB->maxArea);
+ mem_free(myCCB->maxArea);
}
if (myCCB->source) {
- mem_free((char *)myCCB->source);
+ mem_free(myCCB->source);
}
- mem_free((void *)myCCB);
-#endif
+
+ mem_free(myCCB);
+}
+
+void Cel_msr(Anim8 *myAnim8) {
+ CCB *myCCB;
+ frac16 *myRegs;
+ int32 scaler;
+
+ if (!myAnim8) {
+ error_show(FL, 'WSAI');
+ }
+
+ myCCB = myAnim8->myCCB;
+ if ((!myCCB) || (!myCCB->source)) {
+ error_show(FL, 'WSIC');
+ }
+
+ if ((myCCB->source->w == 0) || (myCCB->source->h == 0)) {
+ return;
+ }
+
+ myRegs = myAnim8->myRegs;
+ if (!myRegs) {
+ error_show(FL, 'WSAI');
+ }
+
+ scaler = FixedMul(myRegs[IDX_S], 100 << 16) >> 16;
+
+ myCCB->scaleX = myRegs[IDX_W] < 0 ? -scaler : scaler;
+ myCCB->scaleY = scaler;
+
+ GetUpdateRectangle(myRegs[IDX_X] >> 16, myRegs[IDX_Y] >> 16, myCCB->source->xOffset, myCCB->source->yOffset,
+ myCCB->scaleX, myCCB->scaleY, myCCB->source->w, myCCB->source->h, myCCB->newLocation);
+ if (myCCB->flags & CCB_STREAM) {
+ if (!myCCB->maxArea) {
+ if ((myCCB->maxArea = (M4Rect *)mem_alloc(sizeof(M4Rect), "Rectangle")) == nullptr) {
+ error_show(FL, 'OOM!');
+ }
+ myCCB->maxArea->x1 = myCCB->newLocation->x1;
+ myCCB->maxArea->y1 = myCCB->newLocation->y1;
+ myCCB->maxArea->x2 = myCCB->newLocation->x2;
+ myCCB->maxArea->y2 = myCCB->newLocation->y2;
+ } else {
+ myCCB->maxArea->x1 = imath_min(myCCB->maxArea->x1, myCCB->newLocation->x1);
+ myCCB->maxArea->y1 = imath_min(myCCB->maxArea->y1, myCCB->newLocation->y1);
+ myCCB->maxArea->x2 = imath_max(myCCB->maxArea->x2, myCCB->newLocation->x2);
+ myCCB->maxArea->y2 = imath_max(myCCB->maxArea->y2, myCCB->newLocation->y2);
+ }
+ } else {
+ vmng_AddRectToRectList(&_GWS(deadRectList), myCCB->currLocation->x1, myCCB->currLocation->y1,
+ myCCB->currLocation->x2, myCCB->currLocation->y2);
+ }
+
+ myAnim8->flags &= ~(TAG_MAP_CEL | TAG_MOVE_CEL);
+ myCCB->layer = imath_max(0, myAnim8->myLayer);
+ myCCB->flags &= ~CCB_SKIP;
+ myCCB->flags |= CCB_REDRAW;
+ return;
+}
+
+void ws_OverrideCrunchTime(machine *m) {
+ if ((!m) || (!m->myAnim8)) {
+ return;
+ }
+ m->myAnim8->switchTime = 0;
}
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index c11dd7be373..36cad42320d 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -24,17 +24,47 @@
#define M4_WSCRIPT_WS_HAL_H
#include "m4/wscript/ws_machine.h"
+#include "m4/wscript/ws_cruncher.h"
namespace M4 {
+#define CCB_SKIP 0x0001
+#define CCB_HIDE 0x0002
+#define CCB_REDRAW 0x0004
+#define CCB_STREAM 0x0008
+#define CCB_DISC_STREAM 0x0010
+
+#define CCB_NO_DRAW (CCB_SKIP | CCB_HIDE)
+
+#define ERR_INTERNAL 0
+#define ERR_SEQU 1
+#define ERR_MACH 2
+
struct WSHal_Globals {
RectList *_deadRectList;
- int32 _pcOffsetOld;
};
extern bool ws_InitHAL();
extern void ws_KillHAL();
+
+extern void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
+ uint8 *myPalette, uint8 *ICT, bool updateVideo);
+extern void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
+extern void GetBezCoeffs(frac16 *ctrlPoints, frac16 *coeffs);
+extern void GetBezPoint(frac16 *x, frac16 *y, frac16 *coeffs, frac16 tVal);
+extern bool InitCCB(CCB *myCCB);
+extern void HideCCB(CCB *myCCB);
+extern void ShowCCB(CCB *myCCB);
+//extern void SetLastCCB(CCB *myCCB);
+extern void MoveCCB(CCB *myCCB, frac16 deltaX, frac16 deltaY);
extern void KillCCB(CCB *myCCB, bool restoreFlag);
+extern void Cel_msr(Anim8 *myAnim8);
+extern void ws_OverrideCrunchTime(machine *m);
+
+extern bool CheckAddr();
+extern void ws_Error(machine *m, int32 errorType, quadchar errorCode, const char *errMsg);
+extern void ws_DumpMachine(machine *m);
+extern void ws_LogErrorMsg(char *sourceFile, int32 lineNum, char *fmt, ...);
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 09efb239740..2fd2443d373 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -21,6 +21,7 @@
#include "m4/wscript/ws_load.h"
#include "m4/wscript/ws_machine.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/graphics/graphics.h"
@@ -29,6 +30,30 @@
namespace M4 {
+#define CHUNK_MACH 0x4D414348 //'MACH'
+#define CHUNK_SEQU 0x53455155 //'SEQU'
+#define CHUNK_DATA 0x44415441 //'DATA'
+#define CHUNK_CELS 0x43454C53 //'CELS'
+
+#define CHUNK_NECS 0x4E454353 //INTEL 'SCEN'
+#define CHUNK_HCAM 0x4843414D //INTEL 'MACH'
+#define CHUNK_UQES 0x55514553 //INTEL 'SEQU'
+#define CHUNK_SLEC 0x534C4543 //INTEL 'CELS'
+#define CHUNK_ATAD 0x41544144 //INTEL 'DATA'
+
+#define MACH_NUM_STATES 0
+#define MACH_OFFSETS 1
+
+#define SEQU_NUM_VARS 0
+#define SEQU_SEQU_START 1
+
+#define DATA_REC_COUNT 0
+#define DATA_REC_SIZE 1
+#define DATA_REC_START 2
+
+#define MAX_ASSET_HASH 255
+
+
static bool GetNextint32(char **assetPtr, char *endOfAssetBlock, uint32 **returnVal);
static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char * /*mainAssetPtr*/, char *endOfAssetBlock,
int32 **dataOffset, int32 **palDataOffset, RGB8 *myPalette);
@@ -38,80 +63,80 @@ bool InitWSAssets() {
int32 i;
// Make sure this is only called once.
- if (_G(wsloaderInitialized)) {
+ if (_GWS(wsloaderInitialized)) {
error_show(FL, 'WSSN');
}
// Allocate space for the tables used by the loader and the resource io MACHine tables
- if ((_G(globalMACHnames) = (char **)mem_alloc(sizeof(char *) * 256, "MACH resource table")) == nullptr) {
+ if ((_GWS(globalMACHnames) = (char **)mem_alloc(sizeof(char *) * 256, "MACH resource table")) == nullptr) {
return false;
}
- if ((_G(globalMACHHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ if ((_GWS(globalMACHHandles) = (MemHandle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
return false;
}
- if ((_G(globalMACHoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "MACH offsets table")) == nullptr) {
+ if ((_GWS(globalMACHoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "MACH offsets table")) == nullptr) {
return false;
}
for (i = 0; i < 256; i++) {
- _G(globalMACHnames)[i] = nullptr;
- _G(globalMACHHandles)[i] = nullptr;
- _G(globalMACHoffsets)[i] = -1;
+ _GWS(globalMACHnames)[i] = nullptr;
+ _GWS(globalMACHHandles)[i] = nullptr;
+ _GWS(globalMACHoffsets)[i] = -1;
}
// SEQUence tables
- if ((_G(globalSEQUnames) = (char **)mem_alloc(sizeof(char *) * 256, "SEQU resource table")) == nullptr) {
+ if ((_GWS(globalSEQUnames) = (char **)mem_alloc(sizeof(char *) * 256, "SEQU resource table")) == nullptr) {
return false;
}
- if ((_G(globalSEQUHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ if ((_GWS(globalSEQUHandles) = (MemHandle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
return false;
}
- if ((_G(globalSEQUoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "SEQU offsets table")) == nullptr) {
+ if ((_GWS(globalSEQUoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "SEQU offsets table")) == nullptr) {
return false;
}
for (i = 0; i < 256; i++) {
- _G(globalSEQUnames)[i] = nullptr;
- _G(globalSEQUHandles)[i] = nullptr;
- _G(globalSEQUoffsets)[i] = -1;
+ _GWS(globalSEQUnames)[i] = nullptr;
+ _GWS(globalSEQUHandles)[i] = nullptr;
+ _GWS(globalSEQUoffsets)[i] = -1;
}
// DATA tables
- if ((_G(globalDATAnames) = (char **)mem_alloc(sizeof(char *) * 256, "DATA resource table")) == nullptr) {
+ if ((_GWS(globalDATAnames) = (char **)mem_alloc(sizeof(char *) * 256, "DATA resource table")) == nullptr) {
return false;
}
- if ((_G(globalDATAHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ if ((_GWS(globalDATAHandles) = (MemHandle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
return false;
}
- if ((_G(globalDATAoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "DATA offsets table")) == nullptr) {
+ if ((_GWS(globalDATAoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "DATA offsets table")) == nullptr) {
return false;
}
for (i = 0; i < 256; i++) {
- _G(globalDATAnames)[i] = nullptr;
- _G(globalDATAHandles)[i] = nullptr;
- _G(globalDATAoffsets)[i] = -1;
+ _GWS(globalDATAnames)[i] = nullptr;
+ _GWS(globalDATAHandles)[i] = nullptr;
+ _GWS(globalDATAoffsets)[i] = -1;
}
// CELS tables
- if ((_G(globalCELSnames) = (char **)mem_alloc(sizeof(char *) * 256, "CELS resource table")) == nullptr) {
+ if ((_GWS(globalCELSnames) = (char **)mem_alloc(sizeof(char *) * 256, "CELS resource table")) == nullptr) {
return false;
}
- if ((_G(globalCELSHandles) = (Handle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
+ if ((_GWS(globalCELSHandles) = (MemHandle *)mem_alloc(sizeof(Handle) * 256, "CELS Handles table")) == nullptr) {
return false;
}
- if ((_G(globalCELSoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS offsets table")) == nullptr) {
+ if ((_GWS(globalCELSoffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS offsets table")) == nullptr) {
return false;
}
- if ((_G(globalCELSPaloffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS pal offsets table")) == nullptr) {
+ if ((_GWS(globalCELSPaloffsets) = (int32 *)mem_alloc(sizeof(int32 *) * 256, "CELS pal offsets table")) == nullptr) {
return false;
}
for (i = 0; i < 256; i++) {
- _G(globalCELSnames)[i] = nullptr;
- _G(globalCELSHandles)[i] = nullptr;
- _G(globalCELSoffsets)[i] = -1;
- _G(globalCELSPaloffsets)[i] = -1;
+ _GWS(globalCELSnames)[i] = nullptr;
+ _GWS(globalCELSHandles)[i] = nullptr;
+ _GWS(globalCELSoffsets)[i] = -1;
+ _GWS(globalCELSPaloffsets)[i] = -1;
}
- //set the global to indicate the loader is active
- _G(wsloaderInitialized) = true;
+ // Set the global to indicate the loader is active
+ _GWS(wsloaderInitialized) = true;
return true;
}
@@ -119,7 +144,7 @@ bool InitWSAssets() {
bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
int32 i;
- if (!_G(wsloaderInitialized)) {
+ if (!_GWS(wsloaderInitialized)) {
return false;
}
@@ -131,15 +156,15 @@ bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
switch (assetType) {
case _WS_ASSET_MACH:
- //clear the machines table for entries [minHash, maxHash]
+ // Clear the machines table for entries [minHash, maxHash]
for (i = minHash; i <= maxHash; i++) {
TerminateMachinesByHash(i);
- if (_G(globalMACHnames)[i]) {
- rtoss(_G(globalMACHnames)[i]);
- mem_free(_G(globalMACHnames)[i]);
- _G(globalMACHnames)[i] = nullptr;
- _G(globalMACHHandles)[i] = nullptr;
- _G(globalMACHoffsets)[i] = -1;
+ if (_GWS(globalMACHnames)[i]) {
+ rtoss(_GWS(globalMACHnames)[i]);
+ mem_free(_GWS(globalMACHnames)[i]);
+ _GWS(globalMACHnames)[i] = nullptr;
+ _GWS(globalMACHHandles)[i] = nullptr;
+ _GWS(globalMACHoffsets)[i] = -1;
}
}
break;
@@ -147,39 +172,39 @@ bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
case _WS_ASSET_SEQU:
// Clear the sequences table for entries [minHash, maxHash]
for (i = minHash; i <= maxHash; i++) {
- if (_G(globalSEQUnames)[i]) {
- rtoss(_G(globalSEQUnames)[i]);
- mem_free(_G(globalSEQUnames)[i]);
- _G(globalSEQUnames)[i] = nullptr;
- _G(globalSEQUHandles)[i] = nullptr;
- _G(globalSEQUoffsets)[i] = -1;
+ if (_GWS(globalSEQUnames)[i]) {
+ rtoss(_GWS(globalSEQUnames)[i]);
+ mem_free(_GWS(globalSEQUnames)[i]);
+ _GWS(globalSEQUnames)[i] = nullptr;
+ _GWS(globalSEQUHandles)[i] = nullptr;
+ _GWS(globalSEQUoffsets)[i] = -1;
}
}
break;
case _WS_ASSET_DATA:
- //clear the data table for entries [minHash, maxHash]
+ // Clear the data table for entries [minHash, maxHash]
for (i = minHash; i <= maxHash; i++) {
- if (_G(globalDATAnames)[i]) {
- rtoss(_G(globalDATAnames)[i]);
- mem_free(_G(globalDATAnames)[i]);
- _G(globalDATAnames)[i] = nullptr;
- _G(globalDATAHandles)[i] = nullptr;
- _G(globalDATAoffsets)[i] = -1;
+ if (_GWS(globalDATAnames)[i]) {
+ rtoss(_GWS(globalDATAnames)[i]);
+ mem_free(_GWS(globalDATAnames)[i]);
+ _GWS(globalDATAnames)[i] = nullptr;
+ _GWS(globalDATAHandles)[i] = nullptr;
+ _GWS(globalDATAoffsets)[i] = -1;
}
}
break;
case _WS_ASSET_CELS:
- //clear the cels tables for entries [minHash, maxHash]
+ // Clear the cels tables for entries [minHash, maxHash]
for (i = minHash; i <= maxHash; i++) {
- if (_G(globalCELSnames)[i]) {
- rtoss(_G(globalCELSnames)[i]);
- mem_free(_G(globalCELSnames)[i]);
- _G(globalCELSnames)[i] = nullptr;
- _G(globalCELSHandles)[i] = nullptr;
- _G(globalCELSoffsets)[i] = -1;
- _G(globalCELSPaloffsets)[i] = -1;
+ if (_GWS(globalCELSnames)[i]) {
+ rtoss(_GWS(globalCELSnames)[i]);
+ mem_free(_GWS(globalCELSnames)[i]);
+ _GWS(globalCELSnames)[i] = nullptr;
+ _GWS(globalCELSHandles)[i] = nullptr;
+ _GWS(globalCELSoffsets)[i] = -1;
+ _GWS(globalCELSPaloffsets)[i] = -1;
}
}
break;
@@ -191,7 +216,7 @@ bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
}
void ShutdownWSAssets(void) {
- if (!_G(wsloaderInitialized))
+ if (!_GWS(wsloaderInitialized))
return;
// For each asset type, clear the entire table
@@ -201,22 +226,22 @@ void ShutdownWSAssets(void) {
ClearWSAssets(_WS_ASSET_DATA, 0, MAX_ASSET_HASH);
// Deallocate all tables
- if (_G(globalMACHnames)) mem_free(_G(globalMACHnames));
- if (_G(globalSEQUnames)) mem_free(_G(globalSEQUnames));
- if (_G(globalDATAnames)) mem_free(_G(globalDATAnames));
- if (_G(globalCELSnames)) mem_free(_G(globalCELSnames));
-
- if (_G(globalMACHHandles)) mem_free(_G(globalMACHHandles));
- if (_G(globalMACHoffsets)) mem_free(_G(globalMACHoffsets));
- if (_G(globalSEQUHandles)) mem_free(_G(globalSEQUHandles));
- if (_G(globalSEQUoffsets)) mem_free(_G(globalSEQUoffsets));
- if (_G(globalDATAHandles)) mem_free(_G(globalDATAHandles));
- if (_G(globalDATAoffsets)) mem_free(_G(globalDATAoffsets));
- if (_G(globalCELSHandles)) mem_free(_G(globalCELSHandles));
- if (_G(globalCELSoffsets)) mem_free(_G(globalCELSoffsets));
- if (_G(globalCELSPaloffsets)) mem_free(_G(globalCELSPaloffsets));
-
- _G(wsloaderInitialized) = false;
+ if (_GWS(globalMACHnames)) mem_free(_GWS(globalMACHnames));
+ if (_GWS(globalSEQUnames)) mem_free(_GWS(globalSEQUnames));
+ if (_GWS(globalDATAnames)) mem_free(_GWS(globalDATAnames));
+ if (_GWS(globalCELSnames)) mem_free(_GWS(globalCELSnames));
+
+ if (_GWS(globalMACHHandles)) mem_free(_GWS(globalMACHHandles));
+ if (_GWS(globalMACHoffsets)) mem_free(_GWS(globalMACHoffsets));
+ if (_GWS(globalSEQUHandles)) mem_free(_GWS(globalSEQUHandles));
+ if (_GWS(globalSEQUoffsets)) mem_free(_GWS(globalSEQUoffsets));
+ if (_GWS(globalDATAHandles)) mem_free(_GWS(globalDATAHandles));
+ if (_GWS(globalDATAoffsets)) mem_free(_GWS(globalDATAoffsets));
+ if (_GWS(globalCELSHandles)) mem_free(_GWS(globalCELSHandles));
+ if (_GWS(globalCELSoffsets)) mem_free(_GWS(globalCELSoffsets));
+ if (_GWS(globalCELSPaloffsets)) mem_free(_GWS(globalCELSPaloffsets));
+
+ _GWS(wsloaderInitialized) = false;
}
bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
@@ -230,7 +255,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
int32 assetSize;
// Check that the loader has been initialized
- if (!_G(wsloaderInitialized)) {
+ if (!_GWS(wsloaderInitialized)) {
error_show(FL, 'WSLI');
}
@@ -285,9 +310,9 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
ClearWSAssets(_WS_ASSET_MACH, *chunkHash, *chunkHash);
// Store the resource name, and the offset into the resource block
- _G(globalMACHnames)[*chunkHash] = mem_strdup(wsAssetName);
- _G(globalMACHHandles)[*chunkHash] = workHandle;
- _G(globalMACHoffsets)[*chunkHash] = parseAssetPtr - mainAssetPtr;
+ _GWS(globalMACHnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _GWS(globalMACHHandles)[*chunkHash] = workHandle;
+ _GWS(globalMACHoffsets)[*chunkHash] = parseAssetPtr - mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -324,9 +349,9 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
ClearWSAssets(_WS_ASSET_SEQU, *chunkHash, *chunkHash);
// Store the resource name, and the offset into the resource block
- _G(globalSEQUnames)[*chunkHash] = mem_strdup(wsAssetName);
- _G(globalSEQUHandles)[*chunkHash] = workHandle;
- _G(globalSEQUoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+ _GWS(globalSEQUnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _GWS(globalSEQUHandles)[*chunkHash] = workHandle;
+ _GWS(globalSEQUoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -363,9 +388,9 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
ClearWSAssets(_WS_ASSET_DATA, *chunkHash, *chunkHash);
// Store the resource name, and the offset into the resource block
- _G(globalDATAnames)[*chunkHash] = mem_strdup(wsAssetName);
- _G(globalDATAHandles)[*chunkHash] = workHandle;
- _G(globalDATAoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+ _GWS(globalDATAnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _GWS(globalDATAHandles)[*chunkHash] = workHandle;
+ _GWS(globalDATAoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -401,7 +426,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
ClearWSAssets(_WS_ASSET_CELS, *chunkHash, *chunkHash);
// Store the resource name
- _G(globalCELSnames)[*chunkHash] = mem_strdup(wsAssetName);
+ _GWS(globalCELSnames)[*chunkHash] = mem_strdup(wsAssetName);
// Process the SS from the stream file
if (ProcessCELS(wsAssetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette) < 0) {
@@ -410,16 +435,16 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// At this point, celsPtr points to the beginning of the cels data, palPtr to the pal data
// Store the Handle, and calculate the offsets
- _G(globalCELSHandles)[*chunkHash] = workHandle;
+ _GWS(globalCELSHandles)[*chunkHash] = workHandle;
if (celsPtr) {
- _G(globalCELSoffsets)[*chunkHash] = (int32)celsPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSoffsets)[*chunkHash] = (int32)celsPtr - (int32)mainAssetPtr;
} else {
- _G(globalCELSoffsets)[*chunkHash] = -1;
+ _GWS(globalCELSoffsets)[*chunkHash] = -1;
}
if (palPtr) {
- _G(globalCELSPaloffsets)[*chunkHash] = (int32)palPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[*chunkHash] = (int32)palPtr - (int32)mainAssetPtr;
} else {
- _G(globalCELSPaloffsets)[*chunkHash] = -1;
+ _GWS(globalCELSPaloffsets)[*chunkHash] = -1;
}
break;
@@ -624,7 +649,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
int32 emptySlot, i, assetSize, *celsPtr, *palPtr;
// Check that the loader has been initialized
- if (!_G(wsloaderInitialized)) {
+ if (!_GWS(wsloaderInitialized)) {
error_show(FL, 'WSLI', "Asset Name: %s", wsAssetName);
}
@@ -635,8 +660,8 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Search through the SS names table
for (i = 0; i <= MAX_ASSET_HASH; i++) {
// See if there is something loaded in this slot
- if (_G(globalCELSnames)[i]) {
- if (!strcmp(_G(globalCELSnames)[i], wsAssetName)) {
+ if (_GWS(globalCELSnames)[i]) {
+ if (!strcmp(_GWS(globalCELSnames)[i], wsAssetName)) {
break;
}
} else if (emptySlot < 0) {
@@ -652,12 +677,12 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
}
// Check to see if the SS is already loaded in the given hash slot
- if (_G(globalCELSnames)[hash] && (!strcmp(_G(globalCELSnames)[hash], wsAssetName))) {
- if (_G(globalCELSPaloffsets)[hash] >= 0) {
+ if (_GWS(globalCELSnames)[hash] && (!strcmp(_GWS(globalCELSnames)[hash], wsAssetName))) {
+ if (_GWS(globalCELSPaloffsets)[hash] >= 0) {
// Get the pointer to the pal data
#ifdef TODO
- workHandle = _G(globalCELSHandles)[hash];
- palPtr = (int32 *)((int32)*workHandle + _G(globalCELSPaloffsets)[hash]);
+ workHandle = _GWS(globalCELSHandles)[hash];
+ palPtr = (int32 *)((int32)*workHandle + _GWS(globalCELSPaloffsets)[hash]);
#else
error("TODO: Figure out dereferencing");
#endif
@@ -680,7 +705,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// we found an empty slot to load the SS into
if ((i > MAX_ASSET_HASH) && (emptySlot >= 0)) {
- if ((workHandle = rget(wsAssetName, &assetSize)) == NULL) {
+ if ((workHandle = rget(wsAssetName, &assetSize)) == nullptr) {
error_show(FL, 'FNF!', (char *)wsAssetName);
}
@@ -694,7 +719,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
ClearWSAssets(_WS_ASSET_CELS, emptySlot, emptySlot);
// Store the resource name
- _G(globalCELSnames)[emptySlot] = mem_strdup(wsAssetName);
+ _GWS(globalCELSnames)[emptySlot] = mem_strdup(wsAssetName);
// Process the SS from the stream file
if (ProcessCELS(wsAssetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette) < 0) {
@@ -703,16 +728,16 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// At this point, celsPtr points to the beginning of the cels data, palPtr to the pal data
// Store the Handle, and calculate the offsets
- _G(globalCELSHandles)[emptySlot] = workHandle;
+ _GWS(globalCELSHandles)[emptySlot] = workHandle;
if (celsPtr) {
- _G(globalCELSoffsets)[emptySlot] = (int32)celsPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSoffsets)[emptySlot] = (int32)celsPtr - (int32)mainAssetPtr;
} else {
- _G(globalCELSoffsets)[emptySlot] = -1;
+ _GWS(globalCELSoffsets)[emptySlot] = -1;
}
if (palPtr) {
- _G(globalCELSPaloffsets)[emptySlot] = (int32)palPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[emptySlot] = (int32)palPtr - (int32)mainAssetPtr;
} else {
- _G(globalCELSPaloffsets)[emptySlot] = -1;
+ _GWS(globalCELSPaloffsets)[emptySlot] = -1;
}
// Unlock the handle
@@ -721,12 +746,12 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
return emptySlot;
} else if (i < MAX_ASSET_HASH) {
// Else if we found the SS already loaded
- if (_G(globalCELSPaloffsets)[i] >= 0) {
+ if (_GWS(globalCELSPaloffsets)[i] >= 0) {
// Get the pointer to the pal data
#ifdef TODO
- workHandle = _G(globalCELSHandles)[i];
+ workHandle = _GWS(globalCELSHandles)[i];
HLock(workHandle);
- palPtr = (int32 *)((int32)*workHandle + _G(globalCELSPaloffsets)[i]);
+ palPtr = (int32 *)((int32)*workHandle + _GWS(globalCELSPaloffsets)[i]);
#else
error("TODO: Figure out dereferencing");
#endif
@@ -764,7 +789,7 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
uint32 *tempPtr, *celsSize, *data, *dataPtr, *offsetPtr, i, j, *header, *format;
bool byteSwap;
- if (!_G(wsloaderInitialized))
+ if (!_GWS(wsloaderInitialized))
return -1;
*dataOffset = nullptr;
@@ -970,4 +995,875 @@ static void RestoreSSPaletteInfo(RGB8 *myPalette, int32 *palPtr) {
}
}
+M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries) {
+ MemHandle workHandle;
+ int32 i;
+
+ // Ensure wsloader has been initialized
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return nullptr;
+ }
+
+ // If spriteName is specified, we search by name, otherwise hash is assumed to be correct
+ if (spriteName) {
+ if (!_GWS(globalCELSnames)) return nullptr;
+ for (i = 0; i <= MAX_ASSET_HASH; i++) {
+ if (!strcmp(spriteName, _GWS(globalCELSnames)[i])) {
+ break;
+ }
+ }
+ hash = i;
+ }
+
+ // Check for valid index, and sprite loaded at that index
+ if (hash > MAX_ASSET_HASH) {
+ if (spriteName) {
+ ws_LogErrorMsg(FL, "Sprite series is not in memory: %s.", spriteName);
+ } else {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld.", hash);
+ }
+ }
+
+ // Get the resource handle
+ workHandle = _GWS(globalCELSHandles)[hash];
+
+ // Create the sprite
+ mySprite = CreateSprite(workHandle, _GWS(globalCELSoffsets)[hash], index, mySprite, streamSeries);
+
+ // Check the sprite
+ if (!mySprite) {
+ ws_LogErrorMsg(FL, "Series: %s, Hash: %ld, index: %ld", _GWS(globalCELSnames)[hash], hash, index);
+ }
+
+ return mySprite;
+}
+
+
+int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+ MemHandle workHandle;
+ int32 celsSize, *celsPtr, *palPtr;
+ char *mainAssetPtr, *endOfAssetBlock, *parseAssetPtr;
+ int32 assetSize;
+
+ //This loads a sprite series into the provided vars, rather than the WS tables.
+ //The WS loader is not involved with this procedure.
+
+ // Load in the sprite series
+ if ((workHandle = rget(assetName, &assetSize)) == nullptr)
+ error_show(FL, 'FNF!', "Sprite series: %s", assetName);
+
+ HLock(workHandle);
+
+ mainAssetPtr = (char *)*workHandle;
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ parseAssetPtr = mainAssetPtr;
+
+ // Process the SS from the stream file
+ if ((celsSize = ProcessCELS(assetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette)) < 0) {
+ error_show(FL, 'WSLP', "series: %s", assetName);
+ }
+
+ // Store the handle and offsets
+ *seriesHandle = workHandle;
+ *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
+ *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+
+ HUnLock(workHandle);
+
+ return celsSize;
+}
+
+int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette) {
+ MemHandle workHandle;
+ Common::File f;
+ int32 celsSize, *celsPtr, *palPtr;
+ char *mainAssetPtr, *endOfAssetBlock, *parseAssetPtr;
+ uint32 assetSize;
+
+ // This loads a sprite series into the provided vars, rather than the WS tables.
+ // The WS loader is not involved with this procedure.
+
+ // First open the file
+ if (!f.open(assetName))
+ return -1;
+
+ // Get the size
+ assetSize = f.size();
+
+ // Create a handle big enough to hold the contents of the file
+ if ((workHandle = NewHandle(assetSize, "ss file")) == nullptr) {
+ f.close();
+ return -1;
+ }
+
+ // Lock the handle and read the contents of the file intoit
+ HLock(workHandle);
+ mainAssetPtr = (char *)*workHandle;
+ if (f.read(mainAssetPtr, assetSize) < assetSize) {
+ f.close();
+ return -1;
+ }
+
+ // Close the file
+ f.close();
+
+ // Set up some pointers
+ endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ parseAssetPtr = mainAssetPtr;
+
+ // Process the SS from the stream file
+ if ((celsSize = ProcessCELS(assetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette)) < 0) {
+ error_show(FL, 'WSLP', "series: %s", assetName);
+ }
+
+ // Store the handle and offsets
+ *seriesHandle = workHandle;
+ *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
+ *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ HUnLock(workHandle);
+
+ return celsSize;
+}
+
+CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB) {
+ bool streamSeries;
+ M4sprite *mySprite;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return false;
+ }
+
+ //If a memory location to store the CCB has not been provided...
+ if (!myCCB) {
+ // Create the CCB struct
+ if ((myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(CCB));
+ return nullptr;
+ }
+
+ // Create the CCB current location and new location rectangles
+ if ((myCCB->currLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "M4Rect")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(M4Rect));
+ return nullptr;
+ }
+ myCCB->currLocation->x1 = 0;
+ myCCB->currLocation->y1 = 0;
+ myCCB->currLocation->x2 = 0;
+ myCCB->currLocation->y2 = 0;
+ if ((myCCB->newLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "M4Rect")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(M4Rect));
+ return nullptr;
+ }
+ myCCB->maxArea = nullptr;
+ myCCB->source = nullptr;
+ }
+
+ //The source for a CCB is a sprite. create the sprite from the WS tables hash, index
+ mySprite = myCCB->source;
+ if ((mySprite = GetWSAssetSprite(nullptr, hash, index, mySprite, &streamSeries)) == nullptr) {
+ // Term messages for whatever went wrong are printed from within GetWSAssetSprite()
+ return nullptr;
+ }
+ myCCB->source = mySprite;
+ if (streamSeries) {
+ myCCB->flags |= CCB_STREAM;
+ }
+
+ //Initialize the CCB and return
+ myCCB->newLocation->x1 = 0;
+ myCCB->newLocation->y1 = 0;
+ myCCB->newLocation->x2 = 0;
+ myCCB->newLocation->y2 = 0;
+ myCCB->scaleX = 0;
+ myCCB->scaleY = 0;
+ myCCB->seriesName = _GWS(globalCELSnames)[hash];
+ return myCCB;
+}
+
+int32 GetWSAssetCELCount(uint32 hash) {
+ uint32 *celsPtr;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the series is still in memory
+ if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
+ ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ return -1;
+ }
+
+ // Find and return the number of sprites in the SS
+ celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ return celsPtr[CELS_COUNT];
+}
+
+
+int32 GetWSAssetCELFrameRate(uint32 hash) {
+ uint32 *celsPtr; // *mainAssetPtr,
+// int32 assetSize;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the series is still in memory
+ if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
+ ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ return -1;
+ }
+
+ // Find and return the frame rate for the SS
+ celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ return celsPtr[CELS_FRAME_RATE];
+}
+
+
+int32 GetWSAssetCELPixSpeed(uint32 hash) {
+ uint32 *celsPtr; // *mainAssetPtr,
+// int32 assetSize;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the series is still in memory
+ if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
+ ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ return -1;
+ }
+
+ // Find and return the pix speed for the SS
+ celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ return celsPtr[CELS_PIX_SPEED];
+}
+
+
+int32 ws_get_sprite_width(uint32 hash, int32 index) {
+ uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
+ int32 numCels; // AssetSize,
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the series is still in memory
+ if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
+ ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ return -1;
+ }
+
+ // Find the source for the SS
+ celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+
+ // Check that the index into the series requested is within a valid range
+ numCels = celsPtr[CELS_COUNT];
+ if (index >= numCels) {
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ return -1;
+ }
+
+ // Find the offset table in the SS header
+ offsets = &celsPtr[CELS_OFFSETS];
+
+ // Find the beginning of the data for all sprites in the SS
+ data = &celsPtr[CELS_OFFSETS + numCels];
+
+ // Find the sprite data for the specific sprite in the series
+ myCelSource = (uint32 *)((uint32)data + offsets[index]);
+
+ return (int32)myCelSource[CELS_W];
+}
+
+
+int32 ws_get_sprite_height(uint32 hash, int32 index) {
+ uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
+ int32 numCels; // assetSize,
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the series is still in memory
+ if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
+ ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ return -1;
+ }
+
+ // Find the source for the SS
+ celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+
+ // Check that the index into the series requested is within a valid range
+ numCels = celsPtr[CELS_COUNT];
+ if (index >= numCels) {
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ return -1;
+ }
+
+ // Find the offset table in the SS header
+ offsets = &celsPtr[CELS_OFFSETS];
+
+ // Find the beginning of the data for all sprites in the SS
+ data = &celsPtr[CELS_OFFSETS + numCels];
+
+ // Find the sprite data for the specific sprite in the series
+ myCelSource = (uint32 *)((uint32)data + offsets[index]);
+
+ return (int32)myCelSource[CELS_H];
+}
+
+MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
+ uint32 *sequPtr;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return nullptr;
+ }
+
+ // Verify the hash is valid, and a SEQU for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "SEQU number out of range: requested num: %ld", hash);
+ return nullptr;
+ }
+
+ // Make sure the SEQU is still in memory
+ if ((!_GWS(globalSEQUHandles)[hash]) || (!*_GWS(globalSEQUHandles)[hash])) {
+ ws_LogErrorMsg(FL, "SEQU not in memory: sequence num: %ld", hash);
+ return nullptr;
+ }
+
+ // Find the sequence chunk
+ sequPtr = (uint32 *)((uint32)*(_GWS(globalSEQUHandles)[hash]) + (uint32)(_GWS(globalSEQUoffsets)[hash]));
+
+ // Return the offset into the resource chunk, and the number of local vars used by the sequence
+ *offset = (int32)(&sequPtr[SEQU_SEQU_START]) - (int32) * (_GWS(globalSEQUHandles)[hash]);
+ *numLocalVars = sequPtr[SEQU_NUM_VARS];
+
+ // Return the resource handle
+ return _GWS(globalSEQUHandles)[hash];
+}
+
+
+MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset) {
+ uint32 *machPtr; // *mainAssetPtr,
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return nullptr;
+ }
+
+ // Verify the hash is valid, and a MACH for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "MACH number out of range: requested num: %ld", hash);
+ return nullptr;
+ }
+
+ // Make sure the MACH is still in memory
+ if ((!_GWS(globalMACHHandles)[hash]) || (!*_GWS(globalMACHHandles)[hash])) {
+ ws_LogErrorMsg(FL, "MACH not in memory: machine num: %ld", hash);
+ return nullptr;
+ }
+
+ // Lock the handle
+ HLock(_GWS(globalMACHHandles)[hash]);
+
+ // Find the machine chunk
+ machPtr = (uint32 *)((uint32) * (_GWS(globalMACHHandles)[hash]) + (uint32)(_GWS(globalMACHoffsets)[hash]));
+
+ // Set the number of states, the state offset table, the start of the mach instructions
+ *numStates = (int32)machPtr[MACH_NUM_STATES];
+ *stateTableOffset = (int32)(&machPtr[MACH_OFFSETS]) - (int32)(*_GWS(globalMACHHandles)[hash]);
+ *machInstrOffset = (int32)((int32)machPtr + ((*numStates + 1) << 2)) - (int32)(*_GWS(globalMACHHandles)[hash]);
+
+ //unlock and return the handle
+ HUnLock(_GWS(globalMACHHandles)[hash]);
+ return _GWS(globalMACHHandles)[hash];
+}
+
+MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
+ uint32 *dataPtr;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return nullptr;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "DATA number out of range: requested num: %ld", hash);
+ return nullptr;
+ }
+
+ // Make sure the DATA is still in memory
+ if ((!_GWS(globalDATAHandles)[hash]) || (!*_GWS(globalDATAHandles)[hash])) {
+ ws_LogErrorMsg(FL, "DATA not in memory: data num: %ld", hash);
+ return nullptr;
+ }
+
+ // Find the data block chunk
+ dataPtr = (uint32 *)((uint32) * (_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
+
+ // Verify the row index of the data block is valid
+ if (index > dataPtr[DATA_REC_COUNT]) {
+ term_message("File: %s, line: %ld, ws_GetDATA() failed:", FL);
+ term_message("Data block num: %ld", hash);
+ term_message("Data row out of range - max row index: %ld, requested row index: %ld", dataPtr[DATA_REC_COUNT], index);
+ return nullptr;
+ }
+
+ *rowOffset = (int32)((uint32)(&dataPtr[DATA_REC_START]) + ((index * dataPtr[DATA_REC_SIZE]) << 2) -
+ (int32)(*_GWS(globalDATAHandles)[hash]));
+ // Return the data handle
+ return _GWS(globalDATAHandles)[hash];
+}
+
+
+int32 ws_GetDATACount(uint32 hash) {
+ uint32 *dataPtr; // *mainAssetPtr,
+// int32 assetSize;
+
+ // Ensure the WS loader has been initialized.
+ if (!_GWS(wsloaderInitialized)) {
+ ws_LogErrorMsg(FL, "WS loader has not been initialized.");
+ return -1;
+ }
+
+ // Verify the hash is valid, and a SS for that hash has been loaded
+ if (hash > MAX_ASSET_HASH) {
+ ws_LogErrorMsg(FL, "DATA number out of range: requested num: %ld", hash);
+ return -1;
+ }
+
+ // Make sure the DATA is still in memory
+ if ((!_GWS(globalDATAHandles)[hash]) || (!*_GWS(globalDATAHandles)[hash])) {
+ ws_LogErrorMsg(FL, "DATA not in memory: data num: %ld", hash);
+ return -1;
+ }
+
+ // Find the data block chunk
+ dataPtr = (uint32 *)((uint32) * (_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
+
+ // Return the number of rows in the data block
+ return dataPtr[DATA_REC_COUNT];
+}
+
+
+static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette) {
+ uint32 celsType, celsSize, numColors, *myColors;
+ uint32 *tempPtr, i, j, header, format;
+ int32 numCels, dataOffset;
+ bool byteSwap;
+ void *handlebuffer;
+
+ if (!stream) {
+ ws_LogErrorMsg(FL, "nullptr FILE POINTER given.");
+ return -1;
+ }
+
+ // Read in the series header and the format number
+ handlebuffer = &header;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Unable to read series header.");
+ return -1;
+ }
+ handlebuffer = &format;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Unable to read series format.");
+ return -1;
+ }
+
+ // Make sure the header is "M4SS", and that the format is not antique
+ if (header == HEAD_SS4M) {
+ format = SWAP_INT32(format);
+ } else if (header != HEAD_M4SS) {
+ ws_LogErrorMsg(FL, "Series is not a valid M4SS series.");
+ return -1;
+ }
+ if (format < SS_FORMAT) {
+ ws_LogErrorMsg(FL, "Format is antique and cannot be read - rebuild series.");
+ return -1;
+ }
+
+ // Read in the SS chunk type - either PAL or SS info
+ handlebuffer = &celsType;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Unable to read series chunk type.");
+ return -1;
+ }
+
+ if ((celsType == CELS__PAL) || (celsType == CELS_LAP_)) {
+
+ //PAL info, read in the size of the PAL chunk
+ handlebuffer = &celsSize;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Unable to read series chunk size.");
+ return -1;
+ }
+
+ // Now read in the number of colors to be inserted into the PAL
+ handlebuffer = &numColors;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Unable to read number of colors in PAL chunk.");
+ return -1;
+ }
+
+ // Make sure the info is in the correct format (swap between Motorola and Intel formats)
+ if (celsType == CELS_LAP_) {
+ celsSize = SWAP_INT32(celsSize);
+ numColors = SWAP_INT32(numColors);
+ byteSwap = true;
+ } else {
+ byteSwap = false;
+ }
+
+ // If there is at least one color specified in this block
+ if (numColors > 0) {
+ if ((myColors = (uint32 *)mem_alloc(celsSize - 12, "ss pal info")) == nullptr) {
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", celsSize - 12);
+ return -1;
+ }
+
+ // Read in the color info into a temp buffer
+ handlebuffer = myColors;
+ if (!(*stream).read((Handle)&handlebuffer, numColors << 2)) {
+ ws_LogErrorMsg(FL, "Failed to read in the PAL color info.");
+ return -1;
+ }
+
+ // If the chunk is in the wrong format, byte-swap the entire chunk
+ // note: we do this because we want the data stored in nrgb format
+ // The data is always read in low byte first, but we need it high byte first
+ // regardless of the endianness of the machine.
+ if (byteSwap) {
+ tempPtr = (uint32 *)&myColors[0];
+ for (i = 0; i < numColors; i++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+ }
+
+ //If we have a place to store the color info
+ if (myPalette) {
+ tempPtr = (uint32 *)(&myColors[0]);
+ for (i = 0; i < numColors; i++) {
+ j = (*tempPtr & 0xff000000) >> 24;
+ myPalette[j].r = (*tempPtr & 0x00ff0000) >> 14;
+ myPalette[j].g = (*tempPtr & 0x0000ff00) >> 6;
+ myPalette[j].b = (*tempPtr & 0x000000ff) << 2;
+ tempPtr++;
+ }
+ }
+
+ // Turf the temp buffer
+ mem_free((void *)myColors);
+ }
+
+ // Read in the next chunk type
+ handlebuffer = &celsType;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Failed to read in series chunk type.");
+ return -1;
+ }
+ }
+
+ // Make sure the chunk type is Sprite Series info
+ if ((celsType != CELS___SS) && (celsType != CELS_SS__)) {
+ ws_LogErrorMsg(FL, "Series chunk type is not labelled as SS info.");
+ return -1;
+ }
+
+ // Read in the size of the entire chunk
+ handlebuffer = &celsSize;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Failed to read in series chunk size.");
+ return -1;
+ }
+
+ // If the chunk is the wrong format, byte-swap (between motorola and intel formats)
+ if (celsType == CELS_SS__) {
+ celsSize = SWAP_INT32(celsSize);
+ }
+
+ // *data contains header + offsets, therefore, we must scan ahead
+ // and find out how many cels are here...
+ if (!(*stream).seek_ahead((CELS_COUNT - CELS_SRC_SIZE - 1) << 2)) {
+ ws_LogErrorMsg(FL, "Failed to seek ahead in the stream.");
+ return -1;
+ }
+
+ // Read how many sprites are in the series
+ handlebuffer = &numCels;
+ if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ ws_LogErrorMsg(FL, "Failed to read the number of sprites in the series.");
+ return -1;
+ }
+
+ // Again, byte-swap if the chunk is in the wrong format
+ if (celsType == CELS_SS__) {
+ numCels = SWAP_INT32(numCels);
+ }
+
+ // Now, seek backwards to where we left off
+ if (!(*stream).seek_ahead((CELS_SRC_SIZE - CELS_COUNT) * 4)) {
+ ws_LogErrorMsg(FL, "Failed to seek backwards in the stream.");
+ return -1;
+ }
+
+ // Allocate a block to hold both the series header, and the sprite offset table
+ if ((*data = (uint32 *)mem_alloc((SS_HEAD_SIZE + numCels) * 4, "ss header")) == nullptr) {
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", (SS_HEAD_SIZE + numCels) << 2);
+ return -1;
+ }
+
+ // Read in the series header and the sprite offset table
+ // Since we already read in celsType and celsSize, SS_HEAD_SIZE-2
+ handlebuffer = &((*data)[2]);
+ if (!(*stream).read((Handle)&handlebuffer, (SS_HEAD_SIZE + numCels - 2) << 2)) {
+ ws_LogErrorMsg(FL, "Failed to read the series header and the sprite offset table.");
+ return -1;
+ }
+
+ // Set the celsType and the celsSize
+ (*data)[0] = celsType;
+ (*data)[1] = celsSize;
+
+ // If the chunk is in the wrong format, byte-swap the series header
+ if (celsType == CELS_SS__) {
+ tempPtr = &((*data)[2]);
+ for (i = 0; i < (uint)(SS_HEAD_SIZE + numCels - 2); i++) {
+ *tempPtr++ = SWAP_INT32(*tempPtr);
+ }
+ }
+
+ // Find out how far into the stream we are, and return that value
+ dataOffset = (*stream).get_pos();
+ return dataOffset;
+}
+
+bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
+ CCB *myCCB;
+ frac16 *myRegs;
+ uint32 *celsPtr, *offsets;
+ int32 ssDataOffset, i, numSprites;
+ int32 obesest_frame = 0;
+ uint32 maxFrameSize;
+
+ // Verify the parameters
+ if ((!streamFile) || (!anim8) || (!anim8->myCCB)) {
+ ws_LogErrorMsg(FL, "SysFile* streamFile invalid.");
+ return false;
+ }
+
+ myCCB = anim8->myCCB;
+ myRegs = anim8->myRegs;
+ ssDataOffset = 0;
+
+ // Read in the SS stream header
+ if ((ssDataOffset = GetSSHeaderInfo(streamFile, &(myCCB->streamSSHeader), &_G(master_palette)[0])) <= 0) {
+ return false;
+ }
+
+ // Automatically set some of the sequence registers
+ celsPtr = myCCB->streamSSHeader;
+ numSprites = celsPtr[CELS_COUNT];
+ myRegs[IDX_CELS_INDEX] = (uint)-0x10000;
+ myRegs[IDX_CELS_COUNT] = numSprites << 16;
+ myRegs[IDX_CELS_FRAME_RATE] = celsPtr[CELS_FRAME_RATE] << 16;
+
+ // Here we convert the offset table to become the actual size of the data for each sprite
+ // This is so the stream can be optimized to always read in on sprite boundaries
+ // Get the beginning of the offset table
+ offsets = &celsPtr[CELS_OFFSETS];
+
+ maxFrameSize = 0;
+ // For all but the last frame, the frame size is the difference in offset values
+ for (i = 0; i < numSprites - 1; i++) {
+ offsets[i] = offsets[i + 1] - offsets[i];
+ if (offsets[i] > maxFrameSize) {
+ maxFrameSize = offsets[i];
+ obesest_frame = i;
+ }
+ }
+
+ // For the last sprite we take the entire chunk size - the chunk header - the offset for that sprite
+ offsets[numSprites - 1] = celsPtr[CELS_SRC_SIZE] - ((SS_HEAD_SIZE + celsPtr[CELS_COUNT]) << 2) - offsets[numSprites - 1];
+ if (offsets[numSprites - 1] > maxFrameSize) {
+ maxFrameSize = offsets[numSprites - 1];
+ obesest_frame = numSprites - 1;
+ }
+
+ // Calculate the maximum size a sprite could be
+ maxFrameSize += SS_INDV_HEAD << 2;
+
+ if (!myCCB->source) {
+ myCCB->source = (M4sprite *)mem_alloc(sizeof(M4sprite), "Sprite");
+ if (!myCCB->source) {
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", sizeof(M4sprite));
+ return false;
+ }
+ }
+
+ term_message("Biggest frame was: %ld, size: %ld bytes (compressed)", obesest_frame, maxFrameSize);
+
+ // Access the streamer to recognize the new client
+ if ((myCCB->myStream = (void *)f_stream_Open(streamFile, ssDataOffset, maxFrameSize, maxFrameSize << 4, numSprites, (int32 *)offsets, 4, false)) == nullptr) {
+ ws_LogErrorMsg(FL, "Failed to open a stream.");
+ return false;
+ }
+
+ // Tag the CCB as being streamed
+ myCCB->flags |= CCB_DISC_STREAM;
+ myCCB->seriesName = nullptr;
+
+ // Get the first frame
+ if (!ws_GetNextSSstreamCel(anim8)) {
+ ws_LogErrorMsg(FL, "Failed to get the first stream frame.");
+ return false;
+ }
+
+ return true;
+}
+
+bool ws_GetNextSSstreamCel(Anim8 *anim8) {
+ CCB *myCCB;
+ M4sprite *mySprite;
+ uint32 *celsPtr, *offsets, *myCelSource;
+ uint32 frameNum;
+
+ // Verify the parameters
+ if (!anim8) {
+ ws_LogErrorMsg(FL, "nullptr Anim8* given");
+ return false;
+ }
+
+ myCCB = anim8->myCCB;
+ if ((!anim8->myCCB) || (!myCCB->streamSSHeader) || (!myCCB->myStream)) {
+ ws_LogErrorMsg(FL, "Invalid Anim8* given.");
+ return false;
+ }
+ if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ ws_LogErrorMsg(FL, "Anim8* given has not previously opened a stream");
+ return false;
+ }
+
+ // Find the SS source and the offset table into the source
+ celsPtr = myCCB->streamSSHeader;
+ offsets = &celsPtr[CELS_OFFSETS];
+
+ // Automatically increment the sequence register
+ anim8->myRegs[IDX_CELS_INDEX] += 0x10000;
+
+ // Check whether the end of the SS has been streamed
+ frameNum = anim8->myRegs[IDX_CELS_INDEX] >> 16;
+ if (frameNum >= celsPtr[CELS_COUNT]) {
+ ws_LogErrorMsg(FL, "No more frames available to stream");
+ return false;
+ }
+
+ // Read the next sprite from the stream. Note the offset table was converted to absolute size when the stream was opened.
+ if (f_stream_Read((strmRequest *)myCCB->myStream, (uint8 **)(&myCCB->streamSpriteSource), offsets[frameNum]) < (int)offsets[frameNum]) {
+ ws_LogErrorMsg(FL, "Unable to read the next stream frame");
+ return false;
+ }
+
+ // Flag the CCB if the sprite series is a delta-streaming sprite series
+ if (myCCB->streamSpriteSource[CELS_STREAM]) {
+ myCCB->flags |= CCB_STREAM;
+ }
+
+ // Initialize the sprite structure
+ myCelSource = myCCB->streamSpriteSource;
+ mySprite = myCCB->source;
+
+ mySprite->xOffset = (int32)convert_intel32((uint32)myCelSource[CELS_X]);
+ mySprite->yOffset = (int32)convert_intel32((uint32)myCelSource[CELS_Y]);
+ mySprite->w = (int32)convert_intel32((uint32)myCelSource[CELS_W]);
+ mySprite->h = (int32)convert_intel32((uint32)myCelSource[CELS_H]);
+
+ {
+ uint32 temp = (uint8)myCelSource[CELS_COMP];
+ mySprite->encoding = (uint8)convert_intel32(temp);
+ }
+
+ mySprite->data = (uint8 *)&myCelSource[CELS_DATA];
+
+ // Initialize the CCB structure
+ myCCB->newLocation->x1 = 0;
+ myCCB->newLocation->y1 = 0;
+ myCCB->newLocation->x2 = 0;
+ myCCB->newLocation->y2 = 0;
+ myCCB->scaleX = 0;
+ myCCB->scaleY = 0;
+
+ return true;
+}
+
+void ws_CloseSSstream(CCB *myCCB) {
+
+ // Verify the parameters
+ if ((!myCCB) || (!(myCCB->flags & CCB_DISC_STREAM))) {
+ ws_LogErrorMsg(FL, "Invalid CCB* given.");
+ return;
+ }
+
+ // Remove the CCB_DISC_STREAM flag
+ myCCB->flags &= ~CCB_DISC_STREAM;
+
+ // Free up the CCB pointers which store streaming information
+ if (myCCB->streamSSHeader) {
+ mem_free((char *)myCCB->streamSSHeader);
+ }
+
+ // Close the stream
+ if (myCCB->myStream) {
+ f_stream_Close((strmRequest *)myCCB->myStream);
+ myCCB->myStream = nullptr;
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
index 6e85a479763..6bafea73e71 100644
--- a/engines/m4/wscript/ws_load.h
+++ b/engines/m4/wscript/ws_load.h
@@ -66,13 +66,13 @@ struct WSLoad_Globals {
char **_globalDATAnames = nullptr;
char **_globalCELSnames = nullptr;
- Handle *_globalMACHHandles = nullptr;
+ MemHandle *_globalMACHHandles = nullptr;
int32 *_globalMACHoffsets = nullptr;
- Handle *_globalSEQUHandles = nullptr;
+ MemHandle *_globalSEQUHandles = nullptr;
int32 *_globalSEQUoffsets = nullptr;
- Handle *_globalDATAHandles = nullptr;
+ MemHandle *_globalDATAHandles = nullptr;
int32 *_globalDATAoffsets = nullptr;
- Handle *_globalCELSHandles = nullptr;
+ MemHandle *_globalCELSHandles = nullptr;
int32 *_globalCELSoffsets = nullptr;
int32 *_globalCELSPaloffsets = nullptr;
};
@@ -81,20 +81,19 @@ extern bool InitWSAssets();
extern bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
extern void ShutdownWSAssets();
-extern bool ws_CELSIntegrity(int32 minHash, int32 maxHash);
extern bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette);
extern int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette);
-extern uint32 *FindSpriteSource(uint32 *celsPtr, int32 index);
extern M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries);
+
extern CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB);
extern int32 GetWSAssetCELCount(uint32 hash);
extern int32 GetWSAssetCELFrameRate(uint32 hash);
extern int32 GetWSAssetCELPixSpeed(uint32 hash);
extern int32 ws_get_sprite_width(uint32 hash, int32 index);
extern int32 ws_get_sprite_height(uint32 hash, int32 index);
-extern Handle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
-extern Handle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
-extern Handle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
+extern MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
+extern MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
+extern MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
extern int32 ws_GetDATACount(uint32 hash);
extern int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data, RGB8 *myPalette);
extern bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index e8a2b70e122..1b4272aaf63 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -15,44 +15,52 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http:// Www.gnu.org/licenses/>.
*
*/
#include "m4/wscript/ws_machine.h"
#include "m4/wscript/ws_cruncher.h"
+#include "m4/wscript/ws_hal.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/wscript/wscript.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/dbg/debug.h"
+#include "m4/mem/mem.h"
#include "m4/platform/timer.h"
#include "m4/vars.h"
namespace M4 {
-static int32 ws_KillMachines();
+#define COND_FLAG 0x80000000
+#define OP_COUNT 0x00007fff
+#define OP_JUMP 3
+#define OP_KILL 4
+
static void clear_msg_list(machine *m);
static void clear_persistent_msg_list(machine *m);
bool ws_Initialize(frac16 *theGlobals) {
int32 i;
- _G(machineIDCount) = 0;
-
- _G(dataFormats) = ws_GetDataFormats();
+ _GWS(machineIDCount) = 0;
+ _GWS(dataFormats) = ws_GetDataFormats();
if (!theGlobals) {
ws_LogErrorMsg(FL, "ws_Initialize() called without a valid global register array.");
return false;
}
- _G(ws_globals) = theGlobals;
+ _GWS(ws_globals) = theGlobals;
for (i = 0; i < GLB_SHARED_VARS; i++) {
- _G(ws_globals)[i] = 0;
+ _GWS(ws_globals)[i] = 0;
}
- _G(firstMachine) = NULL;
- _G(nextXM) = NULL;
- _G(myGlobalMessages) = NULL;
+ _GWS(firstMachine) = nullptr;
+ _GWS(nextXM) = nullptr;
+ _GWS(myGlobalMessages) = nullptr;
if (!ws_InitWSTimer()) {
return false;
@@ -65,9 +73,9 @@ bool ws_Initialize(frac16 *theGlobals) {
return false;
}
- _G(oldTime) = timer_read_60();
- _G(pauseTime) = 0;
- _G(enginesPaused) = false;
+ _GWS(oldTime) = timer_read_60();
+ _GWS(pauseTime) = 0;
+ _GWS(enginesPaused) = false;
return true;
}
@@ -79,84 +87,1138 @@ void ws_Shutdown() {
ws_KillHAL();
}
-void TerminateMachinesByHash(int32 machHash) {
- warning("TODO: TerminateMachinesByHash");
+static void dispose_msgRequest(msgRequest *msg) {
+ if (msg)
+ mem_free(msg);
+}
+
+static void clear_msg_list(machine *m) {
+ msgRequest *freeMsg, *nextMsg;
+
+ nextMsg = m->myMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+
+ m->myMsgs = nullptr;
+}
+
+static void clear_persistent_msg_list(machine *m) {
+ msgRequest *freeMsg, *nextMsg;
+
+ // Clear the active persistent msgs
+ nextMsg = m->myPersistentMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+ m->myPersistentMsgs = nullptr;
+
+ // Clear the used persistent msgs
+ nextMsg = m->usedPersistentMsgs;
+ while (nextMsg) {
+ freeMsg = nextMsg;
+ nextMsg = nextMsg->nextMsg;
+ dispose_msgRequest(freeMsg);
+ }
+
+ m->usedPersistentMsgs = nullptr;
+}
+
+static msgRequest *new_msgRequest() {
+ msgRequest *newMsg;
+ if ((newMsg = (msgRequest *)mem_alloc(sizeof(msgRequest), "msgRequest")) == nullptr) {
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", sizeof(msgRequest));
+ }
+ return newMsg;
+}
+
+static void restore_persistent_msgs(machine *m) {
+ msgRequest *lastMsg;
+
+ // Check params...
+ if ((!m) || (!m->usedPersistentMsgs)) {
+ return;
+ }
+
+ // Loop to find the last used persistent msg
+ lastMsg = m->usedPersistentMsgs;
+ while (lastMsg->nextMsg) {
+ lastMsg = lastMsg->nextMsg;
+ }
+
+ // Place the entire usedPersistentMsgs linked list at the front of the persistentMsgs list
+ lastMsg->nextMsg = m->myPersistentMsgs;
+ m->myPersistentMsgs = m->usedPersistentMsgs;
+ m->usedPersistentMsgs = nullptr;
+}
+
+// CONDITIONAL OPs
+
+static void op_AFTER(machine *m, int32 *pcOffset) {
+ int32 myElapsedTime;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(m, ERR_MACH, 0x0261, "functionality: after arg1 {...}");
+ }
+
+ if (_GWS(myArg3)) {
+ myElapsedTime = (int32)imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)) >> 16;
+ } else {
+ myElapsedTime = (int32)(*_GWS(myArg2)) >> 16;
+ }
+
+ ws_MakeOnTimeReq(_GWS(ws_globals)[GLB_TIME] + myElapsedTime, m, *pcOffset, (int32)*_GWS(myArg1) >> 14);
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+}
+
+static void op_ON_END_SEQ(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0260, "on_seq_end() failed.");
+ }
+
+ ws_OnEndSeqRequest(m->myAnim8, *pcOffset, *_GWS(myArg1) >> 14);
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+}
+
+/**
+ * Message Requests are stored in a linked list, directly in the machine
+ * A message is never actually received, but when another machine wishes to
+ * send a message to this one, it checks this list to see if the message is
+ * expected, and if this machine knows what to do.
+ */
+static void op_ON_MSG(machine *m, int32 *pcOffset) {
+ msgRequest *myMsg;
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0260, "on_msg() failed.");
+ }
+
+ if ((myMsg = new_msgRequest()) == nullptr) {
+ ws_Error(m, ERR_MACH, 0x02fe, "on_msg() failed.");
+ return;
+ }
+
+ if (_GWS(myArg2)) {
+ myMsg->msgHash = *_GWS(myArg2);
+ } else {
+ myMsg->msgHash = 0;
+ }
+ if (_GWS(myArg3)) {
+ myMsg->msgValue = *_GWS(myArg3);
+ } else {
+ myMsg->msgValue = 0;
+ }
+
+ myMsg->pcOffset = *pcOffset;
+ myMsg->pcCount = (int32)*_GWS(myArg1) >> 14;
+ myMsg->nextMsg = m->myMsgs;
+ m->myMsgs = myMsg;
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+}
+
+/**
+ * Same as op_ON_MSG() except these messages do not get cleared between states
+ */
+static void op_ON_P_MSG(machine *m, int32 *pcOffset) {
+ msgRequest *myMsg, *prevMsg;
+ uint32 msgHash;
+ frac16 msgValue;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(m, ERR_MACH, 0x0261, "functionality: on_p_msg arg1 {...}");
+ }
+
+ // Get the values for msgHash and msgValue from the args...
+ msgHash = *_GWS(myArg2);
+ if (_GWS(myArg3)) {
+ msgValue = *_GWS(myArg3);
+ } else {
+ msgValue = 0;
+ }
+
+ // Since the message is persistent, it may have been satisfied earlier, check the used list
+ prevMsg = nullptr;
+ myMsg = m->usedPersistentMsgs;
+
+ // Loop through all the used msgs, see if there is already a struct in place
+ while (myMsg && ((myMsg->msgHash != msgHash) || (myMsg->msgValue != msgValue))) {
+ prevMsg = myMsg;
+ myMsg = myMsg->nextMsg;
+ }
+
+ // If a previous identical msg has already been requested, restore it
+ if (myMsg) {
+ // Remove it from the used msgs linked list
+ // if myMsg is first in the list
+ if (!prevMsg) {
+ m->usedPersistentMsgs = myMsg->nextMsg;
+ } else {
+ // Else myMsg is in the middle of the list (after prevMsg)
+ prevMsg->nextMsg = myMsg->nextMsg;
+ }
+ } else {
+ // Else a new msg has to be created
+ if ((myMsg = new_msgRequest()) == nullptr) {
+ ws_Error(m, ERR_MACH, 0x02fe, "on_p_msg() failed.");
+ return;
+ }
+
+ // Set the msg request values
+ myMsg->msgHash = msgHash;
+ myMsg->msgValue = msgValue;
+ }
+
+ // Since it may be a replacement msg, a new pcOffset may be set
+ myMsg->pcOffset = *pcOffset;
+ myMsg->pcCount = (int32)*_GWS(myArg1) >> 14;
+
+ // Link it into the list
+ myMsg->nextMsg = m->myPersistentMsgs;
+ m->myPersistentMsgs = myMsg;
+
+ // Update the pcOffset
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+}
+
+static void op_SWITCH_LT(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 < arg2) {...}");
+ }
+ if (*_GWS(myArg2) >= *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+static void op_SWITCH_LE(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 <= arg2) {...}");
+ }
+ if (*_GWS(myArg2) > *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+static void op_SWITCH_EQ(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 == arg2) {...}");
+ }
+ if (*_GWS(myArg2) != *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+static void op_SWITCH_NE(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 != arg2) {...}");
+ }
+ if (*_GWS(myArg2) == *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+static void op_SWITCH_GE(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 >= arg2) {...}");
+ }
+ if (*_GWS(myArg2) < *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+static void op_SWITCH_GT(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg3)) {
+ ws_Error(m, ERR_MACH, 0x0262, "functionality: switch (arg1 > arg2) {...}");
+ }
+ if (*_GWS(myArg2) <= *_GWS(myArg3)) {
+ *pcOffset += (int32)*_GWS(myArg1) >> 14;
+ }
+}
+
+
+// IMMEDIATE OPs
+
+static bool op_DO_NOTHING(machine *m, int32 *pcOffset) {
+ return true;
+}
+
+static bool op_GOTO(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: goto arg1");
+ }
+ m->curState = (*_GWS(myArg1)) >> 16;
+ m->recurseLevel = 0;
+ return false;
+}
+
+static bool op_JUMP(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: jump arg1");
+ }
+
+ *pcOffset += (int32)*_GWS(myArg1) >> 16;
+ return true;
+}
+
+static bool op_TERMINATE(machine *m, int32 *pcOffset) {
+ m->curState = -1;
+ m->recurseLevel = 0;
+ return false;
+}
+
+static bool op_START_SEQ(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: start_seq arg1");
+ }
+
+ // Here we check whether a program was previously running
+ if (!m->myAnim8) {
+ if ((m->myAnim8 = ws_AddAnim8ToCruncher(m, *_GWS(myArg1) >> 16)) == nullptr) {
+ ws_Error(m, ERR_MACH, 0x02ff, "start_seq() failed.");
+ }
+ } else {
+ if (!ws_ChangeAnim8Program(m, *_GWS(myArg1) >> 16)) {
+ ws_Error(m, ERR_MACH, 0x02ff, "start_seq() failed.");
+ }
+ }
+
+ // Inform the ws debugger of the new sequence
+ dbg_LaunchSequence(m->myAnim8);
+
+ return true;
+}
+
+static bool op_PAUSE_SEQ(machine *m, int32 *pcOffset) {
+ ws_PauseAnim8(m->myAnim8);
+ return true;
+}
+
+static bool op_STORE_VAL(machine *m, int32 *pcOffset) {
+ if (!_GWS(myArg2)) {
+ ws_Error(m, ERR_MACH, 0x0264, "functionality: arg1 = arg2 or arg1 = rand(arg2, arg3)");
+ }
+ if (_GWS(myArg3)) {
+ *_GWS(myArg1) = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3));
+ } else {
+ *_GWS(myArg1) = *_GWS(myArg2);
+ }
+ return true;
+}
+
+static bool op_SEND_MSG(machine *m, int32 *pcOffset) {
+ frac16 msgValue;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(m, ERR_MACH, 0x0264, "functionality: send to machine arg1, message arg2");
+ }
+ if (_GWS(myArg3)) {
+ msgValue = *_GWS(myArg3);
+ } else {
+ msgValue = 0;
+ }
+ SendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 1);
+ return true;
+}
+
+static bool op_SEND_GMSG(machine *m, int32 *pcOffset) {
+ frac16 msgValue;
+
+ if (!_GWS(myArg2)) {
+ ws_Error(m, ERR_MACH, 0x0264, "functionality: send to to all machines of type arg1, message arg2");
+ }
+ if (_GWS(myArg3)) {
+ msgValue = *_GWS(myArg3);
+ } else {
+ msgValue = 0;
+ }
+
+ SendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 0);
+ return true;
+}
+
+static bool op_REPLY_MSG(machine *m, int32 *pcOffset) {
+ frac16 msgValue;
+
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: reply to sender with msg arg1");
+ }
+ if (_GWS(myArg2)) {
+ msgValue = *_GWS(myArg2);
+ } else {
+ msgValue = 0;
+ }
+
+ SendWSMessage(*_GWS(myArg1), msgValue, m->msgReplyXM, 0, m, 1);
+ return true;
+}
+
+static bool op_SYSTEM_MSG(machine *m, int32 *pcOffset) {
+
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: send to 'C' callback function with msg arg1");
+ }
+
+ if (m->CintrMsg) {
+ (m->CintrMsg)(*_GWS(myArg1), m);
+ }
+
+ return true;
+}
+
+static bool op_TRIG(machine *m, int32 *pcOffset) {
+ int32 myCount, i;
+ char tempStr[80];
+
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: trigger mach arg1, arg2 instances");
+ }
+
+ if (_GWS(myArg2)) {
+ if (_GWS(myArg3)) {
+ myCount = imath_ranged_rand16(*_GWS(myArg2), *_GWS(myArg3)) >> 16;
+ } else {
+ myCount = (*_GWS(myArg2)) >> 16;
+ }
+ } else {
+ myCount = 1;
+ }
+
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ for (i = 0; i < myCount; i++) {
+ if (!TriggerMachineByHash(*_GWS(myArg1) >> 16, m->myAnim8, -1, -1, m->CintrMsg, false, tempStr)) {
+ ws_Error(m, ERR_MACH, 0x0267, "trig() failed");
+ }
+ }
+
+ return true;
+}
+
+static bool op_TRIG_W(machine *m, int32 *pcOffset) {
+ int32 myHash, myCount = 0, minCount = 0, maxCount = 0, i, myInstruction;
+ int32 myIndex, minIndex, maxIndex, myDataCount;
+ int32 myDataHash;
+ bool randFlag = false;
+ char tempStr[80];
+ uint32 *myPC, *oldPC, *machInstr;
+
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "functionality: trigger mach arg1, arg2 instances");
+ }
+
+ myHash = (*_GWS(myArg1)) >> 16;
+ if (_GWS(myArg2)) {
+ if (_GWS(myArg3)) {
+ randFlag = true;
+ minCount = (*_GWS(myArg2)) >> 16;
+ maxCount = (*_GWS(myArg3)) >> 16;
+ } else {
+ myCount = (*_GWS(myArg2)) >> 16;
+ }
+ } else {
+ myCount = 1;
+ }
+
+ // This is a double length instruction - up to 128 bits, we must read in the next pCode
+ machInstr = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->machInstrOffset);
+ myPC = (uint32 *)((uint32)(machInstr)+*pcOffset);
+ oldPC = myPC;
+ if ((myInstruction = ws_PreProcessPcode(&myPC, m->myAnim8)) < 0) {
+ ws_Error(m, ERR_MACH, 0x0266, "trig_w() failed.");
+ }
+
+ // Now find the new pcOffset
+ *pcOffset += (int32)myPC - (int32)oldPC;
+
+ if (!_GWS(myArg1)) {
+ ws_Error(m, ERR_MACH, 0x0263, "trig_w instruction requires a data hash specified by a second pCode.");
+ }
+
+ myDataHash = (int32)(*_GWS(myArg1)) >> 16;
+ myDataCount = ws_GetDATACount(myDataHash);
+ if (_GWS(myArg2)) {
+ if (_GWS(myArg3)) {
+ minIndex = (*_GWS(myArg2)) >> 16;
+ maxIndex = (*_GWS(myArg3)) >> 16;
+ } else {
+ minIndex = (*_GWS(myArg2)) >> 16;
+ maxIndex = (*_GWS(myArg2)) >> 16;
+ }
+ } else {
+ minIndex = 0;
+ maxIndex = myDataCount;
+ }
+
+ if (myInstruction) {
+ for (myIndex = minIndex; myIndex <= maxIndex; i++) {
+ if (randFlag) {
+ myCount = imath_ranged_rand(minCount, maxCount);
+ }
+ for (i = 0; i < myCount; i++) {
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ if (!TriggerMachineByHash(myHash, m->myAnim8, myDataHash, myIndex, m->CintrMsg, false, tempStr)) {
+ ws_Error(m, ERR_MACH, 0x0267, "trig_w() failed");
+ }
+ }
+ }
+ } else {
+ myIndex = imath_ranged_rand(minIndex, maxIndex);
+ if (randFlag) {
+ myCount = imath_ranged_rand(minCount, maxCount);
+ }
+ for (i = 0; i < myCount; i++) {
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ if (!TriggerMachineByHash(myHash, m->myAnim8, myDataHash, myIndex, m->CintrMsg, false, tempStr)) {
+ ws_Error(m, ERR_MACH, 0x0267, "trig_w() failed");
+ }
+ }
+ }
+ return true;
+}
+
+static bool op_CLEAR_REGS(machine *m, int32 *pcOffset) {
+ Anim8 *myAnim8;
+ int32 i;
+
+ if (!m->myAnim8) {
+ ws_Error(m, ERR_INTERNAL, 0x02f3, "clear_regs() failed.");
+ }
+
+ myAnim8 = m->myAnim8;
+ for (i = 0; i < IDX_COUNT + myAnim8->numLocalVars; i++) {
+ myAnim8->myRegs[i] = 0;
+ }
+
+ myAnim8->myRegs[IDX_S] = 0x10000;
+
+ return true;
+}
+
+static bool op_RESUME_SEQ(machine *m, int32 *pcOffset) {
+ if (!m->myAnim8) {
+ ws_Error(m, ERR_INTERNAL, 0x02f3, "resume_seq() failed.");
+ }
+
+ ws_ResumeAnim8(m->myAnim8);
+ return true;
+}
+
+
+bool (*immOpTable[])(machine *m, int32 *pcOffset) = {
+ nullptr, //0 ***END
+ &op_DO_NOTHING, //1
+ &op_GOTO, //2
+ &op_JUMP, //3 don't forget the op_jump #define
+ &op_TERMINATE, //4
+ &op_START_SEQ, //5
+ &op_PAUSE_SEQ, //6
+ &op_RESUME_SEQ, //7
+ &op_STORE_VAL, //8
+ &op_SEND_MSG, //9
+ &op_SEND_GMSG, //10
+ &op_REPLY_MSG, //11
+ &op_SYSTEM_MSG, //12
+ &op_TRIG, //13
+ &op_TRIG_W, //14
+ &op_CLEAR_REGS //15
+};
+
+void (*condOpTable[])(machine *m, int32 *pcOffset) = {
+ &op_AFTER, //0
+ &op_ON_END_SEQ, //1
+ &op_ON_MSG, //2
+ &op_ON_P_MSG, //3
+ &op_SWITCH_LT, //4
+ &op_SWITCH_LE, //5
+ &op_SWITCH_EQ, //6
+ &op_SWITCH_NE, //7
+ &op_SWITCH_GE, //8
+ &op_SWITCH_GT //9
+};
+
+void PauseEngines(void) {
+ _GWS(enginesPaused) = true;
+}
+
+void UnpauseEngines(void) {
+ _GWS(enginesPaused) = false;
+}
+
+void AddPauseTime(int32 myTime) {
+ _GWS(pauseTime) += myTime;
+}
+
+void CycleEngines(Buffer * cleanBackground, int16 * depth_table, GrBuff * screenCodes, uint8 * myPalette, uint8 * ICT, bool updateVideo) {
+ int32 clockTime;
+
+ dbg_DebugNextCycle();
+ clockTime = timer_read_60();
+
+ if (_GWS(enginesPaused)) {
+ _GWS(pauseTime) += clockTime - _GWS(oldTime);
+ _GWS(oldTime) = clockTime;
+
+ } else {
+ _GWS(ws_globals)[GLB_WATCH_DOG] = clockTime - _GWS(pauseTime) - _GWS(ws_globals)[GLB_TIME];
+ _GWS(ws_globals)[GLB_TIME] += _GWS(ws_globals)[GLB_WATCH_DOG];
+ ws_CrunchAnim8s(depth_table);
+
+ if (cleanBackground) {
+ ws_DoDisplay(cleanBackground, depth_table, screenCodes, myPalette, ICT, updateVideo);
+ }
+ ws_CrunchEOSreqs();
+
+ ws_CheckTimeReqs(_GWS(ws_globals)[GLB_TIME]);
+ }
+}
+
+void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT) {
+ ws_hal_RefreshWoodscriptBuffer(_GWS(myCruncher), cleanBackground, depth_table,
+ screenCodes, myPalette, ICT);
+}
+
+static void CancelAllEngineReqs(machine * m) {
+ globalMsgReq *myGMsg, *tempGMsg;
+
+ //---- CANCEL CRUNCHER REQS
+ if (m->myAnim8) {
+ ws_CancelOnEndSeq(m->myAnim8);
+ }
+
+ //---- Free all pending state message requests in this machine
+ clear_msg_list(m);
+
+ //---- Restore all persistent message requests in this machine
+ restore_persistent_msgs(m);
+
+ //---- Free all pending global messages requests in this machine
+ if (_GWS(myGlobalMessages)) {
+ myGMsg = _GWS(myGlobalMessages);
+ while (myGMsg->next) {
+ if (myGMsg->next->sendM == m) {
+ tempGMsg = myGMsg->next;
+ myGMsg->next = myGMsg->next->next;
+ mem_free((void *)tempGMsg);
+ } else myGMsg = myGMsg->next;
+ }
+ }
+
+ //---- CANCEL TIMER REQS
+ ws_CancelOnTimeReqs(m);
}
-static int32 ws_KillMachines() {
+
+static void ShutdownMachine(machine * m) {
+ dbg_RemoveWSMach(m);
+
+ if (m->myAnim8) {
+ ws_RemoveAnim8FromCruncher(m->myAnim8);
+ }
+
+ //---- Free all pending message requests in this machine
+ clear_msg_list(m);
+ clear_persistent_msg_list(m);
+
+ // Fix nextXM so SendWSMessage doesn't break
+ if (m == _GWS(nextXM)) {
+ _GWS(nextXM) = _GWS(nextXM)->next;
+ }
+
+ // Clear any existing walk path
+ DisposePath(m->walkPath);
+
+ // If there is no previous machine, the next machine becomes the first one
+ if (m->prev) {
+ m->prev->next = m->next;
+ } else {
+ _GWS(firstMachine) = m->next;
+ }
+
+ if (m->next) {
+ m->next->prev = m->prev;
+ }
+
+ m->machID = 0xdeaddead;
+
+ if (m->machName) {
+ mem_free((void *)m->machName);
+ }
+
+ mem_free((void *)m);
+}
+
+
+void TerminateMachinesByHash(uint32 machHash) {
+ machine *curr, *next;
+
+ curr = _GWS(firstMachine); // Start at beginning of machine chain
+ while (curr) {
+ next = curr->next; // Preserve next pointer against curr's dealloc
+ if (curr->myHash == machHash) { // is this one to delete?
+ if (curr == _GWS(firstMachine)) { // maintain the beginning of machine chain
+ _GWS(firstMachine) = next;
+ }
+ CancelAllEngineReqs(curr); // cancel its requests
+ ShutdownMachine(curr); // deallocate the whole ball'o'wax
+ }
+ curr = next; // and pop aint32 the chain
+ }
+}
+
+void TerminateMachine(machine * myMachine) {
+ if ((!myMachine) || (!VerifyMachineExists(myMachine))) {
+ return;
+ }
+
+ CancelAllEngineReqs(myMachine);
+ ShutdownMachine(myMachine);
+}
+
+
+bool VerifyMachineExists(machine * m) {
+ machine *tempM;
+
+ // Parameter verification
+ if (!m) {
+ return false;
+ }
+
+ // Loop through the active machine list, looking for m
+ tempM = _GWS(firstMachine);
+ while (tempM && (tempM != m)) {
+ tempM = tempM->next;
+ }
+
+ // If the end of the list was reached, and m was not found, false
+ if (!tempM) {
+ return false;
+ }
+
+ // Otherwise m was found, therefore machine exists
+ return true;
+}
+
+int32 ws_KillMachines() {
machine *myMachine;
globalMsgReq *tempGlobalMsg;
int32 myBytes = 0;
// Deallocate all machines
- myMachine = _G(firstMachine);
+ myMachine = _GWS(firstMachine);
while (myMachine) {
- _G(firstMachine) = _G(firstMachine)->next;
+ _GWS(firstMachine) = _GWS(firstMachine)->next;
clear_msg_list(myMachine);
clear_persistent_msg_list(myMachine);
- mem_free(myMachine);
+ mem_free((void *)myMachine);
myBytes += sizeof(machine);
- myMachine = _G(firstMachine);
+ myMachine = _GWS(firstMachine);
}
// Deallocate global messages
- tempGlobalMsg = _G(myGlobalMessages);
+ tempGlobalMsg = _GWS(myGlobalMessages);
while (tempGlobalMsg) {
- _G(myGlobalMessages) = _G(myGlobalMessages)->next;
+ _GWS(myGlobalMessages) = _GWS(myGlobalMessages)->next;
mem_free((void *)tempGlobalMsg);
- tempGlobalMsg = _G(myGlobalMessages);
+ tempGlobalMsg = _GWS(myGlobalMessages);
}
return myBytes;
}
-static void dispose_msgRequest(msgRequest *msg) {
- if (msg) {
- mem_free(msg);
+
+// This is the proc designed to evaluate the instructions of the state machine
+
+static int32 StepAt(int32 * pcOffset, machine * m) {
+ bool keepProcessing;
+ int32 myInstruction;
+ Anim8 *myAnim8;
+ uint32 machID, *myPC, *oldPC, *machInstr;
+
+ machID = m->machID;
+ myAnim8 = m->myAnim8;
+
+ dbg_SetCurrMachInstr(m, *pcOffset);
+
+ // Find the current PC and process it to get the current instruction
+ machInstr = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->machInstrOffset);
+ myPC = (uint32 *)((uint32)(machInstr)+*pcOffset);
+ oldPC = myPC;
+ _GWS(pcOffsetOld) = *pcOffset;
+ if ((myInstruction = ws_PreProcessPcode(&myPC, myAnim8)) < 0) {
+ ws_Error(m, ERR_MACH, 0x0266, nullptr);
+ }
+
+ // Now find the new pcOffset
+ *pcOffset += (int32)myPC - (int32)oldPC;
+
+ if (myInstruction >= 64) {
+ condOpTable[myInstruction - 64](m, pcOffset);
+ } else if (myInstruction > 0) {
+ keepProcessing = immOpTable[myInstruction](m, pcOffset);
+ if (!keepProcessing) {
+
+ // Does the machine still exist
+ if (m->machID == machID) {
+
+ CancelAllEngineReqs(m);
+ if (m->curState == -1) {
+ ShutdownMachine(m);
+ } else { // If machine hasn't terminated
+ IntoTheState(m); // recurse to kickstart next state
+ }
+ }
+ }
}
+ return myInstruction;
}
-static void clear_msg_list(machine *m) {
- msgRequest *freeMsg, *nextMsg;
- nextMsg = m->myMsgs;
- while (nextMsg) {
- freeMsg = nextMsg;
- nextMsg = nextMsg->nextMsg;
- dispose_msgRequest(freeMsg);
+void ws_StepWhile(machine * m, int32 pcOffset, int32 pcCount) {
+ int32 myInstruction, oldPC;
+ uint32 machID, recurseLevel;
+
+ // We are executing machine instructions after a conditional has been satisfied.
+ // Mark where we started
+ oldPC = pcOffset;
+
+ // Increment and remember the recurseLevel and the machine ID
+ m->recurseLevel++;
+ recurseLevel = m->recurseLevel;
+ machID = m->machID;
+
+ // Execute instructions until the conditional count has been reached.
+ myInstruction = -1;
+ while (myInstruction && (myInstruction != OP_KILL) &&
+ (pcOffset >= oldPC) && (pcOffset - oldPC < pcCount) &&
+ (m->machID == machID) && (m->recurseLevel == recurseLevel)) {
+ myInstruction = StepAt(&pcOffset, m);
+ }
+
+ // The last instruction might have been a JUMP instruction. This should be
+ // a JUMP to reissue the conditional, Therefore, reexecute the conditional.
+ if (myInstruction == OP_JUMP) {
+ StepAt(&pcOffset, m);
+ }
+
+ // If the above loop executed without being modified (ie terminated) by a call to StepAt()
+ if (myInstruction != OP_KILL) {
+ if ((m->machID == machID) && (m->recurseLevel == recurseLevel)) {
+ m->recurseLevel--;
+ }
+ }
+}
+
+
+// When a state machine enters a new state, every request and command is
+// evaluated immediately.
+
+void IntoTheState(machine * m) {
+ int32 myInstruction;
+ uint32 *stateTable, machID, recurseLevel;
+ int32 pcOffset;
+
+ if ((m->curState >= m->numOfStates) || (m->curState < 0)) {
+ ws_Error(m, ERR_INTERNAL, 0x2f2, "IntoTheState() failed.");
}
+ stateTable = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->stateTableOffset);
+ pcOffset = stateTable[m->curState];
+
+ // Increment and remember the recurseLevel and the machine ID
+ m->recurseLevel++;
+ recurseLevel = m->recurseLevel;
+ machID = m->machID;
+
+ // Execute all instruction until an instruction (ie. OP_END) signals execution to stop
+ // by returning 0, or something has reset the recurseLevel (ie. op_GOTO)
+ myInstruction = -1;
+ while (myInstruction && (myInstruction != OP_KILL) &&
+ ((m->machID == machID) && (m->recurseLevel == recurseLevel))) {
+ myInstruction = StepAt(&pcOffset, m);
+ }
+
+ if (myInstruction != OP_KILL) {
+ // If the above loop executed without being modified (ie terminated) by a call to StepAt()
+ if ((m->machID == machID) && (m->recurseLevel == recurseLevel)) {
+ // Decriment the recurse counter
+ m->recurseLevel--;
+ }
+ }
+}
+
+// This proc creates an instance of a machine based on the machine chunk
+
+machine *TriggerMachineByHash(int32 myHash, Anim8 * parentAnim8, int32 dataHash, int32 dataRow, MessageCB CintrMsg, bool debug, const char *machName) {
+ machine *m;
+
+ if ((m = (machine *)mem_alloc(sizeof(machine), "machine")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(machine));
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ ws_Error(m, ERR_INTERNAL, 0x2fe, "TriggerMachineByHash() failed.");
+ return nullptr;
+ }
+
+ // Initialize the identification fields
+ _GWS(machineIDCount)++;
+ if (_GWS(machineIDCount) == 0xdeaddead) {
+ _GWS(machineIDCount)++;
+ }
+
+ m->myHash = myHash;
+ m->machID = _GWS(machineIDCount);
+ m->machName = mem_strdup(machName);
+
+ if ((m->machHandle = ws_GetMACH(myHash, &m->numOfStates, &m->stateTableOffset, &m->machInstrOffset)) == nullptr) {
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ return nullptr;
+ }
+
+ // Get the data handle and offset if requested
+ if (dataHash >= 0) {
+ m->dataHash = dataHash;
+ if ((m->dataHandle = ws_GetDATA(dataHash, (uint32)dataRow, &m->dataOffset)) == nullptr) {
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ return nullptr;
+ }
+ } else {
+ m->dataHash = -1;
+ m->dataHandle = nullptr;
+ }
+
+ // Insert m into the list...
+ m->next = _GWS(firstMachine);
+ m->prev = nullptr;
+ if (_GWS(firstMachine)) {
+ _GWS(firstMachine)->prev = m;
+ }
+ _GWS(firstMachine) = m;
+
+ m->recurseLevel = 0;
+ m->curState = 0;
+ m->myAnim8 = nullptr;
+ m->parentAnim8 = parentAnim8;
+ m->targetCount = 0;
+ m->msgReplyXM = nullptr;
+ m->CintrMsg = CintrMsg;
m->myMsgs = nullptr;
+ m->myPersistentMsgs = nullptr;
+ m->usedPersistentMsgs = nullptr;
+ m->walkPath = nullptr;
+
+ dbg_DebugWSMach(m, debug);
+
+ IntoTheState(m);
+ return m;
}
-static void clear_persistent_msg_list(machine *m) {
- msgRequest *freeMsg, *nextMsg;
+enum {
+ REGULAR_MSG = 0,
+ PERSISTENT_MSG
+};
- // Clear the active persistent msgs
- nextMsg = m->myPersistentMsgs;
- while (nextMsg) {
- freeMsg = nextMsg;
- nextMsg = nextMsg->nextMsg;
- dispose_msgRequest(freeMsg);
+
+static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine * recvM, int32 whichList, machine * sendM) {
+ bool found;
+ msgRequest *myMsg = nullptr, *prevMsg;
+ int32 pcOffset, pcCount;
+
+ // Initialize search vars
+ found = false;
+ prevMsg = nullptr;
+
+ // Find the first msg, based on which list is to be searched
+ switch (whichList) {
+ // Regular messages
+ case REGULAR_MSG:
+ myMsg = recvM->myMsgs;
+ break;
+
+ // Persistent msgs
+ case PERSISTENT_MSG:
+ myMsg = recvM->myPersistentMsgs;
+ break;
}
- m->myPersistentMsgs = NULL;
- // Clear the used persistent msgs
- nextMsg = m->usedPersistentMsgs;
- while (nextMsg) {
- freeMsg = nextMsg;
- nextMsg = nextMsg->nextMsg;
- dispose_msgRequest(freeMsg);
+ // Search through the message list
+ while (myMsg && (!found)) {
+ // Check if we've found the msg we're looking for
+ if ((myMsg->msgHash == msgHash) && (myMsg->msgValue == msgValue)) {
+
+ // Set found bool
+ found = true;
+
+ // Find out where to begin executing from
+ pcOffset = myMsg->pcOffset;
+ pcCount = myMsg->pcCount;
+
+ // Remove the msg from the list, based on which list
+ switch (whichList) {
+ // Regular messages
+ case REGULAR_MSG:
+ // If myMsg was first in the list
+ if (!prevMsg) {
+ recvM->myMsgs = myMsg->nextMsg;
+ } else {
+ // Else it was in the middle
+ prevMsg->nextMsg = myMsg->nextMsg;
+ }
+
+ // Dispose of the message
+ dispose_msgRequest(myMsg);
+ break;
+
+ // Persistent messages
+ case PERSISTENT_MSG:
+ // If myMsg was first in the list
+ if (!prevMsg) {
+ recvM->myPersistentMsgs = myMsg->nextMsg;
+ } else {
+ // Else it was in the middle
+ prevMsg->nextMsg = myMsg->nextMsg;
+ }
+
+ // Move the message to the inactive list
+ myMsg->nextMsg = recvM->usedPersistentMsgs;
+ recvM->usedPersistentMsgs = myMsg;
+ break;
+ }
+
+ // Set up so the recv machine can reply to this message
+ recvM->msgReplyXM = sendM;
+
+ // Service the request
+ ws_StepWhile(recvM, pcOffset, pcCount);
+ } else {
+ // Else check the next message
+ prevMsg = myMsg;
+ myMsg = myMsg->nextMsg;
+ }
}
- m->usedPersistentMsgs = NULL;
+ // Return whether a message was found or not
+ return found;
}
-void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
- uint32 machHash, machine *sendM, int32 msgCount) {
- error("TODO: SendWSMessage");
+// This proc is what allows a machine to send a message to another machine(s)
+
+void SendWSMessage(uint32 msgHash, frac16 msgValue, machine * recvM,
+ uint32 machHash, machine * sendM, int32 msgCount) {
+
+ bool found, more_to_send;
+ machine *currMachine;
+ int32 myCount; // ,i;
+ bool sendToAll;
+ globalMsgReq *myGlobalMsgs, *tempGlobalMsg;
+
+ // In this case we are sending to a specific machine: recvM
+ if (recvM) {
+ // Search first the regular message list, and if it was not found
+ if (!SearchMsgList(msgHash, msgValue, recvM, REGULAR_MSG, sendM)) {
+ // Search the persistent message list
+ SearchMsgList(msgHash, msgValue, recvM, PERSISTENT_MSG, sendM);
+ }
+
+ // and return
+ return;
+ }
+
+ // Otherwise...
+ // Not sending to a specific machine, so send to <msgCount> machines with the given hash
+
+ // Prepare a global message structure
+ if ((tempGlobalMsg = (globalMsgReq *)mem_alloc(sizeof(globalMsgReq), "globalMsgReq")) == nullptr) {
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(machine));
+ ws_Error(nullptr, ERR_INTERNAL, 0x2fe, "SendWSMessage() failed.");
+ }
+ tempGlobalMsg->msgHash = msgHash;
+ tempGlobalMsg->msgValue = msgValue;
+ tempGlobalMsg->machHash = machHash;
+ tempGlobalMsg->sendM = sendM;
+ tempGlobalMsg->msgCount = msgCount;
+ tempGlobalMsg->next = nullptr;
+
+ // If we are in the middle of a "global send message", queue the request and exit
+ // Question: is this a re-entrancy check?
+ // Answer: not really. If a machine sends out a "global send message", then we
+ // to completely process the "global send message" before any other
+ // "global send message" statements are executed. Suppose machine:A
+ // accepted two different messages. Machine:B sends out message:1
+ // Machine:C also receives message:1 sent by machine:B, and sends out
+ // message:2. Since machine:C received message:1 before machine:A, now
+ // both message:1 and message:2 have been sent. Which does machine:A
+ // respond to? Queueing message:2 until message:1 has been completely
+ // processed ensures predictability. ie. In this case, machine:A
+ // will respond to message:1 before any machine responds to message:2.
+ //
+
+ // Check to see if we are already in the middle of processing global messages
+ if (_GWS(myGlobalMessages)) {
+
+ // Find the end of the global list
+ myGlobalMsgs = _GWS(myGlobalMessages);
+ while (myGlobalMsgs->next) {
+ myGlobalMsgs = myGlobalMsgs->next;
+ }
+
+ //myGlobalMsgs is the last element, now tempGlobalMsg is.
+ myGlobalMsgs->next = tempGlobalMsg;
+
+ // Since we are already processing a global message, this one is now queued, and we return
+ return;
+ }
+
+ // We are not currently processing another global message, therefore put this on the queue
+ // To prevent future global requests from processing until this request is serviced
+ _GWS(myGlobalMessages) = tempGlobalMsg;
+
+ // Loop through and service all global requests.
+ while (_GWS(myGlobalMessages)) {
+ // Sending to all machines, or just a bunch of them?
+ myCount = _GWS(myGlobalMessages)->msgCount;
+ if (myCount <= 0) {
+ sendToAll = true;
+ } else {
+ sendToAll = false;
+ }
+
+ // Search machine list
+ more_to_send = true;
+ currMachine = _GWS(firstMachine);
+ while (currMachine && more_to_send) {
+ // Set nextXM up in case this machine is deleted during the ws_StepWhile
+ // nextXM will be maintained by ShutDownMachine()
+ _GWS(nextXM) = currMachine->next;
+
+ // Have we got a machine of the specified hash
+ if (currMachine->myHash == _GWS(myGlobalMessages)->machHash) {
+ // Search the machines regular list.
+ found = SearchMsgList(msgHash, msgValue, currMachine, REGULAR_MSG, sendM);
+
+ // If the message wasn't found in the regular list, search the persistent list
+ if (!found) {
+ found = SearchMsgList(msgHash, msgValue, currMachine, PERSISTENT_MSG, sendM);
+ }
+
+ // Check to see if found
+ if (found) {
+ myCount--;
+ if ((!sendToAll) && (myCount <= 0)) {
+ more_to_send = false;
+ }
+ }
+ }
+ currMachine = _GWS(nextXM);
+ }
+
+ // Note: ws_StepWhile could have added more messages to the proceedings
+ // Discard a global message and queue up the next one:
+ tempGlobalMsg = _GWS(myGlobalMessages);
+ _GWS(myGlobalMessages) = _GWS(myGlobalMessages)->next;
+ mem_free((void *)tempGlobalMsg);
+ }
}
} // End of namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index d4d2b8bc83c..c3668729071 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -97,11 +97,11 @@ struct Anim8 {
Anim8 *behind = nullptr;
Anim8 *myParent = nullptr; // The parent anim8
int32 sequHash = 0; // The current sequence Hash = 0;
- Handle sequHandle = nullptr; // The sequence Handle
+ MemHandle sequHandle = nullptr; // The sequence Handle
int32 pcOffset = 0; // The offset into the sequence of the current PC
CCB *myCCB = nullptr;
int32 dataHash = 0; // The array of data
- Handle dataHandle = nullptr;
+ MemHandle dataHandle = nullptr;
int32 dataOffset = 0;
int32 startTime = 0;
int32 switchTime = 0;
@@ -125,7 +125,7 @@ struct machine {
uint32 myHash = 0;
uint32 machID = 0;
char *machName = nullptr;
- Handle machHandle = 0;
+ MemHandle machHandle = 0;
int32 machInstrOffset = 0;
int32 stateTableOffset = 0;
int32 curState = 0;
@@ -134,7 +134,7 @@ struct machine {
Anim8 *myAnim8 = nullptr;
Anim8 *parentAnim8 = nullptr;
int32 dataHash = 0;
- Handle dataHandle = 0;
+ MemHandle dataHandle = 0;
int32 dataOffset = 0;
int32 targetCount = 0;
struct machine *msgReplyXM = nullptr;
@@ -168,11 +168,26 @@ struct WSMachine_Globals {
// Used for processing pCodes
frac16 *_ws_globals = nullptr;
+ void *_addrExists = nullptr;
};
extern bool ws_Initialize(frac16 *theGlobals);
extern void ws_Shutdown();
-extern void TerminateMachinesByHash(int32 machHash);
+extern void PauseEngines();
+extern void UnpauseEngines();
+extern void AddPauseTime(int32 myTime);
+
+void CycleEngines(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes,
+ uint8 *myPalette, uint8 *ICT, bool updateVideo);
+void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
+
+void TerminateMachine(machine *m);
+void TerminateMachinesByHash(uint32 machHash);
+bool VerifyMachineExists(machine *m);
+int32 ws_KillMachines();
+void ws_StepWhile(machine *m, int32 pcOffset, int32 pcCount);
+void IntoTheState(machine *m);
+machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash, int32 dataRow, MessageCB CintrMsg, bool debug, const char *machName);
/**
* This proc is what allows a machine to send a message to another machine(s)
@@ -180,6 +195,9 @@ extern void TerminateMachinesByHash(int32 machHash);
extern void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
uint32 machHash, machine *sendM, int32 msgCount);
+#define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, NULL, -1, -1, callback, FALSE, (char*)name)
+#define kernel_terminate_machine(m) TerminateMachine(m)
+
} // End of namespace M4
#endif
diff --git a/engines/m4/wscript/ws_timer.cpp b/engines/m4/wscript/ws_timer.cpp
index 1618579a9e0..c0a2eb7dcba 100644
--- a/engines/m4/wscript/ws_timer.cpp
+++ b/engines/m4/wscript/ws_timer.cpp
@@ -27,18 +27,18 @@ namespace M4 {
static void dispose_timeRequest(onTimeReq *timeReq);
bool ws_InitWSTimer(void) {
- _G(firstTimeReq) = nullptr;
+ _GWS(firstTimeReq) = nullptr;
return true;
}
void ws_KillTime() {
onTimeReq *tempTime;
- tempTime = _G(firstTimeReq);
+ tempTime = _GWS(firstTimeReq);
while (tempTime) {
- _G(firstTimeReq) = _G(firstTimeReq)->next;
+ _GWS(firstTimeReq) = _GWS(firstTimeReq)->next;
dispose_timeRequest(tempTime);
- tempTime = _G(firstTimeReq);
+ tempTime = _GWS(firstTimeReq);
}
}
@@ -48,4 +48,17 @@ static void dispose_timeRequest(onTimeReq *timeReq) {
}
}
+void ws_MakeOnTimeReq(int32 wakeUpTime, machine *myXM, int32 pcOffset, int32 pcCount) {
+ error("TODO: ws_MakeOnTimeReq");
+}
+
+void ws_CancelOnTimeReqs(machine *m) {
+ error("TODO: ws_CancelOnTimeReqs");
+}
+
+void ws_CheckTimeReqs(int32 curTime) {
+ error("TODO: ws_CheckTimeReqs");
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/wscript/wst_regs.cpp b/engines/m4/wscript/wst_regs.cpp
new file mode 100644
index 00000000000..4a0b734e624
--- /dev/null
+++ b/engines/m4/wscript/wst_regs.cpp
@@ -0,0 +1,122 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/wscript/wst_regs.h"
+
+namespace M4 {
+
+const char *myRegLabels[IDX_COUNT] = {
+ "timer", //0
+ "tag", //1
+ "layer", //2
+
+ "w", //3
+ "h", //4
+ "x", //5
+ "y", //6
+ "s", //7
+ "r", //8
+
+ "cels_hash", //9
+ "cels_index", //10
+ "cels_count", //11
+ "cels_frame_rate", //12
+ "cels_pix_speed", //13
+
+ "targ_s", //14
+ "targ_r", //15
+ "targ_x", //16
+ "targ_y", //17
+
+ "delta_s", //18
+ "delta_r", //19
+ "delta_x", //20
+ "delta_y", //21
+
+ "velocity", //22
+ "theta", //23
+
+ "ztemp1", //24
+ "ztemp2", //25
+ "ztemp3", //26
+ "ztemp4", //27
+ "ztemp5", //28
+ "ztemp6", //29
+ "ztemp7", //30
+ "ztemp8", //31
+
+ "mach_id" //32
+};
+
+const char *myGlobLabels[GLOB_COUNT] = {
+ "***SYSTEM - TIME",
+ "***SYSTEM - WATCHDOG",
+ "min_y",
+ "max_y",
+ "min_scale",
+ "max_scale",
+ "scaler",
+ "g_temp1",
+ "g_temp2",
+ "g_temp3",
+ "g_temp4",
+ "g_temp5",
+ "g_temp6",
+ "g_temp7",
+ "g_temp8",
+ "g_temp9",
+ "g_temp10",
+ "g_temp11",
+ "g_temp12",
+ "g_temp13",
+ "g_temp14",
+ "g_temp15",
+ "g_temp16",
+ "g_temp17",
+ "g_temp18",
+ "g_temp19",
+ "g_temp20",
+ "g_temp21",
+ "g_temp22",
+ "g_temp23",
+ "g_temp24",
+ "g_temp25",
+ "g_temp26",
+ "g_temp27",
+ "g_temp28",
+ "g_temp29",
+ "g_temp30",
+ "g_temp31",
+ "g_temp32",
+};
+
+const char *tagLabels[TAG_COUNT] = {
+ "tag_none",
+ "tag_targs",
+ "tag_bez",
+ "tag_deltas",
+ "tag_vectors",
+ "tag_text",
+ "tag_move_cel",
+ "tag_map_cel"
+};
+
+} // End of namespace M4
diff --git a/engines/m4/wscript/wst_regs.h b/engines/m4/wscript/wst_regs.h
index cd563389fd4..9bb7a61ec8b 100644
--- a/engines/m4/wscript/wst_regs.h
+++ b/engines/m4/wscript/wst_regs.h
@@ -85,9 +85,11 @@ enum {
#define TAG_MOVE_CEL 0x00004000
#define TAG_MAP_CEL 0x00002000
-extern char *myRegLabels[];
-extern char *myGlobLabels[];
-extern char *tagLabels[];
+#define GLOB_COUNT 39
+
+extern const char *myRegLabels[];
+extern const char *myGlobLabels[];
+extern const char *tagLabels[];
} // End of namespace M4
Commit: 18d3ac846ef8a30c8e7ca9b2a305250e2df00a5c
https://github.com/scummvm/scummvm/commit/18d3ac846ef8a30c8e7ca9b2a305250e2df00a5c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More m4SceneLoad
Changed paths:
engines/m4/adv_r/adv_been.cpp
engines/m4/adv_r/adv_been.h
engines/m4/adv_r/adv_control.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
index 11a5fca2896..d50aa283359 100644
--- a/engines/m4/adv_r/adv_been.cpp
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -58,10 +58,7 @@ void player_been_sync(Common::Serializer &s) {
s.syncBytes(_G(scene_list).table, _G(scene_list).total_scenes);
}
-/**
- * Checks whether player has been in specified scene before
- */
-static bool player_been_here(int16 scene_num) {
+bool player_been_here(int16 scene_num) {
for (int i = 0; i < _G(scene_list).tail; i++)
if (_G(scene_list).table[i] == scene_num)
return true;
diff --git a/engines/m4/adv_r/adv_been.h b/engines/m4/adv_r/adv_been.h
index 4db3b87a94b..d135b9dbb6d 100644
--- a/engines/m4/adv_r/adv_been.h
+++ b/engines/m4/adv_r/adv_been.h
@@ -71,6 +71,11 @@ extern bool player_enters_scene(int16 scene_num);
*/
extern void player_forgets_scene(int16 scene_num);
+/**
+ * Checks whether player has been in specified scene before
+ */
+extern bool player_been_here(int16 scene_num);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 0234cfd15ad..6bb04f042f6 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -23,6 +23,7 @@
#include "m4/adv_r/adv_interface.h"
#include "m4/core/errors.h"
#include "m4/mem/memman.h"
+#include "m4/wscript/ws_machine.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 0b2b39c7944..bc118f48f14 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -21,12 +21,17 @@
#include "m4/core/rooms.h"
#include "m4/core/errors.h"
+#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_file.h"
#include "m4/adv_r/adv_interface.h"
+#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/db_env.h"
#include "m4/fileio/extensions.h"
+#include "m4/graphics/krn_pal.h"
#include "m4/gui/gui_buffer.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
@@ -100,47 +105,50 @@ void Sections::m4SceneLoad() {
_G(between_rooms) = false;
room_init();
-#ifdef TODO
_G(player).walker_trigger = -1;
- if (_G(game).previous_room == KERNEL_RESTORING_GAME)
- {
+
+
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
if (_G(player).walker_in_this_scene) {
- // if restoring game, restore player position and facing
- player_demand_location(player_info.x, player_info.y);
- player_demand_facing(player_info.facing);
+ // If restoring game, restore player position and facing
+ player_demand_location(_G(player_info).x, _G(player_info).y);
+ player_demand_facing(_G(player_info).facing);
}
- // restore camera position
- MoveScreenAbs(game_buff_ptr, player_info.camera_x, player_info.camera_y);
+
+ // Restore camera position
+ MoveScreenAbs(_G(game_buff_ptr), _G(player_info).camera_x, _G(player_info).camera_y);
}
- //enable_end_user_hot_keys();
+ _visited_room = player_been_here(_G(game).room_id);
+
term_message("calling room_init_code");
- util_exec_function(room_init_code_pointer);
+ g_engine->room_init();
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
- interface_show();
_G(game).previous_room = -1;
}
- // init for fade up screen
+ // Init for fade up screen
if (!_G(kernel).supress_fadeup) {
- pal_fade_set_start(&master_palette[0], 0); //set fade to black instantly (0 ticks)
- pal_fade_init(&master_palette[0], _G(kernel).first_fade, 255, 100, _G(kernel).fade_up_time, 32765); // 30 ticks
+ pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to black instantly (0 ticks)
+ pal_fade_init(&_G(master_palette)[0], _G(kernel).first_fade, 255, 100,
+ _G(kernel).fade_up_time, 32765); // 30 ticks
}
if (!_G(set_commands_allowed_since_last_checked))
player_set_commands_allowed(true);
- if (player_been_here(_G(game).room_id))
+ if (player_been_here(_G(game).room_id)) {
_G(player).been_here_before = true;
- else {
+ } else {
_G(player).been_here_before = false;
player_enters_scene(_G(game).room_id);
}
//-------------------- PLAY ROOM ------------------
-#endif
+
+ term_message("Off to the races -- %d", timer_read_60());
}
void Sections::get_ipl() {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 4fcef8463f3..97ed20fa229 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -80,6 +80,7 @@ private:
int32 cameraShift_vert_Amount = 0;
bool shut_down_digi_tracks_between_rooms = true;
int32 camera_pan_step = 10;
+ bool _visited_room = false;
void get_ipl();
void get_walker();
Commit: fbd3606be2318c2b80267b87a4c83dd62f0af236
https://github.com/scummvm/scummvm/commit/fbd3606be2318c2b80267b87a4c83dd62f0af236
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added hotspot walk methods
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 6bb04f042f6..57cf358ac71 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -61,4 +61,18 @@ void game_pause(bool flag) {
}
}
+void player_hotspot_walk_override(int32 x, int32 y, int32 facing, int32 trigger) {
+ _G(player).walk_x = x;
+ _G(player).walk_y = y;
+ _G(player).walk_facing = facing;
+ _G(player).walker_trigger = trigger;
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+}
+
+void player_hotspot_walk_override_just_face(int32 facing, int32 trigger) {
+ player_update_info(_G(my_walker), &_G(player_info));
+ player_hotspot_walk_override(_G(player_info).x, _G(player_info).y, facing, trigger);
+}
+
} // End of namespace M4
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index bc118f48f14..de370b9d1e4 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -139,18 +139,20 @@ void Sections::m4SceneLoad() {
if (!_G(set_commands_allowed_since_last_checked))
player_set_commands_allowed(true);
- if (player_been_here(_G(game).room_id)) {
- _G(player).been_here_before = true;
- } else {
- _G(player).been_here_before = false;
- player_enters_scene(_G(game).room_id);
- }
-
//-------------------- PLAY ROOM ------------------
term_message("Off to the races -- %d", timer_read_60());
}
+void Sections::m4SceneRun() {
+ game_control_cycle();
+
+ if (!player_been_here(_G(game).room_id))
+ player_enters_scene(_G(game).room_id);
+
+
+}
+
void Sections::get_ipl() {
if (_G(inverse_pal))
delete _G(inverse_pal);
@@ -181,6 +183,10 @@ void Sections::get_walker() {
ws_walk_init_system();
}
+void Sections::game_control_cycle() {
+ // TODO
+}
+
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 97ed20fa229..80d6d3d49f0 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -85,6 +85,8 @@ private:
void get_ipl();
void get_walker();
+ void game_control_cycle();
+
public:
Section *_sections = nullptr;
Section *_activeSection = nullptr;
@@ -131,6 +133,7 @@ public:
}
void m4SceneLoad();
+ void m4SceneRun();
};
} // namespace M4
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 1019934148f..a7f2e3716a7 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -170,6 +170,7 @@ public:
Common::String _currBackgroundFN;
Common::String _currCodeFN;
ScreenContext *_game_buff_ptr = nullptr;
+ machine *_my_walker = nullptr;
};
#define _G(X) (g_vars->_##X)
Commit: 1836a2c3c949cc5452703b175bdb755d3b1f0765
https://github.com/scummvm/scummvm/commit/1836a2c3c949cc5452703b175bdb755d3b1f0765
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added game_control_cycle
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
engines/m4/m4.cpp
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index de370b9d1e4..b4300d12ac2 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -30,6 +30,7 @@
#include "m4/graphics/krn_pal.h"
#include "m4/gui/gui_buffer.h"
#include "m4/gui/gui_vmng.h"
+#include "m4/wscript/wst_regs.h"
#include "m4/vars.h"
#include "m4/m4.h"
@@ -55,7 +56,7 @@ void Sections::section_room_constructor() {
void Sections::m4SceneLoad() {
_G(between_rooms) = true;
- cameraShiftAmount = 0;
+ _cameraShiftAmount = 0;
cameraShift_vert_Amount = 0;
_G(art_base_override) = nullptr;
_G(use_alternate_attribute_file) = true;
@@ -184,7 +185,74 @@ void Sections::get_walker() {
}
void Sections::game_control_cycle() {
- // TODO
+ int32 status;
+
+ while (_G(game).new_room == _G(game).room_id && _G(kernel).going) {
+ krn_pal_game_task();
+
+ ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &status);
+ if (!screen)
+ error_show(FL, 'BUF!');
+
+ if (_G(player).ready_to_walk) {
+ if (_G(player).need_to_walk) {
+ if (_G(player).noun[0] == '@' || !_G(player).walker_in_this_scene) {
+ term_message("parsing0");
+ parse_player_command_now();
+ term_message("parsed0");
+ } else {
+ term_message("player: walk to (%ld, %ld), facing: %ld",
+ _G(player).walk_x, _G(player).walk_y, _G(player).walk_facing);
+
+ if (_G(player).walk_x < 0 || _G(player).walk_y < 0) {
+ term_message("walk x or y < 0 - player: %s %s %s",
+ _G(player).verb, _G(player).noun, _G(player).prep);
+ }
+
+ _G(player).waiting_for_walk = true;
+ ws_walk(_G(my_walker), _G(player).walk_x, _G(player).walk_y,
+ nullptr, _G(player).walker_trigger, _G(player).walk_facing);
+ term_message("walked");
+
+ _G(player).need_to_walk = false;
+ }
+ } else if (!_G(player).waiting_for_walk) {
+ term_message("parsing1");
+ parse_player_command_now();
+ term_message("parsed0");
+
+ _G(player).ready_to_walk = false;
+ }
+ }
+
+ if (_G(player).walker_in_this_scene && _G(camera_reacts_to_player) &&
+ _G(gameDrawBuff)->w > 640 && _G(my_walker)) {
+ int xp = (_G(my_walker)->myAnim8->myRegs[IDX_X] >> 16) + screen->x1;
+
+ if (xp > 560 && _cameraShiftAmount >= 0) {
+ _cameraShiftAmount += screen->x1 - 427;
+ int xv = _cameraShiftAmount + _G(gameDrawBuff)->w - 1;
+
+ if (xv < 639)
+ _cameraShiftAmount = -(_G(gameDrawBuff)->w - 640);
+ _cameraShiftAmount -= screen->x1;
+ } else if (xp < 80 && _cameraShiftAmount <= 0) {
+ _cameraShiftAmount += screen->x1 + 427;
+
+ if (_cameraShiftAmount > 0)
+ _cameraShiftAmount = 0;
+
+ _cameraShiftAmount -= screen->x1;
+ }
+ }
+ }
+
+ _GI().cancel_sentence();
+}
+
+void Sections::parse_player_command_now() {
+ // TODO: parse_player_command_now
+ error("TODO: parse_player_command_now");
}
/*------------------------------------------------------------------------*/
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 80d6d3d49f0..7072a249f8f 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -76,7 +76,7 @@ public:
class Sections {
private:
- int32 cameraShiftAmount = 0;
+ int32 _cameraShiftAmount = 0;
int32 cameraShift_vert_Amount = 0;
bool shut_down_digi_tracks_between_rooms = true;
int32 camera_pan_step = 10;
@@ -86,6 +86,7 @@ private:
void get_walker();
void game_control_cycle();
+ void parse_player_command_now();
public:
Section *_sections = nullptr;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 70344c9c854..b57958503a7 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -45,7 +45,7 @@ namespace M4 {
#define FREE_END 255
#define NUM_FREE FREE_END-(FREE_START)+1
-static void krn_pal_game_task() {
+void krn_pal_game_task() {
int32 status;
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index d87efc36086..317d537dc21 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -104,6 +104,8 @@ extern void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scr
int32 greyX1, int32 greyY1, int32 greyX2, int32 greyY2);
extern void krn_ChangeBufferLuminance(Buffer *target, int32 percent);
+extern void krn_pal_game_task();
+
} // namespace M4
#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 10ef63c3d04..33a8358e8c8 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -88,10 +88,13 @@ void M4Engine::m4_inflight() {
_G(kernel).going = kernel_section_startup();
section_init();
+ m4SceneLoad();
+ m4SceneRun();
+ /*
while (_G(game).section_id == _G(game).new_section && _G(kernel).going) {
}
-
+ */
// TODO
}
}
Commit: c6f2e797180c28983ea11afcedcd27fef3a866cb
https://github.com/scummvm/scummvm/commit/c6f2e797180c28983ea11afcedcd27fef3a866cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added scaling methods
Changed paths:
A engines/m4/adv_r/adv_scale.cpp
A engines/m4/adv_r/adv_scale.h
A engines/m4/adv_r/other.cpp
A engines/m4/adv_r/other.h
R engines/m4/burger/other.cpp
R engines/m4/burger/other.h
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_file.h
engines/m4/burger/hotkeys.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/m4.cpp
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 16a3ecb84d8..e829a0b975e 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -280,6 +280,11 @@ bool kernel_save_game_exists(int32 slot) {
return result;
}
+int kernel_save_game(int slot, const char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData) {
+ error("TODO: kernel_save_game");
+ return 0;
+}
+
bool kernel_load_game(int slot) {
return g_engine->loadGameState(slot).getCode() == Common::kNoError;
}
diff --git a/engines/m4/adv_r/adv_file.h b/engines/m4/adv_r/adv_file.h
index 0ee5d3c9021..e88884b327a 100644
--- a/engines/m4/adv_r/adv_file.h
+++ b/engines/m4/adv_r/adv_file.h
@@ -38,7 +38,7 @@ extern bool kernel_CreateSSFromGrBuff(GrBuff *myBuff, RGB8 *myPalette, bool comp
extern bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff **scr_orig_data, GrBuff **scr_orig);
extern void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **loadBuffer);
-extern int kernel_save_game(int slot, char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
+extern int kernel_save_game(int slot, const char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
extern bool kernel_load_game(int slot);
extern bool kernel_save_game_exists(int32 slot);
diff --git a/engines/m4/adv_r/adv_scale.cpp b/engines/m4/adv_r/adv_scale.cpp
new file mode 100644
index 00000000000..2a8ef38d4e3
--- /dev/null
+++ b/engines/m4/adv_r/adv_scale.cpp
@@ -0,0 +1,136 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_scale.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_pal.h"
+#include "m4/graphics/gr_line.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+#define LABEL_OFFSET 8
+#define _GS(X) _G(scale)._##X
+
+static void scale_editor_clear_rects() {
+ _GS(old_front) = _GS(old_back) = -1;
+ _GS(myback) = _GS(myfront) = _GS(mybs) = _GS(myfs) = -1;
+}
+
+static void scale_editor_init() {
+ scale_editor_clear_rects();
+}
+
+static void scale_editor_undraw() {
+ Buffer *scr_orig = _G(game_bgBuff)->get_buffer();
+ Buffer *game_buff = _G(gameDrawBuff)->get_buffer();
+ int32 status;
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+
+ if (_GS(old_back) != -1) {
+ gr_buffer_rect_copy_2(scr_orig, game_buff, 0, _GS(old_back) - LABEL_OFFSET, 0,
+ _GS(old_back) - LABEL_OFFSET, scr_orig->W, LABEL_OFFSET + 1);
+ RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->W, _GS(old_back) + 1, game_buff_ptr);
+ _GS(old_back) = -1;
+ }
+ if (_GS(old_front) != -1) {
+ gr_buffer_rect_copy_2(scr_orig, game_buff, 0, _GS(old_front) - LABEL_OFFSET, 0,
+ _GS(old_front) - LABEL_OFFSET, scr_orig->W, LABEL_OFFSET + 1);
+ RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->W, _GS(old_front) + 1, game_buff_ptr);
+ _GS(old_front) = -1;
+ }
+
+ _G(game_bgBuff)->release();
+ _G(gameDrawBuff)->release();
+ scale_editor_clear_rects();
+}
+
+void scale_editor_draw() {
+ bool bail = true;
+
+ // Have we drawn before?
+ if (_GS(myback) == -1 && _GS(myfront) == -1)
+ bail = false;
+
+ // Has back or front y changed?
+ if (bail && _GS(myback) != _G(currentSceneDef).back_y && _GS(myfront) != _G(currentSceneDef).front_y)
+ bail = false;
+
+ // Has back or front scale changed?
+ if (bail && _GS(mybs) != _G(currentSceneDef).back_scale && _GS(myfs) != _G(currentSceneDef).front_scale)
+ bail = false;
+
+ // No changes, don't draw.
+ if (bail)
+ return;
+
+ scale_editor_undraw();
+
+ Buffer *game_buff = _G(gameDrawBuff)->get_buffer();
+ int32 status;
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+
+ Buffer *scr_orig = _G(game_bgBuff)->get_buffer();
+
+ gr_color_set(__YELLOW);
+ _GS(myback) = _GS(old_back) = _G(currentSceneDef).back_y;
+ _GS(myfront) = _GS(old_front) = _G(currentSceneDef).front_y;
+ _GS(mybs) = _G(currentSceneDef).back_scale;
+ _GS(myfs) = _G(currentSceneDef).front_scale;
+ gr_hline(game_buff, 0, scr_orig->W, _GS(old_back));
+ gr_hline(game_buff, 0, scr_orig->W, _GS(old_front));
+
+ char string[20];
+ gr_font_set_color(__WHITE);
+ gr_font_set(_G(font_tiny));
+
+ Common::sprintf_s(string, "Front: %ld, %ld", _GS(old_front), _G(currentSceneDef).front_scale);
+ int x;
+ for (x = 10; x < scr_orig->W - 220; x += 400)
+ gr_font_write(game_buff, string, x, _GS(old_front) - LABEL_OFFSET, 0, 0);
+
+ Common::sprintf_s(string, "Back: %ld, %ld", _GS(old_back), _G(currentSceneDef).back_scale);
+ for (x = 110; x < scr_orig->W - 320; x += 400)
+ gr_font_write(game_buff, string, x, _GS(old_back) - LABEL_OFFSET, 0, 0);
+
+ RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->W, _GS(old_back) + 1, game_buff_ptr);
+ RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->W, _GS(old_front) + 1, game_buff_ptr);
+
+ _G(game_bgBuff)->release();
+ _G(gameDrawBuff)->release();
+}
+
+void scale_editor_cancel() {
+ scale_editor_undraw();
+ _G(editors_in_use) &= ~kScaleEditor;
+}
+
+void scale_editor_toggle(void *, void *) {
+ if (_G(editors_in_use) & kScaleEditor)
+ scale_editor_cancel();
+ else {
+ _G(editors_in_use) |= kScaleEditor;
+ scale_editor_init();
+ }
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_scale.h b/engines/m4/adv_r/adv_scale.h
new file mode 100644
index 00000000000..8a1a76502a4
--- /dev/null
+++ b/engines/m4/adv_r/adv_scale.h
@@ -0,0 +1,47 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_SCALE_H
+#define M4_ADV_R_ADV_SCALE_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+constexpr int kScaleEditor = 1;
+
+struct ADVScale_Globals {
+ int32 _old_front = -1;
+ int32 _old_back = -1;
+ int _myback = -1;
+ int _myfront = -1;
+ int _mybs = -1;
+ int _myfs = -1;
+};
+
+extern void scale_editor_draw();
+extern void scale_editor_cancel();
+extern void scale_editor_toggle(void *, void *);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/burger/other.cpp b/engines/m4/adv_r/other.cpp
similarity index 88%
rename from engines/m4/burger/other.cpp
rename to engines/m4/adv_r/other.cpp
index 811ff8656be..3acc17af6db 100644
--- a/engines/m4/burger/other.cpp
+++ b/engines/m4/adv_r/other.cpp
@@ -19,20 +19,16 @@
*
*/
-#include "m4/burger/other.h"
-#include "m4/burger/vars.h"
+#include "m4/adv_r/other.h"
#include "m4/adv_r/adv_file.h"
#include "m4/core/errors.h"
namespace M4 {
-namespace Burger {
-
void other_save_game_for_resurrection(void) {
- if (kernel_save_game(0, NULL, 0, NULL, 0)) {
+ if (kernel_save_game(0, nullptr, 0, nullptr, 0)) {
error_show(FL, 0, "couldn't other_save_game_for_res");
}
}
-} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/other.h b/engines/m4/adv_r/other.h
similarity index 91%
rename from engines/m4/burger/other.h
rename to engines/m4/adv_r/other.h
index ae2ea4fffff..a51ddde1fa0 100644
--- a/engines/m4/burger/other.h
+++ b/engines/m4/adv_r/other.h
@@ -20,17 +20,15 @@
*
*/
-#ifndef M4_BURGER_OTHER_H
-#define M4_BURGER_OTHER_H
+#ifndef M4_ADV_R_OTHER_H
+#define M4_ADV_R_OTHER_H
#include "m4/m4_types.h"
namespace M4 {
-namespace Burger {
extern void other_save_game_for_resurrection();
-} // namespace Burger
} // namespace M4
#endif
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 49ef83d3e86..95f1a6bb980 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -22,7 +22,7 @@
#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
#include "m4/burger/gui/game_menu.h"
-#include "m4/burger/other.h"
+#include "m4/adv_r/other.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index b4300d12ac2..8ce59cdce89 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -24,8 +24,10 @@
#include "m4/adv_r/adv_been.h"
#include "m4/adv_r/adv_file.h"
#include "m4/adv_r/adv_interface.h"
+#include "m4/adv_r/adv_scale.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/db_env.h"
+#include "m4/adv_r/other.h"
#include "m4/fileio/extensions.h"
#include "m4/graphics/krn_pal.h"
#include "m4/gui/gui_buffer.h"
@@ -36,8 +38,6 @@
namespace M4 {
-constexpr int kScaleEditor = 1;
-
HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
warning("TODO: walker_spotter");
return nullptr;
@@ -140,18 +140,76 @@ void Sections::m4SceneLoad() {
if (!_G(set_commands_allowed_since_last_checked))
player_set_commands_allowed(true);
- //-------------------- PLAY ROOM ------------------
+ //-------------------- PRE-PLAY ROOM ------------------
term_message("Off to the races -- %d", timer_read_60());
-}
-void Sections::m4SceneRun() {
game_control_cycle();
if (!player_been_here(_G(game).room_id))
player_enters_scene(_G(game).room_id);
+}
+
+void Sections::m4EndScene() {
+ _G(between_rooms) = true;
+ hotspot_unhide_and_dump();
+
+ if (!_G(kernel).going && _GI()._visible && player_commands_allowed())
+ other_save_game_for_resurrection();
+
+ if (_G(kernel).teleported_in) {
+ _G(kernel).teleported_in = false;
+ pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to black instantly (0 ticks)
+ }
+
+ //-------------------- cancel all editors ------------------
+ scale_editor_cancel();
+#ifdef TODO
+ //-------------------- ROOM SHUTDOWN CODE ------------------
+ term_message("Shuttin' down the scene");
+ util_exec_function(room_shutdown_code_pointer);
+ kernel_unload_room(¤tSceneDef, &screenCodeBuff, &game_bgBuff);
+
+ pal_cycle_stop();
+
+ if (shut_down_digi_tracks_between_rooms) {
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+ digi_flush_mem();
+ }
+ conv_unload(conv_get_handle()); //apr24
+
+ //-------------------- DUMP ASSETS AND MINI-ENGINES ------------------
+ //note machines should always be cleared before anything else
+ ClearWSAssets(_WS_ASSET_MACH, 0, 255);
+ ClearWSAssets(_WS_ASSET_SEQU, 0, 255);
+ ClearWSAssets(_WS_ASSET_DATA, 0, 255);
+ ClearWSAssets(_WS_ASSET_CELS, 0, 255);
+
+ //reload the walker and show scripts.
+ if (!LoadWSAssets("walker script", &_G(master_palette)[0]))
+ {
+ error_show(FL, 'FNF!', "walker script");
+ }
+ if (!LoadWSAssets("show script", &_G(master_palette)[0]))
+ {
+ error_show(FL, 'FNF!', "show script");
+ }
+ if (!LoadWSAssets("stream script", &_G(master_palette)[0]))
+ {
+ error_show(FL, 'FNF', "stream script");
+ }
+
+ // load main interface sprites
+ main_interface_sprite = AddWSAssetCELS("INTERFACE STUFF", 22, &_G(master_palette)[0]);
+ //gr_pal_interface(&_G(master_palette)[0]);
+ if (main_interface_sprite != 22) {
+ error_show(FL, 'SLF!', "interface stuff");
+ }
+#endif
}
void Sections::get_ipl() {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 7072a249f8f..7383c340c36 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -134,7 +134,7 @@ public:
}
void m4SceneLoad();
- void m4SceneRun();
+ void m4EndScene();
};
} // namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 33a8358e8c8..f72dada3ca1 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -89,12 +89,11 @@ void M4Engine::m4_inflight() {
section_init();
m4SceneLoad();
- m4SceneRun();
- /*
- while (_G(game).section_id == _G(game).new_section && _G(kernel).going) {
- }
- */
+ // TODO
+
+ m4EndScene();
+
// TODO
}
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 0381e7e300f..9f4e2cbde0f 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -16,11 +16,13 @@ MODULE_OBJS = \
adv_r/adv_inv.o \
adv_r/adv_player.o \
adv_r/adv_rails.o \
+ adv_r/adv_scale.o \
adv_r/adv_trigger.o \
adv_r/adv_walk.o \
adv_r/conv_io.o \
adv_r/db_env.o \
adv_r/kernel.o \
+ adv_r/other.o \
core/cstring.o \
core/errors.o \
core/globals.o \
@@ -82,7 +84,6 @@ MODULE_OBJS = \
burger/globals.o \
burger/hotkeys.o \
burger/inventory.o \
- burger/other.o \
burger/series_player.o \
burger/vars.o \
burger/walker.o
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index a7f2e3716a7..ed037510ae2 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -33,6 +33,7 @@
#include "m4/adv_r/adv_inv.h"
#include "m4/adv_r/adv_player.h"
#include "m4/adv_r/adv_rails.h"
+#include "m4/adv_r/adv_scale.h"
#include "m4/adv_r/adv_trigger.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/conv_io.h"
@@ -107,6 +108,7 @@ public:
Sound::Digi _digi;
Sound::Midi _midi;
KernelPal_Globals _krnPal;
+ ADVScale_Globals _scale;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
@@ -171,6 +173,7 @@ public:
Common::String _currCodeFN;
ScreenContext *_game_buff_ptr = nullptr;
machine *_my_walker = nullptr;
+ uint32 _editors_in_use = 0;
};
#define _G(X) (g_vars->_##X)
Commit: aceeb68f642111642adfd490404a2f071a8c8b67
https://github.com/scummvm/scummvm/commit/aceeb68f642111642adfd490404a2f071a8c8b67
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More main inflight loop
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/burger/vars.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/m4.cpp
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 455169425a3..75c964669aa 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -43,5 +43,16 @@ void Converstation_Globals::conv_reset_all() {
conv_save_buff.clear();
}
+/*------------------------------------------------------------------------*/
+
+void conv_unload(Conv *c) {
+ error("TODO: conv_unload");
+}
+
+Conv *conv_get_handle() {
+ error("TODO: conv_get_handle");
+ return nullptr;
+}
+
} // End of namespace M4
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index cb7d8c8fcee..c78ef994ec3 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -46,7 +46,6 @@ private:
protected:
void main_cold_data_init() override;
- void global_menu_system_init() override;
void initialize_game() override;
public:
@@ -74,6 +73,7 @@ public:
return &_walker;
}
+ void global_menu_system_init() override;
};
extern Vars *g_globals;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 8ce59cdce89..f1cd7e12670 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -143,7 +143,9 @@ void Sections::m4SceneLoad() {
//-------------------- PRE-PLAY ROOM ------------------
term_message("Off to the races -- %d", timer_read_60());
+}
+void Sections::m4RunScene() {
game_control_cycle();
if (!player_been_here(_G(game).room_id))
@@ -165,51 +167,40 @@ void Sections::m4EndScene() {
//-------------------- cancel all editors ------------------
scale_editor_cancel();
-#ifdef TODO
+
//-------------------- ROOM SHUTDOWN CODE ------------------
term_message("Shuttin' down the scene");
- util_exec_function(room_shutdown_code_pointer);
- kernel_unload_room(¤tSceneDef, &screenCodeBuff, &game_bgBuff);
+ room_shutdown();
+ kernel_unload_room(&_G(currentSceneDef), &_G(screenCodeBuff), &_G(game_bgBuff));
pal_cycle_stop();
if (shut_down_digi_tracks_between_rooms) {
- digi_stop(1);
- digi_stop(2);
- digi_stop(3);
- digi_flush_mem();
+ _G(digi).stop(1);
+ _G(digi).stop(2);
+ _G(digi).stop(3);
+ _G(digi).flush_mem();
}
- conv_unload(conv_get_handle()); //apr24
+
+ conv_unload(conv_get_handle());
//-------------------- DUMP ASSETS AND MINI-ENGINES ------------------
- //note machines should always be cleared before anything else
+ // Note machines should always be cleared before anything else
ClearWSAssets(_WS_ASSET_MACH, 0, 255);
ClearWSAssets(_WS_ASSET_SEQU, 0, 255);
ClearWSAssets(_WS_ASSET_DATA, 0, 255);
ClearWSAssets(_WS_ASSET_CELS, 0, 255);
- //reload the walker and show scripts.
+ // Reload the walker and show scripts.
if (!LoadWSAssets("walker script", &_G(master_palette)[0]))
- {
error_show(FL, 'FNF!', "walker script");
- }
if (!LoadWSAssets("show script", &_G(master_palette)[0]))
- {
error_show(FL, 'FNF!', "show script");
- }
if (!LoadWSAssets("stream script", &_G(master_palette)[0]))
- {
error_show(FL, 'FNF', "stream script");
- }
- // load main interface sprites
- main_interface_sprite = AddWSAssetCELS("INTERFACE STUFF", 22, &_G(master_palette)[0]);
- //gr_pal_interface(&_G(master_palette)[0]);
- if (main_interface_sprite != 22) {
- error_show(FL, 'SLF!', "interface stuff");
- }
-#endif
+ g_vars->global_menu_system_init();
}
void Sections::get_ipl() {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 7383c340c36..63e4f85ae7e 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -134,6 +134,7 @@ public:
}
void m4SceneLoad();
+ void m4RunScene();
void m4EndScene();
};
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index f72dada3ca1..06b0f69e808 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -76,7 +76,7 @@ Common::Error M4Engine::run() {
void M4Engine::m4_inflight() {
Hotkeys::add_hot_keys();
- while (_G(kernel).going) {
+ while (_G(kernel).going && !shouldQuit()) {
if (_G(game).previous_room == -2) {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
@@ -88,13 +88,11 @@ void M4Engine::m4_inflight() {
_G(kernel).going = kernel_section_startup();
section_init();
- m4SceneLoad();
-
- // TODO
-
- m4EndScene();
-
- // TODO
+ while (_G(game).new_section == _G(game).section_id) {
+ m4SceneLoad();
+ m4RunScene();
+ m4EndScene();
+ }
}
}
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index fc48ec70dc2..d9ee99fda93 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -66,6 +66,14 @@ int32 Digi::play_loop(const char *name, int32 channel, int32 vol, int32 trigger,
return 0;
}
+void Digi::stop(int slot) {
+ error("TODO: Digi::stop");
+}
+
+void Digi::flush_mem() {
+ error("TODO: Digi::flush_mem");
+}
+
void Digi::read_another_chunk() {
warning("TODO: Digi::read_another_chunk");
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 93f297bee35..b9712baeab7 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -51,6 +51,8 @@ public:
int32 play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
int32 play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+ void stop(int slot);
+ void flush_mem();
void read_another_chunk();
};
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index ed037510ae2..732d61b2a09 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -75,7 +75,6 @@ private:
protected:
virtual void main_cold_data_init() = 0;
- virtual void global_menu_system_init() = 0;
virtual void initialize_game() = 0;
public:
@@ -86,6 +85,7 @@ public:
virtual GlobalVars *getGlobals() = 0;
virtual Interface *getInterface() = 0;
virtual Walker *getWalker() = 0;
+ virtual void global_menu_system_init() = 0;
GameControl _game;
Kernel _kernel;
Commit: d7107bbe0275aec006d7b3035b7dc65c40792d1a
https://github.com/scummvm/scummvm/commit/d7107bbe0275aec006d7b3035b7dc65c40792d1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Extra globals initialization
Changed paths:
engines/m4/adv_r/adv_rails.h
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_hal.h
diff --git a/engines/m4/adv_r/adv_rails.h b/engines/m4/adv_r/adv_rails.h
index 480b8ff1754..168520c227a 100644
--- a/engines/m4/adv_r/adv_rails.h
+++ b/engines/m4/adv_r/adv_rails.h
@@ -30,13 +30,13 @@
namespace M4 {
struct Rails_Globals {
- railNode **myNodes;
- int16 *myEdges;
+ railNode **myNodes = nullptr;
+ int16 *myEdges = nullptr;
- railNode **stackBottom, **stackTop;
- noWalkRect *noWalkRectList;
+ railNode **stackBottom = nullptr, **stackTop = nullptr;
+ noWalkRect *noWalkRectList = nullptr;
- int32 memtypePATHN;
+ int32 memtypePATHN = 0;
};
extern bool InitRails();
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 8e9a731b98a..a2ee1c70897 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -155,6 +155,28 @@ bool ws_InitCruncher(void) {
return true;
}
+void ws_KillCruncher() {
+ Anim8 *myAnim8;
+
+ if (_GWS(cruncherInitialized)) {
+ myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
+ while (myAnim8) {
+ _GWS(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
+ if (myAnim8->myCCB) {
+ KillCCB(myAnim8->myCCB, false);
+ }
+ mem_free(myAnim8->myRegs);
+ myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
+ }
+ mem_free(_GWS(myCruncher));
+ if (_GWS(stackBase)) {
+ mem_free(_GWS(stackBase));
+ }
+
+ _GWS(cruncherInitialized) = false;
+ }
+}
+
Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash) {
Anim8 *myAnim8;
frac16 *myRegs;
@@ -1547,29 +1569,6 @@ void ws_CrunchEOSreqs(void) {
}
}
-void ws_KillCruncher() {
- Anim8 *myAnim8;
-
- // Make sure the cruncher has been initialized
- VERIFY_INTIALIZED("ws_KillCruncher()");
-
- myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
- while (myAnim8) {
- _GWS(myCruncher)->firstAnim8ToCrunch = myAnim8->next;
- if (myAnim8->myCCB) {
- KillCCB(myAnim8->myCCB, false);
- }
- mem_free(myAnim8->myRegs);
- myAnim8 = _GWS(myCruncher)->firstAnim8ToCrunch;
- }
- mem_free(_GWS(myCruncher));
- if (_GWS(stackBase)) {
- mem_free(_GWS(stackBase));
- }
-
- _GWS(cruncherInitialized) = false;
-}
-
// This proc was designed to allow the state machine to issue an OnEndSeq request
// In which the cruncher will signal the state machine should an anim8 ever finish.
bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount) {
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index 36cad42320d..a33fef636f8 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -41,7 +41,7 @@ namespace M4 {
#define ERR_MACH 2
struct WSHal_Globals {
- RectList *_deadRectList;
+ RectList *_deadRectList = nullptr;
};
extern bool ws_InitHAL();
Commit: 06e3b47ab7d185cba277d22c694638a85f86edf9
https://github.com/scummvm/scummvm/commit/06e3b47ab7d185cba277d22c694638a85f86edf9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix adv_been table size
Changed paths:
engines/m4/adv_r/adv_been.cpp
engines/m4/adv_r/adv_been.h
diff --git a/engines/m4/adv_r/adv_been.cpp b/engines/m4/adv_r/adv_been.cpp
index d50aa283359..3c8df15e639 100644
--- a/engines/m4/adv_r/adv_been.cpp
+++ b/engines/m4/adv_r/adv_been.cpp
@@ -26,8 +26,11 @@
namespace M4 {
+#define TOTAL_SCENES 180
+
bool player_been_init(int16 num_scenes) {
- _G(scene_list).table = (byte *)mem_alloc(sizeof(byte) * num_scenes, "been_scenes");
+ assert(num_scenes == TOTAL_SCENES);
+ _G(scene_list).table = (int16 *)mem_alloc(sizeof(int16) * num_scenes, "been_scenes");
if (!_G(scene_list).table)
error_show(FL, 'OOM!', "player_been_init");
@@ -43,19 +46,23 @@ void player_been_shutdown() {
}
void player_reset_been() {
- memset(_G(scene_list).table, 0, sizeof(int16) * _G(scene_list).total_scenes);
+ Common::fill(_G(scene_list).table, _G(scene_list).table + TOTAL_SCENES, 180);
+ _G(scene_list).total_scenes = TOTAL_SCENES;
_G(scene_list).tail = 0;
}
void player_been_sync(Common::Serializer &s) {
// Handle number of scenes
- s.syncAsUint32LE(_G(scene_list).total_scenes);
+ int count = _G(scene_list).total_scenes;
+ s.syncAsUint32LE(count);
+ assert(s.isSaving() || count == _G(scene_list).total_scenes);
// Handle current tail
s.syncAsUint32LE(_G(scene_list).tail);
- // Handle scene list table
- s.syncBytes(_G(scene_list).table, _G(scene_list).total_scenes);
+ // Handle table
+ for (int i = 0; i < count; ++i)
+ s.syncAsSint16LE(_G(scene_list).table[i]);
}
bool player_been_here(int16 scene_num) {
diff --git a/engines/m4/adv_r/adv_been.h b/engines/m4/adv_r/adv_been.h
index d135b9dbb6d..8fc7a3af10b 100644
--- a/engines/m4/adv_r/adv_been.h
+++ b/engines/m4/adv_r/adv_been.h
@@ -32,7 +32,7 @@ namespace M4 {
struct Scene_list {
int32 total_scenes = 0;
int32 tail = 0;
- byte *table = nullptr;
+ int16 *table = nullptr;
};
/**
Commit: 66189df2312209120510d5a3afc593886a491295
https://github.com/scummvm/scummvm/commit/66189df2312209120510d5a3afc593886a491295
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Set kernel.going to enter inflight loop
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/m4.cpp
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index f1cd7e12670..7cd55e72b58 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -48,10 +48,12 @@ void Sections::global_section_constructor() {
assert(sectionNum >= 1 && sectionNum <= 9);
_activeSection = &_sections[sectionNum - 1];
+ assert(_activeSection);
}
void Sections::section_room_constructor() {
_activeRoom = (*_activeSection)[_G(game).new_room];
+ assert(_activeRoom);
}
void Sections::m4SceneLoad() {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 06b0f69e808..a2a6aa92c02 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -75,6 +75,7 @@ Common::Error M4Engine::run() {
void M4Engine::m4_inflight() {
Hotkeys::add_hot_keys();
+ _G(kernel).going = true;
while (_G(kernel).going && !shouldQuit()) {
if (_G(game).previous_room == -2) {
Commit: 965d8b85fd1e2170407825a1c03ce546ce2f1ef2
https://github.com/scummvm/scummvm/commit/965d8b85fd1e2170407825a1c03ce546ce2f1ef2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton startup room class
Changed paths:
A engines/m4/burger/rooms/section1/section1.cpp
A engines/m4/burger/rooms/section1/section1.h
A engines/m4/burger/rooms/section9/room951.cpp
A engines/m4/burger/rooms/section9/room951.h
A engines/m4/burger/rooms/section9/section9.cpp
A engines/m4/burger/rooms/section9/section9.h
R engines/m4/burger/rooms/section1.cpp
R engines/m4/burger/rooms/section1.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/rooms/section.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index d590dc5b954..a35a19d52fe 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -28,7 +28,15 @@ namespace Burger {
BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
- _sections = &_SECTIONS[0];
+ _sections.push_back(&_section1);
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section9);
}
M4::Vars *BurgerEngine::createVars() {
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 50b79a157c6..e0e0ad811a8 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -23,16 +23,23 @@
#define M4_BURGER_BURGER_H
#include "m4/m4.h"
-#include "m4/burger/rooms/section1.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section9/section9.h"
namespace M4 {
namespace Burger {
class BurgerEngine : public M4Engine {
private:
- const Section _SECTIONS[1] = {
- Rooms::Section1()
- };
+ Rooms::Section1 _section1;
+ Rooms::Section1 _section2;
+ Rooms::Section1 _section3;
+ Rooms::Section1 _section4;
+ Rooms::Section1 _section5;
+ Rooms::Section1 _section6;
+ Rooms::Section1 _section7;
+ Rooms::Section1 _section8;
+ Rooms::Section9 _section9;
protected:
/**
* Creates the structure that holds all the global variables
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
index e366ca771b9..f4bb1875d44 100644
--- a/engines/m4/burger/rooms/section.h
+++ b/engines/m4/burger/rooms/section.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Section : public M4::Section {
public:
- Section(Room *rooms, size_t count) : M4::Section(rooms, count) {}
+ Section() : M4::Section() {}
~Section() override {}
void daemon_code() override;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
new file mode 100644
index 00000000000..7f1f8bff1f0
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/section1.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1.h b/engines/m4/burger/rooms/section1/section1.h
similarity index 87%
rename from engines/m4/burger/rooms/section1.h
rename to engines/m4/burger/rooms/section1/section1.h
index 8610fff4541..d61c437cba6 100644
--- a/engines/m4/burger/rooms/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -29,18 +29,9 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-class DummyRoom : public Rooms::Room {
-public:
- DummyRoom() : Rooms::Room(666) {}
-};
-
class Section1 : public Rooms::Section {
-private:
- Room _ROOMS[1] = {
- DummyRoom()
- };
public:
- Section1() : Rooms::Section(&_ROOMS[0], 1) {}
+ Section1() : Rooms::Section() {}
virtual ~Section1() {}
};
diff --git a/engines/m4/burger/rooms/section1.cpp b/engines/m4/burger/rooms/section9/room951.cpp
similarity index 95%
rename from engines/m4/burger/rooms/section1.cpp
rename to engines/m4/burger/rooms/section9/room951.cpp
index b5f85eb41fa..8cd495c29f3 100644
--- a/engines/m4/burger/rooms/section1.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/rooms/section1.h"
+#include "m4/burger/rooms/section9/room951.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
new file mode 100644
index 00000000000..6e3ed99d5f1
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room951.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 M4_BURGER_ROOMS_SECTION9_ROOM951_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM951_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room951 : public Rooms::Room {
+public:
+ Room951() : Rooms::Room(951) {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
new file mode 100644
index 00000000000..649e81895f2
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/section9.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section9::Section9() : Rooms::Section() {
+ add(&_room951);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
new file mode 100644
index 00000000000..7e46f2dd42d
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION9_H
+#define M4_BURGER_ROOMS_SECTION9_H
+
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section9/room951.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section9 : public Rooms::Section {
+private:
+ Room951 _room951;
+public:
+ Section9();
+ virtual ~Section9() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 7cd55e72b58..57344437850 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -47,7 +47,7 @@ void Sections::global_section_constructor() {
uint sectionNum = _G(game).new_section;
assert(sectionNum >= 1 && sectionNum <= 9);
- _activeSection = &_sections[sectionNum - 1];
+ _activeSection = _sections[sectionNum - 1];
assert(_activeSection);
}
@@ -309,9 +309,9 @@ void Sections::parse_player_command_now() {
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
- for (uint i = 0; i < _roomsCount; ++i) {
- if (_rooms[i]._roomNum == roomNum)
- return &_rooms[i];
+ for (uint i = 0; i < _rooms.size(); ++i) {
+ if (_rooms[i]->_roomNum == roomNum)
+ return _rooms[i];
}
error("Unknown room number - %d", roomNum);
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 63e4f85ae7e..ccfabc5c083 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -22,6 +22,7 @@
#ifndef M4_CORE_ROOMS_H
#define M4_CORE_ROOMS_H
+#include "common/array.h"
#include "m4/adv_r/adv.h"
namespace M4 {
@@ -48,10 +49,15 @@ public:
class Section {
private:
- Room *const _rooms;
- const size_t _roomsCount = 0;
+ Common::Array<Room *> _rooms;
+protected:
+ // Add a room to the section
+ void add(Room *room) {
+ _rooms.push_back(room);
+ }
+
public:
- Section(Room *rooms, size_t count) : _rooms(rooms), _roomsCount(count) {}
+ Section() {}
virtual ~Section() {}
virtual void preLoad() {}
@@ -88,8 +94,10 @@ private:
void game_control_cycle();
void parse_player_command_now();
+protected:
+ Common::Array<Section *> _sections;
+
public:
- Section *_sections = nullptr;
Section *_activeSection = nullptr;
Room *_activeRoom = nullptr;
public:
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index fff59e20cba..1fc2ef2c285 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -43,19 +43,9 @@ namespace M4 {
struct M4GameDescription;
class M4Engine : public Engine, public Sections {
- enum GamePhase {
- FirstRun,
- SectionStartup,
- SceneLoad,
- SceneRun,
- EndScene,
- LastRun,
- GameFinished
- };
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
- GamePhase _gamePhase = FirstRun;
/**
* Main game loop
@@ -73,7 +63,6 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
- const Section *_sections = nullptr;
public:
M4Engine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9f4e2cbde0f..953f9d27734 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -79,7 +79,9 @@ MODULE_OBJS = \
burger/gui/interface.o \
burger/rooms/room.o \
burger/rooms/section.o \
- burger/rooms/section1.o \
+ burger/rooms/section1/section1.o \
+ burger/rooms/section9/section9.o \
+ burger/rooms/section9/room951.o \
burger/burger.o \
burger/globals.o \
burger/hotkeys.o \
Commit: 2d1409620c629d6fef25274f61d709c580e3dcdb
https://github.com/scummvm/scummvm/commit/2d1409620c629d6fef25274f61d709c580e3dcdb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 951 logic
Changed paths:
engines/m4/adv_r/adv_trigger.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/rooms/section9/room951.h
engines/m4/burger/series_player.h
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 782ebe937a5..6849406a07f 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -27,6 +27,9 @@
namespace M4 {
+constexpr int NO_TRIGGER = -1;
+constexpr int CALLED_EACH_LOOP = 32764;
+
constexpr int MAX_TIMERS = 32;
struct Triggers {
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 8cd495c29f3..a0ebea94ede 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -20,11 +20,218 @@
*/
#include "m4/burger/rooms/section9/room951.h"
+#include "m4/adv_r/adv_trigger.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+enum scene_triggers {
+ START_ORION_BURGER_POSTER = 1,
+
+ // Triggers to start streamers
+ START_PLANET_X_HILLTOP_A,
+ START_PLANET_X_LOW_GROUND_SHOT,
+ START_PLANET_X_HILLTOP_B,
+ START_SPACE_STATION_PANORAMA_A,
+ START_CARGO_TRANSFER_AREA_A,
+ START_VPS_OFFICE_A,
+ START_HOLOGRAM,
+ START_VPS_OFFICE_B,
+ START_CARGO_TRANSFER_AREA_B,
+ START_CARGO_TRANSFER_CONTROLS,
+ START_SPACE_STATION_PANORAMA_B,
+ START_CALL_TO_ACTION,
+
+ // Misc triggers for all animations
+ FADE_DOWN_FAST,
+ FADE_UP_FAST,
+
+ FADE_DOWN_SLOW,
+ FADE_UP_SLOW,
+
+ LAST_SCENE_TRIGGER
+};
+
+
+static seriesStreamBreak planet_x_hilltop_a[] = {
+ // frame sound chan vol trigger flags variable value
+ { 0, "951_000", 3, 100, NO_TRIGGER, 0, nullptr, 0 },
+ { 15, "951_004", 2, 150, NO_TRIGGER, 0, nullptr, 0 },
+ { 36, "951_009", 1, 150, NO_TRIGGER, 1024, nullptr, 0 },
+ { 80, "951_004b", 2, 150, NO_TRIGGER, 1024, nullptr, 0 },
+ { 114, nullptr, 2, 100, NO_TRIGGER, 0, nullptr, 0 },
+ { 124, nullptr, 2, 50, NO_TRIGGER, 0, nullptr, 0 },
+ { 134, "951Z001", 2, 230, NO_TRIGGER, 0, nullptr, 0 },
+ { 158, "951_006", 1, 255, NO_TRIGGER, 0, nullptr, 0 },
+ { 165, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 },
+ { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
+};
+
+void Room951::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room951::init() {
+ _G(kernel).supress_fadeup = true;
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_ORION_BURGER_POSTER);
+}
+
+void Room951::daemon() {
+ switch (_G(kernel).trigger) {
+ case START_ORION_BURGER_POSTER:
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+
+ digi_preload("951music", -1);
+ digi_play("951music", 1, 255, START_PLANET_X_HILLTOP_A, -1);
+ digi_preload("952music", -1);
+#ifdef TODO
+ digi_preload_stream_breaks(planet_x_hilltop_a);
+
+ digi_preload_stream_breaks(planet_x_low_shot);
+ digi_preload_stream_breaks(planet_x_hilltop_b);
+ digi_preload_stream_breaks(panorama_a);
+ digi_preload_stream_breaks(cargo_transfer_a);
+ digi_preload_stream_breaks(vps_office_a);
+ digi_preload_stream_breaks(hologram);
+ digi_preload_stream_breaks(vps_office_b);
+ break;
+
+ case START_PLANET_X_HILLTOP_A:
+ palette_prep_for_stream();
+ series_stream_with_breaks(planet_x_hilltop_a, "PLANET X HILLTOP A", 6, 1, START_PLANET_X_LOW_GROUND_SHOT);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_PLANET_X_LOW_GROUND_SHOT:
+ palette_prep_for_stream();
+ series_stream_with_breaks(planet_x_low_shot, "Planet X Low Ground Shot", 6, 1, START_PLANET_X_HILLTOP_B);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_PLANET_X_HILLTOP_B:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(planet_x_hilltop_a);
+ series_stream_with_breaks(planet_x_hilltop_b, "Planet X Hilltop B", 6, 1, START_SPACE_STATION_PANORAMA_A);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_SPACE_STATION_PANORAMA_A:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(planet_x_low_shot);
+ series_stream_with_breaks(panorama_a, "Space Station Panorama A", 6, 1, START_CARGO_TRANSFER_AREA_A);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_CARGO_TRANSFER_AREA_A:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(planet_x_hilltop_b);
+ series_stream_with_breaks(cargo_transfer_a, "Cargo Transfer Area A", 6, 1, START_VPS_OFFICE_A);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_VPS_OFFICE_A:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(panorama_a);
+ series_stream_with_breaks(vps_office_a, "VP's Office A", 6, 1, START_HOLOGRAM);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_HOLOGRAM:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(cargo_transfer_a);
+ series_stream_with_breaks(hologram, "Hologram", 6, 1, START_VPS_OFFICE_B);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_VPS_OFFICE_B:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(vps_office_a);
+ series_stream_with_breaks(vps_office_b, "VP's Office B", 6, 1, START_CARGO_TRANSFER_AREA_B);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_CARGO_TRANSFER_AREA_B:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(hologram);
+ digi_preload_stream_breaks(cargo_transfer_b);
+ series_stream_with_breaks(cargo_transfer_b, "Cargo Transfer Area B", 6, 1, START_CARGO_TRANSFER_CONTROLS);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_CARGO_TRANSFER_CONTROLS:
+ palette_prep_for_stream();
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+ digi_unload_stream_breaks(vps_office_b);
+ digi_preload_stream_breaks(transfer_controls);
+ series_stream_with_breaks(transfer_controls, "Cargo Transfer Controls", 6, 1, START_SPACE_STATION_PANORAMA_B);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_SPACE_STATION_PANORAMA_B:
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(transfer_controls);
+ digi_unload_stream_breaks(cargo_transfer_b);
+ digi_preload_stream_breaks(panorama_b);
+ series_stream_with_breaks(panorama_b, "Space Station Panorama B", 6, 1, START_CALL_TO_ACTION);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case START_CALL_TO_ACTION:
+ if (executing == INTERACTIVE_DEMO) {
+ palette_prep_for_stream();
+ digi_unload_stream_breaks(transfer_controls);
+ digi_preload_stream_breaks(call_to_action);
+ series_stream_with_breaks(call_to_action, "Call To Action", 6, 1, LAST_SCENE_TRIGGER);
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ } else {
+ kernel_trigger_dispatch_now(LAST_SCENE_TRIGGER);
+ }
+ break;
+
+ case FADE_DOWN_FAST:
+ pal_fade_init(&master_palette[0], 0, 255, 0, 30, NO_TRIGGER); // half second fade down
+ break;
+
+ case FADE_DOWN_SLOW:
+ pal_fade_init(&master_palette[0], 0, 255, 0, 60, NO_TRIGGER); // one second fade down
+ break;
+
+ case FADE_UP_FAST:
+ pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ break;
+
+ case FADE_UP_SLOW:
+ pal_fade_init(&master_palette[0], 0, 255, 100, 60, NO_TRIGGER); // one second fade up
+ break;
+
+ case LAST_SCENE_TRIGGER:
+
+ switch (executing) {
+
+ case INTERACTIVE_DEMO:
+ game.new_room = 901; // go back to demo menu
+ break;
+
+ case WHOLE_GAME:
+ game.new_room = 901; // debug for now go back to demo menu until main game menu is available
+ break;
+ }
+ ShowCursor();
+ break;
+#endif
+ case 49:
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
index 6e3ed99d5f1..d72695eceb0 100644
--- a/engines/m4/burger/rooms/section9/room951.h
+++ b/engines/m4/burger/rooms/section9/room951.h
@@ -31,6 +31,11 @@ namespace Rooms {
class Room951 : public Rooms::Room {
public:
Room951() : Rooms::Room(951) {}
+
+ void preload() override;
+ void init() override;
+ void pre_parser() override {}
+ void daemon() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/series_player.h b/engines/m4/burger/series_player.h
index 380a04160a6..e00eb888571 100644
--- a/engines/m4/burger/series_player.h
+++ b/engines/m4/burger/series_player.h
@@ -31,14 +31,15 @@ namespace Burger {
struct seriesStreamBreak {
int32 frame = 0;
- char *sound = nullptr;
+ const char *sound = nullptr;
int32 channel = 0;
int32 volume = 0;
int32 trigger = 0;
uint32 flags = 0;
- int32 *variable = nullptr;
+ const int32 *variable = nullptr;
int32 value = 0;
};
+
// Used as last line of seriesStreamBreak arrays
#define SERIES_STREAM_BREAK_END -1,nullptr,0,0,NO_TRIGGER,nullptr,nullptr,nullptr
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index d9ee99fda93..eba3c3aa5dc 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -80,6 +80,10 @@ void Digi::read_another_chunk() {
} // namespace Sound
+void digi_preload(const Common::String &name, int roomNum) {
+ _G(digi).preload(name, roomNum);
+}
+
int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
return _G(digi).play(name, channel, vol, trigger, room_num);
}
@@ -92,4 +96,8 @@ void digi_read_another_chunk() {
return _G(digi).read_another_chunk();
}
+void digi_stop(int slot) {
+ _G(digi).stop(slot);
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index b9712baeab7..39ec9c10588 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -34,10 +34,14 @@ private:
Common::StringArray _names;
private:
- void preload(const Common::String &name, int roomNum);
void unload(const Common::String &name);
public:
+ /**
+ * Preload a digi sample into memory buffer for play back later.
+ */
+ void preload(const Common::String &name, int roomNum);
+
void preload_sounds(const char **names);
void unload_sounds();
void task();
@@ -59,9 +63,14 @@ public:
} // namespace Sound
+extern void digi_preload(const Common::String &name, int roomNum);
extern int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern void digi_read_another_chunk();
+extern void digi_stop(int slot);
+
+//extern void digi_preload_stream_breaks(const seriesStreamBreak *list);
+//extern void digi_unload_stream_breaks(const seriesStreamBreak *list);
} // namespace M4
Commit: 96bd0dd735f9206b89755ce5c00006b443c6ebc9
https://github.com/scummvm/scummvm/commit/96bd0dd735f9206b89755ce5c00006b443c6ebc9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding stream break methods
Changed paths:
A engines/m4/burger/stream_break.cpp
A engines/m4/burger/stream_break.h
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/series_player.h
engines/m4/burger/vars.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/module.mk
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 351ea9088ed..f9740a6d150 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_ROOM_H
#include "m4/core/rooms.h"
+#include "m4/burger/stream_break.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index a0ebea94ede..2666779ae10 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -66,7 +66,8 @@ static seriesStreamBreak planet_x_hilltop_a[] = {
{ 134, "951Z001", 2, 230, NO_TRIGGER, 0, nullptr, 0 },
{ 158, "951_006", 1, 255, NO_TRIGGER, 0, nullptr, 0 },
{ 165, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 },
- { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
+ { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 },
+ STREAM_BREAK_END
};
void Room951::preload() {
@@ -89,9 +90,9 @@ void Room951::daemon() {
digi_preload("951music", -1);
digi_play("951music", 1, 255, START_PLANET_X_HILLTOP_A, -1);
digi_preload("952music", -1);
-#ifdef TODO
- digi_preload_stream_breaks(planet_x_hilltop_a);
+ digi_preload_stream_breaks(planet_x_hilltop_a);
+#ifdef TODO
digi_preload_stream_breaks(planet_x_low_shot);
digi_preload_stream_breaks(planet_x_hilltop_b);
digi_preload_stream_breaks(panorama_a);
diff --git a/engines/m4/burger/series_player.h b/engines/m4/burger/series_player.h
index e00eb888571..262058288e0 100644
--- a/engines/m4/burger/series_player.h
+++ b/engines/m4/burger/series_player.h
@@ -29,20 +29,6 @@
namespace M4 {
namespace Burger {
-struct seriesStreamBreak {
- int32 frame = 0;
- const char *sound = nullptr;
- int32 channel = 0;
- int32 volume = 0;
- int32 trigger = 0;
- uint32 flags = 0;
- const int32 *variable = nullptr;
- int32 value = 0;
-};
-
-// Used as last line of seriesStreamBreak arrays
-#define SERIES_STREAM_BREAK_END -1,nullptr,0,0,NO_TRIGGER,nullptr,nullptr,nullptr
-
struct seriesPlayBreak {
int32 firstFrame = 0;
int32 lastFrame = 0;
@@ -57,7 +43,6 @@ struct seriesPlayBreak {
};
#define WITH_SHADOW 1 // Flag for seriesPlayBreak
#define PRELOAD_SOUNDS 2 // Flag for seriesPlayBreak
-#define SERIES_PLAY_BREAK_END -1,-1,nullptr,0,0,NO_TRIGGER,nullptr,0,nullptr,nullptr // used as last line of seriesPlayBreak arrays
struct seriesPlayer {
seriesPlayBreak *break_list = nullptr; // Holds the list of breaks for digi plays
diff --git a/engines/m4/burger/stream_break.cpp b/engines/m4/burger/stream_break.cpp
new file mode 100644
index 00000000000..4537fac5818
--- /dev/null
+++ b/engines/m4/burger/stream_break.cpp
@@ -0,0 +1,121 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/stream_break.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+#define _GB(X) _G(streamBreak)._##X
+
+static void set_next_series_stream_break() {
+ _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
+
+ // While there is a positive frame to break on...
+ while (_GB(my_stream_break)->frame >= 0) {
+ // If variable is null or variable = value then this break is used
+ // Note: if Variable != value this break is skipped
+ if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) {
+ series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, gSERIES_STREAM_BREAK);
+ break;
+ }
+ ++_GB(my_stream_break_index); // go to the next break in list
+ _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)]; // grab the info from the list
+ }
+}
+
+void handle_series_stream_break() {
+ int32 thisFrame = _GB(my_stream_break)->frame;
+
+ // Handle all breaks for this frame number (only one series break can occur on each frame)
+ // There can be any number of things to do once we've broken on a particular frame.
+
+ while (thisFrame == _GB(my_stream_break)->frame) {
+
+ if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) { // if there is a variable check if equal value
+
+ if (_GB(my_stream_break)->flags & DIGI_STOP) { // Should we do a digi_stop?
+ digi_stop(_GB(my_stream_break)->channel);
+ }
+
+ if (_GB(my_stream_break)->sound) { // Is there is a sound to play?
+ if (_GB(my_stream_break)->flags & DIGI_LOOP) { // Should it be looped?
+ digi_play_loop(_GB(my_stream_break)->sound, _GB(my_stream_break)->channel, _GB(my_stream_break)->volume, _GB(my_stream_break)->trigger);
+ } else {
+ digi_play(_GB(my_stream_break)->sound, _GB(my_stream_break)->channel, _GB(my_stream_break)->volume, _GB(my_stream_break)->trigger);
+ }
+ } else {
+ // No sound to play, so see if there is a trigger to dispatch
+ if (_GB(my_stream_break)->trigger != NO_TRIGGER) {
+ kernel_trigger_dispatch(kernel_trigger_create(_GB(my_stream_break)->trigger));
+ }
+ }
+ }
+
+ ++_GB(my_stream_break_index); // Go to next break in list
+ _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
+ }
+
+ if (_GB(my_stream_break)->frame >= 0) { // If we aren't at end of list yet, set up next stream break
+ set_next_series_stream_break();
+ }
+}
+
+void series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger) {
+ _GB(my_stream_break_index) = 0;
+ _GB(my_stream_break_list) = list;
+ _GB(my_stream_viewer) = series_stream(name, framerate, depth, trigger);
+ set_next_series_stream_break();
+}
+
+void digi_preload_stream_breaks(const seriesStreamBreak list[]) {
+ int32 i = 0;
+
+ while (list[i].frame >= 0) { // While there is a legitimate frame to break on
+ // If variable is null or variable = value then this break is used
+ if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
+ if (list[i].sound) { // If there is a sound to load for this break
+ if (!digi_preload(list[i].sound)) { // Check to see if it loaded ok
+ term_message("**** Couldn't load: %s.RAW", list[i].sound);
+ }
+ }
+ }
+
+ ++i; // Next in list please
+ }
+}
+
+void digi_unload_stream_breaks(const seriesStreamBreak list[]) {
+ int32 i = 0;
+
+ while (list[i].frame >= 0) {
+ if (list[i].sound) { // if there is a sound to unload
+ digi_unload(list[i].sound); // unload it
+ }
+ ++i; // next in list please
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/stream_break.h b/engines/m4/burger/stream_break.h
new file mode 100644
index 00000000000..de2dfa7b742
--- /dev/null
+++ b/engines/m4/burger/stream_break.h
@@ -0,0 +1,63 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_STREAM_BREAK_H
+#define M4_BURGER_STREAM_BREAK_H
+
+#include "m4/m4_types.h"
+#include "m4/wscript/ws_machine.h"
+
+namespace M4 {
+namespace Burger {
+
+struct seriesStreamBreak {
+ int32 frame = 0;
+ const char *sound = nullptr;
+ int32 channel = 0;
+ int32 volume = 0;
+ int32 trigger = 0;
+ uint32 flags = 0;
+ const int32 *variable = nullptr;
+ int32 value = 0;
+};
+#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
+
+// Flags for series_stream_with_breaks and series_play_with_breaks
+#define DIGI_LOOP 1024 // these must be more than the series play flags
+#define DIGI_STOP 2048
+
+struct StreamBreak_Globals {
+ int32 _my_stream_break_index = 0; // Holds which line of the list currently waiting for a stream break
+ const seriesStreamBreak *_my_stream_break_list = nullptr; // Holds the list of breaks for digi plays
+ const seriesStreamBreak *_my_stream_break = nullptr;
+ machine *_my_stream_viewer = nullptr;
+};
+
+extern void series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger);
+extern void digi_preload_stream_breaks(const seriesStreamBreak list[]);
+extern void digi_unload_stream_breaks(const seriesStreamBreak list[]);
+extern void handle_series_stream_break();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index c78ef994ec3..b55dde12fc0 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -27,6 +27,7 @@
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
+#include "m4/burger/stream_break.h"
#include "m4/burger/walker.h"
namespace M4 {
@@ -36,6 +37,28 @@ enum GameMode {
JUST_OVERVIEW = 0, INTERACTIVE_DEMO = 1, MAGAZINE_DEMO = 2, WHOLE_GAME = 3
};
+enum global_triggers {
+ gFIRST_GLOBAL_TRIGGER = 10000,
+
+ // System triggers
+ gRESUME_CONVERSATION, // Yep, that's what it does!
+ gWILBURS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
+ gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
+ gSERIES_STREAM_BREAK, // Used only by set_next_stream_break () in global.cpp
+ gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
+ gSERIES_PLAY_BREAK_1, // Used only by set_next_play_break () in global.cpp
+ gSERIES_PLAY_BREAK_2, // Used only by set_next_play_break () in global.cpp
+ gRELEASE_TRIGGER_DIGI_CHECK, // Used only by release_trigger_digi_check() in global.cpp
+
+ // General triggers
+ gREACT_TO_WHISTLE, // For anything that reacts to the wistle being blown
+
+ // Wilbur specific triggers
+ gCHANGE_WILBUR_ANIMATION,
+
+ gLAST_GLOBAL_TRIGGER
+};
+
class Vars : public M4::Vars {
private:
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
@@ -53,6 +76,7 @@ public:
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
SeriesPlayers _seriesPlayers;
+ StreamBreak_Globals _streamBreak;
Burger::Walker _walker;
int _wilburTerm = 2;
const Common::String _wilbur = "WILBUR";
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index f106cdb9683..9bd26cf89d6 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -22,9 +22,18 @@
#include "m4/graphics/gr_series.h"
#include "m4/core/errors.h"
#include "m4/wscript/ws_load.h"
+#include "m4/wscript/ws_machine.h"
+#include "m4/wscript/wst_regs.h"
+#include "m4/vars.h"
namespace M4 {
+#define CHECK_SERIES if (!_G(globals)) error_show(FL, 'SERI');
+
+static void series_trigger_dispatch_callback(frac16 myMessage, struct machine * /*sender*/) {
+ kernel_trigger_dispatch(myMessage);
+}
+
int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal) {
int32 myAssetIndex = AddWSAssetCELS(seriesName, assetIndex, myPal);
@@ -53,4 +62,51 @@ machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
return nullptr;
}
+machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger) {
+ machine *m;
+ StreamFile *streamFil = new StreamFile(seriesName);
+
+ //store the frameRate in g_temp1
+ //if it is < 0, the default frame rate for the ss will be used
+ _G(globals)[GLB_TEMP_1] = frameRate << 16;
+
+ //an unusual way to use global regs, but a FILE* is as good a value as any other...
+
+ _G(globals)[GLB_TEMP_4] = (frac16)(streamFil); //apr29
+
+ //set the callback trigger
+ _G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
+
+ //set the layer
+ _G(globals)[GLB_TEMP_6] = layer << 16;
+
+ m = kernel_spawn_machine(seriesName, HASH_STREAM_MACHINE, series_trigger_dispatch_callback);
+ return m;
+}
+
+bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger) {
+ CHECK_SERIES
+
+ // Parameter verification
+ if (!m)
+ return false;
+
+ _G(globals)[GLB_TEMP_2] = frameNum << 16;
+ _G(globals)[GLB_TEMP_3] = kernel_trigger_create(trigger);
+
+ //send the message to the machine to accept the new callback frame num and trigger
+ SendWSMessage(0x10000, 0, m, 0, NULL, 1);
+
+ return true;
+}
+
+void series_set_frame_rate(machine *m, int32 newFrameRate) {
+ CHECK_SERIES
+
+ if ((!m) || (!m->myAnim8) || !VerifyMachineExists(m))
+ error_show(FL, 'SSFR');
+
+ m->myAnim8->myRegs[IDX_CELS_FRAME_RATE] = newFrameRate << 16;
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 7359ef12434..f89f7da0ccd 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -33,6 +33,14 @@ constexpr uint32 BACKWARD = 2;
constexpr uint32 STICK = 4;
constexpr uint32 NO_TOSS = 8;
+enum {
+ HASH_SERIES_PLAY_MACHINE = 0,
+ HASH_SERIES_SHOW_MACHINE = 1,
+ // HASH_TIMER_MACHINE = 2, // defined in adv.h
+
+ HASH_STREAM_MACHINE = 6
+};
+
extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal);
extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
@@ -62,6 +70,10 @@ machine *series_ranged_play_xy(char *seriesName, int32 loopCount, uint32 flags,
int32 s, int32 layer, int32 frameRate,
int16 triggerNum, bool stick_when_done);
+machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger);
+bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
+void series_set_frame_rate(machine *m, int32 newFrameRate);
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 953f9d27734..7dfb3eb2047 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -87,6 +87,7 @@ MODULE_OBJS = \
burger/hotkeys.o \
burger/inventory.o \
burger/series_player.o \
+ burger/stream_break.o \
burger/vars.o \
burger/walker.o
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index eba3c3aa5dc..03ca18b6478 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -44,8 +44,9 @@ void Digi::unload_sounds() {
unload(_names[i]);
}
-void Digi::preload(const Common::String &name, int roomNum) {
+bool Digi::preload(const Common::String &name, int roomNum) {
warning("TODO: Digi::preload - %s, %d", name.c_str(), roomNum);
+ return false;
}
void Digi::unload(const Common::String &name) {
@@ -80,8 +81,12 @@ void Digi::read_another_chunk() {
} // namespace Sound
-void digi_preload(const Common::String &name, int roomNum) {
- _G(digi).preload(name, roomNum);
+bool digi_preload(const Common::String &name, int roomNum) {
+ return _G(digi).preload(name, roomNum);
+}
+
+void digi_unload(const Common::String &name) {
+ _G(digi).unload(name);
}
int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 39ec9c10588..0676f2468e4 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -34,16 +34,16 @@ private:
Common::StringArray _names;
private:
- void unload(const Common::String &name);
public:
/**
* Preload a digi sample into memory buffer for play back later.
*/
- void preload(const Common::String &name, int roomNum);
+ bool preload(const Common::String &name, int roomNum = -1);
void preload_sounds(const char **names);
void unload_sounds();
+ void unload(const Common::String &name);
void task();
// digi_play and digi_play_loop play a particular sound file in a given channel,
@@ -63,15 +63,13 @@ public:
} // namespace Sound
-extern void digi_preload(const Common::String &name, int roomNum);
+extern bool digi_preload(const Common::String &name, int roomNum = -1);
+extern void digi_unload(const Common::String &name);
extern int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern void digi_read_another_chunk();
extern void digi_stop(int slot);
-//extern void digi_preload_stream_breaks(const seriesStreamBreak *list);
-//extern void digi_unload_stream_breaks(const seriesStreamBreak *list);
-
} // namespace M4
#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 1b4272aaf63..aa1d1d1e440 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -951,7 +951,7 @@ void IntoTheState(machine * m) {
// This proc creates an instance of a machine based on the machine chunk
-machine *TriggerMachineByHash(int32 myHash, Anim8 * parentAnim8, int32 dataHash, int32 dataRow, MessageCB CintrMsg, bool debug, const char *machName) {
+machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash, int32 dataRow, MessageCB CintrMsg, bool debug, const char *machName) {
machine *m;
if ((m = (machine *)mem_alloc(sizeof(machine), "machine")) == nullptr) {
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index c3668729071..b6841e1b3b6 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -195,7 +195,7 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
extern void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
uint32 machHash, machine *sendM, int32 msgCount);
-#define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, NULL, -1, -1, callback, FALSE, (char*)name)
+#define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, nullptr, -1, -1, callback, false, name)
#define kernel_terminate_machine(m) TerminateMachine(m)
} // End of namespace M4
Commit: f559baff06aa5c579bf055d161c992be681ad3b7
https://github.com/scummvm/scummvm/commit/f559baff06aa5c579bf055d161c992be681ad3b7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 951 stream break arrays
Changed paths:
engines/m4/burger/rooms/section9/room951.cpp
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 2666779ae10..5f088dd207c 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -15,7 +15,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/ },.
*
*/
@@ -55,7 +55,7 @@ enum scene_triggers {
};
-static seriesStreamBreak planet_x_hilltop_a[] = {
+static const seriesStreamBreak planet_x_hilltop_a[] = {
// frame sound chan vol trigger flags variable value
{ 0, "951_000", 3, 100, NO_TRIGGER, 0, nullptr, 0 },
{ 15, "951_004", 2, 150, NO_TRIGGER, 0, nullptr, 0 },
@@ -70,6 +70,176 @@ static seriesStreamBreak planet_x_hilltop_a[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak planet_x_low_shot[] = {
+ { 0, nullptr, 2, 0, -1, 2048, 0, 0 },
+ { 0, "952_003", 1, 200, -1, 0, 0, 0 },
+ { 21, "952_001", 3, 120, -1, 0, 0, 0 },
+ { 73, "952_002", 2, 160, -1, 0, 0, 0 },
+ { 80, "952Z001", 1, 255, -1, 0, 0, 0 },
+ { 92, "952_005", 2, 160, -1, 0, 0, 0 },
+ { 111, "952_006", 2, 100, -1, 0, 0, 0 },
+ { 117, "952_007", 2, 100, -1, 0, 0, 0 },
+ { 124, "952_004", 1, 225, -1, 0, 0, 0 },
+ { 136, "952_004", 1, 245, -1, 0, 0, 0 },
+ { 143, "952_010", 1, 255, -1, 0, 0, 0 },
+ { 147, "952_004", 1, 235, -1, 0, 0, 0 },
+ { 153, "952_008", 2, 100, -1, 0, 0, 0 },
+ { 154, "952_009", 3, 200, -1, 0, 0, 0 },
+ { 157, 0, 0, 0, 52, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak planet_x_hilltop_b[] = {
+ { 1, "951_020", 3, 100, -1, 0, nullptr, 0 },
+ { 4, "951_007", 2, 125, -1, 0, nullptr, 0 },
+ { 7, "951z002", 1, 255, -1, 0, nullptr, 0 },
+ { 54, nullptr, 0, 0, 50, 0, nullptr, 0 },
+ { 56, "951_008", 2, 150, -1, 0, nullptr, 0 },
+ { 75, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak panorama_a[] = {
+ { 1, "955_001", 1, 150, -1, 0, nullptr, 0 },
+ { 7, "955_007", 2, 220, -1, 0, nullptr, 0 },
+ { 24, "955_007", 2, 220, -1, 0, nullptr, 0 },
+ { 25, nullptr, 2, 0, -1, 2048, nullptr, 0 },
+ { 26, "955_007", 2, 220, -1, 0, nullptr, 0 },
+ { 35, "955_002", 2, 255, -1, 0, nullptr, 0 },
+ { 90, "955_007", 1, 220, -1, 0, nullptr, 0 },
+ { 92, nullptr, 1, 0, -1, 2048, nullptr, 0 },
+ { 93, "955_007", 1, 220, -1, 0, nullptr, 0 },
+ { 99, "955_010", 1, 150, -1, 0, nullptr, 0 },
+ { 104, nullptr, 3, 240, -1, 0, nullptr, 0 },
+ { 105, nullptr, 3, 220, -1, 0, nullptr, 0 },
+ { 105, "955_007", 1, 210, -1, 0, nullptr, 0 },
+ { 106, nullptr, 3, 200, -1, 0, nullptr, 0 },
+ { 107, nullptr, 3, 190, -1, 0, nullptr, 0 },
+ { 108, nullptr, 3, 180, -1, 0, nullptr, 0 },
+ { 109, nullptr, 3, 170, -1, 0, nullptr, 0 },
+ { 110, nullptr, 3, 160, -1, 0, nullptr, 0 },
+ { 111, nullptr, 3, 150, -1, 0, nullptr, 0 },
+ { 112, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ { 113, nullptr, 3, 140, -1, 0, nullptr, 0 },
+ { 114, nullptr, 3, 120, -1, 0, nullptr, 0 },
+ { 115, nullptr, 3, 110, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak cargo_transfer_a[] = {
+ { 0, nullptr, 3, 100, -1, 0, nullptr, 0 },
+ { 1, "956_001", 2, 80, -1, 0, nullptr, 0 },
+ { 4, "956v001", 1, 255, -1, 0, nullptr, 0 },
+ { 136, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak vps_office_a[] = {
+ { 1, "957_005", 3, 40, -1, 1024, nullptr, 0 },
+ { 1, "957v001", 1, 255, -1, 0, nullptr, 0 },
+ { 92, "957v002", 1, 255, -1, 0, nullptr, 0 },
+ { 110, "957v003", 1, 255, -1, 0, nullptr, 0 },
+ { 125, "957_004", 2, 230, -1, 0, nullptr, 0 },
+ { 177, "957_007", 2, 100, -1, 0, nullptr, 0 },
+ { 183, "957_001", 2, 150, -1, 0, nullptr, 0 },
+ { 191, "957v004", 1, 255, -1, 0, nullptr, 0 },
+ { 194, "957_006", 2, 120, -1, 1024, nullptr, 0 },
+ { 267, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak hologram[] = {
+ { 0, "958v001", 1, 255, -1, 0, nullptr, 0 },
+ { 0, "957_005", 3, 20, -1, 1024, nullptr, 0 },
+ { 1, nullptr, 2, 210, -1, 0, nullptr, 0 },
+ { 39, "958_003", 1, 150, -1, 0, nullptr, 0 },
+ { 42, "958_001", 1, 200, -1, 0, nullptr, 0 },
+ { 52, "958z001", 1, 255, -1, 0, nullptr, 0 },
+ { 161, "958_003", 1, 150, -1, 0, nullptr, 0 },
+ { 164, "958_004", 2, 200, -1, 0, nullptr, 0 },
+ { 170, "958v002", 1, 255, -1, 0, nullptr, 0 },
+ { 264, "958z002", 1, 255, -1, 0, nullptr, 0 },
+ { 329, "958v003", 1, 255, -1, 0, nullptr, 0 },
+ { 362, "958_002", 2, 50, -1, 0, nullptr, 0 },
+ { 425, "958v004", 1, 255, -1, 0, nullptr, 0 },
+ { 456, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak vps_office_b[] = {
+ { 0, "957_005", 3, 40, -1, 1024, nullptr, 0 },
+ { 8, "957Z001y", 1, 255, -1, 0, nullptr, 0 },
+ { 43, "957Z001z", 1, 255, -1, 0, nullptr, 0 },
+ { 112, "957V005", 2, 255, -1, 0, nullptr, 0 },
+ { 139, "957_002", 1, 255, -1, 0, nullptr, 0 },
+ { 154, "957_003", 1, 255, -1, 0, nullptr, 0 },
+ { 170, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak cargo_transfer_b[] = {
+ { 0, "956_020", 1, 130, -1, 0, nullptr, 0 },
+ { 0, "956_000", 2, 60, -1, 1024, nullptr, 0 },
+ { 0, "956_001", 3, 80, -1, 1024, nullptr, 0 },
+ { 29, "956Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 67, "956_003", 1, 60, -1, 0, nullptr, 0 },
+ { 83, "956Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 121, "956_002", 1, 200, -1, 0, nullptr, 0 },
+ { 132, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak transfer_controls[] = {
+ { 0, nullptr, 2, 0, -1, 2048, nullptr, 0 },
+ { 0, nullptr, 3, 0, -1, 2048, nullptr, 0 },
+ { 0, "956_001", 3, 180, -1, 1024, nullptr, 0 },
+ { 1, "959F001", 1, 255, -1, 0, nullptr, 0 },
+ { 5, "959_010", 2, 170, -1, 0, nullptr, 0 },
+ { 27, "959_010", 2, 170, -1, 0, nullptr, 0 },
+ { 36, "959Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 43, "959_013", 2, 100, -1, 0, nullptr, 0 },
+ { 48, nullptr, 2, 0, -1, 2048, nullptr, 0 },
+ { 69, "959Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 100, "959F002", 1, 255, -1, 0, nullptr, 0 },
+ { 146, "959Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 207, "959_002", 2, 150, -1, 0, nullptr, 0 },
+ { 226, "959_003", 2, 255, -1, 0, nullptr, 0 },
+ { 235, "959_013", 1, 100, -1, 0, nullptr, 0 },
+ { 245, nullptr, 1, 0, -1, 2048, nullptr, 0 },
+ { 254, "959_010", 2, 170, -1, 0, nullptr, 0 },
+ { 257, "959_013", 1, 100, -1, 0, nullptr, 0 },
+ { 272, nullptr, 1, 0, -1, 2048, nullptr, 0 },
+ { 274, "959_004", 2, 255, -1, 0, nullptr, 0 },
+ { 277, "959_005", 2, 255, -1, 0, nullptr, 0 },
+ { 288, "959_012", 1, 255, -1, 0, nullptr, 0 },
+ { 295, "959_011", 2, 255, -1, 0, nullptr, 0 },
+ { 307, "959_005", 1, 200, -1, 0, nullptr, 0 },
+ { 311, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak panorama_b[] = {
+ { 0, "955_000", 3, 180, -1, 1024, nullptr, 0 },
+ { 0, "955_003", 2, 150, -1, 0, nullptr, 0 },
+ { 2, "955z001", 1, 255, -1, 0, nullptr, 0 },
+ { 74, "955_004", 2, 255, -1, 0, nullptr, 0 },
+ { 89, "955z002", 1, 255, -1, 0, nullptr, 0 },
+ { 125, "955_006", 2, 245, -1, 0, nullptr, 0 },
+ { 140, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ { 148, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak call_to_action[] = {
+ { 0, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ { 1, nullptr, 0, 0, 47, 0, nullptr, 0 },
+ { 1, "961_001", 1, 100, -1, 0, nullptr, 0 },
+ { 63, "961_002", 1, 180, -1, 0, nullptr, 0 },
+ { 143, nullptr, 0, 0, 52, 0, nullptr, 0 },
+ { 147, nullptr, 0, 0, 48, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
void Room951::preload() {
_G(player).walker_in_this_scene = false;
}
@@ -92,16 +262,12 @@ void Room951::daemon() {
digi_preload("952music", -1);
digi_preload_stream_breaks(planet_x_hilltop_a);
-#ifdef TODO
digi_preload_stream_breaks(planet_x_low_shot);
digi_preload_stream_breaks(planet_x_hilltop_b);
digi_preload_stream_breaks(panorama_a);
digi_preload_stream_breaks(cargo_transfer_a);
- digi_preload_stream_breaks(vps_office_a);
- digi_preload_stream_breaks(hologram);
- digi_preload_stream_breaks(vps_office_b);
break;
-
+#ifdef TODO
case START_PLANET_X_HILLTOP_A:
palette_prep_for_stream();
series_stream_with_breaks(planet_x_hilltop_a, "PLANET X HILLTOP A", 6, 1, START_PLANET_X_LOW_GROUND_SHOT);
Commit: 6cbd2df9c5daecbe071e47cd5e887005bcb6b168
https://github.com/scummvm/scummvm/commit/6cbd2df9c5daecbe071e47cd5e887005bcb6b168
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added release trigger methods
Changed paths:
A engines/m4/burger/core/release_trigger.cpp
A engines/m4/burger/core/release_trigger.h
A engines/m4/burger/core/stream_break.cpp
A engines/m4/burger/core/stream_break.h
R engines/m4/burger/stream_break.cpp
R engines/m4/burger/stream_break.h
engines/m4/adv_r/adv_trigger.h
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/vars.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
engines/m4/module.mk
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 6849406a07f..6bd18e00e8c 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -27,9 +27,9 @@
namespace M4 {
-constexpr int NO_TRIGGER = -1;
+constexpr int NO_TRIGGER = -1;
constexpr int CALLED_EACH_LOOP = 32764;
-
+constexpr int TENTH_SECOND = 6;
constexpr int MAX_TIMERS = 32;
struct Triggers {
diff --git a/engines/m4/burger/core/release_trigger.cpp b/engines/m4/burger/core/release_trigger.cpp
new file mode 100644
index 00000000000..f73db47e07c
--- /dev/null
+++ b/engines/m4/burger/core/release_trigger.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/core/release_trigger.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+#define _GT(X) _G(releaseTrigger)._##X
+
+void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue) {
+ _GT(released_digi_trigger) = kernel_trigger_create(trigger);
+ _GT(check_channels) = checkChannels;
+ _GT(match_value) = matchValue;
+
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(gRELEASE_TRIGGER_DIGI_CHECK);
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void release_trigger_digi_check() {
+ uint32 i;
+ uint32 digi_state = 0;
+
+ // Set channel bits in digi_state that a sound is presently busy in each channel
+ for (i = 0; i < 3; ++i) {
+ if (digi_play_state(i)) // Check if a sound is playing
+ digi_state |= (1 << i); // Set the bit that corresponds with this channel
+ }
+
+ term_message("%d %d %d", digi_state, _GT(check_channels), _GT(match_value));
+
+ // AND this with the channels we care about
+ digi_state &= _GT(check_channels);
+ term_message(" %d %d %d", digi_state, _GT(check_channels), _GT(match_value));
+
+ // Compare this with the match values
+ if (digi_state == _GT(match_value)) {
+ kernel_trigger_dispatch(_GT(released_digi_trigger));
+ } else {
+ kernel_timing_trigger(TENTH_SECOND, gRELEASE_TRIGGER_DIGI_CHECK);
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/core/release_trigger.h b/engines/m4/burger/core/release_trigger.h
new file mode 100644
index 00000000000..b0fb2c19ed4
--- /dev/null
+++ b/engines/m4/burger/core/release_trigger.h
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_CORE_RELEASE_TRIGGER_H
+#define M4_BURGER_CORE_RELEASE_TRIGGER_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+struct ReleaseTrigger_Globals {
+ uint32 _released_digi_trigger = 0;
+ uint32 _check_channels = 0, _match_value = 0;
+};
+
+extern void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue);
+extern void release_trigger_digi_check();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/stream_break.cpp b/engines/m4/burger/core/stream_break.cpp
similarity index 94%
rename from engines/m4/burger/stream_break.cpp
rename to engines/m4/burger/core/stream_break.cpp
index 4537fac5818..b94ff50bcaa 100644
--- a/engines/m4/burger/stream_break.cpp
+++ b/engines/m4/burger/core/stream_break.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/stream_break.h"
+#include "m4/burger/core/stream_break.h"
#include "m4/platform/sound/digi.h"
#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
@@ -117,5 +117,10 @@ void digi_unload_stream_breaks(const seriesStreamBreak list[]) {
}
}
+void palette_prep_for_stream() {
+ gr_pal_clear(&_G(master_palette)[0]); // Clear out colours in palette
+ pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to zero percent instantly (0 ticks)
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/stream_break.h b/engines/m4/burger/core/stream_break.h
similarity index 90%
rename from engines/m4/burger/stream_break.h
rename to engines/m4/burger/core/stream_break.h
index de2dfa7b742..e5be0b8f48b 100644
--- a/engines/m4/burger/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -57,6 +57,12 @@ extern void digi_preload_stream_breaks(const seriesStreamBreak list[]);
extern void digi_unload_stream_breaks(const seriesStreamBreak list[]);
extern void handle_series_stream_break();
+/**
+ * Palette_prep_for_stream is called just before series_stream() for a full screen animation.
+ * It clears the palette, (debug: sets ui colors) and sets up a palette fade up from 0%
+ */
+extern void palette_prep_for_stream();
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index f9740a6d150..b1f54140f56 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -23,7 +23,7 @@
#define M4_BURGER_ROOMS_ROOM_H
#include "m4/core/rooms.h"
-#include "m4/burger/stream_break.h"
+#include "m4/burger/core/stream_break.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 5f088dd207c..88dddb2cf25 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -29,9 +29,9 @@ namespace Rooms {
enum scene_triggers {
START_ORION_BURGER_POSTER = 1,
-
- // Triggers to start streamers
START_PLANET_X_HILLTOP_A,
+ START_3,
+ START_4,
START_PLANET_X_LOW_GROUND_SHOT,
START_PLANET_X_HILLTOP_B,
START_SPACE_STATION_PANORAMA_A,
@@ -267,59 +267,67 @@ void Room951::daemon() {
digi_preload_stream_breaks(panorama_a);
digi_preload_stream_breaks(cargo_transfer_a);
break;
-#ifdef TODO
+
case START_PLANET_X_HILLTOP_A:
palette_prep_for_stream();
series_stream_with_breaks(planet_x_hilltop_a, "PLANET X HILLTOP A", 6, 1, START_PLANET_X_LOW_GROUND_SHOT);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
break;
- case START_PLANET_X_LOW_GROUND_SHOT:
+ case START_3:
palette_prep_for_stream();
+ kernel_timing_trigger(6, 4, nullptr);
+ break;
+
+ case START_4:
+ release_trigger_on_digi_state(5, 1, 0);
+ break;
+#ifdef TODO
+ case START_PLANET_X_LOW_GROUND_SHOT:
series_stream_with_breaks(planet_x_low_shot, "Planet X Low Ground Shot", 6, 1, START_PLANET_X_HILLTOP_B);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_PLANET_X_HILLTOP_B:
palette_prep_for_stream();
digi_unload_stream_breaks(planet_x_hilltop_a);
series_stream_with_breaks(planet_x_hilltop_b, "Planet X Hilltop B", 6, 1, START_SPACE_STATION_PANORAMA_A);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_SPACE_STATION_PANORAMA_A:
palette_prep_for_stream();
digi_unload_stream_breaks(planet_x_low_shot);
series_stream_with_breaks(panorama_a, "Space Station Panorama A", 6, 1, START_CARGO_TRANSFER_AREA_A);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_CARGO_TRANSFER_AREA_A:
palette_prep_for_stream();
digi_unload_stream_breaks(planet_x_hilltop_b);
series_stream_with_breaks(cargo_transfer_a, "Cargo Transfer Area A", 6, 1, START_VPS_OFFICE_A);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_VPS_OFFICE_A:
palette_prep_for_stream();
digi_unload_stream_breaks(panorama_a);
series_stream_with_breaks(vps_office_a, "VP's Office A", 6, 1, START_HOLOGRAM);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_HOLOGRAM:
palette_prep_for_stream();
digi_unload_stream_breaks(cargo_transfer_a);
series_stream_with_breaks(hologram, "Hologram", 6, 1, START_VPS_OFFICE_B);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_VPS_OFFICE_B:
palette_prep_for_stream();
digi_unload_stream_breaks(vps_office_a);
series_stream_with_breaks(vps_office_b, "VP's Office B", 6, 1, START_CARGO_TRANSFER_AREA_B);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_CARGO_TRANSFER_AREA_B:
@@ -327,7 +335,7 @@ void Room951::daemon() {
digi_unload_stream_breaks(hologram);
digi_preload_stream_breaks(cargo_transfer_b);
series_stream_with_breaks(cargo_transfer_b, "Cargo Transfer Area B", 6, 1, START_CARGO_TRANSFER_CONTROLS);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_CARGO_TRANSFER_CONTROLS:
@@ -338,7 +346,7 @@ void Room951::daemon() {
digi_unload_stream_breaks(vps_office_b);
digi_preload_stream_breaks(transfer_controls);
series_stream_with_breaks(transfer_controls, "Cargo Transfer Controls", 6, 1, START_SPACE_STATION_PANORAMA_B);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_SPACE_STATION_PANORAMA_B:
@@ -347,7 +355,7 @@ void Room951::daemon() {
digi_unload_stream_breaks(cargo_transfer_b);
digi_preload_stream_breaks(panorama_b);
series_stream_with_breaks(panorama_b, "Space Station Panorama B", 6, 1, START_CALL_TO_ACTION);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case START_CALL_TO_ACTION:
@@ -356,26 +364,26 @@ void Room951::daemon() {
digi_unload_stream_breaks(transfer_controls);
digi_preload_stream_breaks(call_to_action);
series_stream_with_breaks(call_to_action, "Call To Action", 6, 1, LAST_SCENE_TRIGGER);
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
} else {
kernel_trigger_dispatch_now(LAST_SCENE_TRIGGER);
}
break;
case FADE_DOWN_FAST:
- pal_fade_init(&master_palette[0], 0, 255, 0, 30, NO_TRIGGER); // half second fade down
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 30, NO_TRIGGER); // half second fade down
break;
case FADE_DOWN_SLOW:
- pal_fade_init(&master_palette[0], 0, 255, 0, 60, NO_TRIGGER); // one second fade down
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 60, NO_TRIGGER); // one second fade down
break;
case FADE_UP_FAST:
- pal_fade_init(&master_palette[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
break;
case FADE_UP_SLOW:
- pal_fade_init(&master_palette[0], 0, 255, 100, 60, NO_TRIGGER); // one second fade up
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 60, NO_TRIGGER); // one second fade up
break;
case LAST_SCENE_TRIGGER:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index b55dde12fc0..04350a7c9e2 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -23,11 +23,12 @@
#define M4_BURGER_BURGER_VARS_H
#include "m4/vars.h"
+#include "m4/burger/core/release_trigger.h"
+#include "m4/burger/core/stream_break.h"
#include "m4/burger/gui/interface.h"
#include "m4/burger/inventory.h"
#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
-#include "m4/burger/stream_break.h"
#include "m4/burger/walker.h"
namespace M4 {
@@ -46,9 +47,11 @@ enum global_triggers {
gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
gSERIES_STREAM_BREAK, // Used only by set_next_stream_break () in global.cpp
gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
+/*
gSERIES_PLAY_BREAK_1, // Used only by set_next_play_break () in global.cpp
gSERIES_PLAY_BREAK_2, // Used only by set_next_play_break () in global.cpp
- gRELEASE_TRIGGER_DIGI_CHECK, // Used only by release_trigger_digi_check() in global.cpp
+*/
+ gRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
// General triggers
gREACT_TO_WHISTLE, // For anything that reacts to the wistle being blown
@@ -76,6 +79,7 @@ public:
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
SeriesPlayers _seriesPlayers;
+ ReleaseTrigger_Globals _releaseTrigger;
StreamBreak_Globals _streamBreak;
Burger::Walker _walker;
int _wilburTerm = 2;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index b57958503a7..b56e3efc9f8 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -566,7 +566,7 @@ static void pal_fade_callback(frac16 myMessage) {
}
void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
- int32 targetPercent, int32 numTicks, uint32 triggerNum) {
+ int32 targetPercent, int32 numTicks, int32 triggerNum) {
if ((!origPalette) || (firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry))
return;
if ((targetPercent < 0) || (targetPercent > 100))
@@ -639,7 +639,7 @@ static void pal_cycle_callback(frac16 myMessage) {
}
void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry,
- int32 delayTicks, int32 totalTicks, uint32 triggerNum) {
+ int32 delayTicks, int32 totalTicks, int32 triggerNum) {
if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry)) {
// This should generate an error
return;
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 317d537dc21..53cf3bdfc3e 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -84,9 +84,9 @@ struct KernelPal_Globals {
};
extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
-extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, uint32 triggerNum);
+extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
-extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, uint32 triggerNum);
+extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, int32 triggerNum);
extern bool pal_cycle_active(); // Returns true if color cycling is on
extern void pal_cycle_stop(); // Stops color cycling
extern void pal_cycle_resume(); // Starts color cycling
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 7dfb3eb2047..1bccb5d7a40 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -74,6 +74,8 @@ MODULE_OBJS = \
wscript/ws_timer.o \
wscript/wscript.o \
wscript/wst_regs.o \
+ burger/core/release_trigger.o \
+ burger/core/stream_break.o \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
burger/gui/interface.o \
@@ -87,7 +89,6 @@ MODULE_OBJS = \
burger/hotkeys.o \
burger/inventory.o \
burger/series_player.o \
- burger/stream_break.o \
burger/vars.o \
burger/walker.o
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 03ca18b6478..3e03d2bfc94 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -79,6 +79,11 @@ void Digi::read_another_chunk() {
warning("TODO: Digi::read_another_chunk");
}
+bool Digi::play_state(int channel) const {
+ warning("TODO: Digi::play_state");
+ return true;
+}
+
} // namespace Sound
bool digi_preload(const Common::String &name, int roomNum) {
@@ -105,4 +110,8 @@ void digi_stop(int slot) {
_G(digi).stop(slot);
}
+bool digi_play_state(int channel) {
+ return _G(digi).play_state(channel);
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 0676f2468e4..6c8bf7dd657 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -59,6 +59,7 @@ public:
void flush_mem();
void read_another_chunk();
+ bool play_state(int channel) const;
};
} // namespace Sound
@@ -68,7 +69,8 @@ extern void digi_unload(const Common::String &name);
extern int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
extern void digi_read_another_chunk();
-extern void digi_stop(int slot);
+extern void digi_stop(int channel);
+extern bool digi_play_state(int channel);
} // namespace M4
Commit: 53986272299764f853196dc1c683f0dcbdf4ce76
https://github.com/scummvm/scummvm/commit/53986272299764f853196dc1c683f0dcbdf4ce76
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More switch cases for rooim 951
Changed paths:
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index b1f54140f56..1f21f3c914e 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -41,6 +41,7 @@ public:
void shutdown() override;
void parser_code() override;
+ void compact_mem_and_report() {}
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 88dddb2cf25..bc5bfc02de1 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section9/room951.h"
#include "m4/adv_r/adv_trigger.h"
#include "m4/burger/vars.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
@@ -33,23 +34,56 @@ enum scene_triggers {
START_3,
START_4,
START_PLANET_X_LOW_GROUND_SHOT,
+ START_6,
+ START_7,
START_PLANET_X_HILLTOP_B,
+ START_9,
+ START_10,
START_SPACE_STATION_PANORAMA_A,
+ START_12,
+ START_13,
START_CARGO_TRANSFER_AREA_A,
+ START_15,
+ START_16,
START_VPS_OFFICE_A,
+ START_18,
+ START_19,
START_HOLOGRAM,
+ START_21,
+ START_22,
START_VPS_OFFICE_B,
+ START_24,
+ START_25,
START_CARGO_TRANSFER_AREA_B,
+ START_27,
+ START_28,
START_CARGO_TRANSFER_CONTROLS,
+ START_30,
+ START_31,
START_SPACE_STATION_PANORAMA_B,
- START_CALL_TO_ACTION,
-
- // Misc triggers for all animations
- FADE_DOWN_FAST,
- FADE_UP_FAST,
-
- FADE_DOWN_SLOW,
- FADE_UP_SLOW,
+ START_33,
+ START_34,
+ START_35,
+ START_36,
+ START_37,
+ START_38,
+ START_39,
+ START_40,
+ START_41,
+ START_42,
+ START_43,
+ START_44,
+ START_45,
+ START_46,
+ START_47,
+ START_48,
+ START_49,
+ START_50,
+ START_51,
+ START_52,
+ START_53,
+ START_54,
+ START_55,
LAST_SCENE_TRIGGER
};
@@ -230,7 +264,7 @@ static const seriesStreamBreak panorama_b[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak call_to_action[] = {
+static const seriesStreamBreak break_961a[] = {
{ 0, nullptr, 0, 0, -1, 0, nullptr, 0 },
{ 1, nullptr, 0, 0, 47, 0, nullptr, 0 },
{ 1, "961_001", 1, 100, -1, 0, nullptr, 0 },
@@ -240,6 +274,45 @@ static const seriesStreamBreak call_to_action[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak break_961b[] = {
+ { 0, nullptr, 0, 0, -1, 0, 0, 0 },
+ { 4, "961_003", 1, 255, -1, 0, 0, 0 },
+ { 19, "961_004", 2, 180, -1, 0, 0, 0 },
+ { 38, "961_005", 1, 255, -1, 0, 0, 0 },
+ { 55, nullptr, 0, 0, 52, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak break_961c[] = {
+ { 0, nullptr, 0, 0, -1, 0, 0, 0 },
+ { 1, "961_006", 2, 130, -1, 0, 0, 0 },
+ { 29, "961_007", 1, 255, -1, 0, 0, 0 },
+ { 62, "961_008", 1, 255, -1, 0, 0, 0 },
+ { 75, "961_009", 1, 200, -1, 0, 0, 0 },
+ { 95, "961_007", 2, 255, -1, 0, 0, 0 },
+ { 100, nullptr, 3, 240, -1, 0, 0, 0 },
+ { 101, nullptr, 3, 220, -1, 0, 0, 0 },
+ { 102, nullptr, 3, 200, -1, 0, 0, 0 },
+ { 103, nullptr, 3, 180, -1, 0, 0, 0 },
+ { 104, nullptr, 3, 160, -1, 0, 0, 0 },
+ { 105, nullptr, 3, 140, -1, 0, 0, 0 },
+ { 106, nullptr, 3, 120, -1, 0, 0, 0 },
+ { 107, nullptr, 3, 100, -1, 0, 0, 0 },
+ { 108, nullptr, 3, 90, -1, 0, 0, 0 },
+ { 109, nullptr, 3, 80, -1, 0, 0, 0 },
+ { 110, nullptr, 3, 60, -1, 0, 0, 0 },
+ { 112, nullptr, 3, 40, -1, 0, 0, 0 },
+ { 114, nullptr, 3, 20, -1, 0, 0, 0 },
+ { 116, nullptr, 3, 10, -1, 0, 0, 0 },
+ { 117, nullptr, 0, 0, 52, 0, 0, 0 },
+ { 118, nullptr, 3, 0, -1, 0, 0, 0 },
+ { -1, nullptr, 0, 0, -1, 0, 0, 0 },
+ { 0, nullptr, 0, 0, -1, 0, 0, 0 },
+ { 39, nullptr, 0, 0, 52, 0, 0, 0 },
+ { 42, nullptr, 0, 0,2048, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
void Room951::preload() {
_G(player).walker_in_this_scene = false;
}
@@ -270,138 +343,258 @@ void Room951::daemon() {
case START_PLANET_X_HILLTOP_A:
palette_prep_for_stream();
- series_stream_with_breaks(planet_x_hilltop_a, "PLANET X HILLTOP A", 6, 1, START_PLANET_X_LOW_GROUND_SHOT);
+ series_stream_with_breaks(planet_x_hilltop_a, "PLANET X HILLTOP A", 6, 1, START_3);
pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
break;
case START_3:
palette_prep_for_stream();
- kernel_timing_trigger(6, 4, nullptr);
+ kernel_timing_trigger(TENTH_SECOND, START_4, nullptr);
break;
case START_4:
- release_trigger_on_digi_state(5, 1, 0);
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_PLANET_X_LOW_GROUND_SHOT, 1, 0);
break;
-#ifdef TODO
+
case START_PLANET_X_LOW_GROUND_SHOT:
- series_stream_with_breaks(planet_x_low_shot, "Planet X Low Ground Shot", 6, 1, START_PLANET_X_HILLTOP_B);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ series_stream_with_breaks(planet_x_low_shot, "Planet X Low Ground Shot", 6, 1, START_6);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
break;
- case START_PLANET_X_HILLTOP_B:
+ case START_6:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_7, nullptr);
+ break;
+
+ case START_7:
digi_unload_stream_breaks(planet_x_hilltop_a);
- series_stream_with_breaks(planet_x_hilltop_b, "Planet X Hilltop B", 6, 1, START_SPACE_STATION_PANORAMA_A);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_PLANET_X_HILLTOP_B, 1, 0);
break;
- case START_SPACE_STATION_PANORAMA_A:
+ case START_PLANET_X_HILLTOP_B:
+ series_stream_with_breaks(planet_x_hilltop_b, "Planet X Hilltop B", 6, 1, START_9);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_9:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_10, nullptr);
+ break;
+
+ case START_10:
digi_unload_stream_breaks(planet_x_low_shot);
- series_stream_with_breaks(panorama_a, "Space Station Panorama A", 6, 1, START_CARGO_TRANSFER_AREA_A);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ compact_mem_and_report();
+ digi_preload_stream_breaks(vps_office_a);
+ digi_preload_stream_breaks(hologram);
+ digi_preload_stream_breaks(vps_office_b);
+ release_trigger_on_digi_state(START_SPACE_STATION_PANORAMA_A, 1, 0);
break;
- case START_CARGO_TRANSFER_AREA_A:
+ case START_SPACE_STATION_PANORAMA_A:
+ series_stream_with_breaks(panorama_a, "Space Station Panorama A", 6, 1, START_12);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_12:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_13, nullptr);
+ break;
+
+ case START_13:
digi_unload_stream_breaks(planet_x_hilltop_b);
- series_stream_with_breaks(cargo_transfer_a, "Cargo Transfer Area A", 6, 1, START_VPS_OFFICE_A);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_CARGO_TRANSFER_AREA_A, 1, 0);
+ break;
+
+ case START_CARGO_TRANSFER_AREA_A:
+ series_stream_with_breaks(cargo_transfer_a, "Cargo Transfer Area A", 6, 1, START_15);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_15:
+ palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_16, nullptr);
+ break;
+
+ case START_16:
+ digi_unload_stream_breaks(panorama_a);
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_VPS_OFFICE_A, 1, 0);
break;
case START_VPS_OFFICE_A:
palette_prep_for_stream();
digi_unload_stream_breaks(panorama_a);
- series_stream_with_breaks(vps_office_a, "VP's Office A", 6, 1, START_HOLOGRAM);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ series_stream_with_breaks(vps_office_a, "VP's Office A", 6, 1, START_18);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
break;
- case START_HOLOGRAM:
+ case START_18:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_19, nullptr);
+ break;
+
+ case START_19:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_HOLOGRAM, 1, 0);
+ break;
+
+ case START_HOLOGRAM:
digi_unload_stream_breaks(cargo_transfer_a);
- series_stream_with_breaks(hologram, "Hologram", 6, 1, START_VPS_OFFICE_B);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ series_stream_with_breaks(hologram, "Hologram", 6, 1, START_21);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_21:
+ palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_22, nullptr);
+ break;
+
+
+ case START_22:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_VPS_OFFICE_B, 1, 0);
break;
case START_VPS_OFFICE_B:
+ series_stream_with_breaks(vps_office_b, "VP's Office B", 6, 1, START_24);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_24:
palette_prep_for_stream();
- digi_unload_stream_breaks(vps_office_a);
- series_stream_with_breaks(vps_office_b, "VP's Office B", 6, 1, START_CARGO_TRANSFER_AREA_B);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ kernel_timing_trigger(TENTH_SECOND, START_25, nullptr);
+ break;
+
+ case START_25:
+ compact_mem_and_report();
+ digi_preload_stream_breaks(cargo_transfer_b);
+ release_trigger_on_digi_state(START_CARGO_TRANSFER_AREA_B, 1, 0);
break;
case START_CARGO_TRANSFER_AREA_B:
+ series_stream_with_breaks(cargo_transfer_b, "Cargo Transfer Area B", 6, 1, START_27);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_27:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_28, nullptr);
+ break;
+
+ case START_28:
+ digi_unload_stream_breaks(vps_office_a);
digi_unload_stream_breaks(hologram);
- digi_preload_stream_breaks(cargo_transfer_b);
- series_stream_with_breaks(cargo_transfer_b, "Cargo Transfer Area B", 6, 1, START_CARGO_TRANSFER_CONTROLS);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ digi_unload_stream_breaks(vps_office_b);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(transfer_controls);
+ release_trigger_on_digi_state(START_CARGO_TRANSFER_CONTROLS, 1, 0);
break;
case START_CARGO_TRANSFER_CONTROLS:
+ series_stream_with_breaks(transfer_controls, "Cargo Transfer Controls", 6, 1, START_30);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_30:
palette_prep_for_stream();
- digi_stop(1);
- digi_stop(2);
- digi_stop(3);
- digi_unload_stream_breaks(vps_office_b);
- digi_preload_stream_breaks(transfer_controls);
- series_stream_with_breaks(transfer_controls, "Cargo Transfer Controls", 6, 1, START_SPACE_STATION_PANORAMA_B);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ kernel_timing_trigger(TENTH_SECOND, START_31, nullptr);
+ break;
+
+ case START_31:
+ digi_unload_stream_breaks(cargo_transfer_b);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(panorama_b);
+ release_trigger_on_digi_state(START_SPACE_STATION_PANORAMA_B, 1, 0);
break;
case START_SPACE_STATION_PANORAMA_B:
+ series_stream_with_breaks(panorama_b, "Space Station Panorama B", 6, 1, START_33);
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // Half second fade up
+ break;
+
+ case START_33:
palette_prep_for_stream();
+ kernel_timing_trigger(TENTH_SECOND, START_34, 0);
+ break;
+
+ case START_34:
digi_unload_stream_breaks(transfer_controls);
- digi_unload_stream_breaks(cargo_transfer_b);
- digi_preload_stream_breaks(panorama_b);
- series_stream_with_breaks(panorama_b, "Space Station Panorama B", 6, 1, START_CALL_TO_ACTION);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ kernel_timing_trigger(60, START_35, nullptr);
break;
- case START_CALL_TO_ACTION:
- if (executing == INTERACTIVE_DEMO) {
- palette_prep_for_stream();
- digi_unload_stream_breaks(transfer_controls);
- digi_preload_stream_breaks(call_to_action);
- series_stream_with_breaks(call_to_action, "Call To Action", 6, 1, LAST_SCENE_TRIGGER);
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
- } else {
- kernel_trigger_dispatch_now(LAST_SCENE_TRIGGER);
- }
+ case START_35:
+ digi_preload_stream_breaks(break_961a);
+ pal_fade_set_start(_G(master_palette), 0);
+ series_stream_with_breaks(break_961a, "961a", 6, 1, START_36);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 60, NO_TRIGGER);
break;
- case FADE_DOWN_FAST:
- pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 30, NO_TRIGGER); // half second fade down
+ case START_36:
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_cycle_stop();
+ kernel_timing_trigger(TENTH_SECOND, START_37, 0);
break;
- case FADE_DOWN_SLOW:
- pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 60, NO_TRIGGER); // one second fade down
+ case START_37:
+ compact_mem_and_report();
+ kernel_timing_trigger(1, START_38, 0);
break;
- case FADE_UP_FAST:
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 30, NO_TRIGGER); // half second fade up
+ case START_38:
+ digi_unload_stream_breaks(panorama_b);
+ digi_preload_stream_breaks(break_961b);
+ pal_fade_set_start(_G(master_palette), 0);
+ series_stream_with_breaks(break_961b, "961b", 6, 1, START_39);
break;
- case FADE_UP_SLOW:
- pal_fade_init(&_G(master_palette)[0], 0, 255, 100, 60, NO_TRIGGER); // one second fade up
+ case START_39:
+ pal_fade_set_start(_G(master_palette), 0);
+ kernel_timing_trigger(TENTH_SECOND, START_40, 0);
break;
- case LAST_SCENE_TRIGGER:
+ case START_40:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_41, 1, 0);
+ break;
- switch (executing) {
+ case START_41:
+ digi_unload_stream_breaks(break_961a);
+ digi_preload_stream_breaks(break_961c);
+ pal_fade_set_start(_G(master_palette), 0);
+ series_stream_with_breaks(break_961c, "961c", 6, 1, START_42);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 30, NO_TRIGGER);
+ break;
- case INTERACTIVE_DEMO:
- game.new_room = 901; // go back to demo menu
- break;
+ case START_42:
+ pal_fade_set_start(_G(master_palette), 0);
+ kernel_timing_trigger(TENTH_SECOND, START_43, 0);
+ break;
- case WHOLE_GAME:
- game.new_room = 901; // debug for now go back to demo menu until main game menu is available
- break;
- }
- ShowCursor();
+ case START_43:
+ digi_unload_stream_breaks(break_961b);
+ compact_mem_and_report();
+ kernel_trigger_dispatch_now(LAST_SCENE_TRIGGER);
break;
+
+ case LAST_SCENE_TRIGGER:
+ if (_G(executing) == WHOLE_GAME && !g_engine->autosaveExists()) {
+ _G(game).new_room = 903;
+#ifdef TODO
+ adv_kill_digi_between_rooms();
#endif
- case 49:
+ } else {
+ kernel_trigger_dispatch_now(START_44);
+ }
+ break;
+
+ case START_44:
+ // TODO: 44 through 55
+ break;
+
+ case START_49:
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index a2a6aa92c02..e7fc8dea74b 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -24,6 +24,7 @@
#include "common/debug-channels.h"
#include "common/events.h"
#include "common/system.h"
+#include "common/savefile.h"
#include "engines/util.h"
#include "graphics/palette.h"
#include "m4/m4.h"
@@ -121,4 +122,14 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
return Common::kNoError;
}
+bool M4Engine::autosaveExists() const {
+ Common::String slotName = getSaveStateName(getAutosaveSlot());
+ Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+ bool result = saveFile != nullptr;
+ delete saveFile;
+
+ return result;
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 1fc2ef2c285..7f68e708102 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -111,6 +111,11 @@ public:
return syncGame(s);
}
+ /**
+ * Returns true if an autosave exists
+ */
+ bool autosaveExists() const;
+
/**
* Show the engine information
*/
Commit: 5217968208fa3a2c80a6e05157b0d4906967572c
https://github.com/scummvm/scummvm/commit/5217968208fa3a2c80a6e05157b0d4906967572c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added adv_kill_digi_between_rooms
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_player.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 57cf358ac71..427e62213fe 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -75,4 +75,9 @@ void player_hotspot_walk_override_just_face(int32 facing, int32 trigger) {
player_hotspot_walk_override(_G(player_info).x, _G(player_info).y, facing, trigger);
}
+void adv_kill_digi_between_rooms(bool true_or_false) {
+ _G(shut_down_digi_tracks_between_rooms) = true_or_false;
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 2f9e543ab3e..4828b0cdebc 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -111,6 +111,7 @@ extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger =
extern bool player_commands_allowed();
extern PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
+extern void adv_kill_digi_between_rooms(bool true_or_false);
} // End of namespace M4
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index bc5bfc02de1..4b9d2e6bd4b 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section9/room951.h"
+#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_trigger.h"
#include "m4/burger/vars.h"
#include "m4/m4.h"
@@ -582,9 +583,7 @@ void Room951::daemon() {
case LAST_SCENE_TRIGGER:
if (_G(executing) == WHOLE_GAME && !g_engine->autosaveExists()) {
_G(game).new_room = 903;
-#ifdef TODO
- adv_kill_digi_between_rooms();
-#endif
+ adv_kill_digi_between_rooms(false);
} else {
kernel_trigger_dispatch_now(START_44);
}
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 732d61b2a09..7c40dab9604 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -174,6 +174,7 @@ public:
ScreenContext *_game_buff_ptr = nullptr;
machine *_my_walker = nullptr;
uint32 _editors_in_use = 0;
+ bool _shut_down_digi_tracks_between_rooms = false;
};
#define _G(X) (g_vars->_##X)
Commit: 6ec55d332e0c0043bbade29cd0fa084d42c29c23
https://github.com/scummvm/scummvm/commit/6ec55d332e0c0043bbade29cd0fa084d42c29c23
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining room 951 switch cases
Changed paths:
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/vars.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/vars.h
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 4b9d2e6bd4b..a5d7a904d04 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -85,7 +85,7 @@ enum scene_triggers {
START_53,
START_54,
START_55,
-
+ SAVEGAME_CHECK,
LAST_SCENE_TRIGGER
};
@@ -307,6 +307,10 @@ static const seriesStreamBreak break_961c[] = {
{ 116, nullptr, 3, 10, -1, 0, 0, 0 },
{ 117, nullptr, 0, 0, 52, 0, 0, 0 },
{ 118, nullptr, 3, 0, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak break_961d[] = {
{ -1, nullptr, 0, 0, -1, 0, 0, 0 },
{ 0, nullptr, 0, 0, -1, 0, 0, 0 },
{ 39, nullptr, 0, 0, 52, 0, 0, 0 },
@@ -577,10 +581,10 @@ void Room951::daemon() {
case START_43:
digi_unload_stream_breaks(break_961b);
compact_mem_and_report();
- kernel_trigger_dispatch_now(LAST_SCENE_TRIGGER);
+ kernel_trigger_dispatch_now(SAVEGAME_CHECK);
break;
- case LAST_SCENE_TRIGGER:
+ case SAVEGAME_CHECK:
if (_G(executing) == WHOLE_GAME && !g_engine->autosaveExists()) {
_G(game).new_room = 903;
adv_kill_digi_between_rooms(false);
@@ -590,7 +594,65 @@ void Room951::daemon() {
break;
case START_44:
- // TODO: 44 through 55
+ pal_fade_set_start(_G(master_palette), 0);
+ series_stream_with_breaks(break_961d, "961d", 6, 1, START_45);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 30, -1);
+ break;
+
+ case START_45:
+ kernel_timing_trigger(TENTH_SECOND, START_46, nullptr);
+ break;
+
+ case START_46:
+ digi_preload_stream_breaks(break_961c);
+ digi_preload_stream_breaks(break_961d);
+ compact_mem_and_report();
+ release_trigger_on_digi_state(START_47, 1, 0);
+ break;
+
+ case START_47:
+ pal_cycle_init(224, 254, 4, -1, -1);
+ break;
+
+ case START_48:
+ pal_cycle_stop();
+ break;
+
+ case START_50:
+ digi_play("952music", 3, 255, -1, -1);
+ break;
+
+ case START_51:
+ digi_play_loop("952music", 3, 255, -1, -1);
+ break;
+
+ case START_52:
+ pal_fade_init(_G(master_palette), 0, 255, 0, 30, -1);
+ break;
+
+ case START_53:
+ pal_fade_init(_G(master_palette), 0, 255, 100, 30, -1);
+ break;
+
+ case START_54:
+ pal_fade_init(_G(master_palette), 0, 255, 0, 60, -1);
+ break;
+
+ case START_55:
+ pal_fade_init(_G(master_palette), 0, 255, 100, 60, -1);
+ break;
+
+ case LAST_SCENE_TRIGGER:
+ compact_mem_and_report();
+ if (_G(executing) == WHOLE_GAME) {
+ g_vars->initialize_game();
+ _G(game).new_room = 801;
+ _G(game).new_section = 8;
+ } else if (g_engine->getLanguage() == Common::EN_ANY) {
+ _G(game).new_room = 901;
+ } else {
+ _G(kernel).force_restart = true;
+ }
break;
case START_49:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 04350a7c9e2..6fb7f012fd4 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -72,7 +72,6 @@ private:
protected:
void main_cold_data_init() override;
- void initialize_game() override;
public:
Burger::GlobalVars _globals;
@@ -100,6 +99,7 @@ public:
M4::Walker *getWalker() override {
return &_walker;
}
+ void initialize_game() override;
void global_menu_system_init() override;
};
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e7fc8dea74b..3f76b918e9d 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -58,6 +58,10 @@ Common::String M4Engine::getGameId() const {
return _gameDescription->gameId;
}
+Common::Language M4Engine::getLanguage() const {
+ return _gameDescription->language;
+}
+
Common::Error M4Engine::run() {
// Initialize 320x200 paletted graphics mode
initGraphics(640, 480);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 7f68e708102..f982373abd5 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -75,6 +75,11 @@ public:
*/
Common::String getGameId() const;
+ /**
+ * Return game language
+ */
+ Common::Language getLanguage() const;
+
/**
* Gets a random number
*/
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 7c40dab9604..723b9c656a7 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -75,7 +75,6 @@ private:
protected:
virtual void main_cold_data_init() = 0;
- virtual void initialize_game() = 0;
public:
Vars();
@@ -86,6 +85,7 @@ public:
virtual Interface *getInterface() = 0;
virtual Walker *getWalker() = 0;
virtual void global_menu_system_init() = 0;
+ virtual void initialize_game() = 0;
GameControl _game;
Kernel _kernel;
Commit: 3f1c6ebd86b91d43bcc83a31a62e1c68880ec673
https://github.com/scummvm/scummvm/commit/3f1c6ebd86b91d43bcc83a31a62e1c68880ec673
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added ws_timer.cpp methods
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/wscript/ws_timer.cpp
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 57344437850..5645235afe9 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -110,8 +110,6 @@ void Sections::m4SceneLoad() {
room_init();
_G(player).walker_trigger = -1;
-
-
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
if (_G(player).walker_in_this_scene) {
// If restoring game, restore player position and facing
diff --git a/engines/m4/wscript/ws_timer.cpp b/engines/m4/wscript/ws_timer.cpp
index c0a2eb7dcba..28f58dbec77 100644
--- a/engines/m4/wscript/ws_timer.cpp
+++ b/engines/m4/wscript/ws_timer.cpp
@@ -42,6 +42,10 @@ void ws_KillTime() {
}
}
+static onTimeReq *new_timeRequest() {
+ return (onTimeReq *)mem_alloc(sizeof(onTimeReq), "onTimeReq");
+}
+
static void dispose_timeRequest(onTimeReq *timeReq) {
if (timeReq) {
mem_free(timeReq);
@@ -49,16 +53,93 @@ static void dispose_timeRequest(onTimeReq *timeReq) {
}
void ws_MakeOnTimeReq(int32 wakeUpTime, machine *myXM, int32 pcOffset, int32 pcCount) {
- error("TODO: ws_MakeOnTimeReq");
+ onTimeReq *newTimeReq, *tempTimeReq;
+
+ // Create a new time request struct and set it's fields
+ newTimeReq = new_timeRequest();
+ newTimeReq->myTime = wakeUpTime;
+ newTimeReq->myXM = myXM;
+ newTimeReq->pcOffset = pcOffset;
+ newTimeReq->pcCount = pcCount;
+
+ // Insert the new time req into the list in ascending order
+ // If the list is empty...
+ if (!_GWS(firstTimeReq)) {
+ newTimeReq->next = NULL;
+ _GWS(firstTimeReq) = newTimeReq;
+ } else if (newTimeReq->myTime <= _GWS(firstTimeReq)->myTime) {
+ // Else if it belongs at the front of a non-empty list..
+ newTimeReq->next = _GWS(firstTimeReq);
+ _GWS(firstTimeReq) = newTimeReq;
+ } else {
+ // Else it belongs in the middle/end of a non-empty list...
+ tempTimeReq = _GWS(firstTimeReq);
+ while (tempTimeReq->next && (tempTimeReq->next->myTime < newTimeReq->myTime)) {
+ tempTimeReq = tempTimeReq->next;
+ }
+
+ newTimeReq->next = tempTimeReq->next;
+ tempTimeReq->next = newTimeReq;
+ }
}
void ws_CancelOnTimeReqs(machine *m) {
- error("TODO: ws_CancelOnTimeReqs");
+ onTimeReq *tempTimeReq, *prevTimeReq;
+
+ if (!m)
+ return;
+
+ // Pass through the linked list, removing any requests for machine* m.
+ prevTimeReq = _GWS(firstTimeReq);
+ tempTimeReq = _GWS(firstTimeReq);
+
+ while (tempTimeReq) {
+ // If tempTimeReq is one to be cancelled...
+ if (tempTimeReq->myXM == m) {
+ // If req is first in the list
+ if (tempTimeReq == _GWS(firstTimeReq)) {
+ _GWS(firstTimeReq) = _GWS(firstTimeReq)->next;
+ prevTimeReq = _GWS(firstTimeReq);
+ dispose_timeRequest(tempTimeReq);
+ tempTimeReq = _GWS(firstTimeReq);
+ } else {
+ // Else prevTimeReq is the parent of tempTimeReq
+ prevTimeReq->next = tempTimeReq->next;
+ dispose_timeRequest(tempTimeReq);
+ tempTimeReq = prevTimeReq->next;
+ }
+ } else {
+ // Else check next req in list, maintain prevTimeReq is parent of tempTimeReq
+ if (prevTimeReq != tempTimeReq) {
+ prevTimeReq = prevTimeReq->next;
+ }
+ tempTimeReq = tempTimeReq->next;
+ }
+ }
}
void ws_CheckTimeReqs(int32 curTime) {
- error("TODO: ws_CheckTimeReqs");
-}
+ onTimeReq *tempTimeReq;
+ machine *myXM;
+ int32 pcOffset, pcCount;
+
+ // Loop through the list, answering all expired time requests
+ tempTimeReq = _GWS(firstTimeReq);
+ while (tempTimeReq && (tempTimeReq->myTime <= curTime)) {
+ // Extract all important information from request
+ myXM = tempTimeReq->myXM;
+ pcOffset = tempTimeReq->pcOffset;
+ pcCount = tempTimeReq->pcCount;
+
+ // Remove it from the list and dispose
+ _GWS(firstTimeReq) = _GWS(firstTimeReq)->next;
+ dispose_timeRequest(tempTimeReq);
+
+ // Execute machine instructions for onTimeReq
+ ws_StepWhile(myXM, pcOffset, pcCount);
+ tempTimeReq = _GWS(firstTimeReq);
+ }
+}
} // End of namespace M4
Commit: 5a90163a80821d5b17df47c9403b1f136beb06af
https://github.com/scummvm/scummvm/commit/5a90163a80821d5b17df47c9403b1f136beb06af
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move events folder into platform/
Changed paths:
A engines/m4/platform/events/keys.h
A engines/m4/platform/events/mickey.cpp
A engines/m4/platform/events/mickey.h
A engines/m4/platform/events/mouse_handler.cpp
A engines/m4/platform/events/mouse_handler.h
R engines/m4/events/keys.h
R engines/m4/events/mickey.cpp
R engines/m4/events/mickey.h
R engines/m4/events/mouse_handler.cpp
R engines/m4/events/mouse_handler.h
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_sys.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/module.mk
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index b56e3efc9f8..caea9f04670 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -23,12 +23,12 @@
#include "m4/adv_r/adv_control.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
-#include "m4/events/keys.h"
#include "m4/graphics/krn_pal.h"
#include "m4/graphics/gr_pal.h"
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
+#include "m4/platform/events/keys.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 45aed49ca9e..2cb1480e637 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -25,7 +25,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/gui/gui.h"
#include "m4/core/imath.h"
-#include "m4/events/keys.h"
+#include "m4/platform/events/keys.h"
#include "m4/graphics/gr_pal.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/krn_pal.h"
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 9c8da35b59f..884ec677e67 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/gui/gui_item.h"
-#include "m4/events/keys.h"
+#include "m4/platform/events/keys.h"
#include "m4/graphics/gr_draw.h"
#include "m4/graphics/gr_line.h"
#include "m4/graphics/gr_pal.h"
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 6162584ddbb..8c4ac4959f2 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -24,8 +24,8 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/core/mouse.h"
-#include "m4/events/mickey.h"
-#include "m4/events/mouse_handler.h"
+#include "m4/platform/events/mickey.h"
+#include "m4/platform/events/mouse_handler.h"
#include "m4/mem/memman.h"
#include "m4/vars.h"
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index edcf44e7d2a..952bd599c56 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -21,7 +21,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
-#include "m4/events/keys.h"
+#include "m4/platform/events/keys.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 1bccb5d7a40..746b2a6d574 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -32,8 +32,6 @@ MODULE_OBJS = \
core/rooms.o \
core/term.o \
dbg/dbg_wscript.o \
- events/mickey.o \
- events/mouse_handler.o \
fileio/extensions.o \
fileio/fileio.o \
fileio/fstream.o \
@@ -64,6 +62,8 @@ MODULE_OBJS = \
mem/res.o \
platform/sound.o \
platform/timer.o \
+ platform/events/mickey.o \
+ platform/events/mouse_handler.o \
platform/sound/digi.o \
platform/sound/midi.o \
platform/tile/tile_read.o \
diff --git a/engines/m4/events/keys.h b/engines/m4/platform/events/keys.h
similarity index 98%
rename from engines/m4/events/keys.h
rename to engines/m4/platform/events/keys.h
index 69f6d6001ac..0814809788c 100644
--- a/engines/m4/events/keys.h
+++ b/engines/m4/platform/events/keys.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_EVENTS_KEYS_H
-#define M4_EVENTS_KEYS_H
+#ifndef M4_PLATFORM_EVENTS_KEYS_H
+#define M4_PLATFORM_EVENTS_KEYS_H
#include "common/events.h"
#include "m4/m4_types.h"
diff --git a/engines/m4/events/mickey.cpp b/engines/m4/platform/events/mickey.cpp
similarity index 96%
rename from engines/m4/events/mickey.cpp
rename to engines/m4/platform/events/mickey.cpp
index 6f97771b9fe..43788d4a3e5 100644
--- a/engines/m4/events/mickey.cpp
+++ b/engines/m4/platform/events/mickey.cpp
@@ -20,7 +20,7 @@
*/
#include "common/textconsole.h"
-#include "m4/events/mickey.h"
+#include "m4/platform/events/mickey.h"
namespace M4 {
diff --git a/engines/m4/events/mickey.h b/engines/m4/platform/events/mickey.h
similarity index 93%
rename from engines/m4/events/mickey.h
rename to engines/m4/platform/events/mickey.h
index 747360742ab..e3d354bef6a 100644
--- a/engines/m4/events/mickey.h
+++ b/engines/m4/platform/events/mickey.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_EVENTS_MICKEY_H
-#define M4_EVENTS_MICKEY_H
+#ifndef M4_PLATFORM_EVENTS_MICKEY_H
+#define M4_PLATFORM_EVENTS_MICKEY_H
#include "m4/m4_types.h"
diff --git a/engines/m4/events/mouse_handler.cpp b/engines/m4/platform/events/mouse_handler.cpp
similarity index 95%
rename from engines/m4/events/mouse_handler.cpp
rename to engines/m4/platform/events/mouse_handler.cpp
index a64f1a5e46d..53c9a6e5721 100644
--- a/engines/m4/events/mouse_handler.cpp
+++ b/engines/m4/platform/events/mouse_handler.cpp
@@ -20,7 +20,7 @@
*/
#include "common/textconsole.h"
-#include "m4/events/mouse_handler.h"
+#include "m4/platform/events/mouse_handler.h"
namespace M4 {
diff --git a/engines/m4/events/mouse_handler.h b/engines/m4/platform/events/mouse_handler.h
similarity index 92%
rename from engines/m4/events/mouse_handler.h
rename to engines/m4/platform/events/mouse_handler.h
index 62a84718b0b..2cb6797d998 100644
--- a/engines/m4/events/mouse_handler.h
+++ b/engines/m4/platform/events/mouse_handler.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_EVENTS_MOUSE_HANDLER_H
-#define M4_EVENTS_MOUSE_HANDLER_H
+#ifndef M4_PLATFORM_EVENTS_MOUSE_HANDLER_H
+#define M4_PLATFORM_EVENTS_MOUSE_HANDLER_H
#include "m4/m4_types.h"
#include "m4/core/mouse.h"
Commit: d63cfd525cdbf5e554a0895f5a03698a6a207cb0
https://github.com/scummvm/scummvm/commit/d63cfd525cdbf5e554a0895f5a03698a6a207cb0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Events handler
Changed paths:
A engines/m4/platform/events/events.cpp
A engines/m4/platform/events/events.h
R engines/m4/platform/events/mouse_handler.cpp
R engines/m4/platform/events/mouse_handler.h
engines/m4/core/mouse.cpp
engines/m4/core/mouse.h
engines/m4/gui/gui_sys.cpp
engines/m4/module.mk
engines/m4/platform/timer.cpp
engines/m4/vars.h
diff --git a/engines/m4/core/mouse.cpp b/engines/m4/core/mouse.cpp
index 8f3d8f48639..004a3df2b8c 100644
--- a/engines/m4/core/mouse.cpp
+++ b/engines/m4/core/mouse.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/core/mouse.h"
+#include "m4/vars.h"
namespace M4 {
@@ -60,10 +61,13 @@ static byte Pointer[] = {
// returns FALSE if the mouse couldn't be initialized
int mouse_init() {
+ auto &ms = _G(MouseState);
+ ms.CursorColumn = 640 / 2;
+ ms.CursorRow = 480 / 2;
+
return true;
}
-
void mouse_uninstall() {
// No implementation
}
diff --git a/engines/m4/core/mouse.h b/engines/m4/core/mouse.h
index f42b0fdf23a..06fa435ab0c 100644
--- a/engines/m4/core/mouse.h
+++ b/engines/m4/core/mouse.h
@@ -26,84 +26,13 @@
namespace M4 {
-struct MouseInfo {
- uint16 Event;
- uint16 ButtonState;
- uint16 CursorColumn; // x
- uint16 CursorRow; // y
- uint16 HorizontalMickeyCount;
- uint16 VerticalMickeyCount;
-};
-
struct MouseDriverInfo {
- byte MajorVersion;
- byte MinorVersion;
- byte MouseType;
- byte MouseIRQ;
-};
-
-/*
- * Define call mask bit fields
- */
-enum {
- CursorPositionChanged = 0,
- LeftButtonPressed, LeftButtonReleased, RightButtonPressed,
- RightButtonReleased, OEM_MiddleButtonPressed, OEM_MiddleButtonReleased,
- LeftButtonHold, RightButtonHold, OEM_MiddleButtonHold
+ byte MajorVersion = 0;
+ byte MinorVersion = 0;
+ byte MouseType = 0;
+ byte MouseIRQ = 0;
};
-/*
- * Define call mask values
- */
-#define CPC ((Word)(1 << CursorPositionChanged))
-#define LBD ((Word)(1 << LeftButtonPressed))
-#define LBU ((Word)(1 << LeftButtonReleased))
-#define LBH ((int32)(1 << LeftButtonHold))
-#define RBD ((Word)(1 << RightButtonPressed))
-#define RBU ((Word)(1 << RightButtonReleased))
-#define RBH ((int32)(1 << RightButtonHold))
-#define MBD ((Word)(1 << OEM_MiddleButtonPressed))
-#define MBU ((Word)(1 << OEM_MiddleButtonReleased))
-#define MBHold ((int32)(1 << OEM_MiddleButtonHold))
-
-#define LBC (LBD + LBU)
-#define RBC (RBD + RBU)
-#define MBC (MBD + MBU)
-
-#define MSA (LBC + RBC + CPC)
-#define OEMA (LBC + RBC + MBC + CPC)
-
-
-enum mausEvent {
- _ME_no_event, // 0
- _ME_move, // 1
- _ME_L_click, // 2
- _ME_L_hold, // 3
- _ME_L_drag, // 4
- _ME_L_release, // 5
- _ME_R_click, // 6
- _ME_R_hold, // 7
- _ME_R_drag, // 8
- _ME_R_release, // 9
- _ME_both_click, // 10
- _ME_both_hold, // 11
- _ME_both_drag, // 12
- _ME_both_release, // 13
- _ME_doubleclick, // 14
- _ME_doubleclick_hold, // 15
- _ME_doubleclick_drag, // 16
- _ME_doubleclick_release
-};
-
-enum mausState {
- _MS_no_event, // 0
- _MS_L_clickDown, // 1
- _MS_R_clickDown, // 2
- _MS_both_clickDown, // 3
- _MS_doubleclick_Down // 4
-};
-
-
extern int mouse_init();
extern void mouse_uninstall();
extern byte *GetMousePicture();
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 8c4ac4959f2..9e24bb40262 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -25,7 +25,6 @@
#include "m4/gui/gui_vmng.h"
#include "m4/core/mouse.h"
#include "m4/platform/events/mickey.h"
-#include "m4/platform/events/mouse_handler.h"
#include "m4/mem/memman.h"
#include "m4/vars.h"
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 746b2a6d574..ab8026322cd 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -62,8 +62,8 @@ MODULE_OBJS = \
mem/res.o \
platform/sound.o \
platform/timer.o \
+ platform/events/events.o \
platform/events/mickey.o \
- platform/events/mouse_handler.o \
platform/sound/digi.o \
platform/sound/midi.o \
platform/tile/tile_read.o \
diff --git a/engines/m4/platform/events/events.cpp b/engines/m4/platform/events/events.cpp
new file mode 100644
index 00000000000..a95457bb64d
--- /dev/null
+++ b/engines/m4/platform/events/events.cpp
@@ -0,0 +1,216 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/system.h"
+#include "m4/platform/events/events.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+/*
+ * Define call mask bit fields
+ */
+
+enum {
+ CursorPositionChanged = 0,
+ LeftButtonPressed, LeftButtonReleased, RightButtonPressed,
+ RightButtonReleased, OEM_MiddleButtonPressed, OEM_MiddleButtonReleased
+#if 0
+ ,
+ LeftButtonHold, RightButtonHold, OEM_MiddleButtonHold
+#endif
+};
+
+/*
+ * Define call mask values
+ */
+#define CPC ((uint16)(1 << CursorPositionChanged))
+#define LBD ((uint16)(1 << LeftButtonPressed))
+#define LBU ((uint16)(1 << LeftButtonReleased))
+#define LBH ((uint16)(1 << LeftButtonHold))
+#define RBD ((uint16)(1 << RightButtonPressed))
+#define RBU ((uint16)(1 << RightButtonReleased))
+#define RBH ((uint16)(1 << RightButtonHold))
+#define MBD ((uint16)(1 << OEM_MiddleButtonPressed))
+#define MBU ((uint16)(1 << OEM_MiddleButtonReleased))
+//#define MBHold ((uint16)(1 << OEM_MiddleButtonHold))
+
+#define LBC (LBD + LBU)
+#define RBC (RBD + RBU)
+#define MBC (MBD + MBU)
+#define MSA (LBC + RBC + CPC)
+#define OEMA (LBC + RBC + MBC + CPC)
+
+#define _MLD (_mouseStateEvent & LBD)
+#define _ClearMLD _mouseStateEvent &= ~LBD
+#define _MLU (_mouseStateEvent & LBU)
+#define _ClearMLU _mouseStateEvent &= ~LBU
+#define _MRD (_mouseStateEvent & RBD)
+#define _ClearMRD _mouseStateEvent &= ~RBD
+#define _MRU (_mouseStateEvent & RBU)
+#define _ClearMRU _mouseStateEvent &= ~RBU
+#define _MMOVE ((_mouseX != _oldX) || (_mouseY != _oldY))
+#define _MSAVE _oldX = _mouseX; _oldY = _mouseY
+
+Events *g_events;
+
+Events::Events() {
+ g_events = this;
+}
+
+Events::~Events() {
+ g_events = nullptr;
+}
+
+void Events::process() {
+ pollEvents();
+
+}
+
+void Events::pollEvents() {
+ Common::Event ev;
+ while (g_system->getEventManager()->pollEvent(ev)) {
+ if (ev.type == Common::EVENT_QUIT || ev.type == Common::EVENT_RETURN_TO_LAUNCHER) {
+ _G(kernel).going = false;
+ } else if (ev.type >= Common::EVENT_MOUSEMOVE && ev.type <= Common::EVENT_MBUTTONUP) {
+ handleMouseEvent(ev);
+ } else if (ev.type == Common::EVENT_KEYDOWN || ev.type == Common::EVENT_KEYUP) {
+ handleKeyboardEvent(ev);
+ }
+ }
+}
+
+void Events::handleMouseEvent(const Common::Event &ev) {
+ _mouseX = ev.mouse.x;
+ _mouseY = ev.mouse.y;
+
+ switch (ev.type) {
+ case Common::EVENT_MOUSEMOVE:
+ _mouseStateEvent |= CPC;
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ _mouseStateEvent |= LBD;
+ break;
+ case Common::EVENT_LBUTTONUP:
+ _mouseStateEvent |= LBU;
+ break;
+ case Common::EVENT_RBUTTONDOWN:
+ _mouseStateEvent |= RBD;
+ break;
+ case Common::EVENT_RBUTTONUP:
+ _mouseStateEvent |= RBU;
+ break;
+ case Common::EVENT_MBUTTONDOWN:
+ _mouseStateEvent |= MBD;
+ break;
+ case Common::EVENT_MBUTTONUP:
+ _mouseStateEvent |= MBU;
+ break;
+ default:
+ break;
+ }
+}
+
+void Events::handleKeyboardEvent(const Common::Event &ev) {
+ if (ev.type == Common::EVENT_KEYDOWN) {
+ // TODO
+ } else if (ev.type == Common::EVENT_KEYUP) {
+ // TODO
+ }
+}
+
+mausEvent Events::mouse_get_event() {
+ process();
+
+ switch (_mouse_state) {
+ case _MS_no_event:
+ if (_MLD) {
+ _ClearMLD;
+ if (_dclickTime && (timer_read_60() < _dclickTime)) {
+ _mouse_state = _MS_doubleclick_Down;
+ _dclickTime = 0;
+ return _ME_doubleclick;
+ }
+ _dclickTime = 0;
+ _mouse_state = _MS_L_clickDown;
+ return _ME_L_click;
+ }
+ if (_MRD) {
+ _ClearMRD;
+ _mouse_state = _MS_R_clickDown;
+ return _ME_R_click;
+ }
+ if (_MMOVE) {
+ _MSAVE;
+ return _ME_move;
+ }
+ return _ME_no_event;
+
+ case _MS_L_clickDown:
+ if (_MLU || !ButtonState) {
+ _dclickTime = timer_read_60() + 15;
+ _ClearMLU;
+ _mouse_state = _MS_no_event;
+ return _ME_L_release;
+ }
+ if (_MMOVE) {
+ _MSAVE;
+ return _ME_L_drag;
+ }
+ return _ME_L_hold;
+
+ case _MS_R_clickDown:
+ if (_MRU) {
+ _ClearMRU;
+ _mouse_state = _MS_no_event;
+ _G(please_hyperwalk) = true;
+ return _ME_R_release;
+ }
+ if (_MMOVE) {
+ _MSAVE;
+ return _ME_R_drag;
+ }
+ return _ME_R_hold;
+
+ case _MS_doubleclick_Down:
+ if (_MLU) {
+ _ClearMLU; _ClearMLD;
+ _mouse_state = _MS_no_event;
+ return _ME_doubleclick_release;
+ }
+ if (_MMOVE) {
+ _MSAVE;
+ return _ME_doubleclick_drag;
+ }
+ return _ME_doubleclick_hold;
+
+ default:
+ return _ME_no_event;
+ }
+
+ return _ME_no_event;
+}
+
+mausEvent mouse_get_event() {
+ return g_events->mouse_get_event();
+}
+
+} // namespace M4
diff --git a/engines/m4/platform/events/events.h b/engines/m4/platform/events/events.h
new file mode 100644
index 00000000000..678c4edcee6
--- /dev/null
+++ b/engines/m4/platform/events/events.h
@@ -0,0 +1,114 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_PLATFORM_EVENTS_EVENTS_H
+#define M4_PLATFORM_EVENTS_EVENTS_H
+
+#include "common/events.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+enum mausEvent {
+ _ME_no_event, // 0
+ _ME_move, // 1
+ _ME_L_click, // 2
+ _ME_L_hold, // 3
+ _ME_L_drag, // 4
+ _ME_L_release, // 5
+ _ME_R_click, // 6
+ _ME_R_hold, // 7
+ _ME_R_drag, // 8
+ _ME_R_release, // 9
+ _ME_both_click, // 10
+ _ME_both_hold, // 11
+ _ME_both_drag, // 12
+ _ME_both_release, // 13
+ _ME_doubleclick, // 14
+ _ME_doubleclick_hold, // 15
+ _ME_doubleclick_drag, // 16
+ _ME_doubleclick_release
+};
+
+enum mausState {
+ _MS_no_event, // 0
+ _MS_L_clickDown, // 1
+ _MS_R_clickDown, // 2
+ _MS_both_clickDown, // 3
+ _MS_doubleclick_Down // 4
+};
+
+struct MouseInfo {
+ uint16 Event = 0;
+ uint16 ButtonState = 0;
+ uint16 CursorColumn = 0; // x
+ uint16 CursorRow = 0; // y
+ uint16 HorizontalMickeyCount = 0;
+ uint16 VerticalMickeyCount = 0;
+};
+
+struct Events : public MouseInfo {
+private:
+ uint16 &_mouseX = CursorColumn;
+ uint16 &_mouseY = CursorRow;
+ uint16 _oldX = 0xffff;
+ uint16 _oldY = 0xffff;
+ mausState _mouse_state = _MS_no_event;
+ uint32 _mouseStateEvent = 0;
+ uint32 _dclickTime = 0;
+
+ /**
+ * Handles reading in pending events from the ScummVM event queue
+ */
+ void pollEvents();
+
+ /**
+ * Handles mouse events
+ */
+ void handleMouseEvent(const Common::Event &ev);
+
+ /**
+ * Handles keyboard events
+ */
+ void handleKeyboardEvent(const Common::Event &ev);
+
+public:
+ Events();
+ ~Events();
+
+ /**
+ * Updates pending events and timers
+ */
+ void process();
+
+ /**
+ * Get the next pending mouse event
+ */
+ mausEvent mouse_get_event();
+};
+
+extern Events *g_events;
+
+mausEvent mouse_get_event();
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/platform/events/mouse_handler.cpp b/engines/m4/platform/events/mouse_handler.cpp
deleted file mode 100644
index 53c9a6e5721..00000000000
--- a/engines/m4/platform/events/mouse_handler.cpp
+++ /dev/null
@@ -1,32 +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/>.
- *
- */
-
-#include "common/textconsole.h"
-#include "m4/platform/events/mouse_handler.h"
-
-namespace M4 {
-
-mausEvent mouse_get_event() {
- warning("TODO: mouse_get_event");
- return _ME_no_event;
-}
-
-} // namespace M4
diff --git a/engines/m4/platform/events/mouse_handler.h b/engines/m4/platform/events/mouse_handler.h
deleted file mode 100644
index 2cb6797d998..00000000000
--- a/engines/m4/platform/events/mouse_handler.h
+++ /dev/null
@@ -1,34 +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/>.
- *
- */
-
-#ifndef M4_PLATFORM_EVENTS_MOUSE_HANDLER_H
-#define M4_PLATFORM_EVENTS_MOUSE_HANDLER_H
-
-#include "m4/m4_types.h"
-#include "m4/core/mouse.h"
-
-namespace M4 {
-
-mausEvent mouse_get_event();
-
-} // namespace M4
-
-#endif
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
index 56803d4a118..b9bb578ec48 100644
--- a/engines/m4/platform/timer.cpp
+++ b/engines/m4/platform/timer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/system.h"
#include "m4/platform/timer.h"
#include "m4/vars.h"
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 723b9c656a7..ef91e0bd6f1 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -51,6 +51,7 @@
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/timer.h"
+#include "m4/platform/events/events.h"
#include "m4/platform/sound/digi.h"
#include "m4/platform/sound/midi.h"
#include "m4/wscript/wscript.h"
@@ -87,6 +88,8 @@ public:
virtual void global_menu_system_init() = 0;
virtual void initialize_game() = 0;
+ Events _events;
+ MouseInfo &_MouseState = _events;
GameControl _game;
Kernel _kernel;
Term _term;
@@ -99,7 +102,6 @@ public:
Resources _resources;
Rails_Globals _rails;
Catalog _catalog;
- MouseInfo _MouseState;
Dialog_Globals _dialog;
Item_Globals _items;
Converstation_Globals _conversations;
Commit: 0ef3a4a2b4e33a8aeae21d79c9f9685371f09987
https://github.com/scummvm/scummvm/commit/0ef3a4a2b4e33a8aeae21d79c9f9685371f09987
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Properly implement timers
Changed paths:
engines/m4/platform/timer.cpp
engines/m4/platform/timer.h
engines/m4/vars.h
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
index b9bb578ec48..79a3e65a78c 100644
--- a/engines/m4/platform/timer.cpp
+++ b/engines/m4/platform/timer.cpp
@@ -26,26 +26,19 @@
namespace M4 {
uint32 timer_read() {
- return _G(timer_60_low);
+ return g_system->getMillis() * 60 / 1000;
}
-
uint32 timer_read_dos() {
- return _G(timer_dos_low);
+ return g_system->getMillis() * 60 / 1000;
}
-
uint32 timer_read_600() {
- return _G(timer_600_low);
+ return g_system->getMillis() * 600 / 1000;
}
-
uint32 timer_read_60() {
- return _G(timer_60_low);
-}
-
-void timer_600_proc() {
- _G(timer_600_low)++;
+ return g_system->getMillis() * 60 / 1000;
}
} // End of namespace M4
diff --git a/engines/m4/platform/timer.h b/engines/m4/platform/timer.h
index 1bc0fd02173..7ca74f481dc 100644
--- a/engines/m4/platform/timer.h
+++ b/engines/m4/platform/timer.h
@@ -27,22 +27,10 @@
namespace M4 {
-struct Timer_Globals {
- uint32 _timer_600_low = 0;
- uint32 _timer_60_low = 0;
- uint32 _timer_dos_low = 0;
-
- bool _timer_installed = false;
- uint16 _timer_600_handle = 0;
- uint16 _timer_60_handle = 0;
- uint16 _timer_dos_handle = 0;
-};
-
extern uint32 timer_read();
extern uint32 timer_read_dos();
extern uint32 timer_read_600();
extern uint32 timer_read_60();
-extern void timer_600_proc();
} // End of namespace M4
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index ef91e0bd6f1..eeb35a4583f 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -64,7 +64,7 @@ class Vars;
extern Vars *g_vars;
-class Vars : public Mouse_Globals, public Timer_Globals {
+class Vars : public Mouse_Globals {
private:
void game_systems_initialize(byte flags);
void game_systems_shutdown();
Commit: 876252582b8fa54cefeff466daf98794cf69cb51
https://github.com/scummvm/scummvm/commit/876252582b8fa54cefeff466daf98794cf69cb51
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merging of event handling
Changed paths:
A engines/m4/platform/events.cpp
A engines/m4/platform/events.h
A engines/m4/platform/keys.h
R engines/m4/platform/events/events.cpp
R engines/m4/platform/events/events.h
R engines/m4/platform/events/keys.h
R engines/m4/platform/events/mickey.cpp
R engines/m4/platform/events/mickey.h
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_sys.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index caea9f04670..30ae11aa9cc 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -28,7 +28,7 @@
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
-#include "m4/platform/events/keys.h"
+#include "m4/platform/keys.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 2cb1480e637..b8ce9c52495 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -25,7 +25,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/gui/gui.h"
#include "m4/core/imath.h"
-#include "m4/platform/events/keys.h"
+#include "m4/platform/keys.h"
#include "m4/graphics/gr_pal.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/krn_pal.h"
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 884ec677e67..1ae5681825b 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/gui/gui_item.h"
-#include "m4/platform/events/keys.h"
+#include "m4/platform/keys.h"
#include "m4/graphics/gr_draw.h"
#include "m4/graphics/gr_line.h"
#include "m4/graphics/gr_pal.h"
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 9e24bb40262..16925949221 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -24,7 +24,6 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/core/mouse.h"
-#include "m4/platform/events/mickey.h"
#include "m4/mem/memman.h"
#include "m4/vars.h"
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 952bd599c56..df5f998d86e 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -21,7 +21,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
-#include "m4/platform/events/keys.h"
+#include "m4/platform/keys.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ab8026322cd..c3e712c0101 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -60,10 +60,9 @@ MODULE_OBJS = \
mem/memman.o \
mem/reloc.o \
mem/res.o \
+ platform/events.o \
platform/sound.o \
platform/timer.o \
- platform/events/events.o \
- platform/events/mickey.o \
platform/sound/digi.o \
platform/sound/midi.o \
platform/tile/tile_read.o \
diff --git a/engines/m4/platform/events/events.cpp b/engines/m4/platform/events.cpp
similarity index 96%
rename from engines/m4/platform/events/events.cpp
rename to engines/m4/platform/events.cpp
index a95457bb64d..7496672fa9e 100644
--- a/engines/m4/platform/events/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -20,7 +20,7 @@
*/
#include "common/system.h"
-#include "m4/platform/events/events.h"
+#include "m4/platform/events.h"
#include "m4/vars.h"
namespace M4 {
@@ -209,8 +209,19 @@ mausEvent Events::mouse_get_event() {
return _ME_no_event;
}
+bool Events::util_kbd_check(int32 *parm1) {
+ if (!parm1)
+ return false;
+
+ return true;
+}
+
mausEvent mouse_get_event() {
return g_events->mouse_get_event();
}
+bool util_kbd_check(int32 *parm1) {
+ return g_events->util_kbd_check(parm1);
+}
+
} // namespace M4
diff --git a/engines/m4/platform/events/events.h b/engines/m4/platform/events.h
similarity index 91%
rename from engines/m4/platform/events/events.h
rename to engines/m4/platform/events.h
index 678c4edcee6..69cb85351d1 100644
--- a/engines/m4/platform/events/events.h
+++ b/engines/m4/platform/events.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_PLATFORM_EVENTS_EVENTS_H
-#define M4_PLATFORM_EVENTS_EVENTS_H
+#ifndef M4_PLATFORM_EVENTS_H
+#define M4_PLATFORM_EVENTS_H
#include "common/events.h"
#include "m4/m4_types.h"
@@ -103,11 +103,17 @@ public:
* Get the next pending mouse event
*/
mausEvent mouse_get_event();
+
+ /**
+ * Get the next pending keyboard event
+ */
+ bool util_kbd_check(int32 *parm1);
};
extern Events *g_events;
-mausEvent mouse_get_event();
+extern mausEvent mouse_get_event();
+extern bool util_kbd_check(int32 *parm1);
} // namespace M4
diff --git a/engines/m4/platform/events/mickey.cpp b/engines/m4/platform/events/mickey.cpp
deleted file mode 100644
index 43788d4a3e5..00000000000
--- a/engines/m4/platform/events/mickey.cpp
+++ /dev/null
@@ -1,38 +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/>.
- *
- */
-
-#include "common/textconsole.h"
-#include "m4/platform/events/mickey.h"
-
-namespace M4 {
-
-bool util_kbd_check(int32 *parm1) {
- if (!parm1)
- return false;
-
- *parm1 = 0;
- warning("TODO: util_kbd_check");
-
- return false;
-}
-
-
-} // namespace M4
diff --git a/engines/m4/platform/events/mickey.h b/engines/m4/platform/events/mickey.h
deleted file mode 100644
index e3d354bef6a..00000000000
--- a/engines/m4/platform/events/mickey.h
+++ /dev/null
@@ -1,33 +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/>.
- *
- */
-
-#ifndef M4_PLATFORM_EVENTS_MICKEY_H
-#define M4_PLATFORM_EVENTS_MICKEY_H
-
-#include "m4/m4_types.h"
-
-namespace M4 {
-
-extern bool util_kbd_check(int32 *parm1);
-
-} // namespace M4
-
-#endif
diff --git a/engines/m4/platform/events/keys.h b/engines/m4/platform/keys.h
similarity index 98%
rename from engines/m4/platform/events/keys.h
rename to engines/m4/platform/keys.h
index 0814809788c..e566ef5a495 100644
--- a/engines/m4/platform/events/keys.h
+++ b/engines/m4/platform/keys.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_PLATFORM_EVENTS_KEYS_H
-#define M4_PLATFORM_EVENTS_KEYS_H
+#ifndef M4_PLATFORM_KEYS_H
+#define M4_PLATFORM_KEYS_H
#include "common/events.h"
#include "m4/m4_types.h"
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index eeb35a4583f..fdf416b89d8 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -50,8 +50,8 @@
#include "m4/gui/gui_univ.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
+#include "m4/platform/events.h"
#include "m4/platform/timer.h"
-#include "m4/platform/events/events.h"
#include "m4/platform/sound/digi.h"
#include "m4/platform/sound/midi.h"
#include "m4/wscript/wscript.h"
Commit: 473dd86699ff2dadb5e9e56fe9ec865ef2bb71b2
https://github.com/scummvm/scummvm/commit/473dd86699ff2dadb5e9e56fe9ec865ef2bb71b2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added keyboard code
Changed paths:
engines/m4/gui/gui_sys.cpp
engines/m4/platform/events.cpp
engines/m4/platform/events.h
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 16925949221..c501c4565e5 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -50,7 +50,7 @@ void gui_system_shutdown() {
}
void gui_system_event_handler() {
- mausEvent newMouseEvent;
+ MouseEvent newMouseEvent;
ScreenContext *myScreen;
Hotkey *myHotkey;
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index 7496672fa9e..76e2720fbeb 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -130,14 +130,11 @@ void Events::handleMouseEvent(const Common::Event &ev) {
}
void Events::handleKeyboardEvent(const Common::Event &ev) {
- if (ev.type == Common::EVENT_KEYDOWN) {
- // TODO
- } else if (ev.type == Common::EVENT_KEYUP) {
- // TODO
- }
+ if (ev.type == Common::EVENT_KEYDOWN && _pendingKeys.size() < 16)
+ _pendingKeys.push(ev.kbd);
}
-mausEvent Events::mouse_get_event() {
+MouseEvent Events::mouse_get_event() {
process();
switch (_mouse_state) {
@@ -210,13 +207,16 @@ mausEvent Events::mouse_get_event() {
}
bool Events::util_kbd_check(int32 *parm1) {
- if (!parm1)
+ if (!parm1 || _pendingKeys.empty())
return false;
+ Common::KeyState ks = _pendingKeys.pop();
+ *parm1 = ks.keycode | (ks.flags << 16);
+
return true;
}
-mausEvent mouse_get_event() {
+MouseEvent mouse_get_event() {
return g_events->mouse_get_event();
}
diff --git a/engines/m4/platform/events.h b/engines/m4/platform/events.h
index 69cb85351d1..90ebbb8bb8e 100644
--- a/engines/m4/platform/events.h
+++ b/engines/m4/platform/events.h
@@ -22,12 +22,13 @@
#ifndef M4_PLATFORM_EVENTS_H
#define M4_PLATFORM_EVENTS_H
+#include "common/queue.h"
#include "common/events.h"
#include "m4/m4_types.h"
namespace M4 {
-enum mausEvent {
+enum MouseEvent {
_ME_no_event, // 0
_ME_move, // 1
_ME_L_click, // 2
@@ -67,6 +68,7 @@ struct MouseInfo {
struct Events : public MouseInfo {
private:
+ Common::Queue<Common::KeyState> _pendingKeys;
uint16 &_mouseX = CursorColumn;
uint16 &_mouseY = CursorRow;
uint16 _oldX = 0xffff;
@@ -102,7 +104,7 @@ public:
/**
* Get the next pending mouse event
*/
- mausEvent mouse_get_event();
+ MouseEvent mouse_get_event();
/**
* Get the next pending keyboard event
@@ -112,7 +114,7 @@ public:
extern Events *g_events;
-extern mausEvent mouse_get_event();
+extern MouseEvent mouse_get_event();
extern bool util_kbd_check(int32 *parm1);
} // namespace M4
Commit: 3b9228219aef80670b8b2daf9b1509e2e0539ed1
https://github.com/scummvm/scummvm/commit/3b9228219aef80670b8b2daf9b1509e2e0539ed1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Process pending events when doing keyboard check
Changed paths:
engines/m4/platform/events.cpp
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index 76e2720fbeb..be1b2d26b3b 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -207,6 +207,8 @@ MouseEvent Events::mouse_get_event() {
}
bool Events::util_kbd_check(int32 *parm1) {
+ process();
+
if (!parm1 || _pendingKeys.empty())
return false;
Commit: a80362a793af1edce0418b97efb8fbd0769824d9
https://github.com/scummvm/scummvm/commit/a80362a793af1edce0418b97efb8fbd0769824d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Explicitly process pending events first in gui_system_event_handler
Changed paths:
engines/m4/gui/gui_sys.cpp
engines/m4/platform/events.cpp
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index c501c4565e5..8e5b71fe714 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -62,6 +62,9 @@ void gui_system_event_handler() {
if (!_G(vmng_Initted))
return;
+ // Allow pending events to be processed
+ g_events->process();
+
// Deal with mouse events first..
_G(mouseX) = _G(MouseState).CursorColumn;
_G(mouseY) = _G(MouseState).CursorRow;
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index be1b2d26b3b..dddfb829590 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -82,7 +82,6 @@ Events::~Events() {
void Events::process() {
pollEvents();
-
}
void Events::pollEvents() {
Commit: 076b7a2c92fc95542a96369b0a475f4dc6df504c
https://github.com/scummvm/scummvm/commit/076b7a2c92fc95542a96369b0a475f4dc6df504c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix separation of global_room_init and room specific init() methods
Changed paths:
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 38a13a1e18c..3751fbdd47b 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -26,115 +26,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room::init() {
- int roomId = _G(game).room_id;
-
- if (roomId <= 800)
- _GINT().show();
- else
- _GINT().hide();
-
- // Disable commands for certain rooms
- if (roomId == 201 || roomId == 301 || roomId == 306 || roomId == 307 ||
- roomId == 401 || roomId == 501 || roomId == 511 || roomId == 512 ||
- roomId == 513 || roomId == 601 || roomId == 605 || roomId == 606 ||
- roomId == 608 || roomId == 609 || roomId == 610 || roomId == 801 ||
- roomId == 902) {
- player_set_commands_allowed(false);
- }
-
- if (roomId >= 950 || roomId == 902)
- mouse_hide();
- else
- mouse_show();
-
- // Do stuff that needs to be done each time a scene is started
- init_series_players();
-
- // Preload digi sounds
- if (_G(player).walker_in_this_scene) {
- switch (roomId) {
- case 102:
- case 103:
- case 105:
- case 134:
- case 135:
- case 143:
- case 174:
- case 175:
- case 176:
- case 304:
- case 505:
- case 506:
- case 507:
- case 509:
- case 602:
- case 603:
- case 604:
- case 612:
- {
- static const char *NAMES[] = {
- "fs_wood1", "fs_wood2", "fs_wood3", "fs_wood4", "fs_wood5", nullptr
- };
- _G(digi).preload_sounds(NAMES);
- break;
- }
-
- case 106:
- case 139:
- case 144:
- case 145:
- case 302:
- case 303:
- case 305:
- {
- static const char *NAMES[] = {
- "fs_dirt1", "fs_dirt2", "fs_dirt3", "fs_dirt4", "fs_dirt5", nullptr
- };
- _G(digi).preload_sounds(NAMES);
- break;
- }
-
- case 310:
- case 311:
- case 312:
- case 313:
- case 314:
- case 315:
- case 316:
- case 317:
- case 318:
- case 319:
- {
- static const char *NAMES[] = {
- "fs_mine1", "fs_mine2", "fs_mine3", "fs_mine4", "fs_mine5", nullptr
- };
- _G(digi).preload_sounds(NAMES);
- break;
- }
-
- default:
- {
- static const char *NAMES[] = {
- "fs_hard1", "fs_hard2", "fs_hard3", "fs_hard4", "fs_hard5", nullptr
- };
- _G(digi).preload_sounds(NAMES);
- break;
- }
- }
- }
-
- // TODO: Further room init
-}
-
void Room::shutdown() {
_GV()[298] = 0;
}
-void Room::init_series_players() {
- _G(seriesPlayers).clear();
-}
-
void Room::parser_code() {
warning("TODO: global_parser_code");
}
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 1f21f3c914e..fcb18f931ff 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -30,14 +30,10 @@ namespace Burger {
namespace Rooms {
class Room : public M4::Room {
-private:
- void init_series_players();
-
public:
Room(uint roomNum) : M4::Room(roomNum) {}
~Room() override {}
- void init() override;
void shutdown() override;
void parser_code() override;
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index 7c73a2d04c5..b3c4e4cb93d 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -26,6 +26,107 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+void Section::global_room_init() {
+ int roomId = _G(game).room_id;
+
+ if (roomId <= 800)
+ _GINT().show();
+ else
+ _GINT().hide();
+
+ // Disable commands for certain rooms
+ if (roomId == 201 || roomId == 301 || roomId == 306 || roomId == 307 ||
+ roomId == 401 || roomId == 501 || roomId == 511 || roomId == 512 ||
+ roomId == 513 || roomId == 601 || roomId == 605 || roomId == 606 ||
+ roomId == 608 || roomId == 609 || roomId == 610 || roomId == 801 ||
+ roomId == 902) {
+ player_set_commands_allowed(false);
+ }
+
+ if (roomId >= 950 || roomId == 902)
+ mouse_hide();
+ else
+ mouse_show();
+
+ // Do stuff that needs to be done each time a scene is started
+ init_series_players();
+
+ // Preload digi sounds
+ if (_G(player).walker_in_this_scene) {
+ switch (roomId) {
+ case 102:
+ case 103:
+ case 105:
+ case 134:
+ case 135:
+ case 143:
+ case 174:
+ case 175:
+ case 176:
+ case 304:
+ case 505:
+ case 506:
+ case 507:
+ case 509:
+ case 602:
+ case 603:
+ case 604:
+ case 612: {
+ static const char *NAMES[] = {
+ "fs_wood1", "fs_wood2", "fs_wood3", "fs_wood4", "fs_wood5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 106:
+ case 139:
+ case 144:
+ case 145:
+ case 302:
+ case 303:
+ case 305: {
+ static const char *NAMES[] = {
+ "fs_dirt1", "fs_dirt2", "fs_dirt3", "fs_dirt4", "fs_dirt5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ case 314:
+ case 315:
+ case 316:
+ case 317:
+ case 318:
+ case 319: {
+ static const char *NAMES[] = {
+ "fs_mine1", "fs_mine2", "fs_mine3", "fs_mine4", "fs_mine5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ default: {
+ static const char *NAMES[] = {
+ "fs_hard1", "fs_hard2", "fs_hard3", "fs_hard4", "fs_hard5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+ }
+ }
+
+ // TODO: Further room init
+}
+
+void Section::init_series_players() {
+ _G(seriesPlayers).clear();
+}
+
void Section::daemon_code() {
warning("TODO: global_daemon_code");
}
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
index f4bb1875d44..844b3a5e26e 100644
--- a/engines/m4/burger/rooms/section.h
+++ b/engines/m4/burger/rooms/section.h
@@ -29,10 +29,14 @@ namespace Burger {
namespace Rooms {
class Section : public M4::Section {
+private:
+ void init_series_players();
+
public:
Section() : M4::Section() {}
~Section() override {}
+ void global_room_init() override;
void daemon_code() override;
};
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 5645235afe9..e91164748f0 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -107,7 +107,7 @@ void Sections::m4SceneLoad() {
_G(set_commands_allowed_since_last_checked) = false;
_G(between_rooms) = false;
- room_init();
+ global_room_init();
_G(player).walker_trigger = -1;
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
@@ -124,7 +124,7 @@ void Sections::m4SceneLoad() {
_visited_room = player_been_here(_G(game).room_id);
term_message("calling room_init_code");
- g_engine->room_init();
+ room_init();
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
_G(game).previous_room = -1;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index ccfabc5c083..1f44ef3ae66 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -77,6 +77,7 @@ public:
*/
virtual HotSpotRec *walker_spotter(int32 x, int32 y);
+ virtual void global_room_init() {}
virtual void daemon_code() {}
};
@@ -112,6 +113,9 @@ public:
void daemon_code() {
_activeSection->daemon_code();
}
+ void global_room_init() {
+ _activeSection->global_room_init();
+ }
void room_preload() {
_activeRoom->preload();
Commit: 68dd812327cf793c261f21ae047b09c5666718d7
https://github.com/scummvm/scummvm/commit/68dd812327cf793c261f21ae047b09c5666718d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of global_room_init
Changed paths:
engines/m4/burger/rooms/section.cpp
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index b3c4e4cb93d..3cd75a756a0 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -120,7 +120,8 @@ void Section::global_room_init() {
}
}
- // TODO: Further room init
+ kernel_timing_trigger(900, 10017, nullptr);
+ kernel_timing_trigger(300, 10017, nullptr);
}
void Section::init_series_players() {
Commit: 4c02884c8ddac0e572ec4ebe295d20ede5d736b6
https://github.com/scummvm/scummvm/commit/4c02884c8ddac0e572ec4ebe295d20ede5d736b6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Section9::daemon_code
Changed paths:
engines/m4/burger/rooms/section9/section9.cpp
engines/m4/burger/rooms/section9/section9.h
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
index 649e81895f2..b0f33ed171c 100644
--- a/engines/m4/burger/rooms/section9/section9.cpp
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section9/section9.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
@@ -29,6 +30,26 @@ Section9::Section9() : Rooms::Section() {
add(&_room951);
}
+void Section9::daemon_code() {
+ switch (_G(kernel).trigger) {
+ case 9002:
+ _G(game).new_room = 902;
+ break;
+ case 9004:
+ _G(game).new_room = 904;
+ break;
+ case 9005:
+ _G(game).new_room = 951;
+ break;
+ case 9006:
+ _G(game).new_room = 971;
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
index 7e46f2dd42d..47062af9f1c 100644
--- a/engines/m4/burger/rooms/section9/section9.h
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -35,6 +35,8 @@ private:
public:
Section9();
virtual ~Section9() {}
+
+ void daemon_code() override;
};
} // namespace Rooms
Commit: 9ce3677c22bacc58b0a61fbb9986e7bddf22e111
https://github.com/scummvm/scummvm/commit/9ce3677c22bacc58b0a61fbb9986e7bddf22e111
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding changes for krn_pal_game_task
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/adv_r/adv_trigger.h
engines/m4/adv_r/kernel.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section.h
engines/m4/burger/vars.h
engines/m4/core/mouse.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_dialog.h
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_item.h
engines/m4/gui/hotkeys.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 427e62213fe..f1834ea5767 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -22,6 +22,8 @@
#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_interface.h"
#include "m4/core/errors.h"
+#include "m4/core/mouse.h"
+#include "m4/gui/hotkeys.h"
#include "m4/mem/memman.h"
#include "m4/wscript/ws_machine.h"
#include "m4/vars.h"
@@ -79,5 +81,23 @@ void adv_kill_digi_between_rooms(bool true_or_false) {
_G(shut_down_digi_tracks_between_rooms) = true_or_false;
}
+void toggle_through_cursors() {
+ switch (_G(cursor_state)) {
+ case kARROW:
+ Hotkeys::l_cb(NULL, NULL);
+ break;
+ case kLOOK:
+ Hotkeys::t_cb(NULL, NULL);
+ break;
+ case kTAKE:
+ Hotkeys::u_cb(NULL, NULL);
+ break;
+ case kUSE:
+ Hotkeys::a_cb(NULL, NULL);
+ break;
+ default:
+ break;
+ }
+}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 45e0ebb8014..2e8dfdc33d6 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -31,6 +31,7 @@ namespace M4 {
extern bool kernel_section_startup();
extern void player_set_commands_allowed(bool t_or_f);
extern void game_pause(bool flag);
+extern void toggle_through_cursors();
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 6bd18e00e8c..278a9affdee 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -28,7 +28,6 @@
namespace M4 {
constexpr int NO_TRIGGER = -1;
-constexpr int CALLED_EACH_LOOP = 32764;
constexpr int TENTH_SECOND = 6;
constexpr int MAX_TIMERS = 32;
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index c0c793f3dd6..4e0bfb6e88f 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -69,6 +69,10 @@ struct Kernel {
bool track_open_close = false;
bool going = false;
+ // TODO: Find every use of these new fields
+ int _val1 = 0;
+ int _val2 = 0;
+
size_t mem_avail() const { return 7999999; }
};
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index 3cd75a756a0..f6fccf5618f 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -132,6 +133,13 @@ void Section::daemon_code() {
warning("TODO: global_daemon_code");
}
+void Section::tick() {
+ int oldTrigger = _G(kernel).trigger;
+ _G(kernel).trigger = CALLED_EACH_LOOP;
+ daemon_code();
+ _G(kernel).trigger = oldTrigger;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
index 844b3a5e26e..ac2bfe298a2 100644
--- a/engines/m4/burger/rooms/section.h
+++ b/engines/m4/burger/rooms/section.h
@@ -38,6 +38,7 @@ public:
void global_room_init() override;
void daemon_code() override;
+ void tick() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 6fb7f012fd4..f1b710d4f57 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -59,6 +59,8 @@ enum global_triggers {
// Wilbur specific triggers
gCHANGE_WILBUR_ANIMATION,
+ CALLED_EACH_LOOP = 32764,
+
gLAST_GLOBAL_TRIGGER
};
diff --git a/engines/m4/core/mouse.h b/engines/m4/core/mouse.h
index 06fa435ab0c..d941c54e95f 100644
--- a/engines/m4/core/mouse.h
+++ b/engines/m4/core/mouse.h
@@ -26,6 +26,10 @@
namespace M4 {
+enum cursor_states {
+ kARROW, kLOOK, kTAKE, kUSE
+};
+
struct MouseDriverInfo {
byte MajorVersion = 0;
byte MinorVersion = 0;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index e91164748f0..f1c2a630759 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -21,7 +21,9 @@
#include "m4/core/rooms.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/adv_r/adv_been.h"
+#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_file.h"
#include "m4/adv_r/adv_interface.h"
#include "m4/adv_r/adv_scale.h"
@@ -31,6 +33,7 @@
#include "m4/fileio/extensions.h"
#include "m4/graphics/krn_pal.h"
#include "m4/gui/gui_buffer.h"
+#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/wscript/wst_regs.h"
#include "m4/vars.h"
@@ -59,7 +62,7 @@ void Sections::section_room_constructor() {
void Sections::m4SceneLoad() {
_G(between_rooms) = true;
_cameraShiftAmount = 0;
- cameraShift_vert_Amount = 0;
+ _cameraShift_vert_Amount = 0;
_G(art_base_override) = nullptr;
_G(use_alternate_attribute_file) = true;
shut_down_digi_tracks_between_rooms = true;
@@ -304,6 +307,96 @@ void Sections::parse_player_command_now() {
error("TODO: parse_player_command_now");
}
+void Sections::pal_game_task() {
+ int32 status;
+ bool updateVideo;
+ int delta = 0;
+ int convEvent = 0;
+ Common::String line;
+
+ if (!player_commands_allowed())
+ mouse_set_sprite(5);
+
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+
+ if (!_G(kernel).pause) {
+ if (_G(please_hyperwalk)) {
+ _G(please_hyperwalk) = false;
+ toggle_through_cursors();
+ }
+
+ updateVideo = !_cameraShiftAmount && !_cameraShift_vert_Amount;
+
+ CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
+ _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), updateVideo);
+
+ _G(inverse_pal)->release();
+ _G(game_bgBuff)->release();
+
+ if (!game_buff_ptr)
+ error_show(FL, 'BUF!');
+
+ if (_cameraShiftAmount) {
+ if (_G(kernel)._val2) {
+ delta = _cameraShiftAmount;
+ _cameraShiftAmount = 0;
+ } else if (_cameraShiftAmount > 0) {
+ delta = imath_min(_cameraShiftAmount, camera_pan_step);
+ } else {
+ delta = imath_max(_cameraShiftAmount, camera_pan_step);
+ }
+
+ MoveScreenDelta(game_buff_ptr, delta, 0);
+ }
+
+ if (_cameraShift_vert_Amount) {
+ if (_G(kernel)._val2) {
+ delta = _cameraShift_vert_Amount;
+ _cameraShift_vert_Amount = 0;
+ } else if (_cameraShift_vert_Amount > 0) {
+ delta = imath_min(_cameraShift_vert_Amount, camera_pan_step);
+ } else {
+ delta = imath_max(_cameraShift_vert_Amount, camera_pan_step);
+ }
+ }
+ }
+
+ pal_fx_update();
+ _G(digi).read_another_chunk();
+ _G(midi).loop();
+
+ gui_system_event_handler();
+#ifdef TODO
+ if (conv_is_event_ready()) {
+ _G(player).command_ready = true;
+ term_message("conv parse row");
+ parse_player_command_now();
+ term_message("conv parse finish");
+
+ convEvent = conv_get_event();
+ }
+#endif
+
+ f_stream_Process(2);
+
+ if (_G(kernel).call_daemon_every_loop)
+ tick();
+
+ if (_G(editor_showStats)) {
+ if (_G(my_walker)) {
+ if (!_G(my_walker)->myAnim8)
+ error_show(FL, 'W:-(');
+
+ player_update_info(_G(my_walker), &_G(player_info));
+ }
+
+ line = Common::String::format("%ld From: %ld", _G(game).previous_room, _G(game).new_room);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), line.c_str(), nullptr, 1);
+
+ // TODO: More stuff
+ }
+}
+
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 1f44ef3ae66..2074f1920a6 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -79,12 +79,13 @@ public:
virtual void global_room_init() {}
virtual void daemon_code() {}
+ virtual void tick() {}
};
class Sections {
private:
int32 _cameraShiftAmount = 0;
- int32 cameraShift_vert_Amount = 0;
+ int32 _cameraShift_vert_Amount = 0;
bool shut_down_digi_tracks_between_rooms = true;
int32 camera_pan_step = 10;
bool _visited_room = false;
@@ -116,6 +117,9 @@ public:
void global_room_init() {
_activeSection->global_room_init();
}
+ void tick() {
+ _activeSection->tick();
+ }
void room_preload() {
_activeRoom->preload();
@@ -148,6 +152,8 @@ public:
void m4SceneLoad();
void m4RunScene();
void m4EndScene();
+
+ void pal_game_task();
};
} // namespace M4
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 30ae11aa9cc..c7cb62f92cc 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -30,6 +30,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/platform/keys.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
@@ -46,24 +47,7 @@ namespace M4 {
#define NUM_FREE FREE_END-(FREE_START)+1
void krn_pal_game_task() {
- int32 status;
-
- ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
- if (!game_buff_ptr)
- error_show(FL, 'BUF!');
-
- CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
- _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
-
- _G(inverse_pal)->release();
- _G(game_bgBuff)->release();
-
- _G(digi).task();
- _G(midi).task();
-
- gui_system_event_handler();
-
- f_stream_Process(2);
+ g_engine->pal_game_task();
}
static int32 screen_height(Buffer *grey_screen) {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index b8ce9c52495..8c06a7829ae 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -307,7 +307,7 @@ bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myLis
return retValue;
}
-void Dialog_Change_Item_Prompt(Dialog *d, char *newPrompt, Item *myItem, int32 tag) {
+void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag) {
Buffer *tempBuffer;
ScreenContext *myScreen;
int32 status, tempWidth, tempHeight, itemType;
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index 56658f90e1e..024fc554351 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -121,7 +121,7 @@ extern bool Dialog_Remove_Key(Dialog *d, long myKey);
//GENERAL ITEM SUPPORT
extern Item *Dialog_Get_Item(Dialog *d, int32 tag);
-extern void Dialog_Change_Item_Prompt(Dialog *d, char *newPrompt, Item *myItem, int32 tag);
+extern void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag);
extern bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag);
extern void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag);
extern void Dialog_KeyMouseCollision();
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 1ae5681825b..352b4302600 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -1062,7 +1062,7 @@ bool ResetDefaultListBox(Item *myItem) {
return changed;
}
-bool Item_change_prompt(Item *myItem, char *newPrompt) {
+bool Item_change_prompt(Item *myItem, const char *newPrompt) {
int32 fontHeight;
Font *currFont;
if (!strcmp(myItem->prompt, newPrompt)) return false;
diff --git a/engines/m4/gui/gui_item.h b/engines/m4/gui/gui_item.h
index 6b1cb093006..3d07c709c54 100644
--- a/engines/m4/gui/gui_item.h
+++ b/engines/m4/gui/gui_item.h
@@ -134,7 +134,7 @@ extern bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int3
extern bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset);
extern bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType);
extern bool ResetDefaultListBox(Item *myItem);
-extern bool Item_change_prompt(Item *myItem, char *newPrompt);
+extern bool Item_change_prompt(Item *myItem, const char *newPrompt);
extern void Item_ClearOrigPrompt(void);
extern Item *Item_RestoreTextField(void);
extern Item *Item_CheckTextField(void);
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 2b17c556fa5..4706cc2bdd7 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -31,7 +31,7 @@ struct Hotkeys {
private:
static void adv_enable_system_hot_keys();
-private:
+public:
static void exit_program(void *, void *);
static void cb_F2(void *, void *);
static void cb_F3(void *, void *);
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index fdf416b89d8..4ec154ce028 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -176,7 +176,9 @@ public:
ScreenContext *_game_buff_ptr = nullptr;
machine *_my_walker = nullptr;
uint32 _editors_in_use = 0;
+ bool _editor_showStats = false;
bool _shut_down_digi_tracks_between_rooms = false;
+ cursor_states _cursor_state = kARROW;
};
#define _G(X) (g_vars->_##X)
Commit: 47dd0055e73ad34ec94f4ad578d558e3e1f94c62
https://github.com/scummvm/scummvm/commit/47dd0055e73ad34ec94f4ad578d558e3e1f94c62
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added update_mouse_pos_dialog
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/adv_r/adv_walk.h
engines/m4/core/rooms.cpp
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index f1834ea5767..960f82a5b85 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -24,6 +24,7 @@
#include "m4/core/errors.h"
#include "m4/core/mouse.h"
#include "m4/gui/hotkeys.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/mem/memman.h"
#include "m4/wscript/ws_machine.h"
#include "m4/vars.h"
@@ -100,4 +101,130 @@ void toggle_through_cursors() {
}
}
+bool this_is_a_walkcode(int32 x, int32 y) {
+ if (!_G(screenCodeBuff))
+ return false;
+
+ Buffer *walkCodes;
+ byte *ptr;
+ bool result;
+
+ walkCodes = _G(screenCodeBuff)->get_buffer();
+ if (!walkCodes)
+ return false;
+
+ // Verify params
+ if (x < 0 || y < 0 || x >= walkCodes->W || y >= walkCodes->h)
+ return false;
+
+ ptr = gr_buffer_pointer(walkCodes, x, y);
+ result = ((*ptr) & 0x10) ? true : false;
+
+ _G(screenCodeBuff)->release();
+ return result;
+}
+
+int32 get_screen_depth(int32 x, int32 y) {
+ Buffer *walkCodes;
+ byte *ptr;
+ int32 myDepth;
+
+ if (!_G(screenCodeBuff))
+ return 0;
+
+ walkCodes = _G(screenCodeBuff)->get_buffer();
+ if (!walkCodes) {
+ return 0;
+ }
+
+ // Verify params
+ if (x < 0 || y < 0 || x >= walkCodes->W || y >= walkCodes->h) {
+ return -1;
+ }
+
+ ptr = gr_buffer_pointer(walkCodes, x, y);
+ myDepth = (*ptr) & 0x0f;
+
+ _G(screenCodeBuff)->release();
+ return myDepth;
+}
+
+int32 get_screen_color(int32 x, int32 y) {
+ Buffer *game_buff;
+ byte *ptr;
+ int32 myColor;
+
+ game_buff = _G(gameDrawBuff)->get_buffer();
+ if (!game_buff) {
+ return -1;
+ }
+
+ //verify params
+ if (x < 0 || y < 0 || x >= game_buff->W || y >= game_buff->h) {
+ return -1;
+ }
+
+ ptr = gr_buffer_pointer(game_buff, x, y);
+ myColor = *ptr;
+
+ _G(gameDrawBuff)->release();
+ return myColor;
+}
+
+void update_mouse_pos_dialog() {
+ int32 status;
+
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+ assert(game_buff_ptr);
+
+ if (_G(kernel).myWalker != NULL) {
+ if (((int32)_G(kernel).myWalker->myAnim8) < 0)
+ error_show(FL, 'W:-(');
+ player_get_info();
+ }
+
+ char tempStr1[MAX_STRING_LEN], tempStr2[MAX_STRING_LEN];
+
+ Common::sprintf_s(tempStr1, "%ld From: %ld", _G(game).room_id, _G(game).previous_room);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 1);
+
+ int32 xxx = _G(MouseState).CursorColumn;
+ int32 yyy = _G(MouseState).CursorRow;
+
+ int32 scrnDepth = get_screen_depth(xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1);
+ int32 palColor = get_screen_color(xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1);
+
+ if (this_is_a_walkcode(xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1)) {
+ Common::sprintf_s(tempStr1, "WC %ld, %ld PAL: %ld", xxx, yyy, palColor);
+ Common::sprintf_s(tempStr2, "WC %ld, %ld D: %ld", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
+ } else {
+ Common::sprintf_s(tempStr1, " %ld, %ld PAL: %d", xxx, yyy, palColor);
+ Common::sprintf_s(tempStr2, " %ld, %ld D: %ld", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
+ }
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 2);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 3);
+
+ if (this_is_a_walkcode(_G(player_info).x, _G(player_info).y)) {
+ Common::sprintf_s(tempStr1, "WC %ld, %ld", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
+ Common::sprintf_s(tempStr2, "WC %ld, %ld", _G(player_info).x, _G(player_info).y);
+ } else {
+ Common::sprintf_s(tempStr1, " %ld, %ld", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
+ Common::sprintf_s(tempStr2, " %ld, %ld", _G(player_info).x, _G(player_info).y);
+ }
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 4);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 5);
+
+ Common::sprintf_s(tempStr1, "%ld", _G(player_info).scale);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 6);
+
+ Common::sprintf_s(tempStr1, "%x", _G(player_info).depth);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 7);
+
+ Common::sprintf_s(tempStr1, "%ld, %ld", game_buff_ptr->x1, game_buff_ptr->y1);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 8);
+
+ Common::sprintf_s(tempStr1, "%d", _G(player_info).facing);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 10);
+}
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 2e8dfdc33d6..770c2a17d13 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -32,6 +32,10 @@ extern bool kernel_section_startup();
extern void player_set_commands_allowed(bool t_or_f);
extern void game_pause(bool flag);
extern void toggle_through_cursors();
+extern bool this_is_a_walkcode(int32 x, int32 y);
+extern int32 get_screen_depth(int32 x, int32 y);
+extern int32 get_screen_color(int32 x, int32 y);
+extern void update_mouse_pos_dialog();
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 9a6c0c18eab..a2e19425d4c 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -71,7 +71,7 @@ extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
#define player_turn_to_face(dd, tt) (ws_turn_to_face(_G(kernel).myWalker, dd, tt))
#define player_hide() (ws_hide_walker(_G(kernel).myWalker))
#define player_unhide() (ws_unhide_walker(_G(kernel).myWalker))
-#define player_get_info() (player_update_info(_G(kernel).myWalker, &player_info))
+#define player_get_info() (player_update_info(_G(kernel).myWalker, &_G(player_info)))
#define player_nosepick(aa) (ws_nosepick(_G(kernel).myWalker, aa))
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index f1c2a630759..8ab156b1453 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -311,7 +311,6 @@ void Sections::pal_game_task() {
int32 status;
bool updateVideo;
int delta = 0;
- int convEvent = 0;
Common::String line;
if (!player_commands_allowed())
@@ -373,7 +372,7 @@ void Sections::pal_game_task() {
parse_player_command_now();
term_message("conv parse finish");
- convEvent = conv_get_event();
+ (void)conv_get_event();
}
#endif
@@ -382,19 +381,8 @@ void Sections::pal_game_task() {
if (_G(kernel).call_daemon_every_loop)
tick();
- if (_G(editor_showStats)) {
- if (_G(my_walker)) {
- if (!_G(my_walker)->myAnim8)
- error_show(FL, 'W:-(');
-
- player_update_info(_G(my_walker), &_G(player_info));
- }
-
- line = Common::String::format("%ld From: %ld", _G(game).previous_room, _G(game).new_room);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), line.c_str(), nullptr, 1);
-
- // TODO: More stuff
- }
+ if (_G(showMousePos))
+ update_mouse_pos_dialog();
}
/*------------------------------------------------------------------------*/
Commit: 64636c34c6a5efde76efa7ae81e0940435632f6c
https://github.com/scummvm/scummvm/commit/64636c34c6a5efde76efa7ae81e0940435632f6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added bunch of conv code
Changed paths:
A engines/m4/adv_r/chunk_ops.cpp
A engines/m4/adv_r/chunk_ops.h
A engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv.h
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/core/rooms.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_mouse.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
new file mode 100644
index 00000000000..b8cfbcb916b
--- /dev/null
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/adv_r/chunk_ops.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+conv_chunk *get_conv(Conv *c, long cSize) {
+ char *s = nullptr;
+ conv_chunk *c_v = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ c_v = (conv_chunk *)&s[cSize];
+
+ return c_v;
+}
+
+char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
+ error("TODO: conv_ops_get_entry");
+}
+
+decl_chunk *get_decl(Conv *c, long cSize) {
+ char *s = nullptr;
+ decl_chunk *d = nullptr;
+
+ s = c->conv;
+ d = (decl_chunk *)&s[cSize];
+
+ return d;
+}
+
+char *get_string(Conv *c, long cSize) {
+ char *s = nullptr;
+ char *c_s = nullptr;
+
+ s = c->conv;
+ c_s = (char *)&s[cSize];
+ return c_s;
+}
+
+text_chunk *get_text(Conv *c, long cSize) {
+ char *s = NULL;
+ text_chunk *t = NULL;
+
+ s = &(c->conv[c->myCNode]);
+ t = (text_chunk *)&s[cSize];
+
+ return t;
+}
+
+long conv_ops_text_strlen(char *s) {
+ long len = 0;
+ len = strlen(s) + 1; //added +1 for null char.
+
+ if ((len % 4) == 0)
+ return len;
+
+ len += 4 - (len % 4);
+ return len;
+}
+
+void conv_swap_words(Conv *c) {
+ error("TODO: conv_swap_words");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/chunk_ops.h b/engines/m4/adv_r/chunk_ops.h
new file mode 100644
index 00000000000..9fdffd9e770
--- /dev/null
+++ b/engines/m4/adv_r/chunk_ops.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 M4_ADV_R_CHUNK_OPS_H
+#define M4_ADV_R_CHUNK_OPS_H
+
+#include "m4/m4_types.h"
+#include "m4/adv_r/conv.h"
+
+namespace M4 {
+
+extern conv_chunk *get_conv(Conv *c, long cSize);
+extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
+extern decl_chunk *get_decl(Conv *c, long cSize);
+extern char *get_string(Conv *c, long cSize);
+extern text_chunk *get_text(Conv *c, long cSize);
+extern long conv_ops_text_strlen(char *s);
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
new file mode 100644
index 00000000000..f7e9d5ea8d9
--- /dev/null
+++ b/engines/m4/adv_r/conv.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/conv.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/gui/gui_univ.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+void set_dlg_rect() {
+ int32 sizex = 0, sizey = 0;
+ int32 screen_x_center = 0, screen_y_center = 0;
+ int32 screen_x_size = 0, screen_y_size = 0;
+ int32 status;
+
+ ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
+ if (!game_buff_ptr)
+ error_show(FL, 'BUF!');
+
+ screen_x_center = VIDEO_W / 2;
+ screen_y_center = (game_buff_ptr->y2 - game_buff_ptr->y1) / 2;
+ screen_x_size = VIDEO_W;
+ screen_y_size = (game_buff_ptr->y2 - game_buff_ptr->y1);
+
+ _GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v);
+ _GC(width) += 2 * _GC(conv_font_spacing_h);
+
+ sizex = _GC(width);
+ sizey = _G(cdd).num_txt_ents * (_GC(height))+_GC(conv_font_spacing_v);
+
+ switch (_GC(glob_x)) {
+ case DLG_CENTER_H:
+ _GC(r_x1) = screen_x_center - (sizex / 2);
+ break;
+
+ case DLG_FLUSH_LEFT:
+ _GC(r_x1) = 0;
+ break;
+
+ case DLG_FLUSH_RIGHT:
+ _GC(r_x1) = screen_x_size - sizex;
+ break;
+
+ default:
+ _GC(r_x1) = _GC(glob_x);
+ _GC(r_x1) += game_buff_ptr->x1;
+ break;
+ }
+
+ switch (_GC(glob_y)) {
+ case DLG_CENTER_V:
+ _GC(r_y1) = screen_y_center - (sizey / 2);
+ break;
+
+ case DLG_FLUSH_TOP:
+ _GC(r_y1) = 0;
+ break;
+
+ case DLG_FLUSH_BOTTOM:
+ _GC(r_y1) = screen_y_size - sizey + game_buff_ptr->y1 - 10;
+ break;
+
+ default:
+ _GC(r_y1) = _GC(glob_y);
+ _GC(r_y1) += game_buff_ptr->y1;
+ break;
+ }
+
+ if (_GC(r_x1) < 0)
+ _GC(r_x1) = 0;
+
+ if (_GC(r_y1) < 0)
+ _GC(r_y1) = 0;
+
+ //fprintf( conv_fp, "_GC(r_x1) %d sizex %d\n", _GC(r_x1), sizex );
+ _GC(r_y2) = _GC(r_y1) + sizey - 1;
+ _GC(r_x2) = _GC(r_x1) + sizex - 1;
+
+ _GC(r_x2) = imath_min(VIDEO_W, _GC(r_x2));
+ _GC(r_y2) = imath_min(VIDEO_H, _GC(r_y2));
+}
+
+void conv_go(Conv *c) {
+ error("TODO: conv_go");
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index 6a09d8dc4fa..3e6988ca5b5 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -27,6 +27,8 @@
namespace M4 {
+#define _GC(X) _G(conversations).##X
+
#define CONV_WAIT_FOR_INPUT 1
#define CONV_HALT_FOREVER 2
#define CONV_HALT 3
@@ -223,84 +225,8 @@ struct c_assign_chunk {
long opnd1; // Integer value.
};
-extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
-
-extern void conv_unload(Conv *c);
-extern void conv_shutdown();
-
-extern Conv *conv_get_handle();
-extern void conv_set_handle(Conv *c);
-
-extern void conv_resume(Conv *c);
-
-extern void set_conv_name(char *s);
-extern char *get_conv_name();
-extern char *conv_sound_to_play();
-extern int32 conv_whos_talking();
-
-extern void conv_snap_on_hotspots();
-extern void conv_snap_off_hotspots();
-extern void conv_init_hotspots();
-
-extern long conv_current_node();
-extern long conv_current_entry();
-
-//from: chunkops.cpp
-extern long get_dechunk_type(char *s, long cSize);
-
-extern conv_chunk *get_conv(Conv *c, long cSize);
-extern decl_chunk *get_decl(Conv *c, long cSize);
-extern node_chunk *get_node(Conv *c, long cSize);
-extern fall_chunk *get_fall(Conv *c, long cSize);
-extern lnode_chunk *get_lnode(Conv *c, long cSize);
-extern entry_chunk *get_entry(Conv *c, long cSize);
-extern entry_chunk *get_hash_entry(Conv *c, long cSize);
-
-extern text_chunk *get_text(Conv *c, long cSize);
-extern mesg_chunk *get_mesg(Conv *c, long cSize);
-extern reply_chunk *get_reply(Conv *c, long cSize);
-extern c_reply_chunk *get_c_reply(Conv *c, long cSize);
-extern goto_chunk *get_goto(Conv *c, long cSize);
-extern c_goto_chunk *get_c_goto(Conv *c, long cSize);
-extern c_assign_chunk *get_c_asgn(Conv *c, long cSize);
-extern w_reply_chunk *get_w_reply(Conv *c, long cSize);
-extern w_entry_chunk *get_w_entry(Conv *c, long cSize);
-extern misc_chunk *get_misc(Conv *c, long cSize);
-extern c_misc_chunk *get_c_misc(Conv *c, long cSize);
-extern assign_chunk *get_asgn(Conv *c, long cSize);
-extern long get_long(Conv *c, long cSize);
-extern char *get_string(Conv *c, long cSize);
-
-extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
-
-extern int conv_ops_cond_successful(long l_op, long op, long r_op);
-extern long conv_ops_process_asgn(long val, long oprtr, long opnd);
-extern void conv_ops_unknown_chunk(long tag, char *s);
-extern long conv_ops_text_strlen(char *s);
-
-extern long conv_get_decl_val(decl_chunk *decl);
-extern void conv_set_decl_val(decl_chunk *decl, long val);
-extern void conv_export_value(Conv *c, long val, int index);
-extern void conv_export_pointer(Conv *c, long *val, int index);
-
-extern void conv_set_font_spacing(int32 h, int32 v);
-extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
-
-extern void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
- int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2);
-
-extern void conv_set_shading(int32 shade);
-extern void conv_set_box_xy(int32 x, int32 y);
-extern void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2);
-extern void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2);
-extern void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour);
-extern void conv_set_default_hv(int32 h, int32 v);
-
-extern int conv_get_event();
-extern void conv_set_event(int e);
-extern int conv_is_event_ready();
-
-extern void conv_swap_words(Conv *c);
+extern void set_dlg_rect();
+extern void conv_go(Conv *c);
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 75c964669aa..033ac8e6c77 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -20,11 +20,35 @@
*/
#include "m4/adv_r/conv_io.h"
+#include "m4/adv_r/conv.h"
+#include "m4/adv_r/chunk_ops.h"
+#include "m4/adv_r/db_env.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/vars.h"
namespace M4 {
+#define HIDDEN 0x00000004
+#define DESTROYED 0x00000008
+
+#define INITIAL 1
+#define PERSISTENT 2
+
+#define CONV_OK 0
+#define CONV_QUIT -1
+#define CONV_NEW -2
+#define CONV_BAIL -3
+
+#define CONV_UNKNOWN_MODE 0
+#define CONV_GET_TEXT_MODE 1
+#define CONV_SET_TEXT_MODE 2
+#define CONV_GET_MESG_MODE 3
+#define CONV_UPDATE_MODE 4
+
+#define DECL_POINTER 1
+
void Converstation_Globals::syncGame(Common::Serializer &s) {
-// FILE *fp = NULL;
uint32 val;
conv_reset_all();
@@ -45,14 +69,1037 @@ void Converstation_Globals::conv_reset_all() {
/*------------------------------------------------------------------------*/
-void conv_unload(Conv *c) {
- error("TODO: conv_unload");
+void cdd_init(void) {
+ int i;
+
+ for (i = 0; i < 16; i++) {
+ _G(cdd).text[i] = nullptr;
+ _G(cdd).snd_files[i] = nullptr;
+ }
+
+ _G(cdd).num_txt_ents = 0;
+ Common::strcpy_s(_G(cdd).mesg, "");
+ _G(cdd).mesg_snd_file = nullptr;
+}
+
+void set_conv_name(char *s) {
+ Common::strcpy_s(_GC(conv_name), s);
+}
+
+char *get_conv_name(void) {
+ return _GC(conv_name);
+}
+
+Conv *conv_get_handle(void) {
+ return _GC(globConv);
+}
+
+void conv_set_handle(Conv *c) {
+ _GC(globConv) = c;
+}
+
+void conv_resume(Conv *c) {
+ conv_go(c);
+}
+
+int conv_is_event_ready(void) {
+ return _GC(event_ready);
+}
+
+void conv_set_event(int e) {
+ _GC(event) = e;
+ _GC(event_ready) = 1;
+}
+
+int conv_get_event(void) {
+ _GC(event_ready) = 0;
+ return _GC(event);
+}
+
+void conv_play(Conv *c) {
+ conv_go(c);
+}
+
+long conv_current_node(void) {
+ if (conv_get_handle())
+ return conv_get_handle()->node_hash;
+ return 0;
+}
+
+void conv_reset(char *filename) {
+ Conv *c = nullptr;
+ _GC(restore_conv) = 0;
+
+ c = conv_load(filename, 1, 1, -1, false);
+ conv_unload(c);
+}
+
+
+void conv_reset_all(void) {
+ _G(conversations).conv_reset_all();
+}
+
+char *conv_sound_to_play(void) {
+ return _G(cdd).mesg_snd_file;
+}
+
+int32 conv_whos_talking(void) {
+ return _G(cdd).player_non_player;
+}
+
+int ok_status(entry_chunk *entry) {
+ if (entry->status & DESTROYED)
+ return 0;
+
+ if (entry->status & HIDDEN)
+ return 0;
+
+ return 1;
+}
+
+int conv_toggle_flags(entry_chunk *entry) {
+ if (ok_status(entry))
+ return (entry->status & 0x0000000e); //mask off INITIAL bit.
+ return entry->status;
+}
+
+long conv_get_decl_val(decl_chunk *decl) {
+ switch (decl->flags) {
+ case DECL_POINTER:
+ return *decl->addr;
+
+ default:
+ return decl->val;
+ }
+}
+
+void conv_set_decl_val(decl_chunk *decl, long val) {
+ switch (decl->flags) {
+ case DECL_POINTER:
+ decl->val = val;
+ *decl->addr = val;
+ break;
+
+ default:
+ decl->val = val;
+ break;
+ }
+}
+
+void conv_export_value(Conv *c, long val, int index) {
+ long ent = 0, tag = 0, next;
+ decl_chunk *decl;
+ long ent_old = 0;
+ int i = 0;
+
+ if (!c)
+ return;
+
+ ent_old = c->myCNode;
+ ent = 0;
+ c->myCNode = 0;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case DECL_CHUNK:
+ if (i == index) {
+ decl = get_decl(c, ent);
+ conv_set_decl_val(decl, val);
+ }
+ i++;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+ c->myCNode = ent_old;
+}
+
+void conv_export_pointer(Conv *c, long *val, int index) {
+ long ent = 0, tag = 0, next;
+ decl_chunk *decl;
+ long ent_old = 0;
+ int i = 0;
+
+ if (!c)
+ return;
+
+ ent_old = c->myCNode;
+ ent = 0;
+ c->myCNode = 0;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case DECL_CHUNK:
+ if (i == index) {
+ decl = get_decl(c, ent);
+ decl->addr = val;
+ decl->flags = DECL_POINTER;
+ }
+ i++;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+ c->myCNode = ent_old;
+}
+
+void conv_init(Conv *c) {
+ switch (c->exit_now) {
+ case CONV_OK:
+ break;
+
+ case CONV_QUIT:
+ break;
+
+ case CONV_BAIL:
+ case CONV_NEW:
+ if (c->myCNode != CONV_QUIT) {
+ c->exit_now = CONV_NEW; //conv hasn't been run before. only done here once.
+ c->myCNode = 0;
+ }
+ break;
+ }
+}
+
+#ifdef TODO
+static long find_state(char *s, char *c, int file_size) {
+ char name[9];
+ long size, offset = 0;
+
+ ////fprintf( conv_fp, "find_state %s\n", s );
+ while (offset < file_size) {
+ cstrncpy(name, &c[offset], 8);
+ ////fprintf( conv_fp, "name '%s' offset %d\n", name, offset );
+ name[8] = '\0';
+
+ if (!scumm_strnicmp(name, s, 8)) {
+ offset += 8 * sizeof(char);
+ ////fprintf( conv_fp, "state found\n" );
+ goto handled;
+ }
+
+ offset += 8 * sizeof(char);
+ if (offset < file_size) {
+ memcpy(&size, &c[offset], sizeof(long));
+ ////fprintf( conv_fp, "size %x\n", size );
+ }
+
+ offset += size + sizeof(long);
+ }
+
+ offset = -1;
+
+ ////fprintf( conv_fp, "state not found\n" );
+handled:
+ return offset;
+}
+#endif
+
+void find_and_set_conv_name(Conv *c) {
+ long ent = 0, tag = 0, next = 0;
+ conv_chunk *conv;
+
+ c->myCNode = 0;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case CONV_CHUNK:
+ conv = get_conv(c, ent);
+ set_conv_name(get_string(c, c->myCNode + ent + sizeof(conv_chunk)));
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+}
+
+/*
+void save_state( Conv *c )
+{
+ long ent=0;
+ long tag, next;
+ long offset=-1, size=0, amt_to_write=0;
+
+ entry_chunk *entry;
+ decl_chunk *decl;
+ conv_chunk *conv;
+ short num_decls=0, num_entries=0;
+ short flag_num=0, flag_index=0;
+ long e_flags=0, myCNode, val;
+
+ FILE *fp=nullptr;
+ char fname[9];
+ char *conv_save_buff=nullptr;
+ long file_size;
+ bool overwrite_file=false;
+ long prev_size=0;
+
+ myCNode = c->myCNode; c->myCNode=0; ent=0;
+
+ while( ent < c->chunkSize ) {
+ conv_ops_get_entry( ent, &next, &tag, c );
+
+ switch( tag ) {
+ case CONV_CHUNK:
+ conv = get_conv( c, ent );
+ cstrncpy( fname, get_string( c, c->myCNode+ent+sizeof( conv_chunk ) ), 8 );
+ fname[8] = '\0';
+ break;
+
+ case DECL_CHUNK:
+ num_decls++;
+ amt_to_write += sizeof( long );
+ break;
+
+ case ENTRY_CHUNK:
+ num_entries++;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ sprintf( _GC(conv_file_name), "%sconvsave.dat", argv );
+ //file_size = f_info_get_file_size( _GC(conv_file_name) ); //oct11
+
+ //oct11
+ if( !f_info_exists(_GC(conv_file_name)) )
+ file_size = 0; //was -1
+ else
+ file_size = f_info_get_file_size( _GC(conv_file_name) );
+
+ amt_to_write += 3*sizeof( long );
+ amt_to_write += (num_entries / 8) * sizeof( long );
+ if( (num_entries%8) != 0 )
+ amt_to_write += sizeof( long );
+
+ fp = f_io_open( _GC(conv_file_name), "rb" ); //was r+b
+
+ if( fp ) {
+ conv_save_buff = (char *)mem_alloc( file_size, "conv save buff" );
+ fread( conv_save_buff, file_size, 1, fp );
+
+ f_io_close( fp );
+ offset = find_state( fname, conv_save_buff, file_size );
+
+ if( offset != -1 ) {
+ overwrite_file=true;
+ memcpy( &prev_size, &conv_save_buff[offset], sizeof( long ) );
+ prev_size += 3*sizeof(long);
+ offset += sizeof( long ); //skip header. (name + size)
+ } else {
+ //append!!!
+ offset=0;
+ if( conv_save_buff )
+ mem_free( conv_save_buff );
+
+ conv_save_buff = (char *)mem_alloc( amt_to_write+3*sizeof(long), "conv save buff" );
+ memcpy( &conv_save_buff[offset], fname, 8*sizeof(char) );
+ offset += 8*sizeof( char );
+ memcpy( &conv_save_buff[offset], &amt_to_write, sizeof( long ));
+ offset += sizeof( long );
+ }
+ } else {
+ offset=0;
+ conv_save_buff = (char *)mem_alloc( amt_to_write+3*sizeof(long), "conv save buff" );
+ memcpy( &conv_save_buff[offset], fname, 8*sizeof(char) );
+ offset += 8*sizeof( char );
+ memcpy( &conv_save_buff[offset], &amt_to_write, sizeof( long ));
+ offset += sizeof( long );
+ }
+
+ memcpy( &conv_save_buff[offset], &myCNode, sizeof( long ) );
+ offset += sizeof( long );
+
+ memcpy( &conv_save_buff[offset], &num_decls, sizeof( long ) );
+ offset += sizeof( long );
+
+ memcpy( &conv_save_buff[offset], &num_entries, sizeof( long ) );
+ offset += sizeof( long );
+ size += 3*sizeof( long );
+
+ ent=0; c->myCNode = 0;
+ while( ent < c->chunkSize ) {
+ conv_ops_get_entry( ent, &next, &tag, c );
+
+ switch( tag ) {
+ case DECL_CHUNK:
+ decl = get_decl( c, ent );
+ val = conv_get_decl_val( decl );
+
+ memcpy( &conv_save_buff[offset], &val, sizeof( long ) );
+ offset+=sizeof( long );
+
+ size+=sizeof( long );
+ break;
+
+ case LNODE_CHUNK:
+ case NODE_CHUNK:
+ break;
+
+ case ENTRY_CHUNK:
+ entry = get_entry( c, ent );
+
+ if( flag_index == 32 ) {
+ flag_index = 0;
+ flag_num++;
+
+ memcpy( &conv_save_buff[offset], &e_flags, sizeof( long ) );
+ offset += sizeof( long );
+ size += sizeof( long );
+
+ e_flags = 0;
+ }
+
+ //fprintf( conv_fp, "entry->status %d\n", entry->status );
+ e_flags |= ( (entry->status & 0x0000000f) << flag_index );
+
+ flag_index += 4;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ if( flag_index != 0 ) {
+ memcpy( &conv_save_buff[offset], &e_flags, sizeof(long) );
+ offset += sizeof( long );
+ size += sizeof( long );
+ }
+
+ if( (amt_to_write != size) )
+ error_show( FL, 'CNVS', "save_state: error! size written != size (%d %d)", amt_to_write, size );
+
+ if( overwrite_file == true ) {
+ ////fprintf( conv_fp, "overwrite conversation\n" );
+ fp = f_io_open( _GC(conv_file_name), "wb" );
+ fwrite( conv_save_buff, file_size, 1, fp );
+
+ //if( prev_size != file_size )
+ // error_show( FL, 'CNVS', "save_state() Prev save size != Curr save size (%d, %d)", prev_size, file_size );
+
+ } else {
+ ////fprintf( conv_fp, "append conversation\n" );
+ fp = f_io_open( _GC(conv_file_name), "ab+" );
+ fwrite( conv_save_buff, amt_to_write+3*sizeof(long), 1, fp );
+ }
+
+ if( conv_save_buff )
+ mem_free( conv_save_buff );
+
+ f_io_close( fp );
+}
+*/
+
+//-------------------------------------------------------------------------------
+// nick documented and error checking added 960501
+// variables moved into their scopes because I'm a picky S.O.B.
+
+void save_state(Conv *c) {
+#ifndef TODO
+ error("TODO: save_state");
+#else
+ //-------------------------------------------------------------------------------
+ // calculate amt_to_write by counting up the size of DECL_CHUNKs.
+ // the number of ENTRY_CHUNKs affects the amt_to_write
+ // also extract fname from the CONV_CHUNK
+
+ long amt_to_write = 3 * sizeof(long); // mystery padding
+ long ent = 0;
+ long next, tag; // receive conv_ops_get_entry results
+ long myCNode = c->myCNode;
+ char fname[9];
+
+ short num_decls = 0;
+ short num_entries = 0;
+
+ c->myCNode = 0;
+
+ while (ent < c->chunkSize)
+ {
+ conv_chunk *conv; // declared here for the benefit of Watcom 10.0's initializers.
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case CONV_CHUNK:
+ conv = get_conv(c, ent);
+ cstrncpy(fname, get_string(c, c->myCNode + ent + sizeof(conv_chunk)), 8);
+ fname[8] = '\0';
+ break;
+
+ case DECL_CHUNK:
+ num_decls++;
+ amt_to_write += sizeof(long);
+ break;
+
+ case ENTRY_CHUNK:
+ num_entries++;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ amt_to_write += (num_entries / 8) * sizeof(long);
+ if ((num_entries % 8) != 0)
+ amt_to_write += sizeof(long); // pad the sucker
+
+ //-------------------------------------------------------------------------------
+ // get the name of consave.dat
+
+ Common::strcpy_s(_GC(conv_file_name), "convsave.dat");
+
+ //-------------------------------------------------------------------------------
+ // if consave.dat exists, read it in
+
+ long file_size = 0;
+ long offset = -1;
+ long prev_size = 0;
+ char *conv_save_buff = nullptr;
+ bool overwrite_file = false;
+
+ if (f_info_exists(_GC(conv_file_name))) {
+ file_size = f_info_get_file_size(_GC(conv_file_name));
+ FILE *fp = f_io_open(_GC(conv_file_name), "rb"); //was r+b
+
+ conv_save_buff = (char *)mem_alloc(file_size, "conv save buff");
+ if (!conv_save_buff)
+ error_show(FL, 'OOM!');
+
+ fread(conv_save_buff, file_size, 1, fp);
+
+ f_io_close(fp);
+
+ //----------------------------------------------------------------------------
+ // if this conversation already in save file, overwrite it,
+ // otherwise chuck out the buffer, and create a new buffer which is just
+ // big enough to hold the new save data.
+
+ offset = find_state(fname, conv_save_buff, file_size);
+
+ if (offset != -1) {
+ overwrite_file = true;
+ memcpy(&prev_size, &conv_save_buff[offset], sizeof(long));
+ prev_size += 3 * sizeof(long);
+ offset += sizeof(long); //skip header. (name + size)
+ } else {
+ //append!!!
+ offset = 0;
+
+ if (conv_save_buff)
+ mem_free(conv_save_buff);
+
+ conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(long), "conv save buff");
+ if (!conv_save_buff)
+ error_show(FL, 'OOM!');
+
+ memcpy(&conv_save_buff[offset], fname, 8 * sizeof(char));
+ offset += 8 * sizeof(char);
+ memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(long));
+ offset += sizeof(long);
+ }
+ } else
+ {
+ //----------------------------------------------------------------------------
+ // convsav.dat didn't exist, so we set things up for a create here.
+
+ offset = 0;
+
+ conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(long), "conv save buff");
+ if (!conv_save_buff)
+ error_show(FL, 'OOM!');
+
+ memcpy(&conv_save_buff[offset], fname, 8 * sizeof(char));
+ offset += 8 * sizeof(char);
+ memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(long));
+ offset += sizeof(long);
+ }
+
+ //----------------------------------------------------------------------------
+ // finish filling in conv_save_buff data with num of entries etc.
+
+ memcpy(&conv_save_buff[offset], &myCNode, sizeof(long));
+ offset += sizeof(long);
+
+ memcpy(&conv_save_buff[offset], &num_decls, sizeof(long));
+ offset += sizeof(long);
+
+ memcpy(&conv_save_buff[offset], &num_entries, sizeof(long));
+ offset += sizeof(long);
+
+ long size = 3 * sizeof(long);
+
+ // fill in all the entries themselves
+
+ long e_flags = 0;
+ short flag_index = 0;
+ // short flag_num = 0;
+
+ ent = 0;
+ c->myCNode = 0;
+
+ long val = 0;
+ entry_chunk *entry = nullptr;
+
+ while (ent < c->chunkSize)
+ {
+ conv_ops_get_entry(ent, &next, &tag, c);
+ decl_chunk *decl; // declared here for the benefit of Watcom 10.0 not liking to scope things into switches
+
+ switch (tag) {
+ case DECL_CHUNK:
+ decl = get_decl(c, ent);
+ val = conv_get_decl_val(decl);
+
+ memcpy(&conv_save_buff[offset], &val, sizeof(long));
+ offset += sizeof(long);
+
+ size += sizeof(long);
+ break;
+
+ case LNODE_CHUNK:
+ case NODE_CHUNK:
+ break;
+
+ case ENTRY_CHUNK:
+ entry = get_entry(c, ent);
+
+ if (flag_index == 32) {
+ flag_index = 0;
+ //flag_num++;
+
+ memcpy(&conv_save_buff[offset], &e_flags, sizeof(long));
+ offset += sizeof(long);
+ size += sizeof(long);
+
+ e_flags = 0;
+ }
+
+ //fprintf( conv_fp, "entry->status %d\n", entry->status );
+ e_flags |= ((entry->status & 0x0000000f) << flag_index);
+
+ flag_index += 4;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ // copy the flags
+
+ if (flag_index != 0) {
+ memcpy(&conv_save_buff[offset], &e_flags, sizeof(long));
+ offset += sizeof(long);
+ size += sizeof(long);
+ }
+
+ if ((amt_to_write != size))
+ error_show(FL, 'CNVS', "save_state: error! size written != size (%d %d)", amt_to_write, size);
+
+ // finally, write out the conversation data. Scoped to contain fp.
+ {
+ FILE *fp = nullptr;
+ if (overwrite_file == true)
+ {
+ ////fprintf( conv_fp, "overwrite conversation\n" );
+ fp = f_io_open(_GC(conv_file_name), "wb");
+ if (!fp)
+ error_show(FL, 'FNF!', "consave.dat");
+
+ fwrite(conv_save_buff, file_size, 1, fp);
+ } else
+ {
+ ////fprintf( conv_fp, "append conversation\n" );
+ fp = f_io_open(_GC(conv_file_name), "ab+");
+ if (!fp)
+ error_show(FL, 'FNF!', "consave.dat");
+
+ fwrite(conv_save_buff, amt_to_write + 3 * sizeof(long), 1, fp);
+ }
+
+ if (conv_save_buff)
+ mem_free(conv_save_buff);
+
+ f_io_close(fp);
+ }
+#endif
}
-Conv *conv_get_handle() {
- error("TODO: conv_get_handle");
- return nullptr;
+Conv *restore_state(Conv *c) {
+#ifndef TODO
+ error("TODO: restore_state");
+#else
+ long ent = 0;
+ long tag, next, offset;
+
+ entry_chunk *entry;
+ decl_chunk *decl;
+
+ long num_decls = 0, num_entries = 0;
+ short flag_num = 0, flag_index = 0;
+ long val;
+ long e_flags = 0;
+ long myCNode;
+
+ FILE *fp = nullptr;
+ char fname[9];
+ int dont_update_ents = 0;
+ int file_size = 0;
+ char *conv_save_buff = nullptr;
+
+ ent = 0; c->myCNode = 0;
+
+ find_and_set_conv_name(c);
+ cstrncpy(fname, get_conv_name(), 8);
+ fname[8] = '\0';
+
+ sprintf(_GC(conv_file_name), "%sconvsave.dat", argv);
+ //oct11
+ //file_size = f_info_get_file_size( _GC(conv_file_name) );
+ if (!f_info_exists(_GC(conv_file_name)))
+ file_size = -1;
+ else
+ file_size = f_info_get_file_size(_GC(conv_file_name));
+
+ fp = f_io_open(_GC(conv_file_name), "rb");
+ if (!fp)
+ {
+ conv_init(c);
+ return c;
+ }
+
+ conv_save_buff = (char *)mem_alloc(file_size, "conv save buff");
+ if (!conv_save_buff)
+ error_show(FL, 'OOM!');
+
+ // ------------------
+
+ fread(conv_save_buff, file_size, 1, fp);
+ f_io_close(fp);
+ offset = find_state(fname, conv_save_buff, file_size);
+
+ // nick 960501 changed from a return c to a goto in order to corret an insidious memory leak!
+ if (offset == -1)
+ goto i_am_so_done;
+
+ //skip header.
+ offset += sizeof(long);
+
+ memcpy(&myCNode, &conv_save_buff[offset], sizeof(long));
+ offset += sizeof(long);
+
+ memcpy(&num_decls, &conv_save_buff[offset], sizeof(long));
+ offset += sizeof(long);
+
+ memcpy(&num_entries, &conv_save_buff[offset], sizeof(long));
+ offset += sizeof(long);
+
+ ent = 0; c->myCNode = 0;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case DECL_CHUNK:
+ memcpy(&val, &conv_save_buff[offset], sizeof(long));
+ offset += sizeof(long);
+ decl = get_decl(c, ent);
+
+ conv_set_decl_val(decl, val);
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ ent = 0; c->myCNode = 0;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case LNODE_CHUNK:
+ if (myCNode == ent) {
+ dont_update_ents = 1;
+ } else {
+ dont_update_ents = 0;
+ }
+ break;
+
+ case NODE_CHUNK:
+ dont_update_ents = 0;
+ break;
+
+ case ENTRY_CHUNK:
+ entry = get_entry(c, ent);
+
+ if (flag_index == 32) {
+ flag_index = 0;
+ flag_num++;
+ }
+
+ if (flag_index == 0) {
+ memcpy(&e_flags, &conv_save_buff[offset], sizeof(long));
+ offset += sizeof(long);
+ }
+
+ val = (e_flags >> flag_index) & 0x0000000f;
+ entry->status = val;
+ //fprintf( conv_fp, "entry->status %d\n", entry->status );
+
+ flag_index += 4;
+ break;
+
+ default:
+ break;
+ }
+ ent = next;
+ }
+
+ c->myCNode = myCNode;
+ if (c->myCNode == CONV_QUIT) {
+ c->exit_now = CONV_QUIT;
+ ////fprintf( conv_fp, "c->myCNode == CONV_QUIT conv_unload()\n" );
+ conv_unload(c);
+ c = nullptr;
+ } else c->exit_now = CONV_OK;
+
+i_am_so_done:
+ if (conv_save_buff)
+ mem_free(conv_save_buff);
+ return c;
+#endif
+}
+
+void conv_set_font_spacing(int32 h, int32 v) {
+ _GC(conv_font_spacing_h) = h;
+ _GC(conv_font_spacing_v) = v;
+}
+
+
+void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
+ int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2) {
+ _GC(conv_normal_colour) = norm_colour;
+ _GC(conv_normal_colour_alt1) = norm_colour_alt1;
+ _GC(conv_normal_colour_alt2) = norm_colour_alt2;
+ _GC(conv_hilite_colour) = hi_colour;
+ _GC(conv_hilite_colour_alt1) = hi_colour_alt1;
+ _GC(conv_hilite_colour_alt2) = hi_colour_alt2;
+}
+
+void conv_set_text_colour(int32 norm_colour, int32 hi_colour) {
+ conv_set_text_colours(norm_colour, norm_colour, norm_colour, hi_colour, hi_colour, hi_colour);
+}
+
+void conv_set_default_hv(int32 h, int32 v) {
+ _GC(conv_default_h) = h;
+ _GC(conv_default_v) = v;
+}
+
+void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour) {
+ conv_set_text_colours(norm_colour, norm_colour, norm_colour, hi_colour, hi_colour, hi_colour);
+}
+
+void conv_set_shading(int32 shade) {
+ _GC(conv_shading) = shade;
+}
+
+void conv_set_box_xy(int32 x, int32 y) {
+ _GC(glob_x) = x;
+ _GC(glob_y) = y;
+}
+
+static void conv_set_disp_default(void) {
+ _GC(conv_font_spacing_h) = _GC(conv_default_h);
+ _GC(conv_font_spacing_v) = _GC(conv_default_v);
+ _GC(conv_normal_colour) = _GC(conv_default_normal_colour);
+ _GC(conv_hilite_colour) = _GC(conv_default_hilite_colour);
+ _GC(conv_shading) = 75;
}
+Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box) {
+ Conv *convers = nullptr;
+ long cSize = 0;
+ char fullpathname[MAX_FILENAME_SIZE];
+ void *bufferHandle;
+
+ term_message("conv_load");
+
+ _GC(playerCommAllowed) = _G(player).comm_allowed; // Remember if player commands are on before we start the conversation MattP apr11
+ _GC(interface_was_visible) = INTERFACE_VISIBLE;
+
+ term_message("conv load: %s", filename);
+
+ if (want_box) {
+ // If we want an interface box
+ conv_set_disp_default();
+ mouse_set_sprite(0); // Also if we want a text box, lock the mouse into arrow mode MattP apr11
+ mouse_lock_sprite(0);
+ player_set_commands_allowed(false); // with commands off
+
+ // Hide the interface if it's visible
+ if (INTERFACE_VISIBLE)
+ interface_hide();
+ }
+
+ // if not in rooms.db, use actual filename
+ char *str = env_find(filename);
+ if (str)
+ Common::strcpy_s(fullpathname, str);
+ else
+ Common::sprintf_s(fullpathname, "%s.chk", filename);
+
+ SysFile fp(fullpathname, BINARY);
+ if (!fp.exists()) {
+ // Force the file open
+ error_show(FL, 'CNVL', "couldn't conv_load %s", fullpathname);
+ conv_set_handle(nullptr);
+ convers = nullptr;
+ goto done;
+ }
+
+ cSize = fp.size();
+
+ if (conv_get_handle() != nullptr) {
+ ////fprintf( conv_fp, "conv_get_handle != nullptr conv_unload()\n" );
+ conv_unload(conv_get_handle());
+ }
+
+ convers = (Conv *)mem_alloc(sizeof(Conv), "Conv struct");
+
+ if (!convers) {
+ conv_set_handle(nullptr);
+ convers = nullptr;
+ goto done;
+ }
+
+ convers->chunkSize = cSize;
+ convers->conv = nullptr;
+ convers->myCNode = 0;
+ convers->exit_now = CONV_NEW;
+ convers->node_hash = 0;
+ convers->mode = CONV_GET_TEXT_MODE;
+ convers->c_entry_num = 1;
+ _GC(myFinalTrigger) = kernel_trigger_create(myTrigger);
+
+ convers->conv = (char *)mem_alloc(cSize * sizeof(char), "conv char data");
+
+ bufferHandle = convers->conv;
+ if (!fp.read((MemHandle)&bufferHandle, cSize)) {
+ conv_set_handle(nullptr);
+ if (convers)
+ mem_free(convers);
+
+ convers = nullptr;
+ goto done;
+ }
+
+ conv_swap_words(convers); //oct10
+ find_and_set_conv_name(convers);
+
+ _GC(glob_x) = x1;
+ _GC(glob_y) = y1;
+
+ if (want_box)
+ set_dlg_rect();
+
+ if (_GC(restore_conv))
+ convers = restore_state(convers);
+ _GC(restore_conv) = 1;
+
+ conv_set_handle(convers);
+
+done:
+ fp.close();
+
+ return convers;
+}
+
+void conv_unload(Conv *c) {
+ mouse_unlock_sprite();
+
+ if (_GC(interface_was_visible)) { // turn interface back on if it was on MattP
+ interface_show();
+ }
+
+ _GC(globConv) = nullptr;
+
+ if (c)
+ save_state(c);
+
+ player_set_commands_allowed(_GC(playerCommAllowed));
+
+ _G(player).command_ready = false;
+ _G(player).ready_to_walk = false;
+ _G(player).need_to_walk = false;
+
+ Common::strcpy_s(_G(player).verb, "");
+ Common::strcpy_s(_G(player).noun, "");
+ kernel_trigger_dispatch(_GC(myFinalTrigger));
+
+ if (c) {
+ if (c->conv)
+ mem_free(c->conv);
+ mem_free(c);
+ }
+
+ _GC(globConv) = c = nullptr;
+}
+
+// only called if node is visible.
+// gets the TEXT chunks inside a node.
+int conv_get_text(long offset, long size, Conv *c) {
+ long i = offset, tag, next, text_len, text_width;
+ text_chunk *text;
+ int result = 0;
+
+ size -= sizeof(entry_chunk);
+
+ while (i < offset + size) {
+ conv_ops_get_entry(i, &next, &tag, c);
+
+ switch (tag) {
+ case TEXT_CHUNK:
+ result = 1;
+ text = get_text(c, i);
+ text_len = conv_ops_text_strlen(get_string(c, c->myCNode + i + sizeof(text_chunk)));
+ _G(cdd).snd_files[_G(cdd).num_txt_ents] = get_string(c, c->myCNode + i + sizeof(text_chunk));
+ _G(cdd).text[_G(cdd).num_txt_ents] = get_string(c, c->myCNode + i + sizeof(text_chunk) + text_len);
+
+ text_width = gr_font_string_width(_G(cdd).text[_G(cdd).num_txt_ents], 1);
+ if (text_width > _GC(width))
+ _GC(width) = text_width;
+
+ _G(cdd).num_txt_ents++;
+ break;
+ }
+ i = next;
+ }
+ return result;
+}
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 4541f488d70..f40500633a9 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -40,25 +40,27 @@ struct Converstation_Globals {
Conv *globConv = nullptr;
bool playerCommAllowed = false;
long myFinalTrigger = 0;
- bool interface_was_visible = false; // to remember to turn it back on or
+ bool interface_was_visible = false; // to remember to turn it back on
int restore_conv = 1;
- int32 glob_x = 0, glob_y = 0;
- const int32 conv_font_spacing_h = 0;
- const int32 conv_font_spacing_v = 5;
- const int32 conv_default_h = conv_font_spacing_h;
- const int32 conv_default_v = conv_font_spacing_v;
- const int32 conv_shading = 65;
+ int32 conv_font_spacing_h = 0;
+ int32 conv_font_spacing_v = 5;
+ int32 conv_default_h = conv_font_spacing_h;
+ int32 conv_default_v = conv_font_spacing_v;
+ int32 conv_shading = 65;
- const int32 conv_normal_colour = __BLACK;
- const int32 conv_normal_colour_alt1 = __GREEN;
- const int32 conv_normal_colour_alt2 = __GREEN;
- const int32 conv_hilite_colour = __YELLOW;
- const int32 conv_default_hilite_colour = __YELLOW;
- const int32 conv_hilite_colour_alt1 = __YELLOW;
- const int32 conv_hilite_colour_alt2 = __YELLOW;
- const int32 conv_default_normal_colour = __BLACK;
+ int32 conv_normal_colour = __BLACK;
+ int32 conv_normal_colour_alt1 = __GREEN;
+ int32 conv_normal_colour_alt2 = __GREEN;
+ int32 conv_hilite_colour = __YELLOW;
+ int32 conv_default_hilite_colour = __YELLOW;
+ int32 conv_hilite_colour_alt1 = __YELLOW;
+ int32 conv_hilite_colour_alt2 = __YELLOW;
+ int32 conv_default_normal_colour = __BLACK;
+ int32 width = 0, height = 0;
+ int32 glob_x = 0, glob_y = 0;
+ int32 r_x1 = 0, r_y1 = 0, r_x2 = 0, r_y2 = 0;
void syncGame(Common::Serializer &s);
@@ -69,6 +71,50 @@ struct Converstation_Globals {
void conv_go(Conv *c);
};
+extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
+
+extern void conv_unload(Conv *c);
+extern void conv_shutdown();
+
+extern Conv *conv_get_handle();
+extern void conv_set_handle(Conv *c);
+
+extern void conv_resume(Conv *c);
+extern void conv_reset(char *filename);
+
+extern void conv_reset_all();
+extern void conv_play(Conv *c);
+
+extern void conv_resume(Conv *c);
+
+extern void set_conv_name(char *s);
+extern char *get_conv_name();
+extern char *conv_sound_to_play();
+extern int32 conv_whos_talking();
+
+extern long conv_get_decl_val(decl_chunk *decl);
+extern void conv_set_decl_val(decl_chunk *decl, long val);
+extern void conv_export_value(Conv *c, long val, int index);
+extern void conv_export_pointer(Conv *c, long *val, int index);
+
+extern void conv_set_font_spacing(int32 h, int32 v);
+extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
+
+extern void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
+ int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2);
+
+extern void conv_set_shading(int32 shade);
+extern void conv_set_box_xy(int32 x, int32 y);
+extern void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2);
+extern void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2);
+extern void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour);
+extern void conv_set_default_hv(int32 h, int32 v);
+
+extern int conv_get_event();
+extern void conv_set_event(int e);
+extern int conv_is_event_ready();
+
+extern void conv_swap_words(Conv *c);
} // End of namespace M4
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 8ab156b1453..05dfce07b5c 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -365,7 +365,7 @@ void Sections::pal_game_task() {
_G(midi).loop();
gui_system_event_handler();
-#ifdef TODO
+
if (conv_is_event_ready()) {
_G(player).command_ready = true;
term_message("conv parse row");
@@ -374,13 +374,15 @@ void Sections::pal_game_task() {
(void)conv_get_event();
}
-#endif
f_stream_Process(2);
if (_G(kernel).call_daemon_every_loop)
tick();
+ if (_G(editors_in_use) && (_G(editors_in_use) & 1))
+ scale_editor_draw();
+
if (_G(showMousePos))
update_mouse_pos_dialog();
}
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index b203ace8300..c48c02d8961 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -316,4 +316,15 @@ void mouse_show() {
vmng_screen_show(_G(mouseScreenSource));
}
+void mouse_lock_sprite(int32 mouseNum) {
+ _G(mouseIsLocked) = false;
+ mouse_set_sprite(mouseNum);
+ _G(mouseIsLocked) = true;
+}
+
+void mouse_unlock_sprite() {
+ _G(mouseIsLocked) = false;
+ mouse_set_sprite(_G(newMouseNum));
+}
+
} // End of namespace M4
diff --git a/engines/m4/gui/gui_mouse.h b/engines/m4/gui/gui_mouse.h
index 46d685f9dd6..34b28be5b61 100644
--- a/engines/m4/gui/gui_mouse.h
+++ b/engines/m4/gui/gui_mouse.h
@@ -72,6 +72,8 @@ extern bool mouse_set_sprite(int32 spriteNum);
extern void gui_mouse_refresh();
extern void mouse_hide();
extern void mouse_show();
+extern void mouse_lock_sprite(int32 mouseNum);
+extern void mouse_unlock_sprite();
} // End of namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index c3e712c0101..f0b57c71b27 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -19,6 +19,8 @@ MODULE_OBJS = \
adv_r/adv_scale.o \
adv_r/adv_trigger.o \
adv_r/adv_walk.o \
+ adv_r/chunk_ops.o \
+ adv_r/conv.o \
adv_r/conv_io.o \
adv_r/db_env.o \
adv_r/kernel.o \
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 4ec154ce028..4eb8ebc2612 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -111,6 +111,7 @@ public:
Sound::Midi _midi;
KernelPal_Globals _krnPal;
ADVScale_Globals _scale;
+ ConvDisplayData _cdd;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
@@ -186,6 +187,7 @@ public:
#define _GI() (*g_vars->getInterface())
#define _GW() (*g_vars->getWalker())
#define _GWS(X) _G(ws)._##X
+#define INTERFACE_VISIBLE g_vars->getInterface()->_visible
} // namespace M4
Commit: d997c09c8a0a48169b41b9baa88c5e85f55c99d2
https://github.com/scummvm/scummvm/commit/d997c09c8a0a48169b41b9baa88c5e85f55c99d2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of section/room daemon calls
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section.h
engines/m4/burger/rooms/section9/section9.cpp
engines/m4/burger/rooms/section9/section9.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index d5d675a04fb..2bd86cd57a6 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -121,7 +121,7 @@ static bool kernel_trigger_dispatchx(int32 trigger_num) {
break;
case KT_DAEMON:
- g_engine->daemon_code();
+ g_engine->game_daemon_code();
result = true;
break;
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index a35a19d52fe..75ead6a99a3 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -52,5 +52,9 @@ void BurgerEngine::showEngineInfo() {
debug("Orion Burger tastes great!\n");
}
+void BurgerEngine::global_daemon() {
+ error("TODO: global_daemon_code");
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index e0e0ad811a8..17745b70c30 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -54,6 +54,8 @@ public:
* Show the engine information
*/
void showEngineInfo() override;
+
+ void global_daemon() override;
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index f6fccf5618f..c38d2f1706a 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section.h"
#include "m4/gui/gui_vmng.h"
#include "m4/burger/vars.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
@@ -129,14 +130,10 @@ void Section::init_series_players() {
_G(seriesPlayers).clear();
}
-void Section::daemon_code() {
- warning("TODO: global_daemon_code");
-}
-
void Section::tick() {
int oldTrigger = _G(kernel).trigger;
_G(kernel).trigger = CALLED_EACH_LOOP;
- daemon_code();
+ g_engine->game_daemon_code();
_G(kernel).trigger = oldTrigger;
}
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
index ac2bfe298a2..f0bbfcd9eaf 100644
--- a/engines/m4/burger/rooms/section.h
+++ b/engines/m4/burger/rooms/section.h
@@ -37,7 +37,6 @@ public:
~Section() override {}
void global_room_init() override;
- void daemon_code() override;
void tick() override;
};
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
index b0f33ed171c..52431389674 100644
--- a/engines/m4/burger/rooms/section9/section9.cpp
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -30,7 +30,7 @@ Section9::Section9() : Rooms::Section() {
add(&_room951);
}
-void Section9::daemon_code() {
+void Section9::daemon() {
switch (_G(kernel).trigger) {
case 9002:
_G(game).new_room = 902;
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
index 47062af9f1c..783dea0c4fc 100644
--- a/engines/m4/burger/rooms/section9/section9.h
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -36,7 +36,7 @@ public:
Section9();
virtual ~Section9() {}
- void daemon_code() override;
+ void daemon() override;
};
} // namespace Rooms
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 05dfce07b5c..189d47cc51e 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -59,6 +59,27 @@ void Sections::section_room_constructor() {
assert(_activeRoom);
}
+void Sections::game_daemon_code() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ _G(kernel).continue_handling_trigger = false;
+
+ room_daemon();
+
+ if (_G(kernel).continue_handling_trigger) {
+ _G(kernel).continue_handling_trigger = false;
+ daemon();
+ }
+
+ if (_G(kernel).continue_handling_trigger)
+ global_daemon();
+
+ if (_G(kernel).trigger == 32001) {
+ _G(game).room_id = -1;
+ _G(game).section_id = -1;
+ _G(game).previous_room = -2;
+ }
+}
+
void Sections::m4SceneLoad() {
_G(between_rooms) = true;
_cameraShiftAmount = 0;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 2074f1920a6..b319980687a 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -78,7 +78,7 @@ public:
virtual HotSpotRec *walker_spotter(int32 x, int32 y);
virtual void global_room_init() {}
- virtual void daemon_code() {}
+ virtual void daemon() {}
virtual void tick() {}
};
@@ -107,12 +107,13 @@ public:
void global_section_constructor();
void section_room_constructor();
+ void game_daemon_code();
void section_init() {
_activeSection->init();
}
- void daemon_code() {
- _activeSection->daemon_code();
+ void daemon() {
+ _activeSection->daemon();
}
void global_room_init() {
_activeSection->global_room_init();
@@ -154,6 +155,8 @@ public:
void m4EndScene();
void pal_game_task();
+
+ virtual void global_daemon() = 0;
};
} // namespace M4
Commit: df6c3063fc0200c5c29c59482533dad27a33828e
https://github.com/scummvm/scummvm/commit/df6c3063fc0200c5c29c59482533dad27a33828e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Minor cleanups
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_trigger.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 2bd86cd57a6..8b7e757e605 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -28,8 +28,6 @@ namespace M4 {
#define _GT(X) _G(triggers)._##X
-static bool kernel_trigger_dispatchx(int32 trigger_num);
-
int32 kernel_trigger_create(int32 trigger_num) {
int32 new_trigger;
@@ -72,13 +70,7 @@ void cisco_clear_triggers() {
_GT(q_end) = _GT(q_start) = 0;
}
-/**
- * Dispatches a trigger.
- * @returns Returns true if the trigger was handled. If the trigger is for
- * a different room that current room_id, returns false. If no trigger_mode was
- * attached to the trigger, returns false
- */
-static bool kernel_trigger_dispatchx(int32 trigger_num) {
+bool kernel_trigger_dispatchx(int32 trigger_num) {
if (_G(between_rooms))
return true;
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 278a9affdee..e9c74aa8c60 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -51,9 +51,21 @@ struct Triggers {
* +--- trigger_mode (0-16)
*/
extern int32 kernel_trigger_create(int32 trigger_num);
-
extern int32 kernel_trigger_create_mode(int32 trigger_num, int32 desired_mode);
+
+/**
+ * Dispatches a trigger
+ */
extern bool kernel_trigger_dispatch(int32 trigger_num);
+
+/**
+ * Dispatches a trigger.
+ * @returns Returns true if the trigger was handled. If the trigger is for
+ * a different room that current room_id, returns false. If no trigger_mode was
+ * attached to the trigger, returns false
+ */
+extern bool kernel_trigger_dispatchx(int32 trigger_num);
+
extern bool kernel_trigger_dispatch_now(int32 trigger_num);
extern void kernel_timing_trigger(int32 ticks, int16 trigger, char *name = NULL);
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index c7cb62f92cc..34ff8c7afbd 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -546,7 +546,7 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
static void pal_fade_callback(frac16 myMessage) {
_G(pal_fade_in_progress) = false;
- kernel_trigger_dispatch((uint32)myMessage);
+ kernel_trigger_dispatchx((int32)myMessage);
}
void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
@@ -718,8 +718,6 @@ static void pal_cycle_update() {
}
}
-// pal_fx_update() is called each game loop
-//
void pal_fx_update() {
int32 startA = 0, endA = 0, startB = 0, endB = 0, startDAC = 0, endDAC = 0;
@@ -776,12 +774,6 @@ void pal_fx_update() {
}
}
-//==========================================================================================
-//
-// DAC_tint_effect() is used to effect the screen colours (not the master palette) temporarily
-// until something else updates the DAC e.g. refresh_DAC()
-//
-
void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent) {
int32 i;
int32 r, g, b, dr, dg, db;
@@ -789,13 +781,13 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
int32 percent_r, percent_g, percent_b;
if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry)) {
- // this should generate an error (Nick debug plarg MattP)
+ // This should generate an error
term_message("*** palette index error");
return;
}
term_message("Colour tint DAC to: %d %d %d, %d percent, range (%d - %d)",
- tintColor->r, tintColor->g, tintColor->b, percent, firstPalEntry, lastPalEntry); // debug
+ tintColor->r, tintColor->g, tintColor->b, percent, firstPalEntry, lastPalEntry);
percent = DivSF16(percent << 16, 100 << 16); // convert percent to frac16 format
targetColor.r = tintColor->r;
@@ -807,17 +799,17 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
if (!transparent) {
for (i = firstPalEntry; i <= lastPalEntry; ++i) {
- // calculate deltas for RGB's and put them in frac16 format
+ // Calculate deltas for RGB's and put them in frac16 format
dr = (targetColor.r - _G(master_palette)[i].r) << 16;
dg = (targetColor.g - _G(master_palette)[i].g) << 16;
db = (targetColor.b - _G(master_palette)[i].b) << 16;
- // new = orig + (delta * percent)
+ // New = orig + (delta * percent)
r = _G(master_palette)[i].r + (MulSF16(percent, dr) >> 16);
g = _G(master_palette)[i].g + (MulSF16(percent, dg) >> 16);
b = _G(master_palette)[i].b + (MulSF16(percent, db) >> 16);
- // check for under/overflow
+ // Check for under/overflow
if (r > 255) r = 255; if (r < 0) r = 0;
if (g > 255) g = 255; if (g < 0) g = 0;
if (b > 255) b = 255; if (b < 0) b = 0;
@@ -826,17 +818,15 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
color.g = (byte)g;
color.b = (byte)b;
- gr_pal_set_entry(i, &color); // set the new colour to the DAC
+ gr_pal_set_entry(i, &color); // Set the new colour to the DAC
}
} else {
-
// This is for filtering colors. For example, a completely red filter
// (255, 0, 0) will block out the blue and green parts of the palette.
// 50% of the same filter will block out only 50% of the blue and
// green, but leaving all of the rest blue.
for (i = firstPalEntry; i <= lastPalEntry; ++i) {
-
// Converting rgb to a frac16 ( << 16) dividing by 256 ( >> 8)
// (the range of the palette values)
percent_r = (targetColor.r) << 8;
@@ -859,7 +849,7 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
g = (_G(master_palette)[i].g - (dg >> 16));
b = (_G(master_palette)[i].b - (db >> 16));
- // check for under/overflow
+ // Check for under/overflow
if (r > 255) r = 255; if (r < 0) r = 0;
if (g > 255) g = 255; if (g < 0) g = 0;
if (b > 255) b = 255; if (b < 0) b = 0;
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 53cf3bdfc3e..15bf2fb0e61 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -42,8 +42,8 @@ struct KernelPal_Globals {
int32 _myCycleStartTime = 0;
int32 _myCycleEndTime = 0;
int32 _myCycleEndDelayTime = 0;
- int32 _myCycleStartIndex;
- int32 _myCycleEndIndex;
+ int32 _myCycleStartIndex = 0;
+ int32 _myCycleEndIndex = 0;
uint32 _myCycleTrigger = 0;
int32 _myCycleNeverStopCycling = false;
@@ -87,10 +87,32 @@ extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, int32 triggerNum);
-extern bool pal_cycle_active(); // Returns true if color cycling is on
-extern void pal_cycle_stop(); // Stops color cycling
-extern void pal_cycle_resume(); // Starts color cycling
-extern void pal_fx_update(); // Handles fading and cycling MattP
+
+/**
+ * Returns true if color cycling is on
+ */
+extern bool pal_cycle_active();
+
+/**
+ * Stops color cycling
+ */
+extern void pal_cycle_stop();
+
+/**
+ * Starts color cycling
+ */
+extern void pal_cycle_resume();
+
+/**
+ * Handles fading and cycling
+ */
+extern void pal_fx_update();
+
+/**
+ * This is used to effect the screen colours (not the master palette) temporarily
+ * until something else updates the DAC e.g. refresh_DAC()
+ */
+extern void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
extern void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger);
Commit: e5d8eac62f7fdff20bf031a280aa553fd7eaf8ea
https://github.com/scummvm/scummvm/commit/e5d8eac62f7fdff20bf031a280aa553fd7eaf8ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding Digi methods implementation
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
engines/m4/vars.cpp
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 3e03d2bfc94..35c65c244e9 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -19,69 +19,111 @@
*
*/
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "audio/decoders/raw.h"
#include "m4/platform/sound/digi.h"
#include "m4/vars.h"
namespace M4 {
namespace Sound {
+Digi::~Digi() {
+ unload_sounds();
+}
+
void Digi::preload_sounds(const char **names) {
- if (!_names.empty()) {
+ if (!_sounds.empty())
unload_sounds();
- _names.clear();
- }
if (names) {
- for (; *names; ++names) {
- _names.push_back(*names);
+ for (; *names; ++names)
preload(*names, NOWHERE);
- }
}
}
void Digi::unload_sounds() {
- for (uint i = 0; i < _names.size(); ++i)
- unload(_names[i]);
+ _mixer->stopAll();
+
+ for (auto it = _sounds.begin(); it != _sounds.end(); ++it)
+ delete it->_value._data;
+
+ _sounds.clear();
}
bool Digi::preload(const Common::String &name, int roomNum) {
- warning("TODO: Digi::preload - %s, %d", name.c_str(), roomNum);
+ MemHandle workHandle;
+ int32 assetSize;
+
+ if (_sounds.contains(name))
+ return true;
+
+ // Load in the sound
+ if ((workHandle = rget(name, &assetSize)) == nullptr)
+ error("Could not find sound - %s", name.c_str());
+
+ HLock(workHandle);
+ const byte *pSrc = (byte *)*workHandle;
+ byte *pDest = (byte *)malloc(assetSize);
+ Common::copy(pSrc, pSrc + assetSize, pDest);
+
+ HUnLock(workHandle);
+ DisposeHandle(workHandle);
+
+ _sounds[name] = DigiEntry(pDest, assetSize);
return false;
}
void Digi::unload(const Common::String &name) {
- warning("TODO: Digi::unload");
+ if (_sounds.contains(name)) {
+ delete _sounds[name]._data;
+ _sounds.erase(name);
+ }
}
void Digi::task() {
- warning("TODO: Digi::task");
+ // No implementation
}
-int32 Digi::play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
- error("TODO: Digi::play");
- return 0;
+int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num) {
+ return play(name, channel, vol, trigger, room_num, false);
+}
+
+int32 Digi::play_loop(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num) {
+ return play(name, channel, vol, trigger, room_num, true);
}
-int32 Digi::play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
- error("TODO: Digi::play_loop");
+int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num, bool loop) {
+ assert(channel < 4);
+
+ digi_preload(name, room_num);
+ DigiEntry &entry = _sounds[name];
+
+ // Create new audio stream
+ Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
+ Audio::makeRawStream(entry._data, entry._size, 11025, Audio::FLAG_UNSIGNED),
+ loop ? 0 : 1);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_channels[channel], stream, -1, vol);
+
+ _sounds.erase(name);
return 0;
}
-void Digi::stop(int slot) {
- error("TODO: Digi::stop");
+void Digi::stop(uint channel) {
+ assert(channel < 4);
+ _mixer->stopHandle(_channels[channel]);
}
void Digi::flush_mem() {
- error("TODO: Digi::flush_mem");
+ // No implementation
}
void Digi::read_another_chunk() {
- warning("TODO: Digi::read_another_chunk");
+ // No implementation
}
bool Digi::play_state(int channel) const {
- warning("TODO: Digi::play_state");
- return true;
+ return _mixer->isSoundHandleActive(_channels[channel]);
}
} // namespace Sound
@@ -94,11 +136,11 @@ void digi_unload(const Common::String &name) {
_G(digi).unload(name);
}
-int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+int32 digi_play(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num) {
return _G(digi).play(name, channel, vol, trigger, room_num);
}
-int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num) {
+int32 digi_play_loop(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num) {
return _G(digi).play_loop(name, channel, vol, trigger, room_num);
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 6c8bf7dd657..6cef4b96676 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -23,19 +23,39 @@
#ifndef M4_PLATFORM_SOUND_DIGI_H
#define M4_PLATFORM_SOUND_DIGI_H
-#include "common/str-array.h"
+#include "audio/mixer.h"
+#include "audio/audiostream.h"
+#include "common/hashmap.h"
#include "m4/m4_types.h"
namespace M4 {
namespace Sound {
+/**
+ * M4 Digital player digivolves to ScummVM-digital player
+ */
class Digi {
+ /**
+ * Digitital sound entry
+ */
+ struct DigiEntry {
+ byte *_data = nullptr;
+ size_t _size = 0;
+ DigiEntry() {}
+ DigiEntry(byte *data, size_t size) : _data(data), _size(size) {}
+ };
private:
- Common::StringArray _names;
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _channels[4];
+ Common::HashMap<Common::String, DigiEntry> _sounds;
-private:
+ int32 play(const Common::String &name, uint channel, int32 vol, int32 trigger,
+ int32 room_num, bool loop);
public:
+ Digi(Audio::Mixer *mixer) : _mixer(mixer) {}
+ ~Digi();
+
/**
* Preload a digi sample into memory buffer for play back later.
*/
@@ -53,9 +73,9 @@ public:
// If the sound has been preloaded it will be played from memory, otherwise it will
// be streamed from disk
- int32 play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
- int32 play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
- void stop(int slot);
+ int32 play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
+ int32 play_loop(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
+ void stop(uint channel);
void flush_mem();
void read_another_chunk();
@@ -66,8 +86,8 @@ public:
extern bool digi_preload(const Common::String &name, int roomNum = -1);
extern void digi_unload(const Common::String &name);
-extern int32 digi_play(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
-extern int32 digi_play_loop(const char *name, int32 channel, int32 vol, int32 trigger, int32 room_num = -1);
+extern int32 digi_play(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
+extern int32 digi_play_loop(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
extern void digi_read_another_chunk();
extern void digi_stop(int channel);
extern bool digi_play_state(int channel);
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 70a215047a0..c7e43241bc6 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -34,12 +34,13 @@
#include "m4/mem/mem.h"
#include "m4/detection.h"
#include "m4/core/param.h"
+#include "m4/m4.h"
namespace M4 {
Vars *g_vars;
-Vars::Vars() {
+Vars::Vars() : _digi(g_engine->_mixer) {
g_vars = this;
_cheating_enabled = gDebugLevel > 0;
}
Commit: 0029933fff3ca72f2aad6fe20934ae1b1a281016
https://github.com/scummvm/scummvm/commit/0029933fff3ca72f2aad6fe20934ae1b1a281016
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Digi fixes, sound now playing
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_file.h
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index e829a0b975e..b5ee7c0ecaa 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -38,7 +38,6 @@
namespace M4 {
-static int32 extract_room_num(const char *name);
static Common::String get_background_filename(const SceneDef *rdef);
static Common::String get_attribute_filename(const SceneDef *rdef);
static void recreate_animation_draw_screen(GrBuff **loadBuf);
@@ -289,8 +288,7 @@ bool kernel_load_game(int slot) {
return g_engine->loadGameState(slot).getCode() == Common::kNoError;
}
-#if 0
-static int32 extract_room_num(const char *name) {
+int32 extract_room_num(const Common::String &name) {
if ((name[0] == 'C' || name[0] == 'c') &&
(name[1] == 'O' || name[1] == 'o') &&
(name[2] == 'M' || name[2] == 'm'))
@@ -301,7 +299,7 @@ static int32 extract_room_num(const char *name) {
} else
return _G(game).room_id;
}
-#endif
+
static Common::String get_background_filename(const SceneDef *rdef) {
if (_G(art_base_override) != nullptr) {
return _G(art_base_override);
diff --git a/engines/m4/adv_r/adv_file.h b/engines/m4/adv_r/adv_file.h
index e88884b327a..714fca9a417 100644
--- a/engines/m4/adv_r/adv_file.h
+++ b/engines/m4/adv_r/adv_file.h
@@ -41,6 +41,7 @@ extern void kernel_unload_room(SceneDef *rdef, GrBuff **code_data, GrBuff **load
extern int kernel_save_game(int slot, const char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData);
extern bool kernel_load_game(int slot);
extern bool kernel_save_game_exists(int32 slot);
+extern int32 extract_room_num(const Common::String &name);
extern bool kernel_load_variant(char *variant);
extern GrBuff *load_codes(SysFile *code_file);
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 35c65c244e9..80d2ae25552 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -23,6 +23,8 @@
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
#include "m4/platform/sound/digi.h"
+#include "m4/adv_r/adv_file.h"
+#include "m4/fileio/extensions.h"
#include "m4/vars.h"
namespace M4 {
@@ -55,12 +57,13 @@ bool Digi::preload(const Common::String &name, int roomNum) {
MemHandle workHandle;
int32 assetSize;
- if (_sounds.contains(name))
+ Common::String fileName = expand_name_2_RAW(name, roomNum);
+ if (_sounds.contains(fileName))
return true;
// Load in the sound
- if ((workHandle = rget(name, &assetSize)) == nullptr)
- error("Could not find sound - %s", name.c_str());
+ if ((workHandle = rget(fileName, &assetSize)) == nullptr)
+ error("Could not find sound - %s", fileName.c_str());
HLock(workHandle);
const byte *pSrc = (byte *)*workHandle;
@@ -68,7 +71,6 @@ bool Digi::preload(const Common::String &name, int roomNum) {
Common::copy(pSrc, pSrc + assetSize, pDest);
HUnLock(workHandle);
- DisposeHandle(workHandle);
_sounds[name] = DigiEntry(pDest, assetSize);
return false;
@@ -95,9 +97,10 @@ int32 Digi::play_loop(const Common::String &name, uint channel, int32 vol, int32
int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num, bool loop) {
assert(channel < 4);
+ Common::String fileName = expand_name_2_RAW(name, room_num);
- digi_preload(name, room_num);
- DigiEntry &entry = _sounds[name];
+ digi_preload(fileName, room_num);
+ DigiEntry &entry = _sounds[fileName];
// Create new audio stream
Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
@@ -105,10 +108,25 @@ int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trig
loop ? 0 : 1);
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_channels[channel], stream, -1, vol);
- _sounds.erase(name);
+ _sounds.erase(fileName);
return 0;
}
+Common::String Digi::expand_name_2_RAW(const Common::String &name, int32 room_num) {
+ Common::String tempName = f_extension_new(name, "RAW");
+
+ if (!_G(kernel).hag_mode) {
+ if (room_num == -1)
+ room_num = extract_room_num(name);
+
+ return Common::String::format("%d\\%s", room_num, tempName.c_str());
+
+ } else {
+ return tempName;
+ }
+}
+
+
void Digi::stop(uint channel) {
assert(channel < 4);
_mixer->stopHandle(_channels[channel]);
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 6cef4b96676..ef335eab2a3 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -51,6 +51,7 @@ private:
int32 play(const Common::String &name, uint channel, int32 vol, int32 trigger,
int32 room_num, bool loop);
+ Common::String expand_name_2_RAW(const Common::String &name, int32 room_num);
public:
Digi(Audio::Mixer *mixer) : _mixer(mixer) {}
Commit: 78330f24fb74e39fff1c6c3a4d07286b43e4201e
https://github.com/scummvm/scummvm/commit/78330f24fb74e39fff1c6c3a4d07286b43e4201e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix closing down ScummVM
Changed paths:
engines/m4/m4.cpp
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 3f76b918e9d..55541e381e5 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -78,11 +78,13 @@ Common::Error M4Engine::run() {
return Common::kNoError;
}
+#define KEEP_PLAYING (_G(kernel).going && !shouldQuit())
+
void M4Engine::m4_inflight() {
Hotkeys::add_hot_keys();
_G(kernel).going = true;
- while (_G(kernel).going && !shouldQuit()) {
+ while (KEEP_PLAYING) {
if (_G(game).previous_room == -2) {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
@@ -94,7 +96,7 @@ void M4Engine::m4_inflight() {
_G(kernel).going = kernel_section_startup();
section_init();
- while (_G(game).new_section == _G(game).section_id) {
+ while (_G(game).new_section == _G(game).section_id && KEEP_PLAYING) {
m4SceneLoad();
m4RunScene();
m4EndScene();
Commit: 71826980913718cd018958f34a2c0fe18156455e
https://github.com/scummvm/scummvm/commit/71826980913718cd018958f34a2c0fe18156455e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Palette fixes
Changed paths:
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 5ee133a2a34..8cd6eaf2984 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -78,11 +78,14 @@ void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b) {
}
void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors) {
- g_system->getPaletteManager()->setPalette((const byte *)pal, first_color, num_colors);
+ g_system->getPaletteManager()->setPalette((const byte *)pal + first_color * 3,
+ first_color, num_colors);
+ g_system->updateScreen();
}
void gr_pal_set_entry(int32 index, RGB8 *entry) {
g_system->getPaletteManager()->setPalette((const byte *)entry, index, 1);
+ g_system->updateScreen();
}
void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color) {
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 34ff8c7afbd..3a43e624b1d 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -565,7 +565,7 @@ void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
_GP(myFadeEndTime) = _GP(myFadeStartTime) + numTicks;
_GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
_GP(myFadeStartPercentFrac) = _GP(myFadeCurrPercentFrac);
- _GP(myFadePercentFrac) = DivSF16(targetPercent << 16, 0x640000);
+ _GP(myFadePercentFrac) = DivSF16(targetPercent << 16, 100 << 16);
// Disable_end_user_hot_keys();
_G(pal_fade_in_progress) = true;
@@ -582,8 +582,9 @@ static void pal_fade_update(RGB8 *origPalette) {
tempFrac2 = _GP(myFadePercentFrac);
_GP(myFadeStartPercentFrac) = _GP(myFadePercentFrac);
_GP(myFadeFinished) = true;
- } else if (currTime <= _GP(myFadeStartTime)) return;
- else {
+ } else if (currTime <= _GP(myFadeStartTime)) {
+ return;
+ } else {
tempFrac = DivSF16((currTime - _GP(myFadeStartTime)) << 16, (_GP(myFadeEndTime) - _GP(myFadeStartTime)) << 16);
tempFrac2 = MulSF16(tempFrac, _GP(myFadePercentFrac) - _GP(myFadeStartPercentFrac)) + _GP(myFadeStartPercentFrac);
}
@@ -597,7 +598,7 @@ static void pal_fade_update(RGB8 *origPalette) {
}
// Recalculate the end delay time again
- _GP(myFadeEndDelayTime) = currTime + _GP(myFadeDelayTicks); // Recalculate the end delay time again
+ _GP(myFadeEndDelayTime) = currTime + _GP(myFadeDelayTicks); // Recalculate the end delay time again
// Must reresh the DAC
_GP(myFadeDACrefresh) = true;
@@ -744,9 +745,10 @@ void pal_fx_update() {
}
}
- // Check ranges to perform minimum calls of gr_pal_set_range() (to minimize snow on monitor due to OUT instructions)
- if (endA < startB || endB < startA) { // if A and B ranges don't overlap
-
+ // Check ranges to perform minimum calls of gr_pal_set_range().
+ // This was originally done to minimize snow on monitor due to repeated OUT instructions
+ if (endA < startB || endB < startA) {
+ // if A and B ranges don't overlap
if (!(startA == 0 && endA == 0)) // if this is not the degenerate case (just the transparent color)
gr_pal_set_range(&_GP(myFXPalette)[0], startA, endA - startA + 1); // set A range of the DAC
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 15bf2fb0e61..bf2cfbc1475 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -44,7 +44,7 @@ struct KernelPal_Globals {
int32 _myCycleEndDelayTime = 0;
int32 _myCycleStartIndex = 0;
int32 _myCycleEndIndex = 0;
- uint32 _myCycleTrigger = 0;
+ int32 _myCycleTrigger = 0;
int32 _myCycleNeverStopCycling = false;
bool _myFadeReq = false;
@@ -56,7 +56,7 @@ struct KernelPal_Globals {
int32 _myFadeEndDelayTime = 0;
int32 _myFadeStartIndex = 0;
int32 _myFadeEndIndex = 0;
- uint32 _myFadeTrigger = 0;
+ int32 _myFadeTrigger = 0;
frac16 _myFadeStartPercentFrac = 0x10000;
frac16 _myFadeCurrPercentFrac = 0x10000;
frac16 _myFadePercentFrac = 0;
Commit: 43f4d5c92e412d67e59c2d603d740489077fece3
https://github.com/scummvm/scummvm/commit/43f4d5c92e412d67e59c2d603d740489077fece3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes to vmng_refresh_video
Changed paths:
engines/m4/gui/gui_vmng_core.cpp
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 10681dc93ba..3ce570e2e40 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -265,7 +265,8 @@ ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
}
void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer) {
- g_system->copyRectToScreen(srcBuffer->data, srcBuffer->stride, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ const byte *srcP = srcBuffer->data + (y1 * srcBuffer->stride) + x1;
+ g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY, x2 - x1 + 1, y2 - y1 + 1);
g_system->updateScreen();
}
Commit: 01a855d40ce04a39753febd983ebe3978761fabc
https://github.com/scummvm/scummvm/commit/01a855d40ce04a39753febd983ebe3978761fabc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix palette range passed to kernel_load_room
Title screen is now correctly showing
Changed paths:
engines/m4/adv_r/kernel.h
engines/m4/core/rooms.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 4e0bfb6e88f..4ab554d232f 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -51,9 +51,6 @@ struct Kernel {
bool supress_fadeup = false;
bool force_restart = false;
- int32 minPalEntry = 0;
- int32 maxPalEntry = 0;
-
bool pause = false;
machine* myWalker = nullptr;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 189d47cc51e..60018ce271c 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -108,7 +108,7 @@ void Sections::m4SceneLoad() {
term_message("Calling kernel_load_room");
- _G(kernel).going = kernel_load_room(_G(kernel).minPalEntry, _G(kernel).maxPalEntry,
+ _G(kernel).going = kernel_load_room(MIN_PAL_ENTRY, MAX_PAL_ENTRY,
&_G(currentSceneDef), &_G(screenCodeBuff), &_G(game_bgBuff));
if (!_G(kernel).going)
error_show(FL, 'IMP!'); // this should never ever happen
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 3a35f2f100e..8b2df5cd9be 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -26,6 +26,9 @@
namespace M4 {
+constexpr int MIN_PAL_ENTRY = 1;
+constexpr int MAX_PAL_ENTRY = 255;
+
#define __BLACK (gr_pal_get_ega_color(0))
#define __BLUE (gr_pal_get_ega_color(1))
#define __GREEN (gr_pal_get_ega_color(2))
Commit: 6f0566b4717eb046854f6a783dc0676154c964da
https://github.com/scummvm/scummvm/commit/6f0566b4717eb046854f6a783dc0676154c964da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Comments cleanup
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 033ac8e6c77..d1d24bb9003 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -949,7 +949,7 @@ Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box)
term_message("conv_load");
- _GC(playerCommAllowed) = _G(player).comm_allowed; // Remember if player commands are on before we start the conversation MattP apr11
+ _GC(playerCommAllowed) = _G(player).comm_allowed; // Remember if player commands are on before we start the conversation
_GC(interface_was_visible) = INTERFACE_VISIBLE;
term_message("conv load: %s", filename);
@@ -957,7 +957,7 @@ Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box)
if (want_box) {
// If we want an interface box
conv_set_disp_default();
- mouse_set_sprite(0); // Also if we want a text box, lock the mouse into arrow mode MattP apr11
+ mouse_set_sprite(0); // Also if we want a text box, lock the mouse into arrow mode
mouse_lock_sprite(0);
player_set_commands_allowed(false); // with commands off
@@ -1042,7 +1042,7 @@ done:
void conv_unload(Conv *c) {
mouse_unlock_sprite();
- if (_GC(interface_was_visible)) { // turn interface back on if it was on MattP
+ if (_GC(interface_was_visible)) { // Turn interface back on if it was on
interface_show();
}
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 3a43e624b1d..ac9e8517964 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -115,7 +115,7 @@ static void grey_fade(RGB8 *pal, int32 to_from_flag, int32 from, int32 to, int32
static void create_luminance_map(RGB8 *pal) {
for (int i = GREY_START; i <= FREE_END; i++) {
Byte luminance = (Byte)((pal[i].r + pal[i].g + pal[i].b) / 3);
- _GP(fadeToMe)[i].g = (Byte)imath_min(255, luminance); // MattP new green screen!
+ _GP(fadeToMe)[i].g = (Byte)imath_min(255, luminance); // New green screen!
_GP(fadeToMe)[i].r = _GP(fadeToMe)[i].b = 0;
}
}
@@ -139,7 +139,7 @@ static void make_translation_table(RGB8 *pal) {
}
// look for best match in the free indexes for the greys in GREY_START-GREY_END range (we need these available)
- int32 matchGrey = pal[GREY_START + i].g; // MattP use green instead of red cause we're having a green screen
+ int32 matchGrey = pal[GREY_START + i].g; // Use green instead of red cause we're having a green screen
for (j = FREE_START; j <= FREE_END; j++) {
int32 tryGrey = pal[j].g;
@@ -219,12 +219,11 @@ void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay) {
RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
// make new trickPal with grey-scale ramp entries and load it into VGA registers
- memcpy(_GP(trick), _GP(fadeToMe), sizeof(RGB8) * 256); // MattP _GP(trick) pal is the greyed version plus the grey ramp overlayed on top
+ memcpy(_GP(trick), _GP(fadeToMe), sizeof(RGB8) * 256); // trick pal is the greyed version plus the grey ramp overlayed on top
int8 grey_step = 256 / NUM_GREYS;
int8 grey_ramp = 0;
for (i = GREY_START; i <= GREY_END; i++) {
- // _GP(trick)[i].r = _GP(trick)[i].g = _GP(trick)[i].b = (Byte) (grey_ramp); old grey ramp
- _GP(trick)[i].g = (Byte)(grey_ramp); // MattP new green screen
+ _GP(trick)[i].g = (Byte)(grey_ramp); // New green screen
_GP(trick)[i].r = _GP(trick)[i].b = 0;
grey_ramp += grey_step;
}
@@ -248,9 +247,9 @@ void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
// load original faded greys into the free indexes (no pixels have these indexs yet)
- gr_pal_set_range(_GP(fadeToMe), FREE_START, NUM_FREE); // Load _GP(fadeToMe) colors into VGA
+ gr_pal_set_range(_GP(fadeToMe), FREE_START, NUM_FREE); // Load fadeToMe colors into VGA
- make_translation_table(_GP(trick)); // Mattp this is used in fade_to_grey too!
+ make_translation_table(_GP(trick)); // This is used in fade_to_grey too!
// for every pixel in the screen, move any pixel in the GREY_START-GREY_END range out in to the free range
tempPtr = grey_screen->data;
@@ -404,7 +403,7 @@ void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2,
// remap the greyed out pixel to the closest grey in GREY_START to GREY_END range
// shift right 3, takes a 255 value and makes it out of 32 (the number of greys in reduced grey ramp)
- ptr[x] = (uint8)(GREY_START + (_GP(fadeToMe)[ptr[x]].g >> 3)); // MattP use green instead of red cause we're having a green screen
+ ptr[x] = (uint8)(GREY_START + (_GP(fadeToMe)[ptr[x]].g >> 3)); // Use green instead of red cause we're having a green screen
if (!(y & 0xff)) {
_G(digi).task();
@@ -625,14 +624,11 @@ static void pal_cycle_callback(frac16 myMessage) {
void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry,
int32 delayTicks, int32 totalTicks, int32 triggerNum) {
- if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry)) {
- // This should generate an error
+ // Validation
+ if ((firstPalEntry < 0) || (lastPalEntry > 255) || (firstPalEntry > lastPalEntry))
return;
- }
- if (delayTicks <= 0) {
- // This should generate an error (Nick debug plarg MattP)
+ if (delayTicks <= 0)
return;
- }
_GP(myCycleReq) = true;
_GP(myCycleFinished) = false;
@@ -641,7 +637,7 @@ void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry,
_GP(myCycleEndDelayTime) = timer_read_60();
_GP(myCycleStartIndex) = firstPalEntry;
_GP(myCycleEndIndex) = lastPalEntry;
- _GP(myCycleTrigger) = kernel_trigger_create(triggerNum); // Returned when _GP(myCycleEndTime) is reached
+ _GP(myCycleTrigger) = kernel_trigger_create(triggerNum); // Returned when myCycleEndTime is reached
if (totalTicks > 0) { // If totalTicks > 0, calculate end time
_GP(myCycleEndTime) = _GP(myCycleStartTime) + totalTicks;
@@ -863,11 +859,10 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
gr_pal_set_entry(i, &color); // Set new colors to DAC.
}
}
-
}
void DAC_restore() {
- term_message("DAC restored");//debug
+ term_message("DAC restored");
gr_pal_set_range(&_G(master_palette)[0], 0, 256);
}
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 8c06a7829ae..649c3a9b685 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -1158,11 +1158,11 @@ TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminanc
myTextScrn->w = x2 - x1 + 1;
myTextScrn->h = y2 - y1 + 1;
myTextScrn->textColor = textColor;
- myTextScrn->textColor_alt1 = textColorAlt1; // MattP
- myTextScrn->textColor_alt2 = textColorAlt2; // MattP
+ myTextScrn->textColor_alt1 = textColorAlt1;
+ myTextScrn->textColor_alt2 = textColorAlt2;
myTextScrn->hiliteColor = hiliteColor;
- myTextScrn->hiliteColor_alt1 = hiliteColorAlt1; // MattP
- myTextScrn->hiliteColor_alt2 = hiliteColorAlt2; // MattP
+ myTextScrn->hiliteColor_alt1 = hiliteColorAlt1;
+ myTextScrn->hiliteColor_alt2 = hiliteColorAlt2;
myTextScrn->luminance = luminance;
myTextScrn->myFont = gr_font_get();
myTextScrn->myTextItems = nullptr;
@@ -1206,7 +1206,7 @@ bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
return false;
}
if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "text item")) == nullptr) return false;
- myTextItem->w = gr_font_string_width(prompt, 0); // MattP no auto spacing
+ myTextItem->w = gr_font_string_width(prompt, 0); // No auto spacing
myTextItem->h = gr_font_get_height() + 1;
myTextItem->y = y;
myTextItem->justification = justification;
@@ -1243,7 +1243,7 @@ bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
return false;
}
if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "textscrn msg")) == nullptr) return false;
- myTextItem->w = gr_font_string_width(prompt, 0); // MattP no auto spacing
+ myTextItem->w = gr_font_string_width(prompt, 0); //No auto spacing
myTextItem->h = gr_font_get_height() + 1;
myTextItem->y = y;
myTextItem->justification = justification;
Commit: 5714c3fb36db619901f0b943e4c8a9f8d8fd129b
https://github.com/scummvm/scummvm/commit/5714c3fb36db619901f0b943e4c8a9f8d8fd129b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added trigger dispatch when digi sounds finish playing
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 80d2ae25552..75664ac9047 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -106,7 +106,11 @@ int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trig
Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
Audio::makeRawStream(entry._data, entry._size, 11025, Audio::FLAG_UNSIGNED),
loop ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_channels[channel], stream, -1, vol);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_channels[channel]._soundHandle, stream, -1, vol);
+
+ if (trigger < 0 || trigger > 32767)
+ trigger = -1;
+ _channels[channel]._trigger = kernel_trigger_create(trigger);
_sounds.erase(fileName);
return 0;
@@ -129,7 +133,8 @@ Common::String Digi::expand_name_2_RAW(const Common::String &name, int32 room_nu
void Digi::stop(uint channel) {
assert(channel < 4);
- _mixer->stopHandle(_channels[channel]);
+ _mixer->stopHandle(_channels[channel]._soundHandle);
+ _channels[channel]._trigger = -1;
}
void Digi::flush_mem() {
@@ -137,11 +142,24 @@ void Digi::flush_mem() {
}
void Digi::read_another_chunk() {
- // No implementation
+ // For ScummVM, the audio data is completely loaded for each sound. But we still
+ // need to check whether a sound has finished so it's trigger can be dispatched
+ for (int channel = 0; channel < MAX_CHANNELS; ++channel) {
+ Channel &c = _channels[channel];
+
+ // Check if the channel has a sound playing that finished
+ if (c._trigger != -1 && !_mixer->isSoundHandleActive(c._soundHandle)) {
+ int trigger = c._trigger;
+ c._trigger = -1;
+
+ // Dispatch the trigger
+ kernel_trigger_dispatchx(trigger);
+ }
+ }
}
bool Digi::play_state(int channel) const {
- return _mixer->isSoundHandleActive(_channels[channel]);
+ return _mixer->isSoundHandleActive(_channels[channel]._soundHandle);
}
} // namespace Sound
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index ef335eab2a3..9d87885258a 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -31,12 +31,14 @@
namespace M4 {
namespace Sound {
+#define MAX_CHANNELS 4
+
/**
* M4 Digital player digivolves to ScummVM-digital player
*/
class Digi {
/**
- * Digitital sound entry
+ * Digital sound entry
*/
struct DigiEntry {
byte *_data = nullptr;
@@ -44,9 +46,16 @@ class Digi {
DigiEntry() {}
DigiEntry(byte *data, size_t size) : _data(data), _size(size) {}
};
+ /**
+ * Sound channel
+ */
+ struct Channel {
+ Audio::SoundHandle _soundHandle;
+ int _trigger = -1;
+ };
private:
Audio::Mixer *_mixer;
- Audio::SoundHandle _channels[4];
+ Channel _channels[4];
Common::HashMap<Common::String, DigiEntry> _sounds;
int32 play(const Common::String &name, uint channel, int32 vol, int32 trigger,
Commit: 3eefd904f47bf6c86c6661160386b55d971ae12b
https://github.com/scummvm/scummvm/commit/3eefd904f47bf6c86c6661160386b55d971ae12b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Stream break methods cleanup and fixes
Changed paths:
engines/m4/burger/core/stream_break.cpp
engines/m4/burger/core/stream_break.h
engines/m4/burger/vars.h
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/burger/core/stream_break.cpp b/engines/m4/burger/core/stream_break.cpp
index b94ff50bcaa..6eeb679f1d9 100644
--- a/engines/m4/burger/core/stream_break.cpp
+++ b/engines/m4/burger/core/stream_break.cpp
@@ -40,64 +40,81 @@ static void set_next_series_stream_break() {
series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, gSERIES_STREAM_BREAK);
break;
}
- ++_GB(my_stream_break_index); // go to the next break in list
- _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)]; // grab the info from the list
+
+ // Go to the next break in list
+ ++_GB(my_stream_break_index);
+ _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
}
void handle_series_stream_break() {
int32 thisFrame = _GB(my_stream_break)->frame;
+ auto &streamBreak = _GB(my_stream_break);
// Handle all breaks for this frame number (only one series break can occur on each frame)
// There can be any number of things to do once we've broken on a particular frame.
-
- while (thisFrame == _GB(my_stream_break)->frame) {
-
- if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) { // if there is a variable check if equal value
-
- if (_GB(my_stream_break)->flags & DIGI_STOP) { // Should we do a digi_stop?
- digi_stop(_GB(my_stream_break)->channel);
+ while (thisFrame == streamBreak->frame) {
+ // If there is a variable check if equal value
+ if ((!streamBreak->variable) || (*(streamBreak->variable) == streamBreak->value)) {
+ // Should we do a digi_stop?
+ if (streamBreak->flags & DIGI_STOP) {
+ digi_stop(streamBreak->channel);
}
- if (_GB(my_stream_break)->sound) { // Is there is a sound to play?
- if (_GB(my_stream_break)->flags & DIGI_LOOP) { // Should it be looped?
- digi_play_loop(_GB(my_stream_break)->sound, _GB(my_stream_break)->channel, _GB(my_stream_break)->volume, _GB(my_stream_break)->trigger);
+ // Is there is a sound to play?
+ if (streamBreak->sound) {
+ // Should it be looped?
+ if (streamBreak->flags & DIGI_LOOP) {
+ digi_play_loop(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
} else {
- digi_play(_GB(my_stream_break)->sound, _GB(my_stream_break)->channel, _GB(my_stream_break)->volume, _GB(my_stream_break)->trigger);
+ digi_play(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
}
} else {
- // No sound to play, so see if there is a trigger to dispatch
- if (_GB(my_stream_break)->trigger != NO_TRIGGER) {
- kernel_trigger_dispatch(kernel_trigger_create(_GB(my_stream_break)->trigger));
+ // No sound to play
+ // See if it's a volume channel
+ if (streamBreak->channel)
+ digi_change_volume(streamBreak->channel, streamBreak->volume);
+
+ // Is there is a trigger to dispatch
+ if (streamBreak->trigger != NO_TRIGGER) {
+ kernel_trigger_dispatchx(kernel_trigger_create(streamBreak->trigger));
}
}
}
- ++_GB(my_stream_break_index); // Go to next break in list
- _GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
+ // Go to next break in list
+ ++_GB(my_stream_break_index);
+ streamBreak = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
- if (_GB(my_stream_break)->frame >= 0) { // If we aren't at end of list yet, set up next stream break
+ // If we aren't at end of list yet, set up next stream break
+ if (streamBreak->frame >= 0)
set_next_series_stream_break();
- }
}
-void series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger) {
+machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger) {
_GB(my_stream_break_index) = 0;
_GB(my_stream_break_list) = list;
_GB(my_stream_viewer) = series_stream(name, framerate, depth, trigger);
set_next_series_stream_break();
+
+ return _GB(my_stream_viewer);
}
void digi_preload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
- while (list[i].frame >= 0) { // While there is a legitimate frame to break on
+ // While there is a legitimate frame to break on
+ while (list[i].frame >= 0) {
// If variable is null or variable = value then this break is used
if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
- if (list[i].sound) { // If there is a sound to load for this break
- if (!digi_preload(list[i].sound)) { // Check to see if it loaded ok
- term_message("**** Couldn't load: %s.RAW", list[i].sound);
+ // Is there is a sound to load for this break
+ if (list[i].sound) {
+ digi_read_another_chunk();
+
+ // Load the sound
+ if (!digi_preload(list[i].sound)) {
+ term_message("Preload stream breaks failed: %s", list[i].sound);
}
}
}
@@ -110,10 +127,11 @@ void digi_unload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
while (list[i].frame >= 0) {
- if (list[i].sound) { // if there is a sound to unload
- digi_unload(list[i].sound); // unload it
- }
- ++i; // next in list please
+ // Unload any sounds
+ if (list[i].sound)
+ digi_unload(list[i].sound);
+
+ ++i;
}
}
diff --git a/engines/m4/burger/core/stream_break.h b/engines/m4/burger/core/stream_break.h
index e5be0b8f48b..df7257d10fb 100644
--- a/engines/m4/burger/core/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -52,7 +52,7 @@ struct StreamBreak_Globals {
machine *_my_stream_viewer = nullptr;
};
-extern void series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger);
+extern machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger);
extern void digi_preload_stream_breaks(const seriesStreamBreak list[]);
extern void digi_unload_stream_breaks(const seriesStreamBreak list[]);
extern void handle_series_stream_break();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index f1b710d4f57..7aaf0379281 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -43,9 +43,9 @@ enum global_triggers {
// System triggers
gRESUME_CONVERSATION, // Yep, that's what it does!
+ gSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
gWILBURS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
- gSERIES_STREAM_BREAK, // Used only by set_next_stream_break () in global.cpp
gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
/*
gSERIES_PLAY_BREAK_1, // Used only by set_next_play_break () in global.cpp
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 75664ac9047..4d1dbf0ec65 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -162,6 +162,10 @@ bool Digi::play_state(int channel) const {
return _mixer->isSoundHandleActive(_channels[channel]._soundHandle);
}
+void Digi::change_volume(int channel, int vol) {
+ _mixer->setChannelVolume(_channels[channel]._soundHandle, vol);
+}
+
} // namespace Sound
bool digi_preload(const Common::String &name, int roomNum) {
@@ -192,4 +196,8 @@ bool digi_play_state(int channel) {
return _G(digi).play_state(channel);
}
+void digi_change_volume(int channel, int vol) {
+ _G(digi).change_volume(channel, vol);
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 9d87885258a..70599dff4b2 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -90,6 +90,7 @@ public:
void read_another_chunk();
bool play_state(int channel) const;
+ void change_volume(int channel, int vol);
};
} // namespace Sound
@@ -101,6 +102,7 @@ extern int32 digi_play_loop(const char *name, uint channel, int32 vol, int32 tri
extern void digi_read_another_chunk();
extern void digi_stop(int channel);
extern bool digi_play_state(int channel);
+extern void digi_change_volume(int channel, int vol);
} // namespace M4
Commit: e45e9b9f1489551a00f4ebababff82249f337f67
https://github.com/scummvm/scummvm/commit/e45e9b9f1489551a00f4ebababff82249f337f67
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move the GlobalVars class to be in Burger namespace
There's some confusion in the outer M4 namespace, with
it having two global arrays. On review, it seems like
one of them was pretty much all Burger-specific apart
from in the saving code, so I'm moving it to
avoid long term confusion
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/globals.cpp
engines/m4/burger/globals.h
engines/m4/burger/rooms/room.cpp
engines/m4/burger/vars.h
engines/m4/core/globals.cpp
engines/m4/core/globals.h
engines/m4/graphics/gr_series.cpp
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 75ead6a99a3..c0150e36c56 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -52,6 +52,10 @@ void BurgerEngine::showEngineInfo() {
debug("Orion Burger tastes great!\n");
}
+void BurgerEngine::syncGlobals(Common::Serializer &s) {
+ g_globals->_globals.sync(s);
+}
+
void BurgerEngine::global_daemon() {
error("TODO: global_daemon_code");
}
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 17745b70c30..ab75dcadf07 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -55,6 +55,8 @@ public:
*/
void showEngineInfo() override;
+ void syncGlobals(Common::Serializer &s) override;
+
void global_daemon() override;
};
diff --git a/engines/m4/burger/globals.cpp b/engines/m4/burger/globals.cpp
index f7657b4e82f..a339c59801f 100644
--- a/engines/m4/burger/globals.cpp
+++ b/engines/m4/burger/globals.cpp
@@ -34,6 +34,12 @@ GlobalVars::GlobalVars() {
resize(MAX_APPS_GLOBAL_VARS);
}
+void GlobalVars::sync(Common::Serializer &s) {
+ size_t count = size();
+ for (uint i = 0; i < count; ++i)
+ s.syncAsSint32LE((*this)[i]);
+}
+
void GlobalVars::reset() {
Common::fill(&(*this)[0], &(*this)[0] + MAX_APPS_GLOBAL_VARS, 0);
}
diff --git a/engines/m4/burger/globals.h b/engines/m4/burger/globals.h
index 462aa41920c..7b5e2ecaede 100644
--- a/engines/m4/burger/globals.h
+++ b/engines/m4/burger/globals.h
@@ -22,7 +22,9 @@
#ifndef M4_BURGER_GLOBALS_H
#define M4_BURGER_GLOBALS_H
-#include "m4/core/globals.h"
+#include "common/array.h"
+#include "common/serializer.h"
+#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
@@ -547,7 +549,7 @@ enum {
V511 = 511
};
-class GlobalVars : public M4::GlobalVars {
+class GlobalVars : public Common::Array<uint32> {
private:
Common::Array<byte> _convSave;
public:
@@ -571,6 +573,10 @@ public:
int32 get_boonsville_time_and_display(bool showTime = false);
void set_boonsville_time(int32 time);
+ /**
+ * Save/load values to a save file
+ */
+ void sync(Common::Serializer &s);
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 3751fbdd47b..f99640a58ed 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -27,7 +27,6 @@ namespace Burger {
namespace Rooms {
void Room::shutdown() {
- _GV()[298] = 0;
}
void Room::parser_code() {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 7aaf0379281..eb307b59d5f 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -92,9 +92,6 @@ public:
Vars();
virtual ~Vars();
- GlobalVars *getGlobals() override {
- return &_globals;
- }
M4::Interface *getInterface() override {
return &_interface;
}
diff --git a/engines/m4/core/globals.cpp b/engines/m4/core/globals.cpp
index 429686aa4e8..6e41d40c920 100644
--- a/engines/m4/core/globals.cpp
+++ b/engines/m4/core/globals.cpp
@@ -22,11 +22,12 @@
#include "m4/core/globals.h"
namespace M4 {
-
+/*
void GlobalVars::syncGame(Common::Serializer &s) {
size_t count = size();
for (uint i = 0; i < count; ++i)
s.syncAsSint32LE((*this)[i]);
}
+*/
} // namespace M4
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index 9443a7db63d..fd3aac42023 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -19,6 +19,10 @@
*
*/
+/**
+ * I know this is confusing, but the original game had two different Globals arrays
+ */
+
#ifndef M4_CORE_GLOBALS_H
#define M4_CORE_GLOBALS_H
@@ -28,7 +32,9 @@
namespace M4 {
-
+/**
+ *
+ */
enum {
GLB_TIME = 0,
GLB_WATCH_DOG = 1,
@@ -77,9 +83,11 @@ enum {
constexpr int GLB_SHARED_VARS = 256;
+/*
struct GlobalVars : public Common::Array<int32> {
- void syncGame(Common::Serializer &s);
+ //void syncGame(Common::Serializer &s);
};
+*/
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 9bd26cf89d6..fee1da6bc33 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -66,18 +66,18 @@ machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int
machine *m;
StreamFile *streamFil = new StreamFile(seriesName);
- //store the frameRate in g_temp1
- //if it is < 0, the default frame rate for the ss will be used
+ // Store the frameRate in g_temp1
+ // If it is < 0, the default frame rate for the ss will be used
_G(globals)[GLB_TEMP_1] = frameRate << 16;
- //an unusual way to use global regs, but a FILE* is as good a value as any other...
+ // An unusual way to use global regs, but a FILE* is as good a value as any other...
- _G(globals)[GLB_TEMP_4] = (frac16)(streamFil); //apr29
+ _G(globals)[GLB_TEMP_4] = (frac16)(streamFil);
- //set the callback trigger
+ // Set the callback trigger
_G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
- //set the layer
+ // Set the layer
_G(globals)[GLB_TEMP_6] = layer << 16;
m = kernel_spawn_machine(seriesName, HASH_STREAM_MACHINE, series_trigger_dispatch_callback);
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 55541e381e5..7a86a10727d 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -108,7 +108,9 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(game).syncGame(s);
_G(player).syncGame(s);
_G(player_info).syncGame(s);
- g_vars->getGlobals()->syncGame(s);
+
+ syncGlobals(s);
+
player_been_sync(s);
_G(conversations).syncGame(s);
_G(inventory)->syncGame(s);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index f982373abd5..3372b84ac8f 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -107,6 +107,8 @@ public:
*/
Common::Error syncGame(Common::Serializer &s);
+ virtual void syncGlobals(Common::Serializer &s) = 0;
+
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
Common::Serializer s(nullptr, stream);
return syncGame(s);
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 4eb8ebc2612..df573981959 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -82,7 +82,6 @@ public:
virtual ~Vars();
bool init();
- virtual GlobalVars *getGlobals() = 0;
virtual Interface *getInterface() = 0;
virtual Walker *getWalker() = 0;
virtual void global_menu_system_init() = 0;
@@ -183,7 +182,6 @@ public:
};
#define _G(X) (g_vars->_##X)
-#define _GV() (*g_vars->getGlobals())
#define _GI() (*g_vars->getInterface())
#define _GW() (*g_vars->getWalker())
#define _GWS(X) _G(ws)._##X
Commit: 78104eea81444d866f0a32d5013ac039e908c65b
https://github.com/scummvm/scummvm/commit/78104eea81444d866f0a32d5013ac039e908c65b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Rename Burger GlobalVars to Flags
Changed paths:
A engines/m4/burger/flags.cpp
A engines/m4/burger/flags.h
R engines/m4/burger/globals.cpp
R engines/m4/burger/globals.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index c0150e36c56..3d4806d16ac 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -52,8 +52,8 @@ void BurgerEngine::showEngineInfo() {
debug("Orion Burger tastes great!\n");
}
-void BurgerEngine::syncGlobals(Common::Serializer &s) {
- g_globals->_globals.sync(s);
+void BurgerEngine::syncFlags(Common::Serializer &s) {
+ g_globals->_flags.sync(s);
}
void BurgerEngine::global_daemon() {
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index ab75dcadf07..7b908136d07 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -55,7 +55,7 @@ public:
*/
void showEngineInfo() override;
- void syncGlobals(Common::Serializer &s) override;
+ void syncFlags(Common::Serializer &s) override;
void global_daemon() override;
};
diff --git a/engines/m4/burger/globals.cpp b/engines/m4/burger/flags.cpp
similarity index 91%
rename from engines/m4/burger/globals.cpp
rename to engines/m4/burger/flags.cpp
index a339c59801f..d3ebee89a12 100644
--- a/engines/m4/burger/globals.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/globals.h"
+#include "m4/burger/flags.h"
#include "m4/core/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_inv.h"
@@ -28,23 +28,23 @@
namespace M4 {
namespace Burger {
-#define MAX_APPS_GLOBAL_VARS 512
+#define FLAGS_COUNT 512
-GlobalVars::GlobalVars() {
- resize(MAX_APPS_GLOBAL_VARS);
+Flags::Flags() {
+ resize(FLAGS_COUNT);
}
-void GlobalVars::sync(Common::Serializer &s) {
+void Flags::sync(Common::Serializer &s) {
size_t count = size();
for (uint i = 0; i < count; ++i)
s.syncAsSint32LE((*this)[i]);
}
-void GlobalVars::reset() {
- Common::fill(&(*this)[0], &(*this)[0] + MAX_APPS_GLOBAL_VARS, 0);
+void Flags::reset() {
+ Common::fill(&(*this)[0], &(*this)[0] + FLAGS_COUNT, 0);
}
-int32 GlobalVars::get_boonsville_time_and_display(bool showTime) {
+int32 Flags::get_boonsville_time_and_display(bool showTime) {
if (showTime) {
int time = (*this)[BOONSVILLE_TIME];
int seconds = time % 60;
@@ -58,12 +58,12 @@ int32 GlobalVars::get_boonsville_time_and_display(bool showTime) {
return (*this)[BOONSVILLE_TIME];
}
-void GlobalVars::set_boonsville_time(int32 time) {
+void Flags::set_boonsville_time(int32 time) {
(*this)[BOONSVILLE_TIME] = time;
(*this)[BOONSVILLE_TIME2] = time - 1;
}
-void GlobalVars::reset1() {
+void Flags::reset1() {
set_boonsville_time(0);
(*this)[V000] = 1000;
inv_give_to_player("money");
@@ -133,7 +133,7 @@ void GlobalVars::reset1() {
conv_reset_all();
}
-void GlobalVars::reset2() {
+void Flags::reset2() {
if ((*this)[V245] != 10027)
inv_give_to_player("BLOCK OF ICE");
if ((*this)[V277] == 6003)
@@ -163,7 +163,7 @@ void GlobalVars::reset2() {
}
}
-void GlobalVars::reset3() {
+void Flags::reset3() {
if (inv_player_has("BOTTLE")) {
inv_give_to_player("CARROT JUICE");
inv_move_object("BOTTLE", NOWHERE);
@@ -194,7 +194,7 @@ void GlobalVars::reset3() {
(*this)[V145] = 0;
}
-void GlobalVars::reset4() {
+void Flags::reset4() {
(*this)[V186] = 0;
(*this)[V234] = 0;
(*this)[V196] = 0;
@@ -245,7 +245,7 @@ void GlobalVars::reset4() {
(*this)[V237] = 0;
}
-void GlobalVars::reset5() {
+void Flags::reset5() {
if ((*this)[V159])
inv_give_to_player("DEED");
diff --git a/engines/m4/burger/globals.h b/engines/m4/burger/flags.h
similarity index 98%
rename from engines/m4/burger/globals.h
rename to engines/m4/burger/flags.h
index 7b5e2ecaede..e96782fa63f 100644
--- a/engines/m4/burger/globals.h
+++ b/engines/m4/burger/flags.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_BURGER_GLOBALS_H
-#define M4_BURGER_GLOBALS_H
+#ifndef M4_BURGER_FLAGS_H
+#define M4_BURGER_FLAGS_H
#include "common/array.h"
#include "common/serializer.h"
@@ -549,11 +549,11 @@ enum {
V511 = 511
};
-class GlobalVars : public Common::Array<uint32> {
+class Flags : public Common::Array<uint32> {
private:
Common::Array<byte> _convSave;
public:
- GlobalVars();
+ Flags();
/**
* Reset the variables back to initial game state
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 8d0d90266af..50c8e27f5bf 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -126,13 +126,13 @@ void Vars::initialize_game() {
inv_give_to_player("MONEY");
// Reset the global variables
- _globals.reset();
- _globals.reset1();
- _globals.reset2();
- _globals.reset3();
- _globals.reset4();
- _globals.reset5();
- _globals.conv_reset_all();
+ _flags.reset();
+ _flags.reset1();
+ _flags.reset2();
+ _flags.reset3();
+ _flags.reset4();
+ _flags.reset5();
+ _flags.conv_reset_all();
}
void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index eb307b59d5f..7450070894c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -26,8 +26,8 @@
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
#include "m4/burger/gui/interface.h"
+#include "m4/burger/flags.h"
#include "m4/burger/inventory.h"
-#include "m4/burger/globals.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
@@ -76,7 +76,7 @@ protected:
void main_cold_data_init() override;
public:
- Burger::GlobalVars _globals;
+ Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
SeriesPlayers _seriesPlayers;
@@ -110,7 +110,6 @@ extern Vars *g_globals;
#define _G(X) (::M4::Burger::g_globals->_##X)
#define _GI(X) _G(interface)._##X
#define _GINT() _G(interface)
-#define VAL(X) _G(_globals)[X]
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 7a86a10727d..fde0c77e2f6 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -109,7 +109,7 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(player).syncGame(s);
_G(player_info).syncGame(s);
- syncGlobals(s);
+ syncFlags(s);
player_been_sync(s);
_G(conversations).syncGame(s);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 3372b84ac8f..6774d9b2e55 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -107,7 +107,7 @@ public:
*/
Common::Error syncGame(Common::Serializer &s);
- virtual void syncGlobals(Common::Serializer &s) = 0;
+ virtual void syncFlags(Common::Serializer &s) = 0;
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
Common::Serializer s(nullptr, stream);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index f0b57c71b27..32c6dc752d4 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -86,7 +86,7 @@ MODULE_OBJS = \
burger/rooms/section9/section9.o \
burger/rooms/section9/room951.o \
burger/burger.o \
- burger/globals.o \
+ burger/flags.o \
burger/hotkeys.o \
burger/inventory.o \
burger/series_player.o \
Commit: 6efb03ade9f76569e429466b4f6b4f2c5673bf47
https://github.com/scummvm/scummvm/commit/6efb03ade9f76569e429466b4f6b4f2c5673bf47
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix casting pointers to numbers
Changed paths:
engines/m4/wscript/ws_cruncher.cpp
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index a2ee1c70897..330b28ce132 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -1378,7 +1378,7 @@ bool CrunchAnim8(Anim8 *myAnim8) {
while (_GWS(keepProcessing)) {
dbg_SetCurrSequInstr(myAnim8, _GWS(compareCCR));
- myPC = (uint32 *)((int32)*(myAnim8->sequHandle) + myAnim8->pcOffset);
+ myPC = (uint32 *)((byte *)*(myAnim8->sequHandle) + myAnim8->pcOffset);
oldPC = myPC;
_GWS(pcOffsetOld) = myAnim8->pcOffset;
@@ -1386,7 +1386,7 @@ bool CrunchAnim8(Anim8 *myAnim8) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025c, nullptr);
}
- myAnim8->pcOffset += (int32)myPC - (int32)oldPC;
+ myAnim8->pcOffset += (byte *)myPC - (byte *)oldPC;
pCodeJmpTable[myInstruction](myAnim8);
}
Commit: 6443afd1acfe24f71421f84b39d1de7eeb857a23
https://github.com/scummvm/scummvm/commit/6443afd1acfe24f71421f84b39d1de7eeb857a23
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Setting up Globals to handle both numbers and pointers
The series_stream method sets GLB_TEMP_4 to a SysFile pointer,
which was bad since on some systems the ptr size may be greater.
This tentative implementation encapsulates both a numeric and
pointer array, and provides seameless get/sets for either type,
as well as validating a pointer can't be read as a number,
or vice versa
Changed paths:
engines/m4/core/globals.cpp
engines/m4/core/globals.h
engines/m4/graphics/gr_series.cpp
engines/m4/vars.cpp
engines/m4/vars.h
diff --git a/engines/m4/core/globals.cpp b/engines/m4/core/globals.cpp
index 6e41d40c920..d2990641f4d 100644
--- a/engines/m4/core/globals.cpp
+++ b/engines/m4/core/globals.cpp
@@ -22,12 +22,11 @@
#include "m4/core/globals.h"
namespace M4 {
-/*
-void GlobalVars::syncGame(Common::Serializer &s) {
- size_t count = size();
- for (uint i = 0; i < count; ++i)
- s.syncAsSint32LE((*this)[i]);
+
+Globals::Globals() {
+ Common::fill(&_numData[0], &_numData[GLB_SCRATCH_VARS], 0);
+ Common::fill(&_ptrData[0], &_ptrData[GLB_SCRATCH_VARS], (void *)nullptr);
+ Common::fill(&_isPtr[0], &_isPtr[GLB_SHARED_VARS], false);
}
-*/
} // namespace M4
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index fd3aac42023..a234055d72e 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -28,12 +28,13 @@
#include "common/array.h"
#include "common/serializer.h"
+#include "m4/fileio/sys_file.h"
#include "m4/m4_types.h"
namespace M4 {
/**
- *
+ * Global entry constants
*/
enum {
GLB_TIME = 0,
@@ -83,11 +84,69 @@ enum {
constexpr int GLB_SHARED_VARS = 256;
-/*
-struct GlobalVars : public Common::Array<int32> {
- //void syncGame(Common::Serializer &s);
+/**
+ * Globals array class.
+ * This design is complicated by the fact that the original sometimes used it
+ * to store pointers as well as numbers, assuming they were 32-bits. Because of this,
+ * the new Globals class has to support both
+ */
+class Globals {
+ struct Entry {
+ private:
+ uint32 &_numValue;
+ void *&_ptrValue;
+ bool &_isPtr;
+ public:
+ Entry(uint32 &numValue, void *&ptrValue, bool &isPtr) :
+ _numValue(numValue), _ptrValue(ptrValue), _isPtr(isPtr) {
+ }
+
+ operator uint32() const {
+ assert(!_isPtr);
+ return _numValue;
+ }
+ template<class T>
+ operator T *() const {
+ assert(_isPtr);
+ return (T *)_ptrValue;
+ }
+ Entry &operator=(uint32 val) {
+ _isPtr = false;
+ _numValue = val;
+ return *this;
+ }
+ template<class T>
+ Entry &operator=(T *val) {
+ _isPtr = true;
+ _ptrValue = val;
+ return *this;
+ }
+ };
+private:
+ frac16 _numData[GLB_SHARED_VARS];
+ void *_ptrData[GLB_SHARED_VARS];
+ bool _isPtr[GLB_SCRATCH_VARS];
+public:
+ Globals();
+
+ /**
+ * Dummy operator to allow for original code that did !globals to see if
+ * the globals array had been created
+ */
+ bool operator!() const { return false; }
+
+ /**
+ * Accesses the numeric array. Needed by several wscript methods
+ */
+ frac16 *getData() {
+ return _numData;
+ }
+
+ Entry operator[](uint idx) {
+ assert(idx < GLB_SHARED_VARS);
+ return Entry(_numData[idx], _ptrData[idx], _isPtr[idx]);
+ }
};
-*/
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index fee1da6bc33..a108cb3b082 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -64,15 +64,14 @@ machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger) {
machine *m;
- StreamFile *streamFil = new StreamFile(seriesName);
+ SysFile *sysFile = new SysFile(seriesName);
// Store the frameRate in g_temp1
// If it is < 0, the default frame rate for the ss will be used
_G(globals)[GLB_TEMP_1] = frameRate << 16;
- // An unusual way to use global regs, but a FILE* is as good a value as any other...
-
- _G(globals)[GLB_TEMP_4] = (frac16)(streamFil);
+ // Store the SysFile pointer
+ _G(globals)[GLB_TEMP_4] = sysFile;
// Set the callback trigger
_G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index c7e43241bc6..bf1ca6ec984 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -88,7 +88,7 @@ bool Vars::init() {
gr_font_set(_font_inter);
if (_cheat_keys_enabled) {
- if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals))
+ if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals.getData()))
error(FL, 'DWIF');
}
@@ -229,7 +229,7 @@ void Vars::fire_up_gui() {
bool Vars::woodscript_init() {
if (!InitWSAssets())
return false;
- if (!ws_Initialize(_G(globals)))
+ if (!ws_Initialize(_G(globals).getData()))
return false;
return true;
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index df573981959..b8ba19193ab 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -95,7 +95,7 @@ public:
Hag_Statics _hag;
SceneDef _currentSceneDef;
Scene_list _scene_list;
- frac16 _globals[GLB_SHARED_VARS];
+ Globals _globals;
Player _player;
PlayerInfo _player_info;
Resources _resources;
Commit: c5777ab224cae5ca56c19ede8d68aa7bfc76b069
https://github.com/scummvm/scummvm/commit/c5777ab224cae5ca56c19ede8d68aa7bfc76b069
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Formatting fixes
Changed paths:
engines/m4/graphics/gr_series.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_cruncher.h
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index a108cb3b082..443ee20dd3a 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -30,7 +30,7 @@ namespace M4 {
#define CHECK_SERIES if (!_G(globals)) error_show(FL, 'SERI');
-static void series_trigger_dispatch_callback(frac16 myMessage, struct machine * /*sender*/) {
+static void series_trigger_dispatch_callback(frac16 myMessage, machine * /*sender*/) {
kernel_trigger_dispatch(myMessage);
}
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 330b28ce132..3b455ab2a8d 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -389,7 +389,7 @@ bool ws_ResumeAnim8(Anim8 *myAnim8) {
}
static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **argPtr, frac16 *argValue) {
- int32 myIndex;
+ int32 myIndex;
Anim8 *parentAnim8;
frac16 *dataArray;
@@ -446,13 +446,13 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
// Dereferrence the dataHandle, add the offset to find the array of data for this anim8
dataArray = (frac16 *)((int32) * (myAnim8->dataHandle) + myAnim8->dataOffset);
- // Copy the data field into _GWS(dataArg1), and set _GWS(myArg1) to point to this location
+ // Copy the data field into dataArg1, and set myArg1 to point to this location
*argValue = dataArray[myIndex];
*argPtr = argValue;
break;
}
} else if (myFormat == FMT_GLOBAL_SRC) {
- // Else if the format indicates the argument is from the _GWS(ws_globals) register set
+ // Else if the format indicates the argument is from the ws_globals register set
// Find out if the index has been previously stored in a special index register
if (myData & REG_SET_IDX_REG) {
myIndex = _GWS(indexReg);
@@ -461,36 +461,29 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
myIndex = myData & REG_SET_IDX;
}
- // Finally, set _GWS(myArg1) to point to the location in the _GWS(ws_globals) array, whichever index
+ // Finally, set myArg1 to point to the location in the ws_globals array, whichever index
*argPtr = &(_GWS(ws_globals)[myIndex]);
} else {
// Else the argument is not a variable, but an actual value
// The top bit of the data segment is a negative flag, the format determines how far the other
// 15 bits of the data segment are shifted left, so the value requested is in frac16 format.
- // The value is stored in a static frac16 (_GWS(dataArg1)), and...
+ // The value is stored in the frac16 (dataArg1), and...
if (myData & OP_DATA_SIGN) {
*argValue = -(myData & OP_DATA_VALUE) << (dataFormats[myFormat - 3]);
} else {
*argValue = (myData & OP_DATA_VALUE) << (dataFormats[myFormat - 3]);
}
- //_GWS(myArg1) will point to this location
+ // myArg1 will point to this location
*argPtr = argValue;
}
return true;
}
-// The instruction number is returned by this function, and the arguments are pointed to by these externable globals
-// Frac16 *_GWS(myArg1);
-// Frac16 *_GWS(myArg2);
-// Frac16 *_GWS(myArg3);
-//
-//
-
int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8) {
- int32 myInstruction, myFormat, myData; // myIndex;
+ int32 myInstruction, myFormat, myData; // myIndex;
uint32 *myPC, opCode, word2;
if (!PC) {
@@ -1253,11 +1246,16 @@ static void op_OPEN_STREAM_SS(Anim8 *myAnim8) {
myCCB = myAnim8->myCCB;
ShowCCB(myCCB);
myCCB->flags |= CCB_SKIP;
+
if (!ws_OpenSSstream((StreamFile *)(*_GWS(myArg1)), myAnim8)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0258, "open_ss_stream() failed.");
}
- if (myAnim8->myRegs[IDX_W] < 0) myAnim8->myRegs[IDX_W] = -myCCB->source->w << 16;
- else myAnim8->myRegs[IDX_W] = myCCB->source->w << 16;
+
+ if (myAnim8->myRegs[IDX_W] < 0)
+ myAnim8->myRegs[IDX_W] = -myCCB->source->w << 16;
+ else
+ myAnim8->myRegs[IDX_W] = myCCB->source->w << 16;
+
myAnim8->myRegs[IDX_H] = myCCB->source->h << 16;
_GWS(mapTheCel) = true;
}
@@ -1582,9 +1580,7 @@ bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount) {
return true;
}
-
void ws_CancelOnEndSeq(Anim8 *myAnim8) {
-
// Make sure the cruncher has been initialized
VERIFY_INTIALIZED("ws_CancelOnEndSeq()");
diff --git a/engines/m4/wscript/ws_cruncher.h b/engines/m4/wscript/ws_cruncher.h
index af1572bfb87..e69c8552d08 100644
--- a/engines/m4/wscript/ws_cruncher.h
+++ b/engines/m4/wscript/ws_cruncher.h
@@ -119,7 +119,17 @@ extern void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8);
extern bool ws_PauseAnim8(Anim8 *myAnim8);
extern bool ws_ResumeAnim8(Anim8 *myAnim8);
+
+/**
+ * Pre-processes a pcode instruction parameters.
+ * The instruction number is returned by this function, and the arguments are
+ * pointed to by these external globals:
+ * Frac16 *myArg1
+ * Frac16 *myArg2
+ * Frac16 *myArg3
+ */
extern int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8);
+
extern void ws_CrunchAnim8s(int16 *depth_table);
extern void ws_CrunchEOSreqs();
extern bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount);
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 2fd2443d373..a53078c2213 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1694,7 +1694,7 @@ bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
uint32 maxFrameSize;
// Verify the parameters
- if ((!streamFile) || (!anim8) || (!anim8->myCCB)) {
+ if (!streamFile || !anim8 || !anim8->myCCB) {
ws_LogErrorMsg(FL, "SysFile* streamFile invalid.");
return false;
}
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index aa1d1d1e440..18a8c2c5057 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -649,7 +649,7 @@ void AddPauseTime(int32 myTime) {
_GWS(pauseTime) += myTime;
}
-void CycleEngines(Buffer * cleanBackground, int16 * depth_table, GrBuff * screenCodes, uint8 * myPalette, uint8 * ICT, bool updateVideo) {
+void CycleEngines(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT, bool updateVideo) {
int32 clockTime;
dbg_DebugNextCycle();
@@ -678,7 +678,7 @@ void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrB
screenCodes, myPalette, ICT);
}
-static void CancelAllEngineReqs(machine * m) {
+static void CancelAllEngineReqs(machine *m) {
globalMsgReq *myGMsg, *tempGMsg;
//---- CANCEL CRUNCHER REQS
@@ -709,7 +709,7 @@ static void CancelAllEngineReqs(machine * m) {
}
-static void ShutdownMachine(machine * m) {
+static void ShutdownMachine(machine *m) {
dbg_RemoveWSMach(m);
if (m->myAnim8) {
@@ -766,7 +766,7 @@ void TerminateMachinesByHash(uint32 machHash) {
}
}
-void TerminateMachine(machine * myMachine) {
+void TerminateMachine(machine *myMachine) {
if ((!myMachine) || (!VerifyMachineExists(myMachine))) {
return;
}
@@ -776,7 +776,7 @@ void TerminateMachine(machine * myMachine) {
}
-bool VerifyMachineExists(machine * m) {
+bool VerifyMachineExists(machine *m) {
machine *tempM;
// Parameter verification
@@ -831,7 +831,7 @@ int32 ws_KillMachines() {
// This is the proc designed to evaluate the instructions of the state machine
-static int32 StepAt(int32 * pcOffset, machine * m) {
+static int32 StepAt(int32 *pcOffset, machine *m) {
bool keepProcessing;
int32 myInstruction;
Anim8 *myAnim8;
@@ -876,7 +876,7 @@ static int32 StepAt(int32 * pcOffset, machine * m) {
}
-void ws_StepWhile(machine * m, int32 pcOffset, int32 pcCount) {
+void ws_StepWhile(machine *m, int32 pcOffset, int32 pcCount) {
int32 myInstruction, oldPC;
uint32 machID, recurseLevel;
@@ -915,7 +915,7 @@ void ws_StepWhile(machine * m, int32 pcOffset, int32 pcCount) {
// When a state machine enters a new state, every request and command is
// evaluated immediately.
-void IntoTheState(machine * m) {
+void IntoTheState(machine *m) {
int32 myInstruction;
uint32 *stateTable, machID, recurseLevel;
int32 pcOffset;
@@ -1020,7 +1020,7 @@ enum {
};
-static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine * recvM, int32 whichList, machine * sendM) {
+static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32 whichList, machine *sendM) {
bool found;
msgRequest *myMsg = nullptr, *prevMsg;
int32 pcOffset, pcCount;
@@ -1104,8 +1104,8 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine * recvM, int3
// This proc is what allows a machine to send a message to another machine(s)
-void SendWSMessage(uint32 msgHash, frac16 msgValue, machine * recvM,
- uint32 machHash, machine * sendM, int32 msgCount) {
+void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
+ uint32 machHash, machine *sendM, int32 msgCount) {
bool found, more_to_send;
machine *currMachine;
Commit: f8d0c8875620e03daccae6c892efaed172a2ac6a
https://github.com/scummvm/scummvm/commit/f8d0c8875620e03daccae6c892efaed172a2ac6a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix various pointer casts to ints
Changed paths:
engines/m4/fileio/fstream.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 92a52828f64..4c44f5a36d5 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -245,7 +245,7 @@ static bool UnwrapStream(strmRequest *myStream) {
if (myStream->strmHead > myStream->strmBuff) {
// Calculate how many bytes to store and copy to a temporary buffer
- bytesToMove = (int32)myStream->strmHead - (int32)myStream->strmBuff;
+ bytesToMove = (byte *)myStream->strmHead - (byte *)myStream->strmBuff;
if ((tempBuff = (uint8 *)mem_alloc(bytesToMove, "stream temp buff")) == nullptr)
error_show(FL, 'OOM!', "UnwrapStream() failed - temp buff avail: %ld", bytesToMove);
@@ -254,10 +254,10 @@ static bool UnwrapStream(strmRequest *myStream) {
}
// Move the data at the end of the buffer to the beginning and reset the strmWrap pointer
- bytesAvail = (int32)myStream->strmWrap - (int32)myStream->strmTail;
+ bytesAvail = (byte *)myStream->strmWrap - (byte *)myStream->strmTail;
memmove(myStream->strmBuff, myStream->strmTail, bytesAvail);
myStream->strmTail = myStream->strmBuff;
- myStream->strmHead = (uint8 *)((int32)(myStream->strmTail) + bytesAvail);
+ myStream->strmHead = (uint8 *)((byte *)(myStream->strmTail) + bytesAvail);
myStream->strmWrap = myStream->endStrmBuff;
// Now check if we temporarily store data. if so, copy it back to the stream and turf the temp buffer
@@ -297,7 +297,7 @@ int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes) {
// If the stream tail is > the stream head, and the number of bytes at the end of the buffer is < numBytes
// we must unwrap the stream, moving the data at the end of the buffer to the beginning, and slide the beginning down
- if ((myStream->strmTail > myStream->strmHead) && (((int32)myStream->strmWrap - (int32)myStream->strmTail) < numBytes)) {
+ if ((myStream->strmTail > myStream->strmHead) && (((byte *)myStream->strmWrap - (byte *)myStream->strmTail) < numBytes)) {
UnwrapStream(myStream);
}
@@ -342,7 +342,7 @@ int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes) {
// Move the data to the beginning of the stream buffer, and reset the head and tail pointers
memmove((void *)myStream->strmBuff, myStream->strmTail, bytesAvail);
myStream->strmTail = myStream->strmBuff;
- myStream->strmHead = (uint8 *)((int32)myStream->strmTail + bytesAvail);
+ myStream->strmHead = (uint8 *)((byte *)myStream->strmTail + bytesAvail);
}
// If the client is using a blockSizeArray, hopefully bytesNeeded will be equal to the next blockSize
@@ -435,7 +435,7 @@ void f_stream_Process(int32 numToProcess) {
// Calculate the amount of empty space in the stream buff
// If all the empty space in the stream buff is between the head and the lastRead...
if (myStream->strmLastRead >= myStream->strmHead) {
- bytesAvail = (int32)myStream->strmLastRead - (int32)myStream->strmHead;
+ bytesAvail = (byte *)myStream->strmLastRead - (byte *)myStream->strmHead;
// strmTail and strmHead can never equal unless the buffer is completely empty, therefore,
// make sure the amout of bytes available won't cause strmHead to become equal to strmTail
@@ -447,8 +447,8 @@ void f_stream_Process(int32 numToProcess) {
buffWrap = true;
// Calculate how much space is available at the start and at the end of the buffer
- buffEndBytesAvail = (int32)myStream->endStrmBuff - (int32)myStream->strmHead;
- buffStartBytesAvail = (int32)myStream->strmLastRead - (int32)myStream->strmBuff;
+ buffEndBytesAvail = (byte *)myStream->endStrmBuff - (byte *)myStream->strmHead;
+ buffStartBytesAvail = (byte *)myStream->strmLastRead - (byte *)myStream->strmBuff;
// As above, ensure strmHead won't become equal to strmTail
if ((buffStartBytesAvail > 0) && (myStream->strmLastRead == myStream->strmTail)) {
@@ -513,7 +513,7 @@ void f_stream_Process(int32 numToProcess) {
}
// Update the stream head
- myStream->strmHead = (uint8 *)((int32)myStream->strmBuff + bytesRead);
+ myStream->strmHead = (uint8 *)((byte *)myStream->strmBuff + bytesRead);
// Update the blockSizeArray pointer if necessary
if (useBlockSizeArray) {
@@ -553,7 +553,7 @@ void f_stream_Process(int32 numToProcess) {
}
// Update the head pointer
- myStream->strmHead = (uint8 *)((int32)myStream->strmBuff + bytesRead);
+ myStream->strmHead = (uint8 *)((byte *)myStream->strmBuff + bytesRead);
// Update the blockSizeArray pointer if necessary
if (useBlockSizeArray) {
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index c48c02d8961..7ca474d3769 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -192,7 +192,7 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
if (mySprite->sourceHandle) {
HLock(mySprite->sourceHandle);
- mySprite->data = (uint8 *)((int32) * (mySprite->sourceHandle) + mySprite->sourceOffset);
+ mySprite->data = (uint8 *)((byte *)*(mySprite->sourceHandle) + mySprite->sourceOffset);
drawSpriteBuff.W = mySprite->w;
drawSpriteBuff.stride = mySprite->w;
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 3b455ab2a8d..1f166564c19 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -444,7 +444,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
}
// Dereferrence the dataHandle, add the offset to find the array of data for this anim8
- dataArray = (frac16 *)((int32) * (myAnim8->dataHandle) + myAnim8->dataOffset);
+ dataArray = (frac16 *)((byte *)*(myAnim8->dataHandle) + myAnim8->dataOffset);
// Copy the data field into dataArg1, and set myArg1 to point to this location
*argValue = dataArray[myIndex];
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 1ee7effe65f..7617f3f8fbb 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -167,7 +167,7 @@ void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCo
}
// Lock the sprite handle
HLock(source->sourceHandle);
- source->data = (uint8 *)((int32) * (source->sourceHandle) + source->sourceOffset);
+ source->data = (uint8 *)((byte *)*(source->sourceHandle) + source->sourceOffset);
}
RendGrBuff Destination;
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index a53078c2213..a37851a6400 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -351,7 +351,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the resource name, and the offset into the resource block
_GWS(globalSEQUnames)[*chunkHash] = mem_strdup(wsAssetName);
_GWS(globalSEQUHandles)[*chunkHash] = workHandle;
- _GWS(globalSEQUoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+ _GWS(globalSEQUoffsets)[*chunkHash] = (byte *)parseAssetPtr - (byte *)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -390,7 +390,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the resource name, and the offset into the resource block
_GWS(globalDATAnames)[*chunkHash] = mem_strdup(wsAssetName);
_GWS(globalDATAHandles)[*chunkHash] = workHandle;
- _GWS(globalDATAoffsets)[*chunkHash] = (int32)parseAssetPtr - (int32)mainAssetPtr;
+ _GWS(globalDATAoffsets)[*chunkHash] = (byte *)parseAssetPtr - (byte *)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -437,12 +437,12 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the Handle, and calculate the offsets
_GWS(globalCELSHandles)[*chunkHash] = workHandle;
if (celsPtr) {
- _GWS(globalCELSoffsets)[*chunkHash] = (int32)celsPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSoffsets)[*chunkHash] = (byte *)celsPtr - (byte *)mainAssetPtr;
} else {
_GWS(globalCELSoffsets)[*chunkHash] = -1;
}
if (palPtr) {
- _GWS(globalCELSPaloffsets)[*chunkHash] = (int32)palPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[*chunkHash] = (byte *)palPtr - (byte *)mainAssetPtr;
} else {
_GWS(globalCELSPaloffsets)[*chunkHash] = -1;
}
@@ -485,7 +485,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
// Find the cels source from the asset block
HLock(resourceHandle);
- celsPtr = (uint32 *)((int32)*resourceHandle + handleOffset);
+ celsPtr = (uint32 *)((byte *)*resourceHandle + handleOffset);
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
@@ -519,7 +519,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
mySprite->data = (uint8 *)&myCelSource[CELS_DATA];
if ((mySprite->w > 0) && (mySprite->h > 0)) {
- mySprite->sourceOffset = (int32)((int32)(mySprite->data) - (int32)*resourceHandle);
+ mySprite->sourceOffset = (int32)((byte *)(mySprite->data) - (byte *)*resourceHandle);
} else {
mySprite->sourceOffset = 0;
}
@@ -559,8 +559,8 @@ int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *ce
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
- *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
+ *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
HUnLock(workHandle);
@@ -608,8 +608,8 @@ int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
- *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
+ *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
HUnLock(workHandle);
return celsSize;
@@ -626,7 +626,7 @@ bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH)
// Lock the handle, and get the cels source
HLock(ssHandle);
- celsPtr = (int32 *)((int32)*ssHandle + ssOffset);
+ celsPtr = (int32 *)((byte *)*ssHandle + ssOffset);
// Return the values
if (maxW) {
@@ -682,7 +682,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Get the pointer to the pal data
#ifdef TODO
workHandle = _GWS(globalCELSHandles)[hash];
- palPtr = (int32 *)((int32)*workHandle + _GWS(globalCELSPaloffsets)[hash]);
+ palPtr = (int32 *)((byte *)*workHandle + _GWS(globalCELSPaloffsets)[hash]);
#else
error("TODO: Figure out dereferencing");
#endif
@@ -730,12 +730,12 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Store the Handle, and calculate the offsets
_GWS(globalCELSHandles)[emptySlot] = workHandle;
if (celsPtr) {
- _GWS(globalCELSoffsets)[emptySlot] = (int32)celsPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSoffsets)[emptySlot] = (byte *)celsPtr - (byte *)mainAssetPtr;
} else {
_GWS(globalCELSoffsets)[emptySlot] = -1;
}
if (palPtr) {
- _GWS(globalCELSPaloffsets)[emptySlot] = (int32)palPtr - (int32)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[emptySlot] = (byte *)palPtr - (byte *)mainAssetPtr;
} else {
_GWS(globalCELSPaloffsets)[emptySlot] = -1;
}
@@ -751,7 +751,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
#ifdef TODO
workHandle = _GWS(globalCELSHandles)[i];
HLock(workHandle);
- palPtr = (int32 *)((int32)*workHandle + _GWS(globalCELSPaloffsets)[i]);
+ palPtr = (int32 *)((byte *)*workHandle + _GWS(globalCELSPaloffsets)[i]);
#else
error("TODO: Figure out dereferencing");
#endif
@@ -925,7 +925,7 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
return -1;
}
- if (((int32)endOfAssetBlock - (int32)data) < (int32)*celsSize) {
+ if (((byte *)endOfAssetBlock - (byte *)data) < (int32)*celsSize) {
ws_LogErrorMsg(FL, "SS info is larger than asset block.");
return -1;
}
@@ -1066,8 +1066,8 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
- *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
+ *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
HUnLock(workHandle);
@@ -1119,8 +1119,8 @@ int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (int32)celsPtr - (int32)mainAssetPtr;
- *palOffset = (int32)palPtr - (int32)mainAssetPtr;
+ *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
+ *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
HUnLock(workHandle);
return celsSize;
@@ -1380,7 +1380,7 @@ MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
sequPtr = (uint32 *)((uint32)*(_GWS(globalSEQUHandles)[hash]) + (uint32)(_GWS(globalSEQUoffsets)[hash]));
// Return the offset into the resource chunk, and the number of local vars used by the sequence
- *offset = (int32)(&sequPtr[SEQU_SEQU_START]) - (int32) * (_GWS(globalSEQUHandles)[hash]);
+ *offset = (byte *)(&sequPtr[SEQU_SEQU_START]) - (byte *)*(_GWS(globalSEQUHandles)[hash]);
*numLocalVars = sequPtr[SEQU_NUM_VARS];
// Return the resource handle
@@ -1417,8 +1417,8 @@ MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int
// Set the number of states, the state offset table, the start of the mach instructions
*numStates = (int32)machPtr[MACH_NUM_STATES];
- *stateTableOffset = (int32)(&machPtr[MACH_OFFSETS]) - (int32)(*_GWS(globalMACHHandles)[hash]);
- *machInstrOffset = (int32)((int32)machPtr + ((*numStates + 1) << 2)) - (int32)(*_GWS(globalMACHHandles)[hash]);
+ *stateTableOffset = (byte *)(&machPtr[MACH_OFFSETS]) - (byte *)(*_GWS(globalMACHHandles)[hash]);
+ *machInstrOffset = ((byte *)machPtr + ((*numStates + 1) << 2)) - (byte *)(*_GWS(globalMACHHandles)[hash]);
//unlock and return the handle
HUnLock(_GWS(globalMACHHandles)[hash]);
@@ -1457,8 +1457,8 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
return nullptr;
}
- *rowOffset = (int32)((uint32)(&dataPtr[DATA_REC_START]) + ((index * dataPtr[DATA_REC_SIZE]) << 2) -
- (int32)(*_GWS(globalDATAHandles)[hash]));
+ *rowOffset = (int32)((byte *)(&dataPtr[DATA_REC_START]) + ((index * dataPtr[DATA_REC_SIZE]) << 2)
+ - (byte *)(*_GWS(globalDATAHandles)[hash]));
// Return the data handle
return _GWS(globalDATAHandles)[hash];
}
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 18a8c2c5057..d18735c0331 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -529,7 +529,7 @@ static bool op_TRIG_W(machine *m, int32 *pcOffset) {
}
// Now find the new pcOffset
- *pcOffset += (int32)myPC - (int32)oldPC;
+ *pcOffset += (byte *)myPC - (byte *)oldPC;
if (!_GWS(myArg1)) {
ws_Error(m, ERR_MACH, 0x0263, "trig_w instruction requires a data hash specified by a second pCode.");
@@ -852,7 +852,7 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
}
// Now find the new pcOffset
- *pcOffset += (int32)myPC - (int32)oldPC;
+ *pcOffset += (byte *)myPC - (byte *)oldPC;
if (myInstruction >= 64) {
condOpTable[myInstruction - 64](m, pcOffset);
Commit: 5cb61c4e22d48450c68ba09d9d06a46c60c6dd0d
https://github.com/scummvm/scummvm/commit/5cb61c4e22d48450c68ba09d9d06a46c60c6dd0d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Simplify regs array access in ExtractArg
Changed paths:
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 1f166564c19..0713de2af11 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -423,7 +423,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
}
return false;
}
- *argPtr = (frac16 *)((uint32)parentAnim8->myRegs + (myIndex << 2));
+ *argPtr = &parentAnim8->myRegs[myIndex];
break;
case LOCAL_FMT_REG:
@@ -433,7 +433,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
IDX_COUNT + myAnim8->numLocalVars, myIndex);
return false;
}
- *argPtr = (frac16 *)((uint32)myAnim8->myRegs + (myIndex << 2));
+ *argPtr = &myAnim8->myRegs[myIndex];
break;
case LOCAL_FMT_DATA:
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index a37851a6400..66aeb24c990 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1420,7 +1420,7 @@ MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int
*stateTableOffset = (byte *)(&machPtr[MACH_OFFSETS]) - (byte *)(*_GWS(globalMACHHandles)[hash]);
*machInstrOffset = ((byte *)machPtr + ((*numStates + 1) << 2)) - (byte *)(*_GWS(globalMACHHandles)[hash]);
- //unlock and return the handle
+ // Unlock and return the handle
HUnLock(_GWS(globalMACHHandles)[hash]);
return _GWS(globalMACHHandles)[hash];
}
Commit: 57860d338f3e5e6dd0f7433fb889b0f0e5db9492
https://github.com/scummvm/scummvm/commit/57860d338f3e5e6dd0f7433fb889b0f0e5db9492
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Simplify globals array holding pointers, gr_series.cpp sysfile pointer
Changed paths:
engines/m4/burger/vars.cpp
engines/m4/core/globals.cpp
engines/m4/core/globals.h
engines/m4/fileio/fstream.cpp
engines/m4/fileio/fstream.h
engines/m4/fileio/sys_file.cpp
engines/m4/fileio/sys_file.h
engines/m4/graphics/gr_series.cpp
engines/m4/m4_types.h
engines/m4/vars.cpp
engines/m4/vars.h
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_load.h
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 50c8e27f5bf..9048fb674e1 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -75,6 +75,8 @@ Vars::Vars() {
Inventory *inv = new Inventory();
_inventory = inv;
+
+ Common::fill(&_globals[0], &_globals[GLB_SHARED_VARS], 0);
}
Vars::~Vars() {
diff --git a/engines/m4/core/globals.cpp b/engines/m4/core/globals.cpp
index d2990641f4d..c6a355618e8 100644
--- a/engines/m4/core/globals.cpp
+++ b/engines/m4/core/globals.cpp
@@ -23,10 +23,4 @@
namespace M4 {
-Globals::Globals() {
- Common::fill(&_numData[0], &_numData[GLB_SCRATCH_VARS], 0);
- Common::fill(&_ptrData[0], &_ptrData[GLB_SCRATCH_VARS], (void *)nullptr);
- Common::fill(&_isPtr[0], &_isPtr[GLB_SHARED_VARS], false);
-}
-
} // namespace M4
diff --git a/engines/m4/core/globals.h b/engines/m4/core/globals.h
index a234055d72e..fb233ac4a03 100644
--- a/engines/m4/core/globals.h
+++ b/engines/m4/core/globals.h
@@ -78,76 +78,12 @@ enum {
GLB_TEMP_31 = 37,
GLB_TEMP_32 = 38,
- GLB_SCRATCH_VARS = 7, // 19-16 globals reserved for the compiler
+ GLB_SCRATCH_VARS = 7, // 19-16 globals reserved for the compiler
GLB_USER_VARS = 17 // 17+ globals for the applications programmer
};
constexpr int GLB_SHARED_VARS = 256;
-/**
- * Globals array class.
- * This design is complicated by the fact that the original sometimes used it
- * to store pointers as well as numbers, assuming they were 32-bits. Because of this,
- * the new Globals class has to support both
- */
-class Globals {
- struct Entry {
- private:
- uint32 &_numValue;
- void *&_ptrValue;
- bool &_isPtr;
- public:
- Entry(uint32 &numValue, void *&ptrValue, bool &isPtr) :
- _numValue(numValue), _ptrValue(ptrValue), _isPtr(isPtr) {
- }
-
- operator uint32() const {
- assert(!_isPtr);
- return _numValue;
- }
- template<class T>
- operator T *() const {
- assert(_isPtr);
- return (T *)_ptrValue;
- }
- Entry &operator=(uint32 val) {
- _isPtr = false;
- _numValue = val;
- return *this;
- }
- template<class T>
- Entry &operator=(T *val) {
- _isPtr = true;
- _ptrValue = val;
- return *this;
- }
- };
-private:
- frac16 _numData[GLB_SHARED_VARS];
- void *_ptrData[GLB_SHARED_VARS];
- bool _isPtr[GLB_SCRATCH_VARS];
-public:
- Globals();
-
- /**
- * Dummy operator to allow for original code that did !globals to see if
- * the globals array had been created
- */
- bool operator!() const { return false; }
-
- /**
- * Accesses the numeric array. Needed by several wscript methods
- */
- frac16 *getData() {
- return _numData;
- }
-
- Entry operator[](uint idx) {
- assert(idx < GLB_SHARED_VARS);
- return Entry(_numData[idx], _ptrData[idx], _isPtr[idx]);
- }
-};
-
} // namespace M4
#endif
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 4c44f5a36d5..36cefac85d8 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -67,7 +67,7 @@ void f_stream_Shutdown(void) {
}
}
-strmRequest *f_stream_Open(StreamFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
+strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
int32 numBlocksToRead, int32 *blockSizeArray, int32 initialRead, bool wrapStream) {
strmRequest *newStream;
@@ -168,7 +168,6 @@ got_mem:
// Check if we are to initially read the stream
if (initialRead > 0) {
-
// If the blockSizeArray exists, then initialRead is the number of blocks to read
if (newStream->blockSizeArray) {
// Calculate the total number of bytes to read in initially
@@ -204,7 +203,7 @@ got_mem:
// Read in the initial bytes to read
//bytesRead = fread((void*)newStream->strmHead, 1, bytesToRead, newStream->srcFile);
bufferHandle = newStream->strmHead;
- bytesRead = newStream->srcFile->read((Handle)&bufferHandle, bytesToRead);
+ bytesRead = newStream->srcFile->read((MemHandle)&bufferHandle, bytesToRead);
//did we actually read that many? If not, close the file
if (bytesRead < bytesToRead) {
@@ -358,7 +357,7 @@ int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes) {
// Read in the bytesNeeded
bufferHandle = myStream->strmHead;
- bytesRead = myStream->srcFile->read((Handle)&bufferHandle, bytesNeeded);
+ bytesRead = myStream->srcFile->read((MemHandle)&bufferHandle, bytesNeeded);
if (bytesRead < bytesNeeded) {
// If we could not read that much in, close the srcFile
@@ -473,7 +472,7 @@ void f_stream_Process(int32 numToProcess) {
((!buffWrap) && (bytesAvail >= nextReadSize))) {
// Read the bytes into the stream buffer
bufferHandle = myStream->strmHead;
- bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize);
+ bytesRead = myStream->srcFile->read((MemHandle)&bufferHandle, nextReadSize);
// If we could not read that much in, close the srcFile
if (bytesRead < nextReadSize) {
@@ -504,7 +503,7 @@ void f_stream_Process(int32 numToProcess) {
// Read the bytes into the stream buffer
//bytesRead = (int32)fread((void*)myStream->strmBuff, 1, nextReadSize, myStream->srcFile);
bufferHandle = myStream->strmBuff;
- bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize);
+ bytesRead = myStream->srcFile->read((MemHandle)&bufferHandle, nextReadSize);
// If we could not read that much in, close the srcFile
if (bytesRead < nextReadSize) {
@@ -529,7 +528,7 @@ void f_stream_Process(int32 numToProcess) {
// Read into the end of the buffer
bufferHandle = myStream->strmHead;
- bytesRead = (int32)myStream->srcFile->read((Handle)&bufferHandle, buffEndBytesAvail);
+ bytesRead = (int32)myStream->srcFile->read((MemHandle)&bufferHandle, buffEndBytesAvail);
// If we could not read that much in, close the srcFile and update the head pointer
if (bytesRead < buffEndBytesAvail) {
@@ -544,7 +543,7 @@ void f_stream_Process(int32 numToProcess) {
// Read into the beginning of the buffer
bufferHandle = myStream->strmBuff;
- bytesRead = myStream->srcFile->read((Handle)&bufferHandle, nextReadSize - buffEndBytesAvail);
+ bytesRead = myStream->srcFile->read((MemHandle)&bufferHandle, nextReadSize - buffEndBytesAvail);
// If we could not read that much in, close the srcFile
if (bytesRead < (nextReadSize - buffEndBytesAvail)) {
diff --git a/engines/m4/fileio/fstream.h b/engines/m4/fileio/fstream.h
index 6729f53d339..b7829153d8d 100644
--- a/engines/m4/fileio/fstream.h
+++ b/engines/m4/fileio/fstream.h
@@ -23,6 +23,7 @@
#define M4_FILEIO_FSTREAM_H
#include "common/file.h"
+#include "m4/fileio/sys_file.h"
#include "m4/mem/reloc.h"
#include "m4/m4_types.h"
@@ -44,7 +45,7 @@ public:
struct strmRequest {
strmRequest *next;
strmRequest *prev;
- StreamFile *srcFile;
+ SysFile *srcFile;
int32 strmSize;
MemHandle strmHandle;
uint8 *strmBuff;
@@ -62,7 +63,7 @@ struct strmRequest {
extern bool f_stream_Init();
extern void f_stream_Shutdown();
-extern strmRequest *f_stream_Open(StreamFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
+extern strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
int32 numBlocksToRead, int32 *blockSizeArray, int32 initialRead, bool wrapStream);
extern int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes);
extern void f_stream_Close(strmRequest *myStream);
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index c19d6733390..30ce56448b3 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -551,7 +551,7 @@ bool SysFile::seek(uint32 pos) {
term_message("fail to fseek");
last_head_pos = rs->pos();
- curr_hag_record->hag_pos = curr_hash_record.offset + pos; // change file position
+ curr_hag_record->hag_pos = curr_hash_record.offset + pos; // Change file position
return true;
} else {
@@ -560,6 +560,29 @@ bool SysFile::seek(uint32 pos) {
}
}
+bool SysFile::seek_ahead(int32 amount) {
+ if (!_G(hag).hag_flag) {
+ return rs()->seek(amount, SEEK_CUR);
+
+ } else {
+ if (hag_success) {
+ Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(curr_hag_record->hag_fp);
+ assert(rs);
+
+ if (!rs->seek(amount, SEEK_CUR))
+ term_message("fail to fseek");
+
+ last_head_pos = rs->pos();
+ curr_hag_record->hag_pos += amount; // Change file position
+ return true;
+
+ } else {
+ return false;
+ }
+ }
+}
+
+
uint32 SysFile::read(MemHandle bufferHandle) {
int32 bytesToRead;
diff --git a/engines/m4/fileio/sys_file.h b/engines/m4/fileio/sys_file.h
index 83d1ba5da8b..7549d66ae69 100644
--- a/engines/m4/fileio/sys_file.h
+++ b/engines/m4/fileio/sys_file.h
@@ -112,6 +112,11 @@ public:
*/
bool seek(uint32 pos);
+ /**
+ * Seek ahaead by a given amount
+ */
+ bool seek_ahead(int32 amount);
+
/**
* Read data
*/
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 443ee20dd3a..63bae8aee02 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -71,7 +71,7 @@ machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int
_G(globals)[GLB_TEMP_1] = frameRate << 16;
// Store the SysFile pointer
- _G(globals)[GLB_TEMP_4] = sysFile;
+ _G(globals)[GLB_TEMP_4] = (intptr_t)sysFile;
// Set the callback trigger
_G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index e1ee094163b..2398ffebc05 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -39,7 +39,12 @@ namespace M4 {
typedef void *Ptr;
typedef void *Handle;
-typedef uint32 frac16;
+/**
+ * This needs to be intptr_t in ScummVM because series_stream in gr_series.cpp stores
+ * a pointer as a global. On some systems size(ptr) > sizeof(int)
+ */
+typedef intptr_t frac16;
+
typedef uint32 ulong;
typedef uint32 quadchar;
typedef uint32 trigraph;
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index bf1ca6ec984..c7e43241bc6 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -88,7 +88,7 @@ bool Vars::init() {
gr_font_set(_font_inter);
if (_cheat_keys_enabled) {
- if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals.getData()))
+ if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals))
error(FL, 'DWIF');
}
@@ -229,7 +229,7 @@ void Vars::fire_up_gui() {
bool Vars::woodscript_init() {
if (!InitWSAssets())
return false;
- if (!ws_Initialize(_G(globals).getData()))
+ if (!ws_Initialize(_G(globals)))
return false;
return true;
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index b8ba19193ab..df573981959 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -95,7 +95,7 @@ public:
Hag_Statics _hag;
SceneDef _currentSceneDef;
Scene_list _scene_list;
- Globals _globals;
+ frac16 _globals[GLB_SHARED_VARS];
Player _player;
PlayerInfo _player_info;
Resources _resources;
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 0713de2af11..1afec3ad9a8 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -1247,7 +1247,7 @@ static void op_OPEN_STREAM_SS(Anim8 *myAnim8) {
ShowCCB(myCCB);
myCCB->flags |= CCB_SKIP;
- if (!ws_OpenSSstream((StreamFile *)(*_GWS(myArg1)), myAnim8)) {
+ if (!ws_OpenSSstream((SysFile *)(*_GWS(myArg1)), myAnim8)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0258, "open_ss_stream() failed.");
}
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 66aeb24c990..c93aac22671 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1494,26 +1494,26 @@ int32 ws_GetDATACount(uint32 hash) {
}
-static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette) {
+static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
uint32 celsType, celsSize, numColors, *myColors;
uint32 *tempPtr, i, j, header, format;
int32 numCels, dataOffset;
bool byteSwap;
void *handlebuffer;
- if (!stream) {
+ if (!sysFile) {
ws_LogErrorMsg(FL, "nullptr FILE POINTER given.");
return -1;
}
// Read in the series header and the format number
handlebuffer = &header;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Unable to read series header.");
return -1;
}
handlebuffer = &format;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Unable to read series format.");
return -1;
}
@@ -1532,23 +1532,22 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// Read in the SS chunk type - either PAL or SS info
handlebuffer = &celsType;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Unable to read series chunk type.");
return -1;
}
if ((celsType == CELS__PAL) || (celsType == CELS_LAP_)) {
-
- //PAL info, read in the size of the PAL chunk
+ // PAL info, read in the size of the PAL chunk
handlebuffer = &celsSize;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Unable to read series chunk size.");
return -1;
}
// Now read in the number of colors to be inserted into the PAL
handlebuffer = &numColors;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Unable to read number of colors in PAL chunk.");
return -1;
}
@@ -1571,7 +1570,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// Read in the color info into a temp buffer
handlebuffer = myColors;
- if (!(*stream).read((Handle)&handlebuffer, numColors << 2)) {
+ if (!(*sysFile).read(&handlebuffer, numColors << 2)) {
ws_LogErrorMsg(FL, "Failed to read in the PAL color info.");
return -1;
}
@@ -1587,7 +1586,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
}
}
- //If we have a place to store the color info
+ // If we have a place to store the color info
if (myPalette) {
tempPtr = (uint32 *)(&myColors[0]);
for (i = 0; i < numColors; i++) {
@@ -1605,7 +1604,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// Read in the next chunk type
handlebuffer = &celsType;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Failed to read in series chunk type.");
return -1;
}
@@ -1619,7 +1618,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// Read in the size of the entire chunk
handlebuffer = &celsSize;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Failed to read in series chunk size.");
return -1;
}
@@ -1631,14 +1630,14 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// *data contains header + offsets, therefore, we must scan ahead
// and find out how many cels are here...
- if (!(*stream).seek_ahead((CELS_COUNT - CELS_SRC_SIZE - 1) << 2)) {
+ if (!(*sysFile).seek_ahead((CELS_COUNT - CELS_SRC_SIZE - 1) << 2)) {
ws_LogErrorMsg(FL, "Failed to seek ahead in the stream.");
return -1;
}
// Read how many sprites are in the series
handlebuffer = &numCels;
- if (!(*stream).read((Handle)&handlebuffer, 4)) {
+ if (!(*sysFile).read(&handlebuffer, 4)) {
ws_LogErrorMsg(FL, "Failed to read the number of sprites in the series.");
return -1;
}
@@ -1649,7 +1648,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
}
// Now, seek backwards to where we left off
- if (!(*stream).seek_ahead((CELS_SRC_SIZE - CELS_COUNT) * 4)) {
+ if (!(*sysFile).seek_ahead((CELS_SRC_SIZE - CELS_COUNT) * 4)) {
ws_LogErrorMsg(FL, "Failed to seek backwards in the stream.");
return -1;
}
@@ -1663,7 +1662,7 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
// Read in the series header and the sprite offset table
// Since we already read in celsType and celsSize, SS_HEAD_SIZE-2
handlebuffer = &((*data)[2]);
- if (!(*stream).read((Handle)&handlebuffer, (SS_HEAD_SIZE + numCels - 2) << 2)) {
+ if (!(*sysFile).read(&handlebuffer, (SS_HEAD_SIZE + numCels - 2) << 2)) {
ws_LogErrorMsg(FL, "Failed to read the series header and the sprite offset table.");
return -1;
}
@@ -1681,11 +1680,11 @@ static int32 GetSSHeaderInfo(StreamFile *stream, uint32 **data, RGB8 *myPalette)
}
// Find out how far into the stream we are, and return that value
- dataOffset = (*stream).get_pos();
+ dataOffset = (*sysFile).get_pos();
return dataOffset;
}
-bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
+bool ws_OpenSSstream(SysFile *sysFile, Anim8 *anim8) {
CCB *myCCB;
frac16 *myRegs;
uint32 *celsPtr, *offsets;
@@ -1694,7 +1693,7 @@ bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
uint32 maxFrameSize;
// Verify the parameters
- if (!streamFile || !anim8 || !anim8->myCCB) {
+ if (!sysFile || !anim8 || !anim8->myCCB) {
ws_LogErrorMsg(FL, "SysFile* streamFile invalid.");
return false;
}
@@ -1704,7 +1703,7 @@ bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
ssDataOffset = 0;
// Read in the SS stream header
- if ((ssDataOffset = GetSSHeaderInfo(streamFile, &(myCCB->streamSSHeader), &_G(master_palette)[0])) <= 0) {
+ if ((ssDataOffset = GetSSHeaderInfo(sysFile, &(myCCB->streamSSHeader), &_G(master_palette)[0])) <= 0) {
return false;
}
@@ -1751,7 +1750,7 @@ bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8) {
term_message("Biggest frame was: %ld, size: %ld bytes (compressed)", obesest_frame, maxFrameSize);
// Access the streamer to recognize the new client
- if ((myCCB->myStream = (void *)f_stream_Open(streamFile, ssDataOffset, maxFrameSize, maxFrameSize << 4, numSprites, (int32 *)offsets, 4, false)) == nullptr) {
+ if ((myCCB->myStream = (void *)f_stream_Open(sysFile, ssDataOffset, maxFrameSize, maxFrameSize << 4, numSprites, (int32 *)offsets, 4, false)) == nullptr) {
ws_LogErrorMsg(FL, "Failed to open a stream.");
return false;
}
diff --git a/engines/m4/wscript/ws_load.h b/engines/m4/wscript/ws_load.h
index 6bafea73e71..09570c9bec1 100644
--- a/engines/m4/wscript/ws_load.h
+++ b/engines/m4/wscript/ws_load.h
@@ -24,7 +24,7 @@
#define M4_WSCRIPT_WS_LOAD_H
#include "m4/m4_types.h"
-#include "m4/fileio/fstream.h"
+#include "m4/fileio/sys_file.h"
#include "m4/mem/reloc.h"
#include "m4/wscript/ws_machine.h"
#include "m4/wscript/ws_univ.h"
@@ -104,7 +104,7 @@ extern int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHand
extern M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
// WOODSCRIPT STREAMING API
-extern bool ws_OpenSSstream(StreamFile *streamFile, Anim8 *anim8);
+extern bool ws_OpenSSstream(SysFile *streamFile, Anim8 *anim8);
extern bool ws_GetNextSSstreamCel(Anim8 *anim8);
extern void ws_CloseSSstream(CCB *myCCB);
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index d18735c0331..2dfbfb28fd1 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -1045,7 +1045,7 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32
// Search through the message list
while (myMsg && (!found)) {
// Check if we've found the msg we're looking for
- if ((myMsg->msgHash == msgHash) && (myMsg->msgValue == msgValue)) {
+ if ((myMsg->msgHash == msgHash) && ((uint32)myMsg->msgValue == msgValue)) {
// Set found bool
found = true;
Commit: 8d1ba27c22b290bc8ab3d1ccc5f8d3a6c2f6711a
https://github.com/scummvm/scummvm/commit/8d1ba27c22b290bc8ab3d1ccc5f8d3a6c2f6711a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added cutscene renderer code
Changed paths:
engines/m4/graphics/rend.cpp
engines/m4/graphics/rend.h
engines/m4/vars.h
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
index 6c83d83eff3..814ba638390 100644
--- a/engines/m4/graphics/rend.cpp
+++ b/engines/m4/graphics/rend.cpp
@@ -19,17 +19,1049 @@
*
*/
-#include "common/textconsole.h"
+#include "common/algorithm.h"
#include "m4/graphics/rend.h"
+#include "m4/core/errors.h"
+#include "m4/core/term.h"
+#include "m4/vars.h"
namespace M4 {
+#define _GR(X) _G(rend)._##X
+#define DEPTH_MASK 0x0f
+#define OPTIMIZE_CLIP
+
+constexpr int32 kShadowFlag = 0x80;
+
+enum {
+ kDepthed = 0x0001,
+ kScaled = 0x0002,
+ kClipped = 0x0004
+};
+
+static RenderResult skip_RLE8_line() {
+ uint8 *from = _GR(sourceAddress);
+
+ for (;;)
+ {
+ if (*from++)
+ ++from;
+ else if (*from++ <= kJumpXY)
+ {
+ _GR(sourceAddress) = from;
+ return (RenderResult)(*(from - 1));
+ } else
+ from += *(from - 1);
+ }
+}
+
+#define EMPIRICALLY_FOUND 5
+
+static RenderResult r_0() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+
+ for (;;) {
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ if (data)
+ *to = data;
+ ++to;
+ }
+ } else {
+ uint8 data = *from++;
+
+ if (!data)
+ to += runLength;
+ else {
+ if (runLength > EMPIRICALLY_FOUND) {
+ while ((uint32)to & 3) {
+ *to++ = data;
+ --runLength;
+ }
+
+ uint32 ddata = data | ((uint32)data << 8);
+ ddata = ddata | (ddata << 16);
+
+ uint32 *dto = (uint32 *)to;
+
+ uint32 longRunLength = runLength >> 2;
+
+ runLength -= longRunLength * 4;
+
+ while (longRunLength--)
+ *dto++ = ddata;
+
+ to = (uint8 *)dto;
+ }
+
+ while (runLength--)
+ *to++ = data;
+ }
+ }
+ }
+}
+
+static RenderResult r_0_5() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+
+ for (;;) {
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ if (data)
+ *to = data;
+ --to;
+ }
+ } else {
+ uint8 data = *from++;
+
+ if (!data)
+ to -= runLength;
+ else {
+ if (runLength > EMPIRICALLY_FOUND) {
+ while (((uint32)to & 3) != 3) {
+ *to-- = data;
+ --runLength;
+ }
+
+ uint32 ddata = data | ((uint32)data << 8);
+ ddata = ddata | (ddata << 16);
+
+ uint32 *dto = (uint32 *)(to - 3);
+
+ uint32 longRunLength = runLength >> 2;
+
+ runLength -= longRunLength * 4;
+
+ while (longRunLength--)
+ *dto-- = ddata;
+
+ to = (uint8 *)dto + 3;
+ }
+
+ while (runLength--)
+ *to-- = data;
+ }
+ }
+ }
+}
+
+static RenderResult r_1() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ uint8 *depth = _GR(depthAddress);
+ uint8 sdepth = _GR(spriteDepth);
+ long Inc = _GR(Increment);
+
+ int32 myWidth = 0;
+
+ for (;;) {
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ ++myWidth;
+
+ uint8 data = *from++;
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && (!ddepth || sdepth < ddepth))
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ }
+ } else {
+ uint8 data = *from++;
+
+ myWidth += runLength;
+
+ if (!data) {
+ if (Inc == 1) {
+ to += runLength;
+ depth += runLength;
+ } else {
+ to -= runLength;
+ depth -= runLength;
+ }
+ } else {
+ while (runLength--) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (!ddepth || sdepth < ddepth)
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ }
+ }
+ }
+
+ if (myWidth > 666) {
+ error_show(FL, 0);
+ }
+ }
+}
+
+static RenderResult r_2() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ int32 Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+
+ for (;;) {
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data)
+ *to = data;
+
+ to += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data)
+ *to = data;
+
+ to += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+static RenderResult r_3() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ uint8 *depth = _GR(depthAddress);
+ uint8 sdepth = _GR(spriteDepth);
+ int32 Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+
+ for (;;) {
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && (!ddepth || sdepth < ddepth))
+ *to = data;
+
+ to += Inc;
+ depth += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && (!ddepth || sdepth < ddepth))
+ *to = data;
+
+ to += Inc;
+ depth += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+static RenderResult r_4() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ int32 PixelPos = _GR(StartingPixelPos);
+ long Inc = _GR(Increment);
+
+ for (;;)
+ {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch))
+ *to = data;
+ to += Inc;
+ PixelPos += Inc;
+ }
+ } else {
+ uint8 data = *from++;
+
+ if (!data) {
+ if (Inc == 1) {
+ to += runLength;
+ PixelPos += runLength;
+ } else {
+ to -= runLength;
+ PixelPos -= runLength;
+ }
+ } else while (runLength--) {
+ if (PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch))
+ *to = data;
+ to += Inc;
+ PixelPos += Inc;
+ }
+ }
+ }
+}
+
+static RenderResult r_5() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ uint8 *depth = _GR(depthAddress);
+ uint8 sdepth = _GR(spriteDepth);
+ int32 PixelPos = _GR(StartingPixelPos);
+ long Inc = _GR(Increment);
+
+ for (;;) {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+ }
+ } else {
+ uint8 data = *from++;
+
+ if (!data)
+ if (Inc == 1) {
+ to += runLength;
+ depth += runLength;
+ PixelPos += runLength;
+ } else {
+ to -= runLength;
+ depth -= runLength;
+ PixelPos -= runLength;
+ } else while (runLength--) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+ }
+ }
+ }
+}
+
+static RenderResult r_6() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+
+ for (;;) {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch))
+ *to = data;
+ to += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch))
+ *to = data;
+ to += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+static RenderResult r_7() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ uint8 *depth = _GR(depthAddress);
+ uint8 sdepth = _GR(spriteDepth);
+ int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+
+ for (;;) {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
+ *to = data;
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+#define PALETTE_SHIFTER 10
+
+static RenderResult r_8() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+ uint32 r, g, b;
+
+ for (;;) {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch)) {
+ // handle pixel
+ r = _GR(Palette)[*to].r;
+ r *= data;
+ r >>= PALETTE_SHIFTER;
+ if (r > 0x1f)
+ r = 0x1f;
+
+ g = _GR(Palette)[*to].g;
+ g *= data;
+ g >>= PALETTE_SHIFTER;
+ if (g > 0x1f)
+ g = 0x1f;
+
+ b = _GR(Palette)[*to].b;
+ b *= data;
+ b >>= PALETTE_SHIFTER;
+ if (b > 0x1f)
+ b = 0x1f;
+
+ *to = _GR(InverseColorTable)[(b << 10) | (g << 5) | r];
+ }
+ to += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch)) {
+ // handle pixel
+ r = _GR(Palette)[*to].r;
+ r *= data;
+ r >>= PALETTE_SHIFTER;
+ if (r > 0x1f)
+ r = 0x1f;
+
+ g = _GR(Palette)[*to].g;
+ g *= data;
+ g >>= PALETTE_SHIFTER;
+ if (g > 0x1f)
+ g = 0x1f;
+
+ b = _GR(Palette)[*to].b;
+ b *= data;
+ b >>= PALETTE_SHIFTER;
+ if (b > 0x1f)
+ b = 0x1f;
+
+ *to = _GR(InverseColorTable)[(b << 10) | (g << 5) | r];
+ }
+ to += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+static RenderResult r_9() {
+ uint8 *from = _GR(sourceAddress);
+ uint8 *to = _GR(destinationAddress);
+ uint8 *depth = _GR(depthAddress);
+ uint8 sdepth = _GR(spriteDepth);
+ int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
+ uint32 scaleX = _GR(X_scale);
+ long Inc = _GR(Increment);
+ uint32 r, g, b;
+
+ for (;;) {
+#ifdef OPTIMIZE_CLIP
+ if (Inc == 1) {
+ if (PixelPos >= _GR(RightPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+ } else if (PixelPos < _GR(LeftPorch)) {
+ _GR(sourceAddress) = from;
+ return skip_RLE8_line();
+ }
+#endif
+
+ // Assume that the first byte is a run-length counter followed by pix data
+ uint8 runLength = *from++;
+
+ if (!runLength) {
+ uint8 code = *from++;
+
+ if (code <= kJumpXY) {
+ _GR(sourceAddress) = from;
+ return (RenderResult)code;
+ } else while (code--) {
+ uint8 data = *from++;
+
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth)) {
+ // Handle pixel
+ r = _GR(Palette)[*to].r;
+ r *= data;
+ r >>= PALETTE_SHIFTER;
+ if (r > 0x1f)
+ r = 0x1f;
+
+ g = _GR(Palette)[*to].g;
+ g *= data;
+ g >>= PALETTE_SHIFTER;
+ if (g > 0x1f)
+ g = 0x1f;
+
+ b = _GR(Palette)[*to].b;
+ b *= data;
+ b >>= PALETTE_SHIFTER;
+ if (b > 0x1f)
+ b = 0x1f;
+
+ *to = _GR(InverseColorTable)[(b << 10) | (g << 5) | r];
+ }
+
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ } else {
+ uint8 data = *from++;
+
+ while (runLength--) {
+ Error -= scaleX;
+
+ while (Error < 0) {
+ uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+
+ if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth)) {
+ // Handle pixel
+ r = _GR(Palette)[*to].r;
+ r *= data;
+ r >>= PALETTE_SHIFTER;
+ if (r > 0x1f)
+ r = 0x1f;
+
+ g = _GR(Palette)[*to].g;
+ g *= data;
+ g >>= PALETTE_SHIFTER;
+ if (g > 0x1f)
+ g = 0x1f;
+
+ b = _GR(Palette)[*to].b;
+ b *= data;
+ b >>= PALETTE_SHIFTER;
+ if (b > 0x1f)
+ b = 0x1f;
+
+ *to = _GR(InverseColorTable)[(b << 10) | (g << 5) | r];
+ }
+
+ to += Inc;
+ depth += Inc;
+ PixelPos += Inc;
+
+ Error += 100;
+ }
+ }
+ }
+ }
+}
+
+static RenderResult(*dispatches[])() = {
+ r_0, r_1, r_2, r_3, r_4, r_5, r_6, r_7
+};
+
+// Render Sprite to 8 Bit Bit Map
+
+int32 scale_this(int32 Value, int32 Scaler, int32 Error);
+
+int32 scale_this(int32 Value, int32 Scaler, int32 Error) {
+ int32 Scaled = 0;
+
+ while (Value--) {
+ Error -= Scaler;
+
+ while (Error < 0) {
+ ++Scaled;
+ Error += 100;
+ }
+ }
+
+ return Scaled;
+}
+
void GetUpdateRectangle(int32 x, int32 y, int32 hot_x, int32 hot_y, int32 scale_x, int32 scale_y, int32 Width, int32 Height, M4Rect *UpdateRect) {
- error("TODO: GetUpdateRectangle");
+ int errY = hot_y * scale_y % 100;
+
+ UpdateRect->y1 = y - hot_y * scale_y / 100;
+ UpdateRect->y2 = UpdateRect->y1 + scale_this(Height, scale_y, errY);
+
+ int32 scaleX = scale_x;
+
+ if (scaleX < 0) {
+ scaleX = -scaleX;
+ UpdateRect->x2 = x + hot_x * scaleX / 100;
+ UpdateRect->x1 = UpdateRect->x2 - scale_this(Width, scaleX, hot_x * scaleX % 100);
+ } else {
+ UpdateRect->x1 = x - hot_x * scaleX / 100;
+ UpdateRect->x2 = UpdateRect->x1 + scale_this(Width, scaleX, hot_x * scaleX % 100);
+ }
}
+typedef struct {
+ RenderFunc addr;
+ const char *name;
+} FuncName;
+
+FuncName fn[] = {
+ { r_0, "r_0" },
+ { r_0_5, "r_0_5" },
+ { r_1, "r_1" },
+ { r_2, "r_2" },
+ { r_3, "r_3" },
+ { r_4, "r_4" },
+ { r_5, "r_5" },
+ { r_6, "r_6" },
+ { r_7, "r_7" },
+ { r_8, "r_8" },
+ { r_9, "r_9" },
+};
+
void render_sprite_to_8BBM(RendGrBuff *Destination, DrawRequestX *dr, RendCell *Frame, M4Rect *ClipRectangle, M4Rect *UpdateRect) {
- error("TODO: render_sprite_to_8BBM");
+#ifdef DEBUGGING_REND
+ int i, len;
+
+ countStart = Frame->data;
+ for (i = 0; i < Frame->Height; ++i)
+ if ((len = count_RLE8_line()) != Frame->Width) {
+ term_message("line %u of sprite %p doesn't look good...", i, Frame);
+ return;
+ }
+#endif
+
+ int errY = Frame->hot_y * dr->scale_y % 100;
+ int ScaledWidth;
+
+ UpdateRect->y1 = dr->y - Frame->hot_y * dr->scale_y / 100;
+ UpdateRect->y2 = UpdateRect->y1 + scale_this(Frame->Height, dr->scale_y, errY);
+
+ int32 scaleX = dr->scale_x;
+
+ if (scaleX < 0) {
+ scaleX = -scaleX;
+ _GR(Increment) = -1;
+ UpdateRect->x2 = dr->x + Frame->hot_x * scaleX / 100;
+ UpdateRect->x1 = UpdateRect->x2 - (ScaledWidth = scale_this(Frame->Width, scaleX, _GR(X_error) = Frame->hot_x * scaleX % 100));
+ } else {
+ _GR(Increment) = 1;
+ UpdateRect->x1 = dr->x - Frame->hot_x * scaleX / 100;
+ UpdateRect->x2 = UpdateRect->x1 + (ScaledWidth = scale_this(Frame->Width, scaleX, _GR(X_error) = Frame->hot_x * scaleX % 100));
+ }
+
+ //-------------------------------------------------
+ // If sprite is off screen, bail immediately
+
+ if (UpdateRect->y2 < ClipRectangle->y1)
+ return;
+
+ if (UpdateRect->y1 > ClipRectangle->y2)
+ return;
+
+ if (UpdateRect->x2 < ClipRectangle->x1)
+ return;
+
+ if (UpdateRect->x1 > ClipRectangle->x2)
+ return;
+
+ //-------------------------------------------------
+ // Choose which line renderer to use
+ uint32 selector_mask = 0;
+ RenderFunc renderer = nullptr;
+
+ if (Frame->Comp & kShadowFlag) {
+ _GR(Palette) = dr->Pal;
+ _GR(InverseColorTable) = dr->ICT;
+
+ _GR(LeftPorch) = 0;
+ _GR(RightPorch) = Destination->Width;
+ if (_GR(Increment) == 1)
+ _GR(StartingPixelPos) = 0;
+ else
+ _GR(StartingPixelPos) = ScaledWidth;
+
+ if (dr->depth)
+ renderer = r_9;
+ else
+ renderer = r_8;
+ }
+
+ if (dr->depth) {
+ if (dr->depth_map) {
+ selector_mask |= kDepthed;
+ _GR(depthAddress) = dr->depth_map;
+ _GR(spriteDepth) = dr->depth;
+ } else {
+ assert(dr->depth_map == nullptr);
+ }
+ }
+
+ if (scaleX != 100)
+ selector_mask |= kScaled;
+
+ // check for clipping
+ if (UpdateRect->x1 < ClipRectangle->x1 || UpdateRect->x2 > ClipRectangle->x2) {
+ selector_mask |= kClipped;
+ _GR(LeftPorch) = ClipRectangle->x1;
+ _GR(RightPorch) = ClipRectangle->x2 + 1;
+ if (_GR(Increment) == 1)
+ _GR(StartingPixelPos) = UpdateRect->x1;
+ else
+ _GR(StartingPixelPos) = UpdateRect->x2;
+ }
+
+ if (!renderer)
+ renderer = dispatches[selector_mask];
+
+ if (renderer == r_0 && _GR(Increment) == -1)
+ renderer = r_0_5;
+
+ //-------------------------------------------------
+ // Set up horizontal scaler
+ _GR(X_scale) = scaleX;
+
+ //-------------------------------------------------
+ // Get beginning address of bit map to render at
+ if (_GR(Increment) == 1) {
+ _GR(destinationAddress) = (uint8 *)Destination->PixMap + UpdateRect->x1 + Destination->Width * UpdateRect->y1;
+ _GR(depthAddress) += UpdateRect->x1 + Destination->Width * UpdateRect->y1;
+ } else {
+ _GR(destinationAddress) = (uint8 *)Destination->PixMap + UpdateRect->x2 + Destination->Width * UpdateRect->y1;
+ _GR(depthAddress) += UpdateRect->x2 + Destination->Width * UpdateRect->y1;
+ }
+
+ _GR(sourceAddress) = Frame->data;
+
+ int posY = UpdateRect->y1;
+
+ UpdateRect->x1 = MAX(UpdateRect->x1, ClipRectangle->x1);
+ UpdateRect->x2 = MIN(UpdateRect->x2, ClipRectangle->x2);
+ UpdateRect->y1 = MAX(UpdateRect->y1, ClipRectangle->y1);
+ UpdateRect->y2 = MIN(UpdateRect->y2, ClipRectangle->y2);
+
+#ifdef DEBUGGING_REND
+ {
+ int32 i;
+
+ for (i = 0; i < 11; ++i)
+ if (renderer == fn[i].addr) {
+ term_message("renderer: %s", fn[i].name);
+ break;
+ }
+ }
+#endif
+
+#ifdef DEBUGGING_REND
+ /* hilite update rectangle */
+ {
+ int32 i;
+ uint8 *p;
+
+ p = (uint8 *)Destination->PixMap + UpdateRect->y1 * Destination->Width;
+ for (i = UpdateRect->x1; i <= UpdateRect->x2; ++i)
+ *(p + i) = ~(*(p + i));
+
+ p = (uint8 *)Destination->PixMap + UpdateRect->y2 * Destination->Width;
+ for (i = UpdateRect->x1; i <= UpdateRect->x2; ++i)
+ *(p + i) = ~(*(p + i));
+
+ p = (uint8 *)Destination->PixMap + UpdateRect->x1;
+ for (i = UpdateRect->y1; i <= UpdateRect->y2; ++i)
+ *(p + i * Destination->Width) = ~(*(p + i * Destination->Width));
+
+ p = (uint8 *)Destination->PixMap + UpdateRect->x2;
+ for (i = UpdateRect->y1; i <= UpdateRect->y2; ++i)
+ *(p + i * Destination->Width) = ~(*(p + i * Destination->Width));
+ }
+#endif
+
+ for (;;) {
+ errY -= dr->scale_y;
+
+ uint8 *prevSourceAddress = _GR(sourceAddress);
+ bool AlreadySkippedClippedLine = false;
+
+ if (errY < 0) {
+ do {
+ if (posY < ClipRectangle->y1) {
+ if (!AlreadySkippedClippedLine) {
+ _GR(sourceAddress) = prevSourceAddress;
+ if (skip_RLE8_line() == kEndOfSprite) {
+ term_message("hey nonny nonny");
+ return;
+ }
+
+ AlreadySkippedClippedLine = true;
+ }
+ } else {
+ _GR(sourceAddress) = prevSourceAddress;
+ if (renderer() == kEndOfSprite)
+ return;
+ }
+
+ if (++posY > ClipRectangle->y2)
+ return;
+
+ _GR(destinationAddress) += Destination->Width;
+ _GR(depthAddress) += Destination->Width;
+
+ errY += 100;
+ } while (errY < 0);
+ } else if (skip_RLE8_line() == kEndOfSprite) {
+ return;
+ }
+ }
}
} // namespace M4
diff --git a/engines/m4/graphics/rend.h b/engines/m4/graphics/rend.h
index e0815d8e82d..52c30957537 100644
--- a/engines/m4/graphics/rend.h
+++ b/engines/m4/graphics/rend.h
@@ -60,6 +60,23 @@ struct RendCell {
uint8 *data;
};
+enum {
+ kEndOfLine = 0,
+ kEndOfSprite = 1,
+ kJumpXY = 2
+};
+
+typedef uint32 RenderResult;
+
+typedef RenderResult(*RenderFunc)();
+
+struct Rend_Globals {
+ uint8 *_sourceAddress, *_destinationAddress, *_depthAddress, _spriteDepth, *_InverseColorTable;
+ int32 _X_scale, _LeftPorch, _RightPorch, _StartingPixelPos, _X_error;
+ int _Increment;
+ RGBcolor *_Palette;
+};
+
extern void GetUpdateRectangle(int32 x, int32 y, int32 hot_x, int32 hot_y, int32 scale_x, int32 scale_y, int32 Width, int32 Height, M4Rect *UpdateRect);
extern void render_sprite_to_8BBM(RendGrBuff *Destination, DrawRequestX *dr, RendCell *Frame, M4Rect *ClipRectangle, M4Rect *UpdateRect);
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index df573981959..c2a6bb3d9de 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -44,6 +44,7 @@
#include "m4/graphics/gr_color.h"
#include "m4/graphics/gr_font.h"
#include "m4/graphics/krn_pal.h"
+#include "m4/graphics/rend.h"
#include "m4/gui/gui_dialog.h"
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
@@ -111,6 +112,7 @@ public:
KernelPal_Globals _krnPal;
ADVScale_Globals _scale;
ConvDisplayData _cdd;
+ Rend_Globals _rend;
bool _cheating_enabled = false;
bool _cheat_keys_enabled = false;
Commit: b68d672e6a262450526195a4cc4cd878672a5d07
https://github.com/scummvm/scummvm/commit/b68d672e6a262450526195a4cc4cd878672a5d07
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress implementing ws_DoDisplay/DrawSprite changes
Changed paths:
engines/m4/graphics/rend.h
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/graphics/rend.h b/engines/m4/graphics/rend.h
index 52c30957537..77ee29f02a8 100644
--- a/engines/m4/graphics/rend.h
+++ b/engines/m4/graphics/rend.h
@@ -32,9 +32,11 @@ struct RGBcolor {
};
struct RendGrBuff {
- uint32 Width;
- uint32 Height;
- void *PixMap;
+ uint32 Width = 0;
+ uint32 Height = 0;
+ void *PixMap = nullptr;
+ byte encoding = 0;
+ uint32 Pitch = 0;
};
struct DrawRequestX {
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 7617f3f8fbb..e14dc9d453f 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -151,20 +151,20 @@ machine *kernel_timer_callback(int32 ticks, int16 trigger, MessageCB callMe) {
return (TriggerMachineByHash(1, nullptr, -1, -1, callMe, false, "timer callback"));
}
-void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff, uint8 *myPalette, uint8 *ICT,
- M4Rect *clipRect, M4Rect *updateRect) {
-#ifdef TODO
+static void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff,
+ uint8 *myPalette, uint8 *ICT, M4Rect *clipRect, M4Rect *updateRect) {
M4sprite *source;
// Temporary var to prevent excessive dereferences
source = myCCB->source;
if (!(myCCB->flags & CCB_DISC_STREAM)) {
- //make sure the sprite is still in memory
+ // Make sure the sprite is still in memory
if (!source->sourceHandle || !*(source->sourceHandle)) {
ws_LogErrorMsg(FL, "Sprite series is no longer in memory.");
ws_Error(myAnim8->myMachine, ERR_INTERNAL, 0x02ff, "Error during ws_DoDisplay()");
}
+
// Lock the sprite handle
HLock(source->sourceHandle);
source->data = (uint8 *)((byte *)*(source->sourceHandle) + source->sourceOffset);
@@ -174,15 +174,17 @@ void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCo
DrawRequestX dr;
RendCell Frame;
- Destination.Width = halScrnBuf->stride;
- Destination.Height = halScrnBuf->h;
- Destination.PixMap = (void *)halScrnBuf->data;
+ Destination.Width = source->w;
+ Destination.Height = source->h;
+ Destination.Pitch = source->w;
+ Destination.encoding = (myPalette && ICT) ? source->encoding : source->encoding & 0x7f;
+ Destination.PixMap = source->data;
dr.x = myAnim8->myRegs[IDX_X] >> 16;
dr.y = myAnim8->myRegs[IDX_Y] >> 16;
dr.scale_x = myCCB->scaleX;
dr.scale_y = myCCB->scaleY;
- dr.depth_map = screenCodeBuff->data;
+ dr.depth_map = screenCodeBuff->get_pixmap(); // TODO: Confirm this
dr.Pal = (RGBcolor *)myPalette;
dr.ICT = ICT;
dr.depth = myCCB->layer >> 8;
@@ -191,6 +193,7 @@ void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCo
Frame.hot_y = myCCB->source->yOffset;
Frame.Width = source->w;
Frame.Height = source->h;
+
if ((!myPalette) || (!ICT)) {
Frame.Comp = (uint32)(source->encoding & 0x7f);
} else {
@@ -203,13 +206,9 @@ void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCo
myCCB->flags &= ~CCB_REDRAW;
if (!(myCCB->flags & CCB_DISC_STREAM)) {
- //unlock the sprite's handle
+ // Unlock the sprite's handle
HUnLock(source->sourceHandle);
}
-
-#else
- error("TODO: DrawSprite");
-#endif
}
void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
@@ -223,14 +222,6 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
Anim8 *myAnim8;
M4Rect *currRect, intersectRect, noClipRect, dummyRect;
bool greyMode;
-#ifdef TODO
- Buffer drawSpriteBuff;
- bool finished;
- M4sprite *source;
- uint8 myDepth;
- M4Rect *newRect;
- DrawRequest spriteDrawReq;
-#endif
if (((myScreen = vmng_screen_find(_G(gameDrawBuff), &status)) == nullptr) || (status != SCRN_ACTIVE)) {
return;
@@ -271,19 +262,16 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
// or simply draw the sprite if it has been marked for redraw
myAnim8 = _GWS(myCruncher)->backLayerAnim8;
while (myAnim8) {
-
myCCB = myAnim8->myCCB;
currRect = myCCB->currLocation;
if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW))) {
if (myCCB->flags & CCB_REDRAW) {
-
// Draw the sprite
DrawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT, &noClipRect, currRect);
// Add it's new location to the update list
vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1, currRect->x2, currRect->y2);
} else {
-
// Loop through the update list, intersect each rect with the sprites
// current location, and update redraw all overlapping areas
myRect = drawRectList;
Commit: 677580823f1fc218f3cb5465e564cffcd8ef1240
https://github.com/scummvm/scummvm/commit/677580823f1fc218f3cb5465e564cffcd8ef1240
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gr_spite.cpp and skeleton RLE methods
Changed paths:
A engines/m4/graphics/gr_sprite.cpp
A engines/m4/graphics/gr_sprite.h
A engines/m4/platform/draw.cpp
A engines/m4/platform/draw.h
engines/m4/module.mk
engines/m4/vars.h
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
new file mode 100644
index 00000000000..dea233229cf
--- /dev/null
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -0,0 +1,455 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/graphics/gr_sprite.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/core/term.h"
+#include "m4/mem/memman.h"
+#include "m4/platform/draw.h"
+//include "m4/vars.h"
+
+namespace M4 {
+
+#define NO_COMPRESS 0x00
+#define RLE8 0x01
+#define SHADOW 0x80
+
+/**
+ * ScaleX and ScaleY are supposed to be percents, where 100 means 100%
+ * S and D are Raw encoded (unencoded!) buffers.
+ */
+static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
+ uint16 ErrX, ErrY, i, j;
+ uint8 *pScaled, *pData = S->data;
+
+ if (!D || !S)
+ error_show(FL, 'BUF!', "scale sprite h:%ld w:%ld sx:%uld sy:%uld", D->h, D->W, ScaleX, ScaleY);
+
+ /* calculate new x size */
+ D->W = S->W * ScaleX / 100;
+ if (S->W * ScaleX % 100 >= 50)
+ ++D->W;
+
+ /* calculate new y size */
+ D->h = S->h * ScaleY / 100;
+ if (S->h * ScaleY % 100 >= 50)
+ ++D->h;
+
+ D->stride = D->W;
+
+ /* allocate 'scaled' buffer */
+ if (!(D->data = pScaled = (uint8 *)mem_alloc(D->h * D->stride, "scaled buffer")))
+ error_show(FL, 'OOM!', "scaled buffer h:%uld w:%uld", D->h, D->stride);
+
+ ErrY = 50;
+ for (i = 0; i < S->h; ++i)
+ {
+ ErrY += ScaleY;
+ while (ErrY >= 100)
+ {
+ ErrX = 50;
+ for (j = 0; j < S->W; ++j)
+ {
+ ErrX += ScaleX;
+ while (ErrX >= 100)
+ {
+ *pScaled++ = *pData;
+ ErrX -= 100;
+ }
+ ++pData;
+ }
+ ErrY -= 100;
+ pData -= S->W;
+ }
+ pData += S->W;
+ }
+ return 0;
+}
+
+#define Scaled ((DrawReq -> scaleY != 100) || (DrawReq -> scaleX != 100 && DrawReq -> scaleX != -100))
+#define Rle (Source.encoding == RLE8)
+#define Clipped ((DrawReq -> x < 0) || (DrawReq -> y < 0) || (DrawReq -> x + Source.W > DrawReq -> Dest->W) || (DrawReq -> y + Source.h > DrawReq -> Dest -> h))
+#define Forward (DrawReq -> scaleX > 0)
+#define Depthed (DrawReq -> srcDepth)
+#define Shadow (Source.encoding & 0x80)
+
+#define ClipD (LeftOffset || RightOffset || BottomCut)
+#ifndef __MAC
+
+uint8 gr_sprite_draw(DrawRequest *DrawReq) {
+ Buffer Source;
+ int32 LeftOffset = 0, RightOffset = 0, YPos;
+ uint8 *ShadowBuff = NULL, *ScaledBuff = NULL;
+ Buffer AfterScaled;
+ uint8 BottomCut = 0;
+
+ if (!DrawReq->Src) {
+ term_message("NULL source data in sprite_draw");
+ //error_fatal_abort(0, "no source data", __FILE__, __LINE__, 0,0,0);
+ return 0;
+ }
+
+ // - scaleY means don't bother drawing this sprite
+
+ if (DrawReq->scaleY <= 0)
+ return 0;
+
+ if ((!DrawReq->Src->W) || (!DrawReq->Src->h)) {
+ //error_fatal_abort(0, "src->w, src->h zero", __FILE__, __LINE__, 0,0,0);
+ return 1;
+ }
+
+ AfterScaled.W = 0;
+ AfterScaled.h = 0;
+ AfterScaled.data = NULL;
+ AfterScaled.encoding = 0;
+ AfterScaled.stride = 0;
+
+ /* copy DrawReq -> Src to Source buffer */
+ memcpy(&Source, DrawReq->Src, sizeof(Buffer));
+
+ /* check for RLE encoding in case of shadows */
+ // there is no RLE shadow draw routine, so we have to decode shadows ahead of time.
+ if ((Source.encoding & RLE8) && (Source.encoding & SHADOW))
+ {
+ if (!(ShadowBuff = (uint8 *)mem_alloc(Source.stride * Source.h, "shadow buff")))
+ error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", Source.W, Source.h);
+
+ RLE8Decode(Source.data, ShadowBuff, Source.stride);
+ Source.data = ShadowBuff;
+ Source.encoding &= ~RLE8;
+ }
+
+ /* check for scaling */
+ // we scale before we draw
+ if (Scaled)
+ {
+ /* check if input is RLE8 encoded */
+ // if it's scaled we decode it first
+ if (Rle)
+ {
+ if (!(ScaledBuff = (uint8 *)mem_alloc(Source.stride * Source.h, "scaled buffer")))
+ error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", Source.W, Source.h);
+
+ RLE8Decode(Source.data, ScaledBuff, Source.stride);
+ Source.data = ScaledBuff;
+ Source.encoding &= ~RLE8;
+ }
+ if (scale_sprite(&Source, &AfterScaled, imath_abs(DrawReq->scaleX), imath_abs(DrawReq->scaleY)))
+ {
+ if (ShadowBuff) mem_free(ShadowBuff);
+ if (ScaledBuff) mem_free(ScaledBuff);
+ error_show(FL, 'SPSF', "gr_sprite_draw");
+ }
+
+ /* preserve encoding */
+ AfterScaled.encoding = Source.encoding;
+
+ /* copy AfterScaled to Source buffer */
+ memcpy(&Source, &AfterScaled, sizeof(Buffer));
+ }
+
+ YPos = DrawReq->y;
+
+ /* check for clipping */
+ // if sprite is off edge of destination buffer, do something special
+ if (Clipped)
+ {
+ if (-YPos >= Source.h)
+ goto truly_done;
+
+ if (YPos >= DrawReq->Dest->h)
+ goto truly_done;
+
+ if (-DrawReq->x >= Source.W)
+ goto truly_done;
+
+ if (DrawReq->x >= DrawReq->Dest->W)
+ goto truly_done;
+
+ // if clipped off top, scan into sprite
+ if (YPos < 0)
+ {
+ if (Rle)
+ Source.data = SkipRLE_Lines(-YPos, Source.data);
+ else
+ Source.data += -YPos * Source.stride;
+ Source.h += YPos;
+ YPos = 0;
+ }
+
+ // find out if we're losing pixels on left or right
+ if (DrawReq->x < 0)
+ LeftOffset = -DrawReq->x;
+
+ if (DrawReq->x + Source.W > DrawReq->Dest->W)
+ RightOffset = DrawReq->x + Source.W - DrawReq->Dest->W;
+
+ if (YPos + Source.h > DrawReq->Dest->h)
+ {
+ Source.h -= YPos + Source.h - DrawReq->Dest->h;
+ BottomCut = 1;
+ }
+ }
+
+ /* after all the necessary changes (scaling/shadow RLE expansion) */
+ if (Rle) /* will be RLE_Draw */
+ if (ClipD)
+ if (Depthed)
+ if (Forward)
+ RLE_DrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ else
+ RLE_DrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ else
+ if (Forward)
+ RLE_DrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ else
+ RLE_DrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ else
+ if (Depthed)
+ if (Forward)
+ RLE_DrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ else
+ RLE_DrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ else
+ if (Forward)
+ RLE_Draw(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ else
+ RLE_DrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ else if (Shadow) /* will be Raw_SDraw */
+ if (ClipD)
+ if (Depthed)
+ if (Forward)
+ Raw_SDrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ else
+ Raw_SDrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ else
+ if (Forward)
+ Raw_SDrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ else
+ Raw_SDrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ else
+ if (Depthed)
+ if (Forward)
+ Raw_SDrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, DrawReq->Pal, DrawReq->ICT);
+ else
+ Raw_SDrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, DrawReq->Pal, DrawReq->ICT);
+ else
+ if (Forward)
+ Raw_SDraw(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->Pal, DrawReq->ICT);
+ else
+ Raw_SDrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->Pal, DrawReq->ICT);
+ else /* will be Raw_Draw */
+ if (ClipD)
+ if (Depthed)
+ if (Forward)
+ Raw_DrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ else
+ Raw_DrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ else
+ if (Forward)
+ Raw_DrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ else
+ Raw_DrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ else
+ if (Depthed)
+ if (Forward)
+ Raw_DrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ else
+ Raw_DrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ else
+ if (Forward)
+ Raw_Draw(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ else
+ Raw_DrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos);
+
+truly_done:
+ if (ShadowBuff)
+ mem_free(ShadowBuff);
+
+ if (ScaledBuff)
+ mem_free(ScaledBuff);
+
+ if (AfterScaled.data)
+ mem_free(AfterScaled.data);
+ return 0;
+}
+#endif
+//----------------------------------------------------------------------------------------
+//Q 'n' D c version - soon to become obselete...
+// NOT USED!!!!!!
+/*
+void gr_sprite_draw_scaled(M4sprite *srcSprite, Buffer *destBuf, int32 destX, int32 destY, int32 scale)
+{
+ int32 errX, errY, x, y, scanX, scanY;
+ uint8 *srcPtr, *destPtr, *destRowPtr, *srcRowPtr;
+
+ if ((! srcSprite) || (! destBuf))
+ return;
+
+ if ((destX >= destBuf->W) || (destY >= destBuf->h))
+ return;
+
+ srcPtr = srcSprite->data;
+
+ if (destY <= 0) {
+ if (destX <= 0)
+ destRowPtr = destBuf->data;
+ else
+ destRowPtr = (uint8*)((long)destBuf->data + destX);
+ }
+ else {
+ if (destX <= 0)
+ destRowPtr = (uint8*)((long)destBuf->data + (destBuf->stride * destY));
+ else
+ destRowPtr = (uint8*)((long)destBuf->data + (destBuf->stride * destY) + destX);
+ }
+ scanY = destY;
+ destPtr = destRowPtr;
+ errY = 50;
+
+ for (y=0; y<srcSprite->h; y++)
+ {
+ errY += scale;
+ if ((errY >= 100) && (scanY >= 0))
+ {
+ srcRowPtr = srcPtr;
+ while (errY >= 100) {
+ scanX = destX;
+ errX = 50;
+ srcPtr = srcRowPtr;
+ for (x=0; x<srcSprite->w; x++) {
+ errX += scale;
+ while (errX >= 100) {
+ if ((scanX >= 0) && (scanX < destBuf->W)) {
+ if (*srcPtr) *destPtr = *srcPtr;
+ destPtr++;
+ }
+ scanX++;
+ errX -= 100;
+ }
+ srcPtr++;
+ }
+ destRowPtr += destBuf->stride; // next line
+ destPtr = destRowPtr;
+ errY -= 100;
+ scanY++;
+ if (scanY >= destBuf->h) {
+ return;
+ }
+ }
+ }
+ else {
+ while ((errY >= 100) && (scanY < 0)) {
+ errY -= 100;
+ scanY++;
+ }
+ if (errY < 100) srcPtr += srcSprite->w;
+ else errY -= scale;
+ }
+ }
+}
+*/
+//----------------------------------------------------------------------------------------
+//RLE8 COMPRESSION CODE...
+
+#define ESC ((uint8)0)
+#define EOL ((uint8)0)
+#define EOB ((uint8)1)
+#define DELTA ((uint8)2)
+
+#define OutBuffSize(x) ((x) + (((x) + 254) / 255 + 1) * 2 + 2)
+
+static uint16 EncodeScan(uint8 *pi, uint8 *po, uint16 scanlen, uint8 EndByte) {
+ uint8 *ps = pi + 1;
+ uint16 outlen = 0, limit, run;
+
+ while (scanlen)
+ {
+ limit = (scanlen < 255) ? scanlen : 255;
+ //imath_min(scanlen, 255);
+ for (run = 1; run < limit && *pi == *ps; ++run, ++ps)
+ ;
+ if (run > 1)
+ {
+ scanlen -= run;
+ *po++ = run;
+ *po++ = *pi;
+ outlen += 2;
+ pi = ps++;
+ } else if (scanlen < 3)
+ {
+ for (; scanlen; --scanlen)
+ {
+ *po++ = 1;
+ *po++ = *pi++;
+ outlen += 2;
+ }
+ } else
+ {
+ --ps;
+ do
+ {
+ ++ps;
+ while ((*ps != *(ps + 1) || *ps != *(ps + 2) || *ps != *(ps + 3)) && (ps - pi) < limit)
+ ++ps;
+ } while ((run = ps - pi) < 3);
+ scanlen -= run;
+ *po++ = ESC;
+ *po++ = run;
+ outlen += (run + 2);
+ for (limit = 0; limit < run; ++limit)
+ *po++ = *pi++;
+ ++ps;
+ }
+ }
+ *po++ = ESC;
+ *po = EndByte;
+ outlen += 2;
+ return outlen;
+}
+
+uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest);
+uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest) {
+ int i;
+ uint32 Offset = 0;
+
+ Dest->W = Source->W;
+ Dest->h = Source->h;
+ Dest->encoding = RLE8;
+ Dest->stride = Source->stride;
+
+ if (!(Dest->data = (uint8 *)mem_alloc(Source->h * OutBuffSize(Source->stride), "sprite data")))
+ {
+ return 0;
+ }
+ for (i = 0; i < Source->h - 1; ++i)
+ Offset += EncodeScan(Source->data + i * Source->stride, Dest->data + Offset, Source->W, EOL);
+
+ Offset += EncodeScan(Source->data + i * Source->stride, Dest->data + Offset, Source->W, EOB);
+
+ Dest->data = (uint8 *)mem_realloc(Dest->data, Offset, "rle8 sprite data");
+
+ return Offset;
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_sprite.h b/engines/m4/graphics/gr_sprite.h
new file mode 100644
index 00000000000..b34145d7e86
--- /dev/null
+++ b/engines/m4/graphics/gr_sprite.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_SPRITE_H
+#define M4_GRAPHICS_GR_SPRITE_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/gui.h"
+
+namespace M4 {
+
+struct DrawRequest {
+ Buffer *Src = nullptr; // sprite source buffer
+ Buffer *Dest = nullptr; // destination buffer
+ int32 x = 0; // x position relative to Destination(0, 0)
+ int32 y = 0; // y position relative to Destination(0, 0)
+ int32 scaleX = 0; // x scale factor (can be negative for reverse draw)
+ int32 scaleY = 0; // y scale factor (can't be negative)
+ uint8 *depthCode = nullptr; // depth code array for destination (doesn't care if srcDepth is 0)
+ uint8 *Pal = nullptr; // palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding)
+ uint8 *ICT = nullptr; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding)
+ uint8 srcDepth = 0; // depth code for source (0 if no depth processing)
+};
+
+
+extern uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest);
+extern uint8 gr_sprite_draw(DrawRequest *DrawReq);
+extern void gr_sprite_draw_scaled(M4sprite *srcSprite, Buffer *destBuf, int32 destX, int32 destY, int32 scale);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 32c6dc752d4..35d49065a24 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -46,6 +46,7 @@ MODULE_OBJS = \
graphics/gr_line.o \
graphics/gr_pal.o \
graphics/gr_series.o \
+ graphics/gr_sprite.o \
graphics/graphics.o \
graphics/krn_pal.o \
graphics/rend.o \
@@ -62,6 +63,7 @@ MODULE_OBJS = \
mem/memman.o \
mem/reloc.o \
mem/res.o \
+ platform/draw.o \
platform/events.o \
platform/sound.o \
platform/timer.o \
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
new file mode 100644
index 00000000000..a3919832ed2
--- /dev/null
+++ b/engines/m4/platform/draw.cpp
@@ -0,0 +1,131 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/textconsole.h"
+#include "m4/platform/draw.h"
+
+namespace M4 {
+
+void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
+ error("TODO: RLE");
+}
+
+uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *RLE_Data) {
+ error("TODO: RLE");
+}
+
+void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
+ error("TODO: RLE");
+}
+
+void Raw_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
+ error("TODO: RLE");
+}
+
+void Raw_SDraw(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void RLE_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void Raw_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+void Raw_SDrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
+ error("TODO: RLE");
+}
+
+} // namespace M4
diff --git a/engines/m4/platform/draw.h b/engines/m4/platform/draw.h
new file mode 100644
index 00000000000..d850468dbb9
--- /dev/null
+++ b/engines/m4/platform/draw.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_PLATFORM_DRAW_H
+#define M4_PLATFORM_DRAW_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch);
+
+extern uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *RLE_Data);
+
+extern void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
+extern void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
+extern void RLE_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
+extern void RLE_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
+
+extern void Raw_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
+extern void Raw_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
+extern void Raw_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
+extern void Raw_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
+
+extern void Raw_SDraw(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable);
+
+extern void RLE_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
+extern void RLE_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
+extern void RLE_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
+extern void RLE_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
+
+extern void Raw_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
+extern void Raw_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
+extern void Raw_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
+extern void Raw_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
+
+extern void Raw_SDrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
+extern void Raw_SDrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index c2a6bb3d9de..b37492dbc9c 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -181,6 +181,7 @@ public:
bool _editor_showStats = false;
bool _shut_down_digi_tracks_between_rooms = false;
cursor_states _cursor_state = kARROW;
+ int _iPitch = 0;
};
#define _G(X) (g_vars->_##X)
Commit: 78b9e664641c04a8ba3b7061b45ef0604a3911fe
https://github.com/scummvm/scummvm/commit/78b9e664641c04a8ba3b7061b45ef0604a3911fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented RLE8Decode
Changed paths:
engines/m4/platform/draw.cpp
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index a3919832ed2..c32176997f3 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -19,13 +19,55 @@
*
*/
+#include "common/algorithm.h"
#include "common/textconsole.h"
#include "m4/platform/draw.h"
namespace M4 {
+#define EOL_CODE 3
+#define END_CODE 2
+
void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
- error("TODO: RLE");
+ byte val, count;
+ int line = 0, numY = 0;
+ byte *destP = outBuff;
+
+ for (;;) {
+ count = *inBuff++;
+
+ if (count != 0xff) {
+ // Basic run length
+ val = *inBuff++;
+ Common::fill(destP, destP + count, val);
+ destP += count;
+
+ } else {
+ count = *inBuff++;
+
+ if (count > EOL_CODE) {
+ // Block of uncompressed pixels to copy
+ Common::copy(inBuff, inBuff + count, destP);
+ inBuff += count;
+ destP += count;
+
+ } else if (count == EOL_CODE) {
+ // End of Line code
+ ++line;
+ destP = outBuff + line * pitch;
+
+ } else if (count == END_CODE) {
+ break;
+
+ } else {
+ // Move down by X, Y amount
+ destP += *inBuff++; // x amount
+ numY = *inBuff++; // y amount
+ line += numY;
+ destP += numY * pitch;
+ }
+ }
+ }
}
uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *RLE_Data) {
Commit: 290ed72dcace973d0a6d9e843c08ad0aa96d64cd
https://github.com/scummvm/scummvm/commit/290ed72dcace973d0a6d9e843c08ad0aa96d64cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added SkipRLE_Lines
Changed paths:
engines/m4/platform/draw.cpp
engines/m4/platform/draw.h
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index c32176997f3..735840c2715 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -36,7 +36,7 @@ void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
for (;;) {
count = *inBuff++;
- if (count != 0xff) {
+ if (count) {
// Basic run length
val = *inBuff++;
Common::fill(destP, destP + count, val);
@@ -70,8 +70,23 @@ void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
}
}
-uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *RLE_Data) {
- error("TODO: RLE");
+uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData) {
+ byte val;
+
+ while (linesToSkip > 0) {
+ if (*rleData) {
+ // Simple RLE sequence, so skip over count and value
+ rleData += 2;
+
+ } else if (rleData[1] < EOL_CODE) {
+ rleData += 2;
+ --linesToSkip;
+ } else {
+ rleData += 2 + rleData[2];
+ }
+ }
+
+ return rleData;
}
void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
diff --git a/engines/m4/platform/draw.h b/engines/m4/platform/draw.h
index d850468dbb9..ff94ada47c6 100644
--- a/engines/m4/platform/draw.h
+++ b/engines/m4/platform/draw.h
@@ -26,9 +26,15 @@
namespace M4 {
+/**
+ * Decode an 8BPP RLE encoded image
+ */
extern void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch);
-extern uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *RLE_Data);
+/**
+ * Given RLE data, skips over a given number of encoded lines
+ */
+extern uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData);
extern void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
extern void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
Commit: f681162f16057a23d9f71dac1d4dfe93296f86fe
https://github.com/scummvm/scummvm/commit/f681162f16057a23d9f71dac1d4dfe93296f86fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove RLE compression code
It's only used for thumbnails, and we'll likely be using the
standard ScummVM thumbnail code
Changed paths:
engines/m4/graphics/gr_sprite.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index dea233229cf..b25e8166aa9 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -85,15 +85,13 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
return 0;
}
-#define Scaled ((DrawReq -> scaleY != 100) || (DrawReq -> scaleX != 100 && DrawReq -> scaleX != -100))
+#define Scaled ((DrawReq->scaleY != 100) || (DrawReq->scaleX != 100 && DrawReq->scaleX != -100))
#define Rle (Source.encoding == RLE8)
-#define Clipped ((DrawReq -> x < 0) || (DrawReq -> y < 0) || (DrawReq -> x + Source.W > DrawReq -> Dest->W) || (DrawReq -> y + Source.h > DrawReq -> Dest -> h))
-#define Forward (DrawReq -> scaleX > 0)
-#define Depthed (DrawReq -> srcDepth)
+#define Clipped ((DrawReq->x < 0) || (DrawReq->y < 0) || (DrawReq->x + Source.W > DrawReq->Dest->W) || (DrawReq->y + Source.h > DrawReq->Dest->h))
+#define Forward (DrawReq->scaleX > 0)
+#define Depthed (DrawReq->srcDepth)
#define Shadow (Source.encoding & 0x80)
-
#define ClipD (LeftOffset || RightOffset || BottomCut)
-#ifndef __MAC
uint8 gr_sprite_draw(DrawRequest *DrawReq) {
Buffer Source;
@@ -293,163 +291,5 @@ truly_done:
mem_free(AfterScaled.data);
return 0;
}
-#endif
-//----------------------------------------------------------------------------------------
-//Q 'n' D c version - soon to become obselete...
-// NOT USED!!!!!!
-/*
-void gr_sprite_draw_scaled(M4sprite *srcSprite, Buffer *destBuf, int32 destX, int32 destY, int32 scale)
-{
- int32 errX, errY, x, y, scanX, scanY;
- uint8 *srcPtr, *destPtr, *destRowPtr, *srcRowPtr;
-
- if ((! srcSprite) || (! destBuf))
- return;
-
- if ((destX >= destBuf->W) || (destY >= destBuf->h))
- return;
-
- srcPtr = srcSprite->data;
-
- if (destY <= 0) {
- if (destX <= 0)
- destRowPtr = destBuf->data;
- else
- destRowPtr = (uint8*)((long)destBuf->data + destX);
- }
- else {
- if (destX <= 0)
- destRowPtr = (uint8*)((long)destBuf->data + (destBuf->stride * destY));
- else
- destRowPtr = (uint8*)((long)destBuf->data + (destBuf->stride * destY) + destX);
- }
- scanY = destY;
- destPtr = destRowPtr;
- errY = 50;
-
- for (y=0; y<srcSprite->h; y++)
- {
- errY += scale;
- if ((errY >= 100) && (scanY >= 0))
- {
- srcRowPtr = srcPtr;
- while (errY >= 100) {
- scanX = destX;
- errX = 50;
- srcPtr = srcRowPtr;
- for (x=0; x<srcSprite->w; x++) {
- errX += scale;
- while (errX >= 100) {
- if ((scanX >= 0) && (scanX < destBuf->W)) {
- if (*srcPtr) *destPtr = *srcPtr;
- destPtr++;
- }
- scanX++;
- errX -= 100;
- }
- srcPtr++;
- }
- destRowPtr += destBuf->stride; // next line
- destPtr = destRowPtr;
- errY -= 100;
- scanY++;
- if (scanY >= destBuf->h) {
- return;
- }
- }
- }
- else {
- while ((errY >= 100) && (scanY < 0)) {
- errY -= 100;
- scanY++;
- }
- if (errY < 100) srcPtr += srcSprite->w;
- else errY -= scale;
- }
- }
-}
-*/
-//----------------------------------------------------------------------------------------
-//RLE8 COMPRESSION CODE...
-
-#define ESC ((uint8)0)
-#define EOL ((uint8)0)
-#define EOB ((uint8)1)
-#define DELTA ((uint8)2)
-
-#define OutBuffSize(x) ((x) + (((x) + 254) / 255 + 1) * 2 + 2)
-
-static uint16 EncodeScan(uint8 *pi, uint8 *po, uint16 scanlen, uint8 EndByte) {
- uint8 *ps = pi + 1;
- uint16 outlen = 0, limit, run;
-
- while (scanlen)
- {
- limit = (scanlen < 255) ? scanlen : 255;
- //imath_min(scanlen, 255);
- for (run = 1; run < limit && *pi == *ps; ++run, ++ps)
- ;
- if (run > 1)
- {
- scanlen -= run;
- *po++ = run;
- *po++ = *pi;
- outlen += 2;
- pi = ps++;
- } else if (scanlen < 3)
- {
- for (; scanlen; --scanlen)
- {
- *po++ = 1;
- *po++ = *pi++;
- outlen += 2;
- }
- } else
- {
- --ps;
- do
- {
- ++ps;
- while ((*ps != *(ps + 1) || *ps != *(ps + 2) || *ps != *(ps + 3)) && (ps - pi) < limit)
- ++ps;
- } while ((run = ps - pi) < 3);
- scanlen -= run;
- *po++ = ESC;
- *po++ = run;
- outlen += (run + 2);
- for (limit = 0; limit < run; ++limit)
- *po++ = *pi++;
- ++ps;
- }
- }
- *po++ = ESC;
- *po = EndByte;
- outlen += 2;
- return outlen;
-}
-
-uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest);
-uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest) {
- int i;
- uint32 Offset = 0;
-
- Dest->W = Source->W;
- Dest->h = Source->h;
- Dest->encoding = RLE8;
- Dest->stride = Source->stride;
-
- if (!(Dest->data = (uint8 *)mem_alloc(Source->h * OutBuffSize(Source->stride), "sprite data")))
- {
- return 0;
- }
- for (i = 0; i < Source->h - 1; ++i)
- Offset += EncodeScan(Source->data + i * Source->stride, Dest->data + Offset, Source->W, EOL);
-
- Offset += EncodeScan(Source->data + i * Source->stride, Dest->data + Offset, Source->W, EOB);
-
- Dest->data = (uint8 *)mem_realloc(Dest->data, Offset, "rle8 sprite data");
-
- return Offset;
-}
} // namespace M4
Commit: fec5b947fa9a3b24a0d365cdebb0544ca2168d73
https://github.com/scummvm/scummvm/commit/fec5b947fa9a3b24a0d365cdebb0544ca2168d73
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added RLE8Decode_Size
Changed paths:
engines/m4/graphics/gr_sprite.cpp
engines/m4/m4_types.h
engines/m4/platform/draw.cpp
engines/m4/platform/draw.h
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index b25e8166aa9..cf072579fff 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -85,56 +85,45 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
return 0;
}
-#define Scaled ((DrawReq->scaleY != 100) || (DrawReq->scaleX != 100 && DrawReq->scaleX != -100))
-#define Rle (Source.encoding == RLE8)
-#define Clipped ((DrawReq->x < 0) || (DrawReq->y < 0) || (DrawReq->x + Source.W > DrawReq->Dest->W) || (DrawReq->y + Source.h > DrawReq->Dest->h))
-#define Forward (DrawReq->scaleX > 0)
-#define Depthed (DrawReq->srcDepth)
-#define Shadow (Source.encoding & 0x80)
-#define ClipD (LeftOffset || RightOffset || BottomCut)
-
-uint8 gr_sprite_draw(DrawRequest *DrawReq) {
- Buffer Source;
- int32 LeftOffset = 0, RightOffset = 0, YPos;
- uint8 *ShadowBuff = NULL, *ScaledBuff = NULL;
- Buffer AfterScaled;
- uint8 BottomCut = 0;
-
- if (!DrawReq->Src) {
- term_message("NULL source data in sprite_draw");
- //error_fatal_abort(0, "no source data", __FILE__, __LINE__, 0,0,0);
+#define Scaled ((drawReq->scaleY != 100) || (drawReq->scaleX != 100 && drawReq->scaleX != -100))
+#define Rle (source.encoding == RLE8)
+#define Clipped ((drawReq->x < 0) || (drawReq->y < 0) || (drawReq->x + source.W > drawReq->Dest->W) || (drawReq->y + source.h > drawReq->Dest->h))
+#define Forward (drawReq->scaleX > 0)
+#define Depthed (drawReq->srcDepth)
+#define Shadow (source.encoding & 0x80)
+#define ClipD (leftOffset || rightOffset || bottomCut)
+
+uint8 gr_sprite_draw(DrawRequest *drawReq) {
+ Buffer source;
+ int32 leftOffset = 0, rightOffset = 0, YPos;
+ uint8 *shadowBuff = nullptr, *scaledBuff = nullptr;
+ Buffer afterScaled;
+ uint8 bottomCut = 0;
+
+ if (!drawReq->Src) {
+ term_message("nullptr source data in sprite_draw");
return 0;
}
- // - scaleY means don't bother drawing this sprite
-
- if (DrawReq->scaleY <= 0)
+ // Negative scaleY means don't bother drawing this sprite
+ if (drawReq->scaleY <= 0)
return 0;
- if ((!DrawReq->Src->W) || (!DrawReq->Src->h)) {
- //error_fatal_abort(0, "src->w, src->h zero", __FILE__, __LINE__, 0,0,0);
+ if ((!drawReq->Src->W) || (!drawReq->Src->h))
return 1;
- }
- AfterScaled.W = 0;
- AfterScaled.h = 0;
- AfterScaled.data = NULL;
- AfterScaled.encoding = 0;
- AfterScaled.stride = 0;
-
- /* copy DrawReq -> Src to Source buffer */
- memcpy(&Source, DrawReq->Src, sizeof(Buffer));
+ // copy DrawReq->Src to source buffer
+ source = *drawReq->Src;
/* check for RLE encoding in case of shadows */
// there is no RLE shadow draw routine, so we have to decode shadows ahead of time.
- if ((Source.encoding & RLE8) && (Source.encoding & SHADOW))
- {
- if (!(ShadowBuff = (uint8 *)mem_alloc(Source.stride * Source.h, "shadow buff")))
- error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", Source.W, Source.h);
+ if ((source.encoding & RLE8) && (source.encoding & SHADOW)) {
+ if (!(shadowBuff = (uint8 *)mem_alloc(source.stride * source.h, "shadow buff")))
+ error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", source.W, source.h);
- RLE8Decode(Source.data, ShadowBuff, Source.stride);
- Source.data = ShadowBuff;
- Source.encoding &= ~RLE8;
+ RLE8Decode(source.data, shadowBuff, source.stride);
+ source.data = shadowBuff;
+ source.encoding &= ~RLE8;
}
/* check for scaling */
@@ -145,67 +134,67 @@ uint8 gr_sprite_draw(DrawRequest *DrawReq) {
// if it's scaled we decode it first
if (Rle)
{
- if (!(ScaledBuff = (uint8 *)mem_alloc(Source.stride * Source.h, "scaled buffer")))
- error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", Source.W, Source.h);
+ if (!(scaledBuff = (uint8 *)mem_alloc(source.stride * source.h, "scaled buffer")))
+ error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", source.W, source.h);
- RLE8Decode(Source.data, ScaledBuff, Source.stride);
- Source.data = ScaledBuff;
- Source.encoding &= ~RLE8;
+ RLE8Decode(source.data, scaledBuff, source.stride);
+ source.data = scaledBuff;
+ source.encoding &= ~RLE8;
}
- if (scale_sprite(&Source, &AfterScaled, imath_abs(DrawReq->scaleX), imath_abs(DrawReq->scaleY)))
+ if (scale_sprite(&source, &afterScaled, imath_abs(drawReq->scaleX), imath_abs(drawReq->scaleY)))
{
- if (ShadowBuff) mem_free(ShadowBuff);
- if (ScaledBuff) mem_free(ScaledBuff);
+ if (shadowBuff) mem_free(shadowBuff);
+ if (scaledBuff) mem_free(scaledBuff);
error_show(FL, 'SPSF', "gr_sprite_draw");
}
/* preserve encoding */
- AfterScaled.encoding = Source.encoding;
+ afterScaled.encoding = source.encoding;
- /* copy AfterScaled to Source buffer */
- memcpy(&Source, &AfterScaled, sizeof(Buffer));
+ /* copy AfterScaled to source buffer */
+ memcpy(&source, &afterScaled, sizeof(Buffer));
}
- YPos = DrawReq->y;
+ YPos = drawReq->y;
/* check for clipping */
// if sprite is off edge of destination buffer, do something special
if (Clipped)
{
- if (-YPos >= Source.h)
+ if (-YPos >= source.h)
goto truly_done;
- if (YPos >= DrawReq->Dest->h)
+ if (YPos >= drawReq->Dest->h)
goto truly_done;
- if (-DrawReq->x >= Source.W)
+ if (-drawReq->x >= source.W)
goto truly_done;
- if (DrawReq->x >= DrawReq->Dest->W)
+ if (drawReq->x >= drawReq->Dest->W)
goto truly_done;
// if clipped off top, scan into sprite
if (YPos < 0)
{
if (Rle)
- Source.data = SkipRLE_Lines(-YPos, Source.data);
+ source.data = SkipRLE_Lines(-YPos, source.data);
else
- Source.data += -YPos * Source.stride;
- Source.h += YPos;
+ source.data += -YPos * source.stride;
+ source.h += YPos;
YPos = 0;
}
// find out if we're losing pixels on left or right
- if (DrawReq->x < 0)
- LeftOffset = -DrawReq->x;
+ if (drawReq->x < 0)
+ leftOffset = -drawReq->x;
- if (DrawReq->x + Source.W > DrawReq->Dest->W)
- RightOffset = DrawReq->x + Source.W - DrawReq->Dest->W;
+ if (drawReq->x + source.W > drawReq->Dest->W)
+ rightOffset = drawReq->x + source.W - drawReq->Dest->W;
- if (YPos + Source.h > DrawReq->Dest->h)
+ if (YPos + source.h > drawReq->Dest->h)
{
- Source.h -= YPos + Source.h - DrawReq->Dest->h;
- BottomCut = 1;
+ source.h -= YPos + source.h - drawReq->Dest->h;
+ bottomCut = 1;
}
}
@@ -214,81 +203,81 @@ uint8 gr_sprite_draw(DrawRequest *DrawReq) {
if (ClipD)
if (Depthed)
if (Forward)
- RLE_DrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ RLE_DrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
else
- RLE_DrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ RLE_DrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
else
if (Forward)
- RLE_DrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ RLE_DrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
else
- RLE_DrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ RLE_DrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
else
if (Depthed)
if (Forward)
- RLE_DrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ RLE_DrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
else
- RLE_DrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ RLE_DrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
else
if (Forward)
- RLE_Draw(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ RLE_Draw(&source, drawReq->Dest, drawReq->x, YPos);
else
- RLE_DrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ RLE_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
else if (Shadow) /* will be Raw_SDraw */
if (ClipD)
if (Depthed)
if (Forward)
- Raw_SDrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
else
- Raw_SDrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
else
if (Forward)
- Raw_SDrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
else
- Raw_SDrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
else
if (Depthed)
if (Forward)
- Raw_SDrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, drawReq->Pal, drawReq->ICT);
else
- Raw_SDrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, drawReq->Pal, drawReq->ICT);
else
if (Forward)
- Raw_SDraw(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDraw(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
else
- Raw_SDrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->Pal, DrawReq->ICT);
+ Raw_SDrawRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
else /* will be Raw_Draw */
if (ClipD)
if (Depthed)
if (Forward)
- Raw_DrawDepthOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ Raw_DrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
else
- Raw_DrawDepthRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode, LeftOffset, RightOffset);
+ Raw_DrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
else
if (Forward)
- Raw_DrawOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ Raw_DrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
else
- Raw_DrawRevOffs(&Source, DrawReq->Dest, DrawReq->x, YPos, LeftOffset, RightOffset);
+ Raw_DrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
else
if (Depthed)
if (Forward)
- Raw_DrawDepth(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ Raw_DrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
else
- Raw_DrawDepthRev(&Source, DrawReq->Dest, DrawReq->x, YPos, DrawReq->srcDepth, DrawReq->depthCode);
+ Raw_DrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
else
if (Forward)
- Raw_Draw(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ Raw_Draw(&source, drawReq->Dest, drawReq->x, YPos);
else
- Raw_DrawRev(&Source, DrawReq->Dest, DrawReq->x, YPos);
+ Raw_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
truly_done:
- if (ShadowBuff)
- mem_free(ShadowBuff);
+ if (shadowBuff)
+ mem_free(shadowBuff);
- if (ScaledBuff)
- mem_free(ScaledBuff);
+ if (scaledBuff)
+ mem_free(scaledBuff);
- if (AfterScaled.data)
- mem_free(AfterScaled.data);
+ if (afterScaled.data)
+ mem_free(afterScaled.data);
return 0;
}
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 2398ffebc05..88502c21618 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -65,11 +65,11 @@ enum {
};
struct Buffer {
- int32 W;
- int32 h;
- uint8 *data;
- uint8 encoding;
- int32 stride;
+ int32 W = 0;
+ int32 h = 0;
+ uint8 *data = nullptr;
+ uint8 encoding = 0;
+ int32 stride = 0;
};
struct token {
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index 735840c2715..b2bd7360840 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -89,6 +89,44 @@ uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData) {
return rleData;
}
+size_t RLE8Decode_Size(byte *src, int pitch) {
+ size_t total = 0, numLines = 0, x, y;
+ byte count;
+
+ for (;;) {
+ count = *src++;
+
+ if (count) {
+ total += count;
+ ++src;
+ } else {
+ count = *src++;
+
+ // TODO: This seems inconsistent with RLE8Decode. Verify the totals are correct sometime.
+ // Though, the method is only used for validation anyway, so minor issues won't hurt
+ if (count >= EOL_CODE) {
+ src += count;
+ count += count;
+
+ } else if (!(count & 3)) {
+ ++numLines;
+ count = pitch * numLines;
+
+ } else if (!(count & 2)) {
+ break;
+
+ } else {
+ x = *src++;
+ y = *src++;
+ numLines += y;
+ count += x + y * pitch;
+ }
+ }
+ }
+
+ return total;
+}
+
void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
error("TODO: RLE");
}
diff --git a/engines/m4/platform/draw.h b/engines/m4/platform/draw.h
index ff94ada47c6..de2db16c483 100644
--- a/engines/m4/platform/draw.h
+++ b/engines/m4/platform/draw.h
@@ -36,6 +36,15 @@ extern void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch);
*/
extern uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData);
+/**
+ * Returns the size of an RLE encoded image
+ * @param data RLE data
+ * @param pitch Image pitch
+ * @returns Decoded image's size in bytes
+ */
+extern size_t RLE8Decode_Size(byte *src, int pitch);
+
+
extern void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
extern void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
extern void RLE_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
Commit: 9e6d8e861799900bef274982bbece1c5255e04ab
https://github.com/scummvm/scummvm/commit/9e6d8e861799900bef274982bbece1c5255e04ab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Formatting in gr_sprite_draw
Changed paths:
engines/m4/graphics/gr_sprite.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index cf072579fff..2d5f36e3784 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -109,14 +109,14 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
if (drawReq->scaleY <= 0)
return 0;
- if ((!drawReq->Src->W) || (!drawReq->Src->h))
+ if (!drawReq->Src->W || !drawReq->Src->h)
return 1;
- // copy DrawReq->Src to source buffer
+ // Copy DrawReq->Src to source buffer
source = *drawReq->Src;
- /* check for RLE encoding in case of shadows */
- // there is no RLE shadow draw routine, so we have to decode shadows ahead of time.
+ // Check for RLE encoding in case of shadows
+ // There is no RLE shadow draw routine, so we have to decode shadows ahead of time.
if ((source.encoding & RLE8) && (source.encoding & SHADOW)) {
if (!(shadowBuff = (uint8 *)mem_alloc(source.stride * source.h, "shadow buff")))
error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", source.W, source.h);
@@ -126,14 +126,12 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source.encoding &= ~RLE8;
}
- /* check for scaling */
- // we scale before we draw
- if (Scaled)
- {
- /* check if input is RLE8 encoded */
- // if it's scaled we decode it first
- if (Rle)
- {
+ // Check for scaling
+ // We scale before we draw
+ if (Scaled) {
+ // Check if input is RLE8 encoded
+ // If it's scaled we decode it first
+ if (Rle) {
if (!(scaledBuff = (uint8 *)mem_alloc(source.stride * source.h, "scaled buffer")))
error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", source.W, source.h);
@@ -141,26 +139,25 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source.data = scaledBuff;
source.encoding &= ~RLE8;
}
- if (scale_sprite(&source, &afterScaled, imath_abs(drawReq->scaleX), imath_abs(drawReq->scaleY)))
- {
+
+ if (scale_sprite(&source, &afterScaled, imath_abs(drawReq->scaleX), imath_abs(drawReq->scaleY))) {
if (shadowBuff) mem_free(shadowBuff);
if (scaledBuff) mem_free(scaledBuff);
error_show(FL, 'SPSF', "gr_sprite_draw");
}
- /* preserve encoding */
+ // Preserve encoding
afterScaled.encoding = source.encoding;
- /* copy AfterScaled to source buffer */
+ // Copy AfterScaled to source buffer
memcpy(&source, &afterScaled, sizeof(Buffer));
}
YPos = drawReq->y;
- /* check for clipping */
- // if sprite is off edge of destination buffer, do something special
- if (Clipped)
- {
+ // Check for clipping
+ // If sprite is off edge of destination buffer, do something special
+ if (Clipped) {
if (-YPos >= source.h)
goto truly_done;
@@ -174,32 +171,31 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
goto truly_done;
// if clipped off top, scan into sprite
- if (YPos < 0)
- {
+ if (YPos < 0) {
if (Rle)
source.data = SkipRLE_Lines(-YPos, source.data);
else
source.data += -YPos * source.stride;
+
source.h += YPos;
YPos = 0;
}
- // find out if we're losing pixels on left or right
+ // Find out if we're losing pixels on left or right
if (drawReq->x < 0)
leftOffset = -drawReq->x;
if (drawReq->x + source.W > drawReq->Dest->W)
rightOffset = drawReq->x + source.W - drawReq->Dest->W;
- if (YPos + source.h > drawReq->Dest->h)
- {
+ if (YPos + source.h > drawReq->Dest->h) {
source.h -= YPos + source.h - drawReq->Dest->h;
bottomCut = 1;
}
}
- /* after all the necessary changes (scaling/shadow RLE expansion) */
- if (Rle) /* will be RLE_Draw */
+ // After all the necessary changes (scaling/shadow RLE expansion)
+ if (Rle) // Will be RLE_Draw
if (ClipD)
if (Depthed)
if (Forward)
@@ -222,7 +218,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
RLE_Draw(&source, drawReq->Dest, drawReq->x, YPos);
else
RLE_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
- else if (Shadow) /* will be Raw_SDraw */
+ else if (Shadow) // Will be Raw_SDraw
if (ClipD)
if (Depthed)
if (Forward)
@@ -245,7 +241,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
Raw_SDraw(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
else
Raw_SDrawRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
- else /* will be Raw_Draw */
+ else // Will be Raw_Draw
if (ClipD)
if (Depthed)
if (Forward)
Commit: e7104738bd6775f29619b9c022226f58e52f934f
https://github.com/scummvm/scummvm/commit/e7104738bd6775f29619b9c022226f58e52f934f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Casing fixes and calling RLE8Decod_Size
Changed paths:
engines/m4/graphics/gr_sprite.cpp
engines/m4/platform/draw.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 2d5f36e3784..3e43ba5ca2e 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -115,6 +115,12 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// Copy DrawReq->Src to source buffer
source = *drawReq->Src;
+ // if it's RLE encoded, ensure the sprite will decode to match the expected size
+ if (source.encoding & RLE8) {
+ if (RLE8Decode_Size(source.data, source.stride) != (source.stride * source.h))
+ error_show(FL, 'RLE8', "RLE8 sprite suspected BAD!");
+ }
+
// Check for RLE encoding in case of shadows
// There is no RLE shadow draw routine, so we have to decode shadows ahead of time.
if ((source.encoding & RLE8) && (source.encoding & SHADOW)) {
@@ -141,8 +147,11 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
}
if (scale_sprite(&source, &afterScaled, imath_abs(drawReq->scaleX), imath_abs(drawReq->scaleY))) {
- if (shadowBuff) mem_free(shadowBuff);
- if (scaledBuff) mem_free(scaledBuff);
+ if (shadowBuff)
+ mem_free(shadowBuff);
+ if (scaledBuff)
+ mem_free(scaledBuff);
+
error_show(FL, 'SPSF', "gr_sprite_draw");
}
@@ -150,7 +159,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
afterScaled.encoding = source.encoding;
// Copy AfterScaled to source buffer
- memcpy(&source, &afterScaled, sizeof(Buffer));
+ source = afterScaled;
}
YPos = drawReq->y;
@@ -195,7 +204,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
}
// After all the necessary changes (scaling/shadow RLE expansion)
- if (Rle) // Will be RLE_Draw
+ if (Rle) {
+ // Will be RLE_Draw
if (ClipD)
if (Depthed)
if (Forward)
@@ -218,7 +228,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
RLE_Draw(&source, drawReq->Dest, drawReq->x, YPos);
else
RLE_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
- else if (Shadow) // Will be Raw_SDraw
+ } else if (Shadow) {
+ // Will be Raw_SDraw
if (ClipD)
if (Depthed)
if (Forward)
@@ -241,7 +252,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
Raw_SDraw(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
else
Raw_SDrawRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
- else // Will be Raw_Draw
+ } else {
+ // Will be Raw_Draw
if (ClipD)
if (Depthed)
if (Forward)
@@ -264,6 +276,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
Raw_Draw(&source, drawReq->Dest, drawReq->x, YPos);
else
Raw_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
+ }
truly_done:
if (shadowBuff)
@@ -274,6 +287,7 @@ truly_done:
if (afterScaled.data)
mem_free(afterScaled.data);
+
return 0;
}
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index b2bd7360840..676fbf7fbfd 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -102,8 +102,7 @@ size_t RLE8Decode_Size(byte *src, int pitch) {
} else {
count = *src++;
- // TODO: This seems inconsistent with RLE8Decode. Verify the totals are correct sometime.
- // Though, the method is only used for validation anyway, so minor issues won't hurt
+ // TODO: This seems inconsistent with RLE8Decode. Verify the totals are correct
if (count >= EOL_CODE) {
src += count;
count += count;
Commit: cdb820f10aafa00161f83b2367b36670a7bd9afb
https://github.com/scummvm/scummvm/commit/cdb820f10aafa00161f83b2367b36670a7bd9afb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change drawSprite to gr_sprite_draw
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/adv_scale.cpp
engines/m4/burger/vars.cpp
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_line.cpp
engines/m4/graphics/gr_sprite.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/m4_types.h
engines/m4/platform/draw.cpp
engines/m4/platform/tile/tile_read.cpp
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 960f82a5b85..04feee17cc8 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -114,7 +114,7 @@ bool this_is_a_walkcode(int32 x, int32 y) {
return false;
// Verify params
- if (x < 0 || y < 0 || x >= walkCodes->W || y >= walkCodes->h)
+ if (x < 0 || y < 0 || x >= walkCodes->w || y >= walkCodes->h)
return false;
ptr = gr_buffer_pointer(walkCodes, x, y);
@@ -138,7 +138,7 @@ int32 get_screen_depth(int32 x, int32 y) {
}
// Verify params
- if (x < 0 || y < 0 || x >= walkCodes->W || y >= walkCodes->h) {
+ if (x < 0 || y < 0 || x >= walkCodes->w || y >= walkCodes->h) {
return -1;
}
@@ -160,7 +160,7 @@ int32 get_screen_color(int32 x, int32 y) {
}
//verify params
- if (x < 0 || y < 0 || x >= game_buff->W || y >= game_buff->h) {
+ if (x < 0 || y < 0 || x >= game_buff->w || y >= game_buff->h) {
return -1;
}
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index b5ee7c0ecaa..87da08192b0 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -336,7 +336,7 @@ static void recreate_animation_draw_screen(GrBuff **loadBuf) {
Buffer *theBuff = (**loadBuf).get_buffer();
Buffer *game_buff = (*_G(gameDrawBuff)).get_buffer();
gr_buffer_rect_copy_2(theBuff, game_buff, 0, 0, 0, 0,
- imath_min((**loadBuf).w, game_buff->W), imath_min((**loadBuf).h, game_buff->h));
+ imath_min((**loadBuf).w, game_buff->w), imath_min((**loadBuf).h, game_buff->h));
(**loadBuf).release();
(*_G(gameDrawBuff)).release();
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index 4f75fa3c0c1..095da486a56 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -429,7 +429,7 @@ void CreateEdge(int32 node1, int32 node2, Buffer *walkCodes) {
if (walkCodes && walkCodes->data) {
// Initialize the buffer data pointer, the maximum dimensions of the buffer, and the scan x and y
- width = walkCodes->W;
+ width = walkCodes->w;
stride = walkCodes->stride;
height = walkCodes->h;
scanX = x1;
diff --git a/engines/m4/adv_r/adv_scale.cpp b/engines/m4/adv_r/adv_scale.cpp
index 2a8ef38d4e3..acaf33b7891 100644
--- a/engines/m4/adv_r/adv_scale.cpp
+++ b/engines/m4/adv_r/adv_scale.cpp
@@ -48,14 +48,14 @@ static void scale_editor_undraw() {
if (_GS(old_back) != -1) {
gr_buffer_rect_copy_2(scr_orig, game_buff, 0, _GS(old_back) - LABEL_OFFSET, 0,
- _GS(old_back) - LABEL_OFFSET, scr_orig->W, LABEL_OFFSET + 1);
- RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->W, _GS(old_back) + 1, game_buff_ptr);
+ _GS(old_back) - LABEL_OFFSET, scr_orig->w, LABEL_OFFSET + 1);
+ RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->w, _GS(old_back) + 1, game_buff_ptr);
_GS(old_back) = -1;
}
if (_GS(old_front) != -1) {
gr_buffer_rect_copy_2(scr_orig, game_buff, 0, _GS(old_front) - LABEL_OFFSET, 0,
- _GS(old_front) - LABEL_OFFSET, scr_orig->W, LABEL_OFFSET + 1);
- RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->W, _GS(old_front) + 1, game_buff_ptr);
+ _GS(old_front) - LABEL_OFFSET, scr_orig->w, LABEL_OFFSET + 1);
+ RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->w, _GS(old_front) + 1, game_buff_ptr);
_GS(old_front) = -1;
}
@@ -96,8 +96,8 @@ void scale_editor_draw() {
_GS(myfront) = _GS(old_front) = _G(currentSceneDef).front_y;
_GS(mybs) = _G(currentSceneDef).back_scale;
_GS(myfs) = _G(currentSceneDef).front_scale;
- gr_hline(game_buff, 0, scr_orig->W, _GS(old_back));
- gr_hline(game_buff, 0, scr_orig->W, _GS(old_front));
+ gr_hline(game_buff, 0, scr_orig->w, _GS(old_back));
+ gr_hline(game_buff, 0, scr_orig->w, _GS(old_front));
char string[20];
gr_font_set_color(__WHITE);
@@ -105,15 +105,15 @@ void scale_editor_draw() {
Common::sprintf_s(string, "Front: %ld, %ld", _GS(old_front), _G(currentSceneDef).front_scale);
int x;
- for (x = 10; x < scr_orig->W - 220; x += 400)
+ for (x = 10; x < scr_orig->w - 220; x += 400)
gr_font_write(game_buff, string, x, _GS(old_front) - LABEL_OFFSET, 0, 0);
Common::sprintf_s(string, "Back: %ld, %ld", _GS(old_back), _G(currentSceneDef).back_scale);
- for (x = 110; x < scr_orig->W - 320; x += 400)
+ for (x = 110; x < scr_orig->w - 320; x += 400)
gr_font_write(game_buff, string, x, _GS(old_back) - LABEL_OFFSET, 0, 0);
- RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->W, _GS(old_back) + 1, game_buff_ptr);
- RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->W, _GS(old_front) + 1, game_buff_ptr);
+ RestoreScreensInContext(0, _GS(old_back) - LABEL_OFFSET, scr_orig->w, _GS(old_back) + 1, game_buff_ptr);
+ RestoreScreensInContext(0, _GS(old_front) - LABEL_OFFSET, scr_orig->w, _GS(old_front) + 1, game_buff_ptr);
_G(game_bgBuff)->release();
_G(gameDrawBuff)->release();
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 9048fb674e1..89ac67821fa 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -155,7 +155,7 @@ void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
if (maxW && maxH) {
_mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
- _mouseBuffer.W = maxW;
+ _mouseBuffer.w = maxW;
_mouseBuffer.h = maxH;
_mouseBuffer.stride = maxW;
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index d3f18ce8eb1..0a8f2681546 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -95,7 +95,7 @@ Buffer *GrBuff::get_buffer() {
{
lock();
dummy.data = (uint8 *)*pixmap;
- dummy.W = w;
+ dummy.w = w;
dummy.h = h;
dummy.encoding = 0;
dummy.stride = pitch;
@@ -111,7 +111,7 @@ void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x
int32 gr_buffer_free(Buffer *buf) {
- buf->W = buf->h = buf->stride = 0;
+ buf->w = buf->h = buf->stride = 0;
if (buf->data != NULL) {
mem_free((char *)buf->data);
@@ -145,7 +145,7 @@ int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
if (buf->data)
error_show(FL, 'BUFR', "buffer_init %s", name);
- buf->W = w;
+ buf->w = w;
buf->h = h;
buf->stride = w;
@@ -169,12 +169,12 @@ bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
h = from->h;
// if source x,y or dest x,y won't touch dest or source buffers, we're done
- if ((sx > from->W) || (sy > from->h) || (dx > to->W) || (dy > to->h))
+ if ((sx > from->w) || (sy > from->h) || (dx > to->w) || (dy > to->h))
return true;
// if dest request intersects dest buffer, clip dest request
- if ((dx + w) > to->W)
- w = to->W - dx;
+ if ((dx + w) > to->w)
+ w = to->w - dx;
if ((dy + h) > to->h)
h = to->h - dy;
@@ -212,12 +212,12 @@ int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h)
error_show(FL, 'BUF!', "buffer_rect_fill");
// if nothing to fill, we're done
- if ((w < 1) || (h < 1) || (x1 > target->W) || (y1 > target->h))
+ if ((w < 1) || (h < 1) || (x1 > target->w) || (y1 > target->h))
return true;
// clip if rectangles too big
- if ((x1 + w) > target->W)
- w = target->W - x1;
+ if ((x1 + w) > target->w)
+ w = target->w - x1;
if ((y1 + h) > target->h)
h = target->h - y1;
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index 79886b8ab6a..1259d609980 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -255,9 +255,9 @@ int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y, int32 w,
int32 i, j;
int32 target_w;
if (w)
- target_w = imath_min(target->W, x + w);
+ target_w = imath_min(target->w, x + w);
else
- target_w = target->W;
+ target_w = target->w;
x += 1; y += 1;
int32 skipTop = 0;
diff --git a/engines/m4/graphics/gr_line.cpp b/engines/m4/graphics/gr_line.cpp
index 5940327d9c7..d7f14517be8 100644
--- a/engines/m4/graphics/gr_line.cpp
+++ b/engines/m4/graphics/gr_line.cpp
@@ -32,7 +32,7 @@ void gr_vline_xor(Buffer *buf, int32 x, int32 y1, int32 y2) {
i = y1; y1 = y2; y2 = i;
}
- if ((x > buf->W) || (y1 > buf->h))
+ if ((x > buf->w) || (y1 > buf->h))
return;
if (y2 > buf->h)
@@ -52,7 +52,7 @@ void gr_hline_xor(Buffer *buf, int32 x1, int32 x2, int32 y) {
i = x1; x1 = x2; x2 = i;
}
- if ((y > buf->h) || (x1 > buf->W))
+ if ((y > buf->h) || (x1 > buf->w))
return;
start = gr_buffer_pointer(buf, x1, y);
@@ -69,7 +69,7 @@ void gr_vline(Buffer *buf, int32 x, int32 y1, int32 y2) {
i = y1; y1 = y2; y2 = i;
}
- if ((x > buf->W) || (y1 > buf->h))
+ if ((x > buf->w) || (y1 > buf->h))
return;
y2++;
@@ -90,14 +90,14 @@ void gr_hline(Buffer *buf, int32 x1, int32 x2, int32 y) {
i = x1; x1 = x2; x2 = i;
}
- if ((y > buf->h) || (x1 > buf->W))
+ if ((y > buf->h) || (x1 > buf->w))
return;
start = gr_buffer_pointer(buf, x1, y);
x2++;
- if (x2 > buf->W)
- x2 = buf->W;
+ if (x2 > buf->w)
+ x2 = buf->w;
for (i = x1; i < x2; i++, start++)
*start = _G(color);
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 3e43ba5ca2e..1716fb222bd 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -42,19 +42,19 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
uint8 *pScaled, *pData = S->data;
if (!D || !S)
- error_show(FL, 'BUF!', "scale sprite h:%ld w:%ld sx:%uld sy:%uld", D->h, D->W, ScaleX, ScaleY);
+ error_show(FL, 'BUF!', "scale sprite h:%ld w:%ld sx:%uld sy:%uld", D->h, D->w, ScaleX, ScaleY);
/* calculate new x size */
- D->W = S->W * ScaleX / 100;
- if (S->W * ScaleX % 100 >= 50)
- ++D->W;
+ D->w = S->w * ScaleX / 100;
+ if (S->w * ScaleX % 100 >= 50)
+ ++D->w;
/* calculate new y size */
D->h = S->h * ScaleY / 100;
if (S->h * ScaleY % 100 >= 50)
++D->h;
- D->stride = D->W;
+ D->stride = D->w;
/* allocate 'scaled' buffer */
if (!(D->data = pScaled = (uint8 *)mem_alloc(D->h * D->stride, "scaled buffer")))
@@ -67,7 +67,7 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
while (ErrY >= 100)
{
ErrX = 50;
- for (j = 0; j < S->W; ++j)
+ for (j = 0; j < S->w; ++j)
{
ErrX += ScaleX;
while (ErrX >= 100)
@@ -78,16 +78,16 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
++pData;
}
ErrY -= 100;
- pData -= S->W;
+ pData -= S->w;
}
- pData += S->W;
+ pData += S->w;
}
return 0;
}
#define Scaled ((drawReq->scaleY != 100) || (drawReq->scaleX != 100 && drawReq->scaleX != -100))
#define Rle (source.encoding == RLE8)
-#define Clipped ((drawReq->x < 0) || (drawReq->y < 0) || (drawReq->x + source.W > drawReq->Dest->W) || (drawReq->y + source.h > drawReq->Dest->h))
+#define Clipped ((drawReq->x < 0) || (drawReq->y < 0) || (drawReq->x + source.w > drawReq->Dest->w) || (drawReq->y + source.h > drawReq->Dest->h))
#define Forward (drawReq->scaleX > 0)
#define Depthed (drawReq->srcDepth)
#define Shadow (source.encoding & 0x80)
@@ -109,7 +109,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
if (drawReq->scaleY <= 0)
return 0;
- if (!drawReq->Src->W || !drawReq->Src->h)
+ if (!drawReq->Src->w || !drawReq->Src->h)
return 1;
// Copy DrawReq->Src to source buffer
@@ -117,7 +117,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// if it's RLE encoded, ensure the sprite will decode to match the expected size
if (source.encoding & RLE8) {
- if (RLE8Decode_Size(source.data, source.stride) != (source.stride * source.h))
+ if (RLE8Decode_Size(source.data, source.stride) != (size_t)(source.stride * source.h))
error_show(FL, 'RLE8', "RLE8 sprite suspected BAD!");
}
@@ -125,7 +125,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// There is no RLE shadow draw routine, so we have to decode shadows ahead of time.
if ((source.encoding & RLE8) && (source.encoding & SHADOW)) {
if (!(shadowBuff = (uint8 *)mem_alloc(source.stride * source.h, "shadow buff")))
- error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", source.W, source.h);
+ error_show(FL, 'OOM!', "buffer w:%uld, h:%uld", source.w, source.h);
RLE8Decode(source.data, shadowBuff, source.stride);
source.data = shadowBuff;
@@ -139,7 +139,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// If it's scaled we decode it first
if (Rle) {
if (!(scaledBuff = (uint8 *)mem_alloc(source.stride * source.h, "scaled buffer")))
- error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", source.W, source.h);
+ error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", source.w, source.h);
RLE8Decode(source.data, scaledBuff, source.stride);
source.data = scaledBuff;
@@ -173,10 +173,10 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
if (YPos >= drawReq->Dest->h)
goto truly_done;
- if (-drawReq->x >= source.W)
+ if (-drawReq->x >= source.w)
goto truly_done;
- if (drawReq->x >= drawReq->Dest->W)
+ if (drawReq->x >= drawReq->Dest->w)
goto truly_done;
// if clipped off top, scan into sprite
@@ -194,8 +194,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
if (drawReq->x < 0)
leftOffset = -drawReq->x;
- if (drawReq->x + source.W > drawReq->Dest->W)
- rightOffset = drawReq->x + source.W - drawReq->Dest->W;
+ if (drawReq->x + source.w > drawReq->Dest->w)
+ rightOffset = drawReq->x + source.w - drawReq->Dest->w;
if (YPos + source.h > drawReq->Dest->h) {
source.h -= YPos + source.h - drawReq->Dest->h;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index ac9e8517964..1ea5e5b94b1 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -229,7 +229,7 @@ void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay) {
}
gr_pal_set_range(_GP(trick), GREY_START, NUM_GREYS); ///set pal GREY_START-GREY_END
- remap_buffer_with_luminance_map(grey_screen, 0, 0, grey_screen->W - 1, screen_height(grey_screen) - 1);
+ remap_buffer_with_luminance_map(grey_screen, 0, 0, grey_screen->w - 1, screen_height(grey_screen) - 1);
_G(gameDrawBuff)->release();
RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
}
@@ -392,7 +392,7 @@ void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2,
int32 x, y;
if ((!src) || (!src->data)) return;
if ((x2 - x1 < 0) || (y2 - y1 < 0)) return;
- if (x2 - x1 + 1 > src->W) x2 = src->W - 1;
+ if (x2 - x1 + 1 > src->w) x2 = src->w - 1;
if (y2 - y1 + 1 > src->h) y2 = src->h - 1;
x2 -= x1;
@@ -506,7 +506,7 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
if (percent == 0) {
gr_color_set(__BLACK);
- gr_buffer_rect_fill(target, 0, 0, target->W, target->h);
+ gr_buffer_rect_fill(target, 0, 0, target->w, target->h);
return;
}
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index 9e84ecceac4..619aa84f076 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -67,7 +67,7 @@ static void Buffer_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler) {
int32 x2, y2;
- x2 = x1 + myBuf->W - 1;
+ x2 = x1 + myBuf->w - 1;
y2 = y1 + myBuf->h - 1;
if (!vmng_screen_create(x1, y1, x2, y2, SCRN_BUF, scrnFlags | SF_OFFSCRN, (void *)myBuf,
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 649c3a9b685..40cfda90a8b 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -164,7 +164,7 @@ bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 t
bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag) {
Item *myItem;
if ((myItem = ItemAdd(d->itemList, x, y,
- myBuff->W, myBuff->h, (char *)myBuff->data, tag, PICTURE, nullptr, 0)) == nullptr) {
+ myBuff->w, myBuff->h, (char *)myBuff->data, tag, PICTURE, nullptr, 0)) == nullptr) {
return false;
}
if (!d->itemList) d->itemList = myItem;
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 352b4302600..6574b08943a 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -1402,7 +1402,7 @@ bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
y1 = i->y;
x2 = x1 + i->w - 1;
y2 = y1 + i->h - 1;
- if ((x1 < 0) || (y1 < 0) || (x2 >= scrBuf->W) || (y2 >= scrBuf->h)) return false;
+ if ((x1 < 0) || (y1 < 0) || (x2 >= scrBuf->w) || (y2 >= scrBuf->h)) return false;
currFont = gr_font_get();
if (i->myFont != currFont)
@@ -1438,11 +1438,11 @@ bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
item_string_write(scrBuf, i->prompt, x1, y1, 0, 1, __BLACK, __BLUE);
break;
case PICTURE:
- pictBuff.W = i->w;
+ pictBuff.w = i->w;
pictBuff.h = i->h;
pictBuff.stride = i->w;
pictBuff.data = (uint8 *)(i->aux);
- gr_buffer_rect_copy_2(&pictBuff, scrBuf, 0, 0, x1, y1, pictBuff.W, pictBuff.h);
+ gr_buffer_rect_copy_2(&pictBuff, scrBuf, 0, 0, x1, y1, pictBuff.w, pictBuff.h);
break;
case TEXTFIELD:
if (itemType == ITEM_DEFAULT) {
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index 7ca474d3769..d9ba883d668 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -34,7 +34,7 @@ bool gui_mouse_init() {
if ((_G(mouseBuffer).data = (uint8 *)mem_alloc(32 * 32, "mouse graphic")) == NULL) {
return false;
}
- _G(mouseBuffer).W = 32;
+ _G(mouseBuffer).w = 32;
_G(mouseBuffer).stride = 32;
_G(mouseBuffer).h = 32;
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 88502c21618..59812ac696f 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -65,7 +65,7 @@ enum {
};
struct Buffer {
- int32 W = 0;
+ int32 w = 0;
int32 h = 0;
uint8 *data = nullptr;
uint8 encoding = 0;
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index 676fbf7fbfd..5d1237023bf 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -71,8 +71,6 @@ void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
}
uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData) {
- byte val;
-
while (linesToSkip > 0) {
if (*rleData) {
// Simple RLE sequence, so skip over count and value
diff --git a/engines/m4/platform/tile/tile_read.cpp b/engines/m4/platform/tile/tile_read.cpp
index fb0e264ed15..a6e27399a35 100644
--- a/engines/m4/platform/tile/tile_read.cpp
+++ b/engines/m4/platform/tile/tile_read.cpp
@@ -114,7 +114,7 @@ Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y) {
error_show(FL, 'OOM!', "fail to allocate mem for buffer structure");
out->data = nullptr;
- out->W = 0;
+ out->w = 0;
out->stride = 0;
out->h = 0;
@@ -136,14 +136,14 @@ Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y) {
gr_buffer_init(out, "back tile", tile_x, tile_y);
if (out->data == nullptr) {
- out->W = 0;
+ out->w = 0;
out->stride = 0;
out->h = 0;
error_show(FL, 'OOM!', "fail to allocate mem for .TT buffer");
return out;
}
- out->W = out->stride = tile_x;
+ out->w = out->stride = tile_x;
out->h = tile_y;
bufferHandle = out->data;
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index e14dc9d453f..0a6aa581599 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -26,6 +26,7 @@
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/dbg/debug.h"
+#include "m4/graphics/gr_sprite.h"
#include "m4/graphics/rend.h"
#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
@@ -170,24 +171,26 @@ static void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *s
source->data = (uint8 *)((byte *)*(source->sourceHandle) + source->sourceOffset);
}
- RendGrBuff Destination;
- DrawRequestX dr;
+ Buffer Destination;
+ DrawRequest dr;
RendCell Frame;
- Destination.Width = source->w;
- Destination.Height = source->h;
- Destination.Pitch = source->w;
+ Destination.w = source->w;
+ Destination.h = source->h;
+ Destination.stride = source->w;
Destination.encoding = (myPalette && ICT) ? source->encoding : source->encoding & 0x7f;
- Destination.PixMap = source->data;
+ Destination.data = source->data;
+ dr.Src = &Destination;
+ dr.Dest = halScrnBuf;
dr.x = myAnim8->myRegs[IDX_X] >> 16;
dr.y = myAnim8->myRegs[IDX_Y] >> 16;
- dr.scale_x = myCCB->scaleX;
- dr.scale_y = myCCB->scaleY;
- dr.depth_map = screenCodeBuff->get_pixmap(); // TODO: Confirm this
- dr.Pal = (RGBcolor *)myPalette;
+ dr.scaleX = myCCB->scaleX;
+ dr.scaleY = myCCB->scaleY;
+ dr.depthCode = screenCodeBuff->get_pixmap(); // TODO: Confirm this
+ dr.Pal = myPalette;
dr.ICT = ICT;
- dr.depth = myCCB->layer >> 8;
+ dr.srcDepth = myCCB->layer >> 8;
Frame.hot_x = myCCB->source->xOffset;
Frame.hot_y = myCCB->source->yOffset;
@@ -202,13 +205,12 @@ static void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *s
Frame.data = source->data;
// And draw the sprite
- render_sprite_to_8BBM(&Destination, &dr, &Frame, clipRect, updateRect);
+ gr_sprite_draw(&dr);
myCCB->flags &= ~CCB_REDRAW;
- if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ if (!(myCCB->flags & CCB_DISC_STREAM))
// Unlock the sprite's handle
HUnLock(source->sourceHandle);
- }
}
void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
@@ -230,7 +232,7 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
Buffer *halScrnBuf = _G(gameDrawBuff)->get_buffer();
noClipRect.x1 = 0;
noClipRect.y1 = 0;
- noClipRect.x2 = halScrnBuf->W - 1;
+ noClipRect.x2 = halScrnBuf->w - 1;
noClipRect.y2 = halScrnBuf->h - 1;
scrnX1 = myScreen->x1;
@@ -250,7 +252,7 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
while (myRect) {
restoreBgndX1 = imath_max(myRect->x1, 0);
restoreBgndY1 = imath_max(myRect->y1, 0);
- restoreBgndX2 = imath_min(myRect->x2, background->W - 1);
+ restoreBgndX2 = imath_min(myRect->x2, background->w - 1);
restoreBgndY2 = imath_min(myRect->y2, background->h - 1);
gr_buffer_rect_copy(background, halScrnBuf, restoreBgndX1, restoreBgndY1,
restoreBgndX2 - restoreBgndX1 + 1, restoreBgndY2 - restoreBgndY1 + 1);
Commit: 3cbf54e1464ecbb13b454f4461c17b1625624e65
https://github.com/scummvm/scummvm/commit/3cbf54e1464ecbb13b454f4461c17b1625624e65
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Properly implement ws_DoDisplay
Changed paths:
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 0a6aa581599..dcb37b729d6 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -152,8 +152,8 @@ machine *kernel_timer_callback(int32 ticks, int16 trigger, MessageCB callMe) {
return (TriggerMachineByHash(1, nullptr, -1, -1, callMe, false, "timer callback"));
}
-static void DrawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff,
- uint8 *myPalette, uint8 *ICT, M4Rect *clipRect, M4Rect *updateRect) {
+static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff,
+ uint8 *myPalette, uint8 *ICT) {
M4sprite *source;
// Temporary var to prevent excessive dereferences
@@ -222,18 +222,14 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
int32 status, scrnX1, scrnY1;
int32 restoreBgndX1, restoreBgndY1, restoreBgndX2, restoreBgndY2;
Anim8 *myAnim8;
- M4Rect *currRect, intersectRect, noClipRect, dummyRect;
- bool greyMode;
+ M4Rect *currRect, *newRect;
+ bool greyMode, breakFlag;
if (((myScreen = vmng_screen_find(_G(gameDrawBuff), &status)) == nullptr) || (status != SCRN_ACTIVE)) {
return;
}
Buffer *halScrnBuf = _G(gameDrawBuff)->get_buffer();
- noClipRect.x1 = 0;
- noClipRect.y1 = 0;
- noClipRect.x2 = halScrnBuf->w - 1;
- noClipRect.y2 = halScrnBuf->h - 1;
scrnX1 = myScreen->x1;
scrnY1 = myScreen->y1;
@@ -244,18 +240,118 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
drawRectList = _GWS(deadRectList);
_GWS(deadRectList) = nullptr;
- // The drawRectList already contains all the areas of the screen that need the
- // background updated
+ // Now we loop back to front and set up a list of drawing areas
+ myAnim8 = _GWS(myCruncher)->backLayerAnim8;
+ while (myAnim8) {
+ myCCB = myAnim8->myCCB;
+
+ if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW)) && (myCCB->flags & CCB_REDRAW)) {
+ currRect = myCCB->currLocation;
+ newRect = myCCB->newLocation;
+
+ if (!(myCCB->flags & CCB_STREAM) && (!greyMode || !(myCCB->source->encoding & 0x80))) {
+ vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1,
+ currRect->x2, currRect->y2);
+
+ if ((!greyMode && (myCCB->source->encoding & 0x80)) ||
+ (greyMode && !(myCCB->source->encoding & 0x80))) {
+ vmng_AddRectToRectList(&drawRectList, newRect->x1, newRect->y1,
+ newRect->x2, newRect->y2);
+ }
+ }
+
+ // Copy over rect
+ *currRect = *newRect;
+ }
+
+ myAnim8 = myAnim8->infront;
+ }
+
+ // The drawRectList now contains all the areas of the screen that need the background updated
// Update the background behind the current rect list - if we are in greyMode, we do this later
- if (background && background->data) {
+ if (!greyMode && background && background->data) {
+ myRect = drawRectList;
+
+ while (myRect) {
+ restoreBgndX1 = imath_max(myRect->x1, 0);
+ restoreBgndY1 = imath_max(myRect->y1, 0);
+ restoreBgndX2 = imath_min(myRect->x2, background->w - 1);
+ restoreBgndY2 = imath_min(myRect->y2, background->h - 1);
+
+ gr_buffer_rect_copy(background, halScrnBuf, restoreBgndX1, restoreBgndY1,
+ restoreBgndX2 - restoreBgndX1 + 1, restoreBgndY2 - restoreBgndY1 + 1);
+
+ myRect = myRect->next;
+ }
+ }
+
+ // Further iteration to set up drawing rects
+ myAnim8 = _GWS(myCruncher)->backLayerAnim8;
+ while (myAnim8) {
+ myCCB = myAnim8->myCCB;
+
+ if (myCCB && myCCB->source && !(myCCB->flags & CCB_NO_DRAW) && (myCCB->flags & CCB_REDRAW)) {
+ if (!(myCCB->source->encoding & 0x80) || (myCCB->flags & CCB_STREAM)) {
+ currRect = myCCB->currLocation;
+ vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1,
+ currRect->x2, currRect->y2);
+ }
+ }
+
+ myAnim8 = myAnim8->infront;
+ }
+
+ // Handle merging intersecting draw rects
+ do {
+ // Presume we'll be able to break
+ breakFlag = true;
+
+ // Iterate through the rects
+ myAnim8 = _GWS(myCruncher)->backLayerAnim8;
+ while (myAnim8) {
+ myCCB = myAnim8->myCCB;
+
+ if (myCCB && myCCB->source && !(myCCB->flags & (CCB_NO_DRAW | CCB_REDRAW))) {
+ currRect = myCCB->currLocation;
+
+ if (vmng_RectIntersectsRectList(drawRectList, currRect->x1, currRect->y1,
+ currRect->x2, currRect->y2)) {
+ vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1,
+ currRect->x2, currRect->y2);
+ myCCB->flags |= CCB_REDRAW;
+
+ if (greyMode || (myCCB->source->encoding & 0x80))
+ breakFlag = false;
+
+ if (!greyMode && (myCCB->source->encoding & 0x80)) {
+ restoreBgndX1 = imath_max(currRect->x1, 0);
+ restoreBgndY1 = imath_max(currRect->y1, 0);
+ restoreBgndX2 = imath_min(currRect->x2, background->w - 1);
+ restoreBgndY2 = imath_min(currRect->y2, background->h - 1);
+
+ gr_buffer_rect_copy(background, halScrnBuf, restoreBgndX1, restoreBgndY1,
+ restoreBgndX2 - restoreBgndX1 + 1, restoreBgndY2 - restoreBgndY1 + 1);
+ }
+ }
+ }
+
+ myAnim8 = myAnim8->infront;
+ }
+ } while (!breakFlag);
+
+ // Handle update background rect area
+ if (greyMode && background && background->data) {
myRect = drawRectList;
+
while (myRect) {
restoreBgndX1 = imath_max(myRect->x1, 0);
restoreBgndY1 = imath_max(myRect->y1, 0);
restoreBgndX2 = imath_min(myRect->x2, background->w - 1);
restoreBgndY2 = imath_min(myRect->y2, background->h - 1);
+
gr_buffer_rect_copy(background, halScrnBuf, restoreBgndX1, restoreBgndY1,
restoreBgndX2 - restoreBgndX1 + 1, restoreBgndY2 - restoreBgndY1 + 1);
+
myRect = myRect->next;
}
}
@@ -265,36 +361,17 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff
myAnim8 = _GWS(myCruncher)->backLayerAnim8;
while (myAnim8) {
myCCB = myAnim8->myCCB;
- currRect = myCCB->currLocation;
- if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW))) {
- if (myCCB->flags & CCB_REDRAW) {
- // Draw the sprite
- DrawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT, &noClipRect, currRect);
-
- // Add it's new location to the update list
- vmng_AddRectToRectList(&drawRectList, currRect->x1, currRect->y1, currRect->x2, currRect->y2);
- } else {
- // Loop through the update list, intersect each rect with the sprites
- // current location, and update redraw all overlapping areas
- myRect = drawRectList;
- while (myRect) {
- intersectRect.x1 = imath_max(myRect->x1, currRect->x1);
- intersectRect.y1 = imath_max(myRect->y1, currRect->y1);
- intersectRect.x2 = imath_min(myRect->x2, currRect->x2);
- intersectRect.y2 = imath_min(myRect->y2, currRect->y2);
-
- // Now see if there was an intersection
- if ((intersectRect.x1 <= intersectRect.x2) && (intersectRect.y1 <= intersectRect.y2)) {
- // Draw just the intersected region
- DrawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT, &intersectRect, &dummyRect);
- }
- // Next rect
- myRect = myRect->next;
+ if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW))) {
+ if ((myCCB->flags & CCB_REDRAW) && greyMode) {
+ if (!greyMode || !(myCCB->source->encoding & 0x80)) {
+ // Draw the sprite
+ drawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT);
}
}
+
+ myAnim8 = myAnim8->infront;
}
- myAnim8 = myAnim8->infront;
}
myRect = drawRectList;
Commit: 41e8a945fd1ea7008857f63e99df93ef49e01e9b
https://github.com/scummvm/scummvm/commit/41e8a945fd1ea7008857f63e99df93ef49e01e9b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix screenCodes type in CycleEngines/ws_DoDisplay
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_hal.h
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 60018ce271c..3783f4c6bd1 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -348,7 +348,7 @@ void Sections::pal_game_task() {
updateVideo = !_cameraShiftAmount && !_cameraShift_vert_Amount;
CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
- _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), updateVideo);
+ _G(screenCodeBuff)->get_buffer(), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), updateVideo);
_G(inverse_pal)->release();
_G(game_bgBuff)->release();
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 1ea5e5b94b1..263e47abac3 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -338,7 +338,7 @@ void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int de
player_set_commands_allowed(true);
CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
- _G(screenCodeBuff), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+ _G(screenCodeBuff)->get_buffer(), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
game_pause(true);
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index dcb37b729d6..109fbd0ef93 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -152,7 +152,7 @@ machine *kernel_timer_callback(int32 ticks, int16 trigger, MessageCB callMe) {
return (TriggerMachineByHash(1, nullptr, -1, -1, callMe, false, "timer callback"));
}
-static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *screenCodeBuff,
+static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, Buffer *screenCodeBuff,
uint8 *myPalette, uint8 *ICT) {
M4sprite *source;
@@ -187,7 +187,7 @@ static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *s
dr.y = myAnim8->myRegs[IDX_Y] >> 16;
dr.scaleX = myCCB->scaleX;
dr.scaleY = myCCB->scaleY;
- dr.depthCode = screenCodeBuff->get_pixmap(); // TODO: Confirm this
+ dr.depthCode = screenCodeBuff->data;
dr.Pal = myPalette;
dr.ICT = ICT;
dr.srcDepth = myCCB->layer >> 8;
@@ -213,7 +213,7 @@ static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, GrBuff *s
HUnLock(source->sourceHandle);
}
-void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
+void ws_DoDisplay(Buffer *background, int16 *depth_table, Buffer *screenCodeBuff,
uint8 *myPalette, uint8 *ICT, bool updateVideo) {
CCB *myCCB;
ScreenContext *myScreen;
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index a33fef636f8..4ecac4d8f8b 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -47,7 +47,7 @@ struct WSHal_Globals {
extern bool ws_InitHAL();
extern void ws_KillHAL();
-extern void ws_DoDisplay(Buffer *background, int16 *depth_table, GrBuff *screenCodeBuff,
+extern void ws_DoDisplay(Buffer *background, int16 *depth_table, Buffer *screenCodeBuff,
uint8 *myPalette, uint8 *ICT, bool updateVideo);
extern void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
extern void GetBezCoeffs(frac16 *ctrlPoints, frac16 *coeffs);
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 2dfbfb28fd1..42fd8e3bf8a 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -649,7 +649,8 @@ void AddPauseTime(int32 myTime) {
_GWS(pauseTime) += myTime;
}
-void CycleEngines(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT, bool updateVideo) {
+void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
+ uint8 *myPalette, uint8 *ICT, bool updateVideo) {
int32 clockTime;
dbg_DebugNextCycle();
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index b6841e1b3b6..f09985ebc52 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -177,7 +177,7 @@ extern void PauseEngines();
extern void UnpauseEngines();
extern void AddPauseTime(int32 myTime);
-void CycleEngines(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes,
+void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
uint8 *myPalette, uint8 *ICT, bool updateVideo);
void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
Commit: f704a7ff74bfd1175c446e6b747d72d9e8249a4c
https://github.com/scummvm/scummvm/commit/f704a7ff74bfd1175c446e6b747d72d9e8249a4c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Temporarily skip title music whilst sprite drawing is being added
Changed paths:
engines/m4/burger/rooms/section9/room951.cpp
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index a5d7a904d04..bc246bbc745 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -325,7 +325,11 @@ void Room951::preload() {
void Room951::init() {
_G(kernel).supress_fadeup = true;
pal_fade_set_start(_G(master_palette), 0);
+#if 0
pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_ORION_BURGER_POSTER);
+#else
+ pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_PLANET_X_HILLTOP_A);
+#endif
}
void Room951::daemon() {
Commit: d934ebe3219af16d0ed761810d158831f8a68c73
https://github.com/scummvm/scummvm/commit/d934ebe3219af16d0ed761810d158831f8a68c73
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: ws_DoDisplay loop fix
Changed paths:
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 109fbd0ef93..1a08a501fb2 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -363,15 +363,13 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, Buffer *screenCodeBuff
myCCB = myAnim8->myCCB;
if (myCCB && myCCB->source && (!(myCCB->flags & CCB_NO_DRAW))) {
- if ((myCCB->flags & CCB_REDRAW) && greyMode) {
- if (!greyMode || !(myCCB->source->encoding & 0x80)) {
- // Draw the sprite
- drawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT);
- }
+ if ((myCCB->flags & CCB_REDRAW) && (greyMode || !(myCCB->source->encoding & 0x80))) {
+ // Draw the sprite
+ drawSprite(myCCB, myAnim8, halScrnBuf, screenCodeBuff, myPalette, ICT);
}
-
- myAnim8 = myAnim8->infront;
}
+
+ myAnim8 = myAnim8->infront;
}
myRect = drawRectList;
Commit: a0a6f3a542eaf66e46dc311982ec5183d23a9808
https://github.com/scummvm/scummvm/commit/a0a6f3a542eaf66e46dc311982ec5183d23a9808
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes to RLE decoding
Changed paths:
engines/m4/graphics/gr_sprite.cpp
engines/m4/platform/draw.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 1716fb222bd..aec6e72caa0 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -117,7 +117,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// if it's RLE encoded, ensure the sprite will decode to match the expected size
if (source.encoding & RLE8) {
- if (RLE8Decode_Size(source.data, source.stride) != (size_t)(source.stride * source.h))
+ if (RLE8Decode_Size(source.data, source.stride) != (source.stride * source.h))
error_show(FL, 'RLE8', "RLE8 sprite suspected BAD!");
}
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index 5d1237023bf..10f85daa4ac 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -25,9 +25,6 @@
namespace M4 {
-#define EOL_CODE 3
-#define END_CODE 2
-
void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
byte val, count;
int line = 0, numY = 0;
@@ -45,18 +42,18 @@ void RLE8Decode(const uint8 *inBuff, uint8 *outBuff, uint32 pitch) {
} else {
count = *inBuff++;
- if (count > EOL_CODE) {
+ if (count >= 3) {
// Block of uncompressed pixels to copy
Common::copy(inBuff, inBuff + count, destP);
inBuff += count;
destP += count;
- } else if (count == EOL_CODE) {
+ } else if (!(count & 3)) {
// End of Line code
++line;
destP = outBuff + line * pitch;
- } else if (count == END_CODE) {
+ } else if (!(count & 2)) {
break;
} else {
@@ -76,11 +73,11 @@ uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData) {
// Simple RLE sequence, so skip over count and value
rleData += 2;
- } else if (rleData[1] < EOL_CODE) {
+ } else if (rleData[1] >= 3) {
+ rleData += 2 + rleData[2];
+ } else {
rleData += 2;
--linesToSkip;
- } else {
- rleData += 2 + rleData[2];
}
}
@@ -88,7 +85,7 @@ uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData) {
}
size_t RLE8Decode_Size(byte *src, int pitch) {
- size_t total = 0, numLines = 0, x, y;
+ size_t total = 0, line = 0, y;
byte count;
for (;;) {
@@ -100,23 +97,25 @@ size_t RLE8Decode_Size(byte *src, int pitch) {
} else {
count = *src++;
- // TODO: This seems inconsistent with RLE8Decode. Verify the totals are correct
- if (count >= EOL_CODE) {
+ if (count >= 3) {
+ // Block of uncompressed pixels to copy
+ total += count;
src += count;
- count += count;
} else if (!(count & 3)) {
- ++numLines;
- count = pitch * numLines;
+ // End of Line code
+ ++line;
+ total = line * pitch;
} else if (!(count & 2)) {
break;
} else {
- x = *src++;
- y = *src++;
- numLines += y;
- count += x + y * pitch;
+ // Move down by X, Y amount
+ total += *src++; // x amount
+ y = *src++; // y amount
+ line += y;
+ total += y * pitch;
}
}
}
Commit: b90f72633f4e3cce2827aaf1b0d448cf1d987bf0
https://github.com/scummvm/scummvm/commit/b90f72633f4e3cce2827aaf1b0d448cf1d987bf0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added RLE_Draw
Changed paths:
engines/m4/platform/draw.cpp
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index 10f85daa4ac..fdaa6a6c5e0 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -124,7 +124,52 @@ size_t RLE8Decode_Size(byte *src, int pitch) {
}
void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
- error("TODO: RLE");
+ const byte *srcP = src->data;
+ byte *destData = dest->data + y * dest->w + x;
+ byte *destP = destData;
+ int destWidth = dest->w;
+ byte count, val;
+ int line = 0;
+
+ assert(x >= 0 && y >= 0 && x < dest->w && y < dest->h);
+
+ for (;;) {
+ count = *srcP++;
+
+ if (count) {
+ // Basic run length
+ val = *srcP++;
+
+ // 0 pixels are transparent, and are skipped. Otherwise, draw pixels
+ if (val != 0)
+ Common::fill(destP, destP + count, val);
+ destP += count;
+
+ } else {
+ count = *srcP++;
+
+ if (count >= 3) {
+ // Block of uncompressed pixels to copy
+ for (; count > 0; --count, ++destP) {
+ val = *srcP++;
+ if (val != 0)
+ *destP = val;
+ }
+
+ } else if (!(count & 3)) {
+ // End of line code
+ ++line;
+ destP = destData + line * destWidth;
+
+ } else {
+ // Stop drawing image. Seems weird that it doesn't handle the X/Y offset
+ // form for count & 2, but the original explicitly doesn't implement it
+ break;
+ }
+ }
+ }
+
+ assert(destP <= (dest->data + dest->h * dest->stride));
}
void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y) {
Commit: 22bb199dcadebe979f9b18e45ae9daaf99be3a9f
https://github.com/scummvm/scummvm/commit/22bb199dcadebe979f9b18e45ae9daaf99be3a9f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix sprite positioning. First cutscene now rendering
Changed paths:
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 1a08a501fb2..874aaf482a9 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -171,6 +171,7 @@ static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, Buffer *s
source->data = (uint8 *)((byte *)*(source->sourceHandle) + source->sourceOffset);
}
+ assert(myCCB->currLocation);
Buffer Destination;
DrawRequest dr;
RendCell Frame;
@@ -183,8 +184,8 @@ static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, Buffer *s
dr.Src = &Destination;
dr.Dest = halScrnBuf;
- dr.x = myAnim8->myRegs[IDX_X] >> 16;
- dr.y = myAnim8->myRegs[IDX_Y] >> 16;
+ dr.x = myCCB->currLocation->x1;
+ dr.y = myCCB->currLocation->y1;
dr.scaleX = myCCB->scaleX;
dr.scaleY = myCCB->scaleY;
dr.depthCode = screenCodeBuff->data;
Commit: c47f9dc3b71a0dfbc847d78557bc1dc003109576
https://github.com/scummvm/scummvm/commit/c47f9dc3b71a0dfbc847d78557bc1dc003109576
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Minor cleanups and pointer casting
Changed paths:
engines/m4/graphics/gr_series.cpp
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 63bae8aee02..d83a74e6a25 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -93,7 +93,7 @@ bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger) {
_G(globals)[GLB_TEMP_2] = frameNum << 16;
_G(globals)[GLB_TEMP_3] = kernel_trigger_create(trigger);
- //send the message to the machine to accept the new callback frame num and trigger
+ // Send the message to the machine to accept the new callback frame num and trigger
SendWSMessage(0x10000, 0, m, 0, NULL, 1);
return true;
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 42fd8e3bf8a..5b98ced5caf 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -404,6 +404,7 @@ static bool op_STORE_VAL(machine *m, int32 *pcOffset) {
} else {
*_GWS(myArg1) = *_GWS(myArg2);
}
+
return true;
}
@@ -844,10 +845,11 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
dbg_SetCurrMachInstr(m, *pcOffset);
// Find the current PC and process it to get the current instruction
- machInstr = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->machInstrOffset);
- myPC = (uint32 *)((uint32)(machInstr)+*pcOffset);
+ machInstr = (uint32 *)((intptr_t)(*(m->machHandle)) + m->machInstrOffset);
+ myPC = (uint32 *)((intptr_t)(machInstr) + *pcOffset);
oldPC = myPC;
_GWS(pcOffsetOld) = *pcOffset;
+
if ((myInstruction = ws_PreProcessPcode(&myPC, myAnim8)) < 0) {
ws_Error(m, ERR_MACH, 0x0266, nullptr);
}
@@ -859,11 +861,10 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
condOpTable[myInstruction - 64](m, pcOffset);
} else if (myInstruction > 0) {
keepProcessing = immOpTable[myInstruction](m, pcOffset);
- if (!keepProcessing) {
+ if (!keepProcessing) {
// Does the machine still exist
if (m->machID == machID) {
-
CancelAllEngineReqs(m);
if (m->curState == -1) {
ShutdownMachine(m);
@@ -873,6 +874,7 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
}
}
}
+
return myInstruction;
}
@@ -1041,13 +1043,15 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32
case PERSISTENT_MSG:
myMsg = recvM->myPersistentMsgs;
break;
+
+ default:
+ break;
}
// Search through the message list
while (myMsg && (!found)) {
// Check if we've found the msg we're looking for
if ((myMsg->msgHash == msgHash) && ((uint32)myMsg->msgValue == msgValue)) {
-
// Set found bool
found = true;
@@ -1085,6 +1089,9 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32
myMsg->nextMsg = recvM->usedPersistentMsgs;
recvM->usedPersistentMsgs = myMsg;
break;
+
+ default:
+ break;
}
// Set up so the recv machine can reply to this message
@@ -1106,11 +1113,10 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32
// This proc is what allows a machine to send a message to another machine(s)
void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
- uint32 machHash, machine *sendM, int32 msgCount) {
-
+ uint32 machHash, machine *sendM, int32 msgCount) {
bool found, more_to_send;
machine *currMachine;
- int32 myCount; // ,i;
+ int32 myCount;
bool sendToAll;
globalMsgReq *myGlobalMsgs, *tempGlobalMsg;
@@ -1157,14 +1163,13 @@ void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
// Check to see if we are already in the middle of processing global messages
if (_GWS(myGlobalMessages)) {
-
// Find the end of the global list
myGlobalMsgs = _GWS(myGlobalMessages);
while (myGlobalMsgs->next) {
myGlobalMsgs = myGlobalMsgs->next;
}
- //myGlobalMsgs is the last element, now tempGlobalMsg is.
+ // myGlobalMsgs is the last element, now tempGlobalMsg is.
myGlobalMsgs->next = tempGlobalMsg;
// Since we are already processing a global message, this one is now queued, and we return
@@ -1211,6 +1216,7 @@ void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
}
}
}
+
currMachine = _GWS(nextXM);
}
@@ -1218,7 +1224,7 @@ void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
// Discard a global message and queue up the next one:
tempGlobalMsg = _GWS(myGlobalMessages);
_GWS(myGlobalMessages) = _GWS(myGlobalMessages)->next;
- mem_free((void *)tempGlobalMsg);
+ mem_free(tempGlobalMsg);
}
}
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index f09985ebc52..45bbbb33145 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -146,7 +146,7 @@ struct machine {
};
struct globalMsgReq {
- struct globalMsgReq *next = nullptr;
+ globalMsgReq *next = nullptr;
ulong msgHash = 0;
frac16 msgValue = 0;
ulong machHash = 0;
Commit: bab244b449011aa0ac83ffdb7a9ce4dc5d035b5e
https://github.com/scummvm/scummvm/commit/bab244b449011aa0ac83ffdb7a9ce4dc5d035b5e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix shutdown crash
Changed paths:
engines/m4/core/errors.cpp
engines/m4/mem/mem.cpp
diff --git a/engines/m4/core/errors.cpp b/engines/m4/core/errors.cpp
index 5eaca4fedf5..22e3bd36af3 100644
--- a/engines/m4/core/errors.cpp
+++ b/engines/m4/core/errors.cpp
@@ -30,6 +30,8 @@ inline static bool quadchar_equals_string(uint32 code, const Common::String &str
}
void error_show(const char *filename, uint32 line, quadchar errorcode, const char *fmt, ...) {
+ assert(fmt);
+
va_list va;
va_start(va, fmt);
Common::String msg = Common::String::vformat(fmt, va);
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index e8c0d3feb26..9901a6f43c5 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -86,7 +86,7 @@ void mem_free_to_stash(void *mem, int32 memType) {
int32 index = ((long)mem - (long)_G(memBlock)[memType]) / (_G(sizeMem)[memType] + 1);
if (index < 0 || index > _G(requests)[memType])
- error_show(FL, 'MSGF', nullptr);
+ error_show(FL, 'MSGF');
b_ptr += index * (_G(sizeMem)[memType] + 1);
*b_ptr = 0;
Commit: d2003296a500f17cc6975496d928ce9c53a1fd7b
https://github.com/scummvm/scummvm/commit/d2003296a500f17cc6975496d928ce9c53a1fd7b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Updates for cutscene sound code to be called
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/graphics/gr_series.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 3d4806d16ac..036e2ef9e91 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -57,7 +57,20 @@ void BurgerEngine::syncFlags(Common::Serializer &s) {
}
void BurgerEngine::global_daemon() {
- error("TODO: global_daemon_code");
+ switch (_G(kernel).trigger) {
+ case gSERIES_STREAM_BREAK:
+ handle_series_stream_break();
+ break;
+
+ case gRELEASE_TRIGGER_DIGI_CHECK:
+ release_trigger_digi_check();
+ break;
+
+ // TODO: Other cases
+
+ default:
+ break;
+ }
}
} // namespace Burger
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index d83a74e6a25..99513d69f02 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -31,7 +31,7 @@ namespace M4 {
#define CHECK_SERIES if (!_G(globals)) error_show(FL, 'SERI');
static void series_trigger_dispatch_callback(frac16 myMessage, machine * /*sender*/) {
- kernel_trigger_dispatch(myMessage);
+ kernel_trigger_dispatchx(myMessage);
}
int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal) {
Commit: 521df4594c2ba55f691fbb80b9121b7715d28161
https://github.com/scummvm/scummvm/commit/521df4594c2ba55f691fbb80b9121b7715d28161
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement changes for kernel_timing_trigger
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_trigger.h
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 8b7e757e605..27d5ef98dab 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -129,29 +129,26 @@ bool kernel_trigger_dispatchx(int32 trigger_num) {
return result;
}
-void kernel_timing_trigger(int32 ticks, int16 trigger, char * /*name*/) {
- if (ticks < 0)
- error_show(FL, 'TICK');
-
- int32 done_time = ticks + timer_read_60();
- _GT(time_q)[_GT(time_q_end)] = done_time;
- _GT(time_trigger_q)[_GT(time_q_end)] = kernel_trigger_create(trigger);
- ++_GT(time_q_end);
- if (_GT(time_q_end) == MAX_TIMERS)
- error_show(FL, 'QOVF');
+static void timer_callback(frac16 myMessage, struct machine *sender) {
+ kernel_trigger_dispatchx(myMessage);
+}
+
+void kernel_timing_trigger(int32 ticks, int16 trigger, const char *name) {
+ if (ticks <= 0) {
+ // Trigger immediately
+ kernel_trigger_dispatchx(kernel_trigger_create(trigger));
+ return;
+ }
- // bubble the new entry up in the q to its proper place
+ _G(globals)[GLB_TEMP_1] = ticks << 16;
+ _G(globals)[GLB_TEMP_2] = kernel_trigger_create(trigger);
- for (int32 iter = _GT(time_q_end) - 1; iter > 0; iter--) {
- if (_GT(time_q)[iter] < _GT(time_q)[iter - 1]) {
- int32 temp = _GT(time_q)[iter];
- _GT(time_q)[iter] = _GT(time_q)[iter - 1];
- _GT(time_q)[iter - 1] = temp;
+ if (name) {
+ Common::String machName = Common::String::format("timer - %s", name);
+ TriggerMachineByHash(2, nullptr, -1, -1, timer_callback, false, machName.c_str());
- temp = _GT(time_trigger_q)[iter];
- _GT(time_trigger_q)[iter] = _GT(time_trigger_q)[iter - 1];
- _GT(time_trigger_q)[iter - 1] = temp;
- }
+ } else {
+ TriggerMachineByHash(2, nullptr, -1, -1, timer_callback, false, "timer trigger");
}
}
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index e9c74aa8c60..3f358e46623 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -68,7 +68,7 @@ extern bool kernel_trigger_dispatchx(int32 trigger_num);
extern bool kernel_trigger_dispatch_now(int32 trigger_num);
-extern void kernel_timing_trigger(int32 ticks, int16 trigger, char *name = NULL);
+extern void kernel_timing_trigger(int32 ticks, int16 trigger, const char *name = nullptr);
extern void cisco_dispatch_triggers();
extern void cisco_clear_triggers();
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index fde0c77e2f6..dec663fc6fc 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -104,6 +104,14 @@ void M4Engine::m4_inflight() {
}
}
+bool M4Engine::canLoadGameStateCurrently(Common::U32String *msg) {
+ return g_vars && g_vars->getInterface() && g_vars->getInterface()->_visible;
+}
+
+bool M4Engine::canSaveGameStateCurrently(Common::U32String *msg) {
+ return g_vars && g_vars->getInterface() && g_vars->getInterface()->_visible;
+}
+
Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(game).syncGame(s);
_G(player).syncGame(s);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 6774d9b2e55..1be6aabf21d 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -94,12 +94,8 @@ public:
(f == kSupportsReturnToLauncher);
};
- bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
- return true;
- }
- bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
- return true;
- }
+ bool canLoadGameStateCurrently(Common::U32String * msg = nullptr) override;
+ bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
/**
* Uses a serializer to allow implementing savegame
Commit: d32e6b19de5d769e0401657bae156d7f0a613d0d
https://github.com/scummvm/scummvm/commit/d32e6b19de5d769e0401657bae156d7f0a613d0d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix for timer callback dispatch
Changed paths:
engines/m4/burger/core/release_trigger.cpp
diff --git a/engines/m4/burger/core/release_trigger.cpp b/engines/m4/burger/core/release_trigger.cpp
index f73db47e07c..d9361b3c64a 100644
--- a/engines/m4/burger/core/release_trigger.cpp
+++ b/engines/m4/burger/core/release_trigger.cpp
@@ -56,7 +56,7 @@ void release_trigger_digi_check() {
// Compare this with the match values
if (digi_state == _GT(match_value)) {
- kernel_trigger_dispatch(_GT(released_digi_trigger));
+ kernel_trigger_dispatchx(_GT(released_digi_trigger));
} else {
kernel_timing_trigger(TENTH_SECOND, gRELEASE_TRIGGER_DIGI_CHECK);
}
Commit: cce9e26643058fe5b57847223ce929ea74274a29
https://github.com/scummvm/scummvm/commit/cce9e26643058fe5b57847223ce929ea74274a29
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Use intptr instead of intptr_t, like most our engines do
If it turns out to be necessary to use intptr_t after all, we're going
to have to include the appropriate header for it. Currently we don't.
Changed paths:
engines/m4/graphics/gr_series.cpp
engines/m4/m4_types.h
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 99513d69f02..a2db81983d6 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -71,7 +71,7 @@ machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int
_G(globals)[GLB_TEMP_1] = frameRate << 16;
// Store the SysFile pointer
- _G(globals)[GLB_TEMP_4] = (intptr_t)sysFile;
+ _G(globals)[GLB_TEMP_4] = (intptr)sysFile;
// Set the callback trigger
_G(globals)[GLB_TEMP_5] = kernel_trigger_create(trigger);
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 59812ac696f..ed522f8852a 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -40,10 +40,10 @@ typedef void *Ptr;
typedef void *Handle;
/**
- * This needs to be intptr_t in ScummVM because series_stream in gr_series.cpp stores
+ * This needs to be intptr in ScummVM because series_stream in gr_series.cpp stores
* a pointer as a global. On some systems size(ptr) > sizeof(int)
*/
-typedef intptr_t frac16;
+typedef intptr frac16;
typedef uint32 ulong;
typedef uint32 quadchar;
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 5b98ced5caf..cc16ce9d275 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -845,8 +845,8 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
dbg_SetCurrMachInstr(m, *pcOffset);
// Find the current PC and process it to get the current instruction
- machInstr = (uint32 *)((intptr_t)(*(m->machHandle)) + m->machInstrOffset);
- myPC = (uint32 *)((intptr_t)(machInstr) + *pcOffset);
+ machInstr = (uint32 *)((intptr)(*(m->machHandle)) + m->machInstrOffset);
+ myPC = (uint32 *)((intptr)(machInstr) + *pcOffset);
oldPC = myPC;
_GWS(pcOffsetOld) = *pcOffset;
Commit: ddbe4a5fda34c57d6d34bcf57cbe710d9bc9c201
https://github.com/scummvm/scummvm/commit/ddbe4a5fda34c57d6d34bcf57cbe710d9bc9c201
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Silence format string warnings
Changed paths:
engines/m4/adv_r/adv_control.cpp
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 04feee17cc8..fe9bdd0bf32 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -185,7 +185,7 @@ void update_mouse_pos_dialog() {
char tempStr1[MAX_STRING_LEN], tempStr2[MAX_STRING_LEN];
- Common::sprintf_s(tempStr1, "%ld From: %ld", _G(game).room_id, _G(game).previous_room);
+ Common::sprintf_s(tempStr1, "%d From: %d", _G(game).room_id, _G(game).previous_room);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 1);
int32 xxx = _G(MouseState).CursorColumn;
@@ -195,32 +195,32 @@ void update_mouse_pos_dialog() {
int32 palColor = get_screen_color(xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1);
if (this_is_a_walkcode(xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1)) {
- Common::sprintf_s(tempStr1, "WC %ld, %ld PAL: %ld", xxx, yyy, palColor);
- Common::sprintf_s(tempStr2, "WC %ld, %ld D: %ld", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
+ Common::sprintf_s(tempStr1, "WC %d, %d PAL: %d", xxx, yyy, palColor);
+ Common::sprintf_s(tempStr2, "WC %d, %d D: %d", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
} else {
- Common::sprintf_s(tempStr1, " %ld, %ld PAL: %d", xxx, yyy, palColor);
- Common::sprintf_s(tempStr2, " %ld, %ld D: %ld", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
+ Common::sprintf_s(tempStr1, " %d, %d PAL: %d", xxx, yyy, palColor);
+ Common::sprintf_s(tempStr2, " %d, %d D: %d", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
}
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 2);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 3);
if (this_is_a_walkcode(_G(player_info).x, _G(player_info).y)) {
- Common::sprintf_s(tempStr1, "WC %ld, %ld", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
- Common::sprintf_s(tempStr2, "WC %ld, %ld", _G(player_info).x, _G(player_info).y);
+ Common::sprintf_s(tempStr1, "WC %d, %d", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
+ Common::sprintf_s(tempStr2, "WC %d, %d", _G(player_info).x, _G(player_info).y);
} else {
- Common::sprintf_s(tempStr1, " %ld, %ld", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
- Common::sprintf_s(tempStr2, " %ld, %ld", _G(player_info).x, _G(player_info).y);
+ Common::sprintf_s(tempStr1, " %d, %d", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
+ Common::sprintf_s(tempStr2, " %d, %d", _G(player_info).x, _G(player_info).y);
}
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 4);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 5);
- Common::sprintf_s(tempStr1, "%ld", _G(player_info).scale);
+ Common::sprintf_s(tempStr1, "%d", _G(player_info).scale);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 6);
Common::sprintf_s(tempStr1, "%x", _G(player_info).depth);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 7);
- Common::sprintf_s(tempStr1, "%ld, %ld", game_buff_ptr->x1, game_buff_ptr->y1);
+ Common::sprintf_s(tempStr1, "%d, %d", game_buff_ptr->x1, game_buff_ptr->y1);
Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 8);
Common::sprintf_s(tempStr1, "%d", _G(player_info).facing);
Commit: 5da5efe95ff8bf1eef8bc59ac8f9cb5a20171475
https://github.com/scummvm/scummvm/commit/5da5efe95ff8bf1eef8bc59ac8f9cb5a20171475
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix GCC invalid preprocessor token error
Changed paths:
engines/m4/adv_r/conv.h
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index 3e6988ca5b5..4f25b157abc 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -27,7 +27,7 @@
namespace M4 {
-#define _GC(X) _G(conversations).##X
+#define _GC(X) _G(conversations).X
#define CONV_WAIT_FOR_INPUT 1
#define CONV_HALT_FOREVER 2
Commit: e5209489bbd2d4bf015325282c4e4bcba3227194
https://github.com/scummvm/scummvm/commit/e5209489bbd2d4bf015325282c4e4bcba3227194
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove "constexpr" for now to placate GCC
Changed paths:
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 8cd6eaf2984..d1b51bcda58 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -27,9 +27,9 @@
namespace M4 {
-static constexpr uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+static const uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-constexpr uint8 gr_pal_get_ega_color(uint8 myColor) {
+uint8 gr_pal_get_ega_color(uint8 myColor) {
return EGAcolors[myColor];
}
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 8b2df5cd9be..eeafca504bf 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -46,7 +46,7 @@ constexpr int MAX_PAL_ENTRY = 255;
#define __YELLOW (gr_pal_get_ega_color(14))
#define __WHITE (gr_pal_get_ega_color(15))
-extern constexpr uint8 gr_pal_get_ega_color(uint8 myColor);
+extern uint8 gr_pal_get_ega_color(uint8 myColor);
extern void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num);
extern uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors);
Commit: 6f29c6da68891a2cd2398186550cbaaf8e3e1ec1
https://github.com/scummvm/scummvm/commit/6f29c6da68891a2cd2398186550cbaaf8e3e1ec1
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix GCC compile errors
Changed paths:
engines/m4/graphics/rend.cpp
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
index 814ba638390..67285cf540b 100644
--- a/engines/m4/graphics/rend.cpp
+++ b/engines/m4/graphics/rend.cpp
@@ -85,7 +85,7 @@ static RenderResult r_0() {
to += runLength;
else {
if (runLength > EMPIRICALLY_FOUND) {
- while ((uint32)to & 3) {
+ while ((uintptr)to & 3) {
*to++ = data;
--runLength;
}
@@ -140,7 +140,7 @@ static RenderResult r_0_5() {
to -= runLength;
else {
if (runLength > EMPIRICALLY_FOUND) {
- while (((uint32)to & 3) != 3) {
+ while (((uintptr)to & 3) != 3) {
*to-- = data;
--runLength;
}
Commit: 994cd1b2a280d3e401c8b7d2037eb752e3cca800
https://github.com/scummvm/scummvm/commit/994cd1b2a280d3e401c8b7d2037eb752e3cca800
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Digi improvements to properly unload sounds
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 4d1dbf0ec65..e8d7b2a22d0 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -78,6 +78,12 @@ bool Digi::preload(const Common::String &name, int roomNum) {
void Digi::unload(const Common::String &name) {
if (_sounds.contains(name)) {
+ // Stop it if it's playing
+ for (int channel = 0; channel < MAX_CHANNELS; ++channel) {
+ if (_channels[channel]._name == name)
+ stop(channel);
+ }
+
delete _sounds[name]._data;
_sounds.erase(name);
}
@@ -97,22 +103,27 @@ int32 Digi::play_loop(const Common::String &name, uint channel, int32 vol, int32
int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num, bool loop) {
assert(channel < 4);
- Common::String fileName = expand_name_2_RAW(name, room_num);
- digi_preload(fileName, room_num);
- DigiEntry &entry = _sounds[fileName];
+ // Assure no prior sound for the channel is playing
+ stop(channel);
+
+ // Load in the new sound
+ preload(name, room_num);
+ DigiEntry &entry = _sounds[name];
+ Channel &c = _channels[channel];
// Create new audio stream
Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
- Audio::makeRawStream(entry._data, entry._size, 11025, Audio::FLAG_UNSIGNED),
+ Audio::makeRawStream(entry._data, entry._size, 11025, Audio::FLAG_UNSIGNED,
+ DisposeAfterUse::NO),
loop ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_channels[channel]._soundHandle, stream, -1, vol);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &c._soundHandle, stream, -1, vol);
if (trigger < 0 || trigger > 32767)
trigger = -1;
- _channels[channel]._trigger = kernel_trigger_create(trigger);
+ c._trigger = kernel_trigger_create(trigger);
+ c._name = name;
- _sounds.erase(fileName);
return 0;
}
@@ -130,11 +141,19 @@ Common::String Digi::expand_name_2_RAW(const Common::String &name, int32 room_nu
}
}
-
void Digi::stop(uint channel) {
assert(channel < 4);
- _mixer->stopHandle(_channels[channel]._soundHandle);
- _channels[channel]._trigger = -1;
+
+ Channel &c = _channels[channel];
+ if (!c._name.empty()) {
+ Common::String name = c._name;
+
+ _mixer->stopHandle(c._soundHandle);
+ c._trigger = -1;
+ c._name.clear();
+
+ digi_unload(name);
+ }
}
void Digi::flush_mem() {
@@ -154,6 +173,8 @@ void Digi::read_another_chunk() {
// Dispatch the trigger
kernel_trigger_dispatchx(trigger);
+
+ stop(channel);
}
}
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 70599dff4b2..031cda3048c 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -52,6 +52,7 @@ class Digi {
struct Channel {
Audio::SoundHandle _soundHandle;
int _trigger = -1;
+ Common::String _name;
};
private:
Audio::Mixer *_mixer;
Commit: 86a0681078a8c43f68780fd3fe6cc9c37a54c4da
https://github.com/scummvm/scummvm/commit/86a0681078a8c43f68780fd3fe6cc9c37a54c4da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Revert startup of startup room to show title screen
Changed paths:
engines/m4/burger/rooms/section9/room951.cpp
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index bc246bbc745..a5d7a904d04 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -325,11 +325,7 @@ void Room951::preload() {
void Room951::init() {
_G(kernel).supress_fadeup = true;
pal_fade_set_start(_G(master_palette), 0);
-#if 0
pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_ORION_BURGER_POSTER);
-#else
- pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_PLANET_X_HILLTOP_A);
-#endif
}
void Room951::daemon() {
Commit: 9b26c90b9018fcca9ead15a8acf8b33c23e41dde
https://github.com/scummvm/scummvm/commit/9b26c90b9018fcca9ead15a8acf8b33c23e41dde
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of main menu room 903
Changed paths:
A engines/m4/burger/rooms/section9/room903.cpp
A engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/gui/game_menu.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/vars.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 0d769fdb645..0fff233b4a1 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -24,11 +24,493 @@
#define M4_BURGER_GUI_GAME_MENU_H
#include "m4/m4_types.h"
+#include "m4/graphics/gr_buff.h"
+#include "m4/gui/gui_univ.h"
namespace M4 {
namespace Burger {
namespace GUI {
+typedef bool (*ItemHandlerFunction)(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem);
+typedef void (*DrawFunction)(void *source, void *dest, int32 x1, int32 y1, int32 x2, int32 y2);
+typedef void (*DestroyFunction)(void *theItem);
+typedef void (*CALLBACK)();
+
+struct Sprite {
+};
+
+struct menuItem {
+ menuItem *next;
+ menuItem *prev;
+
+ void *myMenu;
+ int32 tag;
+
+ int32 x1, y1, x2, y2;
+
+ bool transparent;
+ GrBuff *background;
+
+ void *itemInfo;
+
+ CALLBACK callback;
+ DrawFunction redraw;
+ DestroyFunction destroy;
+ ItemHandlerFunction itemEventHandler;
+};
+
+struct menuItemMsg {
+ int32 itemFlags;
+};
+
+struct menuItemButton {
+ int32 itemFlags;
+ int32 buttonType;
+ char *prompt;
+ menuItem *assocItem;
+ int32 specialTag;
+};
+
+struct menuItemHSlider {
+ int32 itemFlags;
+
+ int32 thumbW, thumbH;
+ int32 thumbX, maxThumbX;
+
+ int32 percent;
+};
+
+struct menuItemVSlider {
+ int32 itemFlags;
+
+ int32 thumbW, thumbH;
+ int32 thumbY, minThumbY, maxThumbY;
+
+ int32 percent;
+};
+
+struct menuItemTextField {
+ int32 itemFlags;
+
+ int32 specialTag;
+ int32 pixWidth;
+
+ char prompt[80];
+ char *promptEnd;
+
+ char *cursor;
+};
+
+struct guiMenu {
+ GrBuff *menuBuffer;
+ menuItem *itemList;
+ CALLBACK cb_return;
+ CALLBACK cb_esc;
+ EventHandler menuEventHandler;
+};
+
+// The following var is true if'f one of the menus is active
+extern bool menuSystemInitialized;
+
+// GENERAL MENU FUNCTIONS
+extern bool menu_Initialize(RGB8 *myPalette);
+extern guiMenu *menu_Create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFlags);
+extern void menu_Destroy(guiMenu *myMenu);
+extern void menu_Configure(guiMenu *myMenu, CALLBACK cb_return, CALLBACK cb_esc);
+extern GrBuff *menu_CopyBackground(guiMenu *myMenu, int32 x, int32 y, int32 w, int32 h);
+extern menuItem *menu_GetItem(int32 tag, guiMenu *myMenu);
+extern void menu_ItemDelete(menuItem *myItem, int32 tag, guiMenu *myMenu);
+extern void menu_ItemRefresh(menuItem *myItem, int32 tag, guiMenu *myMenu);
+
+// SPECIFIC ITEM FUNCTIONS
+
+// Messages
+extern menuItem *menu_MsgAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
+ bool transparent = false);
+extern void menu_DisableMsg(menuItem *myItem, int32 tag, guiMenu *myMenu);
+extern void menu_EnableMsg(menuItem *myItem, int32 tag, guiMenu *myMenu);
+
+// Buttons
+extern bool button_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem);
+extern menuItem *menu_ButtonAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, CALLBACK callback = nullptr,
+ int32 buttonType = 0, bool ghosted = false, bool transparent = false,
+ char *prompt = nullptr, ItemHandlerFunction i_handler = button_Handler);
+extern void menu_DisableButton(menuItem *myItem, int32 tag, guiMenu *myMenu);
+extern void menu_EnableButton(menuItem *myItem, int32 tag, guiMenu *myMenu);
+
+// Horizontal sliders
+extern menuItem *menu_HSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
+ int32 initPercent = 0, CALLBACK callback = nullptr, bool transparent = false);
+
+// Vertical sliders
+extern menuItem *menu_VSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
+ int32 initPercent = 0, CALLBACK callback = nullptr, bool transparent = false);
+extern void menu_DisableVSlider(menuItem *myItem, int32 tag, guiMenu *myMenu);
+extern void menu_EnableVSlider(menuItem *myItem, int32 tag, guiMenu *myMenu);
+
+// Textfields
+extern menuItem *menu_TextFieldAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, int32 initFlags,
+ char *prompt = nullptr, int32 specialtag = 0, CALLBACK callback = nullptr, bool transparent = false);
+
+//GAME MENU FUNCTIONS
+extern void CreateGameMenu(RGB8 *myPalette);
+extern void CreateOptionsMenu(RGB8 *myPalette);
+extern void CreateF2SaveMenu(RGB8 *myPalette);
+extern void CreateF3LoadMenu(RGB8 *myPalette);
+
+//routines used by the main menu
+extern void CreateLoadMenuFromMain(RGB8 *myPalette);
+extern void CreateGameMenuFromMain(RGB8 *myPalette);
+
+
+//======================================
+//
+// gamemenu module defines
+//
+#define MEMORY_NEEDED 478000 // bytes needed for menus to work
+#define MENU_DEPTH 9 // video depth for menu popup boxes
+#define MAX_SLOTS 99 // number of save games you can have
+#define MAX_SLOTS_SHOWN 8 // number of slots in the scrolling field
+
+// 128 very light green
+// 129 light green
+// 130 medium green
+// 131 dark green
+// 133 light red
+// 136 red
+// 142 dark red
+// 186 purple
+// 206 dark grey
+// 236 very dark purple
+
+#define TEXT_COLOR_GREY_HILITE 236
+#define TEXT_COLOR_GREY_FOREGROUND 131
+#define TEXT_COLOR_GREY_SHADOW 186
+
+#define TEXT_COLOR_NORM_HILITE 129
+#define TEXT_COLOR_NORM_FOREGROUND 130
+#define TEXT_COLOR_NORM_SHADOW 236
+
+#define TEXT_COLOR_OVER_HILITE 129
+#define TEXT_COLOR_OVER_FOREGROUND 130
+#define TEXT_COLOR_OVER_SHADOW 236
+
+#define TEXT_COLOR_PRESS_HILITE 236
+#define TEXT_COLOR_PRESS_FOREGROUND 130
+#define TEXT_COLOR_PRESS_SHADOW 129
+
+#define SLIDER_BAR_COLOR 129
+
+
+
+//======================================
+//
+// Game menu enums and defines
+//
+#define GAME_MENU_X 190
+#define GAME_MENU_Y 100
+#define GAME_MENU_W 260
+#define GAME_MENU_H 198
+
+enum game_menu_sprites {
+ GM_DIALOG_BOX,
+
+ GM_BUTTON_GREY,
+ GM_BUTTON_NORM,
+ GM_BUTTON_OVER,
+ GM_BUTTON_PRESS,
+
+ GM_TOTAL_SPRITES
+};
+
+enum game_menu_button_tags {
+ GM_TAG_QUIT = 1,
+ GM_TAG_OPTIONS = 2,
+ GM_TAG_RESUME = 3,
+ GM_TAG_SAVE = 4,
+ GM_TAG_LOAD = 5,
+ GM_TAG_MAIN = 6
+};
+
+#define GM_MAIN_X 45
+#define GM_MAIN_Y 53
+#define GM_MAIN_W 24
+#define GM_MAIN_H 24
+
+#define GM_OPTIONS_X 45
+#define GM_OPTIONS_Y 94
+#define GM_OPTIONS_W 24
+#define GM_OPTIONS_H 24
+
+#define GM_RESUME_X 45
+#define GM_RESUME_Y 135
+#define GM_RESUME_W 24
+#define GM_RESUME_H 24
+
+#define GM_QUIT_X 141
+#define GM_QUIT_Y 135
+#define GM_QUIT_W 24
+#define GM_QUIT_H 24
+
+#define GM_SAVE_X 141
+#define GM_SAVE_Y 53
+#define GM_SAVE_W 24
+#define GM_SAVE_H 24
+
+#define GM_LOAD_X 141
+#define GM_LOAD_Y 94
+#define GM_LOAD_W 24
+#define GM_LOAD_H 24
+
+//======================================
+//
+// Save/Load menu enums and defines
+//
+#define SAVE_LOAD_MENU_X 145
+#define SAVE_LOAD_MENU_Y 10
+#define SAVE_LOAD_MENU_W 344
+#define SAVE_LOAD_MENU_H 460
+
+enum save_load_menu_sprites {
+
+ SL_DIALOG_BOX,
+ SL_EMPTY_THUMB,
+
+ SL_SAVE_BTN_GREY,
+ SL_SAVE_BTN_NORM,
+ SL_SAVE_BTN_OVER,
+ SL_SAVE_BTN_PRESS,
+
+ SL_LOAD_BTN_GREY,
+ SL_LOAD_BTN_NORM,
+ SL_LOAD_BTN_OVER,
+ SL_LOAD_BTN_PRESS,
+
+ SL_CANCEL_BTN_NORM,
+ SL_CANCEL_BTN_OVER,
+ SL_CANCEL_BTN_PRESS,
+
+ SL_UP_BTN_GREY,
+ SL_UP_BTN_NORM,
+ SL_UP_BTN_OVER,
+ SL_UP_BTN_PRESS,
+
+ SL_DOWN_BTN_GREY,
+ SL_DOWN_BTN_NORM,
+ SL_DOWN_BTN_OVER,
+ SL_DOWN_BTN_PRESS,
+
+ SL_SAVE_LABEL,
+ SL_LOAD_LABEL,
+
+ SL_SLIDER_BTN_NORM,
+ SL_SLIDER_BTN_OVER,
+ SL_SLIDER_BTN_PRESS,
+
+ SL_LINE_NORM,
+ SL_LINE_OVER,
+ SL_LINE_PRESS,
+
+ SL_SCROLL_BAR,
+
+ SL_TOTAL_SPRITES
+};
+
+enum save_load_menu_item_tags {
+ SL_TAG_SAVE = 100,
+ SL_TAG_SAVE_LABEL,
+ SL_TAG_LOAD,
+ SL_TAG_LOAD_LABEL,
+ SL_TAG_CANCEL,
+ SL_TAG_VSLIDER,
+ SL_TAG_THUMBNAIL
+};
+
+#define SL_SAVE_X 214
+#define SL_SAVE_Y 384
+#define SL_SAVE_W 74
+#define SL_SAVE_H 43
+
+#define SL_LOAD_X 214
+#define SL_LOAD_Y 384
+#define SL_LOAD_W 74
+#define SL_LOAD_H 43
+
+#define SL_UP_X 292
+#define SL_UP_Y 255
+#define SL_UP_W 20
+#define SL_UP_H 17
+
+#define SL_DOWN_X 293
+#define SL_DOWN_Y 363
+#define SL_DOWN_W 20
+#define SL_DOWN_H 17
+
+#define SL_SLIDER_X 291
+#define SL_SLIDER_Y 255
+#define SL_SLIDER_W 23
+#define SL_SLIDER_H 127
+
+#define SL_CANCEL_X 139
+#define SL_CANCEL_Y 384
+#define SL_CANCEL_W 74
+#define SL_CANCEL_H 43
+
+#define SL_SAVE_LABEL_X 50
+#define SL_SAVE_LABEL_Y 241
+#define SL_SAVE_LABEL_W 70
+#define SL_SAVE_LABEL_H 16
+
+#define SL_LOAD_LABEL_X 50
+#define SL_LOAD_LABEL_Y 241
+#define SL_LOAD_LABEL_W 70
+#define SL_LOAD_LABEL_H 16
+
+#define SL_SCROLL_FIELD_X 50
+#define SL_SCROLL_FIELD_Y 256
+#define SL_SCROLL_FIELD_W 238
+#define SL_SCROLL_FIELD_H 121
+
+#define SL_SCROLL_LINE_W 238
+#define SL_SCROLL_LINE_H 15 //was 16
+
+#define SL_THUMBNAIL_X 66
+#define SL_THUMBNAIL_Y 28
+#define SL_THUMBNAIL_W 215
+#define SL_THUMBNAIL_H 162
+
+/**
+ * Options menu enums and defines
+ */
+enum options_menu_sprites {
+
+ OM_DIALOG_BOX,
+
+ OM_SLIDER_BTN_NORM,
+ OM_SLIDER_BTN_OVER,
+ OM_SLIDER_BTN_PRESS,
+
+ OM_SLIDER_BAR,
+
+ OM_DONE_BTN_GREY,
+ OM_DONE_BTN_NORM,
+ OM_DONE_BTN_OVER,
+ OM_DONE_BTN_PRESS,
+
+ OM_CANCEL_BTN_NORM,
+ OM_CANCEL_BTN_OVER,
+ OM_CANCEL_BTN_PRESS,
+
+ OM_TOTAL_SPRITES
+};
+
+#define OPTIONS_MENU_X 175
+#define OPTIONS_MENU_Y 100
+#define OPTIONS_MENU_W 298
+#define OPTIONS_MENU_H 218
+
+enum option_menu_item_tags {
+ OM_TAG_DONE = 1,
+ OM_TAG_CANCEL,
+ OM_TAG_DIGI,
+ OM_TAG_DIGESTABILITY,
+};
+
+#define OM_DONE_X 168
+#define OM_DONE_Y 141
+#define OM_DONE_W 74
+#define OM_DONE_H 43
+
+#define OM_CANCEL_X 93
+#define OM_CANCEL_Y 141
+#define OM_CANCEL_W 74
+#define OM_CANCEL_H 43
+
+#define OM_DIGI_X 47
+#define OM_DIGI_Y 64
+#define OM_DIGI_W 212
+#define OM_DIGI_H 24
+
+#define OM_DIGESTABILITY_X 47
+#define OM_DIGESTABILITY_Y 104
+#define OM_DIGESTABILITY_W 212
+#define OM_DIGESTABILITY_H 24
+
+/**
+ * Error menu enums and defines
+ */
+enum error_menu_sprites {
+ EM_DIALOG_BOX,
+
+ EM_RETURN_BTN_NORM,
+ EM_RETURN_BTN_OVER,
+ EM_RETURN_BTN_PRESS,
+
+ EM_TOTAL_SPRITES
+};
+
+enum error_menu_tags {
+ EM_TAG_RETURN = 1
+};
+#define ERROR_MENU_X 100
+#define ERROR_MENU_Y 100
+#define ERROR_MENU_W 100
+#define ERROR_MENU_H 100
+
+#define EM_RETURN_X 15
+#define EM_RETURN_Y 15
+#define EM_RETURN_W 15
+#define EM_RETURN_H 15
+
+
+struct MenuGlobals {
+ //GLOBAL VARS
+ bool menuSystemInitialized = false;
+ bool interfaceWasVisible = false;
+ RGB8 *menuPalette = nullptr;
+ bool dumpedCodes = false;
+ bool dumpedBackground = false;
+
+ menuItem *menuCurrItem = nullptr;
+
+ guiMenu *gameMenu = nullptr;
+ guiMenu *opMenu = nullptr;
+ guiMenu *slMenu = nullptr;
+ guiMenu *errMenu = nullptr;
+
+ //menu sprite series vars
+ char *menuSeriesResource = nullptr;
+ Handle menuSeriesHandle;
+ int32 menuSeriesOffset;
+ int32 menuSeriesPalOffset;
+
+ Font *menuFont;
+
+ // menu sprites array (used to hold all the sprites for the current menu, spriteCount is set tot he number of sprites in the series)
+ int32 spriteCount = 0;
+ Sprite **menuSprites = nullptr;
+
+ // VARS SPECIFIC TO THE GAME MENUS SYSTEM
+ // An array of slot titles used by the save/load menus
+ char **slotTitles = nullptr;
+ bool *slotInUse = nullptr;
+ int32 firstSlotIndex = 0; // Slot at the top of the list on menu
+ int32 slotSelected = -1; // Slot currently selected
+ bool deleteSaveDesc = false;
+
+ Sprite **thumbNails = nullptr;
+ Sprite *saveLoadThumbNail = nullptr;
+ int32 sizeofThumbData = -1;
+ int32 thumbIndex = 0;
+
+ bool currMenuIsSave = true; // Used to determine load or save menu
+ bool saveLoadFromHotkey = false; // Come from hotkey, not through game menu
+ bool gameMenuFromMain = false; // Come from main menu, not through escape
+
+ int32 remember_digi_volume; // For cancelling out of the options menu
+ int32 remember_digestability; // For cancelling out of the options menu
+};
+
extern void CreateGameMenu(RGB8 *myPalette);
extern void CreateGameMenuFromMain(RGB8 *myPalette);
extern void CreateGameMenuMain(RGB8 *myPalette);
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
new file mode 100644
index 00000000000..b995954c017
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room903.h"
+#include "m4/adv_r/adv_control.h"
+#include "m4/adv_r/adv_trigger.h"
+#include "m4/burger/vars.h"
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room903::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room903::init() {
+ player_set_commands_allowed(false);
+ _val1 = 0;
+ _val2 = 0;
+ _val3 = -1;
+ _val4 = -1;
+ _val5 = -1;
+#ifdef TODO
+ series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
+#endif
+ if (_G(game).previous_room <= 0 || _G(game).previous_room == 951) {
+ kernel_trigger_dispatch_now(11);
+
+ } else {
+ if (!digi_play_state(1))
+ kernel_trigger_dispatch_now(1);
+
+ kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(14);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 60, -1);
+ }
+}
+
+void Room903::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ // TODO
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
new file mode 100644
index 00000000000..442537adedc
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION9_ROOM903_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM903_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room903 : public Rooms::Room {
+private:
+ int _val1 = 0, _val2 = 0, _val3 = 0;
+ int _val4 = 0, _val5 = 0;
+ void *_ptr1 = nullptr;
+ const char *_ptr2 = nullptr;
+ const char *_pt3 = nullptr;
+
+public:
+ Room903() : Rooms::Room(903) {}
+
+ void preload() override;
+ void init() override;
+ void pre_parser() override {}
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index a5d7a904d04..90a06ba04a8 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -78,7 +78,6 @@ enum scene_triggers {
START_46,
START_47,
START_48,
- START_49,
START_50,
START_51,
START_52,
@@ -655,7 +654,6 @@ void Room951::daemon() {
}
break;
- case START_49:
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 89ac67821fa..ffe4930e6db 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -29,6 +29,7 @@
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/detection.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
@@ -103,7 +104,7 @@ void Vars::main_cold_data_init() {
_game.new_room = 901; // Burger Demo starts at the demo menu screen
break;
case WHOLE_GAME:
- _game.new_room = kernel_save_game_exists(0) ? 903 : 951;
+ _game.new_room = g_engine->autosaveExists() ? 903 : 951;
break;
}
_game.new_section = _game.new_room / 100; // ... in this section!
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 35d49065a24..c264733f6ff 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -86,6 +86,7 @@ MODULE_OBJS = \
burger/rooms/section.o \
burger/rooms/section1/section1.o \
burger/rooms/section9/section9.o \
+ burger/rooms/section9/room903.o \
burger/rooms/section9/room951.o \
burger/burger.o \
burger/flags.o \
Commit: 1a911d5d38e9bbd14398992746befd0a93b51d69
https://github.com/scummvm/scummvm/commit/1a911d5d38e9bbd14398992746befd0a93b51d69
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added series_show_
Changed paths:
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index b995954c017..3f501b58312 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section9/room903.h"
#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_trigger.h"
+#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
#include "m4/m4.h"
@@ -40,9 +41,9 @@ void Room903::init() {
_val3 = -1;
_val4 = -1;
_val5 = -1;
-#ifdef TODO
+
series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
-#endif
+
if (_G(game).previous_room <= 0 || _G(game).previous_room == 951) {
kernel_trigger_dispatch_now(11);
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index a2db81983d6..6b34491f8e9 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -94,7 +94,7 @@ bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger) {
_G(globals)[GLB_TEMP_3] = kernel_trigger_create(trigger);
// Send the message to the machine to accept the new callback frame num and trigger
- SendWSMessage(0x10000, 0, m, 0, NULL, 1);
+ SendWSMessage(0x10000, 0, m, 0, nullptr, 1);
return true;
}
@@ -108,4 +108,42 @@ void series_set_frame_rate(machine *m, int32 newFrameRate) {
m->myAnim8->myRegs[IDX_CELS_FRAME_RATE] = newFrameRate << 16;
}
+machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+ int32 duration, int32 index, int32 s, int32 x, int32 y) {
+ CHECK_SERIES
+
+ int32 myAssetIndex;
+ RGB8 *tempPalettePtr = nullptr;
+
+ term_message(seriesName);
+
+ if (flags & SERIES_LOAD_PALETTE)
+ tempPalettePtr = &_G(master_palette)[0];
+
+ if ((myAssetIndex = AddWSAssetCELS(seriesName, -1, tempPalettePtr)) < 0)
+ error_show(FL, 'SPNF', seriesName);
+
+ _G(globals)[GLB_TEMP_1] = (frac16)myAssetIndex << 24; // cels hash
+ _G(globals)[GLB_TEMP_2] = layer << 16; // layer
+
+ _G(globals)[GLB_TEMP_3] = kernel_trigger_create(triggerNum); // trigger
+
+ _G(globals)[GLB_TEMP_4] = duration << 16; // frame duration (-1=forever, 0=default)
+ _G(globals)[GLB_TEMP_5] = index << 16; // index of series to show
+
+ _G(globals)[GLB_TEMP_6] = (s << 16) / 100; // scale
+ _G(globals)[GLB_TEMP_7] = x << 16; // x
+ _G(globals)[GLB_TEMP_8] = y << 16; // y
+
+ _G(globals)[GLB_TEMP_14] = (flags & SERIES_STICK) ? 0x10000 : 0; // stick to screen after trigger?
+ _G(globals)[GLB_TEMP_16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0;// horizontal flip
+
+ machine *m = kernel_spawn_machine(seriesName, HASH_SERIES_SHOW_MACHINE, series_trigger_dispatch_callback);
+
+ if (!m)
+ error_show(FL, 'WSMF', seriesName);
+
+ return m;
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index f89f7da0ccd..0ff1f33c038 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -27,6 +27,17 @@
namespace M4 {
+constexpr uint32 SERIES_FORWARD = 0;
+constexpr uint32 SERIES_PINGPONG = 1;
+constexpr uint32 SERIES_BACKWARD = 2;
+constexpr uint32 SERIES_RANDOM = 4; // series is played in random order, trigger after number of frames in range played
+constexpr uint32 SERIES_NO_TOSS = 8; // series is not tossed at the end of playing
+constexpr uint32 SERIES_STICK = 16; // series sticks on last frame, then sends trigger
+constexpr uint32 SERIES_LOOP_TRIGGER = 32; // get trigger back every loop
+constexpr uint32 SERIES_LOAD_PALETTE = 64; // load master_palette with colours?
+constexpr uint32 SERIES_HORZ_FLIP = 128; // horizontal flip
+
+// Old constants
constexpr uint32 FORWARD = 0;
constexpr uint32 PINGPONG = 1;
constexpr uint32 BACKWARD = 2;
@@ -74,6 +85,9 @@ machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int
bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
void series_set_frame_rate(machine *m, int32 newFrameRate);
+extern machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+ int32 duration, int32 index, int32 s, int32 x, int32 y);
+
} // namespace M4
#endif
Commit: 1ff0225ac0eb1b6075c4617c02973228697e94ea
https://github.com/scummvm/scummvm/commit/1ff0225ac0eb1b6075c4617c02973228697e94ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further framework for room 903
Changed paths:
A engines/m4/burger/rooms/section9/room9.cpp
A engines/m4/burger/rooms/section9/room9.h
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/rooms/section9/room951.h
engines/m4/burger/rooms/section9/section9.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section9/room9.cpp b/engines/m4/burger/rooms/section9/room9.cpp
new file mode 100644
index 00000000000..088e2cfc2da
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room9.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room9.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room9.h b/engines/m4/burger/rooms/section9/room9.h
new file mode 100644
index 00000000000..8921e18c140
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room9.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION9_ROOM9_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM9_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room9 : public Rooms::Room {
+protected:
+ int _val1 = -1;
+ int _val2 = -1;
+ int _val3 = -1;
+public:
+ Room9(int roomNum) : Rooms::Room(roomNum) {}
+ virtual ~Room9() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 3f501b58312..b7c6c454682 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -36,11 +36,11 @@ void Room903::preload() {
void Room903::init() {
player_set_commands_allowed(false);
- _val1 = 0;
- _val2 = 0;
+ _num1 = 0;
+ _num2 = 0;
+ _val1 = -1;
+ _val2 = -1;
_val3 = -1;
- _val4 = -1;
- _val5 = -1;
series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
@@ -58,8 +58,24 @@ void Room903::init() {
}
void Room903::daemon() {
+ if (!_G(menu).menuSystemInitialized)
+ return;
+
switch (_G(kernel).trigger) {
case 1:
+ digi_preload("903music");
+ digi_play("903music", 3, 100, -1);
+ break;
+
+ case 2:
+ if (!_val1) {
+ digi_preload("901click");
+
+ for (int i = 0; i < _val2; ++i) {
+
+ }
+ }
+
// TODO
break;
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index 442537adedc..0ef88fdbe5e 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -22,22 +22,21 @@
#ifndef M4_BURGER_ROOMS_SECTION9_ROOM903_H
#define M4_BURGER_ROOMS_SECTION9_ROOM903_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section9/room9.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room903 : public Rooms::Room {
+class Room903 : public Room9 {
private:
- int _val1 = 0, _val2 = 0, _val3 = 0;
- int _val4 = 0, _val5 = 0;
+ int _num1 = 0, _num2 = 0;
void *_ptr1 = nullptr;
const char *_ptr2 = nullptr;
const char *_pt3 = nullptr;
public:
- Room903() : Rooms::Room(903) {}
+ Room903() : Room9(903) {}
void preload() override;
void init() override;
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
index d72695eceb0..520245abdad 100644
--- a/engines/m4/burger/rooms/section9/room951.h
+++ b/engines/m4/burger/rooms/section9/room951.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION9_ROOM951_H
#define M4_BURGER_ROOMS_SECTION9_ROOM951_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section9/room9.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room951 : public Rooms::Room {
+class Room951 : public Room9 {
public:
- Room951() : Rooms::Room(951) {}
+ Room951() : Room9(951) {}
void preload() override;
void init() override;
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
index 783dea0c4fc..f1cc757d9b7 100644
--- a/engines/m4/burger/rooms/section9/section9.h
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION9_H
#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section9/room903.h"
#include "m4/burger/rooms/section9/room951.h"
namespace M4 {
@@ -31,6 +32,7 @@ namespace Rooms {
class Section9 : public Rooms::Section {
private:
+ Room903 _room903;
Room951 _room951;
public:
Section9();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 7450070894c..5f88e057ba9 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -25,6 +25,7 @@
#include "m4/vars.h"
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
+#include "m4/burger/gui/game_menu.h"
#include "m4/burger/gui/interface.h"
#include "m4/burger/flags.h"
#include "m4/burger/inventory.h"
@@ -79,6 +80,7 @@ public:
Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
GUI::Interface _interface;
+ GUI::MenuGlobals _menu;
SeriesPlayers _seriesPlayers;
ReleaseTrigger_Globals _releaseTrigger;
StreamBreak_Globals _streamBreak;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index c264733f6ff..94c6070d3b7 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -86,6 +86,7 @@ MODULE_OBJS = \
burger/rooms/section.o \
burger/rooms/section1/section1.o \
burger/rooms/section9/section9.o \
+ burger/rooms/section9/room9.o \
burger/rooms/section9/room903.o \
burger/rooms/section9/room951.o \
burger/burger.o \
Commit: 54be33c935a5b4f0cba8a78514adfac3f7a8d175
https://github.com/scummvm/scummvm/commit/54be33c935a5b4f0cba8a78514adfac3f7a8d175
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton room 901
Changed paths:
A engines/m4/burger/rooms/section9/room901.cpp
A engines/m4/burger/rooms/section9/room901.h
engines/m4/burger/rooms/section9/room9.cpp
engines/m4/burger/rooms/section9/room9.h
engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/rooms/section9/room951.h
engines/m4/burger/rooms/section9/section9.cpp
engines/m4/burger/rooms/section9/section9.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section9/room9.cpp b/engines/m4/burger/rooms/section9/room9.cpp
index 088e2cfc2da..77f6a0cecdb 100644
--- a/engines/m4/burger/rooms/section9/room9.cpp
+++ b/engines/m4/burger/rooms/section9/room9.cpp
@@ -26,7 +26,6 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room9.h b/engines/m4/burger/rooms/section9/room9.h
index 8921e18c140..6742d4fa17f 100644
--- a/engines/m4/burger/rooms/section9/room9.h
+++ b/engines/m4/burger/rooms/section9/room9.h
@@ -30,11 +30,15 @@ namespace Rooms {
class Room9 : public Rooms::Room {
protected:
+ const void *_ptr1 = nullptr;
+ const char *_menuName;
+ const char *_clickName;
int _val1 = -1;
int _val2 = -1;
int _val3 = -1;
public:
- Room9(int roomNum) : Rooms::Room(roomNum) {}
+ Room9(int roomNum, const char *menuName = nullptr, const char *clickName = nullptr) :
+ Rooms::Room(roomNum), _menuName(menuName), _clickName(clickName) {}
virtual ~Room9() {}
};
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
new file mode 100644
index 00000000000..ff93ee77257
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room901.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room901::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room901::init() {
+
+}
+
+void Room901::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room901.h b/engines/m4/burger/rooms/section9/room901.h
new file mode 100644
index 00000000000..00d8715d087
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room901.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION9_ROOM901_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM901_H
+
+#include "m4/burger/rooms/section9/room9.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room901 : public Room9 {
+public:
+ Room901() : Room9(901, "901menu", "901click") {}
+ ~Room901() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index 0ef88fdbe5e..708566721dd 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -31,12 +31,10 @@ namespace Rooms {
class Room903 : public Room9 {
private:
int _num1 = 0, _num2 = 0;
- void *_ptr1 = nullptr;
- const char *_ptr2 = nullptr;
- const char *_pt3 = nullptr;
public:
- Room903() : Room9(903) {}
+ Room903() : Room9(903, "903menu", "903click") {}
+ ~Room903() override {}
void preload() override;
void init() override;
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
index 520245abdad..e27e620f6d2 100644
--- a/engines/m4/burger/rooms/section9/room951.h
+++ b/engines/m4/burger/rooms/section9/room951.h
@@ -31,6 +31,7 @@ namespace Rooms {
class Room951 : public Room9 {
public:
Room951() : Room9(951) {}
+ ~Room951() override {}
void preload() override;
void init() override;
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
index 52431389674..79edeecfaac 100644
--- a/engines/m4/burger/rooms/section9/section9.cpp
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -27,6 +27,8 @@ namespace Burger {
namespace Rooms {
Section9::Section9() : Rooms::Section() {
+ add(&_room901);
+ add(&_room903);
add(&_room951);
}
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
index f1cc757d9b7..a4b6821bb2d 100644
--- a/engines/m4/burger/rooms/section9/section9.h
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION9_H
#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section9/room901.h"
#include "m4/burger/rooms/section9/room903.h"
#include "m4/burger/rooms/section9/room951.h"
@@ -32,6 +33,7 @@ namespace Rooms {
class Section9 : public Rooms::Section {
private:
+ Room901 _room901;
Room903 _room903;
Room951 _room951;
public:
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 94c6070d3b7..db0df68b3d2 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -87,6 +87,7 @@ MODULE_OBJS = \
burger/rooms/section1/section1.o \
burger/rooms/section9/section9.o \
burger/rooms/section9/room9.o \
+ burger/rooms/section9/room901.o \
burger/rooms/section9/room903.o \
burger/rooms/section9/room951.o \
burger/burger.o \
Commit: 7d537e1b33555ed9cf5549c98ac90f0a22105e25
https://github.com/scummvm/scummvm/commit/7d537e1b33555ed9cf5549c98ac90f0a22105e25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented room 901
Changed paths:
A engines/m4/burger/rooms/section9/menu_room.cpp
A engines/m4/burger/rooms/section9/menu_room.h
R engines/m4/burger/rooms/section9/room9.cpp
R engines/m4/burger/rooms/section9/room9.h
engines/m4/adv_r/adv_game.h
engines/m4/adv_r/kernel.h
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/burger/rooms/section9/room901.h
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/rooms/section9/room951.cpp
engines/m4/burger/rooms/section9/room951.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/core/rooms.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/module.mk
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv_game.h b/engines/m4/adv_r/adv_game.h
index 26bf316cb8d..4437a36b604 100644
--- a/engines/m4/adv_r/adv_game.h
+++ b/engines/m4/adv_r/adv_game.h
@@ -44,6 +44,14 @@ struct GameControl {
int32 midi_overall_volume_percent = 100;
bool camera_pan_instant = false;
+ /**
+ * Shortcut for setting new room and section
+ */
+ void setRoom(int newRoom) {
+ new_room = newRoom;
+ new_section = newRoom / 100;
+ }
+
void syncGame(Common::Serializer &s);
};
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 4ab554d232f..8662749223d 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -48,7 +48,7 @@ struct Kernel {
int32 fade_up_time = 0;
int16 first_fade = 0;
bool fading_to_grey = false;
- bool supress_fadeup = false;
+ bool suppress_fadeup = false;
bool force_restart = false;
bool pause = false;
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
new file mode 100644
index 00000000000..a63f35cd31b
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/menu_room.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void MenuRoom::setButtons(const MenuButtonDef *btns, int count) {
+ _buttons.resize(count);
+ for (int i = 0; i < count; ++i)
+ _buttons[i] = btns[i];
+}
+
+void MenuRoom::drawButton(int index) {
+ if (index < 0 || index >= (int)_buttons.size())
+ error_show(FL, 'Burg', "draw_button which?");
+
+ MenuButton &btn = _buttons[index];
+ assert(btn._state >= BTNSTATE_0 && btn._state <= BTNSTATE_3);
+ int frame[4] = { btn._frame0, btn._frame1, btn._frame2, btn._frame3 };
+ btn._machine = series_show_(_menuName, 0, 0, -1, -1, frame[btn._state], 100, btn._x1, btn._y1);
+}
+
+void MenuRoom::setButtonState(int index, ButtonState newState) {
+ if (index >= 0 && index < (int)_buttons.size()) {
+ MenuButton &btn = _buttons[index];
+ if (btn._state != BTNSTATE_0 && newState != btn._state) {
+ TerminateMachineAndNull(btn._machine);
+ btn._state = newState;
+ drawButton(index);
+ }
+ } else if (index != -1) {
+ // LOL: A fine example of original authors sense of humour
+ term_message("ooga booga %d", index);
+ }
+}
+
+int32 MenuRoom::is_mouse_over_a_button() const {
+ for (uint idx = 0; idx < _buttons.size(); ++idx) {
+ const MenuButton &btn = _buttons[idx];
+
+ if (_G(MouseState).CursorColumn >= btn._x1 && _G(MouseState).CursorColumn <= btn._x2 &&
+ _G(MouseState).CursorRow >= btn._y1 && _G(MouseState).CursorRow <= btn._y2) {
+ return idx;
+ }
+ }
+
+ // Mouse not over any button
+ return NO_BUTTONS_HILITED;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room9.h b/engines/m4/burger/rooms/section9/menu_room.h
similarity index 50%
rename from engines/m4/burger/rooms/section9/room9.h
rename to engines/m4/burger/rooms/section9/menu_room.h
index 6742d4fa17f..d19360209a9 100644
--- a/engines/m4/burger/rooms/section9/room9.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -19,27 +19,74 @@
*
*/
-#ifndef M4_BURGER_ROOMS_SECTION9_ROOM9_H
-#define M4_BURGER_ROOMS_SECTION9_ROOM9_H
+#ifndef M4_BURGER_ROOMS_SECTION9_MENU_ROOM_H
+#define M4_BURGER_ROOMS_SECTION9_MENU_ROOM_H
+#include "common/array.h"
+#include "m4/wscript/ws_machine.h"
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room9 : public Rooms::Room {
+constexpr int NO_BUTTONS_HILITED = -1;
+
+enum ButtonState { BTNSTATE_0 = 0, BTNSTATE_1 = 1, BTNSTATE_2 = 2, BTNSTATE_3 = 3 };
+
+struct MenuButtonDef {
+ int32 _x1;
+ int32 _y1;
+ int32 _x2;
+ int32 _y2;
+ int32 _frame0;
+ int32 _frame1;
+ int32 _frame2;
+ int32 _frame3;
+ ButtonState _state;
+ int32 _val10;
+};
+
+struct MenuButton : public MenuButtonDef {
+ machine *_machine = nullptr;
+
+ MenuButton() : MenuButtonDef() {}
+ MenuButton(const MenuButtonDef &def) : MenuButtonDef(def) {}
+};
+
+class MenuRoom : public Rooms::Room {
protected:
- const void *_ptr1 = nullptr;
+ Common::Array<MenuButton> _buttons;
const char *_menuName;
const char *_clickName;
- int _val1 = -1;
int _val2 = -1;
int _val3 = -1;
+ int _val4 = -1;
+
+ /**
+ * Set the display buttons
+ */
+ void setButtons(const MenuButtonDef *btns, int count);
+
+ /**
+ * Draws a button
+ */
+ void drawButton(int index);
+
+ /**
+ * Changes a button's state
+ */
+ void setButtonState(int index, ButtonState newState);
+
+ /**
+ * Returns the index of the button currently under the mouse, if any
+ */
+ int32 is_mouse_over_a_button() const;
+
public:
- Room9(int roomNum, const char *menuName = nullptr, const char *clickName = nullptr) :
+ MenuRoom(int roomNum, const char *menuName, const char *clickName) :
Rooms::Room(roomNum), _menuName(menuName), _clickName(clickName) {}
- virtual ~Room9() {}
+ virtual ~MenuRoom() {}
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room9.cpp b/engines/m4/burger/rooms/section9/room9.cpp
deleted file mode 100644
index 77f6a0cecdb..00000000000
--- a/engines/m4/burger/rooms/section9/room9.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/>.
- *
- */
-
-#include "m4/burger/rooms/section9/room9.h"
-#include "m4/burger/vars.h"
-
-namespace M4 {
-namespace Burger {
-namespace Rooms {
-
-} // namespace Rooms
-} // namespace Burger
-} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index ff93ee77257..1faa2c1c851 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -20,21 +20,114 @@
*/
#include "m4/burger/rooms/section9/room901.h"
+#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ MENU_SHOW = 1,
+ MENU_RESTORE = 2,
+ MENU_3 = 3,
+ MENU_4 = 4,
+ MENU_5 = 5,
+ MENU_RESTARTING = 6,
+ MENU_RESTART = 7,
+ MENU_8 = 8
+};
+
+static const MenuButtonDef DEMO_BUTTONS[4] = {
+ { 337, 82, 622, 140, 0, 1, 2, 3, BTNSTATE_1, 3 },
+ { 337, 138, 622, 197, 4, 5, 6, 7, BTNSTATE_1, 6 },
+ { 337, 198, 622, 256, 8, 9, 10, 11, BTNSTATE_1, 5 },
+ { 337, 260, 622, 317, 12, 13, 14, 15, BTNSTATE_1, 9 }
+};
+
+static const MenuButtonDef GAME_BUTTONS[2] = {
+ { 337, 82, 622, 140, 4, 5, 6, 7, BTNSTATE_1, 6 },
+ { 337, 138, 622, 197, 12, 13, 14, 15, BTNSTATE_1, 9 }
+};
+
void Room901::preload() {
_G(player).walker_in_this_scene = false;
}
void Room901::init() {
+ switch (_G(executing)) {
+ case JUST_OVERVIEW:
+ case INTERACTIVE_DEMO:
+ case MAGAZINE_DEMO:
+ setButtons(DEMO_BUTTONS, 4);
+ series_play_("901order", 0, 0, -1, 60, -1, 100, 165, 395, 0, -1);
+ break;
+
+ case WHOLE_GAME:
+ setButtons(GAME_BUTTONS, 2);
+ series_play_("901order", 0, 0, -1, 60, -1, 100, 470, 245, 0, -1);
+ break;
+ }
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 60, MENU_SHOW);
+
+ for (uint i = 0; i < _buttons.size(); ++i)
+ drawButton(i);
+
+ _val2 = -1;
+ _val3 = -1;
+ _val4 = -1;
}
void Room901::daemon() {
+ switch (_G(kernel).trigger) {
+ case MENU_SHOW:
+ case MENU_RESTORE:
+ if (_G(kernel).trigger == MENU_SHOW)
+ _G(kernel).call_daemon_every_loop = true;
+
+ for (uint i = 0; i < _buttons.size(); ++i) {
+ if (_buttons[i]._state != BTNSTATE_0)
+ setButtonState(i, BTNSTATE_1);
+ }
+ break;
+
+ case MENU_3:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 9005);
+ break;
+
+ case MENU_4:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 9006);
+ break;
+
+ case MENU_5:
+ case MENU_8:
+ _G(room902Flag) = _G(kernel).trigger == 8;
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 9002);
+ break;
+
+ case MENU_RESTARTING:
+ g_vars->initialize_game();
+ conv_reset_all();
+ _G(flags).reset2();
+
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, MENU_RESTART);
+ break;
+
+ case MENU_RESTART:
+ _G(game).setRoom(601);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room901.h b/engines/m4/burger/rooms/section9/room901.h
index 00d8715d087..90154f83a03 100644
--- a/engines/m4/burger/rooms/section9/room901.h
+++ b/engines/m4/burger/rooms/section9/room901.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION9_ROOM901_H
#define M4_BURGER_ROOMS_SECTION9_ROOM901_H
-#include "m4/burger/rooms/section9/room9.h"
+#include "m4/burger/rooms/section9/menu_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room901 : public Room9 {
+class Room901 : public MenuRoom {
public:
- Room901() : Room9(901, "901menu", "901click") {}
+ Room901() : MenuRoom(901, "901menu", "901click") {}
~Room901() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index b7c6c454682..93bc7ecce1e 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -37,10 +37,9 @@ void Room903::preload() {
void Room903::init() {
player_set_commands_allowed(false);
_num1 = 0;
- _num2 = 0;
- _val1 = -1;
_val2 = -1;
_val3 = -1;
+ _val4 = -1;
series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
@@ -68,7 +67,7 @@ void Room903::daemon() {
break;
case 2:
- if (!_val1) {
+ if (!_num1) {
digi_preload("901click");
for (int i = 0; i < _val2; ++i) {
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index 708566721dd..558d40dedef 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -22,23 +22,22 @@
#ifndef M4_BURGER_ROOMS_SECTION9_ROOM903_H
#define M4_BURGER_ROOMS_SECTION9_ROOM903_H
-#include "m4/burger/rooms/section9/room9.h"
+#include "m4/burger/rooms/section9/menu_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room903 : public Room9 {
+class Room903 : public MenuRoom {
private:
- int _num1 = 0, _num2 = 0;
+ int _num1 = 0;
public:
- Room903() : Room9(903, "903menu", "903click") {}
+ Room903() : MenuRoom(903, "903menu", "903click") {}
~Room903() override {}
void preload() override;
void init() override;
- void pre_parser() override {}
void daemon() override;
};
diff --git a/engines/m4/burger/rooms/section9/room951.cpp b/engines/m4/burger/rooms/section9/room951.cpp
index 90a06ba04a8..4c11bb48daa 100644
--- a/engines/m4/burger/rooms/section9/room951.cpp
+++ b/engines/m4/burger/rooms/section9/room951.cpp
@@ -322,7 +322,7 @@ void Room951::preload() {
}
void Room951::init() {
- _G(kernel).supress_fadeup = true;
+ _G(kernel).suppress_fadeup = true;
pal_fade_set_start(_G(master_palette), 0);
pal_fade_init(_G(master_palette), 0, 255, 100, 40, START_ORION_BURGER_POSTER);
}
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
index e27e620f6d2..d8d34569d7e 100644
--- a/engines/m4/burger/rooms/section9/room951.h
+++ b/engines/m4/burger/rooms/section9/room951.h
@@ -22,20 +22,19 @@
#ifndef M4_BURGER_ROOMS_SECTION9_ROOM951_H
#define M4_BURGER_ROOMS_SECTION9_ROOM951_H
-#include "m4/burger/rooms/section9/room9.h"
+#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room951 : public Room9 {
+class Room951 : public Rooms::Room {
public:
- Room951() : Room9(951) {}
+ Room951() : Rooms::Room(951) {}
~Room951() override {}
void preload() override;
void init() override;
- void pre_parser() override {}
void daemon() override;
};
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index ffe4930e6db..bbe2cdd3055 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -97,17 +97,18 @@ void Vars::main_cold_data_init() {
switch (_executing) {
case JUST_OVERVIEW:
- _game.new_room = 971; // Burger overview starts right in at 971
+ _game.setRoom(971); // Burger overview starts right in at 971
break;
case INTERACTIVE_DEMO:
case MAGAZINE_DEMO:
- _game.new_room = 901; // Burger Demo starts at the demo menu screen
+ _game.setRoom(901); // Burger Demo starts at the demo menu screen
break;
case WHOLE_GAME:
- _game.new_room = g_engine->autosaveExists() ? 903 : 951;
+ _game.setRoom(g_engine->autosaveExists() ? 903 : 951);
break;
}
- _game.new_section = _game.new_room / 100; // ... in this section!
+
+ _game.setRoom(901); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 5f88e057ba9..39bd1652ee4 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -89,6 +89,7 @@ public:
const Common::String _wilbur = "WILBUR";
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
+ bool _room902Flag = false;
public:
Vars();
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 3783f4c6bd1..bdd5655b180 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -97,7 +97,7 @@ void Sections::m4SceneLoad() {
// -------------------- SECTION CONSTRUCTOR and ROOM PRELOAD ------------------
section_room_constructor();
- _G(kernel).supress_fadeup = false;
+ _G(kernel).suppress_fadeup = false;
room_preload();
@@ -155,7 +155,7 @@ void Sections::m4SceneLoad() {
}
// Init for fade up screen
- if (!_G(kernel).supress_fadeup) {
+ if (!_G(kernel).suppress_fadeup) {
pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to black instantly (0 ticks)
pal_fade_init(&_G(master_palette)[0], _G(kernel).first_fade, 255, 100,
_G(kernel).fade_up_time, 32765); // 30 ticks
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 6b34491f8e9..ed3eab74ee2 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -146,4 +146,50 @@ machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16
return m;
}
+machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+ int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
+ int32 firstFrame, int32 lastFrame) {
+ CHECK_SERIES
+
+ int32 myAssetIndex;
+ RGB8 *tempPalettePtr = NULL;
+
+ term_message(seriesName);
+
+ if (flags & SERIES_LOAD_PALETTE)
+ tempPalettePtr = &_G(master_palette)[0];
+
+ if ((myAssetIndex = AddWSAssetCELS(seriesName, -1, tempPalettePtr)) < 0)
+ error_show(FL, 'SPNF', seriesName);
+
+ _G(globals)[GLB_TEMP_1] = (frac16)myAssetIndex << 24; // cels hash
+ _G(globals)[GLB_TEMP_2] = layer << 16; // layer
+
+ _G(globals)[GLB_TEMP_3] = kernel_trigger_create(triggerNum); // trigger
+
+ _G(globals)[GLB_TEMP_4] = frameRate << 16; // framerate
+ _G(globals)[GLB_TEMP_5] = loopCount << 16; // loop count
+
+ _G(globals)[GLB_TEMP_6] = (s << 16) / 100; // scale
+ _G(globals)[GLB_TEMP_7] = x << 16; // x
+ _G(globals)[GLB_TEMP_8] = y << 16; // y
+
+ _G(globals)[GLB_TEMP_9] = firstFrame << 16; // first frame
+ _G(globals)[GLB_TEMP_10] = lastFrame << 16; // last frame
+
+ _G(globals)[GLB_TEMP_11] = (flags & SERIES_PINGPONG) ? 0x10000 : 0; // ping pong
+ _G(globals)[GLB_TEMP_12] = (flags & SERIES_BACKWARD) ? 0x10000 : 0; // backwards
+ _G(globals)[GLB_TEMP_13] = (flags & SERIES_RANDOM) ? 0x10000 : 0; // random
+ _G(globals)[GLB_TEMP_14] = (flags & SERIES_STICK) ? 0x10000 : 0; // stick to screen
+ _G(globals)[GLB_TEMP_15] = (flags & SERIES_LOOP_TRIGGER) ? 0x10000 : 0; // trigger back every loop?
+ _G(globals)[GLB_TEMP_16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0; // horizontal flip
+
+ machine *m = kernel_spawn_machine(seriesName, HASH_SERIES_PLAY_MACHINE, series_trigger_dispatch_callback);
+
+ if (!m)
+ error_show(FL, 'WSMF', seriesName);
+
+ return m;
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 0ff1f33c038..fc164b69cf5 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -87,6 +87,9 @@ void series_set_frame_rate(machine *m, int32 newFrameRate);
extern machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 duration, int32 index, int32 s, int32 x, int32 y);
+extern machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+ int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
+ int32 firstFrame, int32 lastFrame);
} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index db0df68b3d2..fd5a51270e4 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -86,7 +86,7 @@ MODULE_OBJS = \
burger/rooms/section.o \
burger/rooms/section1/section1.o \
burger/rooms/section9/section9.o \
- burger/rooms/section9/room9.o \
+ burger/rooms/section9/menu_room.o \
burger/rooms/section9/room901.o \
burger/rooms/section9/room903.o \
burger/rooms/section9/room951.o \
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index cc16ce9d275..f7d6069722a 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -777,6 +777,10 @@ void TerminateMachine(machine *myMachine) {
ShutdownMachine(myMachine);
}
+void TerminateMachineAndNull(machine *&m) {
+ TerminateMachine(m);
+ m = nullptr;
+}
bool VerifyMachineExists(machine *m) {
machine *tempM;
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 45bbbb33145..4d3481be8b1 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -183,6 +183,7 @@ void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrB
void TerminateMachine(machine *m);
void TerminateMachinesByHash(uint32 machHash);
+void TerminateMachineAndNull(machine *&m);
bool VerifyMachineExists(machine *m);
int32 ws_KillMachines();
void ws_StepWhile(machine *m, int32 pcOffset, int32 pcCount);
Commit: f8c1cd018605a0dd00306e15bd7750eb36322460
https://github.com/scummvm/scummvm/commit/f8c1cd018605a0dd00306e15bd7750eb36322460
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix some pointer arithmatic
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index c93aac22671..ab83190195a 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -680,12 +680,8 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
if (_GWS(globalCELSnames)[hash] && (!strcmp(_GWS(globalCELSnames)[hash], wsAssetName))) {
if (_GWS(globalCELSPaloffsets)[hash] >= 0) {
// Get the pointer to the pal data
-#ifdef TODO
workHandle = _GWS(globalCELSHandles)[hash];
- palPtr = (int32 *)((byte *)*workHandle + _GWS(globalCELSPaloffsets)[hash]);
-#else
- error("TODO: Figure out dereferencing");
-#endif
+ palPtr = (int32 *)((intptr)*workHandle + _GWS(globalCELSPaloffsets)[hash]);
// Restore the palette and unlock the handle
RestoreSSPaletteInfo(myPalette, palPtr);
@@ -748,13 +744,10 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Else if we found the SS already loaded
if (_GWS(globalCELSPaloffsets)[i] >= 0) {
// Get the pointer to the pal data
-#ifdef TODO
workHandle = _GWS(globalCELSHandles)[i];
HLock(workHandle);
- palPtr = (int32 *)((byte *)*workHandle + _GWS(globalCELSPaloffsets)[i]);
-#else
- error("TODO: Figure out dereferencing");
-#endif
+ palPtr = (int32 *)((intptr)*workHandle + _GWS(globalCELSPaloffsets)[i]);
+
// Restore the palette and unlock the handle
RestoreSSPaletteInfo(myPalette, palPtr);
HUnLock(workHandle);
Commit: fbbfeb6e9af6782f3602ba174ae80011b9cbcad3
https://github.com/scummvm/scummvm/commit/fbbfeb6e9af6782f3602ba174ae80011b9cbcad3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add missing room 901 code
Changed paths:
engines/m4/burger/rooms/section9/room901.cpp
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index 1faa2c1c851..d676cddc623 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -88,6 +88,9 @@ void Room901::daemon() {
if (_G(kernel).trigger == MENU_SHOW)
_G(kernel).call_daemon_every_loop = true;
+ _val4 = -1;
+ player_set_commands_allowed(true);
+
for (uint i = 0; i < _buttons.size(); ++i) {
if (_buttons[i]._state != BTNSTATE_0)
setButtonState(i, BTNSTATE_1);
Commit: 9bc5b4e9d78914be6f5f88276cb3b4cb58850afb
https://github.com/scummvm/scummvm/commit/9bc5b4e9d78914be6f5f88276cb3b4cb58850afb
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix compile error with Buffer initialization
I had to remove the default values for the Buffer struct members (after
discussing with DreamMaster) because apparently that's not compatible
with brace-enclosed initializer lists. At least not in the dialect of
C++ we're limited to.
Changed paths:
engines/m4/gui/gui_item.cpp
engines/m4/m4_types.h
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 6574b08943a..fa01beea123 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -60,7 +60,7 @@ static const byte scrollUpData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer scrollUpBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpData[0], 0 };
+static const Buffer scrollUpBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpData[0], 0, 0 };
static const byte scrollUpPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -76,7 +76,7 @@ static const byte scrollUpPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
};
-static const Buffer scrollUpPressedBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpPressedData[0], 0 };
+static const Buffer scrollUpPressedBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpPressedData[0], 0, 0 };
#define scrollDownWidth 11
#define scrollDownHeight 12
@@ -94,7 +94,7 @@ static const byte scrollDownData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer scrollDownBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownData[0], 0 };
+static const Buffer scrollDownBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownData[0], 0, 0 };
static const byte scrollDownPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -110,7 +110,7 @@ static const byte scrollDownPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
};
-static const Buffer scrollDownPressedBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownPressedData[0], 0 };
+static const Buffer scrollDownPressedBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownPressedData[0], 0, 0 };
#define thumbWidth 11
#define thumbHeight 11
@@ -127,7 +127,7 @@ static const byte thumbData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer thumbBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbData[0], 0 };
+static const Buffer thumbBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbData[0], 0, 0 };
static const byte thumbPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -142,7 +142,7 @@ static const byte thumbPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
};
-static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbPressedData[0], 0 };
+static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbPressedData[0], 0, 0 };
#define minThumbY (scrollUpHeight + _G(items).buttonHeight)
#define maxThumbY (scrollDownHeight + thumbHeight + (_G(items).buttonHeight<<1))
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index ed522f8852a..1eb8bbc1bbf 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -65,11 +65,11 @@ enum {
};
struct Buffer {
- int32 w = 0;
- int32 h = 0;
- uint8 *data = nullptr;
- uint8 encoding = 0;
- int32 stride = 0;
+ int32 w;
+ int32 h;
+ uint8 *data;
+ uint8 encoding;
+ int32 stride;
};
struct token {
Commit: 903233aa4cb661fa3fc767de828e8f431ad40fa8
https://github.com/scummvm/scummvm/commit/903233aa4cb661fa3fc767de828e8f431ad40fa8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added menu button frame tick handler
Changed paths:
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/rooms/section9/menu_room.h
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/platform/events.h
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index a63f35cd31b..dd0533a29c2 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -28,6 +28,24 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+void MenuRoom::init() {
+ _buttonNum = -1;
+ _highlightedButton = -1;
+ _activeButton = -1;
+ _flag = false;
+}
+
+
+void MenuRoom::daemon() {
+ if (_G(kernel).trigger == CALLED_EACH_LOOP) {
+ if (player_commands_allowed())
+ buttonsFrame();
+
+ } else {
+ _G(kernel).continue_handling_trigger = true;
+ }
+}
+
void MenuRoom::setButtons(const MenuButtonDef *btns, int count) {
_buttons.resize(count);
for (int i = 0; i < count; ++i)
@@ -58,6 +76,53 @@ void MenuRoom::setButtonState(int index, ButtonState newState) {
}
}
+void MenuRoom::buttonsFrame() {
+ bool newFlag = false;
+
+ _highlightedButton = is_mouse_over_a_button();
+
+ if (_buttonNum == -1) {
+ if (_highlightedButton == -1) {
+ setButtonState(_activeButton, BTNSTATE_1);
+ } else if (_highlightedButton != _activeButton) {
+ setButtonState(_activeButton, BTNSTATE_1);
+ setButtonState(_highlightedButton, BTNSTATE_2);
+ }
+ } else {
+ setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_3 : BTNSTATE_1);
+ }
+
+ if (_G(MouseState).ButtonState) {
+ _flag = true;
+ if (_buttonNum == -1)
+ _buttonNum = _highlightedButton;
+
+ if (_buttonNum != -1) {
+ setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_3 : BTNSTATE_1);
+ }
+ } else if (_flag) {
+ _flag = false;
+ newFlag = true;
+ }
+
+ if (newFlag) {
+ _G(events).clearMouseStateEvent();
+
+ if (_highlightedButton == _buttonNum && _buttonNum != -1) {
+ term_message("Button pressed: %d", _highlightedButton);
+
+ const MenuButton &btn = _buttons[_highlightedButton];
+ if (btn._state != BTNSTATE_0) {
+ digi_play(_clickName, 2, 255, -1);
+ kernel_trigger_dispatch_now(btn._trigger);
+ setButtonState(_buttonNum, BTNSTATE_2);
+ }
+ }
+
+ _buttonNum = -1;
+ }
+}
+
int32 MenuRoom::is_mouse_over_a_button() const {
for (uint idx = 0; idx < _buttons.size(); ++idx) {
const MenuButton &btn = _buttons[idx];
diff --git a/engines/m4/burger/rooms/section9/menu_room.h b/engines/m4/burger/rooms/section9/menu_room.h
index d19360209a9..80e12a793b0 100644
--- a/engines/m4/burger/rooms/section9/menu_room.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -44,7 +44,7 @@ struct MenuButtonDef {
int32 _frame2;
int32 _frame3;
ButtonState _state;
- int32 _val10;
+ int32 _trigger;
};
struct MenuButton : public MenuButtonDef {
@@ -55,13 +55,26 @@ struct MenuButton : public MenuButtonDef {
};
class MenuRoom : public Rooms::Room {
-protected:
- Common::Array<MenuButton> _buttons;
+private:
const char *_menuName;
const char *_clickName;
- int _val2 = -1;
- int _val3 = -1;
- int _val4 = -1;
+ int _buttonNum = -1;
+ int _highlightedButton = -1;
+ bool _flag = false;
+
+ /**
+ * Handles button processing once a frame
+ */
+ void buttonsFrame();
+
+ /**
+ * Returns the index of the button currently under the mouse, if any
+ */
+ int32 is_mouse_over_a_button() const;
+
+protected:
+ Common::Array<MenuButton> _buttons;
+ int _activeButton = -1;
/**
* Set the display buttons
@@ -78,15 +91,13 @@ protected:
*/
void setButtonState(int index, ButtonState newState);
- /**
- * Returns the index of the button currently under the mouse, if any
- */
- int32 is_mouse_over_a_button() const;
-
public:
MenuRoom(int roomNum, const char *menuName, const char *clickName) :
Rooms::Room(roomNum), _menuName(menuName), _clickName(clickName) {}
virtual ~MenuRoom() {}
+
+ void init() override;
+ void daemon() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index d676cddc623..5ea0fccfa00 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -55,6 +55,8 @@ void Room901::preload() {
}
void Room901::init() {
+ MenuRoom::init();
+
switch (_G(executing)) {
case JUST_OVERVIEW:
case INTERACTIVE_DEMO:
@@ -75,10 +77,6 @@ void Room901::init() {
for (uint i = 0; i < _buttons.size(); ++i)
drawButton(i);
-
- _val2 = -1;
- _val3 = -1;
- _val4 = -1;
}
void Room901::daemon() {
@@ -88,7 +86,7 @@ void Room901::daemon() {
if (_G(kernel).trigger == MENU_SHOW)
_G(kernel).call_daemon_every_loop = true;
- _val4 = -1;
+ _activeButton = -1;
player_set_commands_allowed(true);
for (uint i = 0; i < _buttons.size(); ++i) {
@@ -128,7 +126,7 @@ void Room901::daemon() {
break;
default:
- _G(kernel).continue_handling_trigger = true;
+ MenuRoom::daemon();
break;
}
}
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 93bc7ecce1e..37e7b65b16e 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -35,11 +35,9 @@ void Room903::preload() {
}
void Room903::init() {
+ MenuRoom::init();
player_set_commands_allowed(false);
_num1 = 0;
- _val2 = -1;
- _val3 = -1;
- _val4 = -1;
series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
@@ -70,7 +68,7 @@ void Room903::daemon() {
if (!_num1) {
digi_preload("901click");
- for (int i = 0; i < _val2; ++i) {
+ for (uint i = 0; i < _buttons.size(); ++i) {
}
}
@@ -79,12 +77,11 @@ void Room903::daemon() {
break;
default:
- _G(kernel).continue_handling_trigger = true;
+ MenuRoom::daemon();
break;
}
}
-
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/platform/events.h b/engines/m4/platform/events.h
index 90ebbb8bb8e..a3cb96d1de1 100644
--- a/engines/m4/platform/events.h
+++ b/engines/m4/platform/events.h
@@ -110,6 +110,10 @@ public:
* Get the next pending keyboard event
*/
bool util_kbd_check(int32 *parm1);
+
+ void clearMouseStateEvent() {
+ _mouseStateEvent = 0;
+ }
};
extern Events *g_events;
Commit: db720319e9d75f62d33a652db407d2e2611fa226
https://github.com/scummvm/scummvm/commit/db720319e9d75f62d33a652db407d2e2611fa226
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove duplicate ws_LogErrorMsg
Changed paths:
engines/m4/burger/rooms/section9/menu_room.h
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_hal.h
engines/m4/wscript/wscript.cpp
engines/m4/wscript/wscript.h
diff --git a/engines/m4/burger/rooms/section9/menu_room.h b/engines/m4/burger/rooms/section9/menu_room.h
index 80e12a793b0..27d47d97b7c 100644
--- a/engines/m4/burger/rooms/section9/menu_room.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -54,12 +54,16 @@ struct MenuButton : public MenuButtonDef {
MenuButton(const MenuButtonDef &def) : MenuButtonDef(def) {}
};
+/**
+ * Base class used for the menu rooms 901 and 903
+ */
class MenuRoom : public Rooms::Room {
private:
const char *_menuName;
const char *_clickName;
int _buttonNum = -1;
int _highlightedButton = -1;
+ int _activeButton = -1;
bool _flag = false;
/**
@@ -74,7 +78,6 @@ private:
protected:
Common::Array<MenuButton> _buttons;
- int _activeButton = -1;
/**
* Set the display buttons
@@ -91,6 +94,12 @@ protected:
*/
void setButtonState(int index, ButtonState newState);
+ /**
+ * Resets the selected button
+ */
+ void resetSelectedButton() {
+ _activeButton = -1;
+ }
public:
MenuRoom(int roomNum, const char *menuName, const char *clickName) :
Rooms::Room(roomNum), _menuName(menuName), _clickName(clickName) {}
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index 5ea0fccfa00..44a19b5be0d 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -86,7 +86,7 @@ void Room901::daemon() {
if (_G(kernel).trigger == MENU_SHOW)
_G(kernel).call_daemon_every_loop = true;
- _activeButton = -1;
+ resetSelectedButton();
player_set_commands_allowed(true);
for (uint i = 0; i < _buttons.size(); ++i) {
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 1afec3ad9a8..0912264673d 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/wscript/ws_cruncher.h"
-#include "m4/wscript/ws_hal.h"
+#include "m4/wscript/wscript.h"
#include "m4/wscript/wst_regs.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 874aaf482a9..53220c6764a 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -123,26 +123,14 @@ void ws_Error(machine *m, int32 errorType, trigraph errorCode, const char *errMs
error_show(FL, errorCode, errMsg);
}
-void ws_LogErrorMsg(char *sourceFile, int32 lineNum, const char *fmt, ...) {
- Common::OutSaveFile *logFile;
- Common::String msgBuff;
- va_list ap;
-
- va_start(ap, fmt);
- msgBuff == Common::String::vformat(fmt, ap);
- va_end(ap);
+void ws_LogErrorMsg(const char *filename, uint32 line, const char *fmt, ...) {
+ va_list argPtr;
+ va_start(argPtr, fmt);
- logFile = g_system->getSavefileManager()->openForSaving("ws_mach.log");
- if (logFile) {
- logFile->writeString(Common::String::format("Source Code Index: %s:%ld\n", sourceFile, lineNum));
- logFile->writeString(Common::String::format("%s\n\n", msgBuff.c_str()));
-
- logFile->finalize();
- delete logFile;
- }
+ Common::String msg = Common::String::vformat(fmt, argPtr);
+ va_end(argPtr);
- term_message("Source Code Index: %s:%ld", sourceFile, lineNum);
- term_message("%s", msgBuff.c_str());
+ error("%s", msg.c_str());
}
machine *kernel_timer_callback(int32 ticks, int16 trigger, MessageCB callMe) {
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index 4ecac4d8f8b..9ce0eb097b3 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -64,7 +64,7 @@ extern void ws_OverrideCrunchTime(machine *m);
extern bool CheckAddr();
extern void ws_Error(machine *m, int32 errorType, quadchar errorCode, const char *errMsg);
extern void ws_DumpMachine(machine *m);
-extern void ws_LogErrorMsg(char *sourceFile, int32 lineNum, char *fmt, ...);
+extern void ws_LogErrorMsg(const char *sourceFile, uint32 lineNum, const char *fmt, ...);
} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.cpp b/engines/m4/wscript/wscript.cpp
index fb711538546..a16cf5f4751 100644
--- a/engines/m4/wscript/wscript.cpp
+++ b/engines/m4/wscript/wscript.cpp
@@ -24,14 +24,4 @@
namespace M4 {
-void ws_LogErrorMsg(const char *filename, uint32 line, const char *fmt, ...) {
- va_list argPtr;
- va_start(argPtr, fmt);
-
- Common::String msg = Common::String::vformat(fmt, argPtr);
- va_end(argPtr);
-
- error("%s", msg.c_str());
-}
-
} // End of namespace M4
diff --git a/engines/m4/wscript/wscript.h b/engines/m4/wscript/wscript.h
index fed1ced823e..7fb250f96b4 100644
--- a/engines/m4/wscript/wscript.h
+++ b/engines/m4/wscript/wscript.h
@@ -35,8 +35,6 @@ struct WS_Globals : public WSCruncher_Globals, public WSHal_Globals,
public WSLoad_Globals, public WSMachine_Globals, public WSTimer_Globals {
};
-extern void ws_LogErrorMsg(const char *filename, uint32 line, const char *fmt, ...);
-
} // End of namespace M4
#endif
Commit: 9f9c10ceceace77e898317c5f488b19867a5cbc7
https://github.com/scummvm/scummvm/commit/9f9c10ceceace77e898317c5f488b19867a5cbc7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Buffer initialization error fix
Changed paths:
engines/m4/graphics/gr_sprite.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index aec6e72caa0..d7c7778feab 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -97,7 +97,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
Buffer source;
int32 leftOffset = 0, rightOffset = 0, YPos;
uint8 *shadowBuff = nullptr, *scaledBuff = nullptr;
- Buffer afterScaled;
+ Buffer afterScaled = { 0, 0, nullptr, 0, 0 };
uint8 bottomCut = 0;
if (!drawReq->Src) {
Commit: e9d918c773492fade231be4fefc64f896ab7c600
https://github.com/scummvm/scummvm/commit/e9d918c773492fade231be4fefc64f896ab7c600
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanups of mouse init / sprites
Changed paths:
engines/m4/gui/gui.h
engines/m4/gui/gui_mouse.cpp
engines/m4/vars.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/gui/gui.h b/engines/m4/gui/gui.h
index b30b5c30e1e..24909f3928f 100644
--- a/engines/m4/gui/gui.h
+++ b/engines/m4/gui/gui.h
@@ -29,23 +29,23 @@
namespace M4 {
struct M4sprite {
- M4sprite *next;
- M4sprite *prev;
- int32 x;
- int32 y;
- int32 w;
- int32 h;
- int32 xOffset; // the "hotspot" of the sprite, ie: the registration point
- int32 yOffset;
- uint8 encoding;
- uint8 *data;
- MemHandle sourceHandle;
- int32 sourceOffset;
+ M4sprite *next = nullptr;
+ M4sprite *prev = nullptr;
+ int32 x = 0;
+ int32 y = 0;
+ int32 w = 0;
+ int32 h = 0;
+ int32 xOffset = 0; // the "hotspot" of the sprite, ie: the registration point
+ int32 yOffset = 0;
+ uint8 encoding = 0;
+ uint8 *data = nullptr;
+ MemHandle sourceHandle = nullptr;
+ int32 sourceOffset = 0;
};
struct transSprite {
- M4sprite *srcSprite;
- Buffer *scrnBuffer;
+ M4sprite *srcSprite = nullptr;
+ Buffer *scrnBuffer = nullptr;
};
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index d9ba883d668..e84de5d97db 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -261,7 +261,7 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
bool mouse_set_sprite(int32 spriteNum) {
M4sprite *tempSprite;
- int32 minX, minY, maxX, maxY;
+ int32 minX, minY, maxX, maxY;
if (_G(mouseIsLocked)) {
_G(newMouseNum) = spriteNum;
@@ -305,7 +305,8 @@ bool mouse_set_sprite(int32 spriteNum) {
}
void gui_mouse_refresh() {
- warning("TODO: gui_mouse_refresh");
+ MoveScreenAbs(_G(mouseScreen), _G(mouseX) - _G(mouseX1offset),
+ _G(mouseY) - _G(mouseY1offset));
}
void mouse_hide() {
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index c7e43241bc6..115c45852ca 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -54,6 +54,7 @@ Vars::~Vars() {
gui_system_shutdown();
gui_buffer_system_shutdown();
gui_dialog_shutdown();
+ gui_mouse_shutdown();
mem_stash_shutdown();
param_shutdown();
woodscript_shutdown();
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index ab83190195a..aa5f508e28a 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -485,7 +485,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
// Find the cels source from the asset block
HLock(resourceHandle);
- celsPtr = (uint32 *)((byte *)*resourceHandle + handleOffset);
+ celsPtr = (uint32 *)((intptr)*resourceHandle + handleOffset);
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
@@ -499,7 +499,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
data = &celsPtr[CELS_OFFSETS + numCels];
// Find the sprite data for the specific sprite in the series
- myCelSource = (uint32 *)((uint32)data + offsets[index]);
+ myCelSource = (uint32 *)((intptr)data + offsets[index]);
// Set the stream boolean
if (streamSeries) {
@@ -510,6 +510,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
}
// Initialize the sprite struct and return it
+ mySprite->next = mySprite->prev = nullptr;
mySprite->sourceHandle = resourceHandle;
mySprite->xOffset = (int32)myCelSource[CELS_X];
mySprite->yOffset = (int32)myCelSource[CELS_Y];
@@ -519,7 +520,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
mySprite->data = (uint8 *)&myCelSource[CELS_DATA];
if ((mySprite->w > 0) && (mySprite->h > 0)) {
- mySprite->sourceOffset = (int32)((byte *)(mySprite->data) - (byte *)*resourceHandle);
+ mySprite->sourceOffset = (int32)((intptr)mySprite->data - (intptr)*resourceHandle);
} else {
mySprite->sourceOffset = 0;
}
Commit: 417410370ce65dd9bd3a5a330e5540e526065fbd
https://github.com/scummvm/scummvm/commit/417410370ce65dd9bd3a5a330e5540e526065fbd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Mouse cursor is now rendering
Changed paths:
engines/m4/gui/gui_mouse.cpp
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index e84de5d97db..59a52373df7 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -21,7 +21,9 @@
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_vmng.h"
+#include "m4/core/imath.h"
#include "m4/core/mouse.h"
+#include "m4/graphics/gr_sprite.h"
#include "m4/mem/res.h"
#include "m4/vars.h"
@@ -91,7 +93,6 @@ void gui_mouse_shutdown() {
}
void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
-#ifdef TODO
ScreenContext *myScreen = (ScreenContext *)s;
matte *myRectList = (matte *)r;
Buffer *destBuffer = (Buffer *)b;
@@ -99,79 +100,80 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
transSprite *mySource;
M4sprite *mySprite;
Buffer *myBuff;
- Buffer drawSpriteBuff;
- DrawRequest spriteDrawReq;
+ Buffer drawSpriteBuff;
+ DrawRequest spriteDrawReq;
matte *myMatte, tempMatte;
RectList *updateList, *updateRect;
RectList *newUpdateList;
uint8 *rowPtr, *destPtr;
- int32 i, j;
+ int32 i, j;
- //parameter verification
- if (!myScreen) return;
+ // Parameter verification
+ if (!myScreen)
+ return;
mySource = (transSprite *)(myScreen->scrnContent);
- if (!mySource) return;
+ if (!mySource)
+ return;
myBuff = (Buffer *)(mySource->scrnBuffer);
- if (!myBuff) return;
+ if (!myBuff)
+ return;
mySprite = mySource->srcSprite;
- if (!mySprite) return;
+ if (!mySprite)
+ return;
- //if no destBuffer, then draw directly to video
+ // If no destBuffer, then draw directly to video
if (!destBuffer) {
-
tempMatte.nextMatte = NULL;
- //loopthrough the dirty matte list
+ // Loop through the dirty matte list
myMatte = myRectList;
while (myMatte) {
- //create an updateRectList to catch the black areas afterwards
+ // Create an updateRectList to catch the black areas afterwards
updateList = vmng_CreateNewRect(myMatte->x1, myMatte->y1, myMatte->x2, myMatte->y2);
updateList->prev = NULL;
updateList->next = NULL;
- //now loop through all the screens behind myScreen
+ // Now loop through all the screens behind myScreen
tempScreen = myScreen->behind;
while (tempScreen && updateList) {
-
- //duplicate the updateList
+ // Duplicate the updateList
newUpdateList = vmng_DuplicateRectList(updateList);
- //loop through the updateList
+ // Loop through the updateList
updateRect = updateList;
while (updateRect) {
-
- //see if it intersects
+ // See if it intersects
tempMatte.x1 = imath_max(updateRect->x1, tempScreen->x1);
tempMatte.y1 = imath_max(updateRect->y1, tempScreen->y1);
tempMatte.x2 = imath_min(updateRect->x2, tempScreen->x2);
tempMatte.y2 = imath_min(updateRect->y2, tempScreen->y2);
if (tempScreen->redraw && (tempMatte.x1 <= tempMatte.x2) && (tempMatte.y1 <= tempMatte.y2)) {
- //draw the intersected part of tempScreen onto myBuffer
+ // Draw the intersected part of tempScreen onto myBuffer
(tempScreen->redraw)(tempScreen, (void *)&tempMatte, myBuff, tempMatte.x1 - myScreen->x1, tempMatte.y1 - myScreen->y1);
- //remove that rectangle from the update list
+ // Remove that rectangle from the update list
vmng_RemoveRectFromRectList(&newUpdateList, tempMatte.x1, tempMatte.y1, tempMatte.x2, tempMatte.y2);
}
- //get the next updateRect
+ // Get the next updateRect
updateRect = updateRect->next;
}
- //the newUpdateList now contains all the pieces not covered by tempScreen;
- //turf the update list, and replace it with the newupdateList
+ // The newUpdateList now contains all the pieces not covered by tempScreen;
+ // turf the update list, and replace it with the newupdateList
vmng_DisposeRectList(&updateList);
updateList = newUpdateList;
- //now get the next screen
+ // Now get the next screen
tempScreen = tempScreen->behind;
}
- //now we've gone through all the screens, whatever is left in the updateList should be filled in with black
+ // Now we've gone through all the screens, whatever is left in the updateList should be filled in with black
gr_color_set(__BLACK);
updateRect = updateList;
while (updateRect) {
@@ -180,21 +182,20 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
updateRect = updateRect->next;
}
- //now dispose of the updateList
+ // Now dispose of the updateList
vmng_DisposeRectList(&updateList);
- //and finally, get the next matte
+ // And finally, get the next matte
myMatte = myMatte->nextMatte;
}
- //now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
- //now would be the time to draw the contents
-
+ // Now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
+ // Now would be the time to draw the contents
if (mySprite->sourceHandle) {
HLock(mySprite->sourceHandle);
- mySprite->data = (uint8 *)((byte *)*(mySprite->sourceHandle) + mySprite->sourceOffset);
+ mySprite->data = (uint8 *)((intptr)*(mySprite->sourceHandle) + mySprite->sourceOffset);
- drawSpriteBuff.W = mySprite->w;
+ drawSpriteBuff.w = mySprite->w;
drawSpriteBuff.stride = mySprite->w;
drawSpriteBuff.h = mySprite->h;
drawSpriteBuff.encoding = (mySprite->encoding) & (uint8)0x7f;
@@ -213,42 +214,38 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
gr_sprite_draw(&spriteDrawReq);
- //unlock the handle
+ // Unlock the handle
HUnLock(mySprite->sourceHandle);
- }
+ } else if (mySprite->data) {
+ // Else the data for the transparent sprite is stored directly in mySprite->data
- //else the data for the transparent sprite is stored directly in mySprite->data
- else if (mySprite->data) {
-
- //loop through the rows
+ // Loop through the rows
for (j = 0; (j < mySprite->h) && (j < myBuff->h); j++) {
-
- //set the rowPtr and the destPtr
+ // Set the rowPtr and the destPtr
rowPtr = mySprite->data + (j * mySprite->w);
destPtr = myBuff->data + (j * myBuff->stride);
- //loop through the columns
- for (i = 0; (i < mySprite->w) && (i < myBuff->W); i++) {
+ // Loop through the columns
+ for (i = 0; (i < mySprite->w) && (i < myBuff->w); i++) {
if (*rowPtr) {
*destPtr = *rowPtr;
}
+
destPtr++;
rowPtr++;
}
}
}
- //now dump the matte list out to video
+ // Now dump the matte list out to video
myMatte = myRectList;
while (myMatte) {
vmng_refresh_video(myMatte->x1, myMatte->y1, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
myMatte->x2 - myScreen->x1, myMatte->y2 - myScreen->y1, myBuff);
myMatte = myMatte->nextMatte;
}
- }
-
- //else draw to the dest buffer
- else {
+ } else {
+ // Else draw to the dest buffer
myMatte = myRectList;
while (myMatte) {
gr_buffer_rect_copy_2(myBuff, destBuffer, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
@@ -256,7 +253,6 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
myMatte = myMatte->nextMatte;
}
}
-#endif
}
bool mouse_set_sprite(int32 spriteNum) {
Commit: a7d940bbf572319e2fe765dc4a8180e686c9e544
https://github.com/scummvm/scummvm/commit/a7d940bbf572319e2fe765dc4a8180e686c9e544
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 903 content
Changed paths:
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/rooms/section9/menu_room.h
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/graphics/gr_series.h
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/module.mk
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index c861b8317fe..77a6bfbccc3 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -26,11 +26,16 @@
namespace M4 {
namespace Burger {
+namespace GUI {
void CreateGameMenuMain(RGB8 *myPalette) {
error("TODO: CreateGameMenuMain");
}
+void CreateSaveLoadMenu(RGB8 *myPalette, bool saveMenu) {
+ error("TODO: CreateSaveLoadMenu");
+}
+
void CreateGameMenu(RGB8 *myPalette) {
if (player_commands_allowed() && _GI(visible) && !_G(pal_fade_in_progress)
&& !_G(menuSystemInitialized)) {
@@ -46,5 +51,16 @@ void CreateGameMenuFromMain(RGB8 *myPalette) {
}
}
+void CreateLoadMenuFromMain(RGB8 *myPalette) {
+ if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
+ return;
+ }
+
+ _G(gui).saveLoadFromHotkey = true;
+ _G(gui).gameMenuFromMain = true;
+ CreateSaveLoadMenu(myPalette, false);
+}
+
+} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index dd0533a29c2..f7c7cd1aa54 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -62,6 +62,11 @@ void MenuRoom::drawButton(int index) {
btn._machine = series_show_(_menuName, 0, 0, -1, -1, frame[btn._state], 100, btn._x1, btn._y1);
}
+void MenuRoom::drawButtons() {
+ for (uint i = 0; i < _buttons.size(); ++i)
+ drawButton(i);
+}
+
void MenuRoom::setButtonState(int index, ButtonState newState) {
if (index >= 0 && index < (int)_buttons.size()) {
MenuButton &btn = _buttons[index];
diff --git a/engines/m4/burger/rooms/section9/menu_room.h b/engines/m4/burger/rooms/section9/menu_room.h
index 27d47d97b7c..23620fe73ed 100644
--- a/engines/m4/burger/rooms/section9/menu_room.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -89,6 +89,11 @@ protected:
*/
void drawButton(int index);
+ /**
+ * Draws all the buttons
+ */
+ void drawButtons();
+
/**
* Changes a button's state
*/
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index 44a19b5be0d..00ace740085 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -75,8 +75,7 @@ void Room901::init() {
pal_fade_set_start(_G(master_palette), 0);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 60, MENU_SHOW);
- for (uint i = 0; i < _buttons.size(); ++i)
- drawButton(i);
+ drawButtons();
}
void Room901::daemon() {
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 37e7b65b16e..f5947c834c2 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -24,12 +24,22 @@
#include "m4/adv_r/adv_trigger.h"
#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
+#include "m4/burger/other.h"
#include "m4/m4.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+static const MenuButtonDef BUTTONS[6] = {
+ { 295, 125, 615, 155, 0, 1, 2, 3, BTNSTATE_1, 5 },
+ { 295, 165, 615, 195, 12, 13, 14, 15, BTNSTATE_1, 6 },
+ { 295, 205, 615, 235, 4, 5, 6, 7, BTNSTATE_1, 7 },
+ { 295, 245, 615, 275, 16, 17, 18, 19, BTNSTATE_1, 8 },
+ { 295, 285, 615, 315, 8, 9, 10, 11, BTNSTATE_1, 9 },
+ { 295, 325, 615, 355, 20, 21, 22, 23, BTNSTATE_1, 10 },
+};
+
void Room903::preload() {
_G(player).walker_in_this_scene = false;
}
@@ -37,8 +47,9 @@ void Room903::preload() {
void Room903::init() {
MenuRoom::init();
player_set_commands_allowed(false);
- _num1 = 0;
+ _buttonsDrawn = false;
+ setButtons(BUTTONS, 6);
series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
if (_G(game).previous_room <= 0 || _G(game).previous_room == 951) {
@@ -65,15 +76,97 @@ void Room903::daemon() {
break;
case 2:
- if (!_num1) {
+ if (!_buttonsDrawn) {
digi_preload("901click");
+ drawButtons();
- for (uint i = 0; i < _buttons.size(); ++i) {
+ if (!g_engine->savesExist()) {
+ _buttons[2]._state = BTNSTATE_0;
+ drawButton(2);
+ }
+ if (!g_engine->autosaveExists()) {
+ _buttons[3]._state = BTNSTATE_0;
+ drawButton(3);
}
+
+ _buttonsDrawn = true;
+ kernel_timing_trigger(30, 3);
}
+ break;
+
+ case 3:
+ case 4:
+ if (_G(kernel).trigger == 3)
+ _G(kernel).call_daemon_every_loop = true;
+
+ resetSelectedButton();
+ player_set_commands_allowed(true);
+
+ for (uint i = 0; i < _buttons.size(); ++i) {
+ if (_buttons[i]._state != BTNSTATE_0)
+ setButtonState(i, BTNSTATE_1);
+ }
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 9005);
+ break;
+
+ case 6:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 15);
+ break;
+
+ case 7:
+ GUI::CreateLoadMenuFromMain(_G(master_palette));
+ break;
+
+ case 8:
+ other_resurrect_player();
+ break;
+
+ case 9:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 9004);
+ break;
+
+ case 10:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 16);
+ break;
+
+ case 11:
+ if (!digi_play_state(1))
+ digi_play("903_001", 2, 155, -1);
+
+ pal_fade_set_start(_G(master_palette), 0);
+ series_play_("903d", 1792, 16, 12, 8, 0, 100, -5, 50, 0, -1);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, -1);
+ break;
+
+ case 12:
+ kernel_timing_trigger(0, 13);
+ break;
+
+ case 13:
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 14:
+ series_show_("903d", 0, 0, -1, -1, 23);
+ break;
+
+ case 15:
+ g_vars->initialize_game();
+ _G(game).new_room = 801;
+ _G(game).new_section = 8;
+ break;
- // TODO
+ case 16:
+ // Quit game
+ _G(kernel).going = false;
break;
default:
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index 558d40dedef..f9fa87902bb 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Room903 : public MenuRoom {
private:
- int _num1 = 0;
+ bool _buttonsDrawn = false;
public:
Room903() : MenuRoom(903, "903menu", "903click") {}
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index bbe2cdd3055..c5cfd071595 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -108,7 +108,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(901); /*****DEBUG*****/
+ _game.setRoom(903); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 39bd1652ee4..273781bcd2f 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -25,8 +25,7 @@
#include "m4/vars.h"
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
-#include "m4/burger/gui/game_menu.h"
-#include "m4/burger/gui/interface.h"
+#include "m4/burger/gui/gui.h"
#include "m4/burger/flags.h"
#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
@@ -79,12 +78,14 @@ protected:
public:
Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
+ GUI::GUI_Globals _gui;
GUI::Interface _interface;
GUI::MenuGlobals _menu;
SeriesPlayers _seriesPlayers;
ReleaseTrigger_Globals _releaseTrigger;
StreamBreak_Globals _streamBreak;
Burger::Walker _walker;
+
int _wilburTerm = 2;
const Common::String _wilbur = "WILBUR";
bool _menuSystemInitialized = false;
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index fc164b69cf5..39573f26171 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -86,7 +86,7 @@ bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
void series_set_frame_rate(machine *m, int32 newFrameRate);
extern machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
- int32 duration, int32 index, int32 s, int32 x, int32 y);
+ int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
extern machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
int32 firstFrame, int32 lastFrame);
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index dec663fc6fc..c486d25fb8e 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -35,6 +35,7 @@
#include "m4/platform/sound.h"
#include "m4/detection.h"
#include "m4/console.h"
+#include "m4/metaengine.h"
#include "m4/core/param.h"
namespace M4 {
@@ -147,5 +148,8 @@ bool M4Engine::autosaveExists() const {
return result;
}
+bool M4Engine::savesExist() const {
+ return getMetaEngine()->listSaves(_targetName.c_str()).empty();
+}
} // End of namespace M4
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 1be6aabf21d..6c19d2da2e8 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -119,6 +119,11 @@ public:
*/
bool autosaveExists() const;
+ /**
+ * Returns true if any saves exist
+ */
+ bool savesExist() const;
+
/**
* Show the engine information
*/
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index fd5a51270e4..ececb6553be 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -94,6 +94,7 @@ MODULE_OBJS = \
burger/flags.o \
burger/hotkeys.o \
burger/inventory.o \
+ burger/other.o \
burger/series_player.o \
burger/vars.o \
burger/walker.o
Commit: 1e507e49ac112b542ffe9655ab541128d303240e
https://github.com/scummvm/scummvm/commit/1e507e49ac112b542ffe9655ab541128d303240e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 902, skeletons for other remaining section 9 rooms
Changed paths:
A engines/m4/burger/gui/gui.h
A engines/m4/burger/other.cpp
A engines/m4/burger/other.h
A engines/m4/burger/rooms/section9/room902.cpp
A engines/m4/burger/rooms/section9/room902.h
A engines/m4/burger/rooms/section9/room904.cpp
A engines/m4/burger/rooms/section9/room904.h
A engines/m4/burger/rooms/section9/room971.cpp
A engines/m4/burger/rooms/section9/room971.h
engines/m4/burger/rooms/section9/section9.cpp
engines/m4/burger/rooms/section9/section9.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/gui/gui.h b/engines/m4/burger/gui/gui.h
new file mode 100644
index 00000000000..d1b5f936628
--- /dev/null
+++ b/engines/m4/burger/gui/gui.h
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_GUI_H
+#define M4_BURGER_GUI_H
+
+#include "m4/burger/gui/game_menu.h"
+#include "m4/burger/gui/interface.h"
+
+namespace M4 {
+namespace Burger {
+namespace GUI {
+
+struct GUI_Globals {
+ bool saveLoadFromHotkey = false;
+ bool gameMenuFromMain = false;
+};
+
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
new file mode 100644
index 00000000000..816938b5fe4
--- /dev/null
+++ b/engines/m4/burger/other.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/other.h"
+#include "m4/core/errors.h"
+#include "m4/burger/vars.h"
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Burger {
+
+static void other_fade_me_out(int32 trigger) {
+ pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 30, trigger);
+}
+
+void other_resurrect_player() {
+ KernelTriggerType old_mode;
+
+ if (!g_engine->autosaveExists())
+ error(FL, 'Burg', "Couldn't resume game");
+
+ _G(kernel).restore_slot = 0;
+ old_mode = _G(kernel).trigger_mode;
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ other_fade_me_out(255);
+
+ _G(kernel).trigger_mode = old_mode;
+ player_set_commands_allowed(false);
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/other.h b/engines/m4/burger/other.h
new file mode 100644
index 00000000000..bfb40e5133e
--- /dev/null
+++ b/engines/m4/burger/other.h
@@ -0,0 +1,34 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_GUI_OTHER_H
+#define M4_BURGER_GUI_OTHER_H
+
+namespace M4 {
+namespace Burger {
+
+extern void other_resurrect_player();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room902.cpp b/engines/m4/burger/rooms/section9/room902.cpp
new file mode 100644
index 00000000000..0cb92891596
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room902.cpp
@@ -0,0 +1,135 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room902.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+static const Entry ENTRIES1[] = {
+ { "902bk", 168 },
+ { "902bi", 168 },
+ { "902bj", 168 },
+ { "902bb", 168 },
+ { "902bs", 168 },
+ { "902bg", 168 },
+ { "902bc", 168 },
+ { "902bl", 168 },
+ { "902ba", 168 },
+ { "902bw", 168 },
+ { "902bq", 168 },
+ { "902bn", 168 },
+ { nullptr, 0 }
+};
+
+static const Entry ENTRIES2[] = {
+ { "902wa", 300 },
+ { nullptr, 0 }
+};
+
+void Room902::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room902::init() {
+ _vol = 255;
+ digi_preload("902music");
+ digi_play("902music", 1, _vol, -1);
+ mouse_hide();
+
+ if (_G(room902Flag) <= 0) {
+ _entries = ENTRIES1;
+ series_load("902ob", -1, _G(master_palette));
+ kernel_timing_trigger(1, 3);
+ } else if (_G(room902Flag) == 1) {
+ _entries = ENTRIES2;
+ }
+
+ _index = 0;
+ _name = _entries[_index]._name;
+ _duration = _entries[_index]._duration;
+
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), 0, 255, 100, 60, 1);
+}
+
+void Room902::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_set_start(_G(master_palette), 0);
+
+ if (_name) {
+ if (_index <= 0)
+ series_unload(_seriesIndex);
+
+ _seriesIndex = series_load(_name, -1, _G(master_palette));
+ series_show_(_name, 1, 64, 1, _duration + 60, 0, 100, 0, 0);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 30, 5);
+ kernel_timing_trigger(_duration + 30, 2);
+
+ ++_index;
+ _name = _entries[_index]._name;
+ _duration = _entries[_index]._duration;
+ }
+ break;
+
+ case 2:
+ if (_name) {
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, -1);
+ } else {
+ pal_fade_init(_G(master_palette), 0, 255, 0, 30, -1);
+ kernel_trigger_dispatch_now(4);
+ }
+ break;
+
+ case 3:
+ series_show_("902ob", 2, 64, -1, -1, 0, 100, 320, 430);
+ break;
+
+ case 4:
+ _vol -= 20;
+ if (_vol > 0) {
+ digi_change_volume(1, _vol);
+ kernel_timing_trigger(6, 4);
+ } else if (_G(executing) == WHOLE_GAME) {
+ _G(game).setRoom(903);
+ } else {
+ _G(game).setRoom(901);
+ }
+ break;
+
+ case 5:
+ if (_entries[_index]._name)
+ series_load(_entries[_index]._name, -1, nullptr);
+ break;
+
+ default:
+ break;
+ }
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room902.h b/engines/m4/burger/rooms/section9/room902.h
new file mode 100644
index 00000000000..ac77ea2eac6
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room902.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION9_ROOM902_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM902_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+struct Entry {
+ const char *_name;
+ int _duration;
+};
+
+class Room902 : public Rooms::Room {
+private:
+ int _vol = 255;
+ const Entry *_entries = nullptr;
+ int _index = 0;
+ const char *_name = nullptr;
+ int _duration = 0;
+ int _seriesIndex = -1;
+
+public:
+ Room902() : Rooms::Room(902) {}
+ ~Room902() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
new file mode 100644
index 00000000000..3503b0dade9
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room904.h"
+#include "m4/burger/vars.h"
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room904::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room904::init() {
+
+}
+
+void Room904::daemon() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room904.h b/engines/m4/burger/rooms/section9/room904.h
new file mode 100644
index 00000000000..3702727be41
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room904.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION9_ROOM904_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM904_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room904 : public Rooms::Room {
+public:
+ Room904() : Rooms::Room(904) {}
+ ~Room904() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/room971.cpp b/engines/m4/burger/rooms/section9/room971.cpp
new file mode 100644
index 00000000000..b0f4a573d59
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room971.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section9/room971.h"
+#include "m4/burger/vars.h"
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room971::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room971::init() {
+
+}
+
+void Room971::daemon() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section9/room971.h b/engines/m4/burger/rooms/section9/room971.h
new file mode 100644
index 00000000000..db35646e850
--- /dev/null
+++ b/engines/m4/burger/rooms/section9/room971.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION9_ROOM971_H
+#define M4_BURGER_ROOMS_SECTION9_ROOM971_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room971 : public Rooms::Room {
+public:
+ Room971() : Rooms::Room(971) {}
+ ~Room971() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
index 79edeecfaac..e814e4e2b40 100644
--- a/engines/m4/burger/rooms/section9/section9.cpp
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -28,8 +28,11 @@ namespace Rooms {
Section9::Section9() : Rooms::Section() {
add(&_room901);
+ add(&_room902);
add(&_room903);
+ add(&_room904);
add(&_room951);
+ add(&_room971);
}
void Section9::daemon() {
diff --git a/engines/m4/burger/rooms/section9/section9.h b/engines/m4/burger/rooms/section9/section9.h
index a4b6821bb2d..2fd4002a491 100644
--- a/engines/m4/burger/rooms/section9/section9.h
+++ b/engines/m4/burger/rooms/section9/section9.h
@@ -24,8 +24,11 @@
#include "m4/burger/rooms/section.h"
#include "m4/burger/rooms/section9/room901.h"
+#include "m4/burger/rooms/section9/room902.h"
#include "m4/burger/rooms/section9/room903.h"
+#include "m4/burger/rooms/section9/room904.h"
#include "m4/burger/rooms/section9/room951.h"
+#include "m4/burger/rooms/section9/room971.h"
namespace M4 {
namespace Burger {
@@ -34,8 +37,11 @@ namespace Rooms {
class Section9 : public Rooms::Section {
private:
Room901 _room901;
+ Room902 _room902;
Room903 _room903;
+ Room904 _room904;
Room951 _room951;
+ Room971 _room971;
public:
Section9();
virtual ~Section9() {}
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index c5cfd071595..67460ce6093 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -108,7 +108,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(903); /*****DEBUG*****/
+ _game.setRoom(902); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 273781bcd2f..2a0a229ca36 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -90,7 +90,7 @@ public:
const Common::String _wilbur = "WILBUR";
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
- bool _room902Flag = false;
+ int _room902Flag = 0;
public:
Vars();
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ececb6553be..b20bef1a6d4 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -88,8 +88,11 @@ MODULE_OBJS = \
burger/rooms/section9/section9.o \
burger/rooms/section9/menu_room.o \
burger/rooms/section9/room901.o \
+ burger/rooms/section9/room902.o \
burger/rooms/section9/room903.o \
+ burger/rooms/section9/room904.o \
burger/rooms/section9/room951.o \
+ burger/rooms/section9/room971.o \
burger/burger.o \
burger/flags.o \
burger/hotkeys.o \
Commit: e56a67eddecb71accdd523d3e4c7217421b65359
https://github.com/scummvm/scummvm/commit/e56a67eddecb71accdd523d3e4c7217421b65359
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 904 credits screen
Changed paths:
engines/m4/burger/rooms/section9/room904.cpp
engines/m4/burger/rooms/section9/room904.h
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
index 3503b0dade9..b9337946ecd 100644
--- a/engines/m4/burger/rooms/section9/room904.cpp
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -27,16 +27,292 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *const CREDITS[] = {
+ "Entwurf",
+ "Spielentwurf: Robert Aitken",
+ " ",
+ "Spieltext: Robert Aitken",
+ " ",
+ "Zus\xe4""tzliche Dialoge: Mark Solomon",
+ " ",
+ "Originalidee:",
+ " Robert Aitken",
+ " Matthew Powell",
+ "Graphik",
+ "K\xfc""nstlerische Leitung: Andrew Pratt",
+ " ",
+ "Entwurf der Charaktere:",
+ " Glen Lovett",
+ " Sean Newton",
+ " ",
+ "Hintergrund-Layout: Glen Lovett",
+ " ",
+ "Landschaftsgestaltung:",
+ " Bob Parr",
+ " Andrew Pratt",
+ " ",
+ "Graphische Technik: Garth Buzzard",
+ " ",
+ "Zus\xe4""tzliche Grafik:",
+ " Darren Brereton",
+ " Shelley Burke",
+ " Garth Buzzard",
+ " Karl Johanson",
+ " Calvin Jones",
+ " Dwight Lockhart",
+ " Bob Parr",
+ " Andrew Pratt",
+ " ",
+ "Benutzeroberfl\xe4""che, Grafikdetails: Andrew Pratt",
+ nullptr,
+ "Animationen",
+ "Animationsleitung: Sean Newton",
+ " ",
+ "Animationen:",
+ " Jim Bridle",
+ " Hilary Denny",
+ " Nelson Dewey",
+ " Richelle Grist",
+ " Glen Lovett",
+ " Kay Lovett",
+ " Tim Maltby",
+ " Stephen McCallum",
+ " Shelley McIntosh",
+ " Jean Paynter",
+ " Gary Scott",
+ " Nigel Tully",
+ " Adrie Van Viersen",
+ " ",
+ "Animationsdesign: Robert Aitken",
+ " ",
+ "3D-Modellierung, Animationen:",
+ " Nelson Dewey",
+ " David Henry",
+ " ",
+ "Animationstechnik: Robert McMurtry",
+ nullptr,
+ "Kolorierung",
+ "Kolorierung:",
+ " Allan Cameron",
+ " Scott Douglas",
+ " Cindy Johnson",
+ " ",
+ "Zus\xe4""tzliche Kolorierung:",
+ " Brent Arnst",
+ " Rob Barrett",
+ " Garth Buzzard",
+ " Chris Capell",
+ " Jacob Dewey",
+ " Bruce Elder",
+ " Andrew James",
+ " Darren Keetley",
+ " Cal Jones",
+ " Jeff Kuipers",
+ " Dwight Lockhart",
+ " Kimberlie Manuel",
+ " Connie McCann",
+ " Stephen Rowe",
+ " Peter Taylor",
+ nullptr,
+ "Audio",
+ "Originalmusik: Darren McGrath",
+ " ",
+ "Soundgestaltung: Darren McGrath",
+ " ",
+ "Audio-Produktion:",
+ " Darren McGrath",
+ " Ton Synchron",
+ " ",
+ "Casting:",
+ " Robert Aitken",
+ " Darren McGrath",
+ " Kris Zimmerman",
+ " ",
+ "Dialogschnitt:",
+ " Darren McGrath",
+ " Allan Cameron",
+ " Ton Synchron",
+ nullptr,
+ "Programmierung",
+ "Leitung Spielprogrammierung: Matthew Powell",
+ " ",
+ "Programmierung:",
+ " Robert McMurtry",
+ " Paul Lahaise",
+ " Chris Petkau",
+ " Jason Bevins",
+ " David Thomas",
+ " ",
+ "Leitung Systemprogrammierung: Nick Porcino",
+ " ",
+ "Systemprogrammierung:",
+ " Andras Kovacs",
+ " Michael Ellis",
+ " Xi Huang",
+ " Tinman",
+ " Paul Lahaise",
+ " Matthew Powell",
+ " Cody Jones",
+ " ",
+ "International: Mojo Systems",
+ " ",
+ "Konversation: Robert Aitken",
+ nullptr,
+ "Produktion"
+ "Produktionsleitung:"
+ " Fran\xe7""ois Robillard,",
+ " Eidos Deutschland",
+ " ",
+ "Produktionsassistenz: Danielle Cooper",
+ " ",
+ "Deutsche Produktion:",
+ " Alp Altun",
+ " Eva Hoogh",
+ " Anskje Kirschner",
+ " Christian Zoch",
+ " ",
+ "International:",
+ " Kimberlie Manuel, Mojo Systems",
+ " Katrin van der Leeden",
+ nullptr,
+ "Qualit\xe4""tssicherung",
+ "Michael Beninger",
+ "Kimberlie Manuel",
+ "Chris Capell",
+ "Bruce Elder",
+ "Darren Keetley",
+ " ",
+ "International: Mojo Systems",
+ nullptr,
+ "Handbuch",
+ "Handbuch: Hope Hickli",
+ " ",
+ "Grafik und Layout des Handbuchs:",
+ " Calvin Jones",
+ " Bob Parr",
+ nullptr,
+ "Die Charaktere",
+ "(in alphabetischer Reihenfolge)",
+ "Angus - Peter Bieringer",
+ "Astral - Susanne Sternberg",
+ "Bauarbeiter - Alp Altun",
+ "Bork - Dee Bradley Baker",
+ "Burl - Nico K\xf6""nig",
+ "Computer - Ulrike Herm",
+ "Elgus - Peter Bieringer",
+ "Erz\xe4""hler - Ingo Abel",
+ "Eugene - Franz-Josef Steffens",
+ "Fernsehstimmen - Ulrike Herm, Robert Missler",
+ " Olaf Ritter, Thomas Stein, Angela Stresemann",
+ "Flumix - Wolfgang J\xfc""rgen",
+ "Harry - Hans Sievers",
+ "Gus - Peter Bieringer",
+ "Odie - Dagmar 'The Kid'",
+ "Perkins - Michael Quiatkowski",
+ "Roxy - Susanne Sternberg",
+ "Sheriff - Hans Sievers",
+ "Stolie - Hans Sievers",
+ "Tante Polly - Verena Wiet",
+ "Unseren Dank an Lynda Gran f\xfc""r unsere Gehaltsschecks,",
+ "Vera - Angela Stresemann",
+ "Vipe - Alexander Draeger",
+ "VP - Franz-Josef Steffens",
+ "Wilbur - Robert Missler",
+ "Zlarg - Wolfgang Draeger",
+ nullptr,
+ "Vielen Dank",
+ "Unseren Dank an Lynda Gran f\xfc""r unsere Gehaltsschecks,",
+ "an Laura McCallum f\xfc""r ihr Organisationsgenie",
+ "und an Carol Schieck f\xfc""r ihr immer geduldiges L\xe4""cheln.",
+ " ",
+ "Vielen Dank an Vancouver Island Brewing. Jungs,",
+ "ihr habt uns Wochenende um Wochenende gerettet!",
+ " ",
+ "Besonderen Dank an bedeutsame andere ",
+ "samt Nachwuchs, die so oft auf ihre Lieben ",
+ "verzichten mu\xdf""ten, damit dieses Spiel ",
+ "entstehen konnte.",
+ " ",
+ "Ganz besonderen Dank an Anskje Kirschner!",
+ nullptr,
+ " "
+ " ",
+ nullptr,
+ "Hauptmen\xfc",
+ " ",
+ nullptr,
+ nullptr
+};
+
void Room904::preload() {
_G(player).walker_in_this_scene = false;
}
void Room904::init() {
+ digi_preload("902music");
+ digi_preload("904pop1");
+ digi_preload("904pop2");
+ digi_preload("904pop3");
+ digi_preload("904pop4");
+ digi_preload("904pop5");
+
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), 0, 255, 100, 60, 1);
+ player_set_commands_allowed(false);
+}
+
+void Room904::shutdown() {
+ if (_screen1)
+ TextScrn_Destroy(_screen1);
+ if (_screen2)
+ TextScrn_Destroy(_screen2);
+ _G(player).command_ready = true;
}
void Room904::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ player_set_commands_allowed(true);
+ creditsSetup();
+ break;
+
+ case 2:
+ // TODO
+
+ default:
+ break;
+ }
+}
+
+void Room904::creditsSetup() {
+ _numSections = getCreditsSectionsCount();
+
+ gr_font_set(_G(font_inter));
+ _fontHeight = gr_font_get_height();
+
+ // TODO
+}
+
+size_t Room904::getCreditsSectionsCount() const {
+ size_t numSections = 0;
+
+ for (auto line = CREDITS; *line; ++line) {
+ while (*line)
+ ++line;
+ ++numSections;
+ }
+
+ return numSections;
+}
+
+size_t Room904::getMaxCreditsWidth() const {
+ for (int sectionNum = 1; sectionNum <= _numSections; ++sectionNum) {
+ // TODO
+ }
+ return 0;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room904.h b/engines/m4/burger/rooms/section9/room904.h
index 3702727be41..79c80060538 100644
--- a/engines/m4/burger/rooms/section9/room904.h
+++ b/engines/m4/burger/rooms/section9/room904.h
@@ -23,18 +23,42 @@
#define M4_BURGER_ROOMS_SECTION9_ROOM904_H
#include "m4/burger/rooms/room.h"
+#include "m4/gui/gui_dialog.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room904 : public Rooms::Room {
+private:
+ TextScrn *_screen1 = nullptr;
+ TextScrn *_screen2 = nullptr;
+ int _numSections = 0;
+ int _fontHeight = 0;
+ int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
+
+ /**
+ * Initial credits setup
+ */
+ void creditsSetup();
+
+ /**
+ * Returns the number of sections in the credits array
+ */
+ size_t getCreditsSectionsCount() const;
+
+ /**
+ * Returns the maximum width of any credits line
+ */
+ size_t getMaxCreditsWidth() const;
+
public:
Room904() : Rooms::Room(904) {}
~Room904() override {}
void preload() override;
void init() override;
+ void shutdown() override;
void daemon() override;
};
Commit: a0487d1ca0ae0297dca106cc703ae11fc3d2ba16
https://github.com/scummvm/scummvm/commit/a0487d1ca0ae0297dca106cc703ae11fc3d2ba16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Furhter implementing room 904
Changed paths:
engines/m4/burger/rooms/section9/room904.cpp
engines/m4/burger/rooms/section9/room904.h
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_font.h
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_dialog.h
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
index b9337946ecd..67e8a02b14b 100644
--- a/engines/m4/burger/rooms/section9/room904.cpp
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section9/room904.h"
+#include "m4/core/errors.h"
#include "m4/burger/vars.h"
#include "m4/m4.h"
@@ -291,11 +292,26 @@ void Room904::creditsSetup() {
gr_font_set(_G(font_inter));
_fontHeight = gr_font_get_height();
+ _totalWidth = getMaxCreditsWidth() + 20;
+ _totalHeight = _fontHeight * _numSections + 20;
- // TODO
+ _x1 = 30;
+ _x2 = 30 + _totalWidth;
+ _y1 = (480 - _totalHeight) / 2;
+ _y2 = _y1 + _totalHeight;
+
+ _screen1 = TextScrn_Create(_x1, _y1, _x2, _y2, 100, 422, 3, 22, 1, 10, 2, 14);
+
+ for (_currentSection = 1; _currentSection <= _numSections; ++_currentSection) {
+ TextScrn_Add_TextItem(_screen1, 10, _currentSection * _fontHeight + 10,
+ _currentSection, TS_CENTRE, getCreditsSectionString(_currentSection),
+ (M4CALLBACK)creditsCallback);
+ }
+
+ TextScrn_Activate(_screen1);
}
-size_t Room904::getCreditsSectionsCount() const {
+size_t Room904::getCreditsSectionsCount() {
size_t numSections = 0;
for (auto line = CREDITS; *line; ++line) {
@@ -307,12 +323,109 @@ size_t Room904::getCreditsSectionsCount() const {
return numSections;
}
-size_t Room904::getMaxCreditsWidth() const {
+int Room904::getCreditsSectionLine(int sectionNum) {
+ if (sectionNum >= 1 && sectionNum <= 8)
+ error_show(FL, 'Burg', "Bad index to credits");
+
+ int lineNum;
+ for (lineNum = 0; sectionNum > 0; --sectionNum, ++lineNum) {
+ while (CREDITS[lineNum])
+ ++lineNum;
+ }
+
+ return lineNum;
+}
+
+const char *Room904::getCreditsSectionString(int sectionNum) {
+ return CREDITS[getCreditsSectionLine(sectionNum)];
+}
+
+int Room904::getCreditsSectionLines(int sectionNum) {
+ int sectionStart = getCreditsSectionLine(sectionNum);
+ int lineNum = sectionStart;
+
+ while (*CREDITS[lineNum])
+ ++lineNum;
+
+ return lineNum - sectionStart;
+}
+
+size_t Room904::getMaxCreditsWidth() {
+ int32 maxWidth = 0;
+
for (int sectionNum = 1; sectionNum <= _numSections; ++sectionNum) {
- // TODO
+ maxWidth = MAX(maxWidth, gr_font_string_width(getCreditsSectionString(sectionNum)));
+ }
+
+ return maxWidth;
+}
+
+size_t Room904::getCreditsSectionWidth(int sectionNum) {
+ int32 maxWidth = 0;
+
+ for (int lineNum = getCreditsSectionLine(sectionNum); CREDITS[lineNum]; ++lineNum) {
+ maxWidth = MAX(maxWidth, gr_font_string_width(CREDITS[lineNum]));
+ }
+
+ return maxWidth;
+}
+
+const char *Room904::getLineInCreditsSection(int sectionNum, int lineNum) {
+ if (lineNum < 1 || lineNum > getCreditsSectionLines(sectionNum))
+ error_show(FL, 'Burg', "Bad index to names");
+
+ return CREDITS[getCreditsSectionLine(sectionNum) + lineNum];
+}
+
+void Room904::creditsCallback(TextItem *textItem, TextScrn *textScrn) {
+ Room904 *room = dynamic_cast<Room904 *>(g_engine->_activeRoom);
+ assert(room);
+ room->updateCredits(textItem, textScrn);
+}
+
+void Room904::updateCredits(TextItem *textItem, TextScrn *textScrn) {
+ const char *credit = textItem->prompt;
+ int sectionNum = textItem->tag;
+ int linesCount = getCreditsSectionLines(sectionNum);
+ term_message("credit: %s index: %d names: %d", credit, sectionNum, linesCount);
+
+ playRandomSound(-1, 2);
+
+ if (strncmp(credit, "Haupt", 5)) {
+ mouse_set_sprite(kArrowCursor);
+ gr_font_set(_G(font_conv));
+ _fontHeight = gr_font_get_height();
+
+ int sectionWidth = getCreditsSectionWidth(sectionNum) + 20;
+ int sectionHeight = linesCount * _fontHeight + 20;
+
+ int x1 = (_x2 - sectionWidth) / 2;
+ int y1 = (480 - sectionHeight) / 2;
+ int x2 = x1 + sectionWidth;
+ int y2 = y1 + sectionHeight;
+
+ if (_screen2)
+ TextScrn_Destroy(_screen2);
+ _screen2 = TextScrn_Create(x1, y1, x2, y2, 100, 422, 3, 22, 1, 10, 2, 14);
+
+ for (int lineNum = 1; lineNum <= linesCount; ++lineNum) {
+ const char *line = getLineInCreditsSection(sectionNum, lineNum);
+ TextScrn_Add_Message(_screen2, 10, (lineNum - 1) * _fontHeight + 10,
+ lineNum, TS_GIVEN, line);
+ }
+
+ TextScrn_Activate(_screen2);
+ TextScrn_Activate(_screen1);
+
+ } else {
+ kernel_trigger_dispatch_now(5);
}
+}
- return 0;
+void Room904::playRandomSound(int trigger, int channel) {
+ Common::String name = Common::String::format("904pop%d",
+ g_engine->getRandomNumber(4) + 1);
+ digi_play(name.c_str(), channel, 255, trigger);
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room904.h b/engines/m4/burger/rooms/section9/room904.h
index 79c80060538..bf46aaa53fc 100644
--- a/engines/m4/burger/rooms/section9/room904.h
+++ b/engines/m4/burger/rooms/section9/room904.h
@@ -35,7 +35,10 @@ private:
TextScrn *_screen2 = nullptr;
int _numSections = 0;
int _fontHeight = 0;
+ int _totalWidth = 0;
+ int _totalHeight = 0;
int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
+ int _currentSection = -1;
/**
* Initial credits setup
@@ -45,12 +48,52 @@ private:
/**
* Returns the number of sections in the credits array
*/
- size_t getCreditsSectionsCount() const;
+ static size_t getCreditsSectionsCount();
/**
* Returns the maximum width of any credits line
*/
- size_t getMaxCreditsWidth() const;
+ size_t getMaxCreditsWidth();
+
+ /**
+ * Text items callback
+ */
+ void updateCredits(TextItem *textItem, TextScrn *textScrn);
+
+ /**
+ * Return the starting index in the credits of a given section
+ */
+ static int getCreditsSectionLine(int sectionNum);
+
+ /**
+ * Return the first string of a given section
+ */
+ static const char *getCreditsSectionString(int sectionNum);
+
+ /**
+ * Returns the number of lines in a given section
+ */
+ static int getCreditsSectionLines(int sectionNum);
+
+ /**
+ * Return the maximum width of a specific credits section
+ */
+ static size_t getCreditsSectionWidth(int sectionNum);
+
+ /**
+ * Returns a given text line within a credits section
+ */
+ static const char *getLineInCreditsSection(int sectionNum, int lineNum);
+
+ /**
+ * Text items callback
+ */
+ static void creditsCallback(TextItem *textItem, TextScrn *textScrn);
+
+ /**
+ * Plays a random sound
+ */
+ static void playRandomSound(int trigger, int channel);
public:
Room904() : Rooms::Room(904) {}
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index 1259d609980..2de237ce4ba 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -236,6 +236,16 @@ int32 gr_font_string_width(char *out_string, int32 auto_spacing) {
return width;
}
+int32 gr_font_string_width(const Common::String &str, int32 auto_spacing) {
+ char *tmp = new char[str.size() + 1];
+ Common::copy(str.c_str(), str.c_str() + str.size() + 1, tmp);
+ int32 result = gr_font_string_width(tmp, auto_spacing);
+ delete[] tmp;
+
+ return result;
+}
+
+
int32 gr_font_get_height() {
if (!_G(font))
return -1;
diff --git a/engines/m4/graphics/gr_font.h b/engines/m4/graphics/gr_font.h
index 3aa74b57181..149266e30fe 100644
--- a/engines/m4/graphics/gr_font.h
+++ b/engines/m4/graphics/gr_font.h
@@ -22,6 +22,7 @@
#ifndef M4_GRAPHICS_GR_FONT_H
#define M4_GRAPHICS_GR_FONT_H
+#include "common/str.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -46,6 +47,8 @@ int32 gr_font_get_height();
int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y,
int32 w, int32 auto_spacing = 1);
int32 gr_font_string_width(char *out_string, int32 auto_spacing = 1);
+int32 gr_font_string_width(const Common::String &str, int32 auto_spacing = 1);
+
//Font *gr_font_file_read(const char *fontName);
Font *gr_font_load(const char *fontName);
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 40cfda90a8b..2056c683899 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -1199,7 +1199,7 @@ bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb) {
}
bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
- int32 justification, char *prompt, M4CALLBACK callback) {
+ int32 justification, const char *prompt, M4CALLBACK callback) {
TextItem *myTextItem;
if (!myTextScrn) {
@@ -1236,7 +1236,7 @@ bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
}
bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
- int32 justification, char *prompt) {
+ int32 justification, const char *prompt) {
TextItem *myTextItem;
if (!myTextScrn) {
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index 024fc554351..bec5acdfb29 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -147,9 +147,9 @@ void TextScrn_Destroy(TextScrn *myTextScrn);
void TextScrn_Activate(TextScrn *myTextScrn);
bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb);
bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
- int32 justification, char *prompt, M4CALLBACK callback);
+ int32 justification, const char *prompt, M4CALLBACK callback);
bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
- int32 justification, char *prompt);
+ int32 justification, const char *prompt);
void TextScrn_Change_TextItem(TextScrn *myTextScrn, int32 tag, char *prompt, uint8 color);
void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag);
Commit: 2bd43580a5ed3f3ced9faecf06cfa36926fc751a
https://github.com/scummvm/scummvm/commit/2bd43580a5ed3f3ced9faecf06cfa36926fc751a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 904
Changed paths:
engines/m4/burger/rooms/section9/room904.cpp
engines/m4/burger/rooms/section9/room904.h
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
index 67e8a02b14b..1a745727aff 100644
--- a/engines/m4/burger/rooms/section9/room904.cpp
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -39,6 +39,7 @@ static const char *const CREDITS[] = {
"Originalidee:",
" Robert Aitken",
" Matthew Powell",
+ nullptr,
"Graphik",
"K\xfc""nstlerische Leitung: Andrew Pratt",
" ",
@@ -159,8 +160,8 @@ static const char *const CREDITS[] = {
" ",
"Konversation: Robert Aitken",
nullptr,
- "Produktion"
- "Produktionsleitung:"
+ "Produktion",
+ "Produktionsleitung:",
" Fran\xe7""ois Robillard,",
" Eidos Deutschland",
" ",
@@ -280,19 +281,48 @@ void Room904::daemon() {
break;
case 2:
- // TODO
+ if (_currentSection < _numSections) {
+ playRandomSound(2, 1);
+ TextScrn_Add_TextItem(_screen1, 10, (_currentSection - 1) * _fontHeight + 10,
+ _currentSection, TS_CENTRE, getCreditsSectionString(_currentSection),
+ (M4CALLBACK)creditsCallback);
+ TextScrn_Activate(_screen1);
+ }
+ break;
+
+ case 3:
+ playRandomSound(-1, 2);
+ break;
+
+ case 4:
+ digi_play_loop("902music", 3, 155, -1);
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), 0, 255, 0, 30, 6);
+ break;
+
+ case 6:
+ _G(game).setRoom(_G(executing) == WHOLE_GAME ? 903 : 901);
+ break;
default:
break;
}
}
+void Room904::parser() {
+ if (player_said("go back"))
+ kernel_trigger_dispatch_now(5);
+}
+
void Room904::creditsSetup() {
_numSections = getCreditsSectionsCount();
gr_font_set(_G(font_inter));
_fontHeight = gr_font_get_height();
- _totalWidth = getMaxCreditsWidth() + 20;
+ _totalWidth = getMaxCreditsHeaderWidth() + 20;
_totalHeight = _fontHeight * _numSections + 20;
_x1 = 30;
@@ -311,7 +341,7 @@ void Room904::creditsSetup() {
TextScrn_Activate(_screen1);
}
-size_t Room904::getCreditsSectionsCount() {
+size_t Room904::getCreditsSectionsCount() const {
size_t numSections = 0;
for (auto line = CREDITS; *line; ++line) {
@@ -323,12 +353,12 @@ size_t Room904::getCreditsSectionsCount() {
return numSections;
}
-int Room904::getCreditsSectionLine(int sectionNum) {
- if (sectionNum >= 1 && sectionNum <= 8)
+int Room904::getCreditsSectionLine(int sectionNum) const {
+ if (sectionNum < 1 || sectionNum > _numSections)
error_show(FL, 'Burg', "Bad index to credits");
int lineNum;
- for (lineNum = 0; sectionNum > 0; --sectionNum, ++lineNum) {
+ for (lineNum = 0; sectionNum > 1; --sectionNum, ++lineNum) {
while (CREDITS[lineNum])
++lineNum;
}
@@ -336,11 +366,11 @@ int Room904::getCreditsSectionLine(int sectionNum) {
return lineNum;
}
-const char *Room904::getCreditsSectionString(int sectionNum) {
+const char *Room904::getCreditsSectionString(int sectionNum) const {
return CREDITS[getCreditsSectionLine(sectionNum)];
}
-int Room904::getCreditsSectionLines(int sectionNum) {
+int Room904::getCreditsSectionLines(int sectionNum) const {
int sectionStart = getCreditsSectionLine(sectionNum);
int lineNum = sectionStart;
@@ -350,17 +380,21 @@ int Room904::getCreditsSectionLines(int sectionNum) {
return lineNum - sectionStart;
}
-size_t Room904::getMaxCreditsWidth() {
+size_t Room904::getMaxCreditsHeaderWidth() const {
int32 maxWidth = 0;
for (int sectionNum = 1; sectionNum <= _numSections; ++sectionNum) {
+ const char *tmp = getCreditsSectionString(sectionNum);
+ int w = gr_font_string_width(tmp);
+ debug("%d", w);
+
maxWidth = MAX(maxWidth, gr_font_string_width(getCreditsSectionString(sectionNum)));
}
return maxWidth;
}
-size_t Room904::getCreditsSectionWidth(int sectionNum) {
+size_t Room904::getCreditsSectionWidth(int sectionNum) const {
int32 maxWidth = 0;
for (int lineNum = getCreditsSectionLine(sectionNum); CREDITS[lineNum]; ++lineNum) {
@@ -370,7 +404,7 @@ size_t Room904::getCreditsSectionWidth(int sectionNum) {
return maxWidth;
}
-const char *Room904::getLineInCreditsSection(int sectionNum, int lineNum) {
+const char *Room904::getLineInCreditsSection(int sectionNum, int lineNum) const {
if (lineNum < 1 || lineNum > getCreditsSectionLines(sectionNum))
error_show(FL, 'Burg', "Bad index to names");
diff --git a/engines/m4/burger/rooms/section9/room904.h b/engines/m4/burger/rooms/section9/room904.h
index bf46aaa53fc..073cf95263c 100644
--- a/engines/m4/burger/rooms/section9/room904.h
+++ b/engines/m4/burger/rooms/section9/room904.h
@@ -48,12 +48,12 @@ private:
/**
* Returns the number of sections in the credits array
*/
- static size_t getCreditsSectionsCount();
+ size_t getCreditsSectionsCount() const;
/**
- * Returns the maximum width of any credits line
+ * Returns the maximum width of any credits section header
*/
- size_t getMaxCreditsWidth();
+ size_t getMaxCreditsHeaderWidth() const;
/**
* Text items callback
@@ -63,27 +63,27 @@ private:
/**
* Return the starting index in the credits of a given section
*/
- static int getCreditsSectionLine(int sectionNum);
+ int getCreditsSectionLine(int sectionNum) const;
/**
* Return the first string of a given section
*/
- static const char *getCreditsSectionString(int sectionNum);
+ const char *getCreditsSectionString(int sectionNum) const;
/**
* Returns the number of lines in a given section
*/
- static int getCreditsSectionLines(int sectionNum);
+ int getCreditsSectionLines(int sectionNum) const;
/**
* Return the maximum width of a specific credits section
*/
- static size_t getCreditsSectionWidth(int sectionNum);
+ size_t getCreditsSectionWidth(int sectionNum) const;
/**
* Returns a given text line within a credits section
*/
- static const char *getLineInCreditsSection(int sectionNum, int lineNum);
+ const char *getLineInCreditsSection(int sectionNum, int lineNum) const;
/**
* Text items callback
@@ -103,6 +103,7 @@ public:
void init() override;
void shutdown() override;
void daemon() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 67460ce6093..7afc5fce72b 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -108,7 +108,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(902); /*****DEBUG*****/
+ _game.setRoom(904); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
Commit: c8eb5f90770d02c07aa3edc8546f888353683107
https://github.com/scummvm/scummvm/commit/c8eb5f90770d02c07aa3edc8546f888353683107
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix rendering room 904 credits sections
Changed paths:
engines/m4/burger/rooms/section9/room904.cpp
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
index 1a745727aff..0a0fb15cdbb 100644
--- a/engines/m4/burger/rooms/section9/room904.cpp
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -333,7 +333,7 @@ void Room904::creditsSetup() {
_screen1 = TextScrn_Create(_x1, _y1, _x2, _y2, 100, 422, 3, 22, 1, 10, 2, 14);
for (_currentSection = 1; _currentSection <= _numSections; ++_currentSection) {
- TextScrn_Add_TextItem(_screen1, 10, _currentSection * _fontHeight + 10,
+ TextScrn_Add_TextItem(_screen1, 10, (_currentSection - 1) * _fontHeight + 10,
_currentSection, TS_CENTRE, getCreditsSectionString(_currentSection),
(M4CALLBACK)creditsCallback);
}
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 7afc5fce72b..659dfba800c 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -90,6 +90,7 @@ void Vars::main_cold_data_init() {
initMouseSeries("cursor", nullptr);
_kernel.first_fade = 32;
+ _G(custom_ascii_converter) = custom_ascii_converter_proc;
debugC(1, kDebugCore, "executing - %s", GAME_MODES[_executing]);
// Set up game mode and starting room
@@ -175,9 +176,9 @@ void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
void Vars::custom_ascii_converter_proc(char *string) {
char *str;
- for (const auto &entry : ASCII_CONVERTERS) {
- while ((str = strstr(string, entry._find)) != nullptr)
- *str = entry._replace;
+ for (const auto *entry = ASCII_CONVERTERS; entry->_find; entry++) {
+ while ((str = strstr(string, entry->_find)) != nullptr)
+ *str = entry->_replace;
}
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 2a0a229ca36..309f24e0a88 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -67,7 +67,7 @@ enum global_triggers {
class Vars : public M4::Vars {
private:
void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
- void custom_ascii_converter_proc(char *string);
+ static void custom_ascii_converter_proc(char *string);
static void escape_key_pressed(void *, void *);
static void cb_F2(void *, void *);
static void cb_F3(void *, void *);
Commit: 514d49c9aecbbd64ae4ddcb671fe2526550d1efa
https://github.com/scummvm/scummvm/commit/514d49c9aecbbd64ae4ddcb671fe2526550d1efa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix rendering credits section contents
Changed paths:
engines/m4/burger/rooms/section9/room904.cpp
diff --git a/engines/m4/burger/rooms/section9/room904.cpp b/engines/m4/burger/rooms/section9/room904.cpp
index 0a0fb15cdbb..23e640be436 100644
--- a/engines/m4/burger/rooms/section9/room904.cpp
+++ b/engines/m4/burger/rooms/section9/room904.cpp
@@ -204,7 +204,7 @@ static const char *const CREDITS[] = {
"Elgus - Peter Bieringer",
"Erz\xe4""hler - Ingo Abel",
"Eugene - Franz-Josef Steffens",
- "Fernsehstimmen - Ulrike Herm, Robert Missler",
+ "Fernsehstimmen - Ulrike Herm, Robert Missler,",
" Olaf Ritter, Thomas Stein, Angela Stresemann",
"Flumix - Wolfgang J\xfc""rgen",
"Harry - Hans Sievers",
@@ -215,7 +215,6 @@ static const char *const CREDITS[] = {
"Sheriff - Hans Sievers",
"Stolie - Hans Sievers",
"Tante Polly - Verena Wiet",
- "Unseren Dank an Lynda Gran f\xfc""r unsere Gehaltsschecks,",
"Vera - Angela Stresemann",
"Vipe - Alexander Draeger",
"VP - Franz-Josef Steffens",
@@ -374,7 +373,7 @@ int Room904::getCreditsSectionLines(int sectionNum) const {
int sectionStart = getCreditsSectionLine(sectionNum);
int lineNum = sectionStart;
- while (*CREDITS[lineNum])
+ while (CREDITS[lineNum])
++lineNum;
return lineNum - sectionStart;
@@ -433,7 +432,7 @@ void Room904::updateCredits(TextItem *textItem, TextScrn *textScrn) {
int sectionWidth = getCreditsSectionWidth(sectionNum) + 20;
int sectionHeight = linesCount * _fontHeight + 20;
- int x1 = (_x2 - sectionWidth) / 2;
+ int x1 = (640 - _x2 - sectionWidth) / 2 + _x2;
int y1 = (480 - sectionHeight) / 2;
int x2 = x1 + sectionWidth;
int y2 = y1 + sectionHeight;
Commit: b326aa72aedba926aaf92a81534c19203f42910e
https://github.com/scummvm/scummvm/commit/b326aa72aedba926aaf92a81534c19203f42910e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix menu initialized flag check in room 903
Changed paths:
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index f5947c834c2..7f00e4fa630 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -66,7 +66,7 @@ void Room903::init() {
}
void Room903::daemon() {
- if (!_G(menu).menuSystemInitialized)
+ if (_G(menu).menuSystemInitialized)
return;
switch (_G(kernel).trigger) {
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 659dfba800c..ee2cc750d6b 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -109,7 +109,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(904); /*****DEBUG*****/
+ _game.setRoom(903); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
Commit: 795bb4fb18397ad7c190fb8456a4e1939888d98c
https://github.com/scummvm/scummvm/commit/795bb4fb18397ad7c190fb8456a4e1939888d98c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Experimental combined sprite drawing code
This is intended to combine clipping, forward/reverse drawing,
depth drawing, etc. into a single method rather than all the
different assembly optimized variations the original had
Changed paths:
A engines/m4/graphics/gr_surface.cpp
A engines/m4/graphics/gr_surface.h
engines/m4/graphics/gr_sprite.cpp
engines/m4/graphics/gr_sprite.h
engines/m4/m4_types.h
engines/m4/module.mk
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index d7c7778feab..9240560304a 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -20,19 +20,15 @@
*/
#include "m4/graphics/gr_sprite.h"
+#include "m4/graphics/gr_surface.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/core/term.h"
#include "m4/mem/memman.h"
#include "m4/platform/draw.h"
-//include "m4/vars.h"
namespace M4 {
-#define NO_COMPRESS 0x00
-#define RLE8 0x01
-#define SHADOW 0x80
-
/**
* ScaleX and ScaleY are supposed to be percents, where 100 means 100%
* S and D are Raw encoded (unencoded!) buffers.
@@ -95,10 +91,12 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
uint8 gr_sprite_draw(DrawRequest *drawReq) {
Buffer source;
+#if 0
int32 leftOffset = 0, rightOffset = 0, YPos;
+ uint8 bottomCut = 0;
+#endif
uint8 *shadowBuff = nullptr, *scaledBuff = nullptr;
Buffer afterScaled = { 0, 0, nullptr, 0, 0 };
- uint8 bottomCut = 0;
if (!drawReq->Src) {
term_message("nullptr source data in sprite_draw");
@@ -117,7 +115,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// if it's RLE encoded, ensure the sprite will decode to match the expected size
if (source.encoding & RLE8) {
- if (RLE8Decode_Size(source.data, source.stride) != (source.stride * source.h))
+ if (RLE8Decode_Size(source.data, source.stride) != (size_t)(source.stride * source.h))
error_show(FL, 'RLE8', "RLE8 sprite suspected BAD!");
}
@@ -162,6 +160,13 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source = afterScaled;
}
+ assert((drawReq->Src->encoding & SHADOW) == 0);
+
+ M4Surface dst(*drawReq->Dest);
+ dst.draw(source, drawReq->x, drawReq->y, drawReq->scaleX > 0,
+ drawReq->srcDepth ? drawReq->depthCode : nullptr, drawReq->srcDepth);
+
+#if 0
YPos = drawReq->y;
// Check for clipping
@@ -279,6 +284,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
}
truly_done:
+#endif
+
if (shadowBuff)
mem_free(shadowBuff);
diff --git a/engines/m4/graphics/gr_sprite.h b/engines/m4/graphics/gr_sprite.h
index b34145d7e86..6d72dc2693a 100644
--- a/engines/m4/graphics/gr_sprite.h
+++ b/engines/m4/graphics/gr_sprite.h
@@ -27,6 +27,12 @@
namespace M4 {
+enum {
+ NO_COMPRESS = 0x00,
+ RLE8 = 0x01,
+ SHADOW = 0x80
+};
+
struct DrawRequest {
Buffer *Src = nullptr; // sprite source buffer
Buffer *Dest = nullptr; // destination buffer
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
new file mode 100644
index 00000000000..0744a942ca3
--- /dev/null
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -0,0 +1,160 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/algorithm.h"
+#include "m4/graphics/gr_surface.h"
+#include "m4/graphics/gr_sprite.h"
+
+namespace M4 {
+
+M4Surface::M4Surface(int w, int h) : Buffer() {
+ this->w = w;
+ this->h = h;
+ this->stride = w;
+ this->encoding = NO_COMPRESS;
+ this->data = new byte[w * h];
+ Common::fill(this->data, this->data + w * h, 0);
+ _disposeAfterUse = DisposeAfterUse::YES;
+}
+
+M4Surface::M4Surface(const byte *src, int w, int h) {
+ this->w = w;
+ this->h = h;
+ this->stride = w;
+ this->encoding = NO_COMPRESS;
+ this->data = new byte[w * h];
+ Common::fill(this->data, this->data + w * h, 0);
+ _disposeAfterUse = DisposeAfterUse::YES;
+
+ rleDraw(src);
+}
+
+M4Surface::~M4Surface() {
+ if (_disposeAfterUse == DisposeAfterUse::YES)
+ delete[] data;
+}
+
+void M4Surface::rleDraw(const byte *src, int x, int y) {
+ const byte *srcP = src;
+ byte *destData = data + y * w + x;
+ byte *destP = destData;
+ int destWidth = w;
+ byte count, val;
+ int line = 0;
+
+ assert(x >= 0 && y >= 0 && x < w && y < h);
+
+ for (;;) {
+ count = *srcP++;
+
+ if (count) {
+ // Basic run length
+ val = *srcP++;
+
+ // 0 pixels are transparent, and are skipped. Otherwise, draw pixels
+ if (val != 0)
+ Common::fill(destP, destP + count, val);
+ destP += count;
+
+ } else {
+ count = *srcP++;
+
+ if (count >= 3) {
+ // Block of uncompressed pixels to copy
+ for (; count > 0; --count, ++destP) {
+ val = *srcP++;
+ if (val != 0)
+ *destP = val;
+ }
+
+ } else if (!(count & 3)) {
+ // End of line code
+ ++line;
+ destP = destData + line * destWidth;
+
+ } else {
+ // Stop drawing image. Seems weird that it doesn't handle the X/Y offset
+ // form for count & 2, but the original explicitly doesn't implement it
+ break;
+ }
+ }
+ }
+
+ assert(destP <= (data + h * stride));
+}
+
+void M4Surface::draw(const Buffer &src, int x, int y, bool forwards,
+ const byte *depthCodes, int srcDepth) {
+ if (src.encoding == RLE8) {
+ // The standard case of RLE sprite drawing onto screen can directly
+ // use RLE decompression for performance
+ if (forwards && !depthCodes && !depthCodes && x >= 0 && y >= 0 &&
+ (x + src.w) <= this->w && (y + src.h) <= this->h) {
+ rleDraw(src.data, x, y);
+
+ } else {
+ // All other RLE drawing first decompresses the sprite, and then does
+ // the various clipping, reverse, etc. on that
+ M4Surface tmp(src.data, src.w, src.h);
+ drawInner(tmp, depthCodes, x, y, forwards, srcDepth);
+ }
+ } else {
+ // Uncompressed images get passed to inner drawing
+ drawInner(src, depthCodes, x, y, forwards, srcDepth);
+ }
+}
+
+void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
+ int x, int y, bool forwards, int srcDepth) {
+ assert(src.encoding == NO_COMPRESS);
+
+ for (int srcY = 0; srcY < src.h; ++srcY, ++y) {
+ if (y >= h)
+ // Below bottom of screen
+ break;
+ else if (y < 0)
+ // Above top of screen
+ continue;
+
+ const byte *srcP = forwards ? src.getBasePtr(0, srcY) : getBasePtr(src.w - 1, srcY);
+ byte *destP = getBasePtr(x, y);
+ const byte *depthP = depthCodes ? depthCodes + y * w + x : nullptr;
+ int deltaX = forwards ? 1 : -1;
+ int destX = x;
+
+ for (int srcX = 0; srcX < src.w; ++srcX, srcP += deltaX, ++destX) {
+ if (destX >= w)
+ // Beyond right of screen
+ break;
+
+ byte v = *srcP;
+ if (destX >= 0 && v != 0 && (!depthP || *depthP == 0 || srcDepth == *depthP)) {
+ *destP = v;
+ }
+
+ ++destP;
+ if (depthP)
+ ++depthP;
+ }
+ }
+}
+
+} // namespace M4
diff --git a/engines/m4/graphics/gr_surface.h b/engines/m4/graphics/gr_surface.h
new file mode 100644
index 00000000000..8e86907e0f5
--- /dev/null
+++ b/engines/m4/graphics/gr_surface.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_GRAPHICS_GR_SURFACE_H
+#define M4_GRAPHICS_GR_SURFACE_H
+
+#include "common/types.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+class M4Surface : public Buffer {
+private:
+ DisposeAfterUse::Flag _disposeAfterUse = DisposeAfterUse::NO;
+
+ void drawInner(const Buffer &src, const byte *depthCodes, int x, int y,
+ bool forwards, int srcDepth);
+
+public:
+ M4Surface() : Buffer() {}
+ M4Surface(const Buffer &src) : Buffer(src) {}
+ M4Surface(int w, int h);
+ M4Surface(const byte *src, int w, int h);
+
+ ~M4Surface();
+
+ /**
+ * Simple drawing at a given position given source RLE data.
+ * In this simplified version, the sprite must be entirely on-screen
+ */
+ void rleDraw(const byte *src, int x = 0, int y = 0);
+
+ /**
+ * Main drawing
+ */
+ void draw(const Buffer &src, int x, int y, bool forwards = true,
+ const byte *depthCodes = nullptr, int srcDepth = -1);
+};
+
+} // namespace M4
+
+#endif
diff --git a/engines/m4/m4_types.h b/engines/m4/m4_types.h
index 1eb8bbc1bbf..717ca1e2d85 100644
--- a/engines/m4/m4_types.h
+++ b/engines/m4/m4_types.h
@@ -70,6 +70,13 @@ struct Buffer {
uint8 *data;
uint8 encoding;
int32 stride;
+
+ uint8 *getBasePtr(int x, int y) {
+ return data + y * w + x;
+ }
+ const uint8 *getBasePtr(int x, int y) const {
+ return data + y * w + x;
+ }
};
struct token {
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index b20bef1a6d4..4540dc31564 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -47,6 +47,7 @@ MODULE_OBJS = \
graphics/gr_pal.o \
graphics/gr_series.o \
graphics/gr_sprite.o \
+ graphics/gr_surface.o \
graphics/graphics.o \
graphics/krn_pal.o \
graphics/rend.o \
Commit: e16072ecbe88f9bf72251eeec8073577364ead57
https://github.com/scummvm/scummvm/commit/e16072ecbe88f9bf72251eeec8073577364ead57
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes, cleanup for menu item display
Changed paths:
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/rooms/section9/menu_room.h
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/burger/rooms/section9/room903.cpp
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index f7c7cd1aa54..9b84c74b17b 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -57,8 +57,11 @@ void MenuRoom::drawButton(int index) {
error_show(FL, 'Burg', "draw_button which?");
MenuButton &btn = _buttons[index];
- assert(btn._state >= BTNSTATE_0 && btn._state <= BTNSTATE_3);
- int frame[4] = { btn._frame0, btn._frame1, btn._frame2, btn._frame3 };
+ assert(btn._state >= BTNSTATE_DISABLED && btn._state <= BTNSTATE_PRESSED);
+ int frame[4] = {
+ btn._frame_disabled, btn._frame_enabled,
+ btn._frame_highlighted, btn._frame_pressed
+ };
btn._machine = series_show_(_menuName, 0, 0, -1, -1, frame[btn._state], 100, btn._x1, btn._y1);
}
@@ -70,7 +73,7 @@ void MenuRoom::drawButtons() {
void MenuRoom::setButtonState(int index, ButtonState newState) {
if (index >= 0 && index < (int)_buttons.size()) {
MenuButton &btn = _buttons[index];
- if (btn._state != BTNSTATE_0 && newState != btn._state) {
+ if (btn._state != BTNSTATE_DISABLED && newState != btn._state) {
TerminateMachineAndNull(btn._machine);
btn._state = newState;
drawButton(index);
@@ -88,13 +91,15 @@ void MenuRoom::buttonsFrame() {
if (_buttonNum == -1) {
if (_highlightedButton == -1) {
- setButtonState(_activeButton, BTNSTATE_1);
+ setButtonState(_activeButton, BTNSTATE_ENABLED);
} else if (_highlightedButton != _activeButton) {
- setButtonState(_activeButton, BTNSTATE_1);
- setButtonState(_highlightedButton, BTNSTATE_2);
+ setButtonState(_activeButton, BTNSTATE_ENABLED);
+ setButtonState(_highlightedButton, BTNSTATE_HIGHLIGHTED);
}
+
+ _activeButton = _highlightedButton;
} else {
- setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_3 : BTNSTATE_1);
+ setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_PRESSED : BTNSTATE_ENABLED);
}
if (_G(MouseState).ButtonState) {
@@ -103,7 +108,7 @@ void MenuRoom::buttonsFrame() {
_buttonNum = _highlightedButton;
if (_buttonNum != -1) {
- setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_3 : BTNSTATE_1);
+ setButtonState(_buttonNum, _buttonNum == _highlightedButton ? BTNSTATE_PRESSED : BTNSTATE_ENABLED);
}
} else if (_flag) {
_flag = false;
@@ -117,10 +122,10 @@ void MenuRoom::buttonsFrame() {
term_message("Button pressed: %d", _highlightedButton);
const MenuButton &btn = _buttons[_highlightedButton];
- if (btn._state != BTNSTATE_0) {
+ if (btn._state != BTNSTATE_DISABLED) {
digi_play(_clickName, 2, 255, -1);
kernel_trigger_dispatch_now(btn._trigger);
- setButtonState(_buttonNum, BTNSTATE_2);
+ setButtonState(_buttonNum, BTNSTATE_HIGHLIGHTED);
}
}
diff --git a/engines/m4/burger/rooms/section9/menu_room.h b/engines/m4/burger/rooms/section9/menu_room.h
index 23620fe73ed..d87daf52b06 100644
--- a/engines/m4/burger/rooms/section9/menu_room.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -32,17 +32,17 @@ namespace Rooms {
constexpr int NO_BUTTONS_HILITED = -1;
-enum ButtonState { BTNSTATE_0 = 0, BTNSTATE_1 = 1, BTNSTATE_2 = 2, BTNSTATE_3 = 3 };
+enum ButtonState { BTNSTATE_DISABLED = 0, BTNSTATE_ENABLED = 1, BTNSTATE_HIGHLIGHTED = 2, BTNSTATE_PRESSED = 3 };
struct MenuButtonDef {
int32 _x1;
int32 _y1;
int32 _x2;
int32 _y2;
- int32 _frame0;
- int32 _frame1;
- int32 _frame2;
- int32 _frame3;
+ int32 _frame_disabled;
+ int32 _frame_enabled;
+ int32 _frame_highlighted;
+ int32 _frame_pressed;
ButtonState _state;
int32 _trigger;
};
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index 00ace740085..0aedaadcc3f 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -39,15 +39,15 @@ enum {
};
static const MenuButtonDef DEMO_BUTTONS[4] = {
- { 337, 82, 622, 140, 0, 1, 2, 3, BTNSTATE_1, 3 },
- { 337, 138, 622, 197, 4, 5, 6, 7, BTNSTATE_1, 6 },
- { 337, 198, 622, 256, 8, 9, 10, 11, BTNSTATE_1, 5 },
- { 337, 260, 622, 317, 12, 13, 14, 15, BTNSTATE_1, 9 }
+ { 337, 82, 622, 140, 0, 1, 2, 3, BTNSTATE_ENABLED, 3 },
+ { 337, 138, 622, 197, 4, 5, 6, 7, BTNSTATE_ENABLED, 6 },
+ { 337, 198, 622, 256, 8, 9, 10, 11, BTNSTATE_ENABLED, 5 },
+ { 337, 260, 622, 317, 12, 13, 14, 15, BTNSTATE_ENABLED, 9 }
};
static const MenuButtonDef GAME_BUTTONS[2] = {
- { 337, 82, 622, 140, 4, 5, 6, 7, BTNSTATE_1, 6 },
- { 337, 138, 622, 197, 12, 13, 14, 15, BTNSTATE_1, 9 }
+ { 337, 82, 622, 140, 4, 5, 6, 7, BTNSTATE_ENABLED, 6 },
+ { 337, 138, 622, 197, 12, 13, 14, 15, BTNSTATE_ENABLED, 9 }
};
void Room901::preload() {
@@ -89,8 +89,8 @@ void Room901::daemon() {
player_set_commands_allowed(true);
for (uint i = 0; i < _buttons.size(); ++i) {
- if (_buttons[i]._state != BTNSTATE_0)
- setButtonState(i, BTNSTATE_1);
+ if (_buttons[i]._state != BTNSTATE_DISABLED)
+ setButtonState(i, BTNSTATE_ENABLED);
}
break;
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 7f00e4fa630..7f09fcea267 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -32,12 +32,12 @@ namespace Burger {
namespace Rooms {
static const MenuButtonDef BUTTONS[6] = {
- { 295, 125, 615, 155, 0, 1, 2, 3, BTNSTATE_1, 5 },
- { 295, 165, 615, 195, 12, 13, 14, 15, BTNSTATE_1, 6 },
- { 295, 205, 615, 235, 4, 5, 6, 7, BTNSTATE_1, 7 },
- { 295, 245, 615, 275, 16, 17, 18, 19, BTNSTATE_1, 8 },
- { 295, 285, 615, 315, 8, 9, 10, 11, BTNSTATE_1, 9 },
- { 295, 325, 615, 355, 20, 21, 22, 23, BTNSTATE_1, 10 },
+ { 295, 125, 615, 155, 0, 1, 2, 3, BTNSTATE_ENABLED, 5 },
+ { 295, 165, 615, 195, 12, 13, 14, 15, BTNSTATE_ENABLED, 6 },
+ { 295, 205, 615, 235, 4, 5, 6, 7, BTNSTATE_ENABLED, 7 },
+ { 295, 245, 615, 275, 16, 17, 18, 19, BTNSTATE_ENABLED, 8 },
+ { 295, 285, 615, 315, 8, 9, 10, 11, BTNSTATE_ENABLED, 9 },
+ { 295, 325, 615, 355, 20, 21, 22, 23, BTNSTATE_ENABLED, 10 },
};
void Room903::preload() {
@@ -81,12 +81,12 @@ void Room903::daemon() {
drawButtons();
if (!g_engine->savesExist()) {
- _buttons[2]._state = BTNSTATE_0;
+ _buttons[2]._state = BTNSTATE_DISABLED;
drawButton(2);
}
if (!g_engine->autosaveExists()) {
- _buttons[3]._state = BTNSTATE_0;
+ _buttons[3]._state = BTNSTATE_DISABLED;
drawButton(3);
}
@@ -104,8 +104,8 @@ void Room903::daemon() {
player_set_commands_allowed(true);
for (uint i = 0; i < _buttons.size(); ++i) {
- if (_buttons[i]._state != BTNSTATE_0)
- setButtonState(i, BTNSTATE_1);
+ if (_buttons[i]._state != BTNSTATE_DISABLED)
+ setButtonState(i, BTNSTATE_ENABLED);
}
break;
Commit: 11818ddd9bc5d4a7353e742a4b963070929003e8
https://github.com/scummvm/scummvm/commit/11818ddd9bc5d4a7353e742a4b963070929003e8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Populate ButtonState when pressing moues buttons
Changed paths:
engines/m4/burger/rooms/section9/room903.h
engines/m4/platform/events.cpp
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index f9fa87902bb..bde4b1832ac 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -33,7 +33,7 @@ private:
bool _buttonsDrawn = false;
public:
- Room903() : MenuRoom(903, "903menu", "903click") {}
+ Room903() : MenuRoom(903, "903menu", "901click") {}
~Room903() override {}
void preload() override;
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index dddfb829590..ed0be6b907b 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -107,21 +107,27 @@ void Events::handleMouseEvent(const Common::Event &ev) {
break;
case Common::EVENT_LBUTTONDOWN:
_mouseStateEvent |= LBD;
+ ButtonState = 1;
break;
case Common::EVENT_LBUTTONUP:
_mouseStateEvent |= LBU;
+ ButtonState = 0;
break;
case Common::EVENT_RBUTTONDOWN:
_mouseStateEvent |= RBD;
+ ButtonState = 2;
break;
case Common::EVENT_RBUTTONUP:
_mouseStateEvent |= RBU;
+ ButtonState = 0;
break;
case Common::EVENT_MBUTTONDOWN:
_mouseStateEvent |= MBD;
+ ButtonState = 4;
break;
case Common::EVENT_MBUTTONUP:
_mouseStateEvent |= MBU;
+ ButtonState = 0;
break;
default:
break;
Commit: 2dcf33c244f75822cf161236705634a79665229c
https://github.com/scummvm/scummvm/commit/2dcf33c244f75822cf161236705634a79665229c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding game menu code
Changed paths:
A engines/m4/adv_r/adv_background.cpp
A engines/m4/adv_r/adv_background.h
engines/m4/burger/flags.h
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/game_menu.h
engines/m4/burger/hotkeys.cpp
engines/m4/burger/vars.h
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_font.h
engines/m4/graphics/krn_pal.h
engines/m4/mem/reloc.h
engines/m4/module.mk
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_background.cpp b/engines/m4/adv_r/adv_background.cpp
new file mode 100644
index 00000000000..6aa2c5eb88b
--- /dev/null
+++ b/engines/m4/adv_r/adv_background.cpp
@@ -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/>.
+ *
+ */
+
+#include "m4/adv_r/adv_background.h"
+#include "m4/vars.h"
+
+namespace M4 {
+
+void adv_freeCodes() {
+
+}
+
+void adv_freeBackground() {
+
+}
+
+bool adv_restoreBackground() {
+ return true;
+}
+
+bool adv_restoreCodes() {
+ return true;
+}
+
+} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_background.h b/engines/m4/adv_r/adv_background.h
new file mode 100644
index 00000000000..70c6aecba14
--- /dev/null
+++ b/engines/m4/adv_r/adv_background.h
@@ -0,0 +1,37 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_ADV_R_ADV_BACKGROUND_H
+#define M4_ADV_R_ADV_BACKGROUND_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+
+extern void adv_freeCodes();
+extern void adv_freeBackground();
+extern bool adv_restoreBackground();
+extern bool adv_restoreCodes();
+
+} // End of namespace M4
+
+#endif
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index e96782fa63f..b5fd64eb523 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -325,7 +325,7 @@ enum {
V290 = 290,
V291 = 291,
V292 = 292,
- V293 = 293,
+ digestability = 293,
V294 = 294,
V295 = 295,
V296 = 296,
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 77a6bfbccc3..fa1b64ec3ee 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -21,43 +21,3724 @@
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/gui/interface.h"
+#include "m4/adv_r/other.h"
+#include "m4/adv_r/adv_background.h"
+#include "m4/adv_r/adv_control.h"
#include "m4/adv_r/adv_player.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
+#include "m4/gui/gui_event.h"
+#include "m4/gui/hotkeys.h"
+#include "m4/graphics/gr_line.h"
+#include "m4/graphics/gr_sprite.h"
+#include "m4/graphics/krn_pal.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/mem/mem.h"
+#include "m4/platform/keys.h"
+#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
namespace GUI {
+#define _GM(X) _G(menu).X
+#define LockMouseSprite mouse_lock_sprite
+#define UnlockMouseSprite mouse_unlock_sprite
+
+void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu);
+void CreateSaveMenu(RGB8 *myPalette);
+void CreateLoadMenu(RGB8 *myPalette);
+
+Sprite *menu_CreateThumbnail(int32 *spriteSize) {
+#ifdef TODO
+ Sprite *thumbNailSprite;
+ GrBuff *thumbNail;
+ Buffer *scrnBuff, *intrBuff, *destBuff, RLE8Buff;
+ uint8 *srcPtr, *srcPtr2, *srcPtr3, *srcRowPtr, *destPtr;
+ ScreenContext *gameScreen;
+ int32 i, status;
+ int32 currRow, beginRow, endRow;
+
+ // Create a Sprite for the rle8 thumbNail
+ if ((thumbNailSprite = (Sprite *)mem_alloc(sizeof(Sprite), "sprite")) == nullptr) {
+ return nullptr;
+ }
+
+ thumbNail = new GrBuff((MAX_VIDEO_X + 1) / 3, (MAX_VIDEO_Y + 1) / 3);
+ if (!thumbNail) {
+ return nullptr;
+ }
+
+ destBuff = thumbNail->get_buffer();
+ if (!destBuff) {
+ return nullptr;
+ }
+
+ gameScreen = vmng_screen_find(_G(gameDrawBuff), &status);
+ if ((!gameScreen) || (status != SCRN_ACTIVE)) {
+ return nullptr;
+ }
+
+ scrnBuff = _G(gameDrawBuff)->get_buffer();
+ if (!scrnBuff) {
+ return nullptr;
+ }
+
+ // Grab the interface buffer
+ intrBuff = _G(gameInterfaceBuff)->get_buffer();
+
+ if (gameScreen->y1 > 0) {
+ // Paint the top of the thumbnail black
+ beginRow = gameScreen->y1;
+ memset(destBuff->data, 21, (beginRow / 3) * destBuff->stride);
+ srcRowPtr = (uint8 *)(scrnBuff->data + (-gameScreen->x1));
+ destPtr = (uint8 *)(destBuff->data + ((beginRow / 3) * destBuff->stride));
+ } else {
+ srcRowPtr = (uint8 *)(scrnBuff->data + ((-gameScreen->y1) * scrnBuff->stride) + (-gameScreen->x1));
+ beginRow = 0;
+ destPtr = destBuff->data;
+ }
+ endRow = imath_min(MAX_VIDEO_Y, gameScreen->y2);
+
+ for (currRow = beginRow; currRow <= endRow; currRow += 3) {
+
+ // Set the src pointers
+ srcPtr = srcRowPtr;
+ srcPtr2 = srcRowPtr + scrnBuff->stride;
+ srcPtr3 = srcRowPtr + (scrnBuff->stride << 1);
+
+ for (i = 0; i < (MAX_VIDEO_X + 1) / 3; i++) {
+
+ // Calculate the average - make sure not to extend past the end of the buffer
+ if (endRow - currRow < 1) {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2)) / 3));
+ } else if (endRow - currRow < 2) {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2) +
+ *srcPtr2 + *(srcPtr2 + 1) + *(srcPtr2 + 2)) / 6));
+ } else {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2) +
+ *srcPtr2 + *(srcPtr2 + 1) + *(srcPtr2 + 2) +
+ *srcPtr3 + *(srcPtr3 + 1) + *(srcPtr3 + 2)) / 9));
+ }
+
+ if (*destPtr == 0) {
+ *destPtr = 21;
+ }
+
+ // Increment the pointers
+ srcPtr += 3;
+ srcPtr2 += 3;
+ srcPtr3 += 3;
+ destPtr++;
+ }
+
+ // Update the row pointer
+ srcRowPtr += scrnBuff->stride * 3;
+ }
+
+ // Reset the currRow
+ beginRow = currRow;
+
+ // Paint the interface section of the thumbnail
+ if (currRow < MAX_VIDEO_Y) {
+
+ // If the interface is visible, grab it
+ if (intrBuff) {
+
+ srcRowPtr = intrBuff->data;
+ endRow = imath_min(MAX_VIDEO_Y, beginRow + intrBuff->h - 1);
+ for (currRow = beginRow; currRow <= endRow; currRow += 3) {
+
+ // Set the src pointers
+ srcPtr = srcRowPtr;
+ srcPtr2 = srcRowPtr + intrBuff->stride;
+ srcPtr3 = srcRowPtr + (intrBuff->stride << 1);
+
+ for (i = 0; i < (MAX_VIDEO_X + 1) / 3; i++) {
+
+ // If the pix is outside of the inventory objects in the interface, set to black
+ // If ((srcPtr - srcRowPtr < 180) || (srcPtr - srcRowPtr > 575)) {
+ if (true) { // for now make everything in the interface black
+ *destPtr = 21;
+ }
+
+ // Else calculate the average - make sure not to extend past the end of the buffer
+ else {
+ if (endRow - currRow < 1) {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2)) / 3));
+ } else if (endRow - currRow < 2) {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2) +
+ *srcPtr2 + *(srcPtr2 + 1) + *(srcPtr2 + 2)) / 6));
+ } else {
+ *destPtr = (uint8)((uint32)((*srcPtr + *(srcPtr + 1) + *(srcPtr + 2) +
+ *srcPtr2 + *(srcPtr2 + 1) + *(srcPtr2 + 2) +
+ *srcPtr3 + *(srcPtr3 + 1) + *(srcPtr3 + 2)) / 9));
+ }
+ if (*destPtr == 0) {
+ *destPtr = 21;
+ }
+ }
+
+ // Increment the pointers
+ srcPtr += 3;
+ srcPtr2 += 3;
+ srcPtr3 += 3;
+ destPtr++;
+ }
+
+ // Update the row pointer
+ srcRowPtr += intrBuff->stride * 3;
+ }
+ }
+ // Else paint the bottom of the thumbnail black
+ else {
+ destPtr = (uint8 *)(destBuff->data + ((currRow / 3) * destBuff->stride));
+ memset(destPtr, 21, (destBuff->h - (currRow / 3)) * destBuff->stride);
+ }
+ }
+
+ // Reset the currRow
+ beginRow = currRow;
+
+ if (currRow < MAX_VIDEO_Y) {
+ // Paint the bottom of the thumbnail black
+ destPtr = (uint8 *)(destBuff->data + ((currRow / 3) * destBuff->stride));
+ memset(destPtr, 21, (destBuff->h - (currRow / 3)) * destBuff->stride);
+ }
+
+ // Compress the thumbNail data into the RLE8Buff
+ if ((*spriteSize = (int32)gr_sprite_RLE8_encode(destBuff, &RLE8Buff)) <= 0) {
+ return nullptr;
+ }
+
+ // Fill in the Sprite structure
+ thumbNailSprite->w = destBuff->w;
+ thumbNailSprite->h = destBuff->h;
+ thumbNailSprite->encoding = RLE8;
+ thumbNailSprite->data = nullptr;
+ if ((thumbNailSprite->sourceHandle = NewHandle(*spriteSize, "thumbNail source")) == nullptr) {
+ return nullptr;
+ }
+ thumbNailSprite->sourceOffset = 0;
+
+ // Now copy the RLE8Buff into the thumbNail source handle
+ HLock(thumbNailSprite->sourceHandle);
+ thumbNailSprite->data = (uint8 *)(*(thumbNailSprite->sourceHandle));
+ memcpy(thumbNailSprite->data, RLE8Buff.data, *spriteSize);
+ HUnLock(thumbNailSprite->sourceHandle);
+
+ // Release all buffers
+ _G(gameDrawBuff)->release();
+ if (intrBuff) {
+ _G(gameInterfaceBuff)->release();
+ }
+ thumbNail->release();
+
+ // Free up both the thumbNail and the RLE8Buff
+ delete thumbNail;
+ mem_free((void *)RLE8Buff.data);
+
+ return thumbNailSprite;
+#else
+ error("TODO: createThumbnail");
+#endif
+}
+
+
+bool menu_CursorInsideItem(menuItem *myItem, int32 cursorX, int32 cursorY) {
+ if ((cursorX >= myItem->x1) && (cursorX <= myItem->x2) && (cursorY >= myItem->y1) && (cursorY <= myItem->y2)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+void gui_DrawSprite(Sprite *mySprite, Buffer *myBuff, int32 x, int32 y) {
+ DrawRequest spriteDrawReq;
+ Buffer drawSpriteBuff;
+
+ if ((!mySprite) || (!myBuff)) {
+ return;
+ }
+
+ if (mySprite->sourceHandle) {
+ HLock(mySprite->sourceHandle);
+ mySprite->data = (uint8 *)((int32) * (mySprite->sourceHandle) + mySprite->sourceOffset);
+
+ drawSpriteBuff.w = mySprite->w;
+ drawSpriteBuff.stride = mySprite->w;
+ drawSpriteBuff.h = mySprite->h;
+ drawSpriteBuff.encoding = (mySprite->encoding) & (uint8)0x7f;
+ drawSpriteBuff.data = mySprite->data;
+
+ spriteDrawReq.Src = &drawSpriteBuff;
+ spriteDrawReq.Dest = myBuff;
+ spriteDrawReq.x = x;
+ spriteDrawReq.y = y;
+ spriteDrawReq.scaleX = 100;
+ spriteDrawReq.scaleY = 100;
+ spriteDrawReq.srcDepth = 0;
+ spriteDrawReq.depthCode = nullptr;
+ spriteDrawReq.Pal = nullptr;
+ spriteDrawReq.ICT = nullptr;
+
+ gr_sprite_draw(&spriteDrawReq);
+
+ // Unlock the handle
+ HUnLock(mySprite->sourceHandle);
+ }
+}
+
+
+void item_Destroy(void *theItem) {
+ menuItem *myItem = (menuItem *)theItem;
+
+ // Verify params
+ if (!myItem) {
+ return;
+ }
+ if (myItem->background) {
+ delete myItem->background;
+ }
+
+ if (myItem->itemInfo) {
+ mem_free((void *)myItem->itemInfo);
+ }
+ mem_free((void *)myItem);
+}
+
+
+//------------------------------- MESSAGE MENU ITEM ---------------------------------//
+
+
+void menu_DrawMsg(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemMsg *myMsg = nullptr;
+ Buffer *myBuff = nullptr;
+ Buffer *backgroundBuff = nullptr;
+ Sprite *mySprite = nullptr;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
+ return;
+ }
+
+ // If the item is marked transparent, get the background buffer
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+ }
+
+ // Get the button info and select the sprite
+ myMsg = (menuItemMsg *)myItem->itemInfo;
+ switch (myItem->tag) {
+ case SL_TAG_SAVE_LABEL:
+ mySprite = _GM(menuSprites)[SL_SAVE_LABEL];
+ break;
+ case SL_TAG_LOAD_LABEL:
+ mySprite = _GM(menuSprites)[SL_LOAD_LABEL];
+ break;
+ case SL_TAG_THUMBNAIL:
+ mySprite = _GM(saveLoadThumbNail);
+ break;
+ }
+
+ // Get the menu buffer and draw the sprite to it
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // If the item is tagged as transparent, we need to fill in it's background behind it
+ if (backgroundBuff) {
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, x, y, backgroundBuff->w, backgroundBuff->h);
+ myItem->background->release();
+ }
+
+ // Draw the sprite in
+ gui_DrawSprite(mySprite, myBuff, x, y);
+
+ // Release the menu buffer
+ myMenu->menuBuffer->release();
+}
+
+
+menuItem *menu_MsgAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, bool transparent) {
+ menuItem *newItem;
+ menuItemMsg *msgInfo;
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ // Allocate a new one
+ if ((newItem = (menuItem *)mem_alloc(sizeof(menuItem), "gui menu item")) == nullptr) {
+ return nullptr;
+ }
+
+ // Initialize the struct
+ newItem->next = myMenu->itemList;
+ newItem->prev = nullptr;
+ if (myMenu->itemList) {
+ myMenu->itemList->prev = newItem;
+ }
+ myMenu->itemList = newItem;
+
+ newItem->myMenu = (void *)myMenu;
+ newItem->tag = tag;
+ newItem->x1 = x;
+ newItem->y1 = y;
+ newItem->x2 = x + w - 1;
+ newItem->y2 = y + h - 1;
+ newItem->callback = nullptr;
+
+ if (!transparent) {
+ newItem->transparent = false;
+ newItem->background = nullptr;
+ } else {
+ newItem->transparent = true;
+ newItem->background = menu_CopyBackground(myMenu, x, y, w, h);
+ }
+
+ if ((msgInfo = (menuItemMsg *)mem_alloc(sizeof(menuItemMsg), "menu item message")) == nullptr) {
+ return nullptr;
+ }
+ newItem->itemInfo = (void *)msgInfo;
+
+ newItem->redraw = menu_DrawMsg;
+ newItem->destroy = item_Destroy;
+ newItem->itemEventHandler = nullptr;
+
+ // Draw the message in now
+ (newItem->redraw)(newItem, (void *)myMenu, x, y, 0, 0);
+
+ // See if the screen is currently visible
+ myScreen = vmng_screen_find((void *)myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + newItem->x1, myScreen->y1 + newItem->y1,
+ myScreen->x1 + newItem->x2, myScreen->y1 + newItem->y2);
+ }
+
+ return newItem;
+}
+
+
+
+//------------------------------- BUTTON MENU ITEM ----------------------------------//
+
+enum button_states {
+ BTN_STATE_NORM = 0,
+ BTN_STATE_OVER = 1,
+ BTN_STATE_PRESS = 2,
+ BTN_STATE_GREY = 3
+};
+
+enum button_types {
+ BTN_TYPE_GM_GENERIC,
+ BTN_TYPE_SL_SAVE,
+ BTN_TYPE_SL_LOAD,
+ BTN_TYPE_SL_CANCEL,
+ BTN_TYPE_SL_TEXT,
+ BTN_TYPE_OM_DONE,
+ BTN_TYPE_OM_CANCEL,
+
+ BTN_TYPE_TOTAL_NUMBER
+};
+
+
+void menu_DrawButton(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemButton *myButton = nullptr;
+ Buffer *myBuff = nullptr;
+ Buffer *backgroundBuff = nullptr;
+ Sprite *mySprite = nullptr;
+ char tempStr[32];
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
+ return;
+ }
+
+ // If the item is marked transparent, get the background buffer
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+ }
+
+ // Get the button info and select the sprite
+ myButton = (menuItemButton *)myItem->itemInfo;
+
+ switch (myButton->buttonType) {
+
+ case BTN_TYPE_GM_GENERIC:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[GM_BUTTON_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[GM_BUTTON_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[GM_BUTTON_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[GM_BUTTON_GREY];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_SL_SAVE:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[SL_SAVE_BTN_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[SL_SAVE_BTN_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[SL_SAVE_BTN_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[SL_SAVE_BTN_GREY];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_SL_LOAD:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[SL_LOAD_BTN_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[SL_LOAD_BTN_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[SL_LOAD_BTN_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[SL_LOAD_BTN_GREY];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_SL_TEXT:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_OVER:
+ font_set_colors(TEXT_COLOR_OVER_SHADOW, TEXT_COLOR_OVER_FOREGROUND, TEXT_COLOR_OVER_HILITE);
+ // Gr_font_set_color(TEXT_COLOR_OVER);
+ mySprite = _GM(menuSprites)[SL_LINE_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ font_set_colors(TEXT_COLOR_PRESS_SHADOW, TEXT_COLOR_PRESS_FOREGROUND, TEXT_COLOR_PRESS_HILITE);
+ // Gr_font_set_color(TEXT_COLOR_PRESS);
+ mySprite = _GM(menuSprites)[SL_LINE_PRESS];
+ break;
+ case BTN_STATE_GREY:
+ font_set_colors(TEXT_COLOR_GREY_SHADOW, TEXT_COLOR_GREY_FOREGROUND, TEXT_COLOR_GREY_HILITE);
+ // Gr_font_set_color(TEXT_COLOR_GREY);
+ mySprite = _GM(menuSprites)[SL_LINE_NORM];
+ break;
+ default:
+ case BTN_STATE_NORM:
+ font_set_colors(TEXT_COLOR_NORM_SHADOW, TEXT_COLOR_NORM_FOREGROUND, TEXT_COLOR_NORM_HILITE);
+ // Gr_font_set_color(TEXT_COLOR_NORM);
+ mySprite = _GM(menuSprites)[SL_LINE_NORM];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_SL_CANCEL:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[SL_CANCEL_BTN_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[SL_CANCEL_BTN_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[SL_CANCEL_BTN_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[SL_CANCEL_BTN_NORM];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_OM_DONE:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[OM_DONE_BTN_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[OM_DONE_BTN_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[OM_DONE_BTN_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[OM_DONE_BTN_GREY];
+ break;
+ }
+ break;
+
+ case BTN_TYPE_OM_CANCEL:
+
+ switch (myButton->itemFlags) {
+ case BTN_STATE_NORM:
+ mySprite = _GM(menuSprites)[OM_CANCEL_BTN_NORM];
+ break;
+ case BTN_STATE_OVER:
+ mySprite = _GM(menuSprites)[OM_CANCEL_BTN_OVER];
+ break;
+ case BTN_STATE_PRESS:
+ mySprite = _GM(menuSprites)[OM_CANCEL_BTN_PRESS];
+ break;
+ default:
+ case BTN_STATE_GREY:
+ mySprite = _GM(menuSprites)[OM_CANCEL_BTN_NORM];
+ break;
+ }
+ break;
+
+
+
+ }
+
+ // Get the menu buffer
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // If the item is tagged as transparent, we need to fill in it's background behind it
+ if (backgroundBuff) {
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, x, y, backgroundBuff->w, backgroundBuff->h);
+ myItem->background->release();
+ }
+
+ // Draw the button sprite in
+ gui_DrawSprite(mySprite, myBuff, x, y);
+
+ // If the button is a textbutton, write in the text
+ if ((myButton->buttonType == BTN_TYPE_SL_TEXT) && (myButton->prompt)) {
+ //write in the special tag
+ Common::sprintf_s(tempStr, 32, "%02ld", myItem->tag - 1000 + _GM(firstSlotIndex));
+ /* Common::sprintf_s(tempStr, "%02ld", myButton->specialTag); */
+ gr_font_set(_GM(menuFont));
+ gr_font_write(myBuff, tempStr, x + 4, y + 1, 0, -1);
+ gr_font_write(myBuff, myButton->prompt, x + 26, y + 1, 0, -1);
+ }
+
+ // Release the menu buffer
+ myMenu->menuBuffer->release();
+}
+
+
+bool button_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemButton *myButton;
+ bool redrawItem, execCallback, handled;
+ ScreenContext *myScreen;
+ int32 status;
+ int32 currTag;
+ guiMenu *currMenu;
+ menuItem *tempItem;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return false;
+ }
+ myButton = (menuItemButton *)myItem->itemInfo;
+
+ if (!(eventType == EVENT_MOUSE)) {
+ return false;
+ }
+
+ if (myButton->itemFlags == BTN_STATE_GREY) {
+ return false;
+ }
+
+ redrawItem = false;
+ execCallback = false;
+ handled = true;
+
+ switch (event) {
+ case _ME_L_click:
+ case _ME_doubleclick:
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ myButton->itemFlags = BTN_STATE_PRESS;
+ *currItem = theItem;
+ redrawItem = true;
+ } else {
+ *currItem = nullptr;
+ if (myButton->itemFlags != BTN_STATE_NORM) {
+ myButton->itemFlags = BTN_STATE_NORM;
+ redrawItem = true;
+ }
+ }
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ if (!*currItem) {
+ return true;
+ }
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ if (myButton->itemFlags != BTN_STATE_PRESS) {
+ myButton->itemFlags = BTN_STATE_PRESS;
+ redrawItem = true;
+ }
+ } else {
+ if (myButton->itemFlags != BTN_STATE_OVER) {
+ myButton->itemFlags = BTN_STATE_OVER;
+ redrawItem = true;
+ }
+ }
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ if (*currItem) {
+ execCallback = true;
+ } else {
+ *currItem = theItem;
+ }
+ myButton->itemFlags = BTN_STATE_OVER;
+ redrawItem = true;
+ } else {
+ *currItem = nullptr;
+ myButton->itemFlags = BTN_STATE_NORM;
+ redrawItem = true;
+ handled = false;
+ }
+ break;
+
+ case _ME_move:
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ *currItem = theItem;
+ if (myButton->itemFlags != BTN_STATE_OVER) {
+ myButton->itemFlags = BTN_STATE_OVER;
+ redrawItem = true;
+ }
+ } else {
+ *currItem = nullptr;
+ if (myButton->itemFlags != BTN_STATE_NORM) {
+ myButton->itemFlags = BTN_STATE_NORM;
+ redrawItem = true;
+ handled = false;
+ }
+ }
+ break;
+
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+ }
+
+ // See if we need to redraw the button
+ if (redrawItem) {
+ (myItem->redraw)((void *)myItem, (void *)myItem->myMenu, myItem->x1, myItem->y1, 0, 0);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + myItem->x1, myScreen->y1 + myItem->y1,
+ myScreen->x1 + myItem->x2, myScreen->y1 + myItem->y2);
+ }
+ }
+
+ // See if we need to call the callback function
+ if (execCallback && myItem->callback) {
+ // digi_play(inv_click_snd, 2, 255, -1, inv_click_snd_room_lock);
+ currMenu = (guiMenu *)myItem->myMenu;
+ currTag = myItem->tag;
+ (myItem->callback)((void *)myItem, (void *)myItem->myMenu);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ *currItem = nullptr;
+ } else {
+ tempItem = menu_GetItem(currTag, currMenu);
+ if (!tempItem) {
+ *currItem = nullptr;
+ }
+ }
+ }
+
+ return handled;
+}
+
+
+menuItem *menu_ButtonAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, CALLBACK callback, int32 buttonType,
+ bool greyed, bool transparent, char *prompt, ItemHandlerFunction i_handler) {
+ menuItem *newItem;
+ menuItemButton *buttonInfo;
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ // Allocate a new one
+ if ((newItem = (menuItem *)mem_alloc(sizeof(menuItem), "gui menu item")) == nullptr) {
+ return nullptr;
+ }
+
+ // Initialize the struct
+ newItem->next = myMenu->itemList;
+ newItem->prev = nullptr;
+ if (myMenu->itemList) {
+ myMenu->itemList->prev = newItem;
+ }
+ myMenu->itemList = newItem;
+
+ newItem->myMenu = (void *)myMenu;
+ newItem->tag = tag;
+ newItem->x1 = x;
+ newItem->y1 = y;
+ newItem->x2 = x + w - 1;
+ newItem->y2 = y + h - 1;
+ newItem->callback = callback;
+
+ if (!transparent) {
+ newItem->transparent = false;
+ newItem->background = nullptr;
+ } else {
+ newItem->transparent = true;
+ newItem->background = menu_CopyBackground(myMenu, x, y, w, h);
+ }
+
+ if ((buttonInfo = (menuItemButton *)mem_alloc(sizeof(menuItemButton), "menu item button")) == nullptr) {
+ return nullptr;
+ }
+ if (greyed) {
+ buttonInfo->itemFlags = BTN_STATE_GREY;
+ } else {
+ buttonInfo->itemFlags = BTN_STATE_NORM;
+ }
+ buttonInfo->buttonType = buttonType;
+
+ // Note: prompt is not duplicated, therefore, make sure the name is stored in non-volatile memory
+ buttonInfo->prompt = prompt;
+ buttonInfo->specialTag = tag - 1000;
+
+ newItem->itemInfo = (void *)buttonInfo;
+
+ newItem->redraw = menu_DrawButton;
+ newItem->destroy = item_Destroy;
+ newItem->itemEventHandler = i_handler;
+
+ // Draw the button in now
+ (newItem->redraw)(newItem, (void *)myMenu, x, y, 0, 0);
+
+ // See if the screen is currently visible
+ myScreen = vmng_screen_find((void *)myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + newItem->x1, myScreen->y1 + newItem->y1,
+ myScreen->x1 + newItem->x2, myScreen->y1 + newItem->y2);
+ }
+
+ return newItem;
+}
+
+
+void menu_DisableButton(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+ menuItemButton *myButton;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ myButton = (menuItemButton *)myItem->itemInfo;
+ myButton->itemFlags = BTN_STATE_GREY;
+}
+
+
+void menu_EnableButton(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+ menuItemButton *myButton;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ myButton = (menuItemButton *)myItem->itemInfo;
+ myButton->itemFlags = BTN_STATE_NORM;
+}
+
+
+//------------------------------- HSLIDER MENU ITEM ---------------------------------//
+
+enum {
+ H_THUMB_NORM = 0,
+ H_THUMB_OVER = 1,
+ H_THUMB_PRESS = 2
+};
+
+
+void menu_DrawHSlider(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemHSlider *mySlider = nullptr;
+ Buffer *myBuff = nullptr;
+ Buffer *backgroundBuff = nullptr;
+ Sprite *mySprite = nullptr;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
+ return;
+ }
+
+ // If the item is marked transparent, get the background buffer
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+ }
+
+ // Get the menu buffer and draw the sprite to it
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // If the item is tagged as transparent, we need to fill in it's background behind it
+ if (backgroundBuff) {
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, x, y, backgroundBuff->w, backgroundBuff->h);
+ myItem->background->release();
+ }
+
+ // Get the slider info and select the thumb sprite
+ mySlider = (menuItemHSlider *)myItem->itemInfo;
+ switch (mySlider->itemFlags) {
+ case H_THUMB_OVER:
+ mySprite = _GM(menuSprites)[OM_SLIDER_BTN_OVER];
+ break;
+ case H_THUMB_PRESS:
+ mySprite = _GM(menuSprites)[OM_SLIDER_BTN_PRESS];
+ break;
+ default:
+ case H_THUMB_NORM:
+ mySprite = _GM(menuSprites)[OM_SLIDER_BTN_NORM];
+ break;
+ }
+
+ // Fill in everything left of the thumb with a hilite color
+ if (mySlider->thumbX > 2) {
+ gr_color_set(SLIDER_BAR_COLOR);
+ gr_buffer_rect_fill(myBuff, myItem->x1 + 3, myItem->y1 + 9, mySlider->thumbX, mySlider->thumbH - 18);
+ }
+
+ // Draw in the thumb
+ gui_DrawSprite(mySprite, myBuff, myItem->x1 + mySlider->thumbX, myItem->y1);
+
+ // Release the menu buffer
+ myMenu->menuBuffer->release();
+}
+
+
+bool hslider_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemHSlider *mySlider;
+ bool redrawItem, execCallback, handled;
+ ScreenContext *myScreen;
+ int32 status;
+ int32 deltaSlide;
+ static bool movingFlag;
+ static int32 movingX;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return false;
+ }
+ mySlider = (menuItemHSlider *)myItem->itemInfo;
+
+ if (!(eventType == EVENT_MOUSE)) {
+ return false;
+ }
+
+ redrawItem = false;
+ handled = true;
+ execCallback = false;
+
+ switch (event) {
+ case _ME_L_click:
+ case _ME_doubleclick:
+ if (menu_CursorInsideItem(myItem, x, y) && (x - myItem->x1 >= mySlider->thumbX) &&
+ (x - myItem->x1 <= mySlider->thumbX + mySlider->thumbW - 1)) {
+ // digi_play(inv_click_snd, 2, 255, -1, inv_click_snd_room_lock);
+ mySlider->itemFlags = H_THUMB_PRESS;
+ movingFlag = true;
+ movingX = x;
+ *currItem = theItem;
+ redrawItem = true;
+ } else {
+ *currItem = nullptr;
+ mySlider->itemFlags = 0;
+ redrawItem = true;
+ }
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ if (!*currItem) {
+ return true;
+ }
+ if (movingFlag) {
+ if (x < movingX) {
+ deltaSlide = imath_min(mySlider->thumbX, movingX - x);
+ if (deltaSlide > 0) {
+ mySlider->thumbX -= deltaSlide;
+ redrawItem = true;
+ mySlider->percent = mySlider->thumbX * 100 / mySlider->maxThumbX;
+ execCallback = true;
+ }
+ } else if (x > movingX) {
+ deltaSlide = imath_min(mySlider->maxThumbX - mySlider->thumbX, x - movingX);
+ if (deltaSlide > 0) {
+ mySlider->thumbX += deltaSlide;
+ redrawItem = true;
+ mySlider->percent = mySlider->thumbX * 100 / mySlider->maxThumbX;
+ execCallback = true;
+ }
+ }
+ movingX = x;
+ if (movingX < (mySlider->thumbX + myItem->x1)) {
+ movingX = mySlider->thumbX + myItem->x1;
+ } else if (movingX > (mySlider->thumbX + mySlider->thumbW - 1 + myItem->x1)) {
+ movingX = mySlider->thumbX + mySlider->thumbW - 1 + myItem->x1;
+ }
+ } else {
+ *currItem = nullptr;
+ }
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ if (!*currItem) {
+ return true;
+ }
+ movingFlag = false;
+ if (menu_CursorInsideItem(myItem, x, y) && (x - myItem->x1 >= mySlider->thumbX) &&
+ (x - myItem->x1 <= mySlider->thumbX + mySlider->thumbW - 1)) {
+ mySlider->itemFlags = H_THUMB_OVER;
+ *currItem = theItem;
+ } else {
+ mySlider->itemFlags = H_THUMB_NORM;
+ *currItem = nullptr;
+ }
+ redrawItem = true;
+ execCallback = true;
+ break;
+
+ case _ME_move:
+ if (menu_CursorInsideItem(myItem, x, y) && (x - myItem->x1 >= mySlider->thumbX) &&
+ (x - myItem->x1 <= mySlider->thumbX + mySlider->thumbW - 1)) {
+ if (mySlider->itemFlags != H_THUMB_OVER) {
+ mySlider->itemFlags = H_THUMB_OVER;
+ *currItem = theItem;
+ redrawItem = true;
+ }
+ } else {
+ if (mySlider->itemFlags != H_THUMB_NORM) {
+ mySlider->itemFlags = H_THUMB_NORM;
+ *currItem = nullptr;
+ redrawItem = true;
+ handled = false;
+ }
+ }
+ break;
+
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+ }
+
+ // See if we need to redraw the hslider
+ if (redrawItem) {
+ (myItem->redraw)((void *)myItem, (void *)myItem->myMenu, myItem->x1, myItem->y1, 0, 0);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + myItem->x1, myScreen->y1 + myItem->y1,
+ myScreen->x1 + myItem->x2, myScreen->y1 + myItem->y2);
+ }
+ }
+
+ // See if we need to call the callback function
+ if (execCallback && myItem->callback) {
+ (myItem->callback)((void *)myItem, (void *)myItem->myMenu);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ *currItem = nullptr;
+ }
+ }
+
+ return handled;
+}
+
+
+menuItem *menu_HSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
+ int32 initPercent, CALLBACK callback, bool transparent) {
+ menuItem *newItem;
+ menuItemHSlider *sliderInfo;
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ // Allocate a new one
+ if ((newItem = (menuItem *)mem_alloc(sizeof(menuItem), "gui menu item")) == nullptr) {
+ return nullptr;
+ }
+
+ // Initialize the struct
+ newItem->next = myMenu->itemList;
+ newItem->prev = nullptr;
+ if (myMenu->itemList) {
+ myMenu->itemList->prev = newItem;
+ }
+ myMenu->itemList = newItem;
+
+ newItem->myMenu = (void *)myMenu;
+ newItem->tag = tag;
+ newItem->x1 = x;
+ newItem->y1 = y;
+ newItem->x2 = x + w - 1;
+ newItem->y2 = y + h - 1;
+ newItem->callback = callback;
+
+ if (!transparent) {
+ newItem->transparent = false;
+ newItem->background = nullptr;
+ } else {
+ newItem->transparent = true;
+ newItem->background = menu_CopyBackground(myMenu, x, y, w, h);
+ }
+
+ // Create a new slider
+ if ((sliderInfo = (menuItemHSlider *)mem_alloc(sizeof(menuItemHSlider), "menu item hslider")) == nullptr) {
+ return nullptr;
+ }
+
+ // Intialize the new slider
+ sliderInfo->itemFlags = H_THUMB_NORM;
+ sliderInfo->thumbW = _GM(menuSprites)[OM_SLIDER_BTN_NORM]->w;
+ sliderInfo->thumbH = _GM(menuSprites)[OM_SLIDER_BTN_NORM]->h;
+ sliderInfo->maxThumbX = w - _GM(menuSprites)[OM_SLIDER_BTN_NORM]->w;
+
+ if (initPercent < 0) {
+ initPercent = 0;
+ } else if (initPercent > 100) {
+ initPercent = 100;
+ }
+
+ // Calculate the initial thumbX
+ sliderInfo->percent = initPercent;
+ sliderInfo->thumbX = initPercent * sliderInfo->maxThumbX / 100;
+
+ newItem->itemInfo = (void *)sliderInfo;
+
+ newItem->redraw = menu_DrawHSlider;
+ newItem->destroy = item_Destroy;
+ newItem->itemEventHandler = hslider_Handler;
+
+ // Draw the slider in now
+ (newItem->redraw)(newItem, (void *)myMenu, x, y, 0, 0);
+
+ // See if the screen is currently visible
+ myScreen = vmng_screen_find((void *)myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + newItem->x1, myScreen->y1 + newItem->y1,
+ myScreen->x1 + newItem->x2, myScreen->y1 + newItem->y2);
+ }
+
+ return newItem;
+}
+
+
+//------------------------------- VSLIDER MENU ITEM ---------------------------------//
+
+enum {
+ VS_NORM = 0x0000,
+ VS_OVER = 0x0001,
+ VS_PRESS = 0x0002,
+ VS_GREY = 0x0003,
+ VS_STATUS = 0x000f,
+ VS_UP = 0x0010,
+ VS_PAGE_UP = 0x0020,
+ VS_THUMB = 0x0030,
+ VS_PAGE_DOWN = 0x0040,
+ VS_DOWN = 0x0050,
+ VS_COMPONENT = 0x00f0
+};
+
+
+void menu_DrawVSlider(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemVSlider *myVSlider = nullptr;
+ Buffer *myBuff = nullptr;
+ Buffer *backgroundBuff = nullptr;
+ Sprite *upSprite = nullptr;
+ Sprite *thumbSprite = nullptr;
+ Sprite *downSprite = nullptr;
+ Sprite *vbarSprite = nullptr;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
+ return;
+ }
+
+ // If the item is marked transparent, get the background buffer
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+ }
+
+ myVSlider = (menuItemVSlider *)myItem->itemInfo;
+
+ // Get the menu buffer
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // If the item is tagged as transparent, we need to fill in it's background behind it
+ if (backgroundBuff) {
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, x, y, backgroundBuff->w, backgroundBuff->h);
+ myItem->background->release();
+ }
+
+ // Set the different sprite components
+ vbarSprite = _GM(menuSprites)[SL_SCROLL_BAR];
+ upSprite = _GM(menuSprites)[SL_UP_BTN_NORM];
+ thumbSprite = _GM(menuSprites)[SL_SLIDER_BTN_NORM];
+ downSprite = _GM(menuSprites)[SL_DOWN_BTN_NORM];
+
+ if ((myVSlider->itemFlags & VS_STATUS) == VS_GREY) {
+ upSprite = _GM(menuSprites)[SL_UP_BTN_GREY];
+ thumbSprite = nullptr;
+ downSprite = _GM(menuSprites)[SL_DOWN_BTN_GREY];
+ } else if ((myVSlider->itemFlags & VS_STATUS) == VS_OVER) {
+ if ((myVSlider->itemFlags & VS_COMPONENT) == VS_UP) {
+ upSprite = _GM(menuSprites)[SL_UP_BTN_OVER];
+ } else if ((myVSlider->itemFlags & VS_COMPONENT) == VS_THUMB) {
+ thumbSprite = _GM(menuSprites)[SL_SLIDER_BTN_OVER];
+ } else if ((myVSlider->itemFlags & VS_COMPONENT) == VS_DOWN) {
+ downSprite = _GM(menuSprites)[SL_DOWN_BTN_OVER];
+ }
+ } else if ((myVSlider->itemFlags & VS_STATUS) == VS_PRESS) {
+ if ((myVSlider->itemFlags & VS_COMPONENT) == VS_UP) {
+ upSprite = _GM(menuSprites)[SL_UP_BTN_PRESS];
+ } else if ((myVSlider->itemFlags & VS_COMPONENT) == VS_THUMB) {
+ thumbSprite = _GM(menuSprites)[SL_SLIDER_BTN_PRESS];
+ } else if ((myVSlider->itemFlags & VS_COMPONENT) == VS_DOWN) {
+ downSprite = _GM(menuSprites)[SL_DOWN_BTN_PRESS];
+ }
+ }
+
+ // Draw the sprite comonents
+ gui_DrawSprite(vbarSprite, myBuff, x, y + upSprite->h);
+ gui_DrawSprite(upSprite, myBuff, x, y);
+ gui_DrawSprite(thumbSprite, myBuff, x, y + myVSlider->thumbY);
+ gui_DrawSprite(downSprite, myBuff, x, y + upSprite->h + vbarSprite->h);
+
+ // Release the menu buffer
+ myMenu->menuBuffer->release();
+}
+
+int32 vslider_WhereIsCursor(menuItemVSlider *myVSlider, int32 y) {
+ if (y < myVSlider->minThumbY) {
+ return VS_UP;
+ } else if (y < myVSlider->thumbY) {
+ return VS_PAGE_UP;
+ } else if (y < myVSlider->thumbY + myVSlider->thumbH) {
+ return VS_THUMB;
+ } else if (y < myVSlider->maxThumbY + myVSlider->thumbH) {
+ return VS_PAGE_DOWN;
+ } else {
+ return VS_DOWN;
+ }
+}
+
+bool vslider_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemVSlider *myVSlider;
+ bool redrawItem, execCallback, handled;
+ int32 tempFlags;
+ ScreenContext *myScreen;
+ int32 status;
+ int32 deltaSlide;
+ int32 currTime;
+ static bool movingFlag;
+ static int32 movingY;
+ static int32 callbackTime;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return false;
+ }
+
+ if (!(eventType == EVENT_MOUSE)) {
+ return false;
+ }
+
+ myVSlider = (menuItemVSlider *)myItem->itemInfo;
+ if ((myVSlider->itemFlags & VS_STATUS) == VS_GREY) {
+ *currItem = nullptr;
+ return false;
+ }
+
+ currTime = timer_read_60();
+ redrawItem = false;
+ handled = true;
+ execCallback = false;
+
+ switch (event) {
+ case _ME_L_click:
+ case _ME_doubleclick:
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ // digi_play(inv_click_snd, 2, 255, -1, inv_click_snd_room_lock);
+ *currItem = theItem;
+ tempFlags = vslider_WhereIsCursor(myVSlider, y - myItem->y1);
+ if (tempFlags == VS_THUMB) {
+ movingFlag = true;
+ movingY = y;
+ }
+ if ((tempFlags == VS_PAGE_UP) || (tempFlags == VS_PAGE_DOWN)) {
+ myVSlider->itemFlags = tempFlags + VS_NORM;
+ } else {
+ myVSlider->itemFlags = tempFlags + VS_PRESS;
+ redrawItem = true;
+ }
+ execCallback = true;
+ } else {
+ *currItem = nullptr;
+ myVSlider->itemFlags = VS_NORM;
+ redrawItem = true;
+ }
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ if (!*currItem) {
+ return true;
+ }
+ if (movingFlag) {
+ if (y < movingY) {
+ deltaSlide = imath_min(myVSlider->thumbY - myVSlider->minThumbY, movingY - y);
+ if (deltaSlide > 0) {
+ myVSlider->thumbY -= deltaSlide;
+ myVSlider->percent = ((myVSlider->thumbY - myVSlider->minThumbY) * 100) /
+ (myVSlider->maxThumbY - myVSlider->minThumbY);
+ redrawItem = true;
+ execCallback = true;
+ }
+ } else if (y > movingY) {
+ deltaSlide = imath_min(myVSlider->maxThumbY - myVSlider->thumbY, y - movingY);
+ if (deltaSlide > 0) {
+ myVSlider->thumbY += deltaSlide;
+ myVSlider->percent = ((myVSlider->thumbY - myVSlider->minThumbY) * 100) /
+ (myVSlider->maxThumbY - myVSlider->minThumbY);
+ redrawItem = true;
+ execCallback = true;
+ }
+ }
+ movingY = y;
+ if (movingY < (myVSlider->thumbY + myItem->y1)) {
+ movingY = myVSlider->thumbY + myItem->y1;
+ } else if (movingY > (myVSlider->thumbY + myVSlider->thumbH - 1 + myItem->y1)) {
+ movingY = myVSlider->thumbY + myVSlider->thumbH - 1 + myItem->y1;
+ }
+ } else {
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ tempFlags = vslider_WhereIsCursor(myVSlider, y - myItem->y1);
+ if ((myVSlider->itemFlags & VS_COMPONENT) == tempFlags) {
+ if ((tempFlags != VS_PAGE_UP) && (tempFlags != VS_PAGE_DOWN) &&
+ ((myVSlider->itemFlags & VS_STATUS) != VS_PRESS)) {
+ myVSlider->itemFlags = tempFlags + VS_PRESS;
+ redrawItem = true;
+ }
+ if (currTime - callbackTime > 6) {
+ execCallback = true;
+ }
+ } else {
+ if ((myVSlider->itemFlags & VS_STATUS) != VS_OVER) {
+ myVSlider->itemFlags = (myVSlider->itemFlags & VS_COMPONENT) + VS_OVER;
+ redrawItem = true;
+ }
+ }
+ execCallback = true;
+ } else {
+ if ((myVSlider->itemFlags & VS_STATUS) != VS_OVER) {
+ myVSlider->itemFlags = (myVSlider->itemFlags & VS_COMPONENT) + VS_OVER;
+ redrawItem = true;
+ }
+ }
+ }
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ movingFlag = false;
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ tempFlags = vslider_WhereIsCursor(myVSlider, y - myItem->y1);
+ if ((tempFlags == VS_PAGE_UP) || (tempFlags == VS_PAGE_DOWN)) {
+ myVSlider->itemFlags = VS_NORM;
+ } else {
+ myVSlider->itemFlags = tempFlags + VS_OVER;
+ *currItem = theItem;
+ }
+ } else {
+ myVSlider->itemFlags = VS_NORM;
+ *currItem = nullptr;
+ }
+ redrawItem = true;
+ if (!_GM(currMenuIsSave)) {
+ UpdateThumbNails(_GM(firstSlotIndex), (guiMenu *)myItem->myMenu);
+ }
+ break;
+
+ case _ME_move:
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ *currItem = theItem;
+ tempFlags = vslider_WhereIsCursor(myVSlider, y - myItem->y1);
+ if ((myVSlider->itemFlags & VS_COMPONENT) != tempFlags) {
+ if ((tempFlags == VS_PAGE_UP) || (tempFlags == VS_PAGE_DOWN)) {
+ myVSlider->itemFlags = VS_NORM;
+ } else {
+ myVSlider->itemFlags = tempFlags + VS_OVER;
+ }
+ redrawItem = true;
+ }
+ } else {
+ *currItem = nullptr;
+ if (myVSlider->itemFlags != VS_NORM) {
+ myVSlider->itemFlags = VS_NORM;
+ redrawItem = true;
+ handled = false;
+ }
+ }
+ break;
+
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ if (!*currItem) {
+ return true;
+ }
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ tempFlags = vslider_WhereIsCursor(myVSlider, y - myItem->y1);
+ if ((myVSlider->itemFlags & VS_COMPONENT) == tempFlags) {
+ if (currTime - callbackTime > 6) {
+ execCallback = true;
+ }
+ }
+ }
+ break;
+ }
+
+ // See if we need to redraw the vslider
+ if (redrawItem) {
+ (myItem->redraw)((void *)myItem, (void *)myItem->myMenu, myItem->x1, myItem->y1, 0, 0);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + myItem->x1, myScreen->y1 + myItem->y1,
+ myScreen->x1 + myItem->x2, myScreen->y1 + myItem->y2);
+ }
+ }
+
+ // See if we need to call the callback function
+ if (execCallback && myItem->callback) {
+ callbackTime = currTime;
+ (myItem->callback)((void *)myItem, (void *)myItem->myMenu);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ *currItem = nullptr;
+ }
+ }
+
+ return handled;
+}
+
+
+menuItem *menu_VSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
+ int32 initPercent, CALLBACK callback, bool transparent) {
+
+ menuItem *newItem;
+ menuItemVSlider *vsliderInfo;
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ // Allocate a new one
+ if ((newItem = (menuItem *)mem_alloc(sizeof(menuItem), "gui menu item")) == nullptr) {
+ return nullptr;
+ }
+
+ // Initialize the struct
+ newItem->next = myMenu->itemList;
+ newItem->prev = nullptr;
+ if (myMenu->itemList) {
+ myMenu->itemList->prev = newItem;
+ }
+ myMenu->itemList = newItem;
+
+ newItem->myMenu = (void *)myMenu;
+ newItem->tag = tag;
+ newItem->x1 = x;
+ newItem->y1 = y;
+ newItem->x2 = x + w - 1;
+ newItem->y2 = y + h - 1;
+ newItem->callback = callback;
+
+ if (!transparent) {
+ newItem->transparent = false;
+ newItem->background = nullptr;
+ } else {
+ newItem->transparent = true;
+ newItem->background = menu_CopyBackground(myMenu, x, y, w, h);
+ }
+
+ if ((vsliderInfo = (menuItemVSlider *)mem_alloc(sizeof(menuItemVSlider), "menu item vslider")) == nullptr) {
+ return nullptr;
+ }
+ vsliderInfo->itemFlags = VS_NORM;
+
+ vsliderInfo->thumbW = _GM(menuSprites)[SL_SLIDER_BTN_NORM]->w;
+ vsliderInfo->thumbH = _GM(menuSprites)[SL_SLIDER_BTN_NORM]->h;
+
+ vsliderInfo->minThumbY = _GM(menuSprites)[SL_UP_BTN_NORM]->h + 1;
+ vsliderInfo->maxThumbY = _GM(menuSprites)[SL_UP_BTN_NORM]->h + _GM(menuSprites)[SL_SCROLL_BAR]->h
+ - _GM(menuSprites)[SL_SLIDER_BTN_NORM]->h - 1;
+
+ // Calculate the initial thumbY
+ vsliderInfo->percent = imath_max(imath_min(initPercent, 100), 0);
+ vsliderInfo->thumbY = vsliderInfo->minThumbY +
+ ((vsliderInfo->percent * (vsliderInfo->maxThumbY - vsliderInfo->minThumbY)) / 100);
+
+ newItem->itemInfo = (void *)vsliderInfo;
+
+ newItem->redraw = menu_DrawVSlider;
+ newItem->destroy = item_Destroy;
+ newItem->itemEventHandler = vslider_Handler;
+
+ // Draw the vslider in now
+ (newItem->redraw)(newItem, (void *)myMenu, x, y, 0, 0);
+
+ // See if the screen is currently visible
+ myScreen = vmng_screen_find((void *)myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + newItem->x1, myScreen->y1 + newItem->y1,
+ myScreen->x1 + newItem->x2, myScreen->y1 + newItem->y2);
+ }
+
+ return newItem;
+}
+
+
+void menu_DisableVSlider(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+ menuItemVSlider *mySlider;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ mySlider = (menuItemVSlider *)myItem->itemInfo;
+ mySlider->itemFlags = VS_GREY;
+}
+
+
+void menu_EnableVSlider(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+ menuItemVSlider *mySlider;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ mySlider = (menuItemVSlider *)myItem->itemInfo;
+ mySlider->itemFlags = VS_NORM;
+}
+
+
+//----------------------------- TEXTFIELD MENU ITEM ---------------------------------//
+
+enum {
+ TF_NORM = 0,
+ TF_OVER = 1,
+ TF_GREY = 2
+};
+
+void menu_DrawTextField(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemTextField *myText = nullptr;
+ Buffer *myBuff = nullptr;
+ Buffer *backgroundBuff = nullptr;
+ Sprite *mySprite = nullptr;
+ char tempStr[64], tempChar;
+ int32 cursorX;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
+ return;
+ }
+
+ // If the item is marked transparent, get the background buffer
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+ }
+
+ // Get the button info and select the sprite
+ myText = (menuItemTextField *)myItem->itemInfo;
+
+ switch (myText->itemFlags) {
+ case TF_GREY:
+ mySprite = _GM(menuSprites)[SL_LINE_NORM];
+ break;
+
+ case TF_OVER:
+ mySprite = _GM(menuSprites)[SL_LINE_OVER];
+ break;
+
+ case TF_NORM:
+ default:
+ mySprite = _GM(menuSprites)[SL_LINE_OVER];
+ break;
+ }
+
+ // Get the menu buffer and draw the sprite to it
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // If the item is tagged as transparent, we need to fill in it's background behind it
+ if (backgroundBuff) {
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, x, y, backgroundBuff->w, backgroundBuff->h);
+ myItem->background->release();
+ }
+
+ // Draw the item sprite in
+ gui_DrawSprite(mySprite, myBuff, x, y);
+
+ //write in the special tag
+ gr_font_set_color(TEXT_COLOR_NORM_FOREGROUND);
+ Common::sprintf_s(tempStr, 64, "%02ld", myText->specialTag);
+ gr_font_set(_GM(menuFont));
+ gr_font_write(myBuff, tempStr, x + 4, y + 1, 0, -1);
+
+ //write in the text
+ gr_font_write(myBuff, &myText->prompt[0], x + 26, y + 1, 0, -1);
+
+ if (myText->itemFlags == TF_OVER) {
+ // Draw in the cursor
+ if (myText->cursor) {
+ tempChar = *myText->cursor;
+ *myText->cursor = '\0';
+ cursorX = gr_font_string_width(&myText->prompt[0], -1);
+ *myText->cursor = tempChar;
+
+ gr_color_set(TEXT_COLOR_OVER_FOREGROUND);
+ gr_vline(myBuff, x + cursorX + 26, y + 1, y + 12);
+ }
+ }
+
+ // Release the menu buffer
+ myMenu->menuBuffer->release();
+}
+
+
+bool textfield_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemTextField *myText;
+ bool redrawItem, execCallback, handled;
+ ScreenContext *myScreen;
+ int32 status, temp;
+ char tempStr[80], *tempPtr;
+
+ // Verify params
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return false;
+ }
+ myText = (menuItemTextField *)myItem->itemInfo;
+
+ if (myText->itemFlags == TF_GREY) {
+ return false;
+ }
+
+ redrawItem = false;
+ execCallback = false;
+ handled = true;
+
+ if (eventType == EVENT_MOUSE) {
+
+ switch (event) {
+ case _ME_L_click:
+ case _ME_doubleclick:
+ _GM(deleteSaveDesc) = false;
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ *currItem = theItem;
+ }
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ if (!*currItem) {
+ return true;
+ }
+ *currItem = nullptr;
+ if (menu_CursorInsideItem(myItem, x, y)) {
+ if (myText->itemFlags == TF_OVER) {
+ temp = strlen(myText->prompt);
+ if (temp > 0) {
+ Common::strcpy_s(tempStr, myText->prompt);
+ tempPtr = &tempStr[temp];
+ gr_font_set(_GM(menuFont));
+ temp = gr_font_string_width(tempStr, -1);
+ while ((tempPtr != &tempStr[0]) && (temp > x - myItem->x1 - 26)) {
+ *--tempPtr = '\0';
+ temp = gr_font_string_width(tempStr, -1);
+ }
+ myText->cursor = &myText->prompt[tempPtr - &tempStr[0]];
+ redrawItem = true;
+ }
+ } else if (event == _ME_doubleclick_release) {
+ execCallback = true;
+ }
+ }
+ break;
+
+ case _ME_move:
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+ }
+ } else if ((eventType == EVENT_KEY) && (myText->itemFlags == TF_OVER)) {
+ switch (event) {
+
+ case KEY_RETURN:
+ _GM(deleteSaveDesc) = false;
+ execCallback = true;
+ break;
+
+ case KEY_HOME:
+ _GM(deleteSaveDesc) = false;
+ myText->cursor = &myText->prompt[0];
+ redrawItem = true;
+ break;
+
+ case KEY_END:
+ _GM(deleteSaveDesc) = false;
+ myText->cursor = myText->promptEnd;
+ redrawItem = true;
+ break;
+
+ case KEY_LEFT:
+ _GM(deleteSaveDesc) = false;
+ if (myText->cursor > &myText->prompt[0]) {
+ myText->cursor--;
+ redrawItem = true;
+ }
+ break;
+
+ case KEY_RIGHT:
+ _GM(deleteSaveDesc) = false;
+ if (myText->cursor < myText->promptEnd) {
+ myText->cursor++;
+ redrawItem = true;
+ }
+ break;
+
+ case KEY_DELETE:
+ if (_GM(deleteSaveDesc)) {
+ myText->prompt[0] = '\0';
+ myText->promptEnd = &myText->prompt[0];
+ myText->cursor = myText->promptEnd;
+ redrawItem = true;
+ } else if (myText->cursor < myText->promptEnd) {
+ Common::strcpy_s(tempStr, (char *)(myText->cursor + 1));
+ Common::strcpy_s(myText->cursor, 80, tempStr);
+ myText->promptEnd--;
+ redrawItem = true;
+ }
+ break;
+
+ case KEY_BACKSP:
+ _GM(deleteSaveDesc) = false;
+ if (myText->cursor > &myText->prompt[0]) {
+ Common::strcpy_s(tempStr, myText->cursor);
+ myText->promptEnd--;
+ myText->cursor--;
+ Common::strcpy_s(myText->cursor, 80, tempStr);
+ redrawItem = true;
+ }
+ break;
+
+ default:
+ _GM(deleteSaveDesc) = false;
+ gr_font_set(_GM(menuFont));
+ temp = gr_font_string_width(&myText->prompt[0], -1);
+ if ((strlen(&myText->prompt[0]) < 79) && (temp < myText->pixWidth - 12) && (event >= 32) && (event <= 127)) {
+ if (myText->cursor < myText->promptEnd) {
+ Common::strcpy_s(tempStr, (char *)myText->cursor);
+ Common::sprintf_s(myText->cursor, 80, "%c%s", (char)event, tempStr);
+ } else {
+ *myText->cursor = (char)event;
+ *(myText->cursor + 1) = '\0';
+ }
+ myText->cursor++;
+ myText->promptEnd++;
+
+ redrawItem = true;
+ }
+ break;
+ }
+ }
+
+ // The only events a NORM textfield can respond to are doubleclick_release and <return> keypress
+ else if ((eventType == EVENT_KEY) && (event == KEY_RETURN)) {
+ execCallback = true;
+ }
+
+ //otherwise the event will not be handled
+ else {
+ return false;
+ }
+
+ // See if we need to redraw the button
+ if (redrawItem) {
+ (myItem->redraw)((void *)myItem, (void *)myItem->myMenu, myItem->x1, myItem->y1, 0, 0);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + myItem->x1, myScreen->y1 + myItem->y1,
+ myScreen->x1 + myItem->x2, myScreen->y1 + myItem->y2);
+ }
+ }
+
+ // See if we need to call the callback function
+ if (execCallback && myItem->callback) {
+ // digi_play(inv_click_snd, 2, 255, -1, inv_click_snd_room_lock);
+ (myItem->callback)((void *)myItem, (void *)myItem->myMenu);
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ *currItem = nullptr;
+ }
+ }
+
+ return handled;
+}
+
+
+menuItem *menu_TextFieldAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, int32 initFlags,
+ char *prompt, int32 specialTag, CALLBACK callback, bool transparent) {
+ menuItem *newItem;
+ menuItemTextField *textInfo;
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ // Allocate a new one
+ if ((newItem = (menuItem *)mem_alloc(sizeof(menuItem), "gui menu item")) == nullptr) {
+ return nullptr;
+ }
+
+ // Initialize the struct
+ newItem->next = myMenu->itemList;
+ newItem->prev = nullptr;
+ if (myMenu->itemList) {
+ myMenu->itemList->prev = newItem;
+ }
+ myMenu->itemList = newItem;
+
+ newItem->myMenu = (void *)myMenu;
+ newItem->tag = tag;
+ newItem->x1 = x;
+ newItem->y1 = y;
+ newItem->x2 = x + w - 1;
+ newItem->y2 = y + h - 1;
+ newItem->callback = callback;
+
+ if (!transparent) {
+ newItem->transparent = false;
+ newItem->background = nullptr;
+ } else {
+ newItem->transparent = true;
+ newItem->background = menu_CopyBackground(myMenu, x, y, w, h);
+ }
+
+ if ((textInfo = (menuItemTextField *)mem_alloc(sizeof(menuItemTextField), "menu item textfield")) == nullptr) {
+ return nullptr;
+ }
+ textInfo->itemFlags = initFlags;
+
+ textInfo->specialTag = specialTag;
+ textInfo->pixWidth = w - 27;
+ if (prompt) {
+ Common::strcpy_s(&textInfo->prompt[0], 80, prompt);
+ textInfo->promptEnd = &textInfo->prompt[strlen(prompt)];
+ } else {
+ textInfo->prompt[0] = '\0';
+ textInfo->promptEnd = &textInfo->prompt[0];
+ }
+ textInfo->cursor = textInfo->promptEnd;
+
+ newItem->itemInfo = (void *)textInfo;
+
+ newItem->redraw = menu_DrawTextField;
+ newItem->destroy = item_Destroy;
+ newItem->itemEventHandler = textfield_Handler;
+
+ // Draw the vslider in now
+ (newItem->redraw)(newItem, (void *)myMenu, x, y, 0, 0);
+
+ // See if the screen is currently visible
+ myScreen = vmng_screen_find((void *)myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + newItem->x1, myScreen->y1 + newItem->y1,
+ myScreen->x1 + newItem->x2, myScreen->y1 + newItem->y2);
+ }
+
+ return newItem;
+}
+
+//----------------------------- GAME MENU FUNCTIONS ---------------------------------//
+
+void DestroyGameMenu();
+
+bool menu_LoadSprites(const char *series, int32 numSprites) {
+ int32 i;
+
+ // Load in the game menu series
+ if (LoadSpriteSeries(series, &_GM(menuSeriesHandle), &_GM(menuSeriesOffset),
+ &_GM(menuSeriesPalOffset), _GM(menuPalette)) <= 0) {
+ return false;
+ }
+ _GM(menuSeriesResource) = mem_strdup(series);
+
+ // Update the palette for the menu
+ gr_pal_set_range(_GM(menuPalette), 59, 197); // rid
+
+ _GM(spriteCount) = numSprites;
+
+ // Create the _GM(menuSprites) array
+ if ((_GM(menuSprites) = (Sprite **)mem_alloc(sizeof(Sprite *) * _GM(spriteCount), "sprites array")) == nullptr) {
+ return false;
+ }
+
+ // Create the menu sprites
+ for (i = 0; i < _GM(spriteCount); i++) {
+ if ((_GM(menuSprites)[i] = CreateSprite(_GM(menuSeriesHandle), _GM(menuSeriesOffset), i, nullptr, nullptr)) == nullptr) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+void menu_UnloadSprites(void) {
+ int32 i;
+
+ if (!_GM(menuSeriesResource)) {
+ return;
+ }
+
+ // Unload the sprites from memory
+ rtoss(_GM(menuSeriesResource));
+ mem_free(_GM(menuSeriesResource));
+ _GM(menuSeriesResource) = nullptr;
+ _GM(menuSeriesHandle) = nullptr;
+ _GM(menuSeriesOffset) = -1;
+ _GM(menuSeriesPalOffset) = -1;
+
+ // Turf the sprites
+ for (i = 0; i < _GM(spriteCount); i++) {
+ mem_free((void *)_GM(menuSprites)[i]);
+ }
+
+ // Turf the sprites array
+ mem_free((void *)_GM(menuSprites));
+ _GM(menuSprites) = nullptr;
+ _GM(spriteCount) = 0;
+}
+
+
+bool menu_Initialize(RGB8 *myPalette) {
+ int32 i, memAvail;
+
+ // This procedure is called before *any* menu is created - the following global var is used
+ // By the menu_eventhandler() to trap events - it must be cleared.
+ _GM(menuCurrItem) = nullptr;
+
+ if (_G(menuSystemInitialized)) {
+ return true;
+ }
+
+ // Set this now to prevent re-entry into the menu system
+ _G(menuSystemInitialized) = true;
+
+ // Pause the game
+ game_pause(true);
+
+ // Hide the telegram window
+ // Hide_telegram_dialog(); // ripley shit again!
+
+ // Hide the interface
+ if (INTERFACE_VISIBLE) {
+ _GM(interfaceWasVisible) = true;
+ interface_hide();
+ } else {
+ _GM(interfaceWasVisible) = false;
+ }
+
+ _GM(menuPalette) = myPalette;
+ krn_fade_to_grey(_GM(menuPalette), 5, 1);
+
+ _GM(dumpedCodes) = false;
+ _GM(dumpedBackground) = false;
+
+ // Make sure we have enough memory
+ PurgeMem();
+ CompactMem();
+ memAvail = mem_avail();
+
+ // Dump the screen codes if necessary
+ if (memAvail < MEMORY_NEEDED) {
+ adv_GetCodeMemory();
+ _GM(dumpedCodes) = true;
+ memAvail = mem_avail();
+ }
+
+ // Dump the background if necessary
+ if (memAvail < MEMORY_NEEDED) {
+ adv_GetBackgroundMemory();
+ _GM(dumpedBackground) = true;
+ memAvail = mem_avail();
+ }
+
+ // If we still don't have enough memory, we are hosed
+ if (memAvail < MEMORY_NEEDED) {
+ return false;
+ }
+
+ // Load in the font
+ _GM(menuFont) = gr_font_load("FONTMENU.FNT");
+
+ // Alloc space for the save/load tables
+ if ((_GM(slotTitles) = (char **)mem_alloc(sizeof(char *) * MAX_SLOTS, "slot desc array")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < MAX_SLOTS; i++) {
+ if ((_GM(slotTitles)[i] = (char *)mem_alloc(80, "slot title")) == nullptr) {
+ return false;
+ }
+ }
+ if ((_GM(slotInUse) = (bool *)mem_alloc(sizeof(bool) * MAX_SLOTS, "slotUnUse array")) == nullptr) {
+ return false;
+ }
+
+ // Allocate space for the thumnail sprites
+ if ((_GM(thumbNails) = (Sprite **)mem_alloc(sizeof(Sprite *) * MAX_SLOTS, "thumbNail array")) == nullptr) {
+ return false;
+ }
+ for (i = 0; i < MAX_SLOTS; i++) {
+ if ((_GM(thumbNails)[i] = (Sprite *)mem_alloc(sizeof(Sprite), "thumbNail")) == nullptr) {
+ return false;
+ }
+ _GM(thumbNails)[i]->sourceHandle = nullptr;
+ }
+
+ return true;
+}
+
+
+void menu_Shutdown(bool fadeToColor) {
+ int32 i;
+
+ // Verify that we need to shutdown
+ if (!_G(menuSystemInitialized)) {
+ return;
+ }
+
+ _GM(menuCurrItem) = nullptr;
+
+ // Turf the font
+ gr_font_dealloc(_GM(menuFont));
+ _GM(menuFont) = nullptr;
+
+ // Turf the slot arrays
+ for (i = 0; i < MAX_SLOTS; i++) {
+ if (_GM(slotTitles)[i]) {
+ mem_free((void *)_GM(slotTitles)[i]);
+ }
+ }
+ mem_free((void *)_GM(slotTitles));
+ mem_free((void *)_GM(slotInUse));
+
+ // Turf the thumbnail sprites
+ for (i = 0; i < MAX_SLOTS; i++) {
+ if (_GM(thumbNails)[i]) {
+ mem_free((void *)_GM(thumbNails)[i]);
+ }
+ }
+ mem_free((void *)_GM(thumbNails));
+
+ // Restore the background and codes if necessary
+ PurgeMem();
+ CompactMem();
+ if (_GM(dumpedBackground)) {
+ if (!adv_restoreBackground()) {
+ error_show(FL, 0, "unable to restore background");
+ }
+ }
+ if (_GM(dumpedCodes)) {
+ if (!adv_restoreCodes()) {
+ error_show(FL, 0, "unable to restore screen codes");
+ }
+ }
+
+ // Fade the screen - up to color if the game resumes, down to black if a new game was loaded
+ if (fadeToColor) {
+ krn_fade_from_grey(_GM(menuPalette), 5, 1, TO_COLOR);
+ } else {
+ krn_fade_from_grey(_GM(menuPalette), 5, 1, TO_BLACK);
+ }
+
+ // See if the interface needs to be restored
+ if (_GM(interfaceWasVisible)) {
+ interface_show();
+ }
+
+ // Allow the mouse to change from a clock
+ UnlockMouseSprite();
+
+ // Unpause the game
+ game_pause(false);
+
+ // Menu is now uninitialized
+ _G(menuSystemInitialized) = false;
+}
+
+
+bool menu_EventHandler(void *theMenu, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
+
+
+GrBuff *menu_CopyBackground(guiMenu *myMenu, int32 x, int32 y, int32 w, int32 h) {
+ GrBuff *copyOfBackground;
+ Buffer *srcBuff, *destBuff;
+
+ // Verify params
+ if ((!myMenu) || (!myMenu->menuBuffer)) {
+ return nullptr;
+ }
+
+ // Create a new grbuff struct
+ copyOfBackground = new GrBuff(w, h);
+ if (!copyOfBackground) {
+ return nullptr;
+ }
+
+ // Get the source and destination buffers
+ srcBuff = myMenu->menuBuffer->get_buffer();
+ destBuff = copyOfBackground->get_buffer();
+ if ((!srcBuff) || (!destBuff)) {
+ return nullptr;
+ }
+
+ // Copy the rect
+ gr_buffer_rect_copy_2(srcBuff, destBuff, x, y, 0, 0, w, h);
+
+ // Now release the buffers
+ myMenu->menuBuffer->release();
+ copyOfBackground->release();
+
+ return copyOfBackground;
+}
+
+
+void menu_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
+ ScreenContext *myScreen = (ScreenContext *)s;
+ RectList *myRectList = (RectList *)r;
+ Buffer *destBuffer = (Buffer *)b;
+ guiMenu *myMenu;
+ GrBuff *myMenuBuffer;
+ Buffer *myBuffer;
+ RectList *myRect;
+
+ // Parameter verification
+ if (!myScreen) {
+ return;
+ }
+ myMenu = (guiMenu *)(myScreen->scrnContent);
+ if (!myMenu) {
+ return;
+ }
+ myMenuBuffer = myMenu->menuBuffer;
+ if (!myMenuBuffer) {
+ return;
+ }
+ myBuffer = myMenuBuffer->get_buffer();
+ if (!myBuffer) {
+ return;
+ }
+
+ // If no destBuffer, then draw directly to video
+ if (!destBuffer) {
+ myRect = myRectList;
+ while (myRect) {
+ vmng_refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, myBuffer);
+ myRect = myRect->next;
+ }
+ }
+
+ // Else draw to the dest buffer
+ else {
+ myRect = myRectList;
+ while (myRect) {
+ gr_buffer_rect_copy_2(myBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
+ destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
+ myRect = myRect->next;
+ }
+ }
+
+ // Release myBuffer
+ myMenuBuffer->release();
+}
+
+
+guiMenu *menu_Create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFlags) {
+ guiMenu *newMenu;
+ Buffer *tempBuff, drawSpriteBuff;
+ DrawRequest spriteDrawReq;
+
+ // Verify params
+ if (!backgroundSprite) {
+ return nullptr;
+ }
+
+ if ((newMenu = (guiMenu *)mem_alloc(sizeof(guiMenu), "gui menu")) == nullptr) {
+ return nullptr;
+ }
+ newMenu->menuBuffer = new GrBuff(backgroundSprite->w, backgroundSprite->h);
+ newMenu->itemList = nullptr;
+ newMenu->cb_return = nullptr;
+ newMenu->cb_esc = nullptr;
+ newMenu->menuEventHandler = menu_EventHandler;
+
+ // Draw the background in to the menuBuffer
+ tempBuff = newMenu->menuBuffer->get_buffer();
+
+ // Copy background into menu-buffer because it is not rectangular (matte ink effect)
+ Buffer *matte = _G(gameDrawBuff)->get_buffer(); // get a pointer to the game background buffer
+ if (tempBuff->h > (_G(gameDrawBuff)->h - y1)) { // if temp buffer is going to hang off the bottom of the game buffer
+ gr_buffer_rect_copy_2(matte, tempBuff, x1, y1, 0, 0, tempBuff->w, _G(gameDrawBuff)->h - y1); // copy the differnce
+ } else {
+ gr_buffer_rect_copy_2(matte, tempBuff, x1, y1, 0, 0, tempBuff->w, tempBuff->h); // copy all of it
+ }
+ _G(gameDrawBuff)->release(); // release the buffer so it can be moved if nesessary
+
+ // draw the sprite
+ if (backgroundSprite->sourceHandle) {
+ HLock(backgroundSprite->sourceHandle);
+ backgroundSprite->data = (uint8 *)((int32) * (backgroundSprite->sourceHandle) + backgroundSprite->sourceOffset);
+
+ drawSpriteBuff.w = backgroundSprite->w;
+ drawSpriteBuff.stride = backgroundSprite->w;
+ drawSpriteBuff.h = backgroundSprite->h;
+ drawSpriteBuff.encoding = (backgroundSprite->encoding) & (uint8)0x7f;
+ drawSpriteBuff.data = backgroundSprite->data;
+
+ spriteDrawReq.Src = &drawSpriteBuff;
+ spriteDrawReq.Dest = tempBuff;
+ spriteDrawReq.x = 0;
+ spriteDrawReq.y = 0;
+ spriteDrawReq.scaleX = 100;
+ spriteDrawReq.scaleY = 100;
+ spriteDrawReq.srcDepth = 0;
+ spriteDrawReq.depthCode = nullptr;
+ spriteDrawReq.Pal = nullptr;
+ spriteDrawReq.ICT = nullptr;
+
+ gr_sprite_draw(&spriteDrawReq);
+
+ // Unlock the handle
+ HUnLock(backgroundSprite->sourceHandle);
+ }
+ // Release the tempBuffer
+ newMenu->menuBuffer->release();
+
+ if (!vmng_screen_create(x1, y1, x1 + backgroundSprite->w - 1, y1 + backgroundSprite->h - 1, 69, scrnFlags, (void *)newMenu,
+ (RefreshFunc)menu_Show, menu_EventHandler)) {
+ return nullptr;
+ }
+
+ return newMenu;
+}
+
+
+void menu_Destroy(guiMenu *myMenu) {
+ menuItem *myItem;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ // Destroy the items
+ myItem = myMenu->itemList;
+ while (myItem) {
+ myMenu->itemList = myItem->next;
+ (myItem->destroy)((void *)myItem);
+ myItem = myMenu->itemList;
+ }
+
+ // Destroy the buffer
+ delete myMenu->menuBuffer;
+
+ // Destroy the menu
+ mem_free((void *)myMenu);
+}
+
+void menu_Configure(guiMenu *myMenu, CALLBACK cb_return, CALLBACK cb_esc) {
+ if (!myMenu) {
+ return;
+ }
+ myMenu->cb_return = cb_return;
+ myMenu->cb_esc = cb_esc;
+}
+
+bool menu_EventHandler(void *theMenu, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen) {
+ ScreenContext *myScreen;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItem *myItem;
+ int32 status, menuX, menuY;
+ bool handled;
+ static int32 movingX;
+ static int32 movingY;
+ static bool movingScreen = false;
+
+ // Initialize the vars
+ handled = false;
+ *currScreen = false;
+
+ // Make sure the screen exists and is active
+ myScreen = vmng_screen_find(theMenu, &status);
+ if ((!myScreen) || (status != SCRN_ACTIVE)) {
+ return false;
+ }
+
+ // If the escape key was pressed, it takes priority over items handling the event
+ if ((eventType == EVENT_KEY) && (parm1 == KEY_ESCAPE)) {
+ if (myMenu->cb_esc) {
+ _GM(menuCurrItem) = nullptr;
+ (myMenu->cb_esc)(nullptr, theMenu);
+ return true;
+ }
+ }
+
+ // If the return key was pressed, it takes priority over items handling the event
+ if ((eventType == EVENT_KEY) && (parm1 == KEY_RETURN)) {
+ if (myMenu->cb_return) {
+ _GM(menuCurrItem) = nullptr;
+ (myMenu->cb_return)(nullptr, theMenu);
+ return true;
+ }
+ }
+
+ // Convert the global coordinates to coords relative to the menu
+ menuX = parm2 - myScreen->x1;
+ menuY = parm3 - myScreen->y1;
+
+ // If we are currently handling the events for an item, continue until that item releases control
+ if (_GM(menuCurrItem)) {
+ handled = (_GM(menuCurrItem)->itemEventHandler)(_GM(menuCurrItem), eventType, parm1, menuX, menuY, (void **)&_GM(menuCurrItem));
+ if (_GM(menuCurrItem)) {
+ *currScreen = true;
+ }
+ if (handled) {
+ return true;
+ }
+ }
+
+ // See what kind of event we have
+ if (eventType == EVENT_MOUSE) {
+ // Scroll through the list of items until we find one that the cursor is on top of
+ myItem = myMenu->itemList;
+ while (myItem && (!((menuX >= myItem->x1) && (menuX <= myItem->x2) &&
+ (menuY >= myItem->y1) && (menuY <= myItem->y2)))) {
+ myItem = myItem->next;
+ }
+
+ // If an item is found, then if it has an event handler, handle the event and return true
+ if (myItem) {
+ if (myItem->itemEventHandler) {
+ (myItem->itemEventHandler)(myItem, eventType, parm1, menuX, menuY, (void **)&_GM(menuCurrItem));
+ if (_GM(menuCurrItem)) {
+ *currScreen = true;
+ }
+ return true;
+ }
+ }
+ }
+
+ else if (eventType == EVENT_KEY) {
+ // Else the event is a key event - loop through - see if anyone grabs it
+ myItem = myMenu->itemList;
+ while (myItem && (!handled)) {
+ if (myItem->itemEventHandler) {
+ handled = (myItem->itemEventHandler)(myItem, eventType, parm1, -1, -1, nullptr);
+ }
+ myItem = myItem->next;
+ }
+ return handled;
+ }
+
+ //otherwise the event is not handled by any of the menu items. Let the menu screen itself handle the event
+
+ switch (parm1) {
+ case _ME_L_click:
+ case _ME_doubleclick:
+ if (!(myScreen->scrnFlags & SF_IMMOVABLE)) {
+ *currScreen = true;
+ movingScreen = true;
+ movingX = parm2;
+ movingY = parm3;
+ }
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ if (movingScreen) {
+ MoveScreenDelta(myScreen, parm2 - movingX, parm3 - movingY);
+ movingX = parm2;
+ movingY = parm3;
+ }
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ *currScreen = false;
+ movingScreen = false;
+ break;
+
+ case _ME_move:
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+ }
+ return true;
+}
+
+menuItem *menu_GetItem(int32 tag, guiMenu *myMenu) {
+ menuItem *myItem;
+
+ // Verify params
+ if (!myMenu) {
+ return nullptr;
+ }
+
+ myItem = myMenu->itemList;
+ while (myItem && (myItem->tag != tag)) {
+ myItem = myItem->next;
+ }
+
+ return myItem;
+}
+
+
+void menu_ItemDelete(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+
+ Buffer *myBuff, *backgroundBuff;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if (!myItem) {
+ return;
+ }
+
+ // Remove myItem from the item list
+ if (myItem->next) {
+ myItem->next->prev = myItem->prev;
+ }
+ if (myItem->prev) {
+ myItem->prev->next = myItem->next;
+ } else {
+ myMenu->itemList = myItem->next;
+ }
+
+ // If the item is marked transparent, we can remove it from the menu
+ if (myItem->transparent) {
+ if (!myItem->background) {
+ return;
+ }
+ backgroundBuff = myItem->background->get_buffer();
+ if (!backgroundBuff) {
+ return;
+ }
+
+ // Get the menu buffer and draw the sprite to it
+ myBuff = myMenu->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ // Copy the clean piece of the background to the menu buffer
+ gr_buffer_rect_copy_2(backgroundBuff, myBuff, 0, 0, myItem->x1, myItem->y1, backgroundBuff->w, backgroundBuff->h);
+
+ // Release both buffers
+ myMenu->menuBuffer->release();
+ myItem->background->release();
+ }
+
+ // Destroy the item;
+ if (myItem->destroy) {
+ myItem->destroy((void *)myItem);
+ }
+}
+
+void menu_ItemRefresh(menuItem *myItem, int32 tag, guiMenu *myMenu) {
+ ScreenContext *myScreen;
+ int32 status;
+
+ // Verify params
+ if (!myMenu) {
+ return;
+ }
+
+ if (!myItem) {
+ myItem = menu_GetItem(tag, myMenu);
+ }
+ if (!myItem) {
+ return;
+ }
+
+ // Draw myItem
+ (myItem->redraw)(myItem, (void *)myItem->myMenu, myItem->x1, myItem->y1, 0, 0);
+
+ // Update the video
+ myScreen = vmng_screen_find((void *)myItem->myMenu, &status);
+ if (myScreen && (status == SCRN_ACTIVE)) {
+ RestoreScreens(myScreen->x1 + myItem->x1, myScreen->y1 + myItem->y1,
+ myScreen->x1 + myItem->x2, myScreen->y1 + myItem->y2);
+ }
+}
+
+//------------------------------------- GAME MENU -------------------------------------//
+
+void cb_Game_Quit(void *, void *) {
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ // Shutdown the menu system
+ menu_Shutdown(false);
+
+ // Set the global that will cause the entire game to exit to dos
+ _G(kernel).going = false;
+}
+
+void cb_Game_Resume(void *, void *) {
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ // Shutdown the menu system
+ menu_Shutdown(true);
+}
+
+void cb_Game_Save(void *, void *) {
+
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ // Create the save game menu
+ CreateSaveMenu(nullptr);
+}
+
+void cb_Game_Load(void *, void *) {
+
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ // Create the save game menu
+ CreateLoadMenu(nullptr);
+}
+
+void cb_Game_Main(void *, void *) {
+
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ if (!_GM(gameMenuFromMain)) {
+
+ // Save the game so we can resume from here if possible
+ if (_GM(interfaceWasVisible) && player_commands_allowed()) {
+ other_save_game_for_resurrection();
+ }
+
+ // Make sure the interface does not reappear
+ _GM(interfaceWasVisible) = false;
+
+ // Shutdown the menu system
+ menu_Shutdown(false);
+ } else {
+ menu_Shutdown(true);
+ }
+
+ // Go to the main menu in room 494
+ _G(game).new_section = 4;
+ _G(game).new_room = 494;
+}
+
+void cb_Game_Options(void *, void *) {
+
+ // Destroy the game menu
+ DestroyGameMenu();
+
+ // Create the options menu
+ CreateOptionsMenu(nullptr);
+}
+
+
+void DestroyGameMenu(void) {
+ if (!_GM(gameMenu)) {
+ return;
+ }
+
+ // Remove the screen from the gui
+ vmng_screen_dispose(_GM(gameMenu));
+
+ // Destroy the menu resources
+ menu_Destroy(_GM(gameMenu));
+
+ // Unload the menu sprites
+ menu_UnloadSprites();
+}
+
+
void CreateGameMenuMain(RGB8 *myPalette) {
- error("TODO: CreateGameMenuMain");
+ if (!_G(menuSystemInitialized)) {
+ menu_Initialize(myPalette);
+ }
+
+ // Keep the memory tidy
+ PurgeMem();
+ CompactMem();
+
+ // Load in the game menu sprites
+ if (!menu_LoadSprites("gamemenu", GM_TOTAL_SPRITES)) {
+ return;
+ }
+
+ _GM(gameMenu) = menu_Create(_GM(menuSprites)[GM_DIALOG_BOX], GAME_MENU_X, GAME_MENU_Y, MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
+ if (!_GM(gameMenu)) {
+ return;
+ }
+
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_MAIN, GM_MAIN_X, GM_MAIN_Y, GM_MAIN_W, GM_MAIN_H, cb_Game_Main);
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_OPTIONS, GM_OPTIONS_X, GM_OPTIONS_Y, GM_OPTIONS_W, GM_OPTIONS_H, cb_Game_Options);
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_RESUME, GM_RESUME_X, GM_RESUME_Y, GM_RESUME_W, GM_RESUME_H, cb_Game_Resume);
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_QUIT, GM_QUIT_X, GM_QUIT_Y, GM_QUIT_W, GM_QUIT_H, cb_Game_Quit);
+
+ if (!_GM(gameMenuFromMain)) {
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_SAVE, GM_SAVE_X, GM_SAVE_Y, GM_SAVE_W, GM_SAVE_H, cb_Game_Save);
+ } else {
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_SAVE, GM_SAVE_X, GM_SAVE_Y, GM_SAVE_W, GM_SAVE_H, cb_Game_Save, BTN_TYPE_GM_GENERIC, true);
+ }
+
+ // See if there are any games to load
+ if (g_engine->savesExist()) {
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_LOAD, GM_LOAD_X, GM_LOAD_Y, GM_LOAD_W, GM_LOAD_H, cb_Game_Load);
+ } else {
+ menu_ButtonAdd(_GM(gameMenu), GM_TAG_LOAD, GM_LOAD_X, GM_LOAD_Y, GM_LOAD_W, GM_LOAD_H, cb_Game_Load, BTN_TYPE_GM_GENERIC, true);
+ }
+
+ // Configure the game so pressing <esc> will cause the menu to disappear and the game to resume
+ menu_Configure(_GM(gameMenu), cb_Game_Resume, cb_Game_Resume);
+
+ vmng_screen_show((void *)_GM(gameMenu));
+ LockMouseSprite(0);
+}
+
+
+//---------------------------------- OPTIONS MENU -------------------------------------//
+
+void DestroyOptionsMenu();
+
+
+void cb_Options_Game_Cancel(void *, void *) {
+ // reset values of items to what they were when options menu came up
+ digi_set_overall_volume(_GM(remember_digi_volume));
+ _G(flags)[digestability] = _GM(remember_digestability);
+
+ // Destroy the options menu
+ DestroyOptionsMenu();
+
+ // Create the options menu
+ CreateGameMenuMain(nullptr);
+}
+
+void cb_Options_Game_Done(void *, void *) {
+ // Destroy the options menu
+ DestroyOptionsMenu();
+
+ // Create the options menu
+ CreateGameMenuMain(nullptr);
+}
+
+void cb_Options_Digi(void *theItem, void *theMenu) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemHSlider *mySlider;
+
+ mySlider = (menuItemHSlider *)myItem->itemInfo;
+ // Set the digi volume
+ digi_set_overall_volume(mySlider->percent);
+ term_message("digi volume: %ld", mySlider->percent);
+
+ // this scroller control has been moved, so make sure that the DONE button is not greyed out
+ menu_EnableButton(nullptr, OM_TAG_DONE, myMenu);
+ menu_ItemRefresh(nullptr, OM_TAG_DONE, myMenu);
+
+}
+
+void cb_Options_Digestability(void *theItem, void *theMenu) {
+ menuItem *myItem = (menuItem *)theItem;
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItemHSlider *mySlider;
+
+ mySlider = (menuItemHSlider *)myItem->itemInfo;
+ // Set the midi volume
+ term_message("digestability: %ld", mySlider->percent);
+ _G(flags)[digestability] = mySlider->percent;
+
+ // this scroller control has been moved, so make sure that the DONE button is not greyed out
+ menu_EnableButton(nullptr, OM_TAG_DONE, myMenu);
+ menu_ItemRefresh(nullptr, OM_TAG_DONE, myMenu);
+}
+
+void DestroyOptionsMenu(void) {
+
+ if (!_GM(opMenu)) {
+ return;
+ }
+
+ // Remove the screen from the gui
+ vmng_screen_dispose(_GM(opMenu));
+
+ // Destroy the menu resources
+ menu_Destroy(_GM(opMenu));
+
+ // Unload the menu sprites
+ menu_UnloadSprites();
+}
+
+
+void CreateOptionsMenu(RGB8 *myPalette) {
+ if (!_G(menuSystemInitialized)) {
+ menu_Initialize(myPalette);
+ }
+
+ // Keep the memory tidy
+ PurgeMem();
+ CompactMem();
+
+ // Load in the game menu sprites
+ if (!menu_LoadSprites("opmenu", OM_TOTAL_SPRITES)) {
+ return;
+ }
+
+ _GM(opMenu) = menu_Create(_GM(menuSprites)[OM_DIALOG_BOX], OPTIONS_MENU_X, OPTIONS_MENU_Y, MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
+ if (!_GM(opMenu)) {
+ return;
+ }
+
+ menu_ButtonAdd(_GM(opMenu), OM_TAG_CANCEL, OM_CANCEL_X, OM_CANCEL_Y, OM_CANCEL_W, OM_CANCEL_H, cb_Options_Game_Cancel, BTN_TYPE_OM_CANCEL);
+ menu_ButtonAdd(_GM(opMenu), OM_TAG_DONE, OM_DONE_X, OM_DONE_Y, OM_DONE_W, OM_DONE_H, cb_Options_Game_Done, BTN_TYPE_OM_DONE, true);
+ menu_HSliderAdd(_GM(opMenu), OM_TAG_DIGI, OM_DIGI_X, OM_DIGI_Y, OM_DIGI_W, OM_DIGI_H, digi_get_overall_volume(), cb_Options_Digi, true);
+ menu_HSliderAdd(_GM(opMenu), OM_TAG_DIGESTABILITY, OM_DIGESTABILITY_X, OM_DIGESTABILITY_Y,
+ OM_DIGESTABILITY_W, OM_DIGESTABILITY_H, _G(flags)[digestability], cb_Options_Digestability, true);
+
+ // remember the values of the items in case the user cancels
+ _GM(remember_digi_volume) = digi_get_overall_volume();
+ _GM(remember_digestability) = _G(flags)[digestability];
+
+ // Configure the game so pressing <esc> will cause the menu to disappear and the gamemenu to reappear
+ menu_Configure(_GM(opMenu), cb_Options_Game_Done, cb_Options_Game_Cancel);
+
+ vmng_screen_show((void *)_GM(opMenu));
+ LockMouseSprite(0);
+}
+
+//------------------------------------------------------------------------------------//
+//-------------------------------- ERR MENU --------------------------------------//
+//------------------------------------------------------------------------------------//
+
+void DestroyErrMenu(void);
+
+void cb_Err_Done(void *, void *) {
+ // Destroy the game menu
+ DestroyErrMenu();
+
+ // Shutdown the menu system
+ menu_Shutdown(true);
+}
+
+
+void DestroyErrMenu(void) {
+ if (!_GM(errMenu)) {
+ return;
+ }
+
+ // Remove the screen from the gui
+ vmng_screen_dispose(_GM(errMenu));
+
+ // Destroy the menu resources
+ menu_Destroy(_GM(errMenu));
+
+ // Unload the menu sprites
+ menu_UnloadSprites();
+}
+
+
+void CreateErrMenu(RGB8 *myPalette) {
+ Buffer *myBuff;
+
+ if (!_G(menuSystemInitialized)) {
+ menu_Initialize(myPalette);
+ }
+
+ // Keep the memory tidy
+ PurgeMem();
+ CompactMem();
+
+ // Load in the game menu sprites
+ if (!menu_LoadSprites("errmenu", 5)) {
+ return;
+ }
+
+ _GM(errMenu) = menu_Create(_GM(menuSprites)[EM_DIALOG_BOX], ERROR_MENU_X, ERROR_MENU_Y, MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
+ if (!_GM(errMenu)) {
+ return;
+ }
+
+ // Get the menu buffer
+ myBuff = _GM(errMenu)->menuBuffer->get_buffer();
+ if (!myBuff) {
+ return;
+ }
+
+ //write the err message
+ gr_font_set_color(TEXT_COLOR_NORM_FOREGROUND);
+ gr_font_write(myBuff, "Save game failed!", 48, 8, 0, -1);
+
+ gr_font_write(myBuff, "A disk error has", 48, 23, 0, -1);
+ gr_font_write(myBuff, "occurred.", 48, 33, 0, -1);
+
+ gr_font_write(myBuff, "Please ensure you", 48, 48, 0, -1);
+ gr_font_write(myBuff, "have write access", 48, 58, 0, -1);
+ gr_font_write(myBuff, "and sufficient", 48, 68, 0, -1);
+ gr_font_write(myBuff, "disk space (40k).", 48, 78, 0, -1);
+
+ _GM(errMenu)->menuBuffer->release();
+
+ // Add the done button
+ menu_ButtonAdd(_GM(errMenu), EM_TAG_RETURN, EM_RETURN_X, EM_RETURN_Y, EM_RETURN_W, EM_RETURN_H, cb_Err_Done);
+
+ // Configure the game so pressing <esc> will cause the menu to disappear and the gamemenu to reappear
+ menu_Configure(_GM(errMenu), cb_Err_Done, cb_Err_Done);
+
+ vmng_screen_show((void *)_GM(errMenu));
+ LockMouseSprite(0);
+}
+
+
+//-------------------------------- SAVE / LOAD MENU -----------------------------------//
+
+void DestroySaveLoadMenu(bool saveMenu);
+void cb_SaveLoad_Slot(void *theItem, void *theMenu);
+bool load_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem);
+
+
+bool LoadThumbNail(int32 slotNum) {
+#ifdef TODO
+ char saveFN[256];
+ Common::File f;
+ int32 byteCount;
+ bool errFlag;
+
+ errFlag = false;
+ Common::sprintf_s(saveFN, "%s\\%s%03d.SAV", homeDir, "BURG", slotNum + 1);
+ handle = fopen(saveFN, "rb");
+ if (!handle) {
+ errFlag = true;
+ }
+
+ // First seek past the save game description
+ if (!errFlag) {
+ if (!fread(&byteCount, sizeof(int32), 1, handle)) {
+ errFlag = true;
+ }
+ }
+ if (!errFlag) {
+ if (fseek(handle, byteCount, SEEK_CUR) != 0) {
+ errFlag = true;
+ }
+ }
+
+ // Read in the sprite structure
+ if (!errFlag) {
+ byteCount = sizeof(Sprite);
+ if (!fread(_GM(thumbNails)[slotNum], sizeof(Sprite), 1, handle)) {
+ errFlag = true;
+ }
+ }
+
+ // Read in the size of the thumbnail data
+ if (!errFlag) {
+ if (!fread(&byteCount, sizeof(int32), 1, handle)) {
+ errFlag = true;
+ }
+ }
+
+ // Now create a handle to hold the sprite data
+ if (!errFlag) {
+ if ((_GM(thumbNails)[slotNum]->sourceHandle = NewHandle(byteCount, "thumbNail source")) == nullptr) {
+ errFlag = true;
+ }
+ _GM(thumbNails)[slotNum]->sourceOffset = 0;
+ }
+
+ // Lock the handle, and read the thumbnail data in
+ if (!errFlag) {
+ HLock(_GM(thumbNails)[slotNum]->sourceHandle);
+ _GM(thumbNails)[slotNum]->data = (uint8 *)((int32) * (_GM(thumbNails)[slotNum]->sourceHandle) + _GM(thumbNails)[slotNum]->sourceOffset);
+ if (!fread(_GM(thumbNails)[slotNum]->data, byteCount, 1, handle)) {
+ errFlag = true;
+ }
+ HUnLock(_GM(thumbNails)[slotNum]->sourceHandle);
+ }
+
+ // In case of an error, clean everything up
+ if (errFlag) {
+ if (_GM(thumbNails)[slotNum]->sourceHandle) {
+ DisposeHandle(_GM(thumbNails)[slotNum]->sourceHandle);
+ _GM(thumbNails)[slotNum]->sourceHandle = false;
+ }
+ _GM(slotInUse)[slotNum] = false;
+ Common::strcpy_s(_GM(slotTitles)[slotNum], "<empty>");
+ }
+ if (handle) {
+ fclose(handle);
+ }
+
+ if (errFlag) {
+ return false;
+ } else {
+ return true;
+ }
+#else
+ error("TODO: LoadThumbnail");
+#endif
+}
+
+
+void UnloadThumbNail(int32 slotNum) {
+ if (_GM(thumbNails)[slotNum]->sourceHandle) {
+ HUnLock(_GM(thumbNails)[slotNum]->sourceHandle);
+ DisposeHandle(_GM(thumbNails)[slotNum]->sourceHandle);
+ _GM(thumbNails)[slotNum]->sourceHandle = nullptr;
+ }
+}
+
+
+void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu) {
+ int32 i, startIndex, endIndex;
+
+ // Make sure there is something to update
+ if (firstSlot == _GM(thumbIndex)) {
+ return;
+ }
+
+ // Ensure firstSlot is in a valid range
+ firstSlot = imath_max(imath_min(firstSlot, 89), 0);
+
+ if (firstSlot > _GM(thumbIndex)) {
+
+ // Dump Out all thumbnails in slots which don't overlap
+ startIndex = _GM(thumbIndex);
+ endIndex = imath_min(_GM(thumbIndex) + 9, firstSlot - 1);
+ for (i = startIndex; i <= endIndex; i++) {
+ UnloadThumbNail(i);
+ }
+
+ // Load in all thumbnails missing thumbnails
+ startIndex = imath_max(_GM(thumbIndex) + 10, firstSlot);
+ endIndex = imath_min(firstSlot + 9, 98);
+ for (i = startIndex; i <= endIndex; i++) {
+ if (_GM(slotInUse)[i]) {
+ if (!LoadThumbNail(i)) {
+ _GM(slotInUse)[i] = false;
+ menu_DisableButton(nullptr, 1001 + i - firstSlot, myMenu);
+ menu_ItemRefresh(nullptr, 1001 + i - firstSlot, myMenu);
+ }
+ }
+ }
+ }
+
+ // Else firstSlot < _GM(thumbIndex)
+ else {
+
+ // Dump Out all thumbnails in slots which don't overlap
+ startIndex = imath_max(firstSlot + 10, _GM(thumbIndex));
+ endIndex = imath_min(_GM(thumbIndex) + 9, 98);
+ for (i = startIndex; i <= endIndex; i++) {
+ UnloadThumbNail(i);
+ }
+
+ // Load in all thumbnails missing thumbnails
+ startIndex = firstSlot;
+ endIndex = imath_min(firstSlot + 9, _GM(thumbIndex) - 1);
+ for (i = startIndex; i <= endIndex; i++) {
+ if (_GM(slotInUse)[i]) {
+ if (!LoadThumbNail(i)) {
+ _GM(slotInUse)[i] = false;
+ menu_DisableButton(nullptr, 1001 + i - firstSlot, myMenu);
+ menu_ItemRefresh(nullptr, 1001 + i - firstSlot, myMenu);
+ }
+ }
+ }
+ }
+
+ // Set the var
+ _GM(thumbIndex) = firstSlot;
+}
+
+
+void SetFirstSlot(int32 firstSlot, guiMenu *myMenu) {
+ menuItem *tempItem;
+ menuItemButton *myButton;
+ int32 i;
+
+ if (!myMenu) {
+ return;
+ }
+
+ // Ensure firstSlot is in a valid range
+ firstSlot = imath_max(imath_min(firstSlot, 89), 0);
+
+ // Change the prompt and special tag of each of the slot buttons
+ for (i = 0; i < MAX_SLOTS_SHOWN; i++) {
+ tempItem = menu_GetItem(i + 1001, myMenu);
+ myButton = (menuItemButton *)tempItem->itemInfo;
+ myButton->prompt = _GM(slotTitles)[firstSlot + i];
+ if (_GM(currMenuIsSave) || _GM(slotInUse)[firstSlot + i]) {
+ myButton->itemFlags = BTN_STATE_NORM;
+ } else {
+ myButton->itemFlags = BTN_STATE_GREY;
+ }
+ myButton->specialTag = firstSlot + i + 1;
+ menu_ItemRefresh(tempItem, i + 1001, myMenu);
+ }
+}
+
+
+void cb_SaveLoad_VSlider(void *theItem, void *theMenu) {
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemVSlider *mySlider;
+ bool redraw;
+
+ if ((!myMenu) || (!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ // Get my slider
+ mySlider = (menuItemVSlider *)myItem->itemInfo;
+
+ if ((mySlider->itemFlags & VS_COMPONENT) != VS_THUMB) {
+
+ redraw = false;
+ switch (mySlider->itemFlags & VS_COMPONENT) {
+
+ case VS_UP:
+ if (_GM(firstSlotIndex) > 0) {
+ _GM(firstSlotIndex)--;
+ redraw = true;
+ }
+ break;
+
+ case VS_PAGE_UP:
+ if (_GM(firstSlotIndex) > 0) {
+ _GM(firstSlotIndex) = imath_max(_GM(firstSlotIndex) - 10, 0);
+ redraw = true;
+ }
+ break;
+
+ case VS_PAGE_DOWN:
+ if (_GM(firstSlotIndex) < 89) {
+ _GM(firstSlotIndex) = imath_min(_GM(firstSlotIndex) + 10, 89);
+ redraw = true;
+ }
+ break;
+
+ case VS_DOWN:
+ if (_GM(firstSlotIndex) < 89) {
+ _GM(firstSlotIndex)++;
+ redraw = true;
+ }
+ break;
+ }
+
+ // See if we were able to set a new first slot index
+ if (redraw) {
+ SetFirstSlot(_GM(firstSlotIndex), myMenu);
+
+ // Calculate the new percent
+ mySlider->percent = (_GM(firstSlotIndex) * 100) / 89;
+
+ // Calculate the new thumbY
+ mySlider->thumbY = mySlider->minThumbY +
+ ((mySlider->percent * (mySlider->maxThumbY - mySlider->minThumbY)) / 100);
+
+ // Redraw the slider
+ menu_ItemRefresh(myItem, -1, myMenu);
+ }
+ }
+
+ // Else the callback came from the thumb - set the _GM(firstSlotIndex) based on the slider percent
+ else {
+ _GM(firstSlotIndex) = (mySlider->percent * 89) / 100;
+ SetFirstSlot(_GM(firstSlotIndex), myMenu);
+ }
+}
+
+
+void cb_SaveLoad_Save(void *, void *theMenu) {
+#ifdef TODO
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItem *myTextItem;
+ menuItemTextField *myText;
+ FILE *handle;
+ char saveFN[80], dummy;
+ bool fileExists, saveGameFailed;
+ int32 i;
+
+ // If (slotSelected < 0) this callback is being executed by pressing return prematurely
+ if (_GM(slotSelected) < 0) {
+ return;
+ }
+
+ // First make the textfield NORM
+ myTextItem = menu_GetItem(2000, myMenu);
+ if ((!myTextItem) || (!myTextItem->itemInfo)) {
+ return;
+ }
+ myText = (menuItemTextField *)myTextItem->itemInfo;
+ myText->itemFlags = TF_NORM;
+
+ // Set the vars
+ _GM(slotInUse)[_GM(slotSelected) - 1] = true;
+ Common::strcpy_s(_GM(slotTitles)[_GM(slotSelected) - 1], 80, myText->prompt);
+
+ // Save the game
+ // Copy the string so the save games will all be "RIPxxx.SAV"
+ strncpy(_G(game).save_file_name, "BURG", 8);
+ saveGameFailed = (bool)kernel_save_game(_GM(slotSelected), myText->prompt, 80, _GM(saveLoadThumbNail), _GM(sizeofThumbData));
+
+ // If the save game failed, bring up the err menu
+ if (saveGameFailed) {
+
+ // Kill the save menu
+ DestroySaveLoadMenu(true);
+
+ // Create the err menu
+ CreateErrMenu(nullptr);
+
+ // Abort this procedure
+ return;
+ }
+
+ // Now update the saves.dir file
+ // First open the file
+ fileExists = true;
+ Common::sprintf_s(saveFN, "%s\\saves.dir", homeDir);
+ handle = fopen(saveFN, "rb+");
+
+ // If it does not, open it, and create
+ if (!handle) {
+ handle = fopen(saveFN, "wb+");
+ fileExists = false;
+ }
+
+ // It should either be open and empty, open and readable
+ if (handle) {
+ // If the file doesn't exists, dump out all the slot titles
+ if (!fileExists) {
+ dummy = 0;
+ for (i = 0; i < MAX_SLOTS; i++) {
+ if (!fwrite(&dummy, 1, 1, handle)) {
+ break;
+ }
+ if (!fwrite(_GM(slotTitles)[i], 80, 1, handle)) {
+ break;
+ }
+ }
+ }
+ // seek to the position in the file containing the description for the slot selected
+ if (fseek(handle, (_GM(slotSelected) - 1) * 81, SEEK_SET) == 0) {
+ fwrite(&_GM(slotInUse)[_GM(slotSelected) - 1], 1, 1, handle);
+ fwrite(_GM(slotTitles)[_GM(slotSelected) - 1], 80, 1, handle);
+ }
+
+ // Close the handle
+ fclose(handle);
+ }
+
+ // Kill the save menu
+ DestroySaveLoadMenu(true);
+
+ // Shutdown the menu system
+ menu_Shutdown(true);
+#else
+ error("TODO: saving");
+#endif
+}
+
+
+void cb_SaveLoad_Load(void *, void *theMenu) {
+// guiMenu *myMenu = (guiMenu *)theMenu;
+ KernelTriggerType oldMode;
+
+ // If (slotSelected < 0) this callback is being executed by pressing return prematurely
+ if (_GM(slotSelected) < 0) {
+ return;
+ }
+
+ // Load the game
+ // Copy the string so the kernel_load_game will find a saved game of the format: "RIPxxx.SAV"
+// strncpy(_G(game).save_file_name, "BURG", 8);
+
+ // Kill the menu
+ DestroySaveLoadMenu(false);
+
+ // Shutdown the menu system
+ menu_Shutdown(false);
+
+ // See if we need to reset the ESC, F2, and F3 hotkeys
+ if (_GM(gameMenuFromMain)) {
+ AddSystemHotkey(KEY_ESCAPE, Burger::Hotkeys::escape_key_pressed);
+ AddSystemHotkey(KEY_F2, M4::Hotkeys::cb_F2);
+ AddSystemHotkey(KEY_F3, M4::Hotkeys::cb_F3);
+ }
+
+ // Start the restore process
+ _G(kernel).restore_slot = _GM(slotSelected);
+ oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch(kernel_trigger_create(TRIG_RESTORE_GAME));
+ _G(kernel).trigger_mode = oldMode;
+}
+
+
+void cb_SaveLoad_Cancel(void *, void *theMenu) {
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItem *myItem;
+ int32 i, x, y, w, h;
+
+ // If a slot has been selected, cancel will re-enable all slots
+ if (_GM(slotSelected) >= 0) {
+
+ // Enable the prev buttons
+ for (i = 1001; i <= 1010; i++) {
+ if (_GM(currMenuIsSave) || _GM(slotInUse)[i - 1001 + _GM(firstSlotIndex)]) {
+ menu_EnableButton(nullptr, i, myMenu);
+ menu_ItemRefresh(nullptr, i, myMenu);
+ }
+ }
+
+ // Find the textfield and use it's coords to place the button
+ myItem = menu_GetItem(2000, myMenu);
+ x = myItem->x1;
+ y = myItem->y1;
+ w = myItem->x2 - myItem->x1 + 1;
+ h = myItem->y2 - myItem->y1 + 1;
+
+ // Delete the textfield
+ menu_ItemDelete(myItem, 2000, myMenu);
+
+ // Add the button back in
+ if (_GM(currMenuIsSave)) {
+ menu_ButtonAdd(myMenu, 1000 + _GM(slotSelected) - _GM(firstSlotIndex), x, y, w, h,
+ cb_SaveLoad_Slot, BTN_TYPE_SL_TEXT, false, true, _GM(slotTitles)[_GM(slotSelected) - 1], button_Handler);
+ } else {
+ menu_ButtonAdd(myMenu, 1000 + _GM(slotSelected) - _GM(firstSlotIndex), x, y, w, h,
+ cb_SaveLoad_Slot, BTN_TYPE_SL_TEXT, false, true, _GM(slotTitles)[_GM(slotSelected) - 1], load_Handler);
+
+ // Remove the thumbnail
+ if (_GM(saveLoadThumbNail)) {
+ _GM(saveLoadThumbNail) = _GM(menuSprites)[SL_EMPTY_THUMB];
+ menu_ItemRefresh(nullptr, SL_TAG_THUMBNAIL, (guiMenu *)myItem->myMenu);
+ }
+ }
+ SetFirstSlot(_GM(firstSlotIndex), myMenu);
+
+ // Enable the slider
+ menu_EnableVSlider(nullptr, SL_TAG_VSLIDER, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_VSLIDER, myMenu);
+
+ // Disable the save/load button
+ if (_GM(currMenuIsSave)) {
+ menu_DisableButton(nullptr, SL_TAG_SAVE, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_SAVE, myMenu);
+ } else {
+ menu_DisableButton(nullptr, SL_TAG_LOAD, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_LOAD, myMenu);
+ }
+
+ // Reset the slot selected var
+ _GM(slotSelected) = -1;
+ }
+
+ //otherwise, back to the game menu
+ else {
+
+ // Destroy the menu
+ DestroySaveLoadMenu(_GM(currMenuIsSave));
+
+ if (_GM(saveLoadFromHotkey)) {
+ // Shutdown the menu system
+ menu_Shutdown(true);
+ } else {
+ // Create the game menu
+ CreateGameMenuMain(nullptr);
+ }
+ }
+}
+
+
+void cb_SaveLoad_Slot(void *theItem, void *theMenu) {
+ guiMenu *myMenu = (guiMenu *)theMenu;
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemButton *myButton;
+ int32 i, x, y, w, h;
+
+ // Verify params
+ if ((!myMenu) || (!myItem) || (!myItem->itemInfo)) {
+ return;
+ }
+
+ // Get the button
+ myButton = (menuItemButton *)myItem->itemInfo;
+
+ // Set the globals
+ _GM(slotSelected) = myButton->specialTag;
+ _GM(deleteSaveDesc) = true;
+
+ // Disable all other buttons
+ for (i = 1001; i <= 1010; i++) {
+ if (i != myItem->tag) {
+ menu_DisableButton(nullptr, i, myMenu);
+ menu_ItemRefresh(nullptr, i, myMenu);
+ }
+ }
+
+ // Get the slot coords, and delete it
+ x = myItem->x1;
+ y = myItem->y1;
+ w = myItem->x2 - myItem->x1 + 1;
+ h = myItem->y2 - myItem->y1 + 1;
+ menu_ItemDelete(myItem, -1, myMenu);
+
+ if (_GM(currMenuIsSave)) {
+ // Replace the current button with a textfield
+ if (!strcmp(myButton->prompt, "<empty>")) {
+ menu_TextFieldAdd(myMenu, 2000, x, y, w, h, TF_OVER,
+ nullptr, myButton->specialTag, cb_SaveLoad_Save, true);
+ } else {
+ menu_TextFieldAdd(myMenu, 2000, x, y, w, h, TF_OVER,
+ myButton->prompt, myButton->specialTag, cb_SaveLoad_Save, true);
+ }
+ } else {
+ menu_TextFieldAdd(myMenu, 2000, x, y, w, h, TF_NORM,
+ myButton->prompt, myButton->specialTag, cb_SaveLoad_Load, true);
+ }
+
+ // Disable the slider
+ menu_DisableVSlider(nullptr, SL_TAG_VSLIDER, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_VSLIDER, myMenu);
+
+ // Enable the save/load button
+ if (_GM(currMenuIsSave)) {
+ menu_EnableButton(nullptr, SL_TAG_SAVE, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_SAVE, myMenu);
+ } else {
+ menu_EnableButton(nullptr, SL_TAG_LOAD, myMenu);
+ menu_ItemRefresh(nullptr, SL_TAG_LOAD, myMenu);
+ }
+}
+
+
+void InitializeSlotTables(void) {
+#ifdef TODO
+ int32 i, j;
+ char saveFN[80];
+ FILE *handle;
+ int32 read1, read2;
+
+ Common::sprintf_s(saveFN, "%s\\saves.dir", homeDir);
+ handle = fopen(saveFN, "rb");
+
+ if (handle) {
+ for (i = 0; i < MAX_SLOTS; i++) {
+ read1 = fread(&_GM(slotInUse)[i], 1, 1, handle);
+ read2 = fread(_GM(slotTitles)[i], 80, 1, handle);
+ if ((!read1) || (!read2)) {
+ for (j = i; j < MAX_SLOTS; j++) {
+ _GM(slotInUse)[j] = false;
+ Common::strcpy_s(_GM(slotTitles)[j], "<empty>");
+ }
+ i = MAX_SLOTS;
+ }
+ }
+ fclose(handle);
+ } else {
+ for (i = 0; i < MAX_SLOTS; i++) {
+ Common::strcpy_s(_GM(slotTitles)[i], "<empty>");
+ _GM(slotInUse)[i] = false;
+ }
+ }
+#else
+ error("TODO: InitializeSlotTables");
+#endif
+}
+
+
+bool load_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
+ menuItem *myItem = (menuItem *)theItem;
+ menuItemButton *myButton;
+ bool handled;
+
+ // Handle the event just like any other button
+ handled = button_Handler(theItem, eventType, event, x, y, currItem);
+
+ // If we've selected a slot, we want the thumbNail to remain on the menu permanently
+ if (_GM(slotSelected) >= 0) {
+ return handled;
+ }
+
+ // But if the event moved the mouse, we want to display the correct thumbNail;
+ if ((eventType == EVENT_MOUSE) && ((event == _ME_move) || (event == _ME_L_drag) || (event == _ME_L_release) ||
+ (event == _ME_doubleclick_drag) || (event == _ME_doubleclick_release))) {
+
+ // Get the button
+ if ((!myItem) || (!myItem->itemInfo)) {
+ return handled;
+ }
+ myButton = (menuItemButton *)myItem->itemInfo;
+
+ // This determines that we are over the button
+ if ((myButton->itemFlags == BTN_STATE_OVER) || (myButton->itemFlags == BTN_STATE_PRESS)) {
+
+ // See if the current _GM(saveLoadThumbNail) is pointing to the correct sprite
+ if (_GM(saveLoadThumbNail) != _GM(thumbNails)[myButton->specialTag - 1]) {
+
+ _GM(saveLoadThumbNail) = _GM(thumbNails)[myButton->specialTag - 1];
+ menu_ItemRefresh(nullptr, SL_TAG_THUMBNAIL, (guiMenu *)myItem->myMenu);
+ }
+ }
+
+ // Else we must determine whether the thumbnail needs to be replaced with the empty thumbnail.
+ else {
+
+ // If the mouse has moved outside of the entire range of all 10 buttons,
+ //or it is over a button which is not hilited it is to be removed.
+ if (menu_CursorInsideItem(myItem, x, y)
+ || (x < SL_SCROLL_FIELD_X)
+ || (x > SL_SCROLL_FIELD_X + SL_SCROLL_FIELD_W)
+ || (y < SL_SCROLL_FIELD_Y)
+ || (y > SL_SCROLL_FIELD_Y + SL_SCROLL_FIELD_H)) {
+
+ // Remove the thumbnail
+ if (_GM(saveLoadThumbNail)) {
+ _GM(saveLoadThumbNail) = _GM(menuSprites)[SL_EMPTY_THUMB];
+ menu_ItemRefresh(nullptr, SL_TAG_THUMBNAIL, (guiMenu *)myItem->myMenu);
+ }
+ }
+ }
+ }
+ return handled;
+}
+
+
+void DestroySaveLoadMenu(bool saveMenu) {
+ int32 i;
+
+ if (!_GM(slMenu)) {
+ return;
+ }
+
+ // Determine whether the screen was the SAVE or the LOAD menu
+ if (saveMenu) {
+
+ // If SAVE, there should be a thumbnail to unload
+ if (_GM(saveLoadThumbNail)) {
+ DisposeHandle(_GM(saveLoadThumbNail)->sourceHandle);
+ mem_free(_GM(saveLoadThumbNail));
+ _GM(saveLoadThumbNail) = nullptr;
+ }
+ } else {
+ // Else there may be up to 10 somewhere in the list to be unloaded
+ for (i = 0; i < MAX_SLOTS; i++) {
+ UnloadThumbNail(i);
+ }
+ _GM(saveLoadThumbNail) = nullptr;
+ }
+
+ // Destroy the screen
+ vmng_screen_dispose(_GM(slMenu));
+ menu_Destroy(_GM(slMenu));
+
+ // Unload the save/load menu sprites
+ menu_UnloadSprites();
}
+
void CreateSaveLoadMenu(RGB8 *myPalette, bool saveMenu) {
- error("TODO: CreateSaveLoadMenu");
+ ItemHandlerFunction i_handler;
+ bool buttonGreyed;
+
+ if (!_G(menuSystemInitialized)) {
+ menu_Initialize(myPalette);
+ }
+
+ // Keep the memory tidy
+ PurgeMem();
+ CompactMem();
+
+ // Load in the game menu sprites
+ if (!menu_LoadSprites("slmenu", SL_TOTAL_SPRITES)) {
+ return;
+ }
+
+ // Initialize some global vars
+ _GM(firstSlotIndex) = 0;
+ _GM(slotSelected) = -1;
+ _GM(saveLoadThumbNail) = nullptr;
+ _GM(thumbIndex) = 100;
+ _GM(currMenuIsSave) = saveMenu;
+
+ _GM(slMenu) = menu_Create(_GM(menuSprites)[SL_DIALOG_BOX], SAVE_LOAD_MENU_X, SAVE_LOAD_MENU_Y,
+ MENU_DEPTH | SF_GET_ALL | SF_BLOCK_ALL | SF_IMMOVABLE);
+ if (!_GM(slMenu)) {
+ return;
+ }
+
+ if (_GM(currMenuIsSave)) {
+ menu_MsgAdd(_GM(slMenu), SL_TAG_SAVE_LABEL, SL_SAVE_LABEL_X, SL_SAVE_LABEL_Y, SL_SAVE_LABEL_W, SL_SAVE_LABEL_H);
+ menu_ButtonAdd(_GM(slMenu), SL_TAG_SAVE, SL_SAVE_X, SL_SAVE_Y, SL_SAVE_W, SL_SAVE_H,
+ cb_SaveLoad_Save, BTN_TYPE_SL_SAVE, true);
+ } else {
+ menu_MsgAdd(_GM(slMenu), SL_TAG_LOAD_LABEL, SL_LOAD_LABEL_X, SL_LOAD_LABEL_Y, SL_LOAD_LABEL_W, SL_LOAD_LABEL_H);
+ menu_ButtonAdd(_GM(slMenu), SL_TAG_LOAD, SL_LOAD_X, SL_LOAD_Y, SL_LOAD_W, SL_LOAD_H,
+ cb_SaveLoad_Load, BTN_TYPE_SL_LOAD, true);
+ }
+
+ menu_ButtonAdd(_GM(slMenu), SL_TAG_CANCEL, SL_CANCEL_X, SL_CANCEL_Y, SL_CANCEL_W, SL_CANCEL_H,
+ cb_SaveLoad_Cancel, BTN_TYPE_SL_CANCEL);
+
+ menu_VSliderAdd(_GM(slMenu), SL_TAG_VSLIDER, SL_SLIDER_X, SL_SLIDER_Y, SL_SLIDER_W, SL_SLIDER_H,
+ 0, cb_SaveLoad_VSlider);
+
+ InitializeSlotTables();
+
+ if (_GM(currMenuIsSave)) {
+ buttonGreyed = false;
+ i_handler = button_Handler;
+ } else {
+ buttonGreyed = true;
+ i_handler = load_Handler;
+ }
+ for (int32 i = 0; i < MAX_SLOTS_SHOWN; i++) {
+ menu_ButtonAdd(_GM(slMenu), 1001 + i,
+ SL_SCROLL_FIELD_X, SL_SCROLL_FIELD_Y + i * SL_SCROLL_LINE_H,
+ SL_SCROLL_LINE_W, SL_SCROLL_LINE_H,
+ cb_SaveLoad_Slot, BTN_TYPE_SL_TEXT,
+ buttonGreyed && (!_GM(slotInUse)[i]), true, _GM(slotTitles)[i], i_handler);
+ }
+
+ if (_GM(currMenuIsSave)) {
+ // Create the thumbnail
+ _GM(saveLoadThumbNail) = menu_CreateThumbnail(&_GM(sizeofThumbData));
+ } else {
+ UpdateThumbNails(0, _GM(slMenu));
+ _GM(saveLoadThumbNail) = _GM(menuSprites)[SL_EMPTY_THUMB];
+ }
+ menu_MsgAdd(_GM(slMenu), SL_TAG_THUMBNAIL, SL_THUMBNAIL_X, SL_THUMBNAIL_Y, SL_THUMBNAIL_W, SL_THUMBNAIL_H, false);
+
+ if (_GM(currMenuIsSave)) {
+ //<return> - if a slot has been selected, saves the game
+ //<esc> - cancels and returns to the game menu
+ menu_Configure(_GM(slMenu), cb_SaveLoad_Save, cb_SaveLoad_Cancel);
+ } else {
+ //<return> - if a slot has been selected, loads the selected game
+ //<esc> - cancels and returns to the game menu
+ menu_Configure(_GM(slMenu), cb_SaveLoad_Load, cb_SaveLoad_Cancel);
+ }
+
+ vmng_screen_show((void *)_GM(slMenu));
+ LockMouseSprite(0);
}
void CreateGameMenu(RGB8 *myPalette) {
- if (player_commands_allowed() && _GI(visible) && !_G(pal_fade_in_progress)
- && !_G(menuSystemInitialized)) {
- _G(gameMenuFromMain) = false;
- CreateGameMenuMain(myPalette);
+ if ((!player_commands_allowed()) || (!INTERFACE_VISIBLE) ||
+ _G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
+ return;
}
+ _GM(gameMenuFromMain) = false;
+ CreateGameMenuMain(myPalette);
}
void CreateGameMenuFromMain(RGB8 *myPalette) {
- if (!_G(pal_fade_in_progress) && _G(menuSystemInitialized)) {
- _G(gameMenuFromMain) = true;
- CreateGameMenuMain(myPalette);
+ if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
+ return;
+ }
+ _GM(gameMenuFromMain) = true;
+ CreateGameMenuMain(myPalette);
+}
+
+void CreateSaveMenu(RGB8 *myPalette) {
+ _GM(saveLoadFromHotkey) = false;
+ CreateSaveLoadMenu(myPalette, true);
+}
+
+void CreateF2SaveMenu(RGB8 *myPalette) {
+ if ((!player_commands_allowed()) || (!INTERFACE_VISIBLE) ||
+ _G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
+ return;
+ }
+ _GM(saveLoadFromHotkey) = true;
+ _GM(gameMenuFromMain) = false;
+ CreateSaveLoadMenu(myPalette, true);
+}
+
+void CreateLoadMenu(RGB8 *myPalette) {
+ _GM(saveLoadFromHotkey) = false;
+ CreateSaveLoadMenu(myPalette, false);
+}
+
+void CreateF3LoadMenu(RGB8 *myPalette) {
+ if ((!player_commands_allowed()) || (!INTERFACE_VISIBLE) ||
+ _G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
+ return;
}
+ _GM(saveLoadFromHotkey) = true;
+ _GM(gameMenuFromMain) = false;
+ CreateSaveLoadMenu(myPalette, false);
}
void CreateLoadMenuFromMain(RGB8 *myPalette) {
if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
-
- _G(gui).saveLoadFromHotkey = true;
- _G(gui).gameMenuFromMain = true;
+ _GM(saveLoadFromHotkey) = true;
+ _GM(gameMenuFromMain) = true;
CreateSaveLoadMenu(myPalette, false);
}
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 0fff233b4a1..ba15c17b1ed 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -34,10 +34,10 @@ namespace GUI {
typedef bool (*ItemHandlerFunction)(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem);
typedef void (*DrawFunction)(void *source, void *dest, int32 x1, int32 y1, int32 x2, int32 y2);
typedef void (*DestroyFunction)(void *theItem);
-typedef void (*CALLBACK)();
+typedef M4CALLBACK CALLBACK;
-struct Sprite {
-};
+typedef M4sprite Sprite;
+//struct Sprite {};
struct menuItem {
menuItem *next;
@@ -109,9 +109,6 @@ struct guiMenu {
EventHandler menuEventHandler;
};
-// The following var is true if'f one of the menus is active
-extern bool menuSystemInitialized;
-
// GENERAL MENU FUNCTIONS
extern bool menu_Initialize(RGB8 *myPalette);
extern guiMenu *menu_Create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFlags);
@@ -480,7 +477,7 @@ struct MenuGlobals {
//menu sprite series vars
char *menuSeriesResource = nullptr;
- Handle menuSeriesHandle;
+ MemHandle menuSeriesHandle;
int32 menuSeriesOffset;
int32 menuSeriesPalOffset;
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 95f1a6bb980..309bc1bdfb6 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -27,7 +27,7 @@
namespace M4 {
namespace Burger {
-void escape_key_pressed(void *, void *) {
+void Hotkeys::escape_key_pressed(void *, void *) {
// Decide what to do depending on what kind of game is playing
switch (_G(executing)) {
case JUST_OVERVIEW:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 309f24e0a88..16bf9fba46e 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -26,6 +26,7 @@
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
#include "m4/burger/gui/gui.h"
+#include "m4/burger/gui/game_menu.h"
#include "m4/burger/flags.h"
#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index 2de237ce4ba..43c5c1760bb 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -22,6 +22,7 @@
#include "m4/graphics/gr_font.h"
#include "m4/graphics/gr_buff.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/mem/mem.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/mem/memman.h"
@@ -296,8 +297,7 @@ int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y, int32 w,
Byte *fontPixData = _G(font)->pixData;
short *offsetArray = _G(font)->offset;
- while (*out_string)
- {
+ while (*out_string) {
char c = (*out_string++) & (char)0x7f;
int32 wdth = widthArray[c];
@@ -347,6 +347,14 @@ int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y, int32 w,
return(cursX);
}
+int32 gr_font_write(Buffer *target, const char *out_string, int32 x, int32 y, int32 w, int32 auto_spacing) {
+ char *tmp = mem_strdup(out_string);
+ int32 result = gr_font_write(target, tmp, x, y, w, auto_spacing);
+ free(tmp);
+
+ return result;
+}
+
Font *gr_font_load(const char *fontName) {
uint8 buffer[10];
uint32 tag;
@@ -381,7 +389,7 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'WIDT')
- error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 1);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 1);
// width table
newFont->width = (byte *)mem_alloc(256, STR_FONTWIDTH);
@@ -397,12 +405,12 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'OFFS')
- error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 2);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 2);
// offset table
newFont->offset = (short *)mem_alloc(256 * sizeof(short), STR_FONTOFF);
if (!newFont->offset)
- error_show(FL, 'OOM!', "_G(font) offset table");
+ error_show(FL, 'OOM!', "font offset table");
bufferHandle = newFont->offset;
fontFile.read(&bufferHandle, 256 * sizeof(short));
@@ -416,12 +424,12 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'PIXS')
- error_show(FL, 'FNTL', "_G(font): %s chkpnt: %d", (char *)fontName, 3);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 3);
// pixData
newFont->pixData = (byte *)mem_alloc(newFont->dataSize, STR_FONTDATA);
if (!newFont->pixData)
- error_show(FL, 'OOM!', "_G(font) pix data");
+ error_show(FL, 'OOM!', "font pix data");
bufferHandle = newFont->pixData;
fontFile.read(&bufferHandle, newFont->dataSize);
diff --git a/engines/m4/graphics/gr_font.h b/engines/m4/graphics/gr_font.h
index 149266e30fe..3f27f384064 100644
--- a/engines/m4/graphics/gr_font.h
+++ b/engines/m4/graphics/gr_font.h
@@ -46,6 +46,8 @@ void gr_font_set(Font *font);
int32 gr_font_get_height();
int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y,
int32 w, int32 auto_spacing = 1);
+int32 gr_font_write(Buffer *target, const char *out_string, int32 x, int32 y,
+ int32 w, int32 auto_spacing);
int32 gr_font_string_width(char *out_string, int32 auto_spacing = 1);
int32 gr_font_string_width(const Common::String &str, int32 auto_spacing = 1);
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index bf2cfbc1475..be839dd6682 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -127,6 +127,8 @@ extern void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scr
extern void krn_ChangeBufferLuminance(Buffer *target, int32 percent);
extern void krn_pal_game_task();
+extern void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType);
+extern void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay);
} // namespace M4
diff --git a/engines/m4/mem/reloc.h b/engines/m4/mem/reloc.h
index e957a50d19b..fbd550af087 100644
--- a/engines/m4/mem/reloc.h
+++ b/engines/m4/mem/reloc.h
@@ -45,6 +45,12 @@ extern MemHandle NewHandle(size_t size, const Common::String &);
extern void DisposeHandle(MemHandle handle);
extern uint32 MaxMem(Size *growBytes);
+inline void PurgeMem() {}
+inline void CompactMem() {}
+inline size_t mem_avail() { return 0; }
+inline void adv_GetCodeMemory() {}
+inline void adv_GetBackgroundMemory() {}
+
} // namespace M4
#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 4540dc31564..9cfeb33fc21 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
metaengine.o \
vars.o \
adv_db_r/db_catalog.o \
+ adv_r/adv_background.o \
adv_r/adv_been.o \
adv_r/adv_chk.o \
adv_r/adv_control.o \
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index e8d7b2a22d0..faba79565bf 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -187,6 +187,14 @@ void Digi::change_volume(int channel, int vol) {
_mixer->setChannelVolume(_channels[channel]._soundHandle, vol);
}
+void Digi::set_overall_volume(int vol) {
+ _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol);
+}
+
+int Digi::get_overall_volume() {
+ return _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType);
+}
+
} // namespace Sound
bool digi_preload(const Common::String &name, int roomNum) {
@@ -221,4 +229,12 @@ void digi_change_volume(int channel, int vol) {
_G(digi).change_volume(channel, vol);
}
+void digi_set_overall_volume(int vol) {
+ _G(digi).set_overall_volume(vol);
+}
+
+int digi_get_overall_volume() {
+ return _G(digi).get_overall_volume();
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 031cda3048c..b2a828ab3b0 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -92,6 +92,9 @@ public:
void read_another_chunk();
bool play_state(int channel) const;
void change_volume(int channel, int vol);
+
+ void set_overall_volume(int vol);
+ int get_overall_volume();
};
} // namespace Sound
@@ -104,6 +107,8 @@ extern void digi_read_another_chunk();
extern void digi_stop(int channel);
extern bool digi_play_state(int channel);
extern void digi_change_volume(int channel, int vol);
+extern void digi_set_overall_volume(int vol);
+extern int digi_get_overall_volume();
} // namespace M4
Commit: 3b99cf9672df3867669a5df21405e04cc6362a0e
https://github.com/scummvm/scummvm/commit/3b99cf9672df3867669a5df21405e04cc6362a0e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement adv_background support methods
Changed paths:
engines/m4/adv_r/adv_background.cpp
diff --git a/engines/m4/adv_r/adv_background.cpp b/engines/m4/adv_r/adv_background.cpp
index 6aa2c5eb88b..a23e86a1959 100644
--- a/engines/m4/adv_r/adv_background.cpp
+++ b/engines/m4/adv_r/adv_background.cpp
@@ -20,23 +20,48 @@
*/
#include "m4/adv_r/adv_background.h"
+#include "m4/adv_r/adv_file.h"
#include "m4/vars.h"
namespace M4 {
void adv_freeCodes() {
-
+ if (_G(screenCodeBuff)) {
+ delete _G(screenCodeBuff);
+ _G(screenCodeBuff) = nullptr;
+ }
}
void adv_freeBackground() {
-
+ if (_G(game_bgBuff)) {
+ delete _G(game_bgBuff);
+ _G(game_bgBuff) = nullptr;
+ }
}
bool adv_restoreBackground() {
- return true;
+ RGB8 myPalette[256];
+ SysFile sysFile(_G(currBackgroundFN));
+
+ if (load_background(&sysFile, &_G(game_bgBuff), myPalette)) {
+ sysFile.close();
+ return true;
+ } else {
+ return false;
+ }
}
bool adv_restoreCodes() {
+ SysFile sysFile(_G(currCodeFN));
+
+ _G(screenCodeBuff) = load_codes(&sysFile);
+ if (_G(screenCodeBuff)) {
+ sysFile.close();
+ return true;
+ } else {
+ return false;
+ }
+
return true;
}
Commit: 89bdb1285ad75389d2f96177783181b14f7f9bb3
https://github.com/scummvm/scummvm/commit/89bdb1285ad75389d2f96177783181b14f7f9bb3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 101 code
Changed paths:
engines/m4/adv_r/adv_player.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 4828b0cdebc..7dd3c894c6d 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -97,6 +97,9 @@ struct PlayerInfo {
};
extern bool player_said(const char *w0, const char *w1 = NULL, const char *w2 = NULL);
+extern bool player_said_any(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr,
+ const char *w3 = nullptr, const char *w4 = nullptr, const char *w5 = nullptr, const char *w6 = nullptr,
+ const char *w7 = nullptr, const char *w8 = nullptr, const char *w9 = nullptr);
extern void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int32 backS);
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index d3ebee89a12..4b7898f5000 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -74,7 +74,7 @@ void Flags::reset1() {
(*this)[V011] = 0;
(*this)[V012] = 0;
(*this)[V013] = 0;
- (*this)[V014] = 0;
+ (*this)[ROOM101_FLAG1] = 0;
(*this)[V015] = 0;
(*this)[V017] = 0;
(*this)[V018] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index b5fd64eb523..1624ab0a064 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -44,7 +44,7 @@ enum {
V011 = 11,
V012 = 12,
V013 = 13,
- V014 = 14,
+ ROOM101_FLAG1 = 14,
V015 = 15,
V016 = 16,
V017 = 17,
@@ -319,7 +319,7 @@ enum {
V284 = 284,
V285 = 285,
V286 = 286,
- V287 = 287,
+ ROOM101_FLAG2 = 287,
V288 = 288,
V289 = 289,
V290 = 290,
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 7f1f8bff1f0..a60094564e7 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -25,7 +25,9 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-
+Section1::Section1() : Rooms::Section() {
+ add(&_room101);
+}
} // namespace Rooms
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index d61c437cba6..b374a3b8fd1 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -24,14 +24,17 @@
#include "m4/burger/rooms/room.h"
#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section1/room101.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Section1 : public Rooms::Section {
+private:
+ Room101 _room101;
public:
- Section1() : Rooms::Section() {}
+ Section1();
virtual ~Section1() {}
};
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 16bf9fba46e..9dddceddfb3 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -92,6 +92,7 @@ public:
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
+ int _roomVal1 = 0;
public:
Vars();
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9cfeb33fc21..bffafb8f67c 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -87,6 +87,7 @@ MODULE_OBJS = \
burger/rooms/room.o \
burger/rooms/section.o \
burger/rooms/section1/section1.o \
+ burger/rooms/section1/room101.o \
burger/rooms/section9/section9.o \
burger/rooms/section9/menu_room.o \
burger/rooms/section9/room901.o \
Commit: e376dd8ccb6da4450aa812bee869065751965f1d
https://github.com/scummvm/scummvm/commit/e376dd8ccb6da4450aa812bee869065751965f1d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding more room 101, wilbur methods
Changed paths:
A engines/m4/burger/rooms/section1/room101.cpp
A engines/m4/burger/rooms/section1/room101.h
A engines/m4/burger/wilbur.cpp
A engines/m4/burger/wilbur.h
engines/m4/burger/burger.cpp
engines/m4/burger/flags.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 036e2ef9e91..f85dc6ec7a8 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -22,6 +22,7 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
+#include "m4/burger/wilbur.h"
namespace M4 {
namespace Burger {
@@ -66,6 +67,14 @@ void BurgerEngine::global_daemon() {
release_trigger_digi_check();
break;
+ case gWILBURS_SPEECH_START:
+ wilbur_say();
+ break;
+
+ case gWILBURS_SPEECH_FINISHED:
+ wilburs_speech_finished();
+ break;
+
// TODO: Other cases
default:
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 1624ab0a064..6cd34b6e1fc 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -129,13 +129,13 @@ enum {
V096 = 96,
V097 = 97,
V098 = 98,
- V099 = 99,
+ ROOM101_FLAG10 = 99,
- V100 = 100,
+ ROOM101_FLAG11 = 100,
V101 = 101,
- V102 = 102,
- V103 = 103,
- V104 = 104,
+ ROOM101_FLAG13 = 102,
+ ROOM101_FLAG14 = 103,
+ ROOM101_FLAG15 = 104,
V105 = 105,
V106 = 106,
V107 = 107,
@@ -144,7 +144,7 @@ enum {
V110 = 110,
V111 = 111,
V112 = 112,
- V113 = 113,
+ ROOM101_FLAG12 = 113,
V114 = 114,
V115 = 115,
V116 = 116,
@@ -183,8 +183,8 @@ enum {
V149 = 149,
V150 = 150,
V151 = 151,
- V152 = 152,
- V153 = 153,
+ ROOM101_FLAG20 = 152,
+ ROOM101_FLAG21 = 153,
V154 = 154,
V155 = 155,
V156 = 156,
@@ -215,17 +215,17 @@ enum {
V181 = 181,
V182 = 182,
V183 = 183,
- V184 = 184,
- V185 = 185,
+ ROOM101_FLAG16 = 184,
+ ROOM101_FLAG17 = 185,
V186 = 186,
V187 = 187,
V188 = 188,
V189 = 189,
- V190 = 190,
+ ROOM101_FLAG19 = 190,
V191 = 191,
V192 = 192,
V193 = 193,
- V194 = 194,
+ ROOM101_FLAG18 = 194,
V195 = 195,
V196 = 196,
V197 = 197,
@@ -273,15 +273,15 @@ enum {
V238 = 238,
V239 = 239,
V240 = 240,
- V241 = 241,
- V242 = 242,
+ ROOM101_FLAG4 = 241,
+ ROOM101_FLAG5 = 242,
V243 = 243,
V244 = 244,
V245 = 245,
V246 = 246,
V247 = 247,
- V248 = 248,
- V249 = 249,
+ ROOM101_FLAG8 = 248,
+ ROOM101_FLAG6 = 249,
V250 = 250,
V251 = 251,
V252 = 252,
@@ -320,9 +320,9 @@ enum {
V285 = 285,
V286 = 286,
ROOM101_FLAG2 = 287,
- V288 = 288,
- V289 = 289,
- V290 = 290,
+ ROOM101_FLAG3 = 288,
+ ROOM101_FLAG9 = 289,
+ ROOM101_FLAG7 = 290,
V291 = 291,
V292 = 292,
digestability = 293,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
new file mode 100644
index 00000000000..f8444ce3121
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -0,0 +1,281 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room101.h"
+#include "m4/burger/wilbur.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/core/imath.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room101::init() {
+ _G(player).walker_in_this_scene = true;
+ _val1 = 255;
+
+ digi_stop(1);
+ digi_preload("101_001");
+ _G(kernel).call_daemon_every_loop = true;
+
+ if (_G(game).previous_room != 102)
+ door();
+
+ switch (_G(game).previous_room) {
+ case -2:
+ // Do nothing
+ break;
+
+ case 102:
+ player_set_commands_allowed(false);
+ if (_G(flags)[ROOM101_FLAG1]) {
+ _G(flags)[ROOM101_FLAG1] = 0;
+ ws_demand_facing(_G(my_walker), 10);
+ ws_demand_location(_G(my_walker), 338, 265);
+ _G(roomVal1) = 16;
+
+ } else {
+ ws_demand_facing(_G(my_walker), 4);
+ ws_demand_location(_G(my_walker), 264, 259);
+ _G(roomVal1) = 10;
+ }
+
+ ws_hide_walker(_G(my_walker));
+ kernel_trigger_dispatch_now(10015);
+ break;
+
+ case 103:
+ player_set_commands_allowed(false);
+ ws_demand_facing(_G(my_walker), 1);
+ ws_demand_location(_G(my_walker), 197, 276);
+ ws_hide_walker(_G(my_walker));
+
+ _G(roomVal1) = 6;
+ kernel_trigger_dispatch_now(10016);
+ break;
+
+ case 104:
+ _G(roomVal1) = 2;
+ kernel_trigger_dispatch_now(10016);
+ break;
+
+ case 106:
+ _G(roomVal1) = 3;
+ kernel_trigger_dispatch_now(10016);
+ break;
+
+ case 135:
+ _G(roomVal1) = 4;
+ kernel_trigger_dispatch_now(10016);
+ break;
+
+ case 142:
+ _G(roomVal1) = 5;
+ kernel_trigger_dispatch_now(10016);
+ break;
+
+ default:
+ ws_demand_location(_G(my_walker), 320, 271);
+ ws_demand_facing(_G(my_walker), 5);
+
+ if (_G(game).previous_section > 1) {
+ if (_G(flags)[ROOM101_FLAG2]) {
+ ws_demand_location(_G(my_walker), 280, 309);
+ ws_demand_facing(_G(my_walker), 8);
+ player_set_commands_allowed(false);
+ }
+
+ kernel_timing_trigger(60, 6);
+ }
+ break;
+ }
+
+ digi_play_loop("101_001", 3, 200, -1);
+}
+
+void Room101::daemon() {
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ player_update_info(_G(my_walker), &_G(player_info));
+
+ if (_G(player_info).y > 374 && player_said("old bridge")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1008);
+ _G(kernel).call_daemon_every_loop = false;
+
+ } else if (_G(player_info.y < 205) && player_said("town hall")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), 16, 255, 0, 30, 1001);
+ _G(kernel).call_daemon_every_loop = false;
+ }
+ }
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ if (_val2 == 12) {
+ int frame = imath_ranged_rand(8, 10);
+ series_play_("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+ } else {
+ digi_preload("101_002");
+ series_play_("101ha01", 3840, 0, 21, 6, 0, 100, 0, 0, 11, 13);
+ }
+ break;
+
+ case 2:
+ digi_stop(2);
+ unloadSounds();
+ player_set_commands_allowed(true);
+ ws_unhide_walker(_G(my_walker));
+ break;
+
+ case 4:
+ digi_play(Common::String::format("101_0%d", imath_ranged_rand(10, 17)).c_str(), 2, 255, -1);
+ break;
+
+ case 5:
+ digi_play("101_017", 2, 255, -1);
+ break;
+
+ case 6:
+ if (!_G(flags)[ROOM101_FLAG2]) {
+ uint idx = _G(flags)[ROOM101_FLAG3];
+ assert(idx < 8);
+
+ static const char *const NAMES[8] = {
+ "101w500", "101w500", "101w501", "101w502",
+ "101w503", "101w504", "101w505", "101w506"
+ };
+
+ wilbur_speech(NAMES[idx], 23);
+
+ } else if (!_G(flags)[ROOM101_FLAG4]) {
+ if (_G(flags)[ROOM101_FLAG5] <= 1) {
+ wilbur_speech("101w520", 7);
+
+ } else if (_G(flags)[ROOM101_FLAG6] && !_G(flags)[ROOM101_FLAG7]) {
+ wilbur_speech("101w522", 7);
+ _G(flags)[ROOM101_FLAG7] = 1;
+
+ } else if (_G(flags)[ROOM101_FLAG8] && !_G(flags)[ROOM101_FLAG9]) {
+ wilbur_speech("101w521", 7);
+ _G(flags)[ROOM101_FLAG9] = 1;
+
+ } else {
+ wilbur_speech("101w524", 7);
+ }
+ } else if (!_G(flags)[ROOM101_FLAG10]) {
+ if (_G(flags)[ROOM101_FLAG11] <= 1) {
+ wilbur_speech("101w530", 7);
+ } else if (!_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG13]) {
+ wilbur_speech("101w531", 7);
+ _G(flags)[ROOM101_FLAG13] = 1;
+ } else if (_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG14]) {
+ wilbur_speech("101w533", 7);
+ _G(flags)[ROOM101_FLAG14] = 1;
+ } else if (_G(flags)[ROOM101_FLAG12] && _G(flags)[ROOM101_FLAG11] >= 5 &&
+ !_G(flags)[ROOM101_FLAG15]) {
+ wilbur_speech("101w534", 7);
+ _G(flags)[ROOM101_FLAG15] = 1;
+ } else {
+ wilbur_speech("101w532", 7);
+ }
+ } else if (!_G(flags)[ROOM101_FLAG16]) {
+ switch (_G(flags)[ROOM101_FLAG17]) {
+ case 0:
+ case 1:
+ wilbur_speech("101w550", 7);
+ break;
+ case 2:
+ wilbur_speech("101w552", 7);
+ break;
+ default:
+ if (_G(flags)[ROOM101_FLAG18] && !_G(flags)[ROOM101_FLAG19]) {
+ wilbur_speech("101w551", 7);
+ _G(flags)[ROOM101_FLAG19] = 1;
+ } else {
+ kernel_timing_trigger(60, 7);
+ }
+ break;
+ }
+ } else if (!_G(flags)[ROOM101_FLAG20]) {
+ switch (_G(flags)[ROOM101_FLAG21]) {
+ case 0:
+ case 1:
+ wilbur_speech("101w570", 7);
+ break;
+ case 2:
+ wilbur_speech("101w571", 7);
+ break;
+ default:
+ kernel_timing_trigger(60, 7);
+ break;
+ }
+ } else {
+ kernel_trigger_dispatch_now(7);
+ }
+ break;
+
+ // TODO: cases
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Room101::pre_parser() {
+ bool lookAt = player_said_any("look", "look at");
+
+ if (player_said("vera's diner") && !player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(9);
+
+ if (player_said("alley") && !player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(3);
+
+ _G(kernel).call_daemon_every_loop = player_said("ENTER", "OLD BRIDGE") ||
+ player_said("gear", "old bridge") ||
+ player_said("old bridge") ||
+ player_said("ENTER", "TOWN HALL") ||
+ player_said("gear", "town hall") ||
+ (lookAt && player_said("town hall"));
+}
+
+void Room101::parser() {
+
+}
+
+void Room101::door() {
+ _doorMachine = series_play_("101door", 3840, 0, -1, 10, -1, 100, 0, -53, 0, 0);
+}
+
+void Room101::unloadSounds() {
+ digi_unload("101_010");
+ digi_unload("101_011");
+ digi_unload("101_012");
+ digi_unload("101_013");
+ digi_unload("101_014");
+ digi_unload("101_015");
+ digi_unload("101_016");
+ digi_unload("101_017");
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room101.h b/engines/m4/burger/rooms/section1/room101.h
new file mode 100644
index 00000000000..3680fe8b073
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room101.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM101_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM101_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room101 : public Room {
+private:
+ int _val1 = 0;
+ int _val2 = 0;
+ machine *_doorMachine = nullptr;
+
+ void door();
+ void unloadSounds();
+public:
+ Room101() : Room(101) {}
+ ~Room101() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 9dddceddfb3..575e77748d7 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -31,6 +31,7 @@
#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
+#include "m4/burger/wilbur.h"
namespace M4 {
namespace Burger {
@@ -45,7 +46,6 @@ enum global_triggers {
// System triggers
gRESUME_CONVERSATION, // Yep, that's what it does!
gSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
- gWILBURS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
/*
@@ -59,6 +59,8 @@ enum global_triggers {
// Wilbur specific triggers
gCHANGE_WILBUR_ANIMATION,
+ gWILBURS_SPEECH_FINISHED = 10014,
+ gWILBURS_SPEECH_START = 10015,
CALLED_EACH_LOOP = 32764,
@@ -86,13 +88,15 @@ public:
ReleaseTrigger_Globals _releaseTrigger;
StreamBreak_Globals _streamBreak;
Burger::Walker _walker;
+ Wilbur_Globals _wilbur;
int _wilburTerm = 2;
- const Common::String _wilbur = "WILBUR";
+ const Common::String _wilburName = "WILBUR";
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
int _roomVal1 = 0;
+ int _roomVal2 = 0;
public:
Vars();
diff --git a/engines/m4/burger/wilbur.cpp b/engines/m4/burger/wilbur.cpp
new file mode 100644
index 00000000000..91e67f98465
--- /dev/null
+++ b/engines/m4/burger/wilbur.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 "m4/burger/wilbur.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+#define _WIL(X) _G(wilbur)._##X
+
+void wilbur_speech(const char *name, int trigger, int room, byte flags, int vol, int channel) {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _WIL(name) = name;
+ _WIL(channel) = channel;
+ _WIL(room) = room;
+ _WIL(vol) = vol;
+ _WIL(trigger) = kernel_trigger_create(trigger);
+ _WIL(flag) = (flags & 1) != 0;
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(gWILBURS_SPEECH_START);
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void wilbur_say() {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+
+ if (_WIL(flag) && _G(player).walker_in_this_scene && _G(roomVal2))
+ SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+
+ term_message("wilbur_say: wilburs_talk_trigger = %d", _WIL(trigger));
+ digi_stop(_WIL(channel));
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(10013);
+ digi_play(_WIL(name), _WIL(channel), _WIL(vol), gWILBURS_SPEECH_FINISHED, _WIL(room));
+
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void wilburs_speech_finished() {
+ if (_WIL(flag) && !_G(player).walker_in_this_scene && !_G(roomVal2))
+ SendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+
+ term_message("wilburs_speech_finished: dispatching wilburs_talk_trigger = %d", _WIL(trigger));
+ kernel_trigger_dispatchx(_WIL(trigger));
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/wilbur.h b/engines/m4/burger/wilbur.h
new file mode 100644
index 00000000000..5ed4ae82f95
--- /dev/null
+++ b/engines/m4/burger/wilbur.h
@@ -0,0 +1,48 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_WILBUR_H
+#define M4_BURGER_WILBUR_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+struct Wilbur_Globals {
+ const char *_name = nullptr;
+ int _channel = 0;
+ int _room = 0;
+ int _vol = 0;
+ int32 _trigger = 0;
+ bool _flag = false;
+};
+
+extern void wilbur_speech(const char *name, int trigger, int room = -1, byte flags = 0,
+ int vol = 256, int channel = 1);
+extern void wilbur_say();
+extern void wilburs_speech_finished();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index bffafb8f67c..73e6d1fc435 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -103,7 +103,8 @@ MODULE_OBJS = \
burger/other.o \
burger/series_player.o \
burger/vars.o \
- burger/walker.o
+ burger/walker.o \
+ burger/wilbur.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 59335025b8d27a890117c1450fa83f081b56979f
https://github.com/scummvm/scummvm/commit/59335025b8d27a890117c1450fa83f081b56979f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More of room 101 daemon
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room101.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 6cd34b6e1fc..3e156d64957 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -282,7 +282,7 @@ enum {
V247 = 247,
ROOM101_FLAG8 = 248,
ROOM101_FLAG6 = 249,
- V250 = 250,
+ ROOM101_FLAG22 = 250,
V251 = 251,
V252 = 252,
V253 = 253,
@@ -312,7 +312,7 @@ enum {
V277 = 277,
V278 = 278,
V279 = 279,
- V280 = 280,
+ ROOM101_FLAG23 = 280,
V281 = 281,
V282 = 282,
V283 = 283,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index f8444ce3121..8a4f82394c6 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -29,6 +29,31 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesStreamBreak STREAMS1[] = {
+ { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 16, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS2[] = {
+ { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 6, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 17, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 24, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 26, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS3[] = {
+ { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 16, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
void Room101::init() {
_G(player).walker_in_this_scene = true;
_val1 = 255;
@@ -233,6 +258,114 @@ void Room101::daemon() {
}
break;
+ case 7:
+ loadSounds();
+ ws_hide_walker(_G(my_walker));
+
+ if (_G(flags)[ROOM101_FLAG4] || _G(flags)[ROOM101_FLAG16])
+ series_load("101wi13s", -1, nullptr);
+ if (_G(flags)[ROOM101_FLAG10])
+ series_load("101wi12s", -1, nullptr);
+ if (_G(flags)[ROOM101_FLAG20])
+ series_load("101wi11s", -1, nullptr);
+ break;
+
+ case 8:
+ kernel_timing_trigger(1, 9);
+ break;
+
+ case 9:
+ daemon9();
+
+ if (_G(flags)[ROOM101_FLAG4] || _G(flags)[ROOM101_FLAG22] ||
+ _G(flags)[ROOM101_FLAG23] || _G(flags)[V002]) {
+ TerminateMachineAndNull(_machine1);
+ TerminateMachineAndNull(_machine2);
+ kernel_trigger_dispatch_now(10);
+ }
+ break;
+
+ case 10:
+ _machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAMS1, "101wi13", 6, 256, 2);
+ break;
+
+ case 11:
+ kernel_timing_trigger(1, 12);
+ break;
+
+ case 12:
+ daemon12();
+
+ if (_G(flags)[ROOM101_FLAG4]) {
+ if (_G(flags)[ROOM101_FLAG10] || _G(flags)[V112] ||
+ _G(flags)[V080] || _G(flags)[V126]) {
+ TerminateMachineAndNull(_machine1);
+ TerminateMachineAndNull(_machine2);
+ kernel_timing_trigger(1, 13);
+ }
+ }
+ break;
+
+ case 13:
+ _machine1 = series_play_("101wi12s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAMS2, "101wi12", 6, 256, 2);
+ break;
+
+ case 14:
+ kernel_timing_trigger(1, 15);
+ break;
+
+ case 15:
+ daemon15();
+
+ if (_G(flags)[ROOM101_FLAG10] && (_G(flags)[ROOM101_FLAG16] || _G(flags)[V220])) {
+ TerminateMachineAndNull(_machine1);
+ TerminateMachineAndNull(_machine2);
+ kernel_timing_trigger(1, 16);
+ }
+ break;
+
+ case 16:
+ _machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAMS3, "101wi13", 6, 256, 2);
+ break;
+
+ case 17:
+ kernel_timing_trigger(1, 18);
+ break;
+
+ case 18:
+ daemon18();
+
+ if (_G(flags)[ROOM101_FLAG16]) {
+ if (_G(flags)[ROOM101_FLAG20] || _G(flags)[V220]) {
+ TerminateMachineAndNull(_machine1);
+ TerminateMachineAndNull(_machine2);
+ kernel_timing_trigger(1, 19);
+ }
+ }
+ break;
+
+ case 19:
+ _machine1 = series_play_("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAMS3, "101wi11", 6, 256, 2);
+ break;
+
+ case 20:
+ daemon20();
+ break;
+
+ case 21:
+ digi_play("101_002", 2, 255, -1);
+ _G(roomVal1) = 18;
+ series_play_("101ha01", 3840, 0, 10016, 6, 0, 100, 0, 0, 14, -1);
+ break;
+
+ case 23:
+ player_set_commands_allowed(true);
+ break;
+
// TODO: cases
default:
_G(kernel).continue_handling_trigger = true;
@@ -265,6 +398,17 @@ void Room101::door() {
_doorMachine = series_play_("101door", 3840, 0, -1, 10, -1, 100, 0, -53, 0, 0);
}
+void Room101::loadSounds() {
+ digi_preload("101_010");
+ digi_preload("101_011");
+ digi_preload("101_012");
+ digi_preload("101_013");
+ digi_preload("101_014");
+ digi_preload("101_015");
+ digi_preload("101_016");
+ digi_preload("101_017");
+}
+
void Room101::unloadSounds() {
digi_unload("101_010");
digi_unload("101_011");
@@ -276,6 +420,104 @@ void Room101::unloadSounds() {
digi_unload("101_017");
}
+void Room101::daemon9() {
+ _G(flags)[V019] = 1;
+ _G(flags)[V017] = 1;
+
+ if (_G(flags)[V021] == 10032)
+ _G(flags)[V001] = 12;
+
+ if (_G(flags)[V021] == 10033)
+ _G(flags)[V013] = 1;
+
+ _G(flags).set_boonsville_time(600);
+}
+
+void Room101::daemon12() {
+ if (_G(flags)[ROOM101_FLAG22] || _G(flags)[ROOM101_FLAG4])
+ inv_give_to_player("BLOCK OF ICE");
+
+ if (_G(flags)[ROOM101_FLAG23] || _G(flags)[ROOM101_FLAG4])
+ inv_give_to_player("PANTYHOSE");
+
+ if (_G(flags)[V002]) {
+ inv_give_to_player("PHONE BILL");
+ inv_give_to_player("WHISTLE");
+ _G(flags)[V079] = 0;
+ _G(flags)[V080] = 1;
+ }
+
+ _G(flags).set_boonsville_time(2400);
+}
+
+void Room101::daemon15() {
+ if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[ROOM101_FLAG10]) {
+ inv_give_to_player("PHONE BILL");
+ inv_give_to_player("WHISTLE");
+ _G(flags)[V079] = 0;
+ _G(flags)[V080] = 1;
+ } else {
+ _G(flags)[V079] = 1;
+ _G(flags)[V080] = 0;
+ }
+
+ if (_G(flags)[V126] || _G(flags)[ROOM101_FLAG10]) {
+ inv_give_to_player("CARROT JUICE");
+ _G(flags)[V088] = 1;
+ _G(flags)[V091] = 1;
+ } else {
+ _G(flags)[V088] = 0;
+ _G(flags)[V091] = 0;
+ }
+
+ if (_G(flags)[ROOM101_FLAG12] || _G(flags)[ROOM101_FLAG10]) {
+ _G(flags).set_boonsville_time(6001);
+ _G(flags)[V000] = 1002;
+ _G(flags)[V001] = 0;
+ inv_move_object("MONEY", NOWHERE);
+ _G(flags)[V039] = 1;
+ _G(flags)[V043] = 1;
+ inv_give_to_player("DEED");
+ _G(flags)[V112] = 1;
+ } else {
+ _G(flags)[V000] = 1000;
+ if (_G(flags)[V021] == 10032)
+ _G(flags)[V001] = 12;
+
+ _G(flags)[V039] = 0;
+ _G(flags)[V043] = 0;
+ _G(flags)[V058] = 0;
+ }
+
+ _G(flags)[V063] = 0;
+ _G(flags)[V092] = 0;
+
+ if (_G(flags)[ROOM101_FLAG10])
+ _G(flags).set_boonsville_time(6600);
+}
+
+void Room101::daemon18() {
+ if (_G(flags)[V220] || _G(flags)[ROOM101_FLAG16]) {
+ inv_give_to_player("laxative");
+ inv_give_to_player("amplifier");
+ _G(flags)[V067] = 1;
+ _G(flags)[V058] = 1;
+ _G(flags).set_boonsville_time(19200);
+ }
+}
+
+void Room101::daemon20() {
+ if (_G(flags)[V177] || _G(flags)[ROOM101_FLAG20]) {
+ inv_move_object("KEYS", 138);
+ inv_give_to_player("JAWZ O' LIFE");
+ _G(flags)[V046] = 0;
+ }
+
+ _G(flags)[V047] = 0;
+ _G(flags)[V048] = 0;
+ _G(flags).set_boonsville_time(22800);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room101.h b/engines/m4/burger/rooms/section1/room101.h
index 3680fe8b073..4a8aa9d9798 100644
--- a/engines/m4/burger/rooms/section1/room101.h
+++ b/engines/m4/burger/rooms/section1/room101.h
@@ -33,9 +33,18 @@ private:
int _val1 = 0;
int _val2 = 0;
machine *_doorMachine = nullptr;
+ machine *_machine1 = nullptr;
+ machine *_machine2 = nullptr;
void door();
+ void loadSounds();
void unloadSounds();
+ void daemon9();
+ void daemon12();
+ void daemon15();
+ void daemon18();
+ void daemon20();
+
public:
Room101() : Room(101) {}
~Room101() override {}
Commit: deb7c73fc4863b38bf4e2da7800ba8eddc276a4f
https://github.com/scummvm/scummvm/commit/deb7c73fc4863b38bf4e2da7800ba8eddc276a4f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More room 101 daemon, walker sprites loading
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/wilbur.cpp
engines/m4/burger/wilbur.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
engines/m4/graphics/gr_series.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 7dca7c47ea8..5bb00ba4c87 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -413,7 +413,7 @@ bool ws_walk_init_system() {
return true;
}
-bool ws_walk_load_series(int16 *dir_array, char *name_array[], bool shadow_flag, bool load_palette) {
+bool ws_walk_load_series(const int16 *dir_array, const char *name_array[], bool shadow_flag, bool load_palette) {
int32 i = 0;
while (dir_array[i] >= 0) {
@@ -429,11 +429,11 @@ bool ws_walk_load_series(int16 *dir_array, char *name_array[], bool shadow_flag,
return true;
}
-bool ws_walk_load_walker_series(int16 *dir_array, char *name_array[], bool load_palette) {
+bool ws_walk_load_walker_series(const int16 *dir_array, const char *name_array[], bool load_palette) {
return (ws_walk_load_series(dir_array, name_array, false, load_palette));
}
-bool ws_walk_load_shadow_series(int16 *dir_array, char *name_array[]) {
+bool ws_walk_load_shadow_series(const int16 *dir_array, const char *name_array[]) {
return (ws_walk_load_series(dir_array, name_array, true, false));
}
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index a2e19425d4c..4f5d2d3685e 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -56,9 +56,9 @@ extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigge
extern bool ws_walk_init_system();
-extern bool ws_walk_load_series(int16 *dir_array, char *name_array[], bool shadow_flag, bool load_palette);
-extern bool ws_walk_load_walker_series(int16 *dir_array, char *name_array[], bool load_palette);
-extern bool ws_walk_load_shadow_series(int16 *dir_array, char *name_array[]);
+extern bool ws_walk_load_series(const int16 *dir_array, const char *name_array[], bool shadow_flag, bool load_palette);
+extern bool ws_walk_load_walker_series(const int16 *dir_array, const char *name_array[], bool load_palette);
+extern bool ws_walk_load_shadow_series(const int16 *dir_array, const char *name_array[]);
extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
#define ws_walk_dump_walker_series(xx, yy) (ws_walk_dump_series (xx, yy))
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 8a4f82394c6..b1e08eff167 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section1/room101.h"
+#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/wilbur.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
@@ -54,6 +55,19 @@ static const seriesStreamBreak STREAMS3[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak STREAMS4[] = {
+ { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 7, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 13, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS5[] = {
+ { 0, "100_010", 1, 255, -1, 0, nullptr, 0 },
+ { 19, "100_011", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
void Room101::init() {
_G(player).walker_in_this_scene = true;
_val1 = 255;
@@ -138,6 +152,8 @@ void Room101::init() {
}
void Room101::daemon() {
+ const int FIFTY_THREE = -53;
+
if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
player_update_info(_G(my_walker), &_G(player_info));
@@ -349,7 +365,7 @@ void Room101::daemon() {
case 19:
_machine1 = series_play_("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAMS3, "101wi11", 6, 256, 2);
+ _machine2 = series_stream_with_breaks(STREAMS4, "101wi11", 6, 256, 2);
break;
case 20:
@@ -366,6 +382,78 @@ void Room101::daemon() {
player_set_commands_allowed(true);
break;
+ case 24:
+ if (_G(player_info).x < 218 || (_G(player_info).x < 349 && _G(player_info).y > 277)) {
+ kernel_trigger_dispatch_now(27);
+ } else {
+ digi_preload_stream_breaks(STREAMS5);
+ series_stream_with_breaks(STREAMS5, "101dt01", 6, 1024, 25);
+ }
+ break;
+
+ case 25:
+ _val1 -= 10;
+ if (_val1 > 0) {
+ digi_change_volume(2, _val1);
+ kernel_timing_trigger(3, 25);
+ } else {
+ digi_stop(1);
+ digi_unload_stream_breaks(STREAMS5);
+ digi_stop(2);
+ digi_unload("100_013");
+ player_set_commands_allowed(true);
+ _val1 = 255;
+ }
+ break;
+
+ case 26:
+ door();
+ reset_walker_sprites();
+ digi_preload_stream_breaks(STREAMS5);
+ series_stream_with_breaks(STREAMS5, "101dt01", 6, 1, 25);
+ break;
+
+ case 27:
+ TerminateMachineAndNull(_doorMachine);
+ Section1::updateWalker(226, 281, 8, 26);
+ break;
+
+ case 10016:
+ switch (_G(roomVal1)) {
+ case 2:
+ player_set_commands_allowed(true);
+ ws_demand_location(_G(my_walker), 336, 184);
+ ws_demand_facing(_G(my_walker), 5);
+ ws_walk(_G(my_walker), 335, 195, nullptr, -1, 5);
+ break;
+
+ case 3:
+ player_set_commands_allowed(true);
+ ws_demand_location(_G(my_walker), 482, 208);
+ ws_demand_facing(_G(my_walker), 9);
+ ws_walk(_G(my_walker), 410, 218, nullptr, -1, 9);
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+ ws_demand_location(_G(my_walker), 224, 373);
+ ws_demand_facing(_G(my_walker), 2);
+ ws_walk(_G(my_walker), 282, 342, nullptr, -1, 2);
+ break;
+
+ case 5:
+ player_set_commands_allowed(true);
+ ws_demand_location(_G(my_walker), 0, 288);
+ ws_demand_facing(_G(my_walker), 3);
+ ws_walk(_G(my_walker), 30, 288, nullptr, -1, 3);
+ break;
+
+ // TODO: More cases
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
// TODO: cases
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index a60094564e7..86ee6fb98a1 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -20,6 +20,9 @@
*/
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
@@ -29,6 +32,29 @@ Section1::Section1() : Rooms::Section() {
add(&_room101);
}
+void Section1::updateWalker(int x, int y, int dir, int trigger, bool mode) {
+ Section1 *s = dynamic_cast<Section1 *>(g_engine->_activeSection);
+ assert(s);
+ s->updateWalker_(x, y, dir, trigger, mode);
+}
+
+void Section1::updateWalker_(int x, int y, int dir, int trigger, bool mode) {
+ _trigger = trigger;
+ player_set_commands_allowed(false);
+ ws_demand_location(_G(my_walker), x, y);
+ ws_demand_facing(_G(my_walker), dir);
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal3) = 0;
+
+ gr_backup_palette();
+ pal_fade_set_start(_G(master_palette), 0);
+ _series = series_load("110", -1, _G(master_palette));
+ _play = series_play_("110", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ kernel_trigger_dispatch_now(mode ? 1032 : 1027);
+ kernel_timing_trigger(1, 1026);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index b374a3b8fd1..86129fc720f 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -33,9 +33,17 @@ namespace Rooms {
class Section1 : public Rooms::Section {
private:
Room101 _room101;
+
+ int _trigger = 0;
+ int _series = -1;
+ machine *_play = nullptr;
+
+ void updateWalker_(int x, int y, int dir, int trigger, bool mode);
public:
Section1();
virtual ~Section1() {}
+
+ static void updateWalker(int x, int y, int dir, int trigger, bool mode = false);
};
} // namespace Rooms
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index ee2cc750d6b..dcd243526cf 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -109,7 +109,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(903); /*****DEBUG*****/
+ _game.setRoom(101); /*****DEBUG*****/
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 575e77748d7..e0996c85e51 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -97,6 +97,7 @@ public:
int _room902Flag = 0;
int _roomVal1 = 0;
int _roomVal2 = 0;
+ int _roomVal3 = 0;
public:
Vars();
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 9825e445efe..5c1a04a20b9 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -25,6 +25,22 @@
namespace M4 {
namespace Burger {
+// Starting hashes for walker machines/sequences/etc */
+#define WALKER_HASH 8 // machine/data starting hash for wilbur
+#define WALKER_SERIES_HASH 0
+#define NUM_WALKER_SERIES 8
+#define SHADOW_SERIES_HASH 8
+#define NUM_SHADOW_SERIES 5
+
+// These are the walker types
+#define WALKER_WILBUR 0
+#define WALKER_FLUMIX 1
+
+// These are the shadow types
+#define SHADOW_WILBUR 0
+#define SHADOW_FLUMIX 1
+
+
bool Walker::walk_load_walker_and_shadow_series() {
// TODO
warning("TODO: walk_load_walker_and_shadow_series");
@@ -32,9 +48,37 @@ bool Walker::walk_load_walker_and_shadow_series() {
}
machine *Walker::walk_initialize_walker() {
- // TODO
- warning("TODO: walk_initialize_walker");
- return nullptr;
+#if 0
+ machine *m;
+ int32 s;
+
+ // Wilbur walker
+ _G(player).walker_type = WALKER_WILBUR;
+ _G(player).shadow_type = SHADOW_WILBUR;
+
+ _G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
+ _G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
+ _G(globals)[GLB_TEMP_3] = SHADOW_SERIES_HASH << 24; // starting series hash of default walker shadows. GAMECTRL loads shadows starting @ 10
+
+ // initialize with bogus data (this is for the real walker)
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+ _G(globals)[GLB_TEMP_4] = 320 << 16;
+ _G(globals)[GLB_TEMP_5] = 400 << 16;
+ _G(globals)[GLB_TEMP_6] = s;
+ _G(globals)[GLB_TEMP_7] = 3 << 16; // facing
+
+ m = TriggerMachineByHash(WALKER_HASH, NULL, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
+
+ // we need to all init sequences to happen immediately (init coordinates)
+ CycleEngines(NULL, &(currentSceneDef.depth_table[0]),
+ NULL, (uint8 *)&master_palette[0], inverse_pal->get_ptr(), TRUE);
+
+ inverse_pal->release();
+
+ return m;
+#else
+ error("TODO: walk_initialize_walker");
+#endif
}
} // namespace Burger
diff --git a/engines/m4/burger/wilbur.cpp b/engines/m4/burger/wilbur.cpp
index 91e67f98465..27a360e4ca1 100644
--- a/engines/m4/burger/wilbur.cpp
+++ b/engines/m4/burger/wilbur.cpp
@@ -21,12 +21,46 @@
#include "m4/burger/wilbur.h"
#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
#define _WIL(X) _G(wilbur)._##X
+static const char *WILBUR_SERIES[8] = {
+ "WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
+ "WILBUR07", "WILBUR08", "WILBUR09"
+};
+static const int16 WILBUR_SERIES_DIRS[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, -1
+};
+
+static const char *WILBUR_SHADOWS[5] = {
+ "WILBUR01_SHADOW", "WILBUR02_SHADOW", "WILBUR03_SHADOW",
+ "WILBUR04_SHADOW", "WILBUR05_SHADOW"
+};
+static const int16 WILBUR_SHADOWS_DIRS[6] = {
+ 8, 9, 10, 11, 12, -1
+};
+
+bool load_walker_sprites() {
+ return ws_walk_load_walker_series(WILBUR_SERIES_DIRS, WILBUR_SERIES, true) &&
+ ws_walk_load_shadow_series(WILBUR_SHADOWS_DIRS, WILBUR_SHADOWS);
+}
+
+void reset_walker_sprites() {
+ if (_G(roomVal3)) {
+ for (int i = 0; WILBUR_SERIES_DIRS[i] != -1; ++i) {
+ series_load(WILBUR_SERIES[i], WILBUR_SERIES_DIRS[i]);
+ }
+ }
+
+ ws_unhide_walker(_G(my_walker));
+ gr_restore_palette();
+ kernel_timing_trigger(1, 1026);
+}
+
void wilbur_speech(const char *name, int trigger, int room, byte flags, int vol, int channel) {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_WIL(name) = name;
diff --git a/engines/m4/burger/wilbur.h b/engines/m4/burger/wilbur.h
index 5ed4ae82f95..62862c5b4ab 100644
--- a/engines/m4/burger/wilbur.h
+++ b/engines/m4/burger/wilbur.h
@@ -37,6 +37,9 @@ struct Wilbur_Globals {
bool _flag = false;
};
+extern void reset_walker_sprites();
+extern bool load_walker_sprites();
+
extern void wilbur_speech(const char *name, int trigger, int room = -1, byte flags = 0,
int vol = 256, int channel = 1);
extern void wilbur_say();
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index d1b51bcda58..b3ec64cf4ff 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -169,4 +169,12 @@ void gr_pal_reset_ega_colors(RGB8 *pal) {
#endif
}
+void gr_backup_palette() {
+ Common::copy(_G(master_palette), _G(master_palette) + 768, _G(backup_palette));
+}
+
+void gr_restore_palette() {
+ Common::copy(_G(backup_palette), _G(backup_palette) + 768, _G(master_palette));
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index eeafca504bf..1075fc32af8 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -62,6 +62,8 @@ extern void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color);
extern uint8 gr_pal_find_best_match(RGB8 *pal, uint8 r, uint8 g, uint8 b);
extern void gr_pal_interface(RGB8 *fixpal);
extern void gr_pal_reset_ega_colors(RGB8 *pal);
+extern void gr_backup_palette();
+extern void gr_restore_palette();
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 39573f26171..061b289a350 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -52,7 +52,7 @@ enum {
HASH_STREAM_MACHINE = 6
};
-extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal);
+extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal = nullptr);
extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index b37492dbc9c..cf1e114de76 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -154,6 +154,7 @@ public:
int32 _requests[_MEMTYPE_LIMIT] = { 0 };
void *_memBlock[_MEMTYPE_LIMIT] = { nullptr };
RGB8 _master_palette[256];
+ RGB8 _backup_palette[256];
bool _pal_fade_in_progress = false;
strmRequest *_firstStream = nullptr;
strmRequest *_lastStream = nullptr;
Commit: af319c41c7589dac526f34905ec776484da9b685
https://github.com/scummvm/scummvm/commit/af319c41c7589dac526f34905ec776484da9b685
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added play break code
Changed paths:
A engines/m4/burger/core/play_break.cpp
A engines/m4/burger/core/play_break.h
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/series_player.h
engines/m4/module.mk
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
new file mode 100644
index 00000000000..a044b8b5712
--- /dev/null
+++ b/engines/m4/burger/core/play_break.cpp
@@ -0,0 +1,213 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/core/play_break.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/burger/vars.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+
+static void set_next_series_play_break(int32 slot) {
+ seriesPlayer *player = &_G(seriesPlayers)[slot];
+
+ player->current_break = player->break_list[player->index]; // Grab the info from the list
+ player->digi_trigger = false; // Assume for now gSERIES_PLAY_BREAK trigger will come from series_ play not digi_play
+
+ while (player->current_break.firstFrame >= 0) {
+ // If there is a positive frame to play from (or to in the case of SERIES_BACKWARDS)
+
+ // if variable is null or variable = value then this break is valid
+ if ((!player->current_break.variable) || (*(player->current_break.variable) == player->current_break.value)) {
+
+ // Are the first and last frame numbers backwards?
+ if ((player->current_break.lastFrame != -1) && (player->current_break.firstFrame > player->current_break.lastFrame)) {
+ player->current_break.flags = player->current_break.flags | SERIES_BACKWARD; // make sure SERIES_BACKWARD is in flags
+ int32 temp = player->current_break.firstFrame; // switch the first and last frame numbers
+ player->current_break.firstFrame = player->current_break.lastFrame;
+ player->current_break.lastFrame = temp;
+ }
+
+ if (player->current_break.flags & DIGI_STOP) {
+ // Should we do a digi_stop?
+ digi_stop(player->current_break.channel);
+ }
+
+ // Is there is a sound to play?
+ if (player->current_break.sound) {
+ // Should it be looped?
+ if (player->current_break.flags & DIGI_LOOP) {
+ digi_play_loop(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
+
+ } else {
+ // There is a sound to play and it is not looping (finite)
+ if (_G(seriesPlayers)[slot].current_break.loopCount == -1) { // Check if series is to loop as long as sound plays (loopCount = -1)
+ _G(seriesPlayers)[slot].digi_trigger = true; // Remember that the gSERIES_PLAY_BREAK will be a sound trigger
+ digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, gSERIES_PLAY_BREAK_0 + slot);
+ } else {
+ // Use the play break trigger
+ digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
+ }
+ }
+ } else {
+ // No sound to play so see if there is a trigger to dispatch
+ if (player->current_break.trigger != NO_TRIGGER) {
+ kernel_trigger_dispatch(kernel_trigger_create(player->current_break.trigger));
+ }
+ }
+
+ // Play the series
+ if (player->digi_trigger) {
+ // Don't ask for the gSERIES_PLAY_BREAK trigger
+ player->series_machine = series_play_(player->name, player->depth, player->current_break.flags, NO_TRIGGER,
+ player->framerate, player->current_break.loopCount,
+ player->scale, player->x, player->y,
+ player->current_break.firstFrame, player->current_break.lastFrame);
+ } else { // ask for the gSERIES_PLAY_BREAK trigger
+ player->series_machine = series_play_(player->name, player->depth, player->current_break.flags, (int16)slot + gSERIES_PLAY_BREAK_0,
+ player->framerate, player->current_break.loopCount,
+ player->scale, player->x, player->y,
+ player->current_break.firstFrame, player->current_break.lastFrame);
+ }
+
+ // play the shadow series if necessary
+ if (player->with_shadow) {
+ player->shadow_machine = series_play_(player->shadow_name, player->depth + 1, player->current_break.flags, NO_TRIGGER,
+ player->framerate, player->current_break.loopCount,
+ player->scale, player->x, player->y,
+ player->current_break.firstFrame, player->current_break.lastFrame);
+ }
+ ++player->index; // set up index to the next break in list
+ break; // we have handled a break so don't look any farther
+
+ } else { // variable didn't equate to value so keep looking
+ ++player->index; // go to the next break in list
+ player->current_break = player->break_list[player->index]; // grab the info from the list
+ }
+ }
+
+ if (player->current_break.firstFrame < 0) { // there were no more breaks, so unload series/sounds and send off trigger
+ player->in_use = false;
+ series_unload(player->series);
+ if (player->with_shadow) series_unload(player->shadow_series);
+ if (player->preload_sounds) digi_unload_play_breaks(player->break_list);
+ kernel_trigger_dispatch(player->trigger);
+ }
+}
+
+void handle_series_play_break(int32 slot) {
+ seriesPlayer *player = &_G(seriesPlayers)[slot];
+
+ if (player->digi_trigger) { // if this was caused by a digi_trigger
+ kernel_terminate_machine(player->series_machine);
+ if (player->with_shadow) {
+ kernel_terminate_machine(player->shadow_machine);
+ }
+ }
+ set_next_series_play_break(slot);
+}
+
+int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name, frac16 depth, int32 trigger, uint32 flags,
+ int32 framerate, int32 scale, int32 x, int32 y) {
+ int32 slot;
+
+ // look for a free player slot (MAX_SERIES_PLAYERS)
+ for (slot = 0; slot < MAX_SERIES_PLAYERS; ++slot) {
+ if (!(_G(seriesPlayers)[slot].in_use)) break;
+ }
+
+ if (slot >= MAX_SERIES_PLAYERS) { // no free slots
+ term_message("**** all _G(seriesPlayers)s are in use!");
+ return -1;
+ }
+
+ seriesPlayer *player = &_G(seriesPlayers)[slot];
+
+ player->in_use = true;
+ player->index = 0;
+ player->break_list = list;
+ player->name = name;
+ player->depth = depth;
+ player->trigger = kernel_trigger_create(trigger);
+ player->framerate = framerate;
+ player->scale = scale;
+ player->x = x;
+ player->y = y;
+ player->with_shadow = (bool)(flags & WITH_SHADOW);
+ player->preload_sounds = (bool)(flags & PRELOAD_SOUNDS);
+
+ player->series = series_load(name, -1, nullptr); // load sprite series
+
+ // Check if shadow sprites should be loaded
+ if (player->with_shadow) {
+ // Make shadow name by adding an "s" to the series name
+ Common::strcpy_s(player->shadow_name, name);
+ Common::strcat_s(player->shadow_name, "s\0");
+ player->shadow_series = series_load(player->shadow_name, -1, nullptr);
+ } else {
+ player->shadow_name[0] = '\0';
+ }
+
+ if (player->preload_sounds) { // check if sounds are to be preloaded
+ digi_preload_play_breaks(list);
+ }
+
+ set_next_series_play_break(slot);
+ term_message("series_play_with_breaks:%s shadow:%s preload_sounds:%d slot:%d",
+ player->name, player->shadow_name, player->preload_sounds, slot);
+ return slot;
+}
+
+void digi_preload_play_breaks(const seriesPlayBreak list[]) {
+ int32 i = 0;
+
+ // While there is a legitimate frame to break on
+ while (list[i].firstFrame >= 0) {
+ // If variable is null or variable = value then this break is used
+ if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
+ // If there is a sound to load for this break
+ if (list[i].sound) {
+ if (!digi_preload(list[i].sound)) {
+ term_message("**** Couldn't load: %s.RAW", list[i].sound);
+ }
+ }
+ }
+
+ ++i; // Next in list please
+ }
+}
+
+void digi_unload_play_breaks(const seriesPlayBreak list[]) {
+ int32 i = 0;
+
+ while (list[i].firstFrame >= 0) {
+ // If there is a sound to unload
+ if (list[i].sound) {
+ digi_unload(list[i].sound); // Unload it
+ }
+ ++i; // Next in list please
+ }
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
new file mode 100644
index 00000000000..6fd7ff311b8
--- /dev/null
+++ b/engines/m4/burger/core/play_break.h
@@ -0,0 +1,61 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_PLAY_BREAK_H
+#define M4_BURGER_PLAY_BREAK_H
+
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv_trigger.h"
+
+namespace M4 {
+namespace Burger {
+
+struct seriesPlayBreak {
+ int32 firstFrame;
+ int32 lastFrame;
+ const char *sound;
+ int32 channel;
+ int32 volume;
+ int32 trigger;
+ uint32 flags;
+ int32 loopCount;
+ int32 *variable;
+ int32 value;
+};
+
+enum {
+ WITH_SHADOW = 1,
+ PRELOAD_SOUNDS = 2
+};
+
+#define PLAY_BREAK_END { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
+
+extern int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name,
+ frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 0,
+ int32 scale = 100, int32 x = 0, int32 y = 0);
+extern void digi_preload_play_breaks(const seriesPlayBreak list[]);
+extern void digi_unload_play_breaks(const seriesPlayBreak list[]);
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index fcb18f931ff..6c756baf049 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_ROOM_H
#include "m4/core/rooms.h"
+#include "m4/burger/core/play_break.h"
#include "m4/burger/core/stream_break.h"
namespace M4 {
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index b1e08eff167..c0842894351 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -30,7 +30,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-static const seriesStreamBreak STREAMS1[] = {
+static const seriesStreamBreak STREAM_BREAKS1[] = {
{ 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
@@ -38,7 +38,7 @@ static const seriesStreamBreak STREAMS1[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS2[] = {
+static const seriesStreamBreak STREAM_BREAKS2[] = {
{ 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 6, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 17, nullptr, 2, 255, -1, 0, nullptr, 0 },
@@ -47,7 +47,7 @@ static const seriesStreamBreak STREAMS2[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS3[] = {
+static const seriesStreamBreak STREAM_BREAKS3[] = {
{ 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
@@ -55,19 +55,25 @@ static const seriesStreamBreak STREAMS3[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS4[] = {
+static const seriesStreamBreak STREAM_BREAKS4[] = {
{ 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 7, nullptr, 2, 255, -1, 0, nullptr, 0 },
{ 13, nullptr, 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS5[] = {
+static const seriesStreamBreak STREAM_BREAKS5[] = {
{ 0, "100_010", 1, 255, -1, 0, nullptr, 0 },
{ 19, "100_011", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
+static const seriesPlayBreak PLAY_BREAKS1[] = {
+ { 0, 10, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 11, -1, "101_004", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
void Room101::init() {
_G(player).walker_in_this_scene = true;
_val1 = 255;
@@ -303,7 +309,7 @@ void Room101::daemon() {
case 10:
_machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAMS1, "101wi13", 6, 256, 2);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS1, "101wi13", 6, 256, 2);
break;
case 11:
@@ -325,7 +331,7 @@ void Room101::daemon() {
case 13:
_machine1 = series_play_("101wi12s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAMS2, "101wi12", 6, 256, 2);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS2, "101wi12", 6, 256, 2);
break;
case 14:
@@ -344,7 +350,7 @@ void Room101::daemon() {
case 16:
_machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAMS3, "101wi13", 6, 256, 2);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS3, "101wi13", 6, 256, 2);
break;
case 17:
@@ -365,7 +371,7 @@ void Room101::daemon() {
case 19:
_machine1 = series_play_("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAMS4, "101wi11", 6, 256, 2);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS4, "101wi11", 6, 256, 2);
break;
case 20:
@@ -386,8 +392,8 @@ void Room101::daemon() {
if (_G(player_info).x < 218 || (_G(player_info).x < 349 && _G(player_info).y > 277)) {
kernel_trigger_dispatch_now(27);
} else {
- digi_preload_stream_breaks(STREAMS5);
- series_stream_with_breaks(STREAMS5, "101dt01", 6, 1024, 25);
+ digi_preload_stream_breaks(STREAM_BREAKS5);
+ series_stream_with_breaks(STREAM_BREAKS5, "101dt01", 6, 1024, 25);
}
break;
@@ -398,7 +404,7 @@ void Room101::daemon() {
kernel_timing_trigger(3, 25);
} else {
digi_stop(1);
- digi_unload_stream_breaks(STREAMS5);
+ digi_unload_stream_breaks(STREAM_BREAKS5);
digi_stop(2);
digi_unload("100_013");
player_set_commands_allowed(true);
@@ -409,8 +415,8 @@ void Room101::daemon() {
case 26:
door();
reset_walker_sprites();
- digi_preload_stream_breaks(STREAMS5);
- series_stream_with_breaks(STREAMS5, "101dt01", 6, 1, 25);
+ digi_preload_stream_breaks(STREAM_BREAKS5);
+ series_stream_with_breaks(STREAM_BREAKS5, "101dt01", 6, 1, 25);
break;
case 27:
@@ -448,6 +454,11 @@ void Room101::daemon() {
ws_walk(_G(my_walker), 30, 288, nullptr, -1, 3);
break;
+ case 6:
+ _G(roomVal1) = 7;
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, 10016, 3, 6, 100, 0, -53);
+ break;
+
// TODO: More cases
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/series_player.h b/engines/m4/burger/series_player.h
index 262058288e0..b44ac2bffa5 100644
--- a/engines/m4/burger/series_player.h
+++ b/engines/m4/burger/series_player.h
@@ -25,34 +25,24 @@
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"
+#include "m4/burger/core/play_break.h"
namespace M4 {
namespace Burger {
-struct seriesPlayBreak {
- int32 firstFrame = 0;
- int32 lastFrame = 0;
- char *sound = nullptr;
- int32 channel = 0;
- int32 volume = 0;
- int32 trigger = 0;
- uint32 flags = 0;
- int32 loopCount = 0;
- int32 *variable = nullptr;
- int32 value = 0;
-};
-#define WITH_SHADOW 1 // Flag for seriesPlayBreak
-#define PRELOAD_SOUNDS 2 // Flag for seriesPlayBreak
+// Flags for series_stream_with_breaks and series_play_with_breaks
+#define DIGI_LOOP 1024 // these must be more than the series play flags
+#define DIGI_STOP 2048
struct seriesPlayer {
- seriesPlayBreak *break_list = nullptr; // Holds the list of breaks for digi plays
+ const seriesPlayBreak *break_list = nullptr; // Holds the list of breaks for digi plays
seriesPlayBreak current_break; // Current play break
machine *series_machine = nullptr; // Series' playback machine
machine *shadow_machine = nullptr; // Shadow series' playback machine
int32 series = 0; // Holds the series handle upon loading so it can be unloaded at the end
int32 shadow_series = 0; // Holds the series handle for the shadow
int32 index = 0; // Holds which line of the list currently waiting for a play break
- char *name = nullptr; // Name of series to play
+ const char *name = nullptr; // Name of series to play
char shadow_name[80] = { 0 };
int32 framerate = 0;
int32 trigger = 0;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 73e6d1fc435..409e26cb8b7 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -80,6 +80,7 @@ MODULE_OBJS = \
wscript/wscript.o \
wscript/wst_regs.o \
burger/core/release_trigger.o \
+ burger/core/play_break.o \
burger/core/stream_break.o \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
Commit: 7295efc65072b10a2b64676577dee62ac1c6aee2
https://github.com/scummvm/scummvm/commit/7295efc65072b10a2b64676577dee62ac1c6aee2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 101 daemon
Changed paths:
engines/m4/adv_r/adv_interface.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/burger/vars.h
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index eaac95b139e..3e417dd91f7 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -47,6 +47,8 @@ public:
virtual void cancel_sentence() = 0;
+ virtual void freshen_sentence() = 0;
+
virtual bool set_interface_palette(RGB8 *myPalette) = 0;
virtual bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) = 0;
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 112e333e45a..faf6d1b1961 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -118,6 +118,17 @@ void Interface::cancel_sentence() {
track_hotspots_refresh();
}
+void Interface::freshen_sentence() {
+ _textField->set_string(" ");
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = _G(player).need_to_walk;
+ _G(player).command_ready = _G(player).ready_to_walk;
+ _pointer1 = nullptr;
+ _pointer2 = nullptr;
+
+ track_hotspots_refresh();
+}
+
bool Interface::set_interface_palette(RGB8 *myPalette) {
gr_pal_set_RGB8(&myPalette[1], 0, 68, 0);
gr_pal_set_RGB8(&myPalette[2], 0, 134, 0);
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index e6781d1a170..a67a14188b8 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -64,6 +64,8 @@ public:
void cancel_sentence() override;
+ void freshen_sentence() override;
+
bool set_interface_palette(RGB8 *myPalette) override;
void track_hotspots_refresh() override;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index c0842894351..623cc90397f 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -68,9 +68,36 @@ static const seriesStreamBreak STREAM_BREAKS5[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak STREAM_BREAKS6[] = {
+ { 9, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 19, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 28, nullptr, 2, 255, -1, 0, nullptr, 0 },
+ { 32, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
static const seriesPlayBreak PLAY_BREAKS1[] = {
- { 0, 10, nullptr, 1, 255, -1, 0, 0, 0, 0 },
- { 11, -1, "101_004", 2, 255, -1, 0, 0, 0, 0 },
+ { 0, 10, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 11, -1, "101_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY_BREAKS2[] = {
+ { 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, -1, "102_038", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY_BREAKS3[] = {
+ { 0, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, -1, "101_002", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY_BREAKS4[] = {
+ { 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 1, 255, 10016, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
@@ -290,6 +317,9 @@ void Room101::daemon() {
series_load("101wi12s", -1, nullptr);
if (_G(flags)[ROOM101_FLAG20])
series_load("101wi11s", -1, nullptr);
+
+ _machine1 = series_play_("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS6, "101wi14", 6, 256, 2);
break;
case 8:
@@ -459,11 +489,109 @@ void Room101::daemon() {
series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, 10016, 3, 6, 100, 0, -53);
break;
- // TODO: More cases
+ case 7:
+ ws_unhide_walker(_G(my_walker));
+ player_set_commands_allowed(true);
+ break;
+
+ case 8:
+ _G(roomVal1) = 9;
+ TerminateMachineAndNull(_doorMachine);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, 10016, 3, 6, 100, 0, 0);
+ break;
+
+ case 9:
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1002);
+ break;
+
+ case 10:
+ _G(roomVal1) = 11;
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, 10016, 3, 6, 100, 0, -53);
+ break;
+
+ case 11:
+ door();
+ ws_unhide_walker(_G(my_walker));
+ player_set_commands_allowed(true);
+ break;
+
+ case 14:
+ TerminateMachineAndNull(_doorMachine);
+ _G(roomVal1) = 15;
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, 10016, 3, 6, 100, 0, 0);
+ break;
+
+ case 15:
+ _G(roomVal1) = 16;
+ digi_play("101h001", 1, 255, 10016);
+ break;
+
+ case 16:
+ _G(roomVal1) = 17;
+ series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, 10016, 3, 6, 100, 0, 0);
+ break;
+
+ case 17:
+ _G(roomVal1) = 19;
+ _val2 = 12;
+
+ if (_G(flags)[V005]) {
+ Common::String name = Common::String::format("101h003%c",
+ 'a' + imath_ranged_rand(0, 5));
+ digi_play(name.c_str(), 1, 255, 10016);
+ } else {
+ digi_play("101h002", 1, 255, 10016);
+ _G(flags)[V005] = 1;
+ }
+
+ series_play_("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 18:
+ door();
+ ws_unhide_walker(_G(my_walker));
+ player_set_commands_allowed(true);
+ break;
+
+ case 19:
+ _val2 = 13;
+ break;
+
+ case 20:
+ _G(roomVal1) = 11;
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, 10016, 3, 6, 100, 0, -53);
+ break;
+
+ case 21:
+ _G(roomVal1) = 22;
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1003);
+ break;
+
+ case 22:
+ series_play_("101wi04", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ series_play_("101wi04s", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
+
+ case 10028:
+ if (_G(flags)[V043]) {
+ _G(kernel).continue_handling_trigger = true;
+
+ } else if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ Section1::updateDisablePlayer();
+ digi_preload("100_013");
+ digi_play("100_013", 2, 255, -1);
+ kernel_timing_trigger(240, 24);
+ } else {
+ kernel_timing_trigger(60, 10028);
+ }
+ break;
// TODO: cases
default:
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 86ee6fb98a1..919d9b394d8 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -55,6 +55,26 @@ void Section1::updateWalker_(int x, int y, int dir, int trigger, bool mode) {
kernel_timing_trigger(1, 1026);
}
+void Section1::updateDisablePlayer() {
+ player_update_info(_G(my_walker), &_G(player_info));
+ player_set_commands_allowed(false);
+ g_vars->getInterface()->freshen_sentence();
+ walk(-1);
+
+ _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1003;
+}
+
+void Section1::walk(int facing, int trigger) {
+ if (_G(my_walker) && _G(player).walker_in_this_scene) {
+ player_update_info(_G(my_walker), &_G(player_info));
+
+ if (facing == -1)
+ ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(walkTrigger));
+ else
+ ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, facing, _G(completeWalk));
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 86129fc720f..d7fd0ef9e90 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -44,6 +44,8 @@ public:
virtual ~Section1() {}
static void updateWalker(int x, int y, int dir, int trigger, bool mode = false);
+ static void updateDisablePlayer();
+ static void walk(int facing, int trigger = -1);
};
} // namespace Rooms
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index e0996c85e51..2840af5eba3 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -98,6 +98,7 @@ public:
int _roomVal1 = 0;
int _roomVal2 = 0;
int _roomVal3 = 0;
+ int _walkTrigger = 0;
public:
Vars();
Commit: 9eb354b4759cce02c894c02e3584ed1a1b19b4bd
https://github.com/scummvm/scummvm/commit/9eb354b4759cce02c894c02e3584ed1a1b19b4bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merge wilbur.cpp methods into Walker class
Changed paths:
R engines/m4/burger/wilbur.cpp
R engines/m4/burger/wilbur.h
engines/m4/adv_r/adv.h
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 126b6b970d9..72154489445 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -53,6 +53,7 @@ enum {
BACKPACK = 998,
NOWHERE = 999
};
+#define GLOBAL_SCENE 999
enum KernelTriggerType {
KT_PARSE = 1,
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index f85dc6ec7a8..e18fc73a1d3 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -22,7 +22,6 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
-#include "m4/burger/wilbur.h"
namespace M4 {
namespace Burger {
@@ -68,11 +67,11 @@ void BurgerEngine::global_daemon() {
break;
case gWILBURS_SPEECH_START:
- wilbur_say();
+ _G(walker).wilbur_say();
break;
case gWILBURS_SPEECH_FINISHED:
- wilburs_speech_finished();
+ _G(walker).wilburs_speech_finished();
break;
// TODO: Other cases
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 623cc90397f..c5be7c8b768 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -21,7 +21,6 @@
#include "m4/burger/rooms/section1/room101.h"
#include "m4/burger/rooms/section1/section1.h"
-#include "m4/burger/wilbur.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
#include "m4/core/imath.h"
@@ -238,51 +237,51 @@ void Room101::daemon() {
"101w503", "101w504", "101w505", "101w506"
};
- wilbur_speech(NAMES[idx], 23);
+ _G(walker).wilbur_speech(NAMES[idx], 23);
} else if (!_G(flags)[ROOM101_FLAG4]) {
if (_G(flags)[ROOM101_FLAG5] <= 1) {
- wilbur_speech("101w520", 7);
+ _G(walker).wilbur_speech("101w520", 7);
} else if (_G(flags)[ROOM101_FLAG6] && !_G(flags)[ROOM101_FLAG7]) {
- wilbur_speech("101w522", 7);
+ _G(walker).wilbur_speech("101w522", 7);
_G(flags)[ROOM101_FLAG7] = 1;
} else if (_G(flags)[ROOM101_FLAG8] && !_G(flags)[ROOM101_FLAG9]) {
- wilbur_speech("101w521", 7);
+ _G(walker).wilbur_speech("101w521", 7);
_G(flags)[ROOM101_FLAG9] = 1;
} else {
- wilbur_speech("101w524", 7);
+ _G(walker).wilbur_speech("101w524", 7);
}
} else if (!_G(flags)[ROOM101_FLAG10]) {
if (_G(flags)[ROOM101_FLAG11] <= 1) {
- wilbur_speech("101w530", 7);
+ _G(walker).wilbur_speech("101w530", 7);
} else if (!_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG13]) {
- wilbur_speech("101w531", 7);
+ _G(walker).wilbur_speech("101w531", 7);
_G(flags)[ROOM101_FLAG13] = 1;
} else if (_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG14]) {
- wilbur_speech("101w533", 7);
+ _G(walker).wilbur_speech("101w533", 7);
_G(flags)[ROOM101_FLAG14] = 1;
} else if (_G(flags)[ROOM101_FLAG12] && _G(flags)[ROOM101_FLAG11] >= 5 &&
!_G(flags)[ROOM101_FLAG15]) {
- wilbur_speech("101w534", 7);
+ _G(walker).wilbur_speech("101w534", 7);
_G(flags)[ROOM101_FLAG15] = 1;
} else {
- wilbur_speech("101w532", 7);
+ _G(walker).wilbur_speech("101w532", 7);
}
} else if (!_G(flags)[ROOM101_FLAG16]) {
switch (_G(flags)[ROOM101_FLAG17]) {
case 0:
case 1:
- wilbur_speech("101w550", 7);
+ _G(walker).wilbur_speech("101w550", 7);
break;
case 2:
- wilbur_speech("101w552", 7);
+ _G(walker).wilbur_speech("101w552", 7);
break;
default:
if (_G(flags)[ROOM101_FLAG18] && !_G(flags)[ROOM101_FLAG19]) {
- wilbur_speech("101w551", 7);
+ _G(walker).wilbur_speech("101w551", 7);
_G(flags)[ROOM101_FLAG19] = 1;
} else {
kernel_timing_trigger(60, 7);
@@ -293,10 +292,10 @@ void Room101::daemon() {
switch (_G(flags)[ROOM101_FLAG21]) {
case 0:
case 1:
- wilbur_speech("101w570", 7);
+ _G(walker).wilbur_speech("101w570", 7);
break;
case 2:
- wilbur_speech("101w571", 7);
+ _G(walker).wilbur_speech("101w571", 7);
break;
default:
kernel_timing_trigger(60, 7);
@@ -444,7 +443,7 @@ void Room101::daemon() {
case 26:
door();
- reset_walker_sprites();
+ _G(walker).reset_walker_sprites();
digi_preload_stream_breaks(STREAM_BREAKS5);
series_stream_with_breaks(STREAM_BREAKS5, "101dt01", 6, 1, 25);
break;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 2840af5eba3..223640255da 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -31,7 +31,6 @@
#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
-#include "m4/burger/wilbur.h"
namespace M4 {
namespace Burger {
@@ -88,7 +87,6 @@ public:
ReleaseTrigger_Globals _releaseTrigger;
StreamBreak_Globals _streamBreak;
Burger::Walker _walker;
- Wilbur_Globals _wilbur;
int _wilburTerm = 2;
const Common::String _wilburName = "WILBUR";
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 5c1a04a20b9..9915fdc3460 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -21,6 +21,8 @@
#include "m4/burger/walker.h"
#include "m4/burger/vars.h"
+#include "m4/core/imath.h"
+#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
@@ -40,15 +42,104 @@ namespace Burger {
#define SHADOW_WILBUR 0
#define SHADOW_FLUMIX 1
+static const char *WILBUR_SERIES[8] = {
+ "WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
+ "WILBUR07", "WILBUR08", "WILBUR09"
+};
+static const int16 WILBUR_SERIES_DIRS[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, -1
+};
+
+static const char *WILBUR_SHADOWS[5] = {
+ "WILBUR01_SHADOW", "WILBUR02_SHADOW", "WILBUR03_SHADOW",
+ "WILBUR04_SHADOW", "WILBUR05_SHADOW"
+};
+static const int16 WILBUR_SHADOWS_DIRS[6] = {
+ 8, 9, 10, 11, 12, -1
+};
+
+const char **Walker::myFootsteps;
+int32 Walker::numFootstepSounds;
+
+void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
+#ifdef TODO
+ int32 triggerType, soundNumber;
+
+ triggerType = _G(globals)[GLB_TEMP_1] >> 16;
+
+ switch (triggerType) {
+ case 0:
+ // Ignore this trigger, it's not important
+ break;
+
+ case 1:
+ // Specific action is finished
+ if (myMessage >> 16 >= 0) { // If user trigger is desired, dispatch it
+ kernel_trigger_dispatch(myMessage); // Trigger will go to where it was called from
+ }
+ break;
+
+ case 2:
+ // walker has arrived at a node
+ if (walker_has_walk_finished(sender)) {
+ // Walks walker to next node if not at end of walk
+ SendMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
+ }
+ break;
+
+ case 3:
+ // Walker has finished his walk and is facing final direction
+ _G(player).waiting_for_walk = false;
+ if (myMessage >> 16 >= 0) { // if user trigger is desired, dispatch it
+ kernel_trigger_dispatch(myMessage); // trigger will go to where it was called from
+ }
+ break;
+
+ case 20:
+ // Walker wants to make a sound
+ soundNumber = myMessage >> 16;
+ switch (soundNumber) {
+ case 21:
+ if (myFootsteps) {
+ digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ }
+ break;
+ case 22:
+ if (myFootsteps) {
+ digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ }
+ break;
+ case 23:
+ term_message("Wilbur: crack");
+ digi_play("crack1", 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 24:
+ term_message("Wilbur: hmmm");
+ digi_play("hmmm", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 25:
+ if (myFootsteps) {
+ digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ }
+ break;
+ }
+ break;
+
+ default:
+ _G(player).waiting_for_walk = false;
+ break;
+ }
+#else
+ error("TODO: player_walker_callback");
+#endif
+}
bool Walker::walk_load_walker_and_shadow_series() {
- // TODO
- warning("TODO: walk_load_walker_and_shadow_series");
- return true;
+ return ws_walk_load_walker_series(WILBUR_SERIES_DIRS, WILBUR_SERIES, true) &&
+ ws_walk_load_shadow_series(WILBUR_SHADOWS_DIRS, WILBUR_SHADOWS);
}
machine *Walker::walk_initialize_walker() {
-#if 0
machine *m;
int32 s;
@@ -67,18 +158,65 @@ machine *Walker::walk_initialize_walker() {
_G(globals)[GLB_TEMP_6] = s;
_G(globals)[GLB_TEMP_7] = 3 << 16; // facing
- m = TriggerMachineByHash(WALKER_HASH, NULL, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
+ m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
// we need to all init sequences to happen immediately (init coordinates)
- CycleEngines(NULL, &(currentSceneDef.depth_table[0]),
- NULL, (uint8 *)&master_palette[0], inverse_pal->get_ptr(), TRUE);
+ CycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
+ nullptr, (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
- inverse_pal->release();
+ _G(inverse_pal)->release();
return m;
-#else
- error("TODO: walk_initialize_walker");
-#endif
+}
+
+void Walker::reset_walker_sprites() {
+ if (_G(roomVal3)) {
+ for (int i = 0; WILBUR_SERIES_DIRS[i] != -1; ++i) {
+ series_load(WILBUR_SERIES[i], WILBUR_SERIES_DIRS[i]);
+ }
+ }
+
+ ws_unhide_walker(_G(my_walker));
+ gr_restore_palette();
+ kernel_timing_trigger(1, 1026);
+}
+
+void Walker::wilbur_speech(const char *name, int trigger, int room, byte flags, int vol, int channel) {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _name = name;
+ _channel = channel;
+ _room = room;
+ _vol = vol;
+ _trigger = kernel_trigger_create(trigger);
+ _flag = (flags & 1) != 0;
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(gWILBURS_SPEECH_START);
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void Walker::wilbur_say() {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+
+ if (_flag && _G(player).walker_in_this_scene && _G(roomVal2))
+ SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+
+ term_message("wilbur_say: wilburs_talk_trigger = %d", _trigger);
+ digi_stop(_channel);
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(10013);
+ digi_play(_name, _channel, _vol, gWILBURS_SPEECH_FINISHED, _room);
+
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void Walker::wilburs_speech_finished() {
+ if (_flag && !_G(player).walker_in_this_scene && !_G(roomVal2))
+ SendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+
+ term_message("wilburs_speech_finished: dispatching wilburs_talk_trigger = %d", _trigger);
+ kernel_trigger_dispatchx(_trigger);
}
} // namespace Burger
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index bb63bb28c69..9165e53b217 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -29,11 +29,32 @@ namespace M4 {
namespace Burger {
class Walker : public M4::Walker {
+private:
+ static const char **myFootsteps; // Handle to array of pointers to strings of the footstep sounds
+ static int32 numFootstepSounds; // Number of footstep sounds to choose from
+ const char *_name = nullptr;
+ int _channel = 0;
+ int _room = 0;
+ int _vol = 0;
+ int32 _trigger = 0;
+ bool _flag = false;
+
+ /**
+ * This is called when PLAYER walker code sends system message back to C (used by MAIN PLAYER WALKER ONLY)
+ */
+ static void player_walker_callback(frac16 myMessage, machine *sender);
+
public:
~Walker() override {}
bool walk_load_walker_and_shadow_series() override;
machine *walk_initialize_walker() override;
+
+ void reset_walker_sprites();
+ void wilbur_speech(const char *name, int trigger, int room = -1, byte flags = 0,
+ int vol = 256, int channel = 1);
+ void wilbur_say();
+ void wilburs_speech_finished();
};
} // namespace Burger
diff --git a/engines/m4/burger/wilbur.cpp b/engines/m4/burger/wilbur.cpp
deleted file mode 100644
index 27a360e4ca1..00000000000
--- a/engines/m4/burger/wilbur.cpp
+++ /dev/null
@@ -1,103 +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/>.
- *
- */
-
-#include "m4/burger/wilbur.h"
-#include "m4/burger/vars.h"
-#include "m4/graphics/gr_series.h"
-
-namespace M4 {
-namespace Burger {
-
-#define _WIL(X) _G(wilbur)._##X
-
-static const char *WILBUR_SERIES[8] = {
- "WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
- "WILBUR07", "WILBUR08", "WILBUR09"
-};
-static const int16 WILBUR_SERIES_DIRS[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, -1
-};
-
-static const char *WILBUR_SHADOWS[5] = {
- "WILBUR01_SHADOW", "WILBUR02_SHADOW", "WILBUR03_SHADOW",
- "WILBUR04_SHADOW", "WILBUR05_SHADOW"
-};
-static const int16 WILBUR_SHADOWS_DIRS[6] = {
- 8, 9, 10, 11, 12, -1
-};
-
-bool load_walker_sprites() {
- return ws_walk_load_walker_series(WILBUR_SERIES_DIRS, WILBUR_SERIES, true) &&
- ws_walk_load_shadow_series(WILBUR_SHADOWS_DIRS, WILBUR_SHADOWS);
-}
-
-void reset_walker_sprites() {
- if (_G(roomVal3)) {
- for (int i = 0; WILBUR_SERIES_DIRS[i] != -1; ++i) {
- series_load(WILBUR_SERIES[i], WILBUR_SERIES_DIRS[i]);
- }
- }
-
- ws_unhide_walker(_G(my_walker));
- gr_restore_palette();
- kernel_timing_trigger(1, 1026);
-}
-
-void wilbur_speech(const char *name, int trigger, int room, byte flags, int vol, int channel) {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
- _WIL(name) = name;
- _WIL(channel) = channel;
- _WIL(room) = room;
- _WIL(vol) = vol;
- _WIL(trigger) = kernel_trigger_create(trigger);
- _WIL(flag) = (flags & 1) != 0;
-
- _G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(gWILBURS_SPEECH_START);
- _G(kernel).trigger_mode = oldMode;
-}
-
-void wilbur_say() {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
-
- if (_WIL(flag) && _G(player).walker_in_this_scene && _G(roomVal2))
- SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
-
- term_message("wilbur_say: wilburs_talk_trigger = %d", _WIL(trigger));
- digi_stop(_WIL(channel));
-
- _G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(10013);
- digi_play(_WIL(name), _WIL(channel), _WIL(vol), gWILBURS_SPEECH_FINISHED, _WIL(room));
-
- _G(kernel).trigger_mode = oldMode;
-}
-
-void wilburs_speech_finished() {
- if (_WIL(flag) && !_G(player).walker_in_this_scene && !_G(roomVal2))
- SendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
-
- term_message("wilburs_speech_finished: dispatching wilburs_talk_trigger = %d", _WIL(trigger));
- kernel_trigger_dispatchx(_WIL(trigger));
-}
-
-} // namespace Burger
-} // namespace M4
diff --git a/engines/m4/burger/wilbur.h b/engines/m4/burger/wilbur.h
deleted file mode 100644
index 62862c5b4ab..00000000000
--- a/engines/m4/burger/wilbur.h
+++ /dev/null
@@ -1,51 +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/>.
- *
- */
-
-#ifndef M4_BURGER_WILBUR_H
-#define M4_BURGER_WILBUR_H
-
-#include "m4/m4_types.h"
-
-namespace M4 {
-namespace Burger {
-
-struct Wilbur_Globals {
- const char *_name = nullptr;
- int _channel = 0;
- int _room = 0;
- int _vol = 0;
- int32 _trigger = 0;
- bool _flag = false;
-};
-
-extern void reset_walker_sprites();
-extern bool load_walker_sprites();
-
-extern void wilbur_speech(const char *name, int trigger, int room = -1, byte flags = 0,
- int vol = 256, int channel = 1);
-extern void wilbur_say();
-extern void wilburs_speech_finished();
-
-} // namespace Burger
-} // namespace M4
-
-#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 409e26cb8b7..f522c4d8f5d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -104,8 +104,7 @@ MODULE_OBJS = \
burger/other.o \
burger/series_player.o \
burger/vars.o \
- burger/walker.o \
- burger/wilbur.o
+ burger/walker.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
Commit: 39a9cab73f9f04e054ae6bb346fd1525c126aa9a
https://github.com/scummvm/scummvm/commit/39a9cab73f9f04e054ae6bb346fd1525c126aa9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove duplicated gameInterfaceBuff global
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index bfeae991c1b..aeae8830396 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -152,7 +152,7 @@ void TextField::draw(GrBuff *myBuffer) {
gr_font_write(myBuff, _string, _x1, _y1, 0, 1);
myBuffer->release();
- ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
+ ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw = false;
}
@@ -349,7 +349,7 @@ void ButtonClass::draw(GrBuff *myBuffer) {
myBuffer->release();
_must_redraw = false;
- ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
+ ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1 - 2, _x2, _y2, iC);
}
@@ -515,7 +515,7 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
}
if (_must_redraw_all) {
- ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
+ ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
}
@@ -713,7 +713,7 @@ void Inventory::draw(GrBuff *myBuffer) {
series_show_frame(_sprite, 68, myBuff, cell_iter * 39 + 188, 92);
}
- ScreenContext *iC = vmng_screen_find(_GI(gameInterfaceBuff), nullptr);
+ ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw1 = _must_redraw2 = -1;
_must_redraw_all = false;
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index faf6d1b1961..44f262a854b 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -46,14 +46,14 @@ void Interface::init(int arrow, int wait, int look, int grab, int use) {
mouse_set_sprite(wait);
- _gameInterfaceBuff = new GrBuff(_x2 - _x1, _y2 - _y1);
+ _G(gameInterfaceBuff) = new GrBuff(_x2 - _x1, _y2 - _y1);
setup();
mouse_set_sprite(arrow);
}
Interface::~Interface() {
- delete _gameInterfaceBuff;
+ delete _G(gameInterfaceBuff);
delete _interfaceBox;
delete _inventory;
delete _textField;
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index a67a14188b8..ec0b7682b38 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -39,7 +39,6 @@ public:
int _sprite = 22; // main_interface_sprite;
bool _visible = false;
bool _shown = false;
- GrBuff *_gameInterfaceBuff = nullptr;
GUI::InterfaceBox *_interfaceBox = nullptr;
GUI::Inventory *_inventory = nullptr;
GUI::TextField *_textField = nullptr;
Commit: cb4c666672bd10a341e4d738c1942eb397f96541
https://github.com/scummvm/scummvm/commit/cb4c666672bd10a341e4d738c1942eb397f96541
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added walker callback method, Digi playRandom
Changed paths:
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 9915fdc3460..274ec5a266d 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -58,11 +58,7 @@ static const int16 WILBUR_SHADOWS_DIRS[6] = {
8, 9, 10, 11, 12, -1
};
-const char **Walker::myFootsteps;
-int32 Walker::numFootstepSounds;
-
void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
-#ifdef TODO
int32 triggerType, soundNumber;
triggerType = _G(globals)[GLB_TEMP_1] >> 16;
@@ -74,25 +70,28 @@ void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
case 1:
// Specific action is finished
- if (myMessage >> 16 >= 0) { // If user trigger is desired, dispatch it
- kernel_trigger_dispatch(myMessage); // Trigger will go to where it was called from
- }
+ // If user trigger is desired, dispatch it
+ if (myMessage >> 16 >= 0)
+ // Trigger will go to where it was called from
+ kernel_trigger_dispatchx(myMessage);
break;
case 2:
- // walker has arrived at a node
+ // Walker has arrived at a node
if (walker_has_walk_finished(sender)) {
// Walks walker to next node if not at end of walk
- SendMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
+ SendWSMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
}
break;
case 3:
// Walker has finished his walk and is facing final direction
_G(player).waiting_for_walk = false;
- if (myMessage >> 16 >= 0) { // if user trigger is desired, dispatch it
- kernel_trigger_dispatch(myMessage); // trigger will go to where it was called from
- }
+
+ // if user trigger is desired, dispatch it
+ if (myMessage >> 16 >= 0)
+ // trigger will go to where it was called from
+ kernel_trigger_dispatchx(myMessage);
break;
case 20:
@@ -100,27 +99,34 @@ void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
soundNumber = myMessage >> 16;
switch (soundNumber) {
case 21:
- if (myFootsteps) {
- digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
- }
- break;
case 22:
- if (myFootsteps) {
- digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
- }
+ case 25:
+ if (!_G(flags)[V298])
+ _G(digi).playRandom();
break;
+
case 23:
- term_message("Wilbur: crack");
- digi_play("crack1", 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("crack1", 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 2:
+ digi_play("crack2", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 3:
+ digi_play("crack3", 1, 80, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ default:
+ break;
+ }
break;
+
case 24:
- term_message("Wilbur: hmmm");
- digi_play("hmmm", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
+ if (!_G(flags)[V298])
+ digi_play("hmmm", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
break;
- case 25:
- if (myFootsteps) {
- digi_play(myFootsteps[imath_ranged_rand(0, numFootstepSounds - 1)], 1, 50, NO_TRIGGER, GLOBAL_SCENE);
- }
+
+ default:
break;
}
break;
@@ -129,9 +135,6 @@ void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
_G(player).waiting_for_walk = false;
break;
}
-#else
- error("TODO: player_walker_callback");
-#endif
}
bool Walker::walk_load_walker_and_shadow_series() {
@@ -143,28 +146,36 @@ machine *Walker::walk_initialize_walker() {
machine *m;
int32 s;
- // Wilbur walker
- _G(player).walker_type = WALKER_WILBUR;
- _G(player).shadow_type = SHADOW_WILBUR;
+ if (!_G(player).walker_in_this_scene) {
+ _G(roomVal2) = 0;
+ m = nullptr;
+
+ } else {
+ _G(roomVal2) = 1;
- _G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
- _G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
- _G(globals)[GLB_TEMP_3] = SHADOW_SERIES_HASH << 24; // starting series hash of default walker shadows. GAMECTRL loads shadows starting @ 10
+ // Wilbur walker
+ _G(player).walker_type = WALKER_WILBUR;
+ _G(player).shadow_type = SHADOW_WILBUR;
- // initialize with bogus data (this is for the real walker)
- s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
- _G(globals)[GLB_TEMP_4] = 320 << 16;
- _G(globals)[GLB_TEMP_5] = 400 << 16;
- _G(globals)[GLB_TEMP_6] = s;
- _G(globals)[GLB_TEMP_7] = 3 << 16; // facing
+ _G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
+ _G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
+ _G(globals)[GLB_TEMP_3] = SHADOW_SERIES_HASH << 24; // starting series hash of default walker shadows. GAMECTRL loads shadows starting @ 10
- m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
+ // initialize with bogus data (this is for the real walker)
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+ _G(globals)[GLB_TEMP_4] = 320 << 16;
+ _G(globals)[GLB_TEMP_5] = 400 << 16;
+ _G(globals)[GLB_TEMP_6] = s;
+ _G(globals)[GLB_TEMP_7] = 3 << 16; // facing
- // we need to all init sequences to happen immediately (init coordinates)
- CycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
- nullptr, (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+ m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
- _G(inverse_pal)->release();
+ // we need to all init sequences to happen immediately (init coordinates)
+ CycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
+ nullptr, (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+
+ _G(inverse_pal)->release();
+ }
return m;
}
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 9165e53b217..6feff841bf3 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -30,8 +30,6 @@ namespace Burger {
class Walker : public M4::Walker {
private:
- static const char **myFootsteps; // Handle to array of pointers to strings of the footstep sounds
- static int32 numFootstepSounds; // Number of footstep sounds to choose from
const char *_name = nullptr;
int _channel = 0;
int _room = 0;
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index faba79565bf..7ada67761ab 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -24,6 +24,7 @@
#include "audio/decoders/raw.h"
#include "m4/platform/sound/digi.h"
#include "m4/adv_r/adv_file.h"
+#include "m4/core/imath.h"
#include "m4/fileio/extensions.h"
#include "m4/vars.h"
@@ -127,6 +128,18 @@ int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trig
return 0;
}
+void Digi::playRandom() {
+ if (!_sounds.empty()) {
+ int soundNum = imath_ranged_rand(0, (int)_sounds.size() - 1);
+
+ auto it = _sounds.begin();
+ for (int i = 0; i < soundNum; ++i, ++it) {
+ }
+
+ play(it->_key, 1, 100, NO_TRIGGER, GLOBAL_SCENE);
+ }
+}
+
Common::String Digi::expand_name_2_RAW(const Common::String &name, int32 room_num) {
Common::String tempName = f_extension_new(name, "RAW");
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index b2a828ab3b0..2189faa90ce 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -86,6 +86,7 @@ public:
int32 play(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
int32 play_loop(const Common::String &name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
+ void playRandom();
void stop(uint channel);
void flush_mem();
Commit: afe1da8cfe35805295d475de689298390a1558d7
https://github.com/scummvm/scummvm/commit/afe1da8cfe35805295d475de689298390a1558d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: playRandom should only choose from explicitly preloaded sounds
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 7ada67761ab..b93260567b3 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -40,8 +40,10 @@ void Digi::preload_sounds(const char **names) {
unload_sounds();
if (names) {
- for (; *names; ++names)
- preload(*names, NOWHERE);
+ for (; *names; ++names) {
+ if (preload(*names, NOWHERE))
+ _sounds[*names]._preloaded = true;
+ }
}
}
@@ -129,14 +131,18 @@ int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trig
}
void Digi::playRandom() {
- if (!_sounds.empty()) {
- int soundNum = imath_ranged_rand(0, (int)_sounds.size() - 1);
+ // Get a list of any preloaded sounds, excluding individual sounds
+ // that were directly played
+ Common::Array<Common::String> names;
- auto it = _sounds.begin();
- for (int i = 0; i < soundNum; ++i, ++it) {
- }
+ for (auto it = _sounds.begin(); it != _sounds.end(); ++it) {
+ if (it->_value._preloaded)
+ names.push_back(it->_key);
+ }
- play(it->_key, 1, 100, NO_TRIGGER, GLOBAL_SCENE);
+ if (!names.empty()) {
+ play(names[imath_ranged_rand(0, (int)names.size() - 1)].c_str(),
+ 1, 100, NO_TRIGGER, GLOBAL_SCENE);
}
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 2189faa90ce..52d2a1ed5bb 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -43,6 +43,7 @@ class Digi {
struct DigiEntry {
byte *_data = nullptr;
size_t _size = 0;
+ bool _preloaded = false;
DigiEntry() {}
DigiEntry(byte *data, size_t size) : _data(data), _size(size) {}
};
Commit: 4b69814cbbd7825d77d34fc80ededbda17422701
https://github.com/scummvm/scummvm/commit/4b69814cbbd7825d77d34fc80ededbda17422701
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix shutdown crash
Changed paths:
engines/m4/burger/gui/interface.cpp
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 44f262a854b..437439bcb68 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -53,7 +53,6 @@ void Interface::init(int arrow, int wait, int look, int grab, int use) {
}
Interface::~Interface() {
- delete _G(gameInterfaceBuff);
delete _interfaceBox;
delete _inventory;
delete _textField;
Commit: c96b277552ed366496999ff7611871092a0f6851
https://github.com/scummvm/scummvm/commit/c96b277552ed366496999ff7611871092a0f6851
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing interface event handler
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 437439bcb68..ffd43b7b0ce 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -167,7 +167,7 @@ bool Interface::set_interface_palette(RGB8 *myPalette) {
void Interface::track_hotspots_refresh() {
_hotspot = nullptr;
- --_counter;
+ --_savedX;
bool z = false;
eventHandler(_G(gameInterfaceBuff), EVENT_MOUSE, 1,
@@ -175,10 +175,86 @@ void Interface::track_hotspots_refresh() {
}
bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
- warning("TODO: Interface::eventHandler");
+ if (eventType != EVENT_MOUSE)
+ return false;
+
+ if (_G(kernel).fading_to_grey && event == 5) {
+ kernel_unexamine_inventory_object(_G(master_palette), 5, 1);
+ return true;
+ }
+
+ if (player_commands_allowed()) {
+ if (x == _savedX && y == _savedY && event != 2 && event != 5 &&
+ event != 3 && event != 4)
+ return true;
+
+ _savedX = x;
+ _savedY = y;
+
+ ControlStatus status = _interfaceBox->track(event, _x1, _y1);
+
+ switch (status) {
+ case NOTHING:
+ _state = 0;
+ break;
+ case SELECTED:
+ sub1();
+ break;
+ default:
+ _state = 1;
+ break;
+ }
+
+ if (_state == 0 || _state == 2) {
+ status = _inventory->track(event, _x1, _y1);
+ _state = (status == NOTHING) ? 0 : 2;
+ }
+
+ if (!_state) {
+ int32 scrStatus;
+ ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
+
+ if (y >= _y1) {
+ if (!_flag1)
+ mouse_set_sprite(kArrowCursor);
+
+ _textField->set_string(" ");
+ }
+
+ if (track(event, x - screen->x1, y - screen->y1) == SELECTED)
+ dispatch_command();
+ }
+ }
+
+ if (_interfaceBox->_must_redraw_all) {
+ _textField->_must_redraw = true;
+ _inventory->_must_redraw_all = true;
+ }
+
+ _interfaceBox->draw(_G(gameInterfaceBuff));
+ _textField->draw(_G(gameInterfaceBuff));
+ _inventory->draw(_G(gameInterfaceBuff));
+
return true;
}
+void Interface::sub1() {
+ warning("TODO: Interface::sub1");
+}
+
+void Interface::sub2() {
+ warning("TODO: Interface::sub2");
+}
+
+ControlStatus Interface::track(int event, int x, int y) {
+ warning("TODO: Interface::track");
+ return NOTHING;
+}
+
+void Interface::dispatch_command() {
+ warning("TODO: Interface::dispatch_command");
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index ec0b7682b38..291695527bd 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -35,6 +35,12 @@ namespace GUI {
struct Interface : public M4::Interface {
private:
void setup();
+
+ void sub1();
+ void sub2();
+ ControlStatus track(int event, int x, int y);
+ void dispatch_command();
+
public:
int _sprite = 22; // main_interface_sprite;
bool _visible = false;
@@ -50,11 +56,12 @@ public:
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
void *_hotspot = nullptr;
- uint32 _counter = 0;
+ int _savedX = 0, _savedY = 0;
void *_pointer1 = nullptr;
void *_pointer2 = nullptr;
void *_pointer3 = nullptr;
bool _flag1 = false;
+ int _state = 0;
Interface();
~Interface() override;
Commit: c32970bf39117a2eae000ebf4ca3cd8103e0fa2f
https://github.com/scummvm/scummvm/commit/c32970bf39117a2eae000ebf4ca3cd8103e0fa2f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for drawing interface sprites
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/gui_cheapo.h
engines/m4/burger/gui/interface.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index aeae8830396..bfd5fe89e93 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -174,8 +174,8 @@ ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int1
}
ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
- int16 unknown, int16 relaxed, int16 over, int16 picked) : RectClass(r),
- _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked) {
+ int16 unknown, int16 relaxed, int16 over, int16 picked, int sprite) : RectClass(r),
+ _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked), _sprite(sprite) {
}
ButtonClass::ButtonClass() : RectClass() {
diff --git a/engines/m4/burger/gui/gui_cheapo.h b/engines/m4/burger/gui/gui_cheapo.h
index b5b77c312ec..48b7eeb23f6 100644
--- a/engines/m4/burger/gui/gui_cheapo.h
+++ b/engines/m4/burger/gui/gui_cheapo.h
@@ -116,7 +116,7 @@ public:
ButtonClass();
ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag);
ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
- int16 unknown, int16 relaxed, int16 over, int16 picked);
+ int16 unknown, int16 relaxed, int16 over, int16 picked, int sprite);
~ButtonClass();
void draw(GrBuff *interface_buffer);
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index ffd43b7b0ce..f71031c8fc1 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -30,6 +30,8 @@ namespace M4 {
namespace Burger {
namespace GUI {
+#define INTERFACE_SPRITES 22
+
Interface::Interface() : M4::Interface() {
_x1 = 0;
_y1 = 374;
@@ -77,9 +79,9 @@ void Interface::setup() {
_interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
_inventory = new GUI::Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
_textField = new TextField(200, 1, 450, 21);
- _btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5);
- _btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8);
- _btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2);
+ _btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5, INTERFACE_SPRITES);
+ _btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8, INTERFACE_SPRITES);
+ _btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2, INTERFACE_SPRITES);
_interfaceBox->add(_btnTake);
_interfaceBox->add(_btnManipulate);
@@ -87,18 +89,18 @@ void Interface::setup() {
if (_G(executing) == WHOLE_GAME) {
- _btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71);
- _btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78);
+ _btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
+ _btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78, INTERFACE_SPRITES);
_interfaceBox->add(_btnAbductFail);
_interfaceBox->add(_btnMenu);
} else {
- _btnAbductFail = new ButtonClass(RectClass(580, 22, 620, 75), "abductfail", 10, 69, 69, 70, 71);
+ _btnAbductFail = new ButtonClass(RectClass(580, 22, 620, 75), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
_interfaceBox->add(_btnAbductFail);
}
- _btnScrollLeft = new ButtonClass(RectClass(168, 22, 188, 97), "scroll left", 8, 59, 60, 61, 62);
- _btnScrollRight = new ButtonClass(RectClass(539, 22, 559, 97), "scroll right", 9, 63, 64, 65, 66);
+ _btnScrollLeft = new ButtonClass(RectClass(168, 22, 188, 97), "scroll left", 8, 59, 60, 61, 62, INTERFACE_SPRITES);
+ _btnScrollRight = new ButtonClass(RectClass(539, 22, 559, 97), "scroll right", 9, 63, 64, 65, 66, INTERFACE_SPRITES);
_interfaceBox->add(_btnScrollLeft);
_interfaceBox->add(_btnScrollRight);
}
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index ed3eab74ee2..fc214c8888f 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -48,20 +48,64 @@ void series_unload(int32 assetIndex) {
}
bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y) {
- error("TODO: series_draw_sprite");
- return false;
+ M4sprite srcSprite, *srcSpritePtr;
+ M4Rect clipRect, updateRect;
+
+ if (!destBuff) {
+ error_show(FL, 'BUF!');
+ return false;
+ }
+
+ srcSpritePtr = &srcSprite;
+ if ((srcSpritePtr = GetWSAssetSprite(nullptr, (uint32)spriteHash, (uint32)index, srcSpritePtr, nullptr)) == nullptr)
+ error_show(FL, 'SPNF', "hash: %ld, index: %ld", spriteHash, index);
+
+ HLock(srcSpritePtr->sourceHandle);
+ //gr_pal_interface(&master_palette[0]);
+ srcSpritePtr->data = (uint8 *)((int32) * (srcSpritePtr->sourceHandle) + srcSpritePtr->sourceOffset);
+
+ RendGrBuff Destination;
+ DrawRequestX dr;
+ RendCell Frame;
+
+ Destination.Width = destBuff->stride;
+ Destination.Height = destBuff->h;
+ Destination.PixMap = (void *)destBuff->data;
+
+ dr.x = x;
+ dr.y = y;
+ dr.scale_x = 100;
+ dr.scale_y = 100;
+ dr.depth_map = destBuff->data;
+ dr.Pal = nullptr;
+ dr.ICT = nullptr;
+ dr.depth = 0;
+
+ Frame.hot_x = srcSpritePtr->xOffset;
+ Frame.hot_y = srcSpritePtr->yOffset;
+
+ Frame.Width = srcSpritePtr->w;
+ Frame.Height = srcSpritePtr->h;
+ Frame.Comp = (uint32)srcSpritePtr->encoding;
+ Frame.data = srcSpritePtr->data;
+
+ clipRect.x1 = 0;
+ clipRect.y1 = 0;
+ clipRect.x2 = Destination.Width;
+ clipRect.y2 = Destination.Height;
+
+ // and draw the sprite
+ render_sprite_to_8BBM(&Destination, &dr, &Frame, &clipRect, &updateRect);
+
+ HUnLock(srcSpritePtr->sourceHandle);
+ return true;
+
}
bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y) {
return series_draw_sprite(spriteHash, index, destBuff, x, y);
}
-machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
- int32 x, int32 y, int32 s, int32 layer, int32 frameRate, int16 triggerNum) {
- error("TODO: series_play_xy");
- return nullptr;
-}
-
machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger) {
machine *m;
SysFile *sysFile = new SysFile(seriesName);
@@ -152,7 +196,7 @@ machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16
CHECK_SERIES
int32 myAssetIndex;
- RGB8 *tempPalettePtr = NULL;
+ RGB8 *tempPalettePtr = nullptr;
term_message(seriesName);
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 061b289a350..a1336fb3c63 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -57,12 +57,8 @@ extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
-extern machine *series_place_sprite(char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
-extern machine *series_show_sprite(char *seriesName, int32 index, int32 layer); // was simple_show_sprite
-
-extern machine *series_play_xy(char *seriesName, int32 loopCount, uint32 flags,
- int32 x, int32 y,
- int32 s, int32 layer, int32 frameRate, int16 triggerNum);
+extern machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
+extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
extern machine *series_play(char *seriesName, int32 loopCount, uint32 flags,
int32 s, int32 layer, int32 frameRate, int16 triggerNum,
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 263e47abac3..42cae522450 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -297,7 +297,7 @@ void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
bool examining_inventory_object = false;
-
+#ifdef UNUSED
void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger) {
@@ -347,6 +347,7 @@ void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int de
PauseEngines();
}
+#endif
void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
if (!_GP(seriesAnim8) || _GP(seriesHash) < 0)
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index be839dd6682..0e5a2ae9ff7 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -114,8 +114,6 @@ extern void pal_fx_update();
*/
extern void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
-extern void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
- int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger);
extern void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay);
extern void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2);
Commit: fa12ee0c4b4e2d9ab5c273eaffd2222ae0e0e991
https://github.com/scummvm/scummvm/commit/fa12ee0c4b4e2d9ab5c273eaffd2222ae0e0e991
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add missing inventory drawing
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index bfd5fe89e93..739ad0c3096 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -37,14 +37,6 @@ namespace M4 {
namespace Burger {
namespace GUI {
-static void refresh_right_arrow() {
- error("TODO: refresh_right_arrow");
-}
-
-static void refresh_left_arrow() {
- error("TODO: refresh_left_arrow");
-}
-
RectClass::RectClass() {
}
@@ -689,8 +681,8 @@ void Inventory::draw(GrBuff *myBuffer) {
if (_must_redraw1 == cell_iter || _must_redraw2 == cell_iter || _must_redraw_all) {
// This does the button update....
- refresh_right_arrow();
- refresh_left_arrow();
+ _G(interface).refresh_right_arrow();
+ _G(interface).refresh_left_arrow();
// Draw icon here
gr_color_set(__BLACK);
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index f71031c8fc1..358d8b47d54 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -240,7 +240,34 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
return true;
}
+void Interface::refresh_right_arrow() {
+ if (_inventory->need_right() || _inventory->need_left()) {
+ _btnScrollRight->set_sprite_unknown(63);
+ _btnScrollRight->set_sprite_relaxed(64);
+ _btnScrollRight->set_sprite_picked(66);
+ _btnScrollRight->set_sprite_over(65);
+ _btnScrollRight->unhide();
+ } else {
+ _btnScrollRight->hide();
+ _btnScrollLeft->hide();
+ }
+}
+
+void Interface::refresh_left_arrow() {
+ if (_inventory->need_right() || _inventory->need_left()) {
+ _btnScrollLeft->set_sprite_unknown(59);
+ _btnScrollLeft->set_sprite_relaxed(60);
+ _btnScrollLeft->set_sprite_picked(62);
+ _btnScrollLeft->set_sprite_over(61);
+ _btnScrollLeft->unhide();
+ } else {
+ _btnScrollRight->hide();
+ _btnScrollLeft->hide();
+ }
+}
+
void Interface::sub1() {
+
warning("TODO: Interface::sub1");
}
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 291695527bd..b12900658c0 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -79,6 +79,9 @@ public:
bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
void show() override;
+
+ void refresh_right_arrow();
+ void refresh_left_arrow();
};
} // namespace Interface
Commit: f62e2be8af0d6e06f7c8eff5f02efd0f31122555
https://github.com/scummvm/scummvm/commit/f62e2be8af0d6e06f7c8eff5f02efd0f31122555
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix placement of inventory items
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 739ad0c3096..bd4816c5790 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -640,9 +640,11 @@ int16 Inventory::cell_pos_x(int16 index) {
}
int16 Inventory::cell_pos_y(int16 index) {
- if (_cells_h > _cells_v) { // Horizontal orientation, fill left to right
+ if (_cells_h > _cells_v) {
+ // Horizontal orientation, fill left to right
return (int16)((index % _cells_v) * _cell_h);
- } else { // Vertical orientation, fill top to bottom
+ } else {
+ // Vertical orientation, fill top to bottom
return (int16)((index % _cells_h) * _cell_h);
}
}
@@ -663,7 +665,6 @@ void Inventory::draw(GrBuff *myBuffer) {
if (!_must_redraw1 && !_must_redraw2 && !_must_redraw_all)
return;
- int16 offx = 0, offy = 0;
int cell_iter;
Buffer *myBuff = myBuffer->get_buffer();
@@ -676,8 +677,8 @@ void Inventory::draw(GrBuff *myBuffer) {
_right_arrow_visible = false;
for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_INVENTORY); cell_iter++) {
- int16 left = (int16)(_x1 + offx + cell_pos_x(cell_iter));
- int16 top = (int16)(_y1 + offy + cell_pos_y(cell_iter));
+ int16 left = (int16)(_x1 + cell_pos_x(cell_iter));
+ int16 top = (int16)(_y1 + cell_pos_y(cell_iter));
if (_must_redraw1 == cell_iter || _must_redraw2 == cell_iter || _must_redraw_all) {
// This does the button update....
@@ -687,7 +688,8 @@ void Inventory::draw(GrBuff *myBuffer) {
// Draw icon here
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, left, top, _cell_w + 1, _cell_h + 1);
- series_show_frame(_sprite, _items[cell_iter + _scroll]._cell, myBuff, left - 3, top - 3);
+ series_show_frame(_sprite, _items[cell_iter + _scroll]._cell, myBuff,
+ left + (_cell_w - 31) / 2, top + (_cell_h - 31) / 2);
// Draw box around icon
if (_highlight == cell_iter) {
Commit: ded1852f15965c84b860d9be16b36622b0efe6fc
https://github.com/scummvm/scummvm/commit/ded1852f15965c84b860d9be16b36622b0efe6fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Interface::trackIcons
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 358d8b47d54..15d6f433ee8 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -24,7 +24,10 @@
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
+#include "m4/gui/hotkeys.h"
+#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
+#include "m4/adv_r/other.h"
namespace M4 {
namespace Burger {
@@ -200,7 +203,7 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
_state = 0;
break;
case SELECTED:
- sub1();
+ trackIcons();
break;
default:
_state = 1;
@@ -266,9 +269,90 @@ void Interface::refresh_left_arrow() {
}
}
-void Interface::sub1() {
+void Interface::trackIcons() {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ switch (_interfaceBox->_highlight_index) {
+ case 4:
+ M4::Hotkeys::t_cb(nullptr, nullptr);
+ break;
+
+ case 5:
+ M4::Hotkeys::l_cb(nullptr, nullptr);
+ break;
+
+ case 6:
+ mouse_set_sprite(_arrow);
+ _flag1 = false;
+
+ if (_btnScrollRight->is_hidden())
+ refresh_right_arrow();
+ else
+ _btnScrollRight->hide();
+
+ if (_btnScrollLeft->is_hidden())
+ refresh_left_arrow();
+ else
+ _btnScrollLeft->hide();
+ break;
+
+ case 7:
+ M4::Hotkeys::u_cb(nullptr, nullptr);
+ break;
+
+ case 8:
+ if (!_btnScrollLeft->is_hidden()) {
+ if (_inventory->need_left()) {
+ _inventory->_scroll = (_inventory->_scroll <= 0) ? 0 :
+ _inventory->_scroll - _inventory->_cells_v;
+ }
+
+ refresh_right_arrow();
+ refresh_left_arrow();
+ _inventory->_must_redraw_all = true;
+ } else {
+ return;
+ }
+ break;
+
+ case 9:
+ if (!_btnScrollRight->is_hidden()) {
+ if (_inventory->need_right())
+ _inventory->_scroll += _inventory->_cells_v;
+
+ refresh_right_arrow();
+ refresh_left_arrow();
+ _inventory->_must_redraw_all = true;
+ } else {
+ return;
+ }
+ break;
+
+ case 10:
+ term_message("Abduct/Fail Button Pressed");
+
+ if (_G(game).section_id == 1) {
+ term_message("Abduct me now!");
+ _G(roomVal1) = 10017;
+ kernel_trigger_dispatch_now(10016);
+ } else if (_G(game).section_id == 7) {
+ _G(walker).wilbur_speech("999w023");
+ } else {
+ term_message("Fail me now!");
+ _G(roomVal1) = 10015;
+ kernel_trigger_dispatch_now(10016);
+ }
+ break;
+
+ case 11:
+ other_save_game_for_resurrection();
+ CreateGameMenu(_G(master_palette));
+ break;
+
+ }
- warning("TODO: Interface::sub1");
+ _G(kernel).trigger_mode = oldMode;
}
void Interface::sub2() {
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index b12900658c0..3fd4117587f 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -36,7 +36,7 @@ struct Interface : public M4::Interface {
private:
void setup();
- void sub1();
+ void trackIcons();
void sub2();
ControlStatus track(int event, int x, int y);
void dispatch_command();
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 6feff841bf3..42ab250be1b 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -49,7 +49,7 @@ public:
machine *walk_initialize_walker() override;
void reset_walker_sprites();
- void wilbur_speech(const char *name, int trigger, int room = -1, byte flags = 0,
+ void wilbur_speech(const char *name, int trigger = -1, int room = -1, byte flags = 0,
int vol = 256, int channel = 1);
void wilbur_say();
void wilburs_speech_finished();
Commit: 2c9219f0d4ab7b73335b9fb55256464e10c898f6
https://github.com/scummvm/scummvm/commit/2c9219f0d4ab7b73335b9fb55256464e10c898f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Interface::track
Changed paths:
engines/m4/adv_r/adv_hotspot.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/core/rooms.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
index 8b55632b7f3..d0959b86ee4 100644
--- a/engines/m4/adv_r/adv_hotspot.h
+++ b/engines/m4/adv_r/adv_hotspot.h
@@ -32,8 +32,8 @@ struct HotSpotRec {
int32 feet_x = 0, feet_y = 0; // Walk-to target for player
int8 facing = 0; // Direction player should face
bool active = false; // Flag if hotspot is active
- char cursor_number = 0; // Mouse cursor number
- char syntax = 0; // Word syntax
+ byte cursor_number = 0; // Mouse cursor number
+ byte syntax = 0; // Word syntax
int32 vocabID = 0, verbID = 0; // ids of name and verb
char *vocab = nullptr; // Vocabulary name of hotspot
char *verb = nullptr; // Vocabulary default verb name
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 15d6f433ee8..4aa3f2433c7 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -25,6 +25,7 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/gui/hotkeys.h"
+#include "m4/burger/burger.h"
#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
#include "m4/adv_r/other.h"
@@ -115,8 +116,8 @@ void Interface::cancel_sentence() {
_G(player).command_ready = false;
_pointer1 = nullptr;
- _pointer2 = nullptr;
- _pointer3 = nullptr;
+ _vocabText[0] = '\0';
+ _verbText[0] = '\0';
_flag1 = false;
track_hotspots_refresh();
@@ -128,7 +129,7 @@ void Interface::freshen_sentence() {
_G(player).ready_to_walk = _G(player).need_to_walk;
_G(player).command_ready = _G(player).ready_to_walk;
_pointer1 = nullptr;
- _pointer2 = nullptr;
+ _vocabText[0] = '\0';
track_hotspots_refresh();
}
@@ -211,8 +212,7 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
}
if (_state == 0 || _state == 2) {
- status = _inventory->track(event, _x1, _y1);
- _state = (status == NOTHING) ? 0 : 2;
+ _state = _inventory->track(event, _x1, _y1) ? 2 : 0;
}
if (!_state) {
@@ -355,17 +355,62 @@ void Interface::trackIcons() {
_G(kernel).trigger_mode = oldMode;
}
-void Interface::sub2() {
- warning("TODO: Interface::sub2");
-}
-
ControlStatus Interface::track(int event, int x, int y) {
- warning("TODO: Interface::track");
- return NOTHING;
+ const HotSpotRec *hotspot = g_engine->_activeRoom->custom_hotspot_which(x, y);
+ if (!hotspot)
+ hotspot = hotspot_which(_G(currentSceneDef).hotspots, x, y);
+
+ if (hotspot != _hotspot && !hotspot) {
+ _textField->set_string(" ");
+ _hotspot = nullptr;
+ return NOTHING;
+
+ } else {
+ if (hotspot != _hotspot) {
+ if (!_flag1) {
+ if (!mouse_set_sprite(hotspot->cursor_number))
+ mouse_set_sprite(kArrowCursor);
+
+ strncpy(_verbText, hotspot->verb, 40);
+ }
+
+ Common::String tmp = (g_engine->getLanguage() == Common::EN_ANY) ?
+ hotspot->vocab : hotspot->prep;
+ tmp.toUppercase();
+ _textField->set_string(tmp.c_str());
+
+ tmp = hotspot->vocab;
+ tmp.toUppercase();
+ strncpy(_vocabText, tmp.c_str(), 40);
+
+ _hotspot = hotspot;
+ }
+
+ if (event == 5 && hotspot) {
+ _G(player).walk_x = x;
+ _G(player).walk_y = y;
+ _G(hotspot_x) = x;
+ _G(hotspot_y) = y;
+
+ if (hotspot) {
+ if (hotspot->feet_x != 0x7fff)
+ _G(player).walk_x = hotspot->feet_x;
+ if (hotspot->feet_y != 0x7fff)
+ _G(player).walk_y = hotspot->feet_y;
+ }
+
+ _G(player).walk_facing = hotspot->facing;
+ _hotspot = nullptr;
+
+ return SELECTED;
+ } else {
+ return NOTHING;
+ }
+ }
}
void Interface::dispatch_command() {
- warning("TODO: Interface::dispatch_command");
+ error("TODO: Interface::dispatch_command");
}
} // namespace GUI
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 3fd4117587f..54c05c00f71 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -24,6 +24,7 @@
#define M4_BURGER_INTERFACE_H
#include "m4/adv_r/adv_interface.h"
+#include "m4/adv_r/adv_hotspot.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
#include "m4/burger/gui/gui_cheapo.h"
@@ -37,7 +38,6 @@ private:
void setup();
void trackIcons();
- void sub2();
ControlStatus track(int event, int x, int y);
void dispatch_command();
@@ -55,11 +55,11 @@ public:
GUI::ButtonClass *_btnMenu = nullptr;
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
- void *_hotspot = nullptr;
+ const HotSpotRec *_hotspot = nullptr;
int _savedX = 0, _savedY = 0;
void *_pointer1 = nullptr;
- void *_pointer2 = nullptr;
- void *_pointer3 = nullptr;
+ char _vocabText[40] = { 0 };
+ char _verbText[40] = { 0 };
bool _flag1 = false;
int _state = 0;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index b319980687a..df5a7029599 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -24,6 +24,7 @@
#include "common/array.h"
#include "m4/adv_r/adv.h"
+#include "m4/adv_r/adv_hotspot.h"
namespace M4 {
@@ -44,7 +45,9 @@ public:
virtual void parser_code() {}
virtual void error() {}
virtual void shutdown() {}
- virtual void custom_hotspot_which() {}
+ virtual HotSpotRec *custom_hotspot_which(int x, int y) {
+ return nullptr;
+ }
};
class Section {
@@ -146,8 +149,8 @@ public:
void room_shutdown() {
_activeRoom->shutdown();
}
- void custom_hotspot_which() {
- _activeRoom->custom_hotspot_which();
+ HotSpotRec *custom_hotspot_which(int x, int y) {
+ return _activeRoom->custom_hotspot_which(x, y);
}
void m4SceneLoad();
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index cf1e114de76..ea251a94af6 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -183,6 +183,7 @@ public:
bool _shut_down_digi_tracks_between_rooms = false;
cursor_states _cursor_state = kARROW;
int _iPitch = 0;
+ int _hotspot_x = 0, _hotspot_y = 0;
};
#define _G(X) (g_vars->_##X)
Commit: 0149d67a0e014ea6f7669db26e9ea2bd93d4b6af
https://github.com/scummvm/scummvm/commit/0149d67a0e014ea6f7669db26e9ea2bd93d4b6af
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify several interface methods and variables
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 4aa3f2433c7..c6cf0d2ceb4 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -115,8 +115,8 @@ void Interface::cancel_sentence() {
_G(player).ready_to_walk = false;
_G(player).command_ready = false;
- _pointer1 = nullptr;
- _vocabText[0] = '\0';
+ _prepText[0] = '\0';
+ _nounText[0] = '\0';
_verbText[0] = '\0';
_flag1 = false;
@@ -128,8 +128,8 @@ void Interface::freshen_sentence() {
_G(player).need_to_walk = false;
_G(player).ready_to_walk = _G(player).need_to_walk;
_G(player).command_ready = _G(player).ready_to_walk;
- _pointer1 = nullptr;
- _vocabText[0] = '\0';
+ _prepText[0] = '\0';
+ _nounText[0] = '\0';
track_hotspots_refresh();
}
@@ -226,7 +226,7 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
_textField->set_string(" ");
}
- if (track(event, x - screen->x1, y - screen->y1) == SELECTED)
+ if (trackHotspots(event, x - screen->x1, y - screen->y1) == SELECTED)
dispatch_command();
}
}
@@ -355,7 +355,7 @@ void Interface::trackIcons() {
_G(kernel).trigger_mode = oldMode;
}
-ControlStatus Interface::track(int event, int x, int y) {
+ControlStatus Interface::trackHotspots(int event, int x, int y) {
const HotSpotRec *hotspot = g_engine->_activeRoom->custom_hotspot_which(x, y);
if (!hotspot)
hotspot = hotspot_which(_G(currentSceneDef).hotspots, x, y);
@@ -381,7 +381,7 @@ ControlStatus Interface::track(int event, int x, int y) {
tmp = hotspot->vocab;
tmp.toUppercase();
- strncpy(_vocabText, tmp.c_str(), 40);
+ strncpy(_nounText, tmp.c_str(), 40);
_hotspot = hotspot;
}
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 54c05c00f71..db9226c3ef3 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -38,7 +38,7 @@ private:
void setup();
void trackIcons();
- ControlStatus track(int event, int x, int y);
+ ControlStatus trackHotspots(int event, int x, int y);
void dispatch_command();
public:
@@ -57,8 +57,8 @@ public:
GUI::ButtonClass *_btnScrollRight = nullptr;
const HotSpotRec *_hotspot = nullptr;
int _savedX = 0, _savedY = 0;
- void *_pointer1 = nullptr;
- char _vocabText[40] = { 0 };
+ char _prepText[40] = { 0 };
+ char _nounText[40] = { 0 };
char _verbText[40] = { 0 };
bool _flag1 = false;
int _state = 0;
Commit: c0530a02ccc4b29c5b87e662b60cdad00763d2cf
https://github.com/scummvm/scummvm/commit/c0530a02ccc4b29c5b87e662b60cdad00763d2cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Interface dispatch_command
Changed paths:
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/adv_player.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/gui/interface.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index 86f13f39bdf..fca0cc1bee8 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -201,4 +201,48 @@ PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info) {
return player_info;
}
+void player_set_facing_hotspot(int trigger) {
+ player_set_facing_at(trigger, _G(hotspot_x), _G(hotspot_y));
+}
+
+void player_set_facing_at(int x, int y, int trigger) {
+ player_hotspot_walk_override_just_face(calc_facing(x, y), trigger);
+}
+
+int calc_facing(int x, int y) {
+ player_update_info(_G(my_walker), &_G(player_info));
+
+ if (!x) {
+ return -_G(player_info).y < -y;
+ } else {
+ double slope = (double)(y - _G(player_info).y) / (double)(x - _G(player_info).x);
+ term_message("click (%d,%d) player (%d,%d) slope = %f",
+ x, -y, _G(player_info).x, -_G(player_info).y);
+
+ if (_G(player_info).x < x) {
+ if (slope >= 1.25)
+ return 1;
+ else if (slope >= 0.1)
+ return 2;
+ else if (slope >= -0.1)
+ return 3;
+ else if (slope >= -0.4)
+ return 4;
+ else
+ return 5;
+ } else {
+ if (slope >= 0.4)
+ return 7;
+ else if (slope >= 0.1)
+ return 8;
+ else if (slope >= -0.1)
+ return 9;
+ else if (slope >= -1.25)
+ return 10;
+ else
+ return 11;
+ }
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 7dd3c894c6d..a67941fece5 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -116,6 +116,10 @@ extern bool player_commands_allowed();
extern PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
extern void adv_kill_digi_between_rooms(bool true_or_false);
+extern void player_set_facing_hotspot(int trigger = -1);
+extern void player_set_facing_at(int x, int y, int trigger = -1);
+extern int calc_facing(int x, int y);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index e18fc73a1d3..c97f3664e97 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -81,5 +81,16 @@ void BurgerEngine::global_daemon() {
}
}
+void BurgerEngine::global_pre_parser() {
+ if (player_said("wilbur")) {
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = true;
+ _G(player).waiting_for_walk = false;
+ }
+
+ if (player_said("SKY"))
+ player_set_facing_hotspot();
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 7b908136d07..4bae9148531 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -58,6 +58,7 @@ public:
void syncFlags(Common::Serializer &s) override;
void global_daemon() override;
+ void global_pre_parser() override;
};
} // namespace Burger
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index c6cf0d2ceb4..56fbf72fa84 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/gui/interface.h"
+#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_event.h"
@@ -410,7 +411,24 @@ ControlStatus Interface::trackHotspots(int event, int x, int y) {
}
void Interface::dispatch_command() {
- error("TODO: Interface::dispatch_command");
+ --_savedX;
+ cstrncpy(_G(player).verb, _verbText, 40);
+ cstrncpy(_G(player).noun, _nounText, 40);
+ cstrncpy(_G(player).prep, _prepText, 40);
+
+ _G(player).waiting_for_walk = true;
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+ _G(player).command_ready = true;
+ _G(kernel).trigger = -1;
+ _G(kernel).trigger_mode = KT_PREPARSE;
+ _flag1 = false;
+
+ mouse_set_sprite(_arrow);
+ _G(player).walker_trigger = -1;
+
+ g_engine->_activeRoom->pre_parser();
+ g_engine->global_pre_parser();
}
} // namespace GUI
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index df5a7029599..a29d5070a3f 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -160,6 +160,7 @@ public:
void pal_game_task();
virtual void global_daemon() = 0;
+ virtual void global_pre_parser() = 0;
};
} // namespace M4
Commit: ae83dda0f75c5f7de81ee3ce34cefbfcfd6d2cdf
https://github.com/scummvm/scummvm/commit/ae83dda0f75c5f7de81ee3ce34cefbfcfd6d2cdf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for clicking interface buttons
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/hotkeys.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index fe9bdd0bf32..f7d2542d8fa 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -85,16 +85,16 @@ void adv_kill_digi_between_rooms(bool true_or_false) {
void toggle_through_cursors() {
switch (_G(cursor_state)) {
case kARROW:
- Hotkeys::l_cb(NULL, NULL);
+ Hotkeys::l_cb(nullptr, nullptr);
break;
case kLOOK:
- Hotkeys::t_cb(NULL, NULL);
+ Hotkeys::t_cb(nullptr, nullptr);
break;
case kTAKE:
- Hotkeys::u_cb(NULL, NULL);
+ Hotkeys::u_cb(nullptr, nullptr);
break;
case kUSE:
- Hotkeys::a_cb(NULL, NULL);
+ Hotkeys::a_cb(nullptr, nullptr);
break;
default:
break;
@@ -177,7 +177,7 @@ void update_mouse_pos_dialog() {
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
assert(game_buff_ptr);
- if (_G(kernel).myWalker != NULL) {
+ if (_G(kernel).myWalker != nullptr) {
if (((int32)_G(kernel).myWalker->myAnim8) < 0)
error_show(FL, 'W:-(');
player_get_info();
@@ -186,7 +186,7 @@ void update_mouse_pos_dialog() {
char tempStr1[MAX_STRING_LEN], tempStr2[MAX_STRING_LEN];
Common::sprintf_s(tempStr1, "%d From: %d", _G(game).room_id, _G(game).previous_room);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 1);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 1);
int32 xxx = _G(MouseState).CursorColumn;
int32 yyy = _G(MouseState).CursorRow;
@@ -201,8 +201,8 @@ void update_mouse_pos_dialog() {
Common::sprintf_s(tempStr1, " %d, %d PAL: %d", xxx, yyy, palColor);
Common::sprintf_s(tempStr2, " %d, %d D: %d", xxx - game_buff_ptr->x1, yyy - game_buff_ptr->y1, scrnDepth);
}
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 2);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 3);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 2);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, nullptr, 3);
if (this_is_a_walkcode(_G(player_info).x, _G(player_info).y)) {
Common::sprintf_s(tempStr1, "WC %d, %d", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
@@ -211,20 +211,20 @@ void update_mouse_pos_dialog() {
Common::sprintf_s(tempStr1, " %d, %d", _G(player_info).x + game_buff_ptr->x1, _G(player_info).y + game_buff_ptr->y1);
Common::sprintf_s(tempStr2, " %d, %d", _G(player_info).x, _G(player_info).y);
}
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 4);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, NULL, 5);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 4);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr2, nullptr, 5);
Common::sprintf_s(tempStr1, "%d", _G(player_info).scale);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 6);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 6);
Common::sprintf_s(tempStr1, "%x", _G(player_info).depth);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 7);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 7);
Common::sprintf_s(tempStr1, "%d, %d", game_buff_ptr->x1, game_buff_ptr->y1);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 8);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 8);
Common::sprintf_s(tempStr1, "%d", _G(player_info).facing);
- Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, NULL, 10);
+ Dialog_Change_Item_Prompt(_G(mousePosDialog), tempStr1, nullptr, 10);
}
} // End of namespace M4
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index bd4816c5790..8ce39066309 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -167,7 +167,7 @@ ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int1
ButtonClass::ButtonClass(const RectClass &r, const Common::String &btnName, int16 tag,
int16 unknown, int16 relaxed, int16 over, int16 picked, int sprite) : RectClass(r),
- _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked), _sprite(sprite) {
+ _tag(tag), _unknown(unknown), _relaxed(relaxed), _over(over), _picked(picked), _sprite(sprite) {
}
ButtonClass::ButtonClass() : RectClass() {
@@ -491,6 +491,7 @@ ControlStatus InterfaceBox::track(int32 eventType, int16 x, int16 y) {
_highlight_index = _button[iter]->get_tag();
term_message("selected button: %ld", iter);
result = SELECTED;
+ break;
}
}
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 56fbf72fa84..fa82a8de716 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -25,7 +25,6 @@
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
-#include "m4/gui/hotkeys.h"
#include "m4/burger/burger.h"
#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
@@ -185,20 +184,20 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
if (eventType != EVENT_MOUSE)
return false;
- if (_G(kernel).fading_to_grey && event == 5) {
+ if (_G(kernel).fading_to_grey && event == _ME_L_release) {
kernel_unexamine_inventory_object(_G(master_palette), 5, 1);
return true;
}
if (player_commands_allowed()) {
- if (x == _savedX && y == _savedY && event != 2 && event != 5 &&
- event != 3 && event != 4)
+ if (x == _savedX && y == _savedY && event != _ME_L_click &&
+ event != _ME_L_release && event != _ME_L_hold && event != _ME_L_drag)
return true;
_savedX = x;
_savedY = y;
- ControlStatus status = _interfaceBox->track(event, _x1, _y1);
+ ControlStatus status = _interfaceBox->track(event, x - _x1, y - _y1);
switch (status) {
case NOTHING:
@@ -276,11 +275,11 @@ void Interface::trackIcons() {
switch (_interfaceBox->_highlight_index) {
case 4:
- M4::Hotkeys::t_cb(nullptr, nullptr);
+ Hotkeys::t_cb(nullptr, nullptr);
break;
case 5:
- M4::Hotkeys::l_cb(nullptr, nullptr);
+ Hotkeys::l_cb(nullptr, nullptr);
break;
case 6:
@@ -347,6 +346,7 @@ void Interface::trackIcons() {
break;
case 11:
+ // Abduct
other_save_game_for_resurrection();
CreateGameMenu(_G(master_palette));
break;
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index e9024bbf1ef..cc7978475c1 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -24,11 +24,12 @@
#define M4_BURGER_HOTKEYS_H
#include "m4/m4_types.h"
+#include "m4/gui/hotkeys.h"
namespace M4 {
namespace Burger {
-struct Hotkeys {
+struct Hotkeys : public M4::Hotkeys {
/**
* Called when the Escape key is pressed
*/
Commit: 9e96f96e268a721dde89625c2ee404de03272301
https://github.com/scummvm/scummvm/commit/9e96f96e268a721dde89625c2ee404de03272301
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing basic action hotkey callbacks
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/hotkeys.cpp
engines/m4/burger/hotkeys.h
engines/m4/burger/vars.h
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
engines/m4/m4.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index f7d2542d8fa..40d9b666086 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -83,22 +83,7 @@ void adv_kill_digi_between_rooms(bool true_or_false) {
}
void toggle_through_cursors() {
- switch (_G(cursor_state)) {
- case kARROW:
- Hotkeys::l_cb(nullptr, nullptr);
- break;
- case kLOOK:
- Hotkeys::t_cb(nullptr, nullptr);
- break;
- case kTAKE:
- Hotkeys::u_cb(nullptr, nullptr);
- break;
- case kUSE:
- Hotkeys::a_cb(nullptr, nullptr);
- break;
- default:
- break;
- }
+ g_vars->getHotkeys()->toggle_through_cursors();
}
bool this_is_a_walkcode(int32 x, int32 y) {
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index fa82a8de716..71d3795ae97 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -26,7 +26,6 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_vmng.h"
#include "m4/burger/burger.h"
-#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
#include "m4/adv_r/other.h"
@@ -275,11 +274,11 @@ void Interface::trackIcons() {
switch (_interfaceBox->_highlight_index) {
case 4:
- Hotkeys::t_cb(nullptr, nullptr);
+ t_cb();
break;
case 5:
- Hotkeys::l_cb(nullptr, nullptr);
+ l_cb();
break;
case 6:
@@ -298,7 +297,7 @@ void Interface::trackIcons() {
break;
case 7:
- M4::Hotkeys::u_cb(nullptr, nullptr);
+ u_cb();
break;
case 8:
@@ -431,6 +430,42 @@ void Interface::dispatch_command() {
g_engine->global_pre_parser();
}
+void Interface::l_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "look at");
+ mouse_set_sprite(_look);
+ _flag1 = true;
+ _G(cursor_state) = kLOOK;
+ }
+}
+
+void Interface::u_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "gear");
+ mouse_set_sprite(_use);
+ _flag1 = true;
+ _G(cursor_state) = kUSE;
+ }
+}
+
+void Interface::t_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "take");
+ mouse_set_sprite(_grab);
+ _flag1 = true;
+ _G(cursor_state) = kTAKE;
+ }
+}
+
+void Interface::a_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "<><><><><><><><>");
+ mouse_set_sprite(_arrow);
+ _flag1 = true;
+ _G(cursor_state) = kARROW;
+ }
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index db9226c3ef3..465b38ad57a 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -82,6 +82,11 @@ public:
void refresh_right_arrow();
void refresh_left_arrow();
+
+ void l_cb();
+ void u_cb();
+ void t_cb();
+ void a_cb();
};
} // namespace Interface
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 309bc1bdfb6..d6a2cd3ed9f 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -22,11 +22,52 @@
#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
#include "m4/burger/gui/game_menu.h"
+#include "m4/gui/gui_sys.h"
#include "m4/adv_r/other.h"
namespace M4 {
namespace Burger {
+void Hotkeys::add_hot_keys() {
+ M4::Hotkeys::add_hot_keys();
+
+ AddSystemHotkey('t', t_cb);
+ AddSystemHotkey('u', u_cb);
+ AddSystemHotkey('l', l_cb);
+ AddSystemHotkey('T', t_cb);
+ AddSystemHotkey('U', u_cb);
+ AddSystemHotkey('L', l_cb);
+
+ AddSystemHotkey('A', l_cb);
+ AddSystemHotkey('S', t_cb);
+ AddSystemHotkey('D', u_cb);
+ AddSystemHotkey('a', l_cb);
+ AddSystemHotkey('s', t_cb);
+ AddSystemHotkey('d', u_cb);
+
+ AddSystemHotkey('F', a_cb);
+ AddSystemHotkey('f', a_cb);
+}
+
+void Hotkeys::toggle_through_cursors() {
+ switch (_G(cursor_state)) {
+ case kARROW:
+ Hotkeys::l_cb(nullptr, nullptr);
+ break;
+ case kLOOK:
+ Hotkeys::t_cb(nullptr, nullptr);
+ break;
+ case kTAKE:
+ Hotkeys::u_cb(nullptr, nullptr);
+ break;
+ case kUSE:
+ Hotkeys::a_cb(nullptr, nullptr);
+ break;
+ default:
+ break;
+ }
+}
+
void Hotkeys::escape_key_pressed(void *, void *) {
// Decide what to do depending on what kind of game is playing
switch (_G(executing)) {
@@ -76,5 +117,22 @@ void Hotkeys::escape_key_pressed(void *, void *) {
}
}
+
+void Hotkeys::t_cb(void *, void *) {
+ g_globals->_interface.t_cb();
+}
+
+void Hotkeys::u_cb(void *, void *) {
+ g_globals->_interface.u_cb();
+}
+
+void Hotkeys::l_cb(void *, void *) {
+ g_globals->_interface.l_cb();
+}
+
+void Hotkeys::a_cb(void *, void *) {
+ g_globals->_interface.a_cb();
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index cc7978475c1..337b6b91937 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -30,10 +30,19 @@ namespace M4 {
namespace Burger {
struct Hotkeys : public M4::Hotkeys {
+ static void t_cb(void *, void *);
+ static void u_cb(void *, void *);
+ static void l_cb(void *, void *);
+ static void a_cb(void *, void *);
+
/**
* Called when the Escape key is pressed
*/
static void escape_key_pressed(void *, void *);
+
+ void add_hot_keys() override;
+
+ void toggle_through_cursors() override;
};
} // namespace Burger
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 223640255da..d7f93673ee8 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -28,6 +28,7 @@
#include "m4/burger/gui/gui.h"
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/flags.h"
+#include "m4/burger/hotkeys.h"
#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
@@ -82,6 +83,7 @@ public:
GameMode _executing = WHOLE_GAME;
GUI::GUI_Globals _gui;
GUI::Interface _interface;
+ Burger::Hotkeys _hotkeys;
GUI::MenuGlobals _menu;
SeriesPlayers _seriesPlayers;
ReleaseTrigger_Globals _releaseTrigger;
@@ -105,6 +107,9 @@ public:
M4::Interface *getInterface() override {
return &_interface;
}
+ Hotkeys *getHotkeys() override {
+ return &_hotkeys;
+ }
M4::Walker *getWalker() override {
return &_walker;
}
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index df5f998d86e..61bbf42fa29 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -108,23 +108,6 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_F2, cb_F2);
AddSystemHotkey(KEY_F3, cb_F3);
- AddSystemHotkey('t', t_cb);
- AddSystemHotkey('u', u_cb);
- AddSystemHotkey('l', l_cb);
-
- AddSystemHotkey('T', t_cb);
- AddSystemHotkey('U', u_cb);
- AddSystemHotkey('L', l_cb);
-
- AddSystemHotkey('A', l_cb);
- AddSystemHotkey('S', t_cb);
- AddSystemHotkey('D', u_cb);
- AddSystemHotkey('F', adv_hyperwalk_to_final_destination);
- AddSystemHotkey('a', l_cb);
- AddSystemHotkey('s', t_cb);
- AddSystemHotkey('d', u_cb);
- AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
-
AddSystemHotkey(KEY_ALT_V, show_version);
AddSystemHotkey(KEY_CTRL_V, show_version);
AddSystemHotkey(KEY_ALT_X, exit_program);
@@ -138,7 +121,7 @@ void Hotkeys::add_hot_keys() {
}
}
-void Hotkeys::adv_enable_system_hot_keys(void) {
+void Hotkeys::adv_enable_system_hot_keys() {
term_message("System Cheats On");
AddSystemHotkey(KEY_HOME, capture_wrap);
@@ -199,22 +182,6 @@ void Hotkeys::version_ok_button(void *a, void *b) {
warning("TODO: hotkey");
}
-void Hotkeys::t_cb(void *, void *) {
- warning("TODO: hotkey");
-}
-
-void Hotkeys::u_cb(void *, void *) {
- warning("TODO: hotkey");
-}
-
-void Hotkeys::l_cb(void *, void *) {
- warning("TODO: hotkey");
-}
-
-void Hotkeys::a_cb(void *, void *) {
- warning("TODO: hotkey");
-}
-
void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
warning("TODO: hotkey");
}
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 4706cc2bdd7..1901ca33d0b 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -28,8 +28,8 @@
namespace M4 {
struct Hotkeys {
-private:
- static void adv_enable_system_hot_keys();
+protected:
+ virtual void adv_enable_system_hot_keys();
public:
static void exit_program(void *, void *);
@@ -37,10 +37,6 @@ public:
static void cb_F3(void *, void *);
static void show_version(void *a, void *b);
static void version_ok_button(void *a, void *b);
- static void t_cb(void *, void *);
- static void u_cb(void *, void *);
- static void l_cb(void *, void *);
- static void a_cb(void *, void *);
static void adv_hyperwalk_to_final_destination(void *a, void *b);
static void capture_wrap(void *, void *);
static void debug_memory_next_column(void *, void *);
@@ -80,9 +76,11 @@ public:
static void pal_override(void *, void *);
public:
- static void add_hot_keys();
- static void disable_hot_keys();
- static void restore_hot_keys();
+ virtual void add_hot_keys();
+ void disable_hot_keys();
+ void restore_hot_keys();
+
+ virtual void toggle_through_cursors() = 0;
};
} // End of namespace M4
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index c486d25fb8e..ab017d3701b 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -82,7 +82,7 @@ Common::Error M4Engine::run() {
#define KEEP_PLAYING (_G(kernel).going && !shouldQuit())
void M4Engine::m4_inflight() {
- Hotkeys::add_hot_keys();
+ g_vars->getHotkeys()->add_hot_keys();
_G(kernel).going = true;
while (KEEP_PLAYING) {
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index ea251a94af6..cac68f51060 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -49,6 +49,7 @@
#include "m4/gui/gui_item.h"
#include "m4/gui/gui_mouse.h"
#include "m4/gui/gui_univ.h"
+#include "m4/gui/hotkeys.h"
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/events.h"
@@ -85,6 +86,7 @@ public:
virtual Interface *getInterface() = 0;
virtual Walker *getWalker() = 0;
+ virtual Hotkeys *getHotkeys() = 0;
virtual void global_menu_system_init() = 0;
virtual void initialize_game() = 0;
Commit: 77a03d4c3d19a007b67b60877f774d09766c7053
https://github.com/scummvm/scummvm/commit/77a03d4c3d19a007b67b60877f774d09766c7053
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix duplicated interface visible flag
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/hotkeys.cpp
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index c97f3664e97..571029e6864 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -53,7 +53,7 @@ void BurgerEngine::showEngineInfo() {
}
void BurgerEngine::syncFlags(Common::Serializer &s) {
- g_globals->_flags.sync(s);
+ g_vars->_flags.sync(s);
}
void BurgerEngine::global_daemon() {
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 465b38ad57a..3ae854679e7 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -43,7 +43,6 @@ private:
public:
int _sprite = 22; // main_interface_sprite;
- bool _visible = false;
bool _shown = false;
GUI::InterfaceBox *_interfaceBox = nullptr;
GUI::Inventory *_inventory = nullptr;
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index d6a2cd3ed9f..5f5400630e6 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -119,19 +119,19 @@ void Hotkeys::escape_key_pressed(void *, void *) {
void Hotkeys::t_cb(void *, void *) {
- g_globals->_interface.t_cb();
+ g_vars->_interface.t_cb();
}
void Hotkeys::u_cb(void *, void *) {
- g_globals->_interface.u_cb();
+ g_vars->_interface.u_cb();
}
void Hotkeys::l_cb(void *, void *) {
- g_globals->_interface.l_cb();
+ g_vars->_interface.l_cb();
}
void Hotkeys::a_cb(void *, void *) {
- g_globals->_interface.a_cb();
+ g_vars->_interface.a_cb();
}
} // namespace Burger
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index dcd243526cf..d0127c2be52 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -34,7 +34,7 @@
namespace M4 {
namespace Burger {
-Vars *g_globals;
+Vars *g_vars;
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
@@ -72,7 +72,7 @@ static const ConverterEntry ASCII_CONVERTERS[] = {
};
Vars::Vars() {
- g_globals = this;
+ g_vars = this;
Inventory *inv = new Inventory();
_inventory = inv;
@@ -81,7 +81,7 @@ Vars::Vars() {
}
Vars::~Vars() {
- g_globals = nullptr;
+ g_vars = nullptr;
delete _inventory;
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index d7f93673ee8..32945e1c588 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -118,11 +118,11 @@ public:
void global_menu_system_init() override;
};
-extern Vars *g_globals;
+extern Vars *g_vars;
#undef _G
#undef _GI
-#define _G(X) (::M4::Burger::g_globals->_##X)
+#define _G(X) (::M4::Burger::g_vars->_##X)
#define _GI(X) _G(interface)._##X
#define _GINT() _G(interface)
Commit: 76ab81eb3a9660a4400b405c76bbd7ac085b5de6
https://github.com/scummvm/scummvm/commit/76ab81eb3a9660a4400b405c76bbd7ac085b5de6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added global abduct trigger code
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_trigger.h
engines/m4/burger/burger.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/core/imath.cpp
engines/m4/core/imath.h
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 27d5ef98dab..927bba6cab4 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -152,6 +152,13 @@ void kernel_timing_trigger(int32 ticks, int16 trigger, const char *name) {
}
}
+void kernel_timing_trigger_daemon(int32 ticks, int16 trigger) {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(ticks, trigger);
+ _G(kernel).trigger_mode = oldMode;
+}
+
void kernel_service_timing_trigger_q() {
// Dispatch pending timing triggers
int32 iter = 0;
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index 3f358e46623..c9a0c8e3a8f 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -65,10 +65,9 @@ extern bool kernel_trigger_dispatch(int32 trigger_num);
* attached to the trigger, returns false
*/
extern bool kernel_trigger_dispatchx(int32 trigger_num);
-
extern bool kernel_trigger_dispatch_now(int32 trigger_num);
-
extern void kernel_timing_trigger(int32 ticks, int16 trigger, const char *name = nullptr);
+extern void kernel_timing_trigger_daemon(int32 ticks, int16 trigger);
extern void cisco_dispatch_triggers();
extern void cisco_clear_triggers();
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 571029e6864..9798960d341 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -26,6 +26,58 @@
namespace M4 {
namespace Burger {
+static const seriesPlayBreak PLAY_BREAKS1[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 18, 18, nullptr, 0, 0, 10008, 0, 0, 0, 0 },
+ { 19, 21, "999blow", 1, 125, -1, 0, -1, 0, 0 },
+ { 22, 30, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+};
+
+static const seriesPlayBreak PLAY_BREAKS2[] = {
+ { 0, 11, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 12, 13, nullptr, 0, 0, -1, 0, 5, 0, 0 },
+ { 14, 26, "302w002", 1, 255, -1, 0, 0, 0, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+};
+
+static const seriesPlayBreak PLAY_BREAKS3[] = {
+ { 0, 14, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 15, 16, "600_008", 2, 255, -1, 0, 0, 0, 0 },
+ { 17, 21, "602w012", 1, 255, -1, 0, 0, 0, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+};
+
+static const seriesPlayBreak PLAY_BREAKS4[] = {
+ { 0, 12, 0, 1, 0, -1, 2048, 0, 0, 0 },
+ { 12, 13, "500_004", 1, 255, -1, 0, 2, 0, 0 },
+ { 12, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, 0, 0, 0, -1, 0, 0, 0, 0 }
+};
+
+static const seriesPlayBreak PLAY_BREAKS5[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 16, 20, "999_001", 1, 200, -1, 0, 0, 0, 0 },
+ { 19, 19, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
+ { 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
+ { 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+};
+
+static const seriesPlayBreak PLAY_BREAKS6[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 16, 23, "999_001", 1, 200, -1, 0, 0, 0, 0 },
+ { 24, 30, "999_002", 1, 200, -1, 0, 0, 0, 0 },
+ { 31, 34, nullptr, 1, 200, -1, 0, 0, 0, 0 },
+ { 34, 34, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+};
+
BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
@@ -74,6 +126,107 @@ void BurgerEngine::global_daemon() {
_G(walker).wilburs_speech_finished();
break;
+ case gABDUCT:
+ switch (_G(roomVal1)) {
+ case 10001:
+ ws_unhide_walker(_G(my_walker));
+ player_set_commands_allowed(true);
+ _G(flags)[V299] = 0;
+ _G(flags)[V298] = 0;
+ _G(roomVal1) = 10002;
+ break;
+ case 10002:
+ _G(flags)[V299] = 0;
+ _G(flags)[V298] = 0;
+ break;
+ case 10003:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10013;
+ series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gABDUCT, 3, 7,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10004:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10012;
+ series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10005:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10009;
+ series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10006:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10001;
+ series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gABDUCT, 3, 7,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10007:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10014;
+ series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10008:
+ player_set_commands_allowed(false);
+ player_update_info(_G(my_walker), &_G(player_info));
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 10001;
+ series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ break;
+ case 10009:
+ ws_unhide_walker(_G(my_walker));
+ _G(roomVal1) = 10018;
+ _G(walker).wilbur_speech("602w012x", gABDUCT);
+ break;
+ case 10010:
+ _G(roomVal1) = 10011;
+ _G(walker).wilbur_speech("602w012y", gABDUCT);
+ break;
+ case 10011:
+ player_set_commands_allowed(true);
+ _G(roomVal1) = 10002;
+ _G(walker).wilbur_speech("602w012z");
+ break;
+ case 10012:
+ player_set_commands_allowed(true);
+ ws_unhide_walker(_G(my_walker));
+ _G(roomVal1) = 10002;
+ _G(walker).wilbur_speech("300w055");
+ break;
+ case 10013:
+ player_set_commands_allowed(true);
+ ws_unhide_walker(_G(my_walker));
+ _G(roomVal1) = 10002;
+ break;
+ case 10014:
+ enable_player();
+ _G(roomVal1) = 10002;
+ _G(walker).wilbur_speech("999w208");
+ break;
+ case 10017:
+ wilbur_abduct(10024);
+ break;
+ case 10018:
+ wilbur_abduct(10027);
+ break;
+ default:
+ break;
+ }
+
// TODO: Other cases
default:
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 71d3795ae97..811db03285d 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -334,18 +334,18 @@ void Interface::trackIcons() {
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
_G(roomVal1) = 10017;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
_G(roomVal1) = 10015;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
}
break;
case 11:
- // Abduct
+ // Game menu
other_save_game_for_resurrection();
CreateGameMenu(_G(master_palette));
break;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index c5be7c8b768..a363f65d36f 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -96,7 +96,7 @@ static const seriesPlayBreak PLAY_BREAKS3[] = {
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
- { 10, -1, nullptr, 1, 255, 10016, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 1, 255, gABDUCT, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
@@ -141,27 +141,27 @@ void Room101::init() {
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 6;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
break;
case 104:
_G(roomVal1) = 2;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
break;
case 106:
_G(roomVal1) = 3;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
break;
case 135:
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
break;
case 142:
_G(roomVal1) = 5;
- kernel_trigger_dispatch_now(10016);
+ kernel_trigger_dispatch_now(gABDUCT);
break;
default:
@@ -410,7 +410,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
_G(roomVal1) = 18;
- series_play_("101ha01", 3840, 0, 10016, 6, 0, 100, 0, 0, 14, -1);
+ series_play_("101ha01", 3840, 0, gABDUCT, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
@@ -453,7 +453,7 @@ void Room101::daemon() {
Section1::updateWalker(226, 281, 8, 26);
break;
- case 10016:
+ case gABDUCT:
switch (_G(roomVal1)) {
case 2:
player_set_commands_allowed(true);
@@ -485,7 +485,7 @@ void Room101::daemon() {
case 6:
_G(roomVal1) = 7;
- series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, 10016, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gABDUCT, 3, 6, 100, 0, -53);
break;
case 7:
@@ -496,7 +496,7 @@ void Room101::daemon() {
case 8:
_G(roomVal1) = 9;
TerminateMachineAndNull(_doorMachine);
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, 10016, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gABDUCT, 3, 6, 100, 0, 0);
break;
case 9:
@@ -505,7 +505,7 @@ void Room101::daemon() {
case 10:
_G(roomVal1) = 11;
- series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, 10016, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gABDUCT, 3, 6, 100, 0, -53);
break;
case 11:
@@ -517,17 +517,17 @@ void Room101::daemon() {
case 14:
TerminateMachineAndNull(_doorMachine);
_G(roomVal1) = 15;
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, 10016, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gABDUCT, 3, 6, 100, 0, 0);
break;
case 15:
_G(roomVal1) = 16;
- digi_play("101h001", 1, 255, 10016);
+ digi_play("101h001", 1, 255, gABDUCT);
break;
case 16:
_G(roomVal1) = 17;
- series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, 10016, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gABDUCT, 3, 6, 100, 0, 0);
break;
case 17:
@@ -537,9 +537,9 @@ void Room101::daemon() {
if (_G(flags)[V005]) {
Common::String name = Common::String::format("101h003%c",
'a' + imath_ranged_rand(0, 5));
- digi_play(name.c_str(), 1, 255, 10016);
+ digi_play(name.c_str(), 1, 255, gABDUCT);
} else {
- digi_play("101h002", 1, 255, 10016);
+ digi_play("101h002", 1, 255, gABDUCT);
_G(flags)[V005] = 1;
}
@@ -558,7 +558,7 @@ void Room101::daemon() {
case 20:
_G(roomVal1) = 11;
- series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, 10016, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gABDUCT, 3, 6, 100, 0, -53);
break;
case 21:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 32945e1c588..a593e5a16f6 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -22,6 +22,7 @@
#ifndef M4_BURGER_BURGER_VARS_H
#define M4_BURGER_BURGER_VARS_H
+#include "common/textconsole.h"
#include "m4/vars.h"
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
@@ -61,6 +62,7 @@ enum global_triggers {
gCHANGE_WILBUR_ANIMATION,
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
+ gABDUCT = 10016,
CALLED_EACH_LOOP = 32764,
@@ -126,6 +128,16 @@ extern Vars *g_vars;
#define _GI(X) _G(interface)._##X
#define _GINT() _G(interface)
+
+inline int UNKNOWN_depth1() {
+ error("TODO: Uninitialized? depth UNKNOWN_1");
+}
+inline int UNKNOWN_scale1() {
+ error("TODO: Uninitialized? depth UNKNOWN_1");
+}
+#define UNKNOWN_DEPTH_1 UNKNOWN_depth1()
+#define UNKNOWN_SCALE_1 UNKNOWN_scale1()
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 274ec5a266d..922b2e38067 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -230,5 +230,67 @@ void Walker::wilburs_speech_finished() {
kernel_trigger_dispatchx(_trigger);
}
+void enable_player() {
+ player_set_commands_allowed(true);
+ ws_unhide_walker(_G(my_walker));
+}
+
+void wilbur_abduct(int trigger) {
+ player_set_commands_allowed(false);
+ digi_stop(1);
+ digi_preload("999_004");
+
+ if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ player_update_info(_G(my_walker), &_G(player_info));
+
+ switch (_G(walkTrigger)) {
+ case 1:
+ case 2:
+ series_play_("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ series_play_("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ break;
+ case 3:
+ case 4:
+ case 5:
+ series_play_("999ab04", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ series_play_("999ab04s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ break;
+ case 7:
+ case 8:
+ case 9:
+ series_play_("999ab08", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ series_play_("999ab08s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ break;
+ case 10:
+ case 11:
+ series_play_("999ab10", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ series_play_("999ab10s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ break;
+ default:
+ series_play_("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ series_play_("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ _G(player_info).x, _G(player_info).y);
+ break;
+ }
+ }
+
+ digi_play("999_04", 2, 255, -1);
+ kernel_timing_trigger_daemon(180, trigger);
+
+ if (!_G(flags)[V154] || imath_rand_bool(5)) {
+ digi_preload("402w005z");
+ digi_play("402w005z", 1, 255, -1);
+ }
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 42ab250be1b..9353677931a 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -55,6 +55,9 @@ public:
void wilburs_speech_finished();
};
+extern void enable_player();
+extern void wilbur_abduct(int trigger);
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/core/imath.cpp b/engines/m4/core/imath.cpp
index 8bb2ffff789..a8d10ba8f72 100644
--- a/engines/m4/core/imath.cpp
+++ b/engines/m4/core/imath.cpp
@@ -85,6 +85,10 @@ frac16 imath_ranged_rand16(frac16 a, frac16 b) {
return result;
}
+bool imath_rand_bool(int max) {
+ return imath_ranged_rand(1, max) == 1;
+}
+
frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2) {
if ((x2 -= x1) < 0) x2 = -x2;
if ((y2 -= y1) < 0) y2 = -y2;
diff --git a/engines/m4/core/imath.h b/engines/m4/core/imath.h
index 7afdf03d48c..376c0dd521b 100644
--- a/engines/m4/core/imath.h
+++ b/engines/m4/core/imath.h
@@ -53,6 +53,7 @@ void imath_seed(int32 seednum);
uint32 imath_random();
int32 imath_ranged_rand(int32 a, int32 b);
frac16 imath_ranged_rand16(frac16 a, frac16 b);
+bool imath_rand_bool(int max);
frac16 dist2d(int32 x1, int32 y1, int32 x2, int32 y2);
frac16 SqrtF16(frac16 n);
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index a1336fb3c63..cdbf592b985 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -85,7 +85,7 @@ extern machine *series_show_(const char *seriesName, frac16 layer, uint32 flags,
int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
extern machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
- int32 firstFrame, int32 lastFrame);
+ int32 firstFrame = 0, int32 lastFrame = -1);
} // namespace M4
Commit: 910ed5479563e7ce450d9b779dbc6eda4d81b015
https://github.com/scummvm/scummvm/commit/910ed5479563e7ce450d9b779dbc6eda4d81b015
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More abduction code
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 9798960d341..0f9b0f2235a 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -22,6 +22,7 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
+#include "m4/graphics/krn_pal.h"
namespace M4 {
namespace Burger {
@@ -226,6 +227,14 @@ void BurgerEngine::global_daemon() {
default:
break;
}
+ break;
+
+ case gTELEPROTED1:
+ disable_player_commands_and_fade_init(gTELEPROTED2);
+ break;
+ case gTELEPROTED2:
+ _G(walker).wilbur_teleported();
+ break;
// TODO: Other cases
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index a593e5a16f6..f8632fc285c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -63,6 +63,8 @@ enum global_triggers {
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
gABDUCT = 10016,
+ gTELEPROTED1 = 10024,
+ gTELEPROTED2 = 10025,
CALLED_EACH_LOOP = 32764,
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 922b2e38067..1158478ae67 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -230,6 +230,10 @@ void Walker::wilburs_speech_finished() {
kernel_trigger_dispatchx(_trigger);
}
+void Walker::wilbur_teleported() {
+ error("TODO: wilbur_teleported");
+}
+
void enable_player() {
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
@@ -283,7 +287,7 @@ void wilbur_abduct(int trigger) {
}
}
- digi_play("999_04", 2, 255, -1);
+ digi_play("999_004", 2, 255, -1);
kernel_timing_trigger_daemon(180, trigger);
if (!_G(flags)[V154] || imath_rand_bool(5)) {
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 9353677931a..2fbaccf9574 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -53,6 +53,7 @@ public:
int vol = 256, int channel = 1);
void wilbur_say();
void wilburs_speech_finished();
+ void wilbur_teleported();
};
extern void enable_player();
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index bdd5655b180..fe04eac9c85 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -46,6 +46,12 @@ HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
return nullptr;
}
+void Section::daemon() {
+ warning("TODO: section daemon");
+ _G(kernel).continue_handling_trigger = true;
+}
+
+
void Sections::global_section_constructor() {
uint sectionNum = _G(game).new_section;
assert(sectionNum >= 1 && sectionNum <= 9);
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index a29d5070a3f..bab711cf312 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -81,7 +81,7 @@ public:
virtual HotSpotRec *walker_spotter(int32 x, int32 y);
virtual void global_room_init() {}
- virtual void daemon() {}
+ virtual void daemon();
virtual void tick() {}
};
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 42cae522450..b69881c066d 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -571,6 +571,11 @@ void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
_G(pal_fade_in_progress) = true;
}
+void disable_player_commands_and_fade_init(int trigger) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, trigger);
+}
+
static void pal_fade_update(RGB8 *origPalette) {
int32 i, currTime;
frac16 tempFrac, tempFrac2;
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 0e5a2ae9ff7..dbb3f54ce62 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -85,7 +85,7 @@ struct KernelPal_Globals {
extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
-
+extern void disable_player_commands_and_fade_init(int trigger);
extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, int32 triggerNum);
/**
Commit: 1db6150783d40aaf50eabd9119321fa19ab5cb2a
https://github.com/scummvm/scummvm/commit/1db6150783d40aaf50eabd9119321fa19ab5cb2a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement kernel_save_game
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/conv_io.cpp
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 87da08192b0..56388ac4c24 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -280,8 +280,7 @@ bool kernel_save_game_exists(int32 slot) {
}
int kernel_save_game(int slot, const char *desc, int32 sizeofDesc, M4sprite *thumbNail, int32 sizeofThumbData) {
- error("TODO: kernel_save_game");
- return 0;
+ return g_engine->saveGameState(slot, desc, slot == 0).getCode() == Common::kNoError ? 0 : 1;
}
bool kernel_load_game(int slot) {
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index d1d24bb9003..efb34d4606e 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -60,7 +60,8 @@ void Converstation_Globals::syncGame(Common::Serializer &s) {
conv_save_buff.resize(val);
// Read in the buffer
- s.syncBytes(&conv_save_buff[0], conv_save_buff.size());
+ if (val)
+ s.syncBytes(&conv_save_buff[0], val);
}
void Converstation_Globals::conv_reset_all() {
Commit: 78928beca89b3f3d0e26eac6809e2ff242f0d127
https://github.com/scummvm/scummvm/commit/78928beca89b3f3d0e26eac6809e2ff242f0d127
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement grey/green fading
Changed paths:
engines/m4/graphics/krn_pal.cpp
engines/m4/platform/events.cpp
engines/m4/platform/events.h
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index b69881c066d..32f0f5fcd64 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -55,10 +55,7 @@ static int32 screen_height(Buffer *grey_screen) {
}
static void grey_fade(RGB8 *pal, int32 to_from_flag, int32 from, int32 to, int32 steps, int32 delay) {
- int i;
-#ifdef TODO
- int j;
- clock_t begin_time;
+ int i, j;
RGB8 *working = (RGB8 *)mem_alloc(sizeof(RGB8) * 256, STR_FADEPAL);
// perform the fade
@@ -82,13 +79,8 @@ static void grey_fade(RGB8 *pal, int32 to_from_flag, int32 from, int32 to, int32
gr_pal_set_range(working, from, to - from + 1); ///set pal 21-255
// Time delay of "delay" milliseconds
- begin_time = clock();
- while ((((clock() - begin_time) * 1000) / CLOCKS_PER_SEC) < delay)
- krn_pal_game_task();
+ g_events->delay(delay);
}
-#else
- error("TODO: grey_fade");
-#endif
// Eliminate round off error
if (to_from_flag == TO_GREY) {
@@ -101,9 +93,8 @@ static void grey_fade(RGB8 *pal, int32 to_from_flag, int32 from, int32 to, int32
}
gr_pal_set_range(pal, from, to - from + 1); ///set pal 21-255
}
-#ifdef TODO
+
mem_free(working);
-#endif
}
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index ed0be6b907b..c6bc8ee0590 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -22,6 +22,7 @@
#include "common/system.h"
#include "m4/platform/events.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
@@ -223,6 +224,18 @@ bool Events::util_kbd_check(int32 *parm1) {
return true;
}
+void Events::delay(uint amount) {
+ uint32 beginTime = g_system->getMillis(), newTime;
+
+ do {
+ krn_pal_game_task();
+ g_system->delayMillis(10);
+ process();
+
+ newTime = g_system->getMillis();
+ } while (!g_engine->shouldQuit() && newTime < (beginTime + amount));
+}
+
MouseEvent mouse_get_event() {
return g_events->mouse_get_event();
}
diff --git a/engines/m4/platform/events.h b/engines/m4/platform/events.h
index a3cb96d1de1..80a08cfc635 100644
--- a/engines/m4/platform/events.h
+++ b/engines/m4/platform/events.h
@@ -114,6 +114,11 @@ public:
void clearMouseStateEvent() {
_mouseStateEvent = 0;
}
+
+ /**
+ * Delays by a given number of milliseconds
+ */
+ void delay(uint amount);
};
extern Events *g_events;
Commit: a59757e163ae438e3c14efe708984353f4876fb2
https://github.com/scummvm/scummvm/commit/a59757e163ae438e3c14efe708984353f4876fb2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merge duplicated myWalker into my_walker
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/adv_r/kernel.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 40d9b666086..12889a03d0b 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -162,8 +162,8 @@ void update_mouse_pos_dialog() {
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
assert(game_buff_ptr);
- if (_G(kernel).myWalker != nullptr) {
- if (((int32)_G(kernel).myWalker->myAnim8) < 0)
+ if (_G(my_walker) != nullptr) {
+ if (((int32)_G(my_walker)->myAnim8) < 0)
error_show(FL, 'W:-(');
player_get_info();
}
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 5bb00ba4c87..256ed910527 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -404,9 +404,9 @@ bool ws_walk_init_system() {
_G(globals)[GLB_SCALER] = FixedDiv(_G(globals)[GLB_MAX_SCALE] - _G(globals)[GLB_MIN_SCALE], _G(globals)[GLB_MAX_Y] - _G(globals)[GLB_MIN_Y]);
}
- _G(kernel).myWalker = _GW().walk_initialize_walker();
+ _G(my_walker) = _GW().walk_initialize_walker();
- if (!_G(kernel).myWalker) {
+ if (!_G(my_walker)) {
error_show(FL, 'W:-(');
return false;
}
@@ -482,24 +482,24 @@ void adv_hyperwalk_to_final_destination(void *, void *) {
_G(i_just_hyperwalked) = true;
// Make sure we have a walker, that it can walk in this scene, and that we can hyperwalk
- if ((!_G(kernel).myWalker) || (!_G(player).walker_in_this_scene) || _G(player).disable_hyperwalk) {
+ if ((!_G(my_walker)) || (!_G(player).walker_in_this_scene) || _G(player).disable_hyperwalk) {
return;
}
// If the walker is not currently walking anywhere, return
- if (!_G(kernel).myWalker->walkPath) {
+ if (!_G(my_walker)->walkPath) {
return;
}
//get the final direction and facing
- adv_get_walker_destination(_G(kernel).myWalker, &x, &y, &facing);
+ adv_get_walker_destination(_G(my_walker), &x, &y, &facing);
// Nuke the rail node path
- DisposePath(_G(kernel).myWalker->walkPath);
- _G(kernel).myWalker->walkPath = nullptr;
+ DisposePath(_G(my_walker)->walkPath);
+ _G(my_walker)->walkPath = nullptr;
// This will make player goto x,y,facing. when that happens, trigger will return
- ws_demand_location_and_facing(_G(kernel).myWalker, x, y, facing);
+ ws_demand_location_and_facing(_G(my_walker), x, y, facing);
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 4f5d2d3685e..9d179a1e05c 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -64,15 +64,15 @@ extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
#define ws_walk_dump_walker_series(xx, yy) (ws_walk_dump_series (xx, yy))
#define ws_walk_dump_shadow_series(xx, yy) (ws_walk_dump_series (xx, yy))
-#define player_walk(xx, yy, ff, tt) (ws_walk(_G(kernel).myWalker, xx, yy, NULL, tt, ff, true))
-#define player_walk_no_finish(xx, yy, ff, tt) (ws_walk(_G(kernel).myWalker, xx, yy, NULL, tt, ff, FALSE))
-#define player_demand_facing(dd) (ws_demand_facing(_G(kernel).myWalker, dd))
-#define player_demand_location(xx, yy) (ws_demand_location(_G(kernel).myWalker, xx, yy))
-#define player_turn_to_face(dd, tt) (ws_turn_to_face(_G(kernel).myWalker, dd, tt))
-#define player_hide() (ws_hide_walker(_G(kernel).myWalker))
-#define player_unhide() (ws_unhide_walker(_G(kernel).myWalker))
-#define player_get_info() (player_update_info(_G(kernel).myWalker, &_G(player_info)))
-#define player_nosepick(aa) (ws_nosepick(_G(kernel).myWalker, aa))
+#define player_walk(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, NULL, tt, ff, true))
+#define player_walk_no_finish(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, NULL, tt, ff, FALSE))
+#define player_demand_facing(dd) (ws_demand_facing(_G(my_walker), dd))
+#define player_demand_location(xx, yy) (ws_demand_location(_G(my_walker), xx, yy))
+#define player_turn_to_face(dd, tt) (ws_turn_to_face(_G(my_walker), dd, tt))
+#define player_hide() (ws_hide_walker(_G(my_walker)))
+#define player_unhide() (ws_unhide_walker(_G(my_walker)))
+#define player_get_info() (player_update_info(_G(my_walker), &_G(player_info)))
+#define player_nosepick(aa) (ws_nosepick(_G(my_walker), aa))
// New walking stuff
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 8662749223d..db70aacd4b1 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -53,8 +53,6 @@ struct Kernel {
bool pause = false;
- machine* myWalker = nullptr;
-
KernelTriggerType trigger_mode = KT_DAEMON; // trigger was/is invoked in this mode
bool call_daemon_every_loop = false;
bool continue_handling_trigger = true; // set to True in apps code when trigger is to
Commit: 99c5f637b161d3b7857ffae88f5642f95f39a2c6
https://github.com/scummvm/scummvm/commit/99c5f637b161d3b7857ffae88f5642f95f39a2c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Outer parser method
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 0f9b0f2235a..90adb4b0125 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -254,5 +254,9 @@ void BurgerEngine::global_pre_parser() {
player_set_facing_hotspot();
}
+void BurgerEngine::global_parser() {
+ // TODO: implement
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 4bae9148531..de0d5277e21 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -59,6 +59,7 @@ public:
void global_daemon() override;
void global_pre_parser() override;
+ void global_parser() override;
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index a363f65d36f..d85fb13f76c 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -617,7 +617,7 @@ void Room101::pre_parser() {
}
void Room101::parser() {
-
+ // TODO: implement
}
void Room101::door() {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index fe04eac9c85..04b9daa2c22 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -330,6 +330,30 @@ void Sections::game_control_cycle() {
}
void Sections::parse_player_command_now() {
+ if (_G(player).command_ready) {
+ term_message("player: %s %s %s", _G(player).verb, _G(player).noun, _G(player).prep);
+ _G(cursor_state) = kARROW;
+ _G(kernel).trigger_mode = KT_PARSE;
+
+ room_parser();
+
+ if (_G(player).command_ready) {
+ section_parser();
+
+ if (_G(player).command_ready) {
+ global_parser();
+
+ if (_G(player).command_ready) {
+ room_error();
+
+ if (_G(player).command_ready)
+ global_error_code();
+ }
+ }
+ }
+
+ }
+
// TODO: parse_player_command_now
error("TODO: parse_player_command_now");
}
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index bab711cf312..c2a56b3192c 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -83,6 +83,7 @@ public:
virtual void global_room_init() {}
virtual void daemon();
virtual void tick() {}
+ virtual void parser() {}
};
class Sections {
@@ -124,6 +125,9 @@ public:
void tick() {
_activeSection->tick();
}
+ void section_parser() {
+ _activeSection->parser();
+ }
void room_preload() {
_activeRoom->preload();
@@ -161,6 +165,11 @@ public:
virtual void global_daemon() = 0;
virtual void global_pre_parser() = 0;
+ virtual void global_parser() = 0;
+
+ void global_error_code() {
+ // No implementation
+ }
};
} // namespace M4
Commit: 76af814554aaa85cb131752bc260a666d9b517ae
https://github.com/scummvm/scummvm/commit/76af814554aaa85cb131752bc260a666d9b517ae
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added wilbur_said
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 90adb4b0125..40df441cd4c 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -255,6 +255,9 @@ void BurgerEngine::global_pre_parser() {
}
void BurgerEngine::global_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+// _G(walker).wilbur_said(
+
// TODO: implement
}
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 1158478ae67..b6e7d74ecff 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -222,6 +222,33 @@ void Walker::wilbur_say() {
_G(kernel).trigger_mode = oldMode;
}
+bool Walker::wilbur_said(const char *list[]) {
+ int index = 0;
+
+ if (!list)
+ return false;
+
+ while (list[index]) {
+ if (player_said(list[index])) {
+ if (player_said("look at") && list[index + 1]) {
+ wilbur_speech(list[index + 1]);
+ return true;
+ } else if (player_said("take") && list[index + 2]) {
+ wilbur_speech(list[index + 2]);
+ return true;
+ } else if (player_said("gear") && list[index + 3]) {
+ wilbur_speech(list[index + 3]);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ index += 4;
+ }
+
+ return false;
+}
+
void Walker::wilburs_speech_finished() {
if (_flag && !_G(player).walker_in_this_scene && !_G(roomVal2))
SendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 2fbaccf9574..d76668de0dd 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -54,6 +54,14 @@ public:
void wilbur_say();
void wilburs_speech_finished();
void wilbur_teleported();
+
+ /**
+ * Takes an array of string constants in the form of "object", "lookline", "takeline", "useline".
+ * The array has to end with four NULLs: NULL, NULL, NULL, NULL
+ * Use NULL in place of a lookline, takeline, or useline if you don't want to this function
+ * to handle it
+ */
+ bool wilbur_said(const char *list[]);
};
extern void enable_player();
Commit: dc41c7ee02c37623a7e7630aa15003c9b64a162a
https://github.com/scummvm/scummvm/commit/dc41c7ee02c37623a7e7630aa15003c9b64a162a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 101 parser
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index d85fb13f76c..d8f1b133a2d 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -100,6 +100,25 @@ static const seriesPlayBreak PLAY_BREAKS4[] = {
PLAY_BREAK_END
};
+static const char *SAID1[][4] = {
+ { "BARBERSHOP", nullptr, "101W003", "101W003" },
+ { "DOOR", "101W006", nullptr, nullptr },
+ { "FIRE ESCAPE", "101W004", nullptr, nullptr },
+ { "TOWN HALL", nullptr, "101W003", nullptr },
+ { "ALLEY", nullptr, "101W003", nullptr },
+ { "VERA'S DINER", nullptr, "101W003", nullptr },
+ { "OLD BRIDGE", nullptr, "101W003", nullptr },
+ { "HARDWARE STORE", "101W006b", "101W003", "101W003" },
+ { "BANK", "101W007", "101W003", "101W003" },
+ { "THEATRE", "101W008", "101W003", "101W003" },
+ { "POLICE STATION", "101W009", "101W003", "101W003" },
+ { "PET AND FEED STORE", "101W010", "101W003", "101W011" },
+ { "FIRE STATION", "101W012", "101W003", "101W003" },
+ { "FIRE HYDRANT", "101W013", "101W003", nullptr },
+ { "PICKUP TRUCK", "101W015", "101W003", "101W016" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
void Room101::init() {
_G(player).walker_in_this_scene = true;
_val1 = 255;
@@ -617,7 +636,72 @@ void Room101::pre_parser() {
}
void Room101::parser() {
- // TODO: implement
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID1)) {
+ // Nothing
+ } else if (player_said("ENTER", "DOOR") || player_said("gear", "door")) {
+ if (_G(flags)[V012] == 2) {
+ player_set_commands_allowed(false);
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 8;
+ kernel_trigger_dispatch_now(gABDUCT);
+ } else if (_G(flags)[V013]) {
+ ws_demand_location(_G(my_walker), 338, 265);
+ ws_demand_facing(_G(my_walker), 10);
+ ws_hide_walker(_G(my_walker));
+ player_set_commands_allowed(false);
+ _G(roomVal1) = 14;
+ kernel_trigger_dispatch_now(gABDUCT);
+ } else {
+ player_set_commands_allowed(false);
+ ws_hide_walker(_G(my_walker));
+ _G(roomVal1) = 8;
+ kernel_trigger_dispatch_now(gABDUCT);
+ }
+
+ } else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
+ player_set_commands_allowed(false);
+ _G(roomVal1) = 20;
+ ws_hide_walker(_G(my_walker));
+ kernel_trigger_dispatch_now(gABDUCT);
+
+ } else if (player_said("ENTER", "TOWN HALL") || player_said("gear", "town hall") ||
+ (lookFlag && player_said("town hall"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1004);
+
+ } else if (player_said("ENTER", "ALLEY") || player_said("gear", "alley") ||
+ (lookFlag && player_said("alley"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1006);
+
+ } else if (player_said("ENTER", "OLD BRIDGE") || player_said("gear", "old bridge") ||
+ (lookFlag && player_said("old bridge"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1008);
+
+ } else if (player_said("ENTER", "VERA'S DINER") || player_said("gear", "vera's diner") ||
+ (lookFlag && player_said("vera's diner"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1014);
+
+ } else if (inv_player_has(_G(player).verb) &&
+ player_said_any("alley", "town hall", "vera's diner", "old bridge")) {
+ _G(walker).wilbur_speech("101w003");
+
+ } else if (inv_player_has(_G(player).verb) && player_said("fire hydrant")) {
+ _G(walker).wilbur_speech("101w014");
+
+ } else if (lookFlag && player_said("barbershop")) {
+ _G(walker).wilbur_speech(_G(flags)[V013] ? "101w002" : "101w001");
+
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
void Room101::door() {
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index b6e7d74ecff..7f3717f5ee9 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -222,28 +222,25 @@ void Walker::wilbur_say() {
_G(kernel).trigger_mode = oldMode;
}
-bool Walker::wilbur_said(const char *list[]) {
- int index = 0;
-
+bool Walker::wilbur_said(const char *list[][4]) {
if (!list)
return false;
- while (list[index]) {
- if (player_said(list[index])) {
- if (player_said("look at") && list[index + 1]) {
- wilbur_speech(list[index + 1]);
+ for (int index = 0; list[index][0]; ++index) {
+ if (player_said(list[index][0])) {
+ if (player_said("look at") && list[index][1]) {
+ wilbur_speech(list[index][1]);
return true;
- } else if (player_said("take") && list[index + 2]) {
- wilbur_speech(list[index + 2]);
+ } else if (player_said("take") && list[index][2]) {
+ wilbur_speech(list[index][2]);
return true;
- } else if (player_said("gear") && list[index + 3]) {
- wilbur_speech(list[index + 3]);
+ } else if (player_said("gear") && list[index][3]) {
+ wilbur_speech(list[index][3]);
return true;
} else {
return false;
}
}
- index += 4;
}
return false;
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index d76668de0dd..ae41ffb7124 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -61,7 +61,7 @@ public:
* Use NULL in place of a lookline, takeline, or useline if you don't want to this function
* to handle it
*/
- bool wilbur_said(const char *list[]);
+ bool wilbur_said(const char *list[][4]);
};
extern void enable_player();
Commit: 35eae178c6ee78f21f1bdc72ab43273c1c7779ec
https://github.com/scummvm/scummvm/commit/35eae178c6ee78f21f1bdc72ab43273c1c7779ec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added global parser code
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 40df441cd4c..7dfeddaa0b3 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -23,6 +23,7 @@
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/graphics/krn_pal.h"
+#include "m4/core/imath.h"
namespace M4 {
namespace Burger {
@@ -79,6 +80,167 @@ static const seriesPlayBreak PLAY_BREAKS6[] = {
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
+static const char *SAID1[][4] = {
+ { "WILBUR", "999w010", "999w011", "999w011" },
+ { "BROKEN MOUSE TRAP", "405W016", nullptr, "400W001" },
+ { "CARROT JUICE", "300w043", nullptr, nullptr },
+ { "BOTTLE", "300w071", nullptr, nullptr },
+ { "WHISTLE", "300w058", nullptr, nullptr },
+ { "PANTYHOSE", "999w005", nullptr, nullptr },
+ { "AMPLIFIER", "999w026", nullptr, nullptr },
+ { "DEED", "999w101", nullptr, nullptr },
+ { "JAWZ O' LIFE", "999w103", nullptr, nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const char *PARSER_LIST[] = {
+ "DEED",
+ "LOOK AT",
+ "999w101",
+ "WILBUR",
+ "400w001",
+ nullptr,
+ "999w102",
+ "Th-th-th-that's all folks...",
+ "JAWZ O' LIFE",
+ "LOOK AT",
+ "999w103",
+ "WILBUR",
+ "400w001",
+ nullptr,
+ "999w104",
+ "Th-th-th-that's all folks...",
+ "CARROT JUICE",
+ "JUG",
+ "300w046",
+ "JUG ",
+ "300w046",
+ "JUG",
+ "300w046",
+ "AUNT POLLY",
+ "999w225",
+ nullptr,
+ "300w057",
+ "Th-th-th-that's all folks...",
+ "SPRING",
+ "BROKEN MOUSE TRAP",
+ "405w018",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ "BOTTLE",
+ "WATER",
+ "999w224",
+ "WILBUR",
+ "300w077",
+ nullptr,
+ "300w078",
+ "Th-th-th-that's all folks...",
+ "WHISTLE",
+ nullptr,
+ "300w070",
+ "Th-th-th-that's all folks...",
+ "BLOCK OF ICE",
+ "FLOOR",
+ "999w003",
+ "FLOOR ",
+ "999w003",
+ "MICROWAVE",
+ "999w222",
+ "WILBUR",
+ "999w003",
+ nullptr,
+ "999w004",
+ "Th-th-th-that's all folks...",
+ "PANTYHOSE",
+ "ENGINE",
+ "999w223",
+ nullptr,
+ "999w008",
+ "Th-th-th-that's all folks...",
+ "AMPLIFIER",
+ "WILBUR",
+ "999w027",
+ nullptr,
+ "999w029",
+ "Th-th-th-that's all folks...",
+ "MONEY",
+ "STOLIE",
+ "999w205",
+ nullptr,
+ "999w206",
+ ",Th-th-th-that's all folks...",
+ ",BROKEN PUZ DISPENSER",
+ "LOOK AT",
+ "999w207",
+ nullptr,
+ "999w209",
+ "Th-th-th-that's all folks...",
+ "PUZ DISPENSER",
+ "LOOK AT",
+ "999w207",
+ nullptr,
+ "999w209",
+ "Th-th-th-that's all folks...",
+ "SPRING",
+ "LOOK AT",
+ "999w210",
+ nullptr,
+ "999w211",
+ "Th-th-th-that's all folks...",
+ "PHONE BILL",
+ "LOOK AT",
+ "999w212",
+ "AUNT POLLY",
+ "999w213",
+ nullptr,
+ "999w206",
+ "Th-th-th-that's all folks...",
+ "LAXATIVE",
+ "LOOK AT",
+ "999w214",
+ "GEAR",
+ "999w215",
+ "WILBUR",
+ "999w215",
+ "PEGLEG",
+ "999w216",
+ "PEGLEG ",
+ "999w216",
+ "PEGLEG ",
+ "999w216",
+ "TRUFFLES",
+ "999w217",
+ "GERBILS",
+ "999w218",
+ "BORK",
+ "999w219",
+ "BORK ",
+ "999w219",
+ "BORK ",
+ "999w219",
+ "BORK ",
+ "999w219",
+ "BORK ",
+ "999w219",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ "KEYS",
+ "LOOK AT",
+ "999w220",
+ "WILBUR",
+ "999w206",
+ nullptr,
+ "999w221",
+ "Th-th-th-that's all folks...",
+ "WILBUR",
+ nullptr,
+ "999w012",
+ "Th-th-th-that's all folks...",
+ nullptr
+};
+
BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
@@ -256,9 +418,127 @@ void BurgerEngine::global_pre_parser() {
void BurgerEngine::global_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
-// _G(walker).wilbur_said(
- // TODO: implement
+ if (_G(walker).wilbur_said(SAID1))
+ goto done;
+
+ if (player_said_any("WILBUR", "GEAR")) {
+ if (player_said("CARROT JUICE")) {
+ if (_G(flags)[V123] && !imath_rand_bool(3)) {
+ _G(walker).wilbur_speech("300w056");
+ goto done;
+
+ } else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(flags)[V123] = 1;
+ _G(roomVal1) = 10004;
+ ws_turn_to_face(_G(my_walker), 3, gABDUCT);
+ goto done;
+ }
+ }
+ }
+
+ if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(roomVal1) = 10003;
+ ws_turn_to_face(_G(my_walker), 7, gABDUCT);
+ goto done;
+ }
+
+ if (player_said("kibble") && player_said_any("gear", "wilbur") &&
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(roomVal1) = 10005;
+ ws_turn_to_face(_G(my_walker), 9, gABDUCT);
+ goto done;
+ }
+
+ if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(roomVal1) = 10006;
+ ws_turn_to_face(_G(my_walker), 9, gABDUCT);
+ goto done;
+ }
+
+ if (player_said("broken puz dispenser") && player_said_any("gear", "wilbur") &&
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(roomVal1) = 10007;
+ ws_turn_to_face(_G(my_walker), 5, 10016);
+ goto done;
+ }
+
+ if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(roomVal1) = 10008;
+ ws_turn_to_face(_G(my_walker), 5, gABDUCT);
+ goto done;
+ }
+
+ if (player_said("spring", "broken puz dispenser")) {
+ inv_move_object("BROKEN PUZ DISPENSER", NOWHERE);
+ inv_move_object("SPRING", NOWHERE);
+ inv_give_to_player("PUZ DISPENSER");
+
+ } else if (player_said("LOOK AT", "BLOCK OF ICE")) {
+ _G(walker).wilbur_speech(_G(flags)[ROOM101_FLAG22] ? "999w002" : "999w001");
+
+ } else if (player_said("PANTYHOSE", "WILBUR")) {
+ if (_G(flags)[V297]) {
+ _G(walker).wilbur_speech("999w007");
+ } else {
+ _G(walker).wilbur_speech("999w006");
+ _G(flags)[V297] = 1;
+ }
+
+ } else if (player_said("TAKE")) {
+ _G(walker).wilbur_speech(saidofInterest() ? "999w021" : "999w016");
+
+ } else if (player_said("LOOK AT", "MONEY")) {
+ switch (_G(flags)[V001]) {
+ case 11:
+ _G(walker).wilbur_speech("999w204");
+ break;
+ case 12:
+ _G(walker).wilbur_speech("999w203");
+ break;
+ case 19:
+ _G(walker).wilbur_speech("999w202");
+ break;
+ case 20:
+ _G(walker).wilbur_speech("999w201");
+ break;
+ default:
+ break;
+ }
+
+ } else if (player_said("GEAR")) {
+ _G(walker).wilbur_speech_random("999w017", "999w018", "999w019", "999w020");
+
+ } else if (!_G(walker).wilbur_parser(PARSER_LIST)) {
+ if (player_said("LOOK AT")) {
+ _G(walker).wilbur_speech_random("999w013", "999w014", "999w015");
+ } else if (player_said("WALK") || player_said("WALK TO") ||
+ player_said("WALK ACROSS") || player_said("WALK ON")) {
+ term_message("Just a walk, no response needed.");
+ } else {
+ _G(walker).wilbur_speech_random("999w017", "999w018", "999w019", "999w020");
+ }
+ }
+
+done:
+ _G(player).command_ready = false;
+}
+
+bool BurgerEngine::saidofInterest() const {
+ return player_said_any("DISTILLED CARROT JUICE", "broken puz dispenser", "puz dispenser") ||
+ player_said_any("broken mouse trap", "mouse trap", "kindling", "burning kindling") ||
+ player_said_any("CHRISTMAS LIGHTS", "CHRISTMAS LIGHTS ", "bottle", "carrot juice") ||
+ player_said_any("soapy water", "iron filings", "waxed hair", "fish") ||
+ player_said_any("hook", "keys", "records", "DOG DOLLAR") ||
+ player_said_any("AMPLIFIER", "rubber gloves", "DIRTY SOCK", "JAWZ O' LIFE") ||
+ player_said_any("deed", "burger morsel", "whistle", "QUARTER") ||
+ player_said_any("matches", "phone cord", "kibble", "pantyhose") ||
+ player_said_any("fan belt", "spring", "mirror", "PHONE BILL") ||
+ player_said_any("ray gun", "BLOCK OF ICE", "rolling pin", "rubber duck") ||
+ player_said_any("LAXATIVE", "money", "crow bar", "Wilbur");
}
} // namespace Burger
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index de0d5277e21..48d603b562c 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -40,6 +40,12 @@ private:
Rooms::Section1 _section7;
Rooms::Section1 _section8;
Rooms::Section9 _section9;
+
+ /**
+ * Tests for a bunch of words of interest during parsing
+ */
+ bool saidofInterest() const;
+
protected:
/**
* Creates the structure that holds all the global variables
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 7f3717f5ee9..bc756752a30 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -320,5 +320,21 @@ void wilbur_abduct(int trigger) {
}
}
+void Walker::speech_random(int count, int trigger,
+ const char *name1, const char *name2, const char *name3,
+ const char *name4, const char *name5, const char *name6,
+ const char *name7, const char *name8, const char *name9) {
+ const char *names[9] = {
+ name1, name2, name3, name4, name5, name6, name7, name8, name9
+ };
+
+ wilbur_speech(names[imath_ranged_rand(1, count) - 1], trigger);
+}
+
+bool Walker::wilbur_parser(const char **list) {
+ // TODO: wilbur_parser
+ return false;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index ae41ffb7124..721bf7ddd10 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -42,6 +42,15 @@ private:
*/
static void player_walker_callback(frac16 myMessage, machine *sender);
+ /**
+ * Says speech randomly
+ */
+ void speech_random(int count, int trigger, const char *name1,
+ const char *name2, const char *name3 = nullptr,
+ const char *name4 = nullptr, const char *name5 = nullptr,
+ const char *name6 = nullptr, const char *name7 = nullptr,
+ const char *name8 = nullptr, const char *name9 = nullptr);
+
public:
~Walker() override {}
@@ -62,6 +71,34 @@ public:
* to handle it
*/
bool wilbur_said(const char *list[][4]);
+
+ void wilbur_speech_random(const char *name1, const char *name2, int trigger = -1) {
+ speech_random(2, trigger, name1, name2);
+ }
+ void wilbur_speech_random(const char *name1, const char *name2,
+ const char *name3, int trigger = -1) {
+ speech_random(3, trigger, name1, name2, name3);
+ }
+ void wilbur_speech_random(const char *name1, const char *name2,
+ const char *name3, const char *name4, int trigger = -1) {
+ speech_random(4, trigger, name1, name2, name3, name4);
+ }
+ void wilbur_speech_random(const char *name1, const char *name2,
+ const char *name3, const char *name4, const char *name5, int trigger = -1) {
+ speech_random(5, trigger, name1, name2, name3, name4, name5);
+ }
+ void wilbur_speech_random(const char *name1, const char *name2,
+ const char *name3, const char *name4, const char *name5,
+ const char *name6, int trigger = -1) {
+ speech_random(6, trigger, name1, name2, name3, name4, name5, name6);
+ }
+ void wilbur_speech_random(const char *name1, const char *name2,
+ const char *name3, const char *name4, const char *name5,
+ const char *name6, const char *name7, int trigger = -1) {
+ speech_random(7, trigger, name1, name2, name3, name4, name5, name6, name7);
+ }
+
+ bool wilbur_parser(const char **list);
};
extern void enable_player();
Commit: 89e262de8343140c643070e25feff051ae8f105d
https://github.com/scummvm/scummvm/commit/89e262de8343140c643070e25feff051ae8f105d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added wilbur_parser
Changed paths:
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index bc756752a30..6b788b728e4 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -332,7 +332,33 @@ void Walker::speech_random(int count, int trigger,
}
bool Walker::wilbur_parser(const char **list) {
- // TODO: wilbur_parser
+ bool flag = true;
+
+ for (const char **curr = list; *curr; ++curr) {
+ if (player_said(*curr)) {
+ for (; *curr; ++curr) {
+ if (!player_said(*curr)) {
+ ++curr;
+ } else {
+ if (!*++curr) {
+ flag = 0;
+ } else {
+ wilbur_speech(*curr);
+ return true;
+ }
+ }
+ }
+
+ if (*++curr && flag) {
+ wilbur_speech(*curr);
+ return true;
+ }
+ } else {
+ for (; !*curr && scumm_stricmp(*curr, "Th-th-th-that's all folks..."); ++curr) {
+ }
+ }
+ }
+
return false;
}
Commit: db6680173ab0cf33b7c2d7bb9939b275ea16a2dd
https://github.com/scummvm/scummvm/commit/db6680173ab0cf33b7c2d7bb9939b275ea16a2dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for look actions
Yes, in-game actions are now starting to work \o/
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/platform/sound/digi.cpp
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 04b9daa2c22..611db86e7e7 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -352,10 +352,8 @@ void Sections::parse_player_command_now() {
}
}
+ term_message("...parsed");
}
-
- // TODO: parse_player_command_now
- error("TODO: parse_player_command_now");
}
void Sections::pal_game_task() {
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index b93260567b3..ba43aa195d2 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -120,7 +120,8 @@ int32 Digi::play(const Common::String &name, uint channel, int32 vol, int32 trig
Audio::makeRawStream(entry._data, entry._size, 11025, Audio::FLAG_UNSIGNED,
DisposeAfterUse::NO),
loop ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &c._soundHandle, stream, -1, vol);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &c._soundHandle, stream,
+ -1, MIN(vol, (int32)255));
if (trigger < 0 || trigger > 32767)
trigger = -1;
Commit: 94fdf06b806d2475e328ab683248756290a58c00
https://github.com/scummvm/scummvm/commit/94fdf06b806d2475e328ab683248756290a58c00
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix colors of interface tooltip
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 8ce39066309..294ea1530fd 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -139,8 +139,9 @@ void TextField::draw(GrBuff *myBuffer) {
Buffer *myBuff = myBuffer->get_buffer();
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
- gr_font_set_color(__WHITE);
+
gr_font_set(_G(font_inter));
+ font_set_colors(1, 2, 3);
gr_font_write(myBuff, _string, _x1, _y1, 0, 1);
myBuffer->release();
Commit: 7b8d433f0487c14e8945b72b653ecbbfb62cce45
https://github.com/scummvm/scummvm/commit/7b8d433f0487c14e8945b72b653ecbbfb62cce45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 1 daemon
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index d8f1b133a2d..ddd4cfdda9a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -209,13 +209,15 @@ void Room101::daemon() {
player_update_info(_G(my_walker), &_G(player_info));
if (_G(player_info).y > 374 && player_said("old bridge")) {
+ // Changing to Old Bridge
player_set_commands_allowed(false);
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1008);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, GOTO_OLD_BRIDGE);
_G(kernel).call_daemon_every_loop = false;
} else if (_G(player_info.y < 205) && player_said("town hall")) {
+ // Changing to Town Hall
player_set_commands_allowed(false);
- pal_fade_init(_G(master_palette), 16, 255, 0, 30, 1001);
+ pal_fade_init(_G(master_palette), 16, 255, 0, 30, GOTO_TOWN_HALL);
_G(kernel).call_daemon_every_loop = false;
}
}
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 919d9b394d8..d8afecd49ec 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
+#include "m4/core/imath.h"
#include "m4/m4.h"
namespace M4 {
@@ -48,7 +49,7 @@ void Section1::updateWalker_(int x, int y, int dir, int trigger, bool mode) {
gr_backup_palette();
pal_fade_set_start(_G(master_palette), 0);
- _series = series_load("110", -1, _G(master_palette));
+ _series1 = series_load("110", -1, _G(master_palette));
_play = series_play_("110", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
kernel_trigger_dispatch_now(mode ? 1032 : 1027);
@@ -75,6 +76,170 @@ void Section1::walk(int facing, int trigger) {
}
}
+void Section1::daemon() {
+ switch (_G(kernel).trigger) {
+ case GOTO_TOWN_HALL:
+ case 1002:
+ case 1003:
+ case 1004:
+ case 1005:
+ case 1006:
+ case 1007:
+ _G(game).new_room = _G(kernel).trigger - 1000 + 100;
+ break;
+ case 1008:
+ _G(game).new_room = _G(flags)[V000] == 1002 ? 134 : 135;
+ break;
+ case 1009:
+ _G(game).new_room = _G(flags)[V000] == 1002 ? 133 : 136;
+ break;
+ case 1010:
+ _G(game).new_room = 137;
+ break;
+ case 1011:
+ _G(game).new_room = 138;
+ break;
+ case 1012:
+ _G(game).new_room = _G(flags)[V000] == 102 ? 144 : 139;
+ break;
+ case 1013:
+ _G(game).new_room = _G(flags)[V000] == 1002 ? 141 : 140;
+ break;
+ case 1014:
+ _G(game).new_room = 142;
+ break;
+ case 1015:
+ _G(game).new_room = 143;
+ break;
+ case 1016:
+ _G(game).new_room = 145;
+ break;
+ case 1017:
+ _G(game).new_room = 170;
+ break;
+ case 1018:
+ _G(game).new_room = 171;
+ break;
+ case 1019:
+ _G(game).new_room = 172;
+ break;
+ case 1020:
+ _G(game).new_room = 173;
+ break;
+ case 1021:
+ _G(game).new_room = 174;
+ break;
+ case 1022:
+ _G(game).new_room = 175;
+ break;
+ case 1023:
+ _G(game).new_room = 176;
+ break;
+ case 1024:
+ pal_fade_init(_G(master_palette), 0, 255, 100, 0, -1);
+ break;
+ case 1025:
+ kernel_trigger_dispatch_now(_trigger);
+ break;
+ case 1026:
+ pal_fade_init(_G(master_palette), 15, 255, 100, 0, -1);
+ break;
+ case 1027:
+ _series2 = series_load("110bu01", -1, _G(master_palette));
+ series_play_("110bu01", 0, 0, 1028, 6, 0, 100, 0, 0, 0, 8);
+ _state1 = 2;
+ break;
+ case 1028:
+ kernel_trigger_dispatch_now(1029);
+ digi_play((_G(game).room_id == 135) ? "100b002" : "100b001", 1, 255, 1030);
+ break;
+ case 1029:
+ if (_state1 == 2) {
+ int frame = imath_ranged_rand(9, 12);
+ series_play_("110bu01", 0, 0, 1029, 5, 0, 100, 0, 0, frame, frame);
+ } else {
+ pal_fade_set_start(_G(master_palette), 0);
+ TerminateMachineAndNull(_play);
+ kernel_timing_trigger(1, 1031);
+ }
+ break;
+ case 1030:
+ _state1 = 1;
+ return;
+ case 1031:
+ series_unload(_series2);
+ series_unload(_series1);
+ kernel_trigger_dispatch_now(_trigger);
+ break;
+ case 1032:
+ _series2 = series_load("110bu02", -1, _G(master_palette));
+ _state1 = 2;
+ kernel_trigger_dispatch_now(1033);
+ digi_play("110bu03", 1, 255, 1034);
+ break;
+ case 1033:
+ if (_state1 == 2) {
+ int frame = imath_ranged_rand(0, 4);
+ series_play_("110bu02", 0, 0, 1033, 5, 0, 100, 0, 0, frame, frame);
+ } else {
+ series_play_("110bu02", 0, 0, 1035, 5, 0, 100, 0, 0, 5, 16);
+ }
+ break;
+ case 1034:
+ _state1 = 1;
+ break;
+ case 1035:
+ pal_fade_set_start(_G(master_palette), 0);
+ TerminateMachineAndNull(_play);
+ kernel_timing_trigger(1, 1036);
+ break;
+ case 1036:
+ series_unload(_series2);
+ series_unload(_series1);
+ kernel_trigger_dispatch_now(_trigger);
+ break;
+ case 10007:
+ if (_G(flags)[V012] == 2) {
+ term_message(" Harry watches tv at: %ld", _G(flags)[GLB_TEMP_3]);
+
+ if (_G(flags).get_boonsville_time_and_display() == (int32)_G(flags)[GLB_TEMP_3]) {
+ if (_G(game).room_id == 102) {
+ term_message("make harry walk in");
+ kernel_timing_trigger(1, 1037);
+ } else {
+ term_message("harry is back in chair");
+ _G(flags)[V012] = 0;
+ }
+ }
+ }
+
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ case 10028:
+ _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1003;
+ break;
+ case 10029:
+ if (!_G(flags)[V043])
+ _G(flags)[V063] = 1;
+ break;
+ case 10030:
+ if (_G(flags)[V043])
+ _G(flags)[V063] = 0;
+ break;
+ case 10031:
+ if (_G(flags)[V043])
+ _G(flags)[V000] = 1004;
+ break;
+ case 10032:
+ _G(flags)[V058] = 1;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index d7fd0ef9e90..953a3352a94 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -30,19 +30,28 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum Goto1 {
+ GOTO_TOWN_HALL = 1001,
+ GOTO_OLD_BRIDGE = 1008
+};
+
class Section1 : public Rooms::Section {
private:
Room101 _room101;
int _trigger = 0;
- int _series = -1;
+ int _series1 = -1;
+ int _series2 = -1;
machine *_play = nullptr;
+ int _state1 = 0;
void updateWalker_(int x, int y, int dir, int trigger, bool mode);
public:
Section1();
virtual ~Section1() {}
+ void daemon() override;
+
static void updateWalker(int x, int y, int dir, int trigger, bool mode = false);
static void updateDisablePlayer();
static void walk(int facing, int trigger = -1);
Commit: 65e6461a97738fd61e1759abe469d198d7d2d0f8
https://github.com/scummvm/scummvm/commit/65e6461a97738fd61e1759abe469d198d7d2d0f8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix depth code drawing
Changed paths:
engines/m4/graphics/gr_surface.cpp
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 0744a942ca3..7ea72f36702 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -146,7 +146,7 @@ void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
break;
byte v = *srcP;
- if (destX >= 0 && v != 0 && (!depthP || *depthP == 0 || srcDepth == *depthP)) {
+ if (destX >= 0 && v != 0 && (!depthP || *depthP == 0 || srcDepth < *depthP)) {
*destP = v;
}
Commit: 361efc1cdaf164f6d5ba885bf577d2fe4b643508
https://github.com/scummvm/scummvm/commit/361efc1cdaf164f6d5ba885bf577d2fe4b643508
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress global daemon
Changed paths:
A engines/m4/burger/core/conv.cpp
A engines/m4/burger/core/conv.h
engines/m4/adv_r/conv_io.h
engines/m4/burger/burger.cpp
engines/m4/burger/core/play_break.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index f40500633a9..424e6c4ff97 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -85,8 +85,6 @@ extern void conv_reset(char *filename);
extern void conv_reset_all();
extern void conv_play(Conv *c);
-extern void conv_resume(Conv *c);
-
extern void set_conv_name(char *s);
extern char *get_conv_name();
extern char *conv_sound_to_play();
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 7dfeddaa0b3..05551b7bb1f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -22,6 +22,7 @@
#include "common/debug.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
+#include "m4/burger/core/conv.h"
#include "m4/graphics/krn_pal.h"
#include "m4/core/imath.h"
@@ -273,14 +274,35 @@ void BurgerEngine::syncFlags(Common::Serializer &s) {
void BurgerEngine::global_daemon() {
switch (_G(kernel).trigger) {
+ case gRESUME_CONVERSATION:
+ conv_resume();
+ break;
+
case gSERIES_STREAM_BREAK:
handle_series_stream_break();
break;
+ case gSERIES_PLAY_BREAK0:
+ handle_series_play_break(0);
+ break;
+
+ case gSERIES_PLAY_BREAK1:
+ handle_series_play_break(1);
+ break;
+
+ case gSERIES_PLAY_BREAK2:
+ handle_series_play_break(2);
+ break;
+
case gRELEASE_TRIGGER_DIGI_CHECK:
release_trigger_digi_check();
break;
+ case 10007:
+ _G(flags).advance_boonsville_time_and_check_schedule(300);
+ kernel_timing_trigger(300, 10007);
+ break;
+
case gWILBURS_SPEECH_START:
_G(walker).wilbur_say();
break;
@@ -391,6 +413,14 @@ void BurgerEngine::global_daemon() {
}
break;
+ case 10017:
+ if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
+ _G(player).walker_in_this_scene && _G(roomVal2))
+ SendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
+
+ kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
+ break;
+
case gTELEPROTED1:
disable_player_commands_and_fade_init(gTELEPROTED2);
break;
diff --git a/engines/m4/burger/core/conv.cpp b/engines/m4/burger/core/conv.cpp
new file mode 100644
index 00000000000..ce7eaa3a9db
--- /dev/null
+++ b/engines/m4/burger/core/conv.cpp
@@ -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/>.
+ *
+ */
+
+#include "m4/adv_r/conv_io.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+
+void conv_resume() {
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ conv_resume(conv_get_handle());
+}
+
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/core/conv.h b/engines/m4/burger/core/conv.h
new file mode 100644
index 00000000000..d68198e9d47
--- /dev/null
+++ b/engines/m4/burger/core/conv.h
@@ -0,0 +1,36 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_CORE_CONV_H
+#define M4_BURGER_CORE_CONV_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+
+extern void conv_resume();
+
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index 6fd7ff311b8..d0509f21b14 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -54,6 +54,7 @@ extern int32 series_play_with_breaks(const seriesPlayBreak list[], const char *n
int32 scale = 100, int32 x = 0, int32 y = 0);
extern void digi_preload_play_breaks(const seriesPlayBreak list[]);
extern void digi_unload_play_breaks(const seriesPlayBreak list[]);
+extern void handle_series_play_break(int32 slot);
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 4b7898f5000..d8592e69750 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -30,6 +30,33 @@ namespace Burger {
#define FLAGS_COUNT 512
+struct BoonsvilleRec {
+ int32 _time;
+ int32 _trigger;
+ const char *_text;
+};
+
+static const BoonsvilleRec ARRAY[] = {
+ { 600, -1, "After getting neuro stuff" },
+ { 2400, -1, "After getting survival stuff" },
+ { 6000, 10028, "Burl enters town" },
+ { 6600, -1, "After getting sensory stuff" },
+ { 9600, 10029, "Burl gets fed" },
+ { 19200, -1, "After getting language stuff" },
+ { 13200, 10030, "Burl stops eating" },
+ { 22800, -1, "After getting logic stuff" },
+ { 15000, 10031, "Burl leaves town" },
+ { 18600, 10031, "Band enters town" },
+ { 33600, 10022, "Abduction time" },
+ { 55200, 10023, "Nero timeout" },
+ { 166800, 10023, "Survival timeout" },
+ { 278400, 10023, "Sensory timeout" },
+ { 390000, 10023, "Language timeout" },
+ { 501600, 10023, "Logic timeout" },
+ { 505200, 10033, "Conclusion" },
+ { 0, 0, nullptr }
+};
+
Flags::Flags() {
resize(FLAGS_COUNT);
}
@@ -63,6 +90,39 @@ void Flags::set_boonsville_time(int32 time) {
(*this)[BOONSVILLE_TIME2] = time - 1;
}
+bool Flags::advance_boonsville_time_and_check_schedule(int32 time) {
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ (*this)[BOONSVILLE_TIME2] = (*this)[BOONSVILLE_TIME];
+ (*this)[BOONSVILLE_TIME] = time;
+ return dispatch_scheduled_boonsville_time_trigger(
+ get_boonsville_time_and_display());
+ } else {
+ return false;
+ }
+}
+
+bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ bool result = false;
+
+ for (const BoonsvilleRec *rec = ARRAY; rec->_time; ++rec) {
+ if ((*this)[BOONSVILLE_TIME2] > rec->_time &&
+ rec->_time <= (*this)[BOONSVILLE_TIME]) {
+ result = true;
+ term_message("Time for: %s", rec->_text);
+ schedule_boonsville_time();
+ kernel_trigger_dispatch_now(rec->_trigger);
+ }
+ }
+
+ return result;
+}
+
+void Flags::schedule_boonsville_time() {
+ error("TODO: Flags::schedule_boonsville_time()");
+}
+
void Flags::reset1() {
set_boonsville_time(0);
(*this)[V000] = 1000;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 3e156d64957..ffe6d847b1e 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -572,6 +572,9 @@ public:
int32 get_boonsville_time_and_display(bool showTime = false);
void set_boonsville_time(int32 time);
+ bool advance_boonsville_time_and_check_schedule(int32 time);
+ bool dispatch_scheduled_boonsville_time_trigger(int32 time);
+ void schedule_boonsville_time();
/**
* Save/load values to a save file
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index ddd4cfdda9a..f10ccf30c44 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -613,7 +613,6 @@ void Room101::daemon() {
}
break;
- // TODO: cases
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index f8632fc285c..b6eafc79f57 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -45,8 +45,11 @@ enum global_triggers {
gFIRST_GLOBAL_TRIGGER = 10000,
// System triggers
- gRESUME_CONVERSATION, // Yep, that's what it does!
+ gRESUME_CONVERSATION = 10001, // Yep, that's what it does!
gSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
+ gSERIES_PLAY_BREAK0 = 10003,
+ gSERIES_PLAY_BREAK1 = 10004,
+ gSERIES_PLAY_BREAK2 = 10005,
gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
/*
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index f522c4d8f5d..94307b29e6e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -79,8 +79,9 @@ MODULE_OBJS = \
wscript/ws_timer.o \
wscript/wscript.o \
wscript/wst_regs.o \
- burger/core/release_trigger.o \
+ burger/core/conv.o \
burger/core/play_break.o \
+ burger/core/release_trigger.o \
burger/core/stream_break.o \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
Commit: f0cd49462302fe0979be7f7680b0630e83742a2d
https://github.com/scummvm/scummvm/commit/f0cd49462302fe0979be7f7680b0630e83742a2d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of global_daemon
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 05551b7bb1f..1326936f8e6 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -24,6 +24,7 @@
#include "m4/burger/vars.h"
#include "m4/burger/core/conv.h"
#include "m4/graphics/krn_pal.h"
+#include "m4/core/errors.h"
#include "m4/core/imath.h"
namespace M4 {
@@ -282,15 +283,15 @@ void BurgerEngine::global_daemon() {
handle_series_stream_break();
break;
- case gSERIES_PLAY_BREAK0:
+ case gSERIES_PLAY_BREAK_0:
handle_series_play_break(0);
break;
- case gSERIES_PLAY_BREAK1:
+ case gSERIES_PLAY_BREAK_1:
handle_series_play_break(1);
break;
- case gSERIES_PLAY_BREAK2:
+ case gSERIES_PLAY_BREAK_2:
handle_series_play_break(2);
break;
@@ -303,14 +304,23 @@ void BurgerEngine::global_daemon() {
kernel_timing_trigger(300, 10007);
break;
- case gWILBURS_SPEECH_START:
- _G(walker).wilbur_say();
+ case gNONPLAYERS_SPEECH_FINISHED:
+ if (_G(npcSpeech1))
+ TerminateMachineAndNull(_G(npcSpeech1));
+ if (_G(npcSpeech2))
+ TerminateMachineAndNull(_G(npcSpeech2));
+
+ kernel_trigger_dispatch_now(_G(npcTrigger));
break;
case gWILBURS_SPEECH_FINISHED:
_G(walker).wilburs_speech_finished();
break;
+ case gWILBURS_SPEECH_START:
+ _G(walker).wilbur_say();
+ break;
+
case gABDUCT:
switch (_G(roomVal1)) {
case 10001:
@@ -421,14 +431,55 @@ void BurgerEngine::global_daemon() {
kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
break;
+ case gSET_FACING:
+ player_set_facing_at(_G(player_facing_x), _G(player_facing_y));
+ break;
+
+ case gSET_DEST:
+ ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
+ _G(walker).wilbur_poof();
+ kernel_trigger_dispatch_now(gSET_COMMANDS_ALLOWED);
+
+ case gSET_COMMANDS_ALLOWED:
+ player_set_commands_allowed(true);
+ break;
+
+ case gUNPOOF:
+ _G(walker).wilbur_unpoof();
+ break;
+
+ case 10022:
+ if (_G(game).room_id < 200) {
+ _G(roomVal1) = 10017;
+ kernel_trigger_dispatch_now(gABDUCT);
+ } else {
+ error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
+ }
+ break;
+
+ case 10023:
+ if (_G(game).room_id < 700) {
+ _G(roomVal1) = 10018;
+ kernel_trigger_dispatch_now(gABDUCT);
+ }
+ break;
+
case gTELEPROTED1:
disable_player_commands_and_fade_init(gTELEPROTED2);
break;
+
case gTELEPROTED2:
- _G(walker).wilbur_teleported();
+
break;
- // TODO: Other cases
+ case 10027:
+ error("TODO: global_daemon 10027");
+ break;
+
+ case 10033:
+ player_set_commands_allowed(false);
+ _G(game).setRoom(701);
+ break;
default:
break;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index d8592e69750..80a093d957c 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -107,8 +107,8 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
bool result = false;
for (const BoonsvilleRec *rec = ARRAY; rec->_time; ++rec) {
- if ((*this)[BOONSVILLE_TIME2] > rec->_time &&
- rec->_time <= (*this)[BOONSVILLE_TIME]) {
+ if ((int32)(*this)[BOONSVILLE_TIME2] > rec->_time &&
+ rec->_time <= (int32)(*this)[BOONSVILLE_TIME]) {
result = true;
term_message("Time for: %s", rec->_text);
schedule_boonsville_time();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index b6eafc79f57..f4cc5ecb07a 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -47,31 +47,29 @@ enum global_triggers {
// System triggers
gRESUME_CONVERSATION = 10001, // Yep, that's what it does!
gSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
- gSERIES_PLAY_BREAK0 = 10003,
- gSERIES_PLAY_BREAK1 = 10004,
- gSERIES_PLAY_BREAK2 = 10005,
- gNONPLAYERS_SPEECH_FINISHED, // digi_play trigger, used in talk.cpp
- gSERIES_PLAY_BREAK_0, // Used only by set_next_play_break () in global.cpp
-/*
- gSERIES_PLAY_BREAK_1, // Used only by set_next_play_break () in global.cpp
- gSERIES_PLAY_BREAK_2, // Used only by set_next_play_break () in global.cpp
-*/
+ gSERIES_PLAY_BREAK_0 = 10003,
+ gSERIES_PLAY_BREAK_1 = 10004,
+ gSERIES_PLAY_BREAK_2 = 10005,
gRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
- // General triggers
- gREACT_TO_WHISTLE, // For anything that reacts to the wistle being blown
-
- // Wilbur specific triggers
- gCHANGE_WILBUR_ANIMATION,
+ gNONPLAYERS_SPEECH_FINISHED = 10011, // digi_play trigger, used in talk.cpp
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
gABDUCT = 10016,
+ gSET_FACING = 10018,
+ gSET_DEST = 10019,
+ gSET_COMMANDS_ALLOWED = 10020,
+ gUNPOOF = 10021,
gTELEPROTED1 = 10024,
gTELEPROTED2 = 10025,
- CALLED_EACH_LOOP = 32764,
+ CALLED_EACH_LOOP = 32764,
gLAST_GLOBAL_TRIGGER
+#if UNUSED
+ gREACT_TO_WHISTLE, // For anything that reacts to the wistle being blown
+ gCHANGE_WILBUR_ANIMATION,
+#endif
};
class Vars : public M4::Vars {
@@ -106,6 +104,11 @@ public:
int _roomVal2 = 0;
int _roomVal3 = 0;
int _walkTrigger = 0;
+ machine *_npcSpeech1 = nullptr;
+ machine *_npcSpeech2 = nullptr;
+ int _npcTrigger = -1;
+ int _player_facing_x = 0, _player_facing_y = 0;
+ int _player_dest_x = 0, _player_dest_y = 0;
public:
Vars();
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 6b788b728e4..7f63c0febb8 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -362,5 +362,14 @@ bool Walker::wilbur_parser(const char **list) {
return false;
}
+void Walker::wilbur_poof() {
+ error("TODO: Walker::wilbur_poof");
+}
+
+void Walker::wilbur_unpoof() {
+ series_unload(_wilburPoof);
+ _wilburPoof = -1;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 721bf7ddd10..de974203682 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -36,6 +36,7 @@ private:
int _vol = 0;
int32 _trigger = 0;
bool _flag = false;
+ int _wilburPoof = -1;
/**
* This is called when PLAYER walker code sends system message back to C (used by MAIN PLAYER WALKER ONLY)
@@ -99,6 +100,9 @@ public:
}
bool wilbur_parser(const char **list);
+
+ void wilbur_poof();
+ void wilbur_unpoof();
};
extern void enable_player();
Commit: 1e559f1bf00410e66be15cc9167c20a6e4df5ba3
https://github.com/scummvm/scummvm/commit/1e559f1bf00410e66be15cc9167c20a6e4df5ba3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes to opening barbershop door
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/core/play_break.cpp
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 927bba6cab4..77b30de8912 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -48,6 +48,7 @@ bool kernel_trigger_dispatch_now(int32 trigger_num) {
}
bool kernel_trigger_dispatch(int32 trigger) {
+#if 0
if (trigger == -1 || trigger == 65535 || _G(between_rooms))
return true;
@@ -56,6 +57,9 @@ bool kernel_trigger_dispatch(int32 trigger) {
error_show(FL, 'QOVF');
return true;
+#else
+ error("TODO: Probably meant to call dispatchx");
+#endif
}
void cisco_dispatch_triggers() {
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 1326936f8e6..393daf814b2 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -321,7 +321,7 @@ void BurgerEngine::global_daemon() {
_G(walker).wilbur_say();
break;
- case gABDUCT:
+ case gTELEPORT:
switch (_G(roomVal1)) {
case 10001:
ws_unhide_walker(_G(my_walker));
@@ -339,7 +339,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10013;
- series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gABDUCT, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gTELEPORT, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10004:
@@ -347,7 +347,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10012;
- series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10005:
@@ -355,7 +355,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10009;
- series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10006:
@@ -363,7 +363,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10001;
- series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gABDUCT, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gTELEPORT, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10007:
@@ -371,7 +371,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10014;
- series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10008:
@@ -379,17 +379,17 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10001;
- series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gABDUCT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
_G(roomVal1) = 10018;
- _G(walker).wilbur_speech("602w012x", gABDUCT);
+ _G(walker).wilbur_speech("602w012x", gTELEPORT);
break;
case 10010:
_G(roomVal1) = 10011;
- _G(walker).wilbur_speech("602w012y", gABDUCT);
+ _G(walker).wilbur_speech("602w012y", gTELEPORT);
break;
case 10011:
player_set_commands_allowed(true);
@@ -451,7 +451,7 @@ void BurgerEngine::global_daemon() {
case 10022:
if (_G(game).room_id < 200) {
_G(roomVal1) = 10017;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
} else {
error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
}
@@ -460,7 +460,7 @@ void BurgerEngine::global_daemon() {
case 10023:
if (_G(game).room_id < 700) {
_G(roomVal1) = 10018;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
}
break;
@@ -512,7 +512,7 @@ void BurgerEngine::global_parser() {
} else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(flags)[V123] = 1;
_G(roomVal1) = 10004;
- ws_turn_to_face(_G(my_walker), 3, gABDUCT);
+ ws_turn_to_face(_G(my_walker), 3, gTELEPORT);
goto done;
}
}
@@ -521,21 +521,21 @@ void BurgerEngine::global_parser() {
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10003;
- ws_turn_to_face(_G(my_walker), 7, gABDUCT);
+ ws_turn_to_face(_G(my_walker), 7, gTELEPORT);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10005;
- ws_turn_to_face(_G(my_walker), 9, gABDUCT);
+ ws_turn_to_face(_G(my_walker), 9, gTELEPORT);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10006;
- ws_turn_to_face(_G(my_walker), 9, gABDUCT);
+ ws_turn_to_face(_G(my_walker), 9, gTELEPORT);
goto done;
}
@@ -549,7 +549,7 @@ void BurgerEngine::global_parser() {
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10008;
- ws_turn_to_face(_G(my_walker), 5, gABDUCT);
+ ws_turn_to_face(_G(my_walker), 5, gTELEPORT);
goto done;
}
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index a044b8b5712..9fe4c64d15f 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -106,12 +106,16 @@ static void set_next_series_play_break(int32 slot) {
}
}
- if (player->current_break.firstFrame < 0) { // there were no more breaks, so unload series/sounds and send off trigger
+ if (player->current_break.firstFrame < 0) {
+ // There were no more breaks, so unload series/sounds and send off trigger
player->in_use = false;
series_unload(player->series);
- if (player->with_shadow) series_unload(player->shadow_series);
- if (player->preload_sounds) digi_unload_play_breaks(player->break_list);
- kernel_trigger_dispatch(player->trigger);
+ if (player->with_shadow)
+ series_unload(player->shadow_series);
+ if (player->preload_sounds)
+ digi_unload_play_breaks(player->break_list);
+
+ kernel_trigger_dispatchx(player->trigger);
}
}
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 294ea1530fd..ab67ff405f6 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -511,7 +511,6 @@ void InterfaceBox::draw(GrBuff *myBuffer) {
if (_must_redraw_all) {
ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
- kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
}
_must_redraw_all = false;
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 811db03285d..1bb2fd84b4f 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -334,13 +334,13 @@ void Interface::trackIcons() {
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
_G(roomVal1) = 10017;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
_G(roomVal1) = 10015;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index f10ccf30c44..432fc384624 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -96,7 +96,7 @@ static const seriesPlayBreak PLAY_BREAKS3[] = {
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
- { 10, -1, nullptr, 1, 255, gABDUCT, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 1, 255, gTELEPORT, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
@@ -160,27 +160,27 @@ void Room101::init() {
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 6;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
break;
case 104:
_G(roomVal1) = 2;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
break;
case 106:
_G(roomVal1) = 3;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
break;
case 135:
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
break;
case 142:
_G(roomVal1) = 5;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
break;
default:
@@ -431,7 +431,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
_G(roomVal1) = 18;
- series_play_("101ha01", 3840, 0, gABDUCT, 6, 0, 100, 0, 0, 14, -1);
+ series_play_("101ha01", 3840, 0, gTELEPORT, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
@@ -474,7 +474,7 @@ void Room101::daemon() {
Section1::updateWalker(226, 281, 8, 26);
break;
- case gABDUCT:
+ case gTELEPORT:
switch (_G(roomVal1)) {
case 2:
player_set_commands_allowed(true);
@@ -506,7 +506,7 @@ void Room101::daemon() {
case 6:
_G(roomVal1) = 7;
- series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gABDUCT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gTELEPORT, 3, 6, 100, 0, -53);
break;
case 7:
@@ -515,18 +515,20 @@ void Room101::daemon() {
break;
case 8:
+ // Barbershop door open
_G(roomVal1) = 9;
TerminateMachineAndNull(_doorMachine);
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gABDUCT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
break;
case 9:
+ // Fade out for switching to Barbershop
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1002);
break;
case 10:
_G(roomVal1) = 11;
- series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gABDUCT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gTELEPORT, 3, 6, 100, 0, -53);
break;
case 11:
@@ -538,17 +540,17 @@ void Room101::daemon() {
case 14:
TerminateMachineAndNull(_doorMachine);
_G(roomVal1) = 15;
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gABDUCT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
break;
case 15:
_G(roomVal1) = 16;
- digi_play("101h001", 1, 255, gABDUCT);
+ digi_play("101h001", 1, 255, gTELEPORT);
break;
case 16:
_G(roomVal1) = 17;
- series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gABDUCT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gTELEPORT, 3, 6, 100, 0, 0);
break;
case 17:
@@ -558,9 +560,9 @@ void Room101::daemon() {
if (_G(flags)[V005]) {
Common::String name = Common::String::format("101h003%c",
'a' + imath_ranged_rand(0, 5));
- digi_play(name.c_str(), 1, 255, gABDUCT);
+ digi_play(name.c_str(), 1, 255, gTELEPORT);
} else {
- digi_play("101h002", 1, 255, gABDUCT);
+ digi_play("101h002", 1, 255, gTELEPORT);
_G(flags)[V005] = 1;
}
@@ -579,7 +581,7 @@ void Room101::daemon() {
case 20:
_G(roomVal1) = 11;
- series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gABDUCT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gTELEPORT, 3, 6, 100, 0, -53);
break;
case 21:
@@ -647,26 +649,26 @@ void Room101::parser() {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 8;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
} else if (_G(flags)[V013]) {
ws_demand_location(_G(my_walker), 338, 265);
ws_demand_facing(_G(my_walker), 10);
ws_hide_walker(_G(my_walker));
player_set_commands_allowed(false);
_G(roomVal1) = 14;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
} else {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 8;
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
}
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
player_set_commands_allowed(false);
_G(roomVal1) = 20;
ws_hide_walker(_G(my_walker));
- kernel_trigger_dispatch_now(gABDUCT);
+ kernel_trigger_dispatch_now(gTELEPORT);
} else if (player_said("ENTER", "TOWN HALL") || player_said("gear", "town hall") ||
(lookFlag && player_said("town hall"))) {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index f4cc5ecb07a..cfddee24427 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -55,7 +55,7 @@ enum global_triggers {
gNONPLAYERS_SPEECH_FINISHED = 10011, // digi_play trigger, used in talk.cpp
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
- gABDUCT = 10016,
+ gTELEPORT = 10016,
gSET_FACING = 10018,
gSET_DEST = 10019,
gSET_COMMANDS_ALLOWED = 10020,
Commit: d1b26bfa99fdb4f32fb55e8b6005d19c833cc687
https://github.com/scummvm/scummvm/commit/d1b26bfa99fdb4f32fb55e8b6005d19c833cc687
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Hooked up console and added room command
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/console.cpp
engines/m4/console.h
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index efb34d4606e..8c97cdf56e8 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -1060,7 +1060,7 @@ void conv_unload(Conv *c) {
Common::strcpy_s(_G(player).verb, "");
Common::strcpy_s(_G(player).noun, "");
- kernel_trigger_dispatch(_GC(myFinalTrigger));
+ kernel_trigger_dispatchx(_GC(myFinalTrigger));
if (c) {
if (c->conv)
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 1caf0bf7b73..9ca37062a89 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -20,11 +20,13 @@
*/
#include "m4/console.h"
+#include "m4/vars.h"
namespace M4 {
Console::Console() : GUI::Debugger() {
registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+ registerCmd("room", WRAP_METHOD(Console, Cmd_room));
}
Console::~Console() {
@@ -35,4 +37,15 @@ bool Console::Cmd_test(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_room(int argc, const char **argv) {
+ if (argc == 2) {
+ _G(game).setRoom(atol(argv[1]));
+ return false;
+ } else {
+ debugPrintf("room <room number>]\n");
+ return true;
+ }
+}
+
+
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index 69bda1653ca..5350be7f457 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -30,6 +30,7 @@ namespace M4 {
class Console : public GUI::Debugger {
private:
bool Cmd_test(int argc, const char **argv);
+ bool Cmd_room(int argc, const char **argv);
public:
Console();
~Console() override;
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index ab017d3701b..87017000745 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -71,6 +71,9 @@ Common::Error M4Engine::run() {
Vars *vars = createVars();
if (vars->init()) {
+ // Set the console
+ setDebugger(new Console());
+
// Run game here
m4_inflight();
}
Commit: 82f8a10263fbd4205f1b4927a4d7c1728331fabe
https://github.com/scummvm/scummvm/commit/82f8a10263fbd4205f1b4927a4d7c1728331fabe
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixed some GCC errors and warnings
I'm still nowhere near being able to build the M4 engine, though.
Changed paths:
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 53220c6764a..8e21e422fd4 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -54,14 +54,14 @@ void ws_DumpMachine(machine *m, Common::WriteStream *logFile) {
return;
// Print out the machine name, hash, and physical address
- logFile->writeString(Common::String::format("Machine Name: %s\n\tHash: %ld\n\tAddress: 0x%08lx\n\n", m->machName, m->myHash, (int32)m));
+ logFile->writeString(Common::String::format("Machine Name: %s\n\tHash: %d\n\tAddress: %p\n\n", m->machName, m->myHash, (void *)m));
// If we have an anim8 for this machine
if (m->myAnim8) {
myAnim8 = m->myAnim8;
// Print out the anim8 hash, and physical address
- logFile->writeString(Common::String::format("Sequence Hash: %ld\n\tAddress: 0x%08lx\n\n", myAnim8->sequHash, (int32)myAnim8));
+ logFile->writeString(Common::String::format("Sequence Hash: %d\n\tAddress: %p\n\n", myAnim8->sequHash, (void *)myAnim8));
// And if this anim8 has registers
if (myAnim8->myRegs) {
@@ -71,14 +71,14 @@ void ws_DumpMachine(machine *m, Common::WriteStream *logFile) {
// Loop through the main set of registers, and dump out the contents
for (i = 0; i < IDX_COUNT; i++) {
tempFloat = (float)(myRegs[i] >> 16) + (float)((float)(myRegs[i] & 0xffff) / (float)65536);
- logFile->writeString(Common::String::format("\t%ld\t%s:\t\t%.2f\t\t0x%08lx\n", i, myRegLabels[i], tempFloat, myRegs[i]));
+ logFile->writeString(Common::String::format("\t%d\t%s:\t\t%.2f\t\t0x%08lx\n", i, myRegLabels[i], tempFloat, myRegs[i]));
}
// If the anim8 has extra local regs
if (myAnim8->numLocalVars > 0) {
for (i = IDX_COUNT; i < IDX_COUNT + myAnim8->numLocalVars; i++) {
tempFloat = (float)(myRegs[i] >> 16) + (float)((float)(myRegs[i] & 0xffff) / (float)65536);
- logFile->writeString(Common::String::format("\t%ld\tlocal.%ld:\t\t%.2f\t\t0x%08lx\n", i, i - IDX_COUNT, tempFloat, myRegs[i]));
+ logFile->writeString(Common::String::format("\t%d\tlocal.%d:\t\t%.2f\t\t0x%08lx\n", i, i - IDX_COUNT, tempFloat, myRegs[i]));
}
}
logFile->writeString(Common::String::format("\n"));
@@ -88,13 +88,13 @@ void ws_DumpMachine(machine *m, Common::WriteStream *logFile) {
if (myAnim8->myCCB) {
myCCB = myAnim8->myCCB;
- logFile->writeString(Common::String::format("Sprite Series Name: %s\tAddress:0x%08lx\tFlags0x%08lx\n", myCCB->seriesName, (uint32)myCCB, myCCB->flags));
- logFile->writeString(Common::String::format("\tCurrent Location: (%ld, %ld), (%ld, %ld)\n", myCCB->currLocation->x1, myCCB->currLocation->y1,
+ logFile->writeString(Common::String::format("Sprite Series Name: %s\tAddress:%p\tFlags0x%08x\n", myCCB->seriesName, (void *)myCCB, myCCB->flags));
+ logFile->writeString(Common::String::format("\tCurrent Location: (%d, %d), (%d, %d)\n", myCCB->currLocation->x1, myCCB->currLocation->y1,
myCCB->currLocation->x2, myCCB->currLocation->y2));
- logFile->writeString(Common::String::format("\tNew Location: (%ld, %ld), (%ld, %ld)\n", myCCB->newLocation->x1, myCCB->newLocation->y1,
+ logFile->writeString(Common::String::format("\tNew Location: (%d, %d), (%d, %d)\n", myCCB->newLocation->x1, myCCB->newLocation->y1,
myCCB->newLocation->x2, myCCB->newLocation->y2));
- logFile->writeString(Common::String::format("\tscale: %ld\n", myCCB->scaleX));
- logFile->writeString(Common::String::format("\tlayer: %ld\n", myCCB->layer));
+ logFile->writeString(Common::String::format("\tscale: %d\n", myCCB->scaleX));
+ logFile->writeString(Common::String::format("\tlayer: %d\n", myCCB->layer));
}
}
}
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index aa5f508e28a..38e3896cc6c 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1576,7 +1576,8 @@ static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
if (byteSwap) {
tempPtr = (uint32 *)&myColors[0];
for (i = 0; i < numColors; i++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
}
@@ -1669,7 +1670,8 @@ static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
if (celsType == CELS_SS__) {
tempPtr = &((*data)[2]);
for (i = 0; i < (uint)(SS_HEAD_SIZE + numCels - 2); i++) {
- *tempPtr++ = SWAP_INT32(*tempPtr);
+ *tempPtr = SWAP_INT32(*tempPtr);
+ tempPtr++;
}
}
Commit: d503f712ed7668dddab09978593da354e2c211ed
https://github.com/scummvm/scummvm/commit/d503f712ed7668dddab09978593da354e2c211ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes closing game menu
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/gui/game_menu.h
engines/m4/graphics/gr_sprite.cpp
engines/m4/graphics/gr_surface.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/wscript/ws_hal.cpp
engines/m4/wscript/ws_hal.h
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 80a093d957c..d12cf92d3ef 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -116,6 +116,7 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
}
}
+ _G(kernel).trigger_mode = oldMode;
return result;
}
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index ba15c17b1ed..9a57e3df675 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -164,7 +164,7 @@ extern void CreateGameMenuFromMain(RGB8 *myPalette);
//
// gamemenu module defines
//
-#define MEMORY_NEEDED 478000 // bytes needed for menus to work
+#define MEMORY_NEEDED 0 // bytes needed for menus to work
#define MENU_DEPTH 9 // video depth for menu popup boxes
#define MAX_SLOTS 99 // number of save games you can have
#define MAX_SLOTS_SHOWN 8 // number of slots in the scrolling field
@@ -481,7 +481,7 @@ struct MenuGlobals {
int32 menuSeriesOffset;
int32 menuSeriesPalOffset;
- Font *menuFont;
+ Font *menuFont = nullptr;
// menu sprites array (used to hold all the sprites for the current menu, spriteCount is set tot he number of sprites in the series)
int32 spriteCount = 0;
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 9240560304a..8fa99b5ba0d 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/textconsole.h"
#include "m4/graphics/gr_sprite.h"
#include "m4/graphics/gr_surface.h"
#include "m4/core/errors.h"
@@ -160,7 +161,8 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source = afterScaled;
}
- assert((drawReq->Src->encoding & SHADOW) == 0);
+ if ((drawReq->Src->encoding & SHADOW) != 0)
+ warning("TODO: shadowed sprites drawing");
M4Surface dst(*drawReq->Dest);
dst.draw(source, drawReq->x, drawReq->y, drawReq->scaleX > 0,
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 7ea72f36702..261c41e7bc3 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -103,7 +103,7 @@ void M4Surface::rleDraw(const byte *src, int x, int y) {
void M4Surface::draw(const Buffer &src, int x, int y, bool forwards,
const byte *depthCodes, int srcDepth) {
- if (src.encoding == RLE8) {
+ if ((src.encoding & 0x7f) == RLE8) {
// The standard case of RLE sprite drawing onto screen can directly
// use RLE decompression for performance
if (forwards && !depthCodes && !depthCodes && x >= 0 && y >= 0 &&
@@ -124,7 +124,7 @@ void M4Surface::draw(const Buffer &src, int x, int y, bool forwards,
void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
int x, int y, bool forwards, int srcDepth) {
- assert(src.encoding == NO_COMPRESS);
+ assert((src.encoding & 0x7f) == NO_COMPRESS);
for (int srcY = 0; srcY < src.h; ++srcY, ++y) {
if (y >= h)
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 32f0f5fcd64..b2fc6a2fd20 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -269,8 +269,8 @@ void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
memcpy(pal, _GP(picPal), sizeof(RGB8) * 256);
- ws_RefreshWoodscriptBuffer(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]), _G(screenCodeBuff),
- (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr());
+ ws_RefreshWoodscriptBuffer(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
+ _G(screenCodeBuff)->get_buffer(), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr());
_G(game_bgBuff)->release();
_G(inverse_pal)->release();
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 8e21e422fd4..247f37095b9 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -378,8 +378,83 @@ void ws_DoDisplay(Buffer *background, int16 *depth_table, Buffer *screenCodeBuff
vmng_DisposeRectList(&drawRectList);
}
-void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT) {
- error("TODO: ws_hal_RefreshWoodscriptBuffer");
+void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background,
+ int16 *depth_table, Buffer *screenCodes, uint8 *myPalette, uint8 *ICT) {
+ Anim8 *myAnim8;
+ CCB *myCCB;
+ uint8 myDepth;
+ Buffer drawSpriteBuff;
+ DrawRequest spriteDrawReq;
+
+ if ((!background) || (!background->data))
+ return;
+
+ term_message("Refresh");
+
+ // Restore the background
+ Buffer *halScrnBuf = _G(gameDrawBuff)->get_buffer();
+ gr_buffer_rect_copy(background, halScrnBuf, 0, 0, halScrnBuf->w, halScrnBuf->h);
+
+ // Now draw all the sprites that are not hidden
+ myAnim8 = myCruncher->backLayerAnim8;
+
+ while (myAnim8) {
+ myCCB = myAnim8->myCCB;
+ if (myCCB && (myCCB->source != nullptr) && (!(myCCB->flags & CCB_SKIP)) && (!(myCCB->flags & CCB_HIDE))) {
+ if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ // Make sure the series is still in memory
+ if ((!myCCB->source->sourceHandle) || (!*(myCCB->source->sourceHandle))) {
+ ws_LogErrorMsg(FL, "Sprite series is no longer in memory.");
+ ws_Error(myAnim8->myMachine, ERR_INTERNAL, 0x02ff,
+ "Error discovered during ws_hal_RefreshWoodscriptBuffer()");
+ }
+
+ // Lock the sprite handle
+ HLock(myCCB->source->sourceHandle);
+ myCCB->source->data = (uint8 *)((intptr)*(myCCB->source->sourceHandle) +
+ myCCB->source->sourceOffset);
+ }
+
+ // Prepare a sprite for drawing, as in ws_DoDisplay
+ drawSpriteBuff.w = myCCB->source->w;
+ drawSpriteBuff.h = myCCB->source->h;
+ drawSpriteBuff.stride = myCCB->source->w;
+
+ if (!myPalette || !ICT)
+ drawSpriteBuff.encoding = (uint8)(myCCB->source->encoding & 0x7f);
+ else
+ drawSpriteBuff.encoding = (uint8)myCCB->source->encoding;
+ drawSpriteBuff.data = myCCB->source->data;
+
+ if (!depth_table || !screenCodes || !screenCodes->data)
+ myDepth = 0;
+ else
+ myDepth = (uint8)(myCCB->layer >> 8);
+
+ spriteDrawReq.Src = (Buffer *)&drawSpriteBuff;
+ spriteDrawReq.Dest = halScrnBuf;
+ spriteDrawReq.x = myCCB->currLocation->x1;
+ spriteDrawReq.y = myCCB->currLocation->y1;
+ spriteDrawReq.scaleX = myCCB->scaleX;
+ spriteDrawReq.scaleY = myCCB->scaleY;
+ spriteDrawReq.srcDepth = myDepth;
+ spriteDrawReq.depthCode = screenCodes->data;
+ spriteDrawReq.Pal = myPalette;
+ spriteDrawReq.ICT = ICT;
+
+ gr_sprite_draw(&spriteDrawReq);
+ myCCB->flags &= ~CCB_REDRAW;
+
+ if (!(myCCB->flags & CCB_DISC_STREAM)) {
+ // Unlock the handle
+ HUnLock(myCCB->source->sourceHandle);
+ }
+ }
+
+ myAnim8 = myAnim8->infront;
+ }
+
+ _G(gameDrawBuff)->release();
}
void GetBezCoeffs(frac16 *ctrlPoints, frac16 *coeffs) {
diff --git a/engines/m4/wscript/ws_hal.h b/engines/m4/wscript/ws_hal.h
index 9ce0eb097b3..b7f56561e0f 100644
--- a/engines/m4/wscript/ws_hal.h
+++ b/engines/m4/wscript/ws_hal.h
@@ -49,7 +49,8 @@ extern void ws_KillHAL();
extern void ws_DoDisplay(Buffer *background, int16 *depth_table, Buffer *screenCodeBuff,
uint8 *myPalette, uint8 *ICT, bool updateVideo);
-extern void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
+extern void ws_hal_RefreshWoodscriptBuffer(cruncher *myCruncher, Buffer *background,
+ int16 *depth_table, Buffer *screenCodes, uint8 *myPalette, uint8 *ICT);
extern void GetBezCoeffs(frac16 *ctrlPoints, frac16 *coeffs);
extern void GetBezPoint(frac16 *x, frac16 *y, frac16 *coeffs, frac16 tVal);
extern bool InitCCB(CCB *myCCB);
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index f7d6069722a..1ff2b3d5260 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -675,7 +675,8 @@ void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCod
}
}
-void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT) {
+void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table,
+ Buffer *screenCodes, uint8 *myPalette, uint8 *ICT) {
ws_hal_RefreshWoodscriptBuffer(_GWS(myCruncher), cleanBackground, depth_table,
screenCodes, myPalette, ICT);
}
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 4d3481be8b1..16b9b20b6ab 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -179,7 +179,8 @@ extern void AddPauseTime(int32 myTime);
void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
uint8 *myPalette, uint8 *ICT, bool updateVideo);
-void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table, GrBuff *screenCodes, uint8 *myPalette, uint8 *ICT);
+void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table,
+ Buffer *screenCodes, uint8 *myPalette, uint8 *ICT);
void TerminateMachine(machine *m);
void TerminateMachinesByHash(uint32 machHash);
Commit: 988b2db33add2aec4706f1757f04a154501d0983
https://github.com/scummvm/scummvm/commit/988b2db33add2aec4706f1757f04a154501d0983
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix quitting game via game menu
Changed paths:
engines/m4/vars.cpp
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 115c45852ca..e017f57e9eb 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -48,8 +48,8 @@ Vars::Vars() : _digi(g_engine->_mixer) {
Vars::~Vars() {
game_systems_shutdown();
- sysfile_shutdown();
- f_stream_Shutdown();
+ woodscript_shutdown();
+ dbg_ws_shutdown();
player_been_shutdown();
gui_system_shutdown();
gui_buffer_system_shutdown();
@@ -57,8 +57,8 @@ Vars::~Vars() {
gui_mouse_shutdown();
mem_stash_shutdown();
param_shutdown();
- woodscript_shutdown();
- dbg_ws_shutdown();
+ sysfile_shutdown();
+ f_stream_Shutdown();
g_vars = nullptr;
}
Commit: 11d155d7bac029ffcb3b103dfac86d51c898e5e9
https://github.com/scummvm/scummvm/commit/11d155d7bac029ffcb3b103dfac86d51c898e5e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change %ld in string formats to %d
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/adv_scale.cpp
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/core/rooms.cpp
engines/m4/fileio/fstream.cpp
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_sprite.cpp
engines/m4/vars.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 56388ac4c24..fd6b8c57aac 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -104,7 +104,7 @@ bool kernel_load_room(int minPalEntry, int maxPalEntry, SceneDef *rdef, GrBuff *
// Read DEF file
if (db_def_chk_read(_G(game).new_room, rdef) != -1) {
- error_show(FL, 'DF:(', "trying to find %ld.CHK", (uint32)_G(game).new_room);
+ error_show(FL, 'DF:(', "trying to find %d.CHK", (uint32)_G(game).new_room);
return false;
}
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index e7ee9b377a0..d9c7fbedc81 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -77,7 +77,7 @@ bool inv_init(int32 num_objects) {
for (i = 0; i < num_objects; i++) {
_G(inventory)->_objects[i] = (InvObj *)mem_get_from_stash(_G(inv_obj_mem_type), "obj");
if (!_G(inventory)->_objects[i])
- error_show(FL, 'OOM!', "%ld bytes", (int32)sizeof(InvObj));
+ error_show(FL, 'OOM!', "%d bytes", (int32)sizeof(InvObj));
}
_G(inventory)->_tail = 0;
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index 095da486a56..b362f103b56 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -131,7 +131,7 @@ noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32
// Create new noWalkRect structure
if ((newRect = (noWalkRect *)mem_alloc(sizeof(noWalkRect), "intr noWalkRect")) == NULL) {
- error_show(FL, 'IADN', "rect size: %ld %ld %ld %ld", x1, y1, x2, y2);
+ error_show(FL, 'IADN', "rect size: %d %d %d %d", x1, y1, x2, y2);
return NULL;
}
@@ -143,7 +143,7 @@ noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32
// Add the alternate walkto node - this node must exist
if ((newRect->alternateWalkToNode = AddRailNode(altX, altY, walkCodes, false)) < 0) {
- error_show(FL, 'IADN', "could not add node. coord: %ld %ld", altX, altY);
+ error_show(FL, 'IADN', "could not add node. coord: %d %d", altX, altY);
}
// Now add the corner nodes. Not as important if these don't exist
diff --git a/engines/m4/adv_r/adv_scale.cpp b/engines/m4/adv_r/adv_scale.cpp
index acaf33b7891..ac85716d6ff 100644
--- a/engines/m4/adv_r/adv_scale.cpp
+++ b/engines/m4/adv_r/adv_scale.cpp
@@ -103,12 +103,12 @@ void scale_editor_draw() {
gr_font_set_color(__WHITE);
gr_font_set(_G(font_tiny));
- Common::sprintf_s(string, "Front: %ld, %ld", _GS(old_front), _G(currentSceneDef).front_scale);
+ Common::sprintf_s(string, "Front: %d, %d", _GS(old_front), _G(currentSceneDef).front_scale);
int x;
for (x = 10; x < scr_orig->w - 220; x += 400)
gr_font_write(game_buff, string, x, _GS(old_front) - LABEL_OFFSET, 0, 0);
- Common::sprintf_s(string, "Back: %ld, %ld", _GS(old_back), _G(currentSceneDef).back_scale);
+ Common::sprintf_s(string, "Back: %d, %d", _GS(old_back), _G(currentSceneDef).back_scale);
for (x = 110; x < scr_orig->w - 320; x += 400)
gr_font_write(game_buff, string, x, _GS(old_back) - LABEL_OFFSET, 0, 0);
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index 77b30de8912..c4848e2ece5 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -35,7 +35,7 @@ int32 kernel_trigger_create(int32 trigger_num) {
return (trigger_num);
if (trigger_num > 0xffff) { // If room changed, this is an invalid trigger
- error_show(FL, 'BADT', "bad trigger. %ld > 0xffff", trigger_num);
+ error_show(FL, 'BADT', "bad trigger. %d > 0xffff", trigger_num);
}
new_trigger = trigger_num + (_G(game).room_id << 16) + (_G(kernel).trigger_mode << 28);
@@ -86,7 +86,7 @@ bool kernel_trigger_dispatchx(int32 trigger_num) {
return false;
if (((trigger_num >> 16) & 0xfff) != _G(game).room_id) { // if room changed, this is an invalid trigger
- term_message("orphan scene trigger:mode: %ld, scene: %ld, trigger: %ld",
+ term_message("orphan scene trigger:mode: %d, scene: %d, trigger: %d",
trigger_num >> 28, (trigger_num >> 16) & 0xffff, trigger_num & 0xffff);
return false;
}
@@ -122,7 +122,7 @@ bool kernel_trigger_dispatchx(int32 trigger_num) {
break;
default:
- term_message("orphan mode trigger: mode: %ld, scene: %ld, trigger: %ld",
+ term_message("orphan mode trigger: mode: %d, scene: %d, trigger: %d",
trigger_num >> 28, (trigger_num >> 16) & 0xffff, trigger_num & 0xffff);
result = false;
break;
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 256ed910527..0ee5e6c7783 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -127,10 +127,10 @@ void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int3
if (_G(screenCodeBuff))
walkerCodes = _G(screenCodeBuff)->get_buffer();
if ((currNodeID = AddRailNode(currX, currY, walkerCodes, true)) < 0) {
- error_show(FL, 'WCAN', "Walker's curr posn: %ld %ld", currX, currY);
+ error_show(FL, 'WCAN', "Walker's curr posn: %d %d", currX, currY);
}
if ((destNodeID = AddRailNode(x, y, walkerCodes, true)) < 0) {
- error_show(FL, 'WCAN', "Trying to walk to: %ld %ld", x, y);
+ error_show(FL, 'WCAN', "Trying to walk to: %d %d", x, y);
}
// Dispose of the current path myWalker is following
@@ -198,10 +198,10 @@ bool adv_walker_path_exists(machine *myWalker, int32 x, int32 y) {
walkerCodes = _G(screenCodeBuff)->get_buffer();
}
if ((currNodeID = AddRailNode(currX, currY, walkerCodes, true)) < 0) {
- error_show(FL, 'WCAN', "Walker's curr posn: %ld %ld", currX, currY);
+ error_show(FL, 'WCAN', "Walker's curr posn: %d %d", currX, currY);
}
if ((destNodeID = AddRailNode(x, y, walkerCodes, true)) < 0) {
- error_show(FL, 'WCAN', "Trying to walk to: %ld %ld", x, y);
+ error_show(FL, 'WCAN', "Trying to walk to: %d %d", x, y);
}
// Dispose of the current path myWalker is following
@@ -307,7 +307,7 @@ void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger) {
int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
if (!myWalker || !myWalker->myAnim8) {
- error_show(FL, 'W:-(', "demand facing: %ld", facing);
+ error_show(FL, 'W:-(', "demand facing: %d", facing);
return;
}
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index fa1b64ec3ee..552eb3466ca 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -2790,7 +2790,7 @@ void cb_Options_Digi(void *theItem, void *theMenu) {
mySlider = (menuItemHSlider *)myItem->itemInfo;
// Set the digi volume
digi_set_overall_volume(mySlider->percent);
- term_message("digi volume: %ld", mySlider->percent);
+ term_message("digi volume: %d", mySlider->percent);
// this scroller control has been moved, so make sure that the DONE button is not greyed out
menu_EnableButton(nullptr, OM_TAG_DONE, myMenu);
@@ -2805,7 +2805,7 @@ void cb_Options_Digestability(void *theItem, void *theMenu) {
mySlider = (menuItemHSlider *)myItem->itemInfo;
// Set the midi volume
- term_message("digestability: %ld", mySlider->percent);
+ term_message("digestability: %d", mySlider->percent);
_G(flags)[digestability] = mySlider->percent;
// this scroller control has been moved, so make sure that the DONE button is not greyed out
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index ab67ff405f6..beb64187f0e 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -490,7 +490,7 @@ ControlStatus InterfaceBox::track(int32 eventType, int16 x, int16 y) {
for (int iter = 0; iter < _index; iter++) {
if (_button[iter]->track(eventType, x, y) == SELECTED) {
_highlight_index = _button[iter]->get_tag();
- term_message("selected button: %ld", iter);
+ term_message("selected button: %d", iter);
result = SELECTED;
break;
}
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index d8afecd49ec..6b9efc93b0c 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -200,7 +200,7 @@ void Section1::daemon() {
break;
case 10007:
if (_G(flags)[V012] == 2) {
- term_message(" Harry watches tv at: %ld", _G(flags)[GLB_TEMP_3]);
+ term_message(" Harry watches tv at: %d", _G(flags)[GLB_TEMP_3]);
if (_G(flags).get_boonsville_time_and_display() == (int32)_G(flags)[GLB_TEMP_3]) {
if (_G(game).room_id == 102) {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 611db86e7e7..a936ecfcbd3 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -280,7 +280,7 @@ void Sections::game_control_cycle() {
parse_player_command_now();
term_message("parsed0");
} else {
- term_message("player: walk to (%ld, %ld), facing: %ld",
+ term_message("player: walk to (%d, %d), facing: %d",
_G(player).walk_x, _G(player).walk_y, _G(player).walk_facing);
if (_G(player).walk_x < 0 || _G(player).walk_y < 0) {
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 36cefac85d8..1467c7ad2eb 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -84,12 +84,12 @@ strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuff
}
if (strmMinBuffSize < 0) {
- error_show(FL, 'FSF1', "neg min buffsize: %ld", strmMinBuffSize);
+ error_show(FL, 'FSF1', "neg min buffsize: %d", strmMinBuffSize);
}
// Allocate a new stream request struct
if ((newStream = (strmRequest *)mem_alloc(sizeof(strmRequest), STR_STRMREQ)) == nullptr) {
- error_show(FL, 'OOM!', "%ld", sizeof(strmRequest));
+ error_show(FL, 'OOM!', "%d", sizeof(strmRequest));
return nullptr;
}
@@ -137,7 +137,7 @@ strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuff
}
// sorry, bud.
- error_show(FL, 'FSOM', "want: %ld, have: %ld", strmMinBuffSize, memAvail);
+ error_show(FL, 'FSOM', "want: %d, have: %d", strmMinBuffSize, memAvail);
got_mem:
//lock the buffer - to be locked until the stream is closed
@@ -247,7 +247,7 @@ static bool UnwrapStream(strmRequest *myStream) {
bytesToMove = (byte *)myStream->strmHead - (byte *)myStream->strmBuff;
if ((tempBuff = (uint8 *)mem_alloc(bytesToMove, "stream temp buff")) == nullptr)
- error_show(FL, 'OOM!', "UnwrapStream() failed - temp buff avail: %ld", bytesToMove);
+ error_show(FL, 'OOM!', "UnwrapStream() failed - temp buff avail: %d", bytesToMove);
memcpy(tempBuff, myStream->strmBuff, bytesToMove);
}
@@ -292,7 +292,7 @@ int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes) {
error_show(FL, 'FSIS', "f_stream_Read() failed - invalid stream request");
if ((numBytes <= 0) || (numBytes >= myStream->strmSize))
- error_show(FL, 'FSR!', "%ld stream size %ld", numBytes, myStream->strmSize);
+ error_show(FL, 'FSR!', "%d stream size %d", numBytes, myStream->strmSize);
// If the stream tail is > the stream head, and the number of bytes at the end of the buffer is < numBytes
// we must unwrap the stream, moving the data at the end of the buffer to the beginning, and slide the beginning down
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 0a8f2681546..f57fad26620 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -67,14 +67,14 @@ void GrBuff::release() {
void GrBuff::alloc_pixmap() {
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap) {
- term_message("GrBuff::alloc_pixmap(): Trying to free up %ld bytes", pitch * height);
+ term_message("GrBuff::alloc_pixmap(): Trying to free up %d bytes", pitch * height);
if (MakeMem(pitch * height, "pixmap"))
{
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap)
- error_show(FL, 15, "pixmap h:%ld w:%ld bytes:%ld", height, pitch, pitch * height);
+ error_show(FL, 15, "pixmap h:%d w:%d bytes:%d", height, pitch, pitch * height);
} else
- error_show(FL, 1, "GrBuff::alloc_pixmap() x, y: %ld %ld", pitch, height);
+ error_show(FL, 1, "GrBuff::alloc_pixmap() x, y: %d %d", pitch, height);
}
HLock(pixmap);
memset(*pixmap, __BLACK, pitch * height);
@@ -125,7 +125,7 @@ int32 gr_buffer_free(Buffer *buf) {
byte *gr_buffer_pointer(Buffer *buf, int32 x, int32 y) {
if (!buf || !buf->data || y < 0 || x < 0) {
- error_show(FL, 'BUF!', "buffer_pointer x,y = %ld,%ld", x, y);
+ error_show(FL, 'BUF!', "buffer_pointer x,y = %d,%d", x, y);
return 0;
}
@@ -134,7 +134,7 @@ byte *gr_buffer_pointer(Buffer *buf, int32 x, int32 y) {
const byte *gr_buffer_pointer(const Buffer *buf, int32 x, int32 y) {
if (!buf || !buf->data || y < 0 || x < 0) {
- error_show(FL, 'BUF!', "buffer_pointer x,y = %ld,%ld", x, y);
+ error_show(FL, 'BUF!', "buffer_pointer x,y = %d,%d", x, y);
return 0;
}
@@ -151,7 +151,7 @@ int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
buf->data = (uint8 *)mem_alloc(buf->stride * h, name);
if (buf->data == NULL)
- error_show(FL, 'OOM!', "buffer: %s - w:%ld h:%ld bytes:%ld", name, buf->stride, h, buf->stride * h);
+ error_show(FL, 'OOM!', "buffer: %s - w:%d h:%d bytes:%d", name, buf->stride, h, buf->stride * h);
memset(buf->data, 0, buf->stride * h);
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index fc214c8888f..32f3c63b131 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -58,7 +58,7 @@ bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x
srcSpritePtr = &srcSprite;
if ((srcSpritePtr = GetWSAssetSprite(nullptr, (uint32)spriteHash, (uint32)index, srcSpritePtr, nullptr)) == nullptr)
- error_show(FL, 'SPNF', "hash: %ld, index: %ld", spriteHash, index);
+ error_show(FL, 'SPNF', "hash: %d, index: %d", spriteHash, index);
HLock(srcSpritePtr->sourceHandle);
//gr_pal_interface(&master_palette[0]);
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 8fa99b5ba0d..81271a7aa76 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -39,7 +39,7 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
uint8 *pScaled, *pData = S->data;
if (!D || !S)
- error_show(FL, 'BUF!', "scale sprite h:%ld w:%ld sx:%uld sy:%uld", D->h, D->w, ScaleX, ScaleY);
+ error_show(FL, 'BUF!', "scale sprite h:%d w:%d sx:%uld sy:%uld", D->h, D->w, ScaleX, ScaleY);
/* calculate new x size */
D->w = S->w * ScaleX / 100;
@@ -138,7 +138,7 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
// If it's scaled we decode it first
if (Rle) {
if (!(scaledBuff = (uint8 *)mem_alloc(source.stride * source.h, "scaled buffer")))
- error_show(FL, 'OOM!', "no mem: buffer w:%ld, h:%ld", source.w, source.h);
+ error_show(FL, 'OOM!', "no mem: buffer w:%d, h:%d", source.w, source.h);
RLE8Decode(source.data, scaledBuff, source.stride);
source.data = scaledBuff;
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index e017f57e9eb..0237237f231 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -111,7 +111,7 @@ void Vars::game_systems_initialize(byte flags) {
debugC(kDebugCore, _G(kernel).suppress_cache ?
"Cache System Disabled" : "Cache System Enabled");
- debugC(kDebugCore, "Available memory: %ld", totalMem);
+ debugC(kDebugCore, "Available memory: %d", totalMem);
mem_stash_init(32);
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 0912264673d..1661f67fc78 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -135,7 +135,7 @@ bool ws_InitCruncher(void) {
error_show(FL, 'WSCE');
if ((_GWS(myCruncher) = (cruncher *)mem_alloc(sizeof(cruncher), "cruncher")) == nullptr)
- error_show(FL, 'OOM!', "%ld bytes.", sizeof(cruncher));
+ error_show(FL, 'OOM!', "%d bytes.", sizeof(cruncher));
_GWS(myCruncher)->backLayerAnim8 = nullptr;
_GWS(myCruncher)->frontLayerAnim8 = nullptr;
@@ -145,7 +145,7 @@ bool ws_InitCruncher(void) {
// Set up stack
_GWS(stackSize) = 2048;
if ((_GWS(stackBase) = (uint32 *)mem_alloc(_GWS(stackSize), "crunchstack")) == nullptr) {
- error_show(FL, 'OOM!', "%ld bytes.", _GWS(stackSize));
+ error_show(FL, 'OOM!', "%d bytes.", _GWS(stackSize));
}
_GWS(stackTop) = _GWS(stackBase);
_GWS(stackLimit) = (uint32 *)((byte *)_GWS(stackBase) + (uint32)_GWS(stackSize));
@@ -188,7 +188,7 @@ Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash) {
// Allocate an anim8 structure
if ((myAnim8 = (Anim8 *)mem_alloc(sizeof(Anim8), "Anim8")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(Anim8));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(Anim8));
return nullptr;
}
@@ -199,7 +199,7 @@ Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash) {
// Allocate an array of registers
if ((myRegs = (frac16 *)mem_alloc(sizeof(frac16) * (IDX_COUNT + numLocalVars), "Anim8 regs")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(frac16) * (IDX_COUNT + numLocalVars));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(frac16) * (IDX_COUNT + numLocalVars));
return nullptr;
}
@@ -418,7 +418,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
if (!parentAnim8) {
ws_LogErrorMsg(FL, "Trying to access a parent register - no parent exists");
} else {
- ws_LogErrorMsg(FL, "Parent Reg Index out of range - max: %ld, requested %ld.",
+ ws_LogErrorMsg(FL, "Parent Reg Index out of range - max: %d, requested %d.",
IDX_COUNT + parentAnim8->numLocalVars, myIndex);
}
return false;
@@ -429,7 +429,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
case LOCAL_FMT_REG:
// Range check to make sure we don't index off into hyperspace
if ((myIndex >= IDX_COUNT + myAnim8->numLocalVars)) {
- ws_LogErrorMsg(FL, "Register Index out of range - max: %ld, requested %ld.",
+ ws_LogErrorMsg(FL, "Register Index out of range - max: %d, requested %d.",
IDX_COUNT + myAnim8->numLocalVars, myIndex);
return false;
}
@@ -925,7 +925,7 @@ static void op_SETCEL(Anim8 *myAnim8) {
if (!myAnim8->myCCB) {
// Allocate and initialize a CCB structure
if ((myAnim8->myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes.", sizeof(CCB));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d bytes.", sizeof(CCB));
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02fe, "setcel() failed.");
}
if (!InitCCB(myAnim8->myCCB)) {
@@ -1038,7 +1038,7 @@ static void op_JSR(Anim8 *myAnim8) {
int32 dummy;
if (myAnim8->returnStackIndex >= JSR_STACK_MAX) {
- ws_LogErrorMsg(FL, "Max number of nested jsr instructions is: %ld", JSR_STACK_MAX);
+ ws_LogErrorMsg(FL, "Max number of nested jsr instructions is: %d", JSR_STACK_MAX);
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0256, "jsr() failed");
}
myAnim8->returnHashes[myAnim8->returnStackIndex] = myAnim8->sequHash;
@@ -1235,7 +1235,7 @@ static void op_OPEN_STREAM_SS(Anim8 *myAnim8) {
if (!myAnim8->myCCB) {
// Allocate and initialize a CCB structure
if ((myAnim8->myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(CCB));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(CCB));
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x02fe, "open_ss_stream() failed.");
}
if (!InitCCB(myAnim8->myCCB)) {
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 38e3896cc6c..46ba9f3e901 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -305,7 +305,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
case CHUNK_MACH:
// Check the validity of the machine hash number, and clear it
if (*chunkHash > MAX_ASSET_HASH) {
- error_show(FL, 'WSLA', "Asset Name: %s, MACH hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLA', "Asset Name: %s, MACH hash was: %d", wsAssetName, *chunkHash);
}
ClearWSAssets(_WS_ASSET_MACH, *chunkHash, *chunkHash);
@@ -316,7 +316,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
- error_show(FL, 'WSLE', "Asset Name: %s, MACH hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLE', "Asset Name: %s, MACH hash was: %d", wsAssetName, *chunkHash);
}
// Byteswap the entire machine if necessary
@@ -344,7 +344,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
case CHUNK_SEQU:
// Check the validity of the sequence hash number, and clear it
if (*chunkHash > MAX_ASSET_HASH) {
- error_show(FL, 'WSLA', "Asset Name: %s, SEQU hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLA', "Asset Name: %s, SEQU hash was: %d", wsAssetName, *chunkHash);
}
ClearWSAssets(_WS_ASSET_SEQU, *chunkHash, *chunkHash);
@@ -355,7 +355,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
- error_show(FL, 'WSLE', "Asset Name: %s, SEQU hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLE', "Asset Name: %s, SEQU hash was: %d", wsAssetName, *chunkHash);
}
// Byteswap the entire sequence if necessary
@@ -383,7 +383,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
case CHUNK_DATA:
// Check the validity of the data block hash number, and clear it
if (*chunkHash > MAX_ASSET_HASH) {
- error_show(FL, 'WSLA', "Asset Name: %s, DATA hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLA', "Asset Name: %s, DATA hash was: %d", wsAssetName, *chunkHash);
}
ClearWSAssets(_WS_ASSET_DATA, *chunkHash, *chunkHash);
@@ -394,7 +394,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
- error_show(FL, 'WSLE', "Asset Name: %s, DATA hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLE', "Asset Name: %s, DATA hash was: %d", wsAssetName, *chunkHash);
}
// Byteswap the entire data block if necessary
@@ -421,7 +421,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
case CHUNK_CELS:
// Check the validity of the cels hash number, and clear it
if (*chunkHash > MAX_ASSET_HASH) {
- error_show(FL, 'WSLA', "Asset Name: %s, CELS hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLA', "Asset Name: %s, CELS hash was: %d", wsAssetName, *chunkHash);
}
ClearWSAssets(_WS_ASSET_CELS, *chunkHash, *chunkHash);
@@ -430,7 +430,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Process the SS from the stream file
if (ProcessCELS(wsAssetName, &parseAssetPtr, mainAssetPtr, endOfAssetBlock, &celsPtr, &palPtr, myPalette) < 0) {
- error_show(FL, 'WSLP', "Asset Name: %s, CELS hash was: %ld", wsAssetName, *chunkHash);
+ error_show(FL, 'WSLP', "Asset Name: %s, CELS hash was: %d", wsAssetName, *chunkHash);
}
// At this point, celsPtr points to the beginning of the cels data, palPtr to the pal data
@@ -449,7 +449,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
break;
default:
- error_show(FL, 'WSLT', "Asset Name: %s, %ld bytes into the file.", wsAssetName,
+ error_show(FL, 'WSLT', "Asset Name: %s, %d bytes into the file.", wsAssetName,
(int32)parseAssetPtr - 12 - (int32)mainAssetPtr);
break;
}
@@ -478,7 +478,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
if (!mySprite) {
mySprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "Sprite");
if (!mySprite) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(M4sprite));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(M4sprite));
return nullptr;
}
}
@@ -490,7 +490,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
if (index >= (int)numCels) {
- ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
return nullptr;
}
@@ -674,7 +674,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Else the SS must be stored in the given hash, replacing any previous contents.
// Index checking
if (hash > MAX_ASSET_HASH) {
- error_show(FL, 'WSLA', "Asset Name: %s, hash given was %ld", wsAssetName, hash);
+ error_show(FL, 'WSLA', "Asset Name: %s, hash given was %d", wsAssetName, hash);
}
// Check to see if the SS is already loaded in the given hash slot
@@ -1015,7 +1015,7 @@ M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite
if (spriteName) {
ws_LogErrorMsg(FL, "Sprite series is not in memory: %s.", spriteName);
} else {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld.", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d.", hash);
}
}
@@ -1027,7 +1027,7 @@ M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite
// Check the sprite
if (!mySprite) {
- ws_LogErrorMsg(FL, "Series: %s, Hash: %ld, index: %ld", _GWS(globalCELSnames)[hash], hash, index);
+ ws_LogErrorMsg(FL, "Series: %s, Hash: %d, index: %d", _GWS(globalCELSnames)[hash], hash, index);
}
return mySprite;
@@ -1134,13 +1134,13 @@ CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB) {
if (!myCCB) {
// Create the CCB struct
if ((myCCB = (CCB *)mem_alloc(sizeof(CCB), "CCB")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(CCB));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d bytes", sizeof(CCB));
return nullptr;
}
// Create the CCB current location and new location rectangles
if ((myCCB->currLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "M4Rect")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(M4Rect));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d bytes", sizeof(M4Rect));
return nullptr;
}
myCCB->currLocation->x1 = 0;
@@ -1148,7 +1148,7 @@ CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB) {
myCCB->currLocation->x2 = 0;
myCCB->currLocation->y2 = 0;
if ((myCCB->newLocation = (M4Rect *)mem_alloc(sizeof(M4Rect), "M4Rect")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld bytes", sizeof(M4Rect));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d bytes", sizeof(M4Rect));
return nullptr;
}
myCCB->maxArea = nullptr;
@@ -1188,13 +1188,13 @@ int32 GetWSAssetCELCount(uint32 hash) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d", hash);
return -1;
}
// Make sure the series is still in memory
if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
- ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series not in memory series num: %d", hash);
return -1;
}
@@ -1216,13 +1216,13 @@ int32 GetWSAssetCELFrameRate(uint32 hash) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d", hash);
return -1;
}
// Make sure the series is still in memory
if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
- ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series not in memory series num: %d", hash);
return -1;
}
@@ -1244,13 +1244,13 @@ int32 GetWSAssetCELPixSpeed(uint32 hash) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d", hash);
return -1;
}
// Make sure the series is still in memory
if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
- ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series not in memory series num: %d", hash);
return -1;
}
@@ -1272,13 +1272,13 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d", hash);
return -1;
}
// Make sure the series is still in memory
if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
- ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series not in memory series num: %d", hash);
return -1;
}
@@ -1288,7 +1288,7 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
if (index >= numCels) {
- ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
return -1;
}
@@ -1317,13 +1317,13 @@ int32 ws_get_sprite_height(uint32 hash, int32 index) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "Series number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series number out of range: requested num: %d", hash);
return -1;
}
// Make sure the series is still in memory
if ((!_GWS(globalCELSHandles)[hash]) || (!*_GWS(globalCELSHandles)[hash])) {
- ws_LogErrorMsg(FL, "Series not in memory series num: %ld", hash);
+ ws_LogErrorMsg(FL, "Series not in memory series num: %d", hash);
return -1;
}
@@ -1333,7 +1333,7 @@ int32 ws_get_sprite_height(uint32 hash, int32 index) {
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
if (index >= numCels) {
- ws_LogErrorMsg(FL, "Sprite index out of range - max index: %ld, requested index: %ld", numCels - 1, index);
+ ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
return -1;
}
@@ -1360,13 +1360,13 @@ MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
// Verify the hash is valid, and a SEQU for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "SEQU number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "SEQU number out of range: requested num: %d", hash);
return nullptr;
}
// Make sure the SEQU is still in memory
if ((!_GWS(globalSEQUHandles)[hash]) || (!*_GWS(globalSEQUHandles)[hash])) {
- ws_LogErrorMsg(FL, "SEQU not in memory: sequence num: %ld", hash);
+ ws_LogErrorMsg(FL, "SEQU not in memory: sequence num: %d", hash);
return nullptr;
}
@@ -1393,13 +1393,13 @@ MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int
// Verify the hash is valid, and a MACH for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "MACH number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "MACH number out of range: requested num: %d", hash);
return nullptr;
}
// Make sure the MACH is still in memory
if ((!_GWS(globalMACHHandles)[hash]) || (!*_GWS(globalMACHHandles)[hash])) {
- ws_LogErrorMsg(FL, "MACH not in memory: machine num: %ld", hash);
+ ws_LogErrorMsg(FL, "MACH not in memory: machine num: %d", hash);
return nullptr;
}
@@ -1430,13 +1430,13 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "DATA number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "DATA number out of range: requested num: %d", hash);
return nullptr;
}
// Make sure the DATA is still in memory
if ((!_GWS(globalDATAHandles)[hash]) || (!*_GWS(globalDATAHandles)[hash])) {
- ws_LogErrorMsg(FL, "DATA not in memory: data num: %ld", hash);
+ ws_LogErrorMsg(FL, "DATA not in memory: data num: %d", hash);
return nullptr;
}
@@ -1445,9 +1445,9 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
// Verify the row index of the data block is valid
if (index > dataPtr[DATA_REC_COUNT]) {
- term_message("File: %s, line: %ld, ws_GetDATA() failed:", FL);
- term_message("Data block num: %ld", hash);
- term_message("Data row out of range - max row index: %ld, requested row index: %ld", dataPtr[DATA_REC_COUNT], index);
+ term_message("File: %s, line: %d, ws_GetDATA() failed:", FL);
+ term_message("Data block num: %d", hash);
+ term_message("Data row out of range - max row index: %d, requested row index: %d", dataPtr[DATA_REC_COUNT], index);
return nullptr;
}
@@ -1470,13 +1470,13 @@ int32 ws_GetDATACount(uint32 hash) {
// Verify the hash is valid, and a SS for that hash has been loaded
if (hash > MAX_ASSET_HASH) {
- ws_LogErrorMsg(FL, "DATA number out of range: requested num: %ld", hash);
+ ws_LogErrorMsg(FL, "DATA number out of range: requested num: %d", hash);
return -1;
}
// Make sure the DATA is still in memory
if ((!_GWS(globalDATAHandles)[hash]) || (!*_GWS(globalDATAHandles)[hash])) {
- ws_LogErrorMsg(FL, "DATA not in memory: data num: %ld", hash);
+ ws_LogErrorMsg(FL, "DATA not in memory: data num: %d", hash);
return -1;
}
@@ -1558,7 +1558,7 @@ static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
// If there is at least one color specified in this block
if (numColors > 0) {
if ((myColors = (uint32 *)mem_alloc(celsSize - 12, "ss pal info")) == nullptr) {
- ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", celsSize - 12);
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %d bytes.", celsSize - 12);
return -1;
}
@@ -1650,7 +1650,7 @@ static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
// Allocate a block to hold both the series header, and the sprite offset table
if ((*data = (uint32 *)mem_alloc((SS_HEAD_SIZE + numCels) * 4, "ss header")) == nullptr) {
- ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", (SS_HEAD_SIZE + numCels) << 2);
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %d bytes.", (SS_HEAD_SIZE + numCels) << 2);
return -1;
}
@@ -1738,12 +1738,12 @@ bool ws_OpenSSstream(SysFile *sysFile, Anim8 *anim8) {
if (!myCCB->source) {
myCCB->source = (M4sprite *)mem_alloc(sizeof(M4sprite), "Sprite");
if (!myCCB->source) {
- ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", sizeof(M4sprite));
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %d bytes.", sizeof(M4sprite));
return false;
}
}
- term_message("Biggest frame was: %ld, size: %ld bytes (compressed)", obesest_frame, maxFrameSize);
+ term_message("Biggest frame was: %d, size: %d bytes (compressed)", obesest_frame, maxFrameSize);
// Access the streamer to recognize the new client
if ((myCCB->myStream = (void *)f_stream_Open(sysFile, ssDataOffset, maxFrameSize, maxFrameSize << 4, numSprites, (int32 *)offsets, 4, false)) == nullptr) {
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 1ff2b3d5260..97313b01448 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -131,7 +131,7 @@ static void clear_persistent_msg_list(machine *m) {
static msgRequest *new_msgRequest() {
msgRequest *newMsg;
if ((newMsg = (msgRequest *)mem_alloc(sizeof(msgRequest), "msgRequest")) == nullptr) {
- ws_LogErrorMsg(FL, "Failed to mem_alloc() %ld bytes.", sizeof(msgRequest));
+ ws_LogErrorMsg(FL, "Failed to mem_alloc() %d bytes.", sizeof(msgRequest));
}
return newMsg;
}
@@ -486,7 +486,7 @@ static bool op_TRIG(machine *m, int32 *pcOffset) {
myCount = 1;
}
- Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %d", m->myHash);
for (i = 0; i < myCount; i++) {
if (!TriggerMachineByHash(*_GWS(myArg1) >> 16, m->myAnim8, -1, -1, m->CintrMsg, false, tempStr)) {
ws_Error(m, ERR_MACH, 0x0267, "trig() failed");
@@ -557,7 +557,7 @@ static bool op_TRIG_W(machine *m, int32 *pcOffset) {
myCount = imath_ranged_rand(minCount, maxCount);
}
for (i = 0; i < myCount; i++) {
- Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %d", m->myHash);
if (!TriggerMachineByHash(myHash, m->myAnim8, myDataHash, myIndex, m->CintrMsg, false, tempStr)) {
ws_Error(m, ERR_MACH, 0x0267, "trig_w() failed");
}
@@ -569,7 +569,7 @@ static bool op_TRIG_W(machine *m, int32 *pcOffset) {
myCount = imath_ranged_rand(minCount, maxCount);
}
for (i = 0; i < myCount; i++) {
- Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %ld", m->myHash);
+ Common::sprintf_s(tempStr, "*** TRIGGERED BY MACHINE: %d", m->myHash);
if (!TriggerMachineByHash(myHash, m->myAnim8, myDataHash, myIndex, m->CintrMsg, false, tempStr)) {
ws_Error(m, ERR_MACH, 0x0267, "trig_w() failed");
}
@@ -963,8 +963,8 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
machine *m;
if ((m = (machine *)mem_alloc(sizeof(machine), "machine")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(machine));
- ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(machine));
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %d, name: %s", myHash, machName);
ws_Error(m, ERR_INTERNAL, 0x2fe, "TriggerMachineByHash() failed.");
return nullptr;
}
@@ -980,7 +980,7 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
m->machName = mem_strdup(machName);
if ((m->machHandle = ws_GetMACH(myHash, &m->numOfStates, &m->stateTableOffset, &m->machInstrOffset)) == nullptr) {
- ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %d, name: %s", myHash, machName);
return nullptr;
}
@@ -988,7 +988,7 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
if (dataHash >= 0) {
m->dataHash = dataHash;
if ((m->dataHandle = ws_GetDATA(dataHash, (uint32)dataRow, &m->dataOffset)) == nullptr) {
- ws_LogErrorMsg(FL, "Trying to trigger hash: %ld, name: %s", myHash, machName);
+ ws_LogErrorMsg(FL, "Trying to trigger hash: %d, name: %s", myHash, machName);
return nullptr;
}
} else {
@@ -1142,7 +1142,7 @@ void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
// Prepare a global message structure
if ((tempGlobalMsg = (globalMsgReq *)mem_alloc(sizeof(globalMsgReq), "globalMsgReq")) == nullptr) {
- ws_LogErrorMsg(FL, "Out of memory - mem requested: %ld.", sizeof(machine));
+ ws_LogErrorMsg(FL, "Out of memory - mem requested: %d.", sizeof(machine));
ws_Error(nullptr, ERR_INTERNAL, 0x2fe, "SendWSMessage() failed.");
}
tempGlobalMsg->msgHash = msgHash;
Commit: d5153451e30fc450b6db8577dca4bc4282a9e718
https://github.com/scummvm/scummvm/commit/d5153451e30fc450b6db8577dca4bc4282a9e718
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix missing virtual destructors
Changed paths:
engines/m4/burger/hotkeys.h
engines/m4/core/rooms.h
engines/m4/gui/hotkeys.h
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index 337b6b91937..f016ba66615 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -40,6 +40,8 @@ struct Hotkeys : public M4::Hotkeys {
*/
static void escape_key_pressed(void *, void *);
+ virtual ~Hotkeys() {}
+
void add_hot_keys() override;
void toggle_through_cursors() override;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index c2a56b3192c..e5085aea60b 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -108,6 +108,7 @@ public:
Room *_activeRoom = nullptr;
public:
Sections() {}
+ virtual ~Sections() {}
void global_section_constructor();
void section_room_constructor();
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 1901ca33d0b..95d61927cae 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -76,6 +76,8 @@ public:
static void pal_override(void *, void *);
public:
+ virtual ~Hotkeys() {}
+
virtual void add_hot_keys();
void disable_hot_keys();
void restore_hot_keys();
Commit: 64f49143c2d7fd5e85a5a84b0d449c3fbd294a08
https://github.com/scummvm/scummvm/commit/64f49143c2d7fd5e85a5a84b0d449c3fbd294a08
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix poitner check
Changed paths:
engines/m4/adv_r/adv_control.cpp
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 12889a03d0b..573d3da146a 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -163,7 +163,7 @@ void update_mouse_pos_dialog() {
assert(game_buff_ptr);
if (_G(my_walker) != nullptr) {
- if (((int32)_G(my_walker)->myAnim8) < 0)
+ if (!_G(my_walker)->myAnim8)
error_show(FL, 'W:-(');
player_get_info();
}
Commit: 9d6400e40c62ed9898ffd9ef3df0f77cd26d5348
https://github.com/scummvm/scummvm/commit/9d6400e40c62ed9898ffd9ef3df0f77cd26d5348
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix a bunch of pointer arithmatic
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 46ba9f3e901..ef02c992d5f 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -268,7 +268,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
HLock(workHandle);
mainAssetPtr = (char *)(*workHandle);
- endOfAssetBlock = (char *)((byte *)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
parseAssetPtr = mainAssetPtr;
@@ -550,7 +550,7 @@ int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *ce
HLock(workHandle);
mainAssetPtr = (char *)*workHandle;
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
parseAssetPtr = mainAssetPtr;
// Process the SS from the stream file
@@ -599,7 +599,7 @@ int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int
f.close();
// Set up some pointers
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
parseAssetPtr = mainAssetPtr;
// Process the SS from the stream file
@@ -711,7 +711,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
mainAssetPtr = (char *)(*workHandle);
parseAssetPtr = mainAssetPtr;
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
ClearWSAssets(_WS_ASSET_CELS, emptySlot, emptySlot);
@@ -955,7 +955,7 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
for (i = 0; i < data[CELS_COUNT]; i++) {
// The beginning of sprite i is the dataPtr + the number of bytes in the offset table
- tempPtr = (uint32 *)((uint32)dataPtr + offsetPtr[i]);
+ tempPtr = (uint32 *)((intptr)dataPtr + offsetPtr[i]);
// Byteswap the individual sprite's header
for (j = 0; j < SS_INDV_HEAD; j++) {
@@ -1050,7 +1050,7 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
HLock(workHandle);
mainAssetPtr = (char *)*workHandle;
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
parseAssetPtr = mainAssetPtr;
// Process the SS from the stream file
@@ -1103,7 +1103,7 @@ int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32
f.close();
// Set up some pointers
- endOfAssetBlock = (char *)((uint32)mainAssetPtr + (uint32)assetSize);
+ endOfAssetBlock = (char *)((intptr)mainAssetPtr + assetSize);
parseAssetPtr = mainAssetPtr;
// Process the SS from the stream file
@@ -1199,7 +1199,7 @@ int32 GetWSAssetCELCount(uint32 hash) {
}
// Find and return the number of sprites in the SS
- celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ celsPtr = (uint32 *)((intptr)*(_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
return celsPtr[CELS_COUNT];
}
@@ -1227,7 +1227,7 @@ int32 GetWSAssetCELFrameRate(uint32 hash) {
}
// Find and return the frame rate for the SS
- celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ celsPtr = (uint32 *)((intptr)*(_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
return celsPtr[CELS_FRAME_RATE];
}
@@ -1255,7 +1255,7 @@ int32 GetWSAssetCELPixSpeed(uint32 hash) {
}
// Find and return the pix speed for the SS
- celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ celsPtr = (uint32 *)((intptr)*(_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
return celsPtr[CELS_PIX_SPEED];
}
@@ -1283,7 +1283,7 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
}
// Find the source for the SS
- celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ celsPtr = (uint32 *)((intptr)*(_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
@@ -1299,7 +1299,7 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
data = &celsPtr[CELS_OFFSETS + numCels];
// Find the sprite data for the specific sprite in the series
- myCelSource = (uint32 *)((uint32)data + offsets[index]);
+ myCelSource = (uint32 *)((intptr)data + offsets[index]);
return (int32)myCelSource[CELS_W];
}
@@ -1328,7 +1328,7 @@ int32 ws_get_sprite_height(uint32 hash, int32 index) {
}
// Find the source for the SS
- celsPtr = (uint32 *)((uint32) * (_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
+ celsPtr = (uint32 *)((intptr)*(_GWS(globalCELSHandles)[hash]) + (uint32)(_GWS(globalCELSoffsets)[hash]));
// Check that the index into the series requested is within a valid range
numCels = celsPtr[CELS_COUNT];
@@ -1344,7 +1344,7 @@ int32 ws_get_sprite_height(uint32 hash, int32 index) {
data = &celsPtr[CELS_OFFSETS + numCels];
// Find the sprite data for the specific sprite in the series
- myCelSource = (uint32 *)((uint32)data + offsets[index]);
+ myCelSource = (uint32 *)((intptr)data + offsets[index]);
return (int32)myCelSource[CELS_H];
}
@@ -1371,7 +1371,7 @@ MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
}
// Find the sequence chunk
- sequPtr = (uint32 *)((uint32)*(_GWS(globalSEQUHandles)[hash]) + (uint32)(_GWS(globalSEQUoffsets)[hash]));
+ sequPtr = (uint32 *)((intptr)*(_GWS(globalSEQUHandles)[hash]) + (uint32)(_GWS(globalSEQUoffsets)[hash]));
// Return the offset into the resource chunk, and the number of local vars used by the sequence
*offset = (byte *)(&sequPtr[SEQU_SEQU_START]) - (byte *)*(_GWS(globalSEQUHandles)[hash]);
@@ -1407,7 +1407,7 @@ MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int
HLock(_GWS(globalMACHHandles)[hash]);
// Find the machine chunk
- machPtr = (uint32 *)((uint32) * (_GWS(globalMACHHandles)[hash]) + (uint32)(_GWS(globalMACHoffsets)[hash]));
+ machPtr = (uint32 *)((intptr)*(_GWS(globalMACHHandles)[hash]) + (uint32)(_GWS(globalMACHoffsets)[hash]));
// Set the number of states, the state offset table, the start of the mach instructions
*numStates = (int32)machPtr[MACH_NUM_STATES];
@@ -1441,7 +1441,7 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
}
// Find the data block chunk
- dataPtr = (uint32 *)((uint32) * (_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
+ dataPtr = (uint32 *)((intptr)*(_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
// Verify the row index of the data block is valid
if (index > dataPtr[DATA_REC_COUNT]) {
@@ -1481,7 +1481,7 @@ int32 ws_GetDATACount(uint32 hash) {
}
// Find the data block chunk
- dataPtr = (uint32 *)((uint32) * (_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
+ dataPtr = (uint32 *)((intptr)*(_GWS(globalDATAHandles)[hash]) + (uint32)(_GWS(globalDATAoffsets)[hash]));
// Return the number of rows in the data block
return dataPtr[DATA_REC_COUNT];
Commit: bd0b5c15230df2fcbc983d2051b4c1204636bf20
https://github.com/scummvm/scummvm/commit/bd0b5c15230df2fcbc983d2051b4c1204636bf20
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Replace all kernel_trigger_dispatch with kernel_trigger_dispatchx
I couldn't locate the original method in the disassembly,
so it's fair to say that everything calls dispatchx now
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/adv_r/adv_trigger.h
engines/m4/burger/core/play_break.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/graphics/krn_pal.cpp
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index c4848e2ece5..8c12bdea4e1 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -47,21 +47,6 @@ bool kernel_trigger_dispatch_now(int32 trigger_num) {
return kernel_trigger_dispatchx(kernel_trigger_create(trigger_num));
}
-bool kernel_trigger_dispatch(int32 trigger) {
-#if 0
- if (trigger == -1 || trigger == 65535 || _G(between_rooms))
- return true;
-
- _GT(sound_trigger_q)[_GT(q_end)++] = trigger;
- if (_GT(q_end) == _GT(q_start))
- error_show(FL, 'QOVF');
-
- return true;
-#else
- error("TODO: Probably meant to call dispatchx");
-#endif
-}
-
void cisco_dispatch_triggers() {
for (int i = 0; i < _GT(q_end); ++i) {
kernel_trigger_dispatchx(_GT(sound_trigger_q)[i]);
@@ -170,7 +155,7 @@ void kernel_service_timing_trigger_q() {
while (iter < _GT(time_q_end) && _GT(time_q)[iter] <= now)
{
- kernel_trigger_dispatch(_GT(time_trigger_q)[iter]);
+ kernel_trigger_dispatchx(_GT(time_trigger_q)[iter]);
++iter;
}
if (!iter)
diff --git a/engines/m4/adv_r/adv_trigger.h b/engines/m4/adv_r/adv_trigger.h
index c9a0c8e3a8f..3232bb022ee 100644
--- a/engines/m4/adv_r/adv_trigger.h
+++ b/engines/m4/adv_r/adv_trigger.h
@@ -56,7 +56,7 @@ extern int32 kernel_trigger_create_mode(int32 trigger_num, int32 desired_mode);
/**
* Dispatches a trigger
*/
-extern bool kernel_trigger_dispatch(int32 trigger_num);
+extern bool kernel_trigger_dispatchx(int32 trigger_num);
/**
* Dispatches a trigger.
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index 9fe4c64d15f..e62a6a26f4d 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -72,7 +72,7 @@ static void set_next_series_play_break(int32 slot) {
} else {
// No sound to play so see if there is a trigger to dispatch
if (player->current_break.trigger != NO_TRIGGER) {
- kernel_trigger_dispatch(kernel_trigger_create(player->current_break.trigger));
+ kernel_trigger_dispatchx(kernel_trigger_create(player->current_break.trigger));
}
}
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 552eb3466ca..e137b899835 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -3332,7 +3332,7 @@ void cb_SaveLoad_Load(void *, void *theMenu) {
_G(kernel).restore_slot = _GM(slotSelected);
oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch(kernel_trigger_create(TRIG_RESTORE_GAME));
+ kernel_trigger_dispatchx(kernel_trigger_create(TRIG_RESTORE_GAME));
_G(kernel).trigger_mode = oldMode;
}
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index b2fc6a2fd20..39e18caad67 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -364,7 +364,7 @@ void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
krn_pal_game_task();
// set in kernel_examine_inventory_object (above)
- kernel_trigger_dispatch(_GP(myFadeTrigger));
+ kernel_trigger_dispatchx(_GP(myFadeTrigger));
// gr_pal_set(master_palette);
@@ -616,7 +616,7 @@ void pal_fade_set_start(RGB8 *origPalette, int32 percent) {
}
static void pal_cycle_callback(frac16 myMessage) {
- kernel_trigger_dispatch((uint32)myMessage);
+ kernel_trigger_dispatchx((uint32)myMessage);
}
void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry,
Commit: 849df588700061fae409b8d2fec16690f1ce687b
https://github.com/scummvm/scummvm/commit/849df588700061fae409b8d2fec16690f1ce687b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix climbing ladder
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 432fc384624..9d8490e6283 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -580,7 +580,7 @@ void Room101::daemon() {
break;
case 20:
- _G(roomVal1) = 11;
+ _G(roomVal1) = 21;
series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gTELEPORT, 3, 6, 100, 0, -53);
break;
Commit: 44985bb6578eed9d4f514b73e0cfa41f8c02a2d8
https://github.com/scummvm/scummvm/commit/44985bb6578eed9d4f514b73e0cfa41f8c02a2d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added skeleton classes for section 1 rooms
Changed paths:
A engines/m4/burger/rooms/section1/room102.cpp
A engines/m4/burger/rooms/section1/room102.h
A engines/m4/burger/rooms/section1/room103.cpp
A engines/m4/burger/rooms/section1/room103.h
A engines/m4/burger/rooms/section1/room104.cpp
A engines/m4/burger/rooms/section1/room104.h
A engines/m4/burger/rooms/section1/room105.cpp
A engines/m4/burger/rooms/section1/room105.h
A engines/m4/burger/rooms/section1/room106.cpp
A engines/m4/burger/rooms/section1/room106.h
A engines/m4/burger/rooms/section1/room120.cpp
A engines/m4/burger/rooms/section1/room120.h
A engines/m4/burger/rooms/section1/room133_136.cpp
A engines/m4/burger/rooms/section1/room133_136.h
A engines/m4/burger/rooms/section1/room135.cpp
A engines/m4/burger/rooms/section1/room135.h
A engines/m4/burger/rooms/section1/room137.cpp
A engines/m4/burger/rooms/section1/room137.h
A engines/m4/burger/rooms/section1/room138.cpp
A engines/m4/burger/rooms/section1/room138.h
A engines/m4/burger/rooms/section1/room141.cpp
A engines/m4/burger/rooms/section1/room141.h
A engines/m4/burger/rooms/section1/room142.cpp
A engines/m4/burger/rooms/section1/room142.h
A engines/m4/burger/rooms/section1/room144.cpp
A engines/m4/burger/rooms/section1/room144.h
A engines/m4/burger/rooms/section1/room170.cpp
A engines/m4/burger/rooms/section1/room170.h
A engines/m4/burger/rooms/section1/room171.cpp
A engines/m4/burger/rooms/section1/room171.h
A engines/m4/burger/rooms/section1/room172.cpp
A engines/m4/burger/rooms/section1/room172.h
A engines/m4/burger/rooms/section1/room173.cpp
A engines/m4/burger/rooms/section1/room173.h
A engines/m4/burger/rooms/section1/room174.cpp
A engines/m4/burger/rooms/section1/room174.h
A engines/m4/burger/rooms/section1/room175.cpp
A engines/m4/burger/rooms/section1/room175.h
A engines/m4/burger/rooms/section1/room176.cpp
A engines/m4/burger/rooms/section1/room176.h
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1/room101.h
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/burger/rooms/section9/menu_room.h
engines/m4/burger/rooms/section9/room901.h
engines/m4/burger/rooms/section9/room902.h
engines/m4/burger/rooms/section9/room903.h
engines/m4/burger/rooms/section9/room904.h
engines/m4/burger/rooms/section9/room951.h
engines/m4/burger/rooms/section9/room971.h
engines/m4/burger/rooms/section9/section9.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 6c756baf049..22b3b5092ea 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -32,7 +32,7 @@ namespace Rooms {
class Room : public M4::Room {
public:
- Room(uint roomNum) : M4::Room(roomNum) {}
+ Room() : M4::Room() {}
~Room() override {}
void shutdown() override;
diff --git a/engines/m4/burger/rooms/section1/room101.h b/engines/m4/burger/rooms/section1/room101.h
index 4a8aa9d9798..40300dae7ae 100644
--- a/engines/m4/burger/rooms/section1/room101.h
+++ b/engines/m4/burger/rooms/section1/room101.h
@@ -46,7 +46,7 @@ private:
void daemon20();
public:
- Room101() : Room(101) {}
+ Room101() : Room() {}
~Room101() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
new file mode 100644
index 00000000000..0760bde713e
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room102.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room102::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room102::daemon() {
+}
+
+void Room102::pre_parser() {
+}
+
+void Room102::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
new file mode 100644
index 00000000000..770958bb843
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM102_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM102_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room102 : public Room {
+public:
+ Room102() : Room() {}
+ ~Room102() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
new file mode 100644
index 00000000000..1cce724ca97
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room103.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room103::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room103::daemon() {
+}
+
+void Room103::pre_parser() {
+}
+
+void Room103::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
new file mode 100644
index 00000000000..77615861e92
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM103_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM103_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room103 : public Room {
+public:
+ Room103() : Room() {}
+ ~Room103() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
new file mode 100644
index 00000000000..91c67787321
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room104.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room104::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room104::daemon() {
+}
+
+void Room104::pre_parser() {
+}
+
+void Room104::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room104.h b/engines/m4/burger/rooms/section1/room104.h
new file mode 100644
index 00000000000..d9cec0f34ec
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room104.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM104_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM104_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room104 : public Room {
+public:
+ Room104() : Room() {}
+ ~Room104() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
new file mode 100644
index 00000000000..487443e4ecc
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room105.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room105::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room105::daemon() {
+}
+
+void Room105::pre_parser() {
+}
+
+void Room105::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
new file mode 100644
index 00000000000..5f31c918e12
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM105_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM105_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room105 : public Room {
+public:
+ Room105() : Room() {}
+ ~Room105() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
new file mode 100644
index 00000000000..05211bed5d9
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room106.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room106::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room106::daemon() {
+}
+
+void Room106::pre_parser() {
+}
+
+void Room106::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
new file mode 100644
index 00000000000..ee659dca60b
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM106_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM106_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room106 : public Room {
+public:
+ Room106() : Room() {}
+ ~Room106() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room120.cpp b/engines/m4/burger/rooms/section1/room120.cpp
new file mode 100644
index 00000000000..f0b0d161ea7
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room120.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room120.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room120::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room120::daemon() {
+}
+
+void Room120::pre_parser() {
+}
+
+void Room120::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room120.h b/engines/m4/burger/rooms/section1/room120.h
new file mode 100644
index 00000000000..13c27564624
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room120.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM120_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM120_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room120 : public Room {
+public:
+ Room120() : Room() {}
+ ~Room120() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
new file mode 100644
index 00000000000..9e51f610b63
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room133_136.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room133_136::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room133_136::daemon() {
+}
+
+void Room133_136::pre_parser() {
+}
+
+void Room133_136::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room133_136.h b/engines/m4/burger/rooms/section1/room133_136.h
new file mode 100644
index 00000000000..ba1a32074f9
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room133_136.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM133_136_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM133_136_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room133_136 : public Room {
+public:
+ Room133_136() : Room() {}
+ ~Room133_136() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
new file mode 100644
index 00000000000..71653c404e9
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room135.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room135::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room135::daemon() {
+}
+
+void Room135::pre_parser() {
+}
+
+void Room135::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room135.h b/engines/m4/burger/rooms/section1/room135.h
new file mode 100644
index 00000000000..9ad4d5893bc
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room135.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM135_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM135_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room135 : public Room {
+public:
+ Room135() : Room() {}
+ ~Room135() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
new file mode 100644
index 00000000000..fc162103fb1
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room137.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room137::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room137::daemon() {
+}
+
+void Room137::pre_parser() {
+}
+
+void Room137::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
new file mode 100644
index 00000000000..c7f596eac58
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM137_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM137_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room137 : public Room {
+public:
+ Room137() : Room() {}
+ ~Room137() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
new file mode 100644
index 00000000000..e49bd46690d
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room138.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room138::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room138::daemon() {
+}
+
+void Room138::pre_parser() {
+}
+
+void Room138::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room138.h b/engines/m4/burger/rooms/section1/room138.h
new file mode 100644
index 00000000000..db4a5a65096
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room138.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM138_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM138_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room138 : public Room {
+public:
+ Room138() : Room() {}
+ ~Room138() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
new file mode 100644
index 00000000000..70739930497
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room141.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room141::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room141::daemon() {
+}
+
+void Room141::pre_parser() {
+}
+
+void Room141::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
new file mode 100644
index 00000000000..2fa91973e38
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM141_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM141_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room141 : public Room {
+public:
+ Room141() : Room() {}
+ ~Room141() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
new file mode 100644
index 00000000000..80dbc1b5af6
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room142.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room142::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room142::daemon() {
+}
+
+void Room142::pre_parser() {
+}
+
+void Room142::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
new file mode 100644
index 00000000000..f97a3ab3f70
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM142_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM142_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room142 : public Room {
+public:
+ Room142() : Room() {}
+ ~Room142() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room144.cpp b/engines/m4/burger/rooms/section1/room144.cpp
new file mode 100644
index 00000000000..ccc635beb76
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room144.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room144.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room144::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room144::daemon() {
+}
+
+void Room144::pre_parser() {
+}
+
+void Room144::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room144.h b/engines/m4/burger/rooms/section1/room144.h
new file mode 100644
index 00000000000..cf2e6e98eac
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room144.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM144_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM144_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room144 : public Room {
+public:
+ Room144() : Room() {}
+ ~Room144() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
new file mode 100644
index 00000000000..eaabd22c36b
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room170.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room170::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room170::daemon() {
+}
+
+void Room170::pre_parser() {
+}
+
+void Room170::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room170.h b/engines/m4/burger/rooms/section1/room170.h
new file mode 100644
index 00000000000..ccfd5699bf5
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room170.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM170_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM170_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room170 : public Room {
+public:
+ Room170() : Room() {}
+ ~Room170() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
new file mode 100644
index 00000000000..e3f66e542cd
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room171.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room171::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room171::daemon() {
+}
+
+void Room171::pre_parser() {
+}
+
+void Room171::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room171.h b/engines/m4/burger/rooms/section1/room171.h
new file mode 100644
index 00000000000..7753233cc04
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room171.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM171_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM171_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room171 : public Room {
+public:
+ Room171() : Room() {}
+ ~Room171() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
new file mode 100644
index 00000000000..762f5b2770d
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room172.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room172::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room172::daemon() {
+}
+
+void Room172::pre_parser() {
+}
+
+void Room172::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room172.h b/engines/m4/burger/rooms/section1/room172.h
new file mode 100644
index 00000000000..ca076736857
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room172.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM172_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM172_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room172 : public Room {
+public:
+ Room172() : Room() {}
+ ~Room172() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
new file mode 100644
index 00000000000..4b5ca8f51aa
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room173.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room173::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room173::daemon() {
+}
+
+void Room173::pre_parser() {
+}
+
+void Room173::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room173.h b/engines/m4/burger/rooms/section1/room173.h
new file mode 100644
index 00000000000..5a64ae24eff
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room173.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM173_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM173_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room173 : public Room {
+public:
+ Room173() : Room() {}
+ ~Room173() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
new file mode 100644
index 00000000000..128335958eb
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room174.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room174::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room174::daemon() {
+}
+
+void Room174::pre_parser() {
+}
+
+void Room174::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room174.h b/engines/m4/burger/rooms/section1/room174.h
new file mode 100644
index 00000000000..713564a619c
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room174.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM174_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM174_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room174 : public Room {
+public:
+ Room174() : Room() {}
+ ~Room174() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
new file mode 100644
index 00000000000..bcced9a380d
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room175.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room175::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room175::daemon() {
+}
+
+void Room175::pre_parser() {
+}
+
+void Room175::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room175.h b/engines/m4/burger/rooms/section1/room175.h
new file mode 100644
index 00000000000..5c2925bc2bb
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room175.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM175_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM175_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room175 : public Room {
+public:
+ Room175() : Room() {}
+ ~Room175() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
new file mode 100644
index 00000000000..44530c58197
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room176.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/vars.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room176::init() {
+ _G(player).walker_in_this_scene = true;
+}
+
+void Room176::daemon() {
+}
+
+void Room176::pre_parser() {
+}
+
+void Room176::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room176.h b/engines/m4/burger/rooms/section1/room176.h
new file mode 100644
index 00000000000..28c66fcfc99
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room176.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM176_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM176_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room176 : public Room {
+public:
+ Room176() : Room() {}
+ ~Room176() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 6b9efc93b0c..cdbd500b435 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -30,7 +30,28 @@ namespace Burger {
namespace Rooms {
Section1::Section1() : Rooms::Section() {
- add(&_room101);
+ add(101, &_room101);
+ add(102, &_room102);
+ add(103, &_room103);
+ add(104, &_room104);
+ add(105, &_room105);
+ add(106, &_room106);
+ add(120, &_room120);
+ add(133, &_room133_136);
+ add(135, &_room135);
+ add(136, &_room133_136);
+ add(137, &_room137);
+ add(138, &_room138);
+ add(141, &_room141);
+ add(142, &_room142);
+ add(144, &_room144);
+ add(170, &_room170);
+ add(171, &_room171);
+ add(172, &_room172);
+ add(173, &_room173);
+ add(174, &_room174);
+ add(175, &_room175);
+ add(176, &_room176);
}
void Section1::updateWalker(int x, int y, int dir, int trigger, bool mode) {
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 953a3352a94..d65e959ff0e 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -25,6 +25,26 @@
#include "m4/burger/rooms/room.h"
#include "m4/burger/rooms/section.h"
#include "m4/burger/rooms/section1/room101.h"
+#include "m4/burger/rooms/section1/room102.h"
+#include "m4/burger/rooms/section1/room103.h"
+#include "m4/burger/rooms/section1/room104.h"
+#include "m4/burger/rooms/section1/room105.h"
+#include "m4/burger/rooms/section1/room106.h"
+#include "m4/burger/rooms/section1/room120.h"
+#include "m4/burger/rooms/section1/room133_136.h"
+#include "m4/burger/rooms/section1/room135.h"
+#include "m4/burger/rooms/section1/room137.h"
+#include "m4/burger/rooms/section1/room138.h"
+#include "m4/burger/rooms/section1/room141.h"
+#include "m4/burger/rooms/section1/room142.h"
+#include "m4/burger/rooms/section1/room144.h"
+#include "m4/burger/rooms/section1/room170.h"
+#include "m4/burger/rooms/section1/room171.h"
+#include "m4/burger/rooms/section1/room172.h"
+#include "m4/burger/rooms/section1/room173.h"
+#include "m4/burger/rooms/section1/room174.h"
+#include "m4/burger/rooms/section1/room175.h"
+#include "m4/burger/rooms/section1/room176.h"
namespace M4 {
namespace Burger {
@@ -38,6 +58,26 @@ enum Goto1 {
class Section1 : public Rooms::Section {
private:
Room101 _room101;
+ Room102 _room102;
+ Room103 _room103;
+ Room104 _room104;
+ Room105 _room105;
+ Room106 _room106;
+ Room120 _room120;
+ Room133_136 _room133_136;
+ Room135 _room135;
+ Room137 _room137;
+ Room138 _room138;
+ Room141 _room141;
+ Room142 _room142;
+ Room144 _room144;
+ Room170 _room170;
+ Room171 _room171;
+ Room172 _room172;
+ Room173 _room173;
+ Room174 _room174;
+ Room175 _room175;
+ Room176 _room176;
int _trigger = 0;
int _series1 = -1;
diff --git a/engines/m4/burger/rooms/section9/menu_room.h b/engines/m4/burger/rooms/section9/menu_room.h
index d87daf52b06..f432978d164 100644
--- a/engines/m4/burger/rooms/section9/menu_room.h
+++ b/engines/m4/burger/rooms/section9/menu_room.h
@@ -106,8 +106,8 @@ protected:
_activeButton = -1;
}
public:
- MenuRoom(int roomNum, const char *menuName, const char *clickName) :
- Rooms::Room(roomNum), _menuName(menuName), _clickName(clickName) {}
+ MenuRoom(const char *menuName, const char *clickName) : Rooms::Room(),
+ _menuName(menuName), _clickName(clickName) {}
virtual ~MenuRoom() {}
void init() override;
diff --git a/engines/m4/burger/rooms/section9/room901.h b/engines/m4/burger/rooms/section9/room901.h
index 90154f83a03..00a7a910936 100644
--- a/engines/m4/burger/rooms/section9/room901.h
+++ b/engines/m4/burger/rooms/section9/room901.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Room901 : public MenuRoom {
public:
- Room901() : MenuRoom(901, "901menu", "901click") {}
+ Room901() : MenuRoom("901menu", "901click") {}
~Room901() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room902.h b/engines/m4/burger/rooms/section9/room902.h
index ac77ea2eac6..2f17d180b80 100644
--- a/engines/m4/burger/rooms/section9/room902.h
+++ b/engines/m4/burger/rooms/section9/room902.h
@@ -43,7 +43,7 @@ private:
int _seriesIndex = -1;
public:
- Room902() : Rooms::Room(902) {}
+ Room902() : Rooms::Room() {}
~Room902() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room903.h b/engines/m4/burger/rooms/section9/room903.h
index bde4b1832ac..1efc7e797bc 100644
--- a/engines/m4/burger/rooms/section9/room903.h
+++ b/engines/m4/burger/rooms/section9/room903.h
@@ -33,7 +33,7 @@ private:
bool _buttonsDrawn = false;
public:
- Room903() : MenuRoom(903, "903menu", "901click") {}
+ Room903() : MenuRoom("903menu", "901click") {}
~Room903() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room904.h b/engines/m4/burger/rooms/section9/room904.h
index 073cf95263c..e87353de14b 100644
--- a/engines/m4/burger/rooms/section9/room904.h
+++ b/engines/m4/burger/rooms/section9/room904.h
@@ -96,7 +96,7 @@ private:
static void playRandomSound(int trigger, int channel);
public:
- Room904() : Rooms::Room(904) {}
+ Room904() : Rooms::Room() {}
~Room904() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room951.h b/engines/m4/burger/rooms/section9/room951.h
index d8d34569d7e..3e69aa07502 100644
--- a/engines/m4/burger/rooms/section9/room951.h
+++ b/engines/m4/burger/rooms/section9/room951.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Room951 : public Rooms::Room {
public:
- Room951() : Rooms::Room(951) {}
+ Room951() : Rooms::Room() {}
~Room951() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/room971.h b/engines/m4/burger/rooms/section9/room971.h
index db35646e850..a16b9f852fd 100644
--- a/engines/m4/burger/rooms/section9/room971.h
+++ b/engines/m4/burger/rooms/section9/room971.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Room971 : public Rooms::Room {
public:
- Room971() : Rooms::Room(971) {}
+ Room971() : Rooms::Room() {}
~Room971() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section9/section9.cpp b/engines/m4/burger/rooms/section9/section9.cpp
index e814e4e2b40..1d215ac86c5 100644
--- a/engines/m4/burger/rooms/section9/section9.cpp
+++ b/engines/m4/burger/rooms/section9/section9.cpp
@@ -27,12 +27,12 @@ namespace Burger {
namespace Rooms {
Section9::Section9() : Rooms::Section() {
- add(&_room901);
- add(&_room902);
- add(&_room903);
- add(&_room904);
- add(&_room951);
- add(&_room971);
+ add(901, &_room901);
+ add(902, &_room902);
+ add(903, &_room903);
+ add(904, &_room904);
+ add(951, &_room951);
+ add(971, &_room971);
}
void Section9::daemon() {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index a936ecfcbd3..3e682d3a667 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -439,13 +439,11 @@ void Sections::pal_game_task() {
/*------------------------------------------------------------------------*/
Room *Section::operator[](uint roomNum) {
- for (uint i = 0; i < _rooms.size(); ++i) {
- if (_rooms[i]->_roomNum == roomNum)
- return _rooms[i];
- }
+ Room *room = _rooms[roomNum];
+ if (!room)
+ error("Unknown room number - %d", roomNum);
- error("Unknown room number - %d", roomNum);
+ return room;
}
-
} // namespace M4
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index e5085aea60b..6902cb9c95e 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -22,7 +22,7 @@
#ifndef M4_CORE_ROOMS_H
#define M4_CORE_ROOMS_H
-#include "common/array.h"
+#include "common/hashmap.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_hotspot.h"
@@ -30,12 +30,8 @@ namespace M4 {
class Room {
public:
- uint _roomNum;
-public:
- Room(uint roomNum) : _roomNum(roomNum) {
- }
- virtual ~Room() {
- }
+ Room() {}
+ virtual ~Room() {}
virtual void preload() {}
virtual void init() {}
@@ -52,11 +48,11 @@ public:
class Section {
private:
- Common::Array<Room *> _rooms;
+ Common::HashMap<int, Room *> _rooms;
protected:
// Add a room to the section
- void add(Room *room) {
- _rooms.push_back(room);
+ void add(int roomNum, Room *room) {
+ _rooms[roomNum] = room;
}
public:
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 94307b29e6e..f23b78114b6 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -90,6 +90,26 @@ MODULE_OBJS = \
burger/rooms/section.o \
burger/rooms/section1/section1.o \
burger/rooms/section1/room101.o \
+ burger/rooms/section1/room102.o \
+ burger/rooms/section1/room103.o \
+ burger/rooms/section1/room104.o \
+ burger/rooms/section1/room105.o \
+ burger/rooms/section1/room106.o \
+ burger/rooms/section1/room120.o \
+ burger/rooms/section1/room133_136.o \
+ burger/rooms/section1/room135.o \
+ burger/rooms/section1/room137.o \
+ burger/rooms/section1/room138.o \
+ burger/rooms/section1/room141.o \
+ burger/rooms/section1/room142.o \
+ burger/rooms/section1/room144.o \
+ burger/rooms/section1/room170.o \
+ burger/rooms/section1/room171.o \
+ burger/rooms/section1/room172.o \
+ burger/rooms/section1/room173.o \
+ burger/rooms/section1/room174.o \
+ burger/rooms/section1/room175.o \
+ burger/rooms/section1/room176.o \
burger/rooms/section9/section9.o \
burger/rooms/section9/menu_room.o \
burger/rooms/section9/room901.o \
Commit: 4b010aaf89c69e0785d907605c18e2ce04d59235
https://github.com/scummvm/scummvm/commit/4b010aaf89c69e0785d907605c18e2ce04d59235
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 102
Changed paths:
engines/m4/adv_r/adv_hotspot.cpp
engines/m4/adv_r/adv_hotspot.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_hotspot.cpp b/engines/m4/adv_r/adv_hotspot.cpp
index 09aaefbc45c..7fa972d9952 100644
--- a/engines/m4/adv_r/adv_hotspot.cpp
+++ b/engines/m4/adv_r/adv_hotspot.cpp
@@ -250,6 +250,10 @@ void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not)
term_message("hotspot '%s' not found!", name_str);
}
+void hotspot_set_active(const char *name, bool active_or_not) {
+ hotspot_set_active(_G(currentSceneDef).hotspots, name, active_or_not);
+}
+
void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y, bool active_or_not) {
char name_str[MAX_FILENAME_SIZE];
HotSpotRec *i;
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
index d0959b86ee4..3fdfb245814 100644
--- a/engines/m4/adv_r/adv_hotspot.h
+++ b/engines/m4/adv_r/adv_hotspot.h
@@ -79,6 +79,7 @@ extern HotSpotRec *hotspot_unlink(HotSpotRec *head, HotSpotRec *h);
extern void hotspot_delete_all(HotSpotRec *head);
extern void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not);
+extern void hotspot_set_active(const char *name, bool active_or_not);
extern void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y, bool active_or_not);
#define kernel_flip_hotspot(aa,bb) (hotspot_set_active(currentSceneDef.hotspots,aa,bb))
#define kernel_flip_hotspot_xy(aa,bb,xx,yy) (hotspot_set_active_xy(currentSceneDef.hotspots,aa,xx,yy,bb))
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 0760bde713e..d480154417a 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -30,6 +30,77 @@ namespace Rooms {
void Room102::init() {
_G(player).walker_in_this_scene = true;
+ _val1 = 0;
+ _val2 = 0;
+ _val3 = -1;
+ _val4 = 0;
+ _val5 = 0;
+ _val6 = 0;
+ _val7 = 0;
+ _val8 = 0;
+ _val9 = 0;
+ _val10 = 99999;
+
+ digi_preload("102_001");
+ digi_preload("102_002");
+
+ switch (_G(flags)[V012]) {
+ case 1:
+ _index1 = series_load("102ha01", -1);
+ _index2 = series_load("102ha03", -1);
+ _val11 = 35;
+ _val12 = 35;
+ kernel_trigger_dispatch_now(3);
+
+ _val13 = 58;
+ _val14 = 62;
+ kernel_trigger_dispatch_now(4);
+
+ hotspot_set_active("harry", false);
+ setup(5, 0);
+ break;
+
+ case 2:
+ hotspot_set_active("harry", false);
+ hotspot_set_active("harry ", false);
+
+ _series1 = series_play_("102seat", 2560, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ setup(5, 0);
+ break;
+
+ default:
+ _index1 = series_load("102ha01", -1);
+ setup(0, 0);
+
+ _val11 = 19;
+ _val12 = 19;
+ kernel_trigger_dispatch_now(3);
+ ++_G(flags)[V015];
+
+ _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ hotspot_set_active("harry ", false);
+ break;
+ }
+
+ _val15 = -1;
+
+ if (_G(game).previous_room == -2) {
+ ws_demand_location(_G(my_walker), 321, 343);
+ ws_demand_facing(_G(my_walker), 4);
+ ws_hide_walker(_G(my_walker));
+
+ } else {
+ _G(roomVal1) = 1;
+ _val16 = 1;
+ digi_preload("102_038");
+ digi_play("102_038", 2, 255, gTELEPORT);
+ player_set_commands_allowed(false);
+ }
+
+ kernel_trigger_dispatch_now(6);
+ setupWax();
+ setupLaz();
}
void Room102::daemon() {
@@ -41,6 +112,92 @@ void Room102::pre_parser() {
void Room102::parser() {
}
+void Room102::setup(int val1, int val2) {
+ digi_stop(3);
+
+ if (val2)
+ digi_play_loop("102_001", 3, 255, -1);
+ if (_val1) {
+ digi_unload(getDigi1(_G(flags)[GLB_TEMP_2]));
+ digi_unload(getDigi2(_G(flags)[GLB_TEMP_2]));
+ }
+
+ if (val1) {
+ _G(flags)[GLB_TEMP_2] = val1;
+ } else {
+ if (++_G(flags)[GLB_TEMP_2] == 36)
+ _G(flags)[GLB_TEMP_2] = 1;
+ }
+
+ _val1 = 1;
+ digi_preload(getDigi1(_G(flags)[GLB_TEMP_2]));
+ digi_preload(getDigi2(_G(flags)[GLB_TEMP_2]));
+
+ if (val2)
+ digi_stop(3);
+
+ digi_play_loop(getDigi2(_G(flags)[GLB_TEMP_2]), 3, 255, -1);
+ _val10 = timer_read_60() + digi_ticks_to_play(getDigi2(_G(flags)[GLB_TEMP_2]));
+ _val8 = 0;
+}
+
+void Room102::setupWax() {
+ if (_G(flags)[V019]) {
+ hotspot_set_active("hair wax ", false);
+ hotspot_set_active("hair wax ", true);
+ hotspot_set_active("hair wax ", true);
+ hotspot_set_active("hair wax", false);
+ } else {
+ hotspot_set_active("hair wax ", true);
+ hotspot_set_active("hair wax ", false);
+ hotspot_set_active("hair wax ", false);
+ hotspot_set_active("hair wax", true);
+ }
+}
+
+void Room102::setupLaz() {
+ if (_G(flags)[V019]) {
+ _laz1 = series_play_("102lazys", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz2 = series_play_("102lazss", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ } else {
+ _laz1 = series_play_("102lazy2", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz2 = series_play_("102laz2s", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ }
+}
+
+const char *Room102::getDigi1(int num) const {
+ static const char *NAMES[34] = {
+ "102h0323", "102h032b", "102h032c", "102h032d",
+ "102h032e", "102h032f", "102h032g", "102h032h",
+ "102h032i", "102h032j", "102h032k", "102h032l",
+ "102h032m", "102h0321", "102h032o", "102h032p",
+ "102h032q", "102h032r", "102h032s", "102h0324",
+ "102h032u", "102h0321", "102h032w", "102h032x",
+ "102h032y", "102h032z", "102h032v", "102h0322",
+ "102h032a", "102h032t", "102h0325", "102h0326",
+ "102h0327", "102h0328" };
+
+ return (num >= 1 && num <= 34) ? NAMES[num - 1] : "102h0329";
+}
+
+const char *Room102::getDigi2(int num) const {
+ static const char *NAMES[35] = {
+ "102_011", "102_004", nullptr, "102_006", "102_008",
+ "102_009", "102_013", "102_005", "102_014", "102_023",
+
+ "102_020", "102_011", "102_015", "102_006", "102_007",
+ "102_016", "102_014", "102_015", "102_013", "102_011",
+
+ "102_003", "102_012", "102_008", "102_013", "102_021",
+ "102_011", "102_013", "102_010", "102_003", "102_005",
+
+ "102_010", "102_011", "102_021", "102_021", "102_012"
+ };
+
+ return (num >= 1 && num <= 35) ? NAMES[num - 1] : "102_024";
+}
+
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 770958bb843..b838376bee2 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -29,6 +29,35 @@ namespace Burger {
namespace Rooms {
class Room102 : public Room {
+private:
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = -1;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
+ int _val10 = 99999;
+ int _val11 = 0;
+ int _val12 = 0;
+ int _val13 = 0;
+ int _val14 = 0;
+ int _val15 = -1;
+ int _val16 = 0;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_laz1 = nullptr;
+ machine *_laz2 = nullptr;
+ int _index1 = -1, _index2 = -1;
+
+ void setup(int val1, int val2);
+ void setupWax();
+ void setupLaz();
+ const char *getDigi1(int num) const;
+ const char *getDigi2(int num) const;
+
public:
Room102() : Room() {}
~Room102() override {}
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index ba43aa195d2..d66bd17e186 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -257,4 +257,8 @@ int digi_get_overall_volume() {
return _G(digi).get_overall_volume();
}
+int32 digi_ticks_to_play(const char *name, int val2) {
+ error("TODO: digi_ticks_to_play");
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 52d2a1ed5bb..7d78592ad03 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -111,6 +111,7 @@ extern bool digi_play_state(int channel);
extern void digi_change_volume(int channel, int vol);
extern void digi_set_overall_volume(int vol);
extern int digi_get_overall_volume();
+extern int32 digi_ticks_to_play(const char *name, int val2 = -1);
} // namespace M4
Commit: 91cab0ad190424b9ac7031bc81dee12e0012ce9d
https://github.com/scummvm/scummvm/commit/91cab0ad190424b9ac7031bc81dee12e0012ce9d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 102 daemon
Changed paths:
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 22b3b5092ea..73a482eb012 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -25,6 +25,9 @@
#include "m4/core/rooms.h"
#include "m4/burger/core/play_break.h"
#include "m4/burger/core/stream_break.h"
+#include "m4/burger/core/conv.h"
+#include "m4/adv_r/conv_io.h"
+#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index d480154417a..abb7fa41df3 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -19,19 +19,29 @@
*
*/
+#include "common/textconsole.h"
#include "m4/burger/rooms/section1/room102.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
+#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesStreamBreak STREAMS1[] = {
+ { 40, nullptr, 1, 255, 12, 0, nullptr, 0 },
+ { 57, nullptr, 1, 255, 1, 0, nullptr, 0 },
+ { 57, "102_034", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room102::init() {
_G(player).walker_in_this_scene = true;
_val1 = 0;
- _val2 = 0;
+ _series3 = 0;
_val3 = -1;
_val4 = 0;
_val5 = 0;
@@ -83,7 +93,7 @@ void Room102::init() {
break;
}
- _val15 = -1;
+ _trigger = -1;
if (_G(game).previous_room == -2) {
ws_demand_location(_G(my_walker), 321, 343);
@@ -104,6 +114,306 @@ void Room102::init() {
}
void Room102::daemon() {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ conv_resume();
+ break;
+ case 2:
+ ws_unhide_walker(_G(my_walker));
+ break;
+ case 3:
+ switch (_val12) {
+ case 19:
+ term_message(" mumble or change channel");
+
+ if (timer_read_60() > _val10 &&_val11 == 19 && player_commands_allowed() &&
+ !digi_play_state(1) && INTERFACE_VISIBLE) {
+ if (_val8) {
+ _val11 = 26;
+ term_message("change channel");
+ } else {
+ digi_play(getDigi1(_G(flags)[GLB_TEMP_2]), 2, 255, 18);
+ _val9 = 1;
+ _val11 = 20;
+ term_message("mumble");
+ }
+ }
+
+ term_message("!");
+
+ switch (_val11) {
+ case 19:
+ switch (imath_ranged_rand(1, 45)) {
+ case 1:
+ case 2:
+ case 3:
+ series_play_("102ha01", 2560, 1, 3, 4, 0, 100, 0, 0, 0, 0);
+ break;
+ case 6:
+ _val12 = 30;
+ series_play_("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 19, 19);
+ break;
+ case 7:
+ _val12 = 31;
+ series_play_("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 20, 23);
+ break;
+ case 8:
+ _val12 = 24;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ break;
+ case 9:
+ _val12 = 25;
+ series_play_("102ha01", 2560, 0, 3, 7, 0, 100, 0, 0, 3, 4);
+ break;
+ case 10:
+ _val12 = 23;
+ series_play_("102ha01", 2560, 0, 3, 8, 0, 100, 0, 0, 46, 48);
+ break;
+ default:
+ series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 20:
+ _val12 = 20;
+ series_play_("102ha01", 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ break;
+
+ case 21:
+ _val12 = 21;
+ series_play_("102ha01", 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ break;
+
+ case 26:
+ _val11 = 27;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ break;
+
+ case 27:
+ if (player_commands_allowed() && !digi_play_state(1)) {
+ setup();
+ _val11 = 19;
+ _val12 = 26;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 60, 0, 100, 0, 0, 14, 14);
+ }
+ break;
+
+ case 28:
+ _val11 = 29;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ break;
+
+ case 29:
+ setup(5);
+ _val11 = 32;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ break;
+
+ case 32:
+ series_unload(_index1);
+ TerminateMachineAndNull(_series2);
+ _val11 = 33;
+ series_play_("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
+ digi_preload_stream_breaks(STREAMS1);
+ series_stream_with_breaks(STREAMS1, "102ha02", 6, 3840, 3);
+ break;
+
+ case 33:
+ digi_unload_stream_breaks(STREAMS1);
+ _val14 = 62;
+ _val13 = 58;
+ kernel_trigger_dispatch_now(4);
+ digi_stop(2);
+ _index2 = series_load("102ha03", -1);
+ _val11 = 34;
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 34:
+ _val11 = 35;
+ _val12 = 35;
+ kernel_trigger_dispatch_now(3);
+ hotspot_set_active("harry", false);
+ hotspot_set_active("harry ", true);
+ conv_resume();
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 20:
+ if (_val11 == 20) {
+ if (_play1) {
+ digi_play(_play1, 1, 255, 26);
+ _play1 = nullptr;
+ }
+ if (_series3)
+ TerminateMachineAndNull(_series3);
+
+ _series3 = series_play_("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 24, 29);
+ } else {
+ TerminateMachineAndNull(_series3);
+ _series3 = nullptr;
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ }
+ break;
+
+ case 21:
+ if (_val11 == 21) {
+ if (_play1) {
+ digi_play(_play1, 1, 255, 26);
+ _play1 = nullptr;
+ }
+
+ _series3 = series_play_("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 31, 42);
+ } else {
+ TerminateMachineAndNull(_series3);
+ _series3 = nullptr;
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ }
+ break;
+
+ case 22:
+ _val12 = 23;
+ series_play_("102ha01", 2560, 2, 3, 6, 0, 100, 0, 0, 44, 48);
+ break;
+
+ case 23:
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 44, 46);
+ break;
+
+ case 24:
+ if (_val11 == 19) {
+ if (imath_ranged_rand(1, 15) == 1) {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ }
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 25:
+ if (_val11 == 19) {
+ if (imath_ranged_rand(1, 15) == 1) {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ }
+ } else {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ }
+ break;
+
+ case 26:
+ if (_val11 == 19) {
+ if (imath_ranged_rand(1, 17) == 1) {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 14, 14);
+ }
+ } else {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ }
+ break;
+
+ case 30:
+ if (_val11 == 19) {
+ if (imath_ranged_rand(1, 15) == 1) {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ }
+ } else {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ }
+ break;
+
+ case 31:
+ if (_val11 == 19) {
+ if (imath_ranged_rand(1, 15) == 1) {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ } else {
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 20);
+ }
+ } else {
+ _val12 = 19;
+ series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ }
+ break;
+
+ case 35:
+ switch (_val11) {
+ case 35:
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ if (!digi_play_state(2))
+ digi_play("102_030", 2, 255, -1);
+
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 4, 6);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 4, 6);
+ break;
+
+ case 2:
+ if (!digi_play_state(2))
+ digi_play("102_031", 2, 255, -1);
+
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 7, 8);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 7, 8);
+ break;
+
+ case 3:
+ if (!digi_play_state(2))
+ digi_play("102_032", 2, 255, -1);
+
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 9, 11);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ break;
+
+ case 4:
+ if (!digi_play_state(2))
+ digi_play("102_033", 2, 255, -1);
+
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 12, 15);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 12, 15);
+ break;
+
+ default:
+ break;
+ }
+
+ if (++_val5 > 24 && _val5 != -666 && player_commands_allowed()) {
+ _val5 = -666;
+ //error("TODO: conv_load_and_prepare");
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room102::pre_parser() {
@@ -184,13 +494,10 @@ const char *Room102::getDigi2(int num) const {
static const char *NAMES[35] = {
"102_011", "102_004", nullptr, "102_006", "102_008",
"102_009", "102_013", "102_005", "102_014", "102_023",
-
"102_020", "102_011", "102_015", "102_006", "102_007",
"102_016", "102_014", "102_015", "102_013", "102_011",
-
"102_003", "102_012", "102_008", "102_013", "102_021",
"102_011", "102_013", "102_010", "102_003", "102_005",
-
"102_010", "102_011", "102_021", "102_021", "102_012"
};
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index b838376bee2..f8b9d8af3a7 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -31,7 +31,6 @@ namespace Rooms {
class Room102 : public Room {
private:
int _val1 = 0;
- int _val2 = 0;
int _val3 = -1;
int _val4 = 0;
int _val5 = 0;
@@ -39,20 +38,24 @@ private:
int _val7 = 0;
int _val8 = 0;
int _val9 = 0;
- int _val10 = 99999;
+ uint32 _val10 = 99999;
int _val11 = 0;
int _val12 = 0;
int _val13 = 0;
int _val14 = 0;
- int _val15 = -1;
int _val16 = 0;
+ int _trigger = -1;
+ int _triggerMode = 0;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
machine *_laz1 = nullptr;
machine *_laz2 = nullptr;
- int _index1 = -1, _index2 = -1;
+ machine *_stream1 = nullptr;
+ int _index1 = 0, _index2 = 0;
+ const char *_play1 = nullptr;
- void setup(int val1, int val2);
+ void setup(int val1 = 0, int val2 = 1);
void setupWax();
void setupLaz();
const char *getDigi1(int num) const;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 6902cb9c95e..34a452ed33b 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -39,7 +39,7 @@ public:
virtual void pre_parser() {}
virtual void parser() {}
virtual void parser_code() {}
- virtual void error() {}
+ virtual void roomError() {}
virtual void shutdown() {}
virtual HotSpotRec *custom_hotspot_which(int x, int y) {
return nullptr;
@@ -145,7 +145,7 @@ public:
_activeRoom->parser_code();
}
void room_error() {
- _activeRoom->error();
+ _activeRoom->roomError();
}
void room_shutdown() {
_activeRoom->shutdown();
Commit: db15d2a225c1786f8f683c0275492ea64615882a
https://github.com/scummvm/scummvm/commit/db15d2a225c1786f8f683c0275492ea64615882a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 102 daemon case 3
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/burger.cpp
engines/m4/burger/core/conv.cpp
engines/m4/burger/core/conv.h
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 8c97cdf56e8..0d5717d5919 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -220,11 +220,15 @@ void conv_export_value(Conv *c, long val, int index) {
c->myCNode = ent_old;
}
+void conv_export_value_curr(long val, int index) {
+ conv_export_value(conv_get_handle(), val, index);
+}
+
void conv_export_pointer(Conv *c, long *val, int index) {
- long ent = 0, tag = 0, next;
+ long ent = 0, tag = 0, next;
decl_chunk *decl;
- long ent_old = 0;
- int i = 0;
+ long ent_old = 0;
+ int i = 0;
if (!c)
return;
@@ -254,6 +258,10 @@ void conv_export_pointer(Conv *c, long *val, int index) {
c->myCNode = ent_old;
}
+void conv_export_pointer_curr(long *val, int index) {
+ conv_export_pointer(conv_get_handle(), val, index);
+}
+
void conv_init(Conv *c) {
switch (c->exit_now) {
case CONV_OK:
@@ -942,7 +950,7 @@ static void conv_set_disp_default(void) {
_GC(conv_shading) = 75;
}
-Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box) {
+Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want_box) {
Conv *convers = nullptr;
long cSize = 0;
char fullpathname[MAX_FILENAME_SIZE];
@@ -1040,6 +1048,17 @@ done:
return convers;
}
+void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt) {
+ player_set_commands_allowed(false);
+
+ if (!ignoreIt) {
+ conv_load(filename, 10, 375, trigger, true);
+ conv_set_shading(100);
+ conv_set_text_colours(3, 1, 2, 22, 10, 14);
+ conv_set_font_spacing(10, 2);
+ }
+}
+
void conv_unload(Conv *c) {
mouse_unlock_sprite();
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 424e6c4ff97..285373a9a15 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -71,7 +71,8 @@ struct Converstation_Globals {
void conv_go(Conv *c);
};
-extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
+extern Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
+extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt = true);
extern void conv_unload(Conv *c);
extern void conv_shutdown();
@@ -93,7 +94,9 @@ extern int32 conv_whos_talking();
extern long conv_get_decl_val(decl_chunk *decl);
extern void conv_set_decl_val(decl_chunk *decl, long val);
extern void conv_export_value(Conv *c, long val, int index);
+extern void conv_export_value_curr(long val, int index);
extern void conv_export_pointer(Conv *c, long *val, int index);
+extern void conv_export_pointer_curr(long *val, int index);
extern void conv_set_font_spacing(int32 h, int32 v);
extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 393daf814b2..e20da233cc2 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -276,7 +276,7 @@ void BurgerEngine::syncFlags(Common::Serializer &s) {
void BurgerEngine::global_daemon() {
switch (_G(kernel).trigger) {
case gRESUME_CONVERSATION:
- conv_resume();
+ conv_resume_curr();
break;
case gSERIES_STREAM_BREAK:
diff --git a/engines/m4/burger/core/conv.cpp b/engines/m4/burger/core/conv.cpp
index ce7eaa3a9db..9f906369515 100644
--- a/engines/m4/burger/core/conv.cpp
+++ b/engines/m4/burger/core/conv.cpp
@@ -25,7 +25,13 @@
namespace M4 {
namespace Burger {
-void conv_resume() {
+void conv_play_curr() {
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ conv_play(conv_get_handle());
+}
+
+void conv_resume_curr() {
_G(flags)[V298] = 1;
_G(flags)[V299] = 1;
conv_resume(conv_get_handle());
diff --git a/engines/m4/burger/core/conv.h b/engines/m4/burger/core/conv.h
index d68198e9d47..a54697b8618 100644
--- a/engines/m4/burger/core/conv.h
+++ b/engines/m4/burger/core/conv.h
@@ -28,7 +28,8 @@
namespace M4 {
namespace Burger {
-extern void conv_resume();
+extern void conv_play_curr();
+extern void conv_resume_curr();
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index ffe6d847b1e..f17a307c63f 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -549,7 +549,7 @@ enum {
V511 = 511
};
-class Flags : public Common::Array<uint32> {
+class Flags : public Common::Array<long> {
private:
Common::Array<byte> _convSave;
public:
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index abb7fa41df3..17e2da7de11 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "common/textconsole.h"
#include "m4/burger/rooms/section1/room102.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
@@ -37,6 +36,37 @@ static const seriesStreamBreak STREAMS1[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak STREAMS2[] = {
+ { 13, "102_036", 2, 255, -1, 0, nullptr, 0 },
+ { 16, "102_037", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS3[] = {
+ { 13, "102_036", 2, 255, -1, 0, nullptr, 0 },
+ { 16, "102_037", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS4[] = {
+ { 6,"102_035", 2, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS5[] = {
+ STREAM_BREAK_END
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, 2, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 18, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
void Room102::init() {
_G(player).walker_in_this_scene = true;
@@ -46,7 +76,7 @@ void Room102::init() {
_val4 = 0;
_val5 = 0;
_val6 = 0;
- _val7 = 0;
+ _series4 = 0;
_val8 = 0;
_val9 = 0;
_val10 = 99999;
@@ -115,10 +145,11 @@ void Room102::init() {
void Room102::daemon() {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ int frame;
switch (_G(kernel).trigger) {
case 1:
- conv_resume();
+ conv_resume_curr();
break;
case 2:
ws_unhide_walker(_G(my_walker));
@@ -241,7 +272,7 @@ void Room102::daemon() {
kernel_trigger_dispatch_now(3);
hotspot_set_active("harry", false);
hotspot_set_active("harry ", true);
- conv_resume();
+ conv_resume_curr();
break;
default:
@@ -404,12 +435,312 @@ void Room102::daemon() {
if (++_val5 > 24 && _val5 != -666 && player_commands_allowed()) {
_val5 = -666;
- //error("TODO: conv_load_and_prepare");
+ conv_load_and_prepare("conv05", 20, 0);
+ conv_export_pointer_curr(&_G(flags)[V016], 0);
+ conv_play_curr();
+ }
+ break;
+
+ case 36:
+ _val12 = 36;
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ break;
+
+ case 37:
+ _val11 = 39;
+ _G(flags)[GLB_TEMP_5] = 2;
+ digi_preload_stream_breaks(STREAMS2);
+ series_play_("102ha09s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS2, "102ha09", 6, 256, 3);
+ break;
+
+ case 38:
+ _val11 = 40;
+ _G(flags)[GLB_TEMP_5] = 1;
+ digi_preload_stream_breaks(STREAMS3);
+ series_play_("102ha10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS3, "102ha10", 6, 256, 3);
+ break;
+
+ case 39:
+ digi_unload_stream_breaks(STREAMS2);
+ _val11 = 41;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 40:
+ digi_unload_stream_breaks(STREAMS3);
+ _val11 = 41;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 41:
+ _val13 = 65;
+ series_unload(_index2);
+ _val11 = 42;
+ sub1();
+
+ digi_preload_stream_breaks(STREAMS4);
+ series_play_("102ha04s", 1024, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS4, "102ha04", 6, 768, 3);
+ break;
+
+ case 42:
+ digi_unload_stream_breaks(STREAMS4);
+ digi_stop(2);
+ _val14 = 59;
+ _val13 = 58;
+ kernel_trigger_dispatch_now(4);
+
+ _index3 = series_load("102wi05", -1);
+ _index4 = series_load("102ha05", -1);
+ _val11 = 43;
+ _val12 = 43;
+
+ series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+
+ conv_load_and_prepare("conv06", 21, false);
+ conv_export_pointer_curr(&_val4, 0);
+ conv_export_value_curr(_G(flags)[V001], 1);
+ conv_play_curr();
+ _G(flags)[V017] = 1;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 36:
+ if (_val11 == 36) {
+ if (!digi_play_state(2)) {
+ ++_val6;
+
+ if (imath_ranged_rand(4, 6) < _val6) {
+ _val6 = 0;
+
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ digi_play("102_030", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("102_031", 2, 255, -1);
+ break;
+ case 3:
+ digi_play("102_032", 2, 255, -1);
+ break;
+ case 4:
+ digi_play("102_033", 2, 255, -1);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ while ((frame = imath_ranged_rand(16, 21)) == _val3) {
+ }
+
+ _val13 = frame;
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, frame, frame);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ _val13 = 35;
+ series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ }
+ break;
+
+ case 43:
+ switch (_val11) {
+ case 20:
+ frame = imath_ranged_rand(8, 11);
+ series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 21:
+ frame = imath_ranged_rand(12, 15);
+ series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 43:
+ frame = imath_ranged_rand(4, 7);
+ series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 44:
+ _val11 = 45;
+ series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 24);
+ series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 24);
+ break;
+
+ case 45:
+ series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 24, 24);
+ series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 24, 24);
+ break;
+
+ case 48:
+ _val11 = 49;
+ series_play_("102ha05", 2560, 2, 3, 6, 0, 100, 0, 0, 0, 3);
+ series_play_("102ha05s", 2561, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 49:
+ _val11 = 50;
+ series_play_("102ha05", 2818, 2, 3, 30, 0, 100, 0, 0, 8, 8);
+ series_play_("102ha05s", 2818, 2, -1, 30, 0, 100, 0, 0, 8, 8);
+ break;
+
+ case 50:
+ sub1();
+ series_unload(_index4);
+ series_unload(_index3);
+ _val13 = 65;
+ _val11 = 51;
+ series_play_with_breaks(PLAY1, "102ha11", 2560, 3, 3, 6, 100, 0, 0);
+ break;
+
+ case 51:
+ _index1 = series_load("102ha01", -1);
+ series_play_with_breaks(PLAY2, "102ha06", 2560, 25, 3, 6, 100, 0, 0);
+ hotspot_set_active("harry", true);
+ hotspot_set_active("harry ", false);
+
+ _G(flags)[V012] = 0;
+ if (!_flag1)
+ player_set_commands_allowed(true);
+ break;
+ }
+ break;
+
+ case 54:
+ switch (_val11) {
+ case 46:
+ TerminateMachineAndNull(_series1);
+ TerminateMachineAndNull(_series2);
+ _val11 = 47;
+ series_play_with_breaks(PLAY2, "102ha06", 2560, 3, 3, 6, 100, 0, 0);
+ hotspot_set_active("harry", true);
+ break;
+
+ case 47:
+ _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _index1 = series_load("102ha01", -1);
+ _val11 = 19;
+ _val12 = 19;
+
+ kernel_trigger_dispatch_now(3);
+ player_set_commands_allowed(true);
+
+ if (_G(flags)[V015] && !_G(flags)[V013])
+ queuePlay("102h202");
+
+ _G(flags)[V012] = 0;
+ ++_G(flags)[V015];
+ break;
+
+ case 53:
+ _val11 = 54;
+ _index5 = series_load("102ha07", -1);
+ series_play_("102ha07", 3840, 0, 3, 10, 0, 100, 0, 0, 0, 7);
+ series_play_("102ha07s", 3841, 0, -1, 10, 0, 100, 0, 0, 0, 7);
+
+ if (_G(flags)[V013]) {
+ _play1 = "102h204";
+ _val11 = 56;
+ _G(flags)[ROOM101_FLAG1] = 1;
+ } else {
+ _val11 = 55;
+ _play1 = _G(flags)[V015] ? "102h203" : "102h201";
+ }
+ break;
+
+ case 54:
+ series_play_("102ha07", 3840, 0, 3, 30, 0, 100, 0, 0, 23, 23);
+ series_play_("102ha07s", 3841, 0, -1, 30, 0, 100, 0, 0, 23, 23);
+
+ if (_play1) {
+ digi_play(_play1, 1, 255, 10);
+ _play1 = nullptr;
}
+ break;
+
+ case 55:
+ _val12 = 55;
+ series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 30, 30);
+ series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 30, 30);
+ break;
+
+ case 56:
+ _val12 = 56;
+ series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 9, 10);
+ series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 9, 10);
+ break;
+
+ case 57:
+ series_unload(_index5);
+ _val11 = 46;
+ series_play_("102ha08s", 3841, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS5, "102ha08", 6, 3840, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 55:
+ if (_val11 == 55) {
+ _series3 = series_play_("102ha07", 3840, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+ _series6 = series_play_("102ha07s", 3841, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+
+ if (_play1) {
+ digi_play(_play1, 1, 255, 10);
+ _play1 = nullptr;
+ kernel_timing_trigger(80, 16);
+ }
+ } else {
+ TerminateMachineAndNull(_series3);
+ TerminateMachineAndNull(_series6);
+ _series3 = nullptr;
+ _val12 = 54;
+ series_play_("102ha07", 3840, 2, 3, 6, 0, 100, 0, 0, 30, 30);
+ series_play_("102ha07s", 3841, 2, -1, 6, 0, 100, 0, 0, 30, 30);
}
break;
+
+ case 56:
+ if (_val11 == 56) {
+ _series3 = series_play_("102ha07", 3840, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+ _series6 = series_play_("102ha07s", 3841, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+
+ if (_play1) {
+ digi_play(_play1, 1, 255, 15);
+ _play1 = nullptr;
+ }
+ } else {
+ TerminateMachineAndNull(_series3);
+ TerminateMachineAndNull(_series6);
+ _series3 = nullptr;
+ _val12 = 54;
+ series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 20, 21);
+ series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 20, 21);
+ }
+ break;
+
+ default:
+ break;
}
break;
+
+ // TODO: More daemon stuff
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -504,6 +835,34 @@ const char *Room102::getDigi2(int num) const {
return (num >= 1 && num <= 35) ? NAMES[num - 1] : "102_024";
}
+void Room102::sub1() {
+ if (_series4) {
+ TerminateMachineAndNull(_series4);
+ TerminateMachineAndNull(_series5);
+ }
+}
+
+void Room102::queuePlay(const char *filename, int trigger, KernelTriggerType triggerMode) {
+ if (_val9) {
+ digi_stop(2);
+ _val9 = 0;
+ _val8 = 1;
+ }
+
+ _play1 = filename;
+ _val11 = 20;
+ _trigger = trigger;
+ _triggerMode = triggerMode;
+ player_set_commands_allowed(false);
+
+ term_message("spleen %d %d %d %d", _val12, _val11, 19, 20);
+
+ if (_val12 == 20) {
+ term_message("spleen2");
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(3);
+ }
+}
} // namespace Rooms
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index f8b9d8af3a7..6d28474f6ee 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -32,10 +32,9 @@ class Room102 : public Room {
private:
int _val1 = 0;
int _val3 = -1;
- int _val4 = 0;
+ long _val4 = 0;
int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
int _val8 = 0;
int _val9 = 0;
uint32 _val10 = 99999;
@@ -49,17 +48,25 @@ private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
machine *_laz1 = nullptr;
machine *_laz2 = nullptr;
machine *_stream1 = nullptr;
int _index1 = 0, _index2 = 0;
+ int _index3 = 0, _index4 = 0;
+ int _index5 = 0;
const char *_play1 = nullptr;
+ bool _flag1 = false;
void setup(int val1 = 0, int val2 = 1);
void setupWax();
void setupLaz();
const char *getDigi1(int num) const;
const char *getDigi2(int num) const;
+ void sub1();
+ void queuePlay(const char *filename, int trigger = 29, KernelTriggerType triggerMode = KT_DAEMON);
public:
Room102() : Room() {}
Commit: 4c8b8406966f56cf6b8391dd9405511e4e67efd0
https://github.com/scummvm/scummvm/commit/4c8b8406966f56cf6b8391dd9405511e4e67efd0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove underscore suffix from several series methods
Changed paths:
engines/m4/burger/core/play_break.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/rooms/section9/room901.cpp
engines/m4/burger/rooms/section9/room902.cpp
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/burger/walker.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index e62a6a26f4d..ede582c1bfb 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -79,12 +79,12 @@ static void set_next_series_play_break(int32 slot) {
// Play the series
if (player->digi_trigger) {
// Don't ask for the gSERIES_PLAY_BREAK trigger
- player->series_machine = series_play_(player->name, player->depth, player->current_break.flags, NO_TRIGGER,
+ player->series_machine = series_play(player->name, player->depth, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
} else { // ask for the gSERIES_PLAY_BREAK trigger
- player->series_machine = series_play_(player->name, player->depth, player->current_break.flags, (int16)slot + gSERIES_PLAY_BREAK_0,
+ player->series_machine = series_play(player->name, player->depth, player->current_break.flags, (int16)slot + gSERIES_PLAY_BREAK_0,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
@@ -92,7 +92,7 @@ static void set_next_series_play_break(int32 slot) {
// play the shadow series if necessary
if (player->with_shadow) {
- player->shadow_machine = series_play_(player->shadow_name, player->depth + 1, player->current_break.flags, NO_TRIGGER,
+ player->shadow_machine = series_play(player->shadow_name, player->depth + 1, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 9d8490e6283..0bd6fd12859 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -226,10 +226,10 @@ void Room101::daemon() {
case 1:
if (_val2 == 12) {
int frame = imath_ranged_rand(8, 10);
- series_play_("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+ series_play("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, frame, frame);
} else {
digi_preload("101_002");
- series_play_("101ha01", 3840, 0, 21, 6, 0, 100, 0, 0, 11, 13);
+ series_play("101ha01", 3840, 0, 21, 6, 0, 100, 0, 0, 11, 13);
}
break;
@@ -338,7 +338,7 @@ void Room101::daemon() {
if (_G(flags)[ROOM101_FLAG20])
series_load("101wi11s", -1, nullptr);
- _machine1 = series_play_("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine1 = series_play("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS6, "101wi14", 6, 256, 2);
break;
@@ -358,7 +358,7 @@ void Room101::daemon() {
break;
case 10:
- _machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine1 = series_play("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS1, "101wi13", 6, 256, 2);
break;
@@ -380,7 +380,7 @@ void Room101::daemon() {
break;
case 13:
- _machine1 = series_play_("101wi12s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine1 = series_play("101wi12s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS2, "101wi12", 6, 256, 2);
break;
@@ -399,7 +399,7 @@ void Room101::daemon() {
break;
case 16:
- _machine1 = series_play_("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine1 = series_play("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS3, "101wi13", 6, 256, 2);
break;
@@ -420,7 +420,7 @@ void Room101::daemon() {
break;
case 19:
- _machine1 = series_play_("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine1 = series_play("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS4, "101wi11", 6, 256, 2);
break;
@@ -431,7 +431,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
_G(roomVal1) = 18;
- series_play_("101ha01", 3840, 0, gTELEPORT, 6, 0, 100, 0, 0, 14, -1);
+ series_play("101ha01", 3840, 0, gTELEPORT, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
@@ -566,7 +566,7 @@ void Room101::daemon() {
_G(flags)[V005] = 1;
}
- series_play_("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, 0, 7);
+ series_play("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, 0, 7);
break;
case 18:
@@ -590,8 +590,8 @@ void Room101::daemon() {
break;
case 22:
- series_play_("101wi04", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
- series_play_("101wi04s", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ series_play("101wi04", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ series_play("101wi04s", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
break;
default:
@@ -708,7 +708,7 @@ void Room101::parser() {
}
void Room101::door() {
- _doorMachine = series_play_("101door", 3840, 0, -1, 10, -1, 100, 0, -53, 0, 0);
+ _doorMachine = series_play("101door", 3840, 0, -1, 10, -1, 100, 0, -53, 0, 0);
}
void Room101::loadSounds() {
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 17e2da7de11..04b28adcc2e 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -104,8 +104,8 @@ void Room102::init() {
hotspot_set_active("harry", false);
hotspot_set_active("harry ", false);
- _series1 = series_play_("102seat", 2560, 0, -1, 100, -1, 100, 0, 0, 0, 0);
- _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1 = series_play("102seat", 2560, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
setup(5, 0);
break;
@@ -118,7 +118,7 @@ void Room102::init() {
kernel_trigger_dispatch_now(3);
++_G(flags)[V015];
- _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
hotspot_set_active("harry ", false);
break;
}
@@ -180,47 +180,47 @@ void Room102::daemon() {
case 1:
case 2:
case 3:
- series_play_("102ha01", 2560, 1, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 2560, 1, 3, 4, 0, 100, 0, 0, 0, 0);
break;
case 6:
_val12 = 30;
- series_play_("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 19, 19);
+ series_play("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 19, 19);
break;
case 7:
_val12 = 31;
- series_play_("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 20, 23);
break;
case 8:
_val12 = 24;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
break;
case 9:
_val12 = 25;
- series_play_("102ha01", 2560, 0, 3, 7, 0, 100, 0, 0, 3, 4);
+ series_play("102ha01", 2560, 0, 3, 7, 0, 100, 0, 0, 3, 4);
break;
case 10:
_val12 = 23;
- series_play_("102ha01", 2560, 0, 3, 8, 0, 100, 0, 0, 46, 48);
+ series_play("102ha01", 2560, 0, 3, 8, 0, 100, 0, 0, 46, 48);
break;
default:
- series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 20:
_val12 = 20;
- series_play_("102ha01", 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 0, 3, 4, 0, 100, 0, 0, 24, 24);
break;
case 21:
_val12 = 21;
- series_play_("102ha01", 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 0, 3, 4, 0, 100, 0, 0, 30, 30);
break;
case 26:
_val11 = 27;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
break;
case 27:
@@ -230,26 +230,26 @@ void Room102::daemon() {
_val12 = 26;
kernel_trigger_dispatch_now(3);
} else {
- series_play_("102ha01", 2560, 0, 3, 60, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 2560, 0, 3, 60, 0, 100, 0, 0, 14, 14);
}
break;
case 28:
_val11 = 29;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
break;
case 29:
setup(5);
_val11 = 32;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
break;
case 32:
series_unload(_index1);
TerminateMachineAndNull(_series2);
_val11 = 33;
- series_play_("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
+ series_play("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
digi_preload_stream_breaks(STREAMS1);
series_stream_with_breaks(STREAMS1, "102ha02", 6, 3840, 3);
break;
@@ -262,8 +262,8 @@ void Room102::daemon() {
digi_stop(2);
_index2 = series_load("102ha03", -1);
_val11 = 34;
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
break;
case 34:
@@ -289,12 +289,12 @@ void Room102::daemon() {
if (_series3)
TerminateMachineAndNull(_series3);
- _series3 = series_play_("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 24, 29);
+ _series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 24, 29);
} else {
TerminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
}
break;
@@ -305,35 +305,35 @@ void Room102::daemon() {
_play1 = nullptr;
}
- _series3 = series_play_("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 31, 42);
+ _series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 31, 42);
} else {
TerminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
}
break;
case 22:
_val12 = 23;
- series_play_("102ha01", 2560, 2, 3, 6, 0, 100, 0, 0, 44, 48);
+ series_play("102ha01", 2560, 2, 3, 6, 0, 100, 0, 0, 44, 48);
break;
case 23:
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 44, 46);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 44, 46);
break;
case 24:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
}
break;
@@ -341,13 +341,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
}
break;
@@ -355,13 +355,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 17) == 1) {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 14, 14);
}
} else {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
}
break;
@@ -369,13 +369,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
}
} else {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
}
break;
@@ -383,13 +383,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
} else {
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 20);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 20);
}
} else {
_val12 = 19;
- series_play_("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
}
break;
@@ -401,32 +401,32 @@ void Room102::daemon() {
if (!digi_play_state(2))
digi_play("102_030", 2, 255, -1);
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 4, 6);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 4, 6);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 4, 6);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 4, 6);
break;
case 2:
if (!digi_play_state(2))
digi_play("102_031", 2, 255, -1);
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 7, 8);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 7, 8);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 7, 8);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 7, 8);
break;
case 3:
if (!digi_play_state(2))
digi_play("102_032", 2, 255, -1);
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 9, 11);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 9, 11);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 9, 11);
break;
case 4:
if (!digi_play_state(2))
digi_play("102_033", 2, 255, -1);
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 12, 15);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 12, 15);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 12, 15);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 12, 15);
break;
default:
@@ -443,15 +443,15 @@ void Room102::daemon() {
case 36:
_val12 = 36;
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
break;
case 37:
_val11 = 39;
_G(flags)[GLB_TEMP_5] = 2;
digi_preload_stream_breaks(STREAMS2);
- series_play_("102ha09s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("102ha09s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS2, "102ha09", 6, 256, 3);
break;
@@ -459,7 +459,7 @@ void Room102::daemon() {
_val11 = 40;
_G(flags)[GLB_TEMP_5] = 1;
digi_preload_stream_breaks(STREAMS3);
- series_play_("102ha10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("102ha10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS3, "102ha10", 6, 256, 3);
break;
@@ -482,7 +482,7 @@ void Room102::daemon() {
sub1();
digi_preload_stream_breaks(STREAMS4);
- series_play_("102ha04s", 1024, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("102ha04s", 1024, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS4, "102ha04", 6, 768, 3);
break;
@@ -498,8 +498,8 @@ void Room102::daemon() {
_val11 = 43;
_val12 = 43;
- series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
conv_load_and_prepare("conv06", 21, false);
conv_export_pointer_curr(&_val4, 0);
@@ -544,13 +544,13 @@ void Room102::daemon() {
}
_val13 = frame;
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, frame, frame);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, frame, frame);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, frame, frame);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, frame, frame);
} else {
_val13 = 35;
- series_play_("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
- series_play_("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
}
break;
@@ -558,43 +558,43 @@ void Room102::daemon() {
switch (_val11) {
case 20:
frame = imath_ranged_rand(8, 11);
- series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 21:
frame = imath_ranged_rand(12, 15);
- series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 43:
frame = imath_ranged_rand(4, 7);
- series_play_("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play_("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 44:
_val11 = 45;
- series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 24);
- series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 24);
+ series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 24);
+ series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 24);
break;
case 45:
- series_play_("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 24, 24);
- series_play_("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 24, 24);
+ series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 24, 24);
+ series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 24, 24);
break;
case 48:
_val11 = 49;
- series_play_("102ha05", 2560, 2, 3, 6, 0, 100, 0, 0, 0, 3);
- series_play_("102ha05s", 2561, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ series_play("102ha05", 2560, 2, 3, 6, 0, 100, 0, 0, 0, 3);
+ series_play("102ha05s", 2561, 2, -1, 6, 0, 100, 0, 0, 0, 3);
break;
case 49:
_val11 = 50;
- series_play_("102ha05", 2818, 2, 3, 30, 0, 100, 0, 0, 8, 8);
- series_play_("102ha05s", 2818, 2, -1, 30, 0, 100, 0, 0, 8, 8);
+ series_play("102ha05", 2818, 2, 3, 30, 0, 100, 0, 0, 8, 8);
+ series_play("102ha05s", 2818, 2, -1, 30, 0, 100, 0, 0, 8, 8);
break;
case 50:
@@ -630,7 +630,7 @@ void Room102::daemon() {
break;
case 47:
- _series2 = series_play_("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_index1 = series_load("102ha01", -1);
_val11 = 19;
_val12 = 19;
@@ -648,8 +648,8 @@ void Room102::daemon() {
case 53:
_val11 = 54;
_index5 = series_load("102ha07", -1);
- series_play_("102ha07", 3840, 0, 3, 10, 0, 100, 0, 0, 0, 7);
- series_play_("102ha07s", 3841, 0, -1, 10, 0, 100, 0, 0, 0, 7);
+ series_play("102ha07", 3840, 0, 3, 10, 0, 100, 0, 0, 0, 7);
+ series_play("102ha07s", 3841, 0, -1, 10, 0, 100, 0, 0, 0, 7);
if (_G(flags)[V013]) {
_play1 = "102h204";
@@ -662,8 +662,8 @@ void Room102::daemon() {
break;
case 54:
- series_play_("102ha07", 3840, 0, 3, 30, 0, 100, 0, 0, 23, 23);
- series_play_("102ha07s", 3841, 0, -1, 30, 0, 100, 0, 0, 23, 23);
+ series_play("102ha07", 3840, 0, 3, 30, 0, 100, 0, 0, 23, 23);
+ series_play("102ha07s", 3841, 0, -1, 30, 0, 100, 0, 0, 23, 23);
if (_play1) {
digi_play(_play1, 1, 255, 10);
@@ -673,20 +673,20 @@ void Room102::daemon() {
case 55:
_val12 = 55;
- series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 30, 30);
- series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 30, 30);
+ series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 30, 30);
+ series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 30, 30);
break;
case 56:
_val12 = 56;
- series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 9, 10);
- series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 9, 10);
+ series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 9, 10);
+ series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 9, 10);
break;
case 57:
series_unload(_index5);
_val11 = 46;
- series_play_("102ha08s", 3841, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("102ha08s", 3841, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS5, "102ha08", 6, 3840, 3);
break;
@@ -697,8 +697,8 @@ void Room102::daemon() {
case 55:
if (_val11 == 55) {
- _series3 = series_play_("102ha07", 3840, 4, -1, 6, -1, 100, 0, 0, 30, 33);
- _series6 = series_play_("102ha07s", 3841, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+ _series3 = series_play("102ha07", 3840, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+ _series6 = series_play("102ha07s", 3841, 4, -1, 6, -1, 100, 0, 0, 30, 33);
if (_play1) {
digi_play(_play1, 1, 255, 10);
@@ -710,15 +710,15 @@ void Room102::daemon() {
TerminateMachineAndNull(_series6);
_series3 = nullptr;
_val12 = 54;
- series_play_("102ha07", 3840, 2, 3, 6, 0, 100, 0, 0, 30, 30);
- series_play_("102ha07s", 3841, 2, -1, 6, 0, 100, 0, 0, 30, 30);
+ series_play("102ha07", 3840, 2, 3, 6, 0, 100, 0, 0, 30, 30);
+ series_play("102ha07s", 3841, 2, -1, 6, 0, 100, 0, 0, 30, 30);
}
break;
case 56:
if (_val11 == 56) {
- _series3 = series_play_("102ha07", 3840, 4, -1, 4, -1, 100, 0, 0, 11, 19);
- _series6 = series_play_("102ha07s", 3841, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+ _series3 = series_play("102ha07", 3840, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+ _series6 = series_play("102ha07s", 3841, 4, -1, 4, -1, 100, 0, 0, 11, 19);
if (_play1) {
digi_play(_play1, 1, 255, 15);
@@ -729,8 +729,8 @@ void Room102::daemon() {
TerminateMachineAndNull(_series6);
_series3 = nullptr;
_val12 = 54;
- series_play_("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 20, 21);
- series_play_("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 20, 21);
+ series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 20, 21);
+ series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 20, 21);
}
break;
@@ -798,11 +798,11 @@ void Room102::setupWax() {
void Room102::setupLaz() {
if (_G(flags)[V019]) {
- _laz1 = series_play_("102lazys", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
- _laz2 = series_play_("102lazss", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz1 = series_play("102lazys", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz2 = series_play("102lazss", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
} else {
- _laz1 = series_play_("102lazy2", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
- _laz2 = series_play_("102laz2s", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz1 = series_play("102lazy2", 512, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _laz2 = series_play("102laz2s", 513, 0, -1, 100, -1, 100, 0, 0, 0, 0);
}
}
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index cdbd500b435..832d0647e41 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -71,7 +71,7 @@ void Section1::updateWalker_(int x, int y, int dir, int trigger, bool mode) {
gr_backup_palette();
pal_fade_set_start(_G(master_palette), 0);
_series1 = series_load("110", -1, _G(master_palette));
- _play = series_play_("110", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _play = series_play("110", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
kernel_trigger_dispatch_now(mode ? 1032 : 1027);
kernel_timing_trigger(1, 1026);
@@ -167,7 +167,7 @@ void Section1::daemon() {
break;
case 1027:
_series2 = series_load("110bu01", -1, _G(master_palette));
- series_play_("110bu01", 0, 0, 1028, 6, 0, 100, 0, 0, 0, 8);
+ series_play("110bu01", 0, 0, 1028, 6, 0, 100, 0, 0, 0, 8);
_state1 = 2;
break;
case 1028:
@@ -177,7 +177,7 @@ void Section1::daemon() {
case 1029:
if (_state1 == 2) {
int frame = imath_ranged_rand(9, 12);
- series_play_("110bu01", 0, 0, 1029, 5, 0, 100, 0, 0, frame, frame);
+ series_play("110bu01", 0, 0, 1029, 5, 0, 100, 0, 0, frame, frame);
} else {
pal_fade_set_start(_G(master_palette), 0);
TerminateMachineAndNull(_play);
@@ -201,9 +201,9 @@ void Section1::daemon() {
case 1033:
if (_state1 == 2) {
int frame = imath_ranged_rand(0, 4);
- series_play_("110bu02", 0, 0, 1033, 5, 0, 100, 0, 0, frame, frame);
+ series_play("110bu02", 0, 0, 1033, 5, 0, 100, 0, 0, frame, frame);
} else {
- series_play_("110bu02", 0, 0, 1035, 5, 0, 100, 0, 0, 5, 16);
+ series_play("110bu02", 0, 0, 1035, 5, 0, 100, 0, 0, 5, 16);
}
break;
case 1034:
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index 9b84c74b17b..e08cbf2dc3d 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -62,7 +62,7 @@ void MenuRoom::drawButton(int index) {
btn._frame_disabled, btn._frame_enabled,
btn._frame_highlighted, btn._frame_pressed
};
- btn._machine = series_show_(_menuName, 0, 0, -1, -1, frame[btn._state], 100, btn._x1, btn._y1);
+ btn._machine = series_show(_menuName, 0, 0, -1, -1, frame[btn._state], 100, btn._x1, btn._y1);
}
void MenuRoom::drawButtons() {
diff --git a/engines/m4/burger/rooms/section9/room901.cpp b/engines/m4/burger/rooms/section9/room901.cpp
index 0aedaadcc3f..39d55766744 100644
--- a/engines/m4/burger/rooms/section9/room901.cpp
+++ b/engines/m4/burger/rooms/section9/room901.cpp
@@ -62,12 +62,12 @@ void Room901::init() {
case INTERACTIVE_DEMO:
case MAGAZINE_DEMO:
setButtons(DEMO_BUTTONS, 4);
- series_play_("901order", 0, 0, -1, 60, -1, 100, 165, 395, 0, -1);
+ series_play("901order", 0, 0, -1, 60, -1, 100, 165, 395, 0, -1);
break;
case WHOLE_GAME:
setButtons(GAME_BUTTONS, 2);
- series_play_("901order", 0, 0, -1, 60, -1, 100, 470, 245, 0, -1);
+ series_play("901order", 0, 0, -1, 60, -1, 100, 470, 245, 0, -1);
break;
}
diff --git a/engines/m4/burger/rooms/section9/room902.cpp b/engines/m4/burger/rooms/section9/room902.cpp
index 0cb92891596..2ce07940a9f 100644
--- a/engines/m4/burger/rooms/section9/room902.cpp
+++ b/engines/m4/burger/rooms/section9/room902.cpp
@@ -85,7 +85,7 @@ void Room902::daemon() {
series_unload(_seriesIndex);
_seriesIndex = series_load(_name, -1, _G(master_palette));
- series_show_(_name, 1, 64, 1, _duration + 60, 0, 100, 0, 0);
+ series_show(_name, 1, 64, 1, _duration + 60, 0, 100, 0, 0);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 100, 30, 5);
kernel_timing_trigger(_duration + 30, 2);
@@ -105,7 +105,7 @@ void Room902::daemon() {
break;
case 3:
- series_show_("902ob", 2, 64, -1, -1, 0, 100, 320, 430);
+ series_show("902ob", 2, 64, -1, -1, 0, 100, 320, 430);
break;
case 4:
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index 7f09fcea267..b525eb9a896 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -50,7 +50,7 @@ void Room903::init() {
_buttonsDrawn = false;
setButtons(BUTTONS, 6);
- series_show_("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
+ series_show("903logo", 0, 0, -1, -1, 0, 100, 386, 20);
if (_G(game).previous_room <= 0 || _G(game).previous_room == 951) {
kernel_trigger_dispatch_now(11);
@@ -142,7 +142,7 @@ void Room903::daemon() {
digi_play("903_001", 2, 155, -1);
pal_fade_set_start(_G(master_palette), 0);
- series_play_("903d", 1792, 16, 12, 8, 0, 100, -5, 50, 0, -1);
+ series_play("903d", 1792, 16, 12, 8, 0, 100, -5, 50, 0, -1);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, -1);
break;
@@ -155,7 +155,7 @@ void Room903::daemon() {
break;
case 14:
- series_show_("903d", 0, 0, -1, -1, 23);
+ series_show("903d", 0, 0, -1, -1, 23);
break;
case 15:
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 7f63c0febb8..d8ff1857d90 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -274,38 +274,38 @@ void wilbur_abduct(int trigger) {
switch (_G(walkTrigger)) {
case 1:
case 2:
- series_play_("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
- series_play_("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
break;
case 3:
case 4:
case 5:
- series_play_("999ab04", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab04", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
- series_play_("999ab04s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab04s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
break;
case 7:
case 8:
case 9:
- series_play_("999ab08", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab08", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
- series_play_("999ab08s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab08s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
break;
case 10:
case 11:
- series_play_("999ab10", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab10", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
- series_play_("999ab10s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab10s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
break;
default:
- series_play_("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
- series_play_("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
_G(player_info).x, _G(player_info).y);
break;
}
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 32f3c63b131..15c664f6b12 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -152,7 +152,7 @@ void series_set_frame_rate(machine *m, int32 newFrameRate) {
m->myAnim8->myRegs[IDX_CELS_FRAME_RATE] = newFrameRate << 16;
}
-machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+machine *series_show(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 duration, int32 index, int32 s, int32 x, int32 y) {
CHECK_SERIES
@@ -190,7 +190,7 @@ machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16
return m;
}
-machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+machine *series_play(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
int32 firstFrame, int32 lastFrame) {
CHECK_SERIES
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index cdbf592b985..1ac718800a9 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -63,9 +63,14 @@ extern machine *series_show_sprite(const char *seriesName, int32 index, int32 la
extern machine *series_play(char *seriesName, int32 loopCount, uint32 flags,
int32 s, int32 layer, int32 frameRate, int16 triggerNum,
bool stick_when_done);
-
+extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags,
+ int16 triggerNum, int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
+ int32 firstFrame = 0, int32 lastFrame = -1);
extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
+extern machine *series_show(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
+ int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
+
extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
int32 firstFrame, int32 lastFrame,
int32 s, int32 layer, int32 frameRate,
@@ -81,12 +86,6 @@ machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int
bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
void series_set_frame_rate(machine *m, int32 newFrameRate);
-extern machine *series_show_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
- int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
-extern machine *series_play_(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
- int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
- int32 firstFrame = 0, int32 lastFrame = -1);
-
} // namespace M4
#endif
Commit: 86f2a8cda18f9c0a82cd7603355fa794d7baf274
https://github.com/scummvm/scummvm/commit/86f2a8cda18f9c0a82cd7603355fa794d7baf274
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 102 daemon
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
engines/m4/burger/rooms/section1/section1.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 0ee5e6c7783..316195e4e45 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -277,7 +277,6 @@ void ws_demand_location(machine *myWalker, int32 x, int32 y) {
SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
}
-
static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, int32 facing) {
const int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
frac16 s;
@@ -327,7 +326,6 @@ void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger) {
SendWSMessage(TURN_TO_FACE << 16, 0, myWalker, 0, nullptr, 1);
}
-
void ws_nosepick(machine *myWalker, int32 seriesHash) {
Anim8 *myAnim8;
if ((!myWalker) || (!myWalker->myAnim8)) {
@@ -339,6 +337,9 @@ void ws_nosepick(machine *myWalker, int32 seriesHash) {
SendWSMessage(NOSEPICK << 16, 0, myWalker, 0, nullptr, 1);
}
+void ws_demand_location(int32 x, int32 y) {
+ ws_demand_location(_G(my_walker), x, y);
+}
void ws_hide_walker(machine *myWalker) {
if (!myWalker) {
@@ -358,6 +359,29 @@ void ws_unhide_walker(machine *myWalker) {
SendWSMessage(PLAYER_UNHIDE << 16, 0, myWalker, 0, nullptr, 1);
}
+void ws_demand_facing(int32 newFacing) {
+ ws_demand_facing(_G(my_walker), newFacing);
+}
+
+void ws_turn_to_face(int32 facing, int32 trigger) {
+ ws_turn_to_face(_G(my_walker), facing, trigger);
+}
+
+void ws_nosepick(int32 seriesHash) {
+ ws_nosepick(_G(my_walker), seriesHash);
+}
+
+void ws_hide_walker() {
+ ws_hide_walker(_G(my_walker));
+}
+
+void ws_unhide_walker() {
+ ws_unhide_walker(_G(my_walker));
+}
+
+void ws_walk(int32 x, int32 y, GrBuff **buffer, int16 trigger, int32 finalFacing, bool complete_walk) {
+ ws_walk(_G(my_walker), x, y, buffer, trigger, finalFacing, complete_walk);
+}
void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing) {
Anim8 *myAnim8;
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 9d179a1e05c..4600fa03f6d 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -47,12 +47,20 @@ extern void ws_demand_location(machine *myWalker, int32 x, int32 y);
extern void ws_demand_facing(machine *myWalker, int32 newFacing);
extern void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger);
extern void ws_nosepick(machine *myWalker, int32 seriesHash);
-
extern void ws_hide_walker(machine *myWalker);
extern void ws_unhide_walker(machine *myWalker);
+extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int32 finalFacing, bool complete_walk = true);
+
+extern void ws_demand_location(int32 x, int32 y);
+extern void ws_demand_facing(int32 newFacing);
+extern void ws_turn_to_face(int32 facing, int32 trigger);
+extern void ws_nosepick(int32 seriesHash);
+extern void ws_hide_walker();
+extern void ws_unhide_walker();
+extern void ws_walk(int32 x, int32 y, GrBuff **buffer, int16 trigger, int32 finalFacing, bool complete_walk = true);
+
extern void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing);
-extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int32 finalFacing, bool complete_walk = true);
extern bool ws_walk_init_system();
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 04b28adcc2e..87832eaf445 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -57,6 +57,16 @@ static const seriesStreamBreak STREAMS5[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak STREAMS6[] = {
+ { 13, "102w010", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS7[] = {
+ { 13, "102w010", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
static const seriesPlayBreak PLAY1[] = {
{ 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 8, 8, nullptr, 1, 255, 2, 0, 0, nullptr, 0 },
@@ -68,6 +78,19 @@ static const seriesPlayBreak PLAY2[] = {
PLAY_BREAK_END
};
+static const seriesPlayBreak PLAY3[] = {
+ { 6, 20, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 21, -1, nullptr, 1, 255, 9, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 0, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 14, "102_039", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room102::init() {
_G(player).walker_in_this_scene = true;
_val1 = 0;
@@ -739,6 +762,375 @@ void Room102::daemon() {
}
break;
+ case 4:
+ switch (_val14) {
+ case 59:
+ switch (_val13) {
+ case 58:
+ _series4 = series_play("102wi05", 2816, 0, 4, 10, -1, 100, 0, 0, 0, 0);
+ _series5 = series_play("102wi05s", 2817, 0, -1, 10, -1, 100, 0, 0, 0, 0);
+ break;
+
+ case 60:
+ frame = imath_ranged_rand(1, 5);
+ series_play("102wi05", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102wi05s", 2817, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 63:
+ sub1();
+ _val1 = 64;
+ _val13 = 58;
+ series_play_with_breaks(PLAY3, "102wi05", 2816, 4, 3, 6, 100, 0, 0);
+ break;
+
+ default:
+ sub1();
+ break;
+ }
+ break;
+
+ case 62:
+ switch (_val13) {
+ case 58:
+ _series4 = series_play("102wi03", 2816, 0, -1, 600, -1, 100, 0, 0, 2, 2);
+ _series5 = series_play("102wi03s", 2816, 0, -1, 600, -1, 100, 0, 0, 2, 2);
+ break;
+
+ case 60:
+ sub1();
+ frame = imath_ranged_rand(0, 5);
+ _series4 = series_play("102wi03", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ _series5 = series_play("102wi03s", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 61:
+ sub1();
+ _val13 = 60;
+ series_play("102wi03", 2816, 1, 4, 6, 0, 100, 0, 0, 6, 9);
+ series_play("102wi03s", 2816, 1, -1, 6, 0, 100, 0, 0, 6, 9);
+ break;
+
+ default:
+ sub1();
+ break;
+ }
+ break;
+
+ case 64:
+ _val14 = 59;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6:
+ series_play("102tv01", 0, 4, -1, 5, -1, 100, 0, 0, 1, 4);
+ break;
+
+ case 8:
+ _series2 = series_play("102seats", 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ break;
+
+ case 9:
+ _val11 = 44;
+ break;
+
+ case 10:
+ _val11 = 57;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 11:
+ _series7 = series_play("102ha02s", 3841, 0, -1, 600, -1, 100, 0, 0, 40, 40);
+ break;
+
+ case 12:
+ series_set_frame_rate(_stream1, 30000);
+ ws_walk(_G(my_walker), 324, 341, 0, 13, 10, 1);
+ break;
+
+ case 13:
+ TerminateMachineAndNull(_series7);
+ series_play("102ha02s", 3841, 0, -1, 6, 0, 100, 0, 0, 42, -1);
+ series_set_frame_rate(_stream1, 6);
+ ws_OverrideCrunchTime(_stream1);
+ ws_demand_location(_G(my_walker), 321, 343);
+ ws_demand_facing(_G(my_walker), 4);
+ ws_hide_walker(_G(my_walker));
+ break;
+
+ case 14:
+ ws_hide_walker(_G(my_walker));
+ break;
+
+ case 15:
+ _val11 = 54;
+ kernel_trigger_dispatch_now(3);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ break;
+
+ case 16:
+ ws_walk(_G(my_walker), 318, 343, 0, -1, 2, 1);
+ break;
+
+ case 17:
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ break;
+
+ case 18:
+ _val8 = 1;
+ _val9 = 0;
+ _val11 = player_commands_allowed() && !digi_play_state(1) ? 26 : 19;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 19:
+ player_set_commands_allowed(true);
+ break;
+
+ case 21:
+ if (_G(flags)[V013]) {
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ } else {
+ player_set_commands_allowed(_flag1);
+ }
+ break;
+
+ case 23:
+ _val11 = 36;
+ player_set_commands_allowed(false);
+
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ digi_play("102h200a", 1, 255, 24);
+ break;
+ case 2:
+ digi_play("102h200b", 1, 255, 24);
+ break;
+ case 3:
+ digi_play("102h200c", 1, 255, 24);
+ break;
+ case 4:
+ digi_play("102h200d", 1, 255, 24);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 24:
+ player_set_commands_allowed(true);
+ _val11 = 35;
+ break;
+
+ case 25:
+ _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _val12 = 19;
+ _val11 = 19;
+ kernel_trigger_dispatch_now(3);
+ conv_resume_curr();
+ break;
+
+ case 26:
+ _val11 = 19;
+ _val10 = timer_read_60() + 600;
+
+ if (_trigger != -1) {
+ _G(kernel).trigger_mode = _triggerMode;
+ kernel_trigger_dispatch_now(_trigger);
+ _G(kernel).trigger_mode = oldMode;
+ _trigger = -1;
+ }
+ break;
+
+ case 28:
+ player_set_commands_allowed(true);
+ break;
+
+ case 29:
+ if (_G(flags)[V012] == 2)
+ player_set_commands_allowed(true);
+ _val11 = 19;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 1037:
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE)
+ freshen();
+ else
+ kernel_timing_trigger(60, 1037);
+ break;
+
+ case 10013:
+ break;
+
+ case 10014:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+
+ case gTELEPORT:
+ switch (_G(roomVal1)) {
+ case 1:
+ digi_unload("102_038");
+ ws_demand_location(628, 325);
+ ws_demand_facing(9);
+ _G(roomVal1) = 2;
+ ws_walk(435, 329, 0, gTELEPORT, 9, 1);
+ break;
+
+ case 2:
+ if (_G(flags)[V012] == 2) {
+ _G(walker).wilbur_speech("102w003", gTELEPORT);
+ } else if (_G(flags)[V012]) {
+ _G(roomVal1) = 5;
+
+ if (_G(flags)[V018]) {
+ _G(walker).wilbur_speech("102w002", gTELEPORT);
+ } else {
+ queuePlay("102h001", gTELEPORT);
+ }
+ }
+ break;
+
+ case 3:
+ _G(walker).wilbur_speech("102w004", gTELEPORT);
+ _G(roomVal1) = 4;
+ break;
+
+ case 4:
+ _val16 = 0;
+ player_set_commands_allowed(true);
+ break;
+
+ case 5:
+ if (_G(flags)[V018]) {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ queuePlay("102h002a");
+ break;
+ case 2:
+ queuePlay("102h002b");
+ break;
+ case 3:
+ queuePlay("102h002c");
+ break;
+ default:
+ break;
+ }
+ } else {
+ _val11 = 19;
+ kernel_trigger_dispatch_now(3);
+ _G(walker).wilbur_speech("102w001", 28);
+ _G(flags)[V018] = 1;
+ }
+ break;
+
+ case 71:
+ ws_hide_walker();
+ _G(roomVal1) = 72;
+ digi_preload_stream_breaks(STREAMS6);
+ series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, 10016);
+ break;
+
+ case 72:
+ digi_unload_stream_breaks(STREAMS6);
+ ws_unhide_walker();
+ _G(walker).wilbur_speech("102w011", 28);
+ break;
+
+ case 73:
+ ws_hide_walker();
+ _G(roomVal1) = 74;
+ digi_preload_stream_breaks(STREAMS7);
+ series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, 10016);
+ break;
+
+ case 74:
+ digi_unload_stream_breaks(STREAMS7);
+ ws_unhide_walker();
+ _G(walker).wilbur_speech("102w011", 28);
+ break;
+
+ case 75:
+ ws_hide_walker();
+ _G(roomVal1) = 76;
+ digi_preload_stream_breaks(STREAMS7);
+ digi_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, 10016);
+ break;
+
+ case 76:
+ digi_unload_stream_breaks(STREAMS6);
+ ws_unhide_walker();
+ _G(walker).wilbur_speech("102w011", 28);
+ break;
+
+ case 77:
+ ws_hide_walker();
+ _G(roomVal1) = 78;
+ digi_preload_stream_breaks(STREAMS7);
+ series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS7, "102wi10");
+ break;
+
+ case 78:
+ digi_unload_stream_breaks(STREAMS7);
+ ws_unhide_walker();
+ _G(walker).wilbur_speech("102w011", 28);
+ break;
+
+ case 79:
+ ws_hide_walker();
+ TerminateMachineAndNull(_laz1);
+ TerminateMachineAndNull(_laz2);
+ _G(flags)[V019] = 1;
+ _G(roomVal1) = 80;
+
+ if (!_G(flags)[V020])
+ digi_preload("102w008");
+
+ series_play_with_breaks(PLAY4, "102wi09", 256, 10016, 3, 6, 100, 0, 0);
+ break;
+
+ case 80:
+ ws_unhide_walker();
+
+ if (!_G(flags)[V020]) {
+ digi_play("102w008", 1, 255, 81);
+ _G(flags)[V020] = 1;
+ }
+
+ player_set_commands_allowed(true);
+ setupLaz();
+ setupWax();
+ break;
+
+ case 81:
+ digi_unload("102w008");
+ break;
+
+ case 82:
+ ws_hide_walker();
+ TerminateMachineAndNull(_laz1);
+ TerminateMachineAndNull(_laz2);
+ _G(flags)[V019] = 0;
+ _G(roomVal1) = 83;
+ series_play_with_breaks(PLAY4, "102wi08", 256, 10016, 3, 6, 100, 0, 0);
+ break;
+
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
// TODO: More daemon stuff
default:
@@ -864,6 +1256,19 @@ void Room102::queuePlay(const char *filename, int trigger, KernelTriggerType tri
}
}
+void Room102::freshen() {
+ if (_G(flags)[V012] == 2) {
+ player_set_commands_allowed(false);
+ _G(flags)[V012] = 0;
+ _val12 = 54;
+ _val11 = 53;
+
+ kernel_trigger_dispatch_now(3);
+ g_vars->getInterface()->freshen_sentence();
+ Section1::walk();
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 6d28474f6ee..45f91024d52 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -44,13 +44,14 @@ private:
int _val14 = 0;
int _val16 = 0;
int _trigger = -1;
- int _triggerMode = 0;
+ KernelTriggerType _triggerMode = KT_DAEMON;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
machine *_series4 = nullptr;
machine *_series5 = nullptr;
machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
machine *_laz1 = nullptr;
machine *_laz2 = nullptr;
machine *_stream1 = nullptr;
@@ -67,6 +68,7 @@ private:
const char *getDigi2(int num) const;
void sub1();
void queuePlay(const char *filename, int trigger = 29, KernelTriggerType triggerMode = KT_DAEMON);
+ void freshen();
public:
Room102() : Room() {}
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index d65e959ff0e..0f13bab2a7a 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -94,7 +94,7 @@ public:
static void updateWalker(int x, int y, int dir, int trigger, bool mode = false);
static void updateDisablePlayer();
- static void walk(int facing, int trigger = -1);
+ static void walk(int facing = -1, int trigger = -1);
};
} // namespace Rooms
Commit: c526ce5be4fb314ffd3cf8ccf786b467b7917534
https://github.com/scummvm/scummvm/commit/c526ce5be4fb314ffd3cf8ccf786b467b7917534
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 102 daemon fixes, added pre_parser
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 87832eaf445..c6954ce9b8c 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -832,7 +832,7 @@ void Room102::daemon() {
break;
case 8:
- _series2 = series_play("102seats", 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
break;
case 9:
@@ -1034,7 +1034,7 @@ void Room102::daemon() {
_G(roomVal1) = 72;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, 10016);
+ series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, gTELEPORT);
break;
case 72:
@@ -1048,7 +1048,7 @@ void Room102::daemon() {
_G(roomVal1) = 74;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, 10016);
+ series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, gTELEPORT);
break;
case 74:
@@ -1060,9 +1060,9 @@ void Room102::daemon() {
case 75:
ws_hide_walker();
_G(roomVal1) = 76;
- digi_preload_stream_breaks(STREAMS7);
- digi_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, 10016);
+ digi_preload_stream_breaks(STREAMS6);
+ series_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, gTELEPORT);
break;
case 76:
@@ -1076,7 +1076,7 @@ void Room102::daemon() {
_G(roomVal1) = 78;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi10");
+ series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, gTELEPORT);
break;
case 78:
@@ -1095,7 +1095,7 @@ void Room102::daemon() {
if (!_G(flags)[V020])
digi_preload("102w008");
- series_play_with_breaks(PLAY4, "102wi09", 256, 10016, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi09", 256, gTELEPORT, 3, 6, 100, 0, 0);
break;
case 80:
@@ -1121,9 +1121,15 @@ void Room102::daemon() {
TerminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
_G(roomVal1) = 83;
- series_play_with_breaks(PLAY4, "102wi08", 256, 10016, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi08", 256, gTELEPORT, 3, 6, 100, 0, 0);
break;
+ case 83:
+ ws_unhide_walker();
+ setupLaz();
+ setupWax();
+ player_set_commands_allowed(true);
+ break;
default:
_G(kernel).continue_handling_trigger = true;
@@ -1131,8 +1137,6 @@ void Room102::daemon() {
}
break;
- // TODO: More daemon stuff
-
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -1140,6 +1144,18 @@ void Room102::daemon() {
}
void Room102::pre_parser() {
+ if (player_said("main street") && !player_said_any("exit", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(3);
+
+ if (_G(flags)[V012] == 1) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(23);
+ _G(player).need_to_walk = false;
+ _G(kernel).trigger_mode = KT_PARSE;
+ g_vars->getInterface()->freshen_sentence();
+ } else if (player_said("talk to")) {
+ player_hotspot_walk_override(192, 327, 2, -1);
+ }
}
void Room102::parser() {
Commit: 6b4a6e7be1966e15ab5df3a2fc1d6bed67130599
https://github.com/scummvm/scummvm/commit/6b4a6e7be1966e15ab5df3a2fc1d6bed67130599
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 102 parser
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index c6954ce9b8c..ff49fe67811 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1159,8 +1159,159 @@ void Room102::pre_parser() {
}
void Room102::parser() {
+ bool lookFlag = player_said("look") || player_said("look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv04")) {
+ conv04();
+ } else if (player_said("conv05")) {
+ conv05();
+ } else if (player_said("talk to")) {
+ conv_load_and_prepare("conv04", 19, false);
+ conv_export_value_curr(_G(flags)[V017], 0);
+ conv_export_value_curr(_G(flags)[V016], 1);
+ conv_play_curr();
+ } else if (inv_player_has(_G(player).verb) && player_said("main street")) {
+ _G(walker).wilbur_speech("102w015");
+ } else if (player_said("exit") || player_said("gear", "main_street")) {
+ player_set_commands_allowed(false);
+ digi_preload("102_038");
+ digi_play("103_038", 2, 255, 17);
+ } else {
+ if (player_said("TAKE", "DOORWAY"))
+ _G(walker).wilbur_speech("102W003");
+
+ if (player_said("USE", "GO", "DOORWAY")) {
+ _G(roomVal1) = 1;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ }
+
+ if (player_said("USE", "GO", "FIRE ESCAPE")) {
+ _G(walker).wilbur_speech("102W005");
+ kernel_trigger_dispatch_now(1003);
+ }
+
+ if (player_said("TAKE", "LAZY SUSAN")) {
+ flagAction("102w007");
+ } else if (player_said("GEAR", "LAZY SUSAN")) {
+ if (_G(flags)[V012]) {
+ player_set_commands_allowed(false);
+ _G(roomVal1) = _G(flags)[V019] ? 82 : 79;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ } else {
+ queuePlay("102h005");
+ }
+ } else if (player_said("GEAR", "harry") || player_said("take", "harry")) {
+ _G(walker).wilbur_speech("102w015");
+ } else if (player_said("take", "hair wax") || player_said("take", "hair wax ")) {
+ if (_G(flags)[V012]) {
+ player_set_commands_allowed(false);
+ _G(roomVal1) = player_said("hair wax") ? 71 : 75;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ } else {
+ queuePlay("102h007");
+ }
+ } else if (player_said("gear", "hair wax") || player_said("gear", "hair wax ")) {
+ flagAction("102w012");
+ } else if (player_said("take", "television")) {
+ flagAction("102w018");
+ } else if (player_said("gear", "television")) {
+ flagAction("102w019");
+ } else if (player_said("take", "hair wax ") || player_said("take", "hair wax ")) {
+ if (_G(flags)[V012]) {
+ player_set_commands_allowed(false);
+ _G(roomVal1) = player_said("hair wax ") ? 73 : 77;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ } else {
+ queuePlay("102h007");
+ }
+ } else if (player_said("gear", "hair wax ") || player_said("gear", "hair wax ")) {
+ flagAction("102w012");
+ } else if (player_said("take", "back room") || player_said("gear", "back room")) {
+ _G(walker).wilbur_speech("102w015");
+ } else if (player_said("enter", "back room")) {
+ if (_G(flags)[V012]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play("102h015", 1, 255, 1);
+ break;
+ case 1:
+ freshen();
+ break;
+ default:
+ break;
+ }
+ } else {
+ queuePlay("102h014");
+ }
+ } else if (player_said("take", "barber's chair")) {
+ flagAction("102w021");
+ } else if (player_said("gear", "barber's chair")) {
+ flagAction("102w022");
+ } else if (player_said("take", "fish")) {
+ flagAction("102w025");
+ } else if (player_said("gear", "fish")) {
+ flagAction("102w026");
+ } else if (player_said("gear", "bottles")) {
+ _G(walker).wilbur_speech("102w029");
+ } else if (player_said("take", "bottles")) {
+ if (_G(flags)[V012]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play("102h023", 1, 255, 1);
+ player_set_commands_allowed(false);
+ break;
+ case 1:
+ _G(kernel).trigger_mode = KT_PARSE;
+ _G(walker).wilbur_speech("102w028");
+ break;
+ default:
+ break;
+ }
+ } else {
+ player_set_commands_allowed(false);
+ }
+ } else if (player_said("take", "towels")) {
+ _G(walker).wilbur_speech("102w2029");
+ } else if (player_said("gear", "towels")) {
+ flagAction("102w032");
+ } else if (player_said("take", "mirror")) {
+ _G(walker).wilbur_speech("102w015");
+ } else if (player_said("gear", "mirror")) {
+ flagAction("102w034");
+ } else if (player_said("take", "sink")) {
+ _G(walker).wilbur_speech("102w037");
+ } else if (player_said("gear", "sink")) {
+ // TODO
+ }
+
+ // TODO
+ }
}
+void Room102::flagAction(const char *name) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ if (_G(flags)[V012]) {
+ _G(walker).wilbur_speech(name);
+ } else {
+ _G(kernel).trigger_mode = KT_PARSE;
+ _G(walker).wilbur_speech(name);
+ player_set_commands_allowed(false);
+ }
+ break;
+ case 1:
+ queuePlay("102h018");
+ break;
+ default:
+ break;
+ }
+}
+
+
void Room102::setup(int val1, int val2) {
digi_stop(3);
@@ -1285,6 +1436,19 @@ void Room102::freshen() {
}
}
+void Room102::conv04() {
+ error("TODO: conv04");
+}
+
+void Room102::conv05() {
+ error("TODO: conv05");
+}
+
+void Room102::conv06() {
+ error("TODO: conv06");
+}
+
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 45f91024d52..9fe52434cec 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -69,6 +69,10 @@ private:
void sub1();
void queuePlay(const char *filename, int trigger = 29, KernelTriggerType triggerMode = KT_DAEMON);
void freshen();
+ void conv04();
+ void conv05();
+ void conv06();
+ void flagAction(const char *name);
public:
Room102() : Room() {}
Commit: 6dec7c988556d81c698cd734c6de2a1c95fcd2a9
https://github.com/scummvm/scummvm/commit/6dec7c988556d81c698cd734c6de2a1c95fcd2a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 102 parse
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index ff49fe67811..11a3882e03b 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1192,7 +1192,7 @@ void Room102::parser() {
}
if (player_said("TAKE", "LAZY SUSAN")) {
- flagAction("102w007");
+ flagAction("102w007", "102h004");
} else if (player_said("GEAR", "LAZY SUSAN")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
@@ -1212,11 +1212,11 @@ void Room102::parser() {
queuePlay("102h007");
}
} else if (player_said("gear", "hair wax") || player_said("gear", "hair wax ")) {
- flagAction("102w012");
+ flagAction("102w012", "102h007");
} else if (player_said("take", "television")) {
- flagAction("102w018");
+ flagAction("102w018", "102h012");
} else if (player_said("gear", "television")) {
- flagAction("102w019");
+ flagAction("102w019", "102h013");
} else if (player_said("take", "hair wax ") || player_said("take", "hair wax ")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
@@ -1226,7 +1226,7 @@ void Room102::parser() {
queuePlay("102h007");
}
} else if (player_said("gear", "hair wax ") || player_said("gear", "hair wax ")) {
- flagAction("102w012");
+ flagAction("102w012", "102h007");
} else if (player_said("take", "back room") || player_said("gear", "back room")) {
_G(walker).wilbur_speech("102w015");
} else if (player_said("enter", "back room")) {
@@ -1247,13 +1247,13 @@ void Room102::parser() {
queuePlay("102h014");
}
} else if (player_said("take", "barber's chair")) {
- flagAction("102w021");
+ flagAction("102w021", "102h016");
} else if (player_said("gear", "barber's chair")) {
- flagAction("102w022");
+ flagAction("102w022", "102h017");
} else if (player_said("take", "fish")) {
- flagAction("102w025");
+ flagAction("102w025", "102h019");
} else if (player_said("gear", "fish")) {
- flagAction("102w026");
+ flagAction("102w026", "102h020");
} else if (player_said("gear", "bottles")) {
_G(walker).wilbur_speech("102w029");
} else if (player_said("take", "bottles")) {
@@ -1277,34 +1277,109 @@ void Room102::parser() {
} else if (player_said("take", "towels")) {
_G(walker).wilbur_speech("102w2029");
} else if (player_said("gear", "towels")) {
- flagAction("102w032");
+ flagAction("102w032", "102h025");
} else if (player_said("take", "mirror")) {
_G(walker).wilbur_speech("102w015");
} else if (player_said("gear", "mirror")) {
- flagAction("102w034");
+ flagAction("102w034", "102h027");
} else if (player_said("take", "sink")) {
_G(walker).wilbur_speech("102w037");
} else if (player_said("gear", "sink")) {
+ flagAction("102w038", "102h029");
+ } else if (player_said("take", "stove")) {
+ _G(walker).wilbur_speech("102w040");
+ } else if (player_said("gear", "stove")) {
// TODO
+ flagAction("102w041", "102h031");
+ } else if (player_said("harry") && inv_player_has(_G(player).verb) && !_G(flags)[V012]) {
+ queuePlay(imath_ranged_rand(1, 2) == 1 ? "102h009y" : "102h009z");
+ } else if (lookFlag) {
+ if (player_said("Harry")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ if (!_G(flags)[V012]) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ _G(walker).wilbur_speech("102w014");
+ player_set_commands_allowed(false);
+ }
+ break;
+ case 1:
+ queuePlay("102h009", 2, KT_PARSE);
+ break;
+ case 2:
+ kernel_trigger_dispatch_now(3);
+ _G(kernel).trigger_mode = KT_PARSE;
+ kernel_timing_trigger(120, 3);
+ break;
+ case 3:
+ queuePlay("102h010");
+ break;
+ default:
+ break;
+ }
+ } else if (player_said("HAIR WAX") || player_said("HAIR WAX ")) {
+ flagAction("102w009", "102h006");
+ } else if (player_said("HAIR WAX ") || player_said("HAIR WAX ")) {
+ flagAction("102w013", "102h008");
+ } else if (player_said("LAZY SUSAN")) {
+ flagAction("102w005", "102h003");
+ } else if (player_said("television")) {
+ flagAction("102w017", "102h011");
+ } else if (player_said("back room")) {
+ if (_G(flags)[V012]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play("102h015", 1, 255, 1);
+ break;
+ case 1:
+ freshen();
+ break;
+ default:
+ break;
+ }
+ } else {
+ queuePlay("102h014");
+ }
+ } else if (player_said("barber's chair")) {
+ _G(walker).wilbur_speech("102W020");
+ } else if (player_said("fish")) {
+ flagAction("102w023", "102h018");
+ } else if (player_said("bottles")) {
+ flagAction("102w027", "102h021");
+ } else if (player_said("towels")) {
+ flagAction("102w030", "102h024");
+ } else if (player_said("mirror")) {
+ flagAction("102w033", "102h026");
+ } else if (player_said("sink")) {
+ flagAction("102w036", "102h028");
+ } else if (player_said("stove")) {
+ flagAction("102w039", "102h030");
+ } else {
+ return;
+ }
+ } else {
+ return;
}
-
- // TODO
}
+
+ _G(player).command_ready = false;
}
-void Room102::flagAction(const char *name) {
+void Room102::flagAction(const char *name1, const char *name2) {
switch (_G(kernel).trigger) {
case -1:
if (_G(flags)[V012]) {
- _G(walker).wilbur_speech(name);
+ _G(walker).wilbur_speech(name1);
} else {
_G(kernel).trigger_mode = KT_PARSE;
- _G(walker).wilbur_speech(name);
+ _G(walker).wilbur_speech(name1);
player_set_commands_allowed(false);
}
break;
case 1:
- queuePlay("102h018");
+ queuePlay(name2);
break;
default:
break;
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 9fe52434cec..3b67c2f1923 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -72,7 +72,7 @@ private:
void conv04();
void conv05();
void conv06();
- void flagAction(const char *name);
+ void flagAction(const char *name1, const char *name2);
public:
Room102() : Room() {}
Commit: 295bc491bf9cca3c34e1894601a7e46c4057aee7
https://github.com/scummvm/scummvm/commit/295bc491bf9cca3c34e1894601a7e46c4057aee7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room skeletons for section 8
Changed paths:
A engines/m4/burger/rooms/section8/room801.cpp
A engines/m4/burger/rooms/section8/room801.h
A engines/m4/burger/rooms/section8/room802.cpp
A engines/m4/burger/rooms/section8/room802.h
A engines/m4/burger/rooms/section8/section8.cpp
A engines/m4/burger/rooms/section8/section8.h
engines/m4/burger/burger.h
engines/m4/burger/flags.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 48d603b562c..e7e27e92c20 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -24,6 +24,7 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section8/section8.h"
#include "m4/burger/rooms/section9/section9.h"
namespace M4 {
@@ -38,7 +39,7 @@ private:
Rooms::Section1 _section5;
Rooms::Section1 _section6;
Rooms::Section1 _section7;
- Rooms::Section1 _section8;
+ Rooms::Section8 _section8;
Rooms::Section9 _section9;
/**
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index f17a307c63f..08c92b3d6d5 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -320,7 +320,7 @@ enum {
V285 = 285,
V286 = 286,
ROOM101_FLAG2 = 287,
- ROOM101_FLAG3 = 288,
+ NEURO_TEST_COUNTER = 288,
ROOM101_FLAG9 = 289,
ROOM101_FLAG7 = 290,
V291 = 291,
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index c38d2f1706a..285df1e41fd 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -137,6 +137,10 @@ void Section::tick() {
_G(kernel).trigger = oldTrigger;
}
+void Section::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section.h b/engines/m4/burger/rooms/section.h
index f0bbfcd9eaf..b04e38e9ce4 100644
--- a/engines/m4/burger/rooms/section.h
+++ b/engines/m4/burger/rooms/section.h
@@ -38,6 +38,7 @@ public:
void global_room_init() override;
void tick() override;
+ void daemon() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 0bd6fd12859..bb3c92d95e3 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -250,7 +250,7 @@ void Room101::daemon() {
case 6:
if (!_G(flags)[ROOM101_FLAG2]) {
- uint idx = _G(flags)[ROOM101_FLAG3];
+ uint idx = _G(flags)[NEURO_TEST_COUNTER];
assert(idx < 8);
static const char *const NAMES[8] = {
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
new file mode 100644
index 00000000000..89a4584a3fc
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -0,0 +1,200 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section8/room801.h"
+#include "m4/burger/rooms/section8/section8.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+static const seriesStreamBreak STREAMS1[] = {
+ { 0, "805_001", 3, 80, -1, 0, nullptr, 0 },
+ { 1, "805w001", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS2[] = {
+ { 1, "806f002", 1, 255, -1, 0, nullptr, 0 },
+ { 22, "806z002", 1, 255, -1, 0, nullptr, 0 },
+ { 36, "806f003", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS3[] = {
+ { 0, "803w001", 1, 255, -1, 0, nullptr, 0 },
+ { 59, "803z006", 1, 255, -1, 0, nullptr, 0 },
+ { 86, "803z007", 1, 255, -1, 0, nullptr, 0 },
+ { 116, "803z008", 1, 255, -1, 0, nullptr, 0 },
+ { 182, "803f005", 1, 255, -1, 0, nullptr, 0 },
+ { 220, "803z009", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS4[] = {
+ { 5, "802_014", 2, 255, -1, 0, nullptr, 0 },
+ { 16, "802f008", 1, 255, -1, 0, nullptr, 0 },
+ { 28, "802f009", 1, 255, -1, 0, nullptr, 0 },
+ { 87, "802_015", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS5[] = {
+ { 0, "807_001", 3, 255, -1, 0, nullptr, 0 },
+ { 0, "807_002", 2, 255, -1, 0, nullptr, 0 },
+ { 1, "804_003", 2, 255, -1, 0, nullptr, 0 },
+ { 3, "807_002", 2, 255, -1, 0, nullptr, 0 },
+ { 5, nullptr, 0, 0, 42, 0, nullptr, 0 },
+ { 6, "804_003", 2, 255, -1, 0, nullptr, 0 },
+ { 9, "807_002", 2, 255, -1, 0, nullptr, 0 },
+ { 12, "804_003", 2, 255, -1, 0, nullptr, 0 },
+ { 15, "807_002", 2, 255, -1, 0, nullptr, 0 },
+ { 28, "807_003", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS6[] = {
+ { 0, nullptr, 0, 0, 37, 0, nullptr, 0 },
+ { 5, "801w001", 1, 255, -1, 0, nullptr, 0 },
+ { 10, "801_001", 2, 75, -1, 0, nullptr, 0 },
+ { 33, "801_001", 2, 75, -1, 0, nullptr, 0 },
+ { 56, "801_001", 2, 75, -1, 0, nullptr, 0 },
+ { 74, "801_003", 2, 200, -1, 0, nullptr, 0 },
+ { 75, "801w002", 1, 255, -1, 0, nullptr, 0 },
+ { 97, nullptr, 0, 0, 38, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS7[] = {
+ { 0, nullptr, 0, 0, 37, 0, nullptr, 0 },
+ { 7, "801_003", 1, 175, -1, 0, nullptr, 0 },
+ { 23, "802_017", 2, 75, -1, 0, nullptr, 0 },
+ { 54, nullptr, 0, 0, 41, 0, nullptr, 0 },
+ { 61, "802f001", 1, 255, -1, 0, nullptr, 0 },
+ { 115, "802w002", 2, 255, -1, 0, nullptr, 0 },
+ { 119, "802f002", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS8[] = {
+ { 0, "803_008", 2, 175, -1, 0, nullptr, 0 },
+ { 10, "803_009", 1, 255, -1, 0, nullptr, 0 },
+ { 10, "803_002", 2, 200, -1, 0, nullptr, 0 },
+ { 32, "803z001", 1, 255, -1, 0, nullptr, 0 },
+ { 52, "803f001", 1, 255, -1, 0, nullptr, 0 },
+ { 58, "803_003", 2, 75, -1, 0, nullptr, 0 },
+ { 68, "803z002", 1, 255, -1, 0, nullptr, 0 },
+ { 160, "803z003", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS9[] = {
+ { 3, "804_002", 2, 150, -1, 0, nullptr, 0 },
+ { 14, "804_003", 2, 150, -1, 0, nullptr, 0 },
+ { 17, "804_003", 2, 150, -1, 0, nullptr, 0 },
+ { 23, "804_004", 2, 150, -1, 0, nullptr, 0 },
+ { 39, "804z001", 1, 255, -1, 0, nullptr, 0 },
+ { 72, "804f002", 1, 255, -1, 0, nullptr, 0 },
+ { 93, "804z002", 1, 255, -1, 0, nullptr, 0 },
+ { 109, "804z003", 1, 255, -1, 0, nullptr, 0 },
+ { 177, "804f003", 1, 255, -1, 0, nullptr, 0 },
+ { 204, "804f004", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
+void Room801::init() {
+ const char *HEADER = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++";
+ _G(player).walker_in_this_scene = false;
+ interface_hide();
+ player_set_commands_allowed(false);
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 0, -1);
+ _val1 = 10;
+ digi_preload("800_001");
+
+ if (_G(flags)[GLB_TEMP_5] == 1) {
+ term_message(HEADER);
+ term_message("Toxic wax in hair");
+
+ digi_preload_stream_breaks(STREAMS1);
+ digi_preload_stream_breaks(STREAMS2);
+ digi_preload_stream_breaks(STREAMS3);
+ digi_preload_stream_breaks(STREAMS4);
+ digi_preload_stream_breaks(STREAMS5);
+
+ kernel_trigger_dispatch_now(20);
+ } else {
+ switch (_G(flags)[NEURO_TEST_COUNTER]) {
+ case 0:
+ term_message(HEADER);
+ term_message("FIRST ATTEMPT AT NEURO TEST");
+
+ digi_preload_stream_breaks(STREAMS6);
+ digi_preload_stream_breaks(STREAMS7);
+ digi_preload_stream_breaks(STREAMS8);
+
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 0, -1);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 1:
+ term_message(HEADER);
+ term_message("SECOND ATTEMPT AT NEURO TEST");
+ digi_preload_stream_breaks(STREAMS8);
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 2:
+ term_message(HEADER);
+ term_message("THIRD ATTEMPT AT NEURO TEST");
+ digi_preload_stream_breaks(STREAMS8);
+ kernel_trigger_dispatch_now(41);
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ default:
+ term_message(HEADER);
+ term_message("FOURTH OR GREATER ATTEMPT AT NEURO TEST");
+ digi_preload_stream_breaks(STREAMS5);
+ kernel_trigger_dispatch_now(20);
+ break;
+ }
+ }
+}
+
+void Room801::daemon() {
+ warning("TODO: Room 801 daemon");
+}
+
+void Room801::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv80")) {
+ kernel_trigger_dispatch_now(14);
+ _G(player).command_ready = false;
+ }
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/room801.h b/engines/m4/burger/rooms/section8/room801.h
new file mode 100644
index 00000000000..747bf7a8593
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/room801.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION8_ROOM801_H
+#define M4_BURGER_ROOMS_SECTION8_ROOM801_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room801 : public Room {
+private:
+ int _val1 = 10;
+
+public:
+ Room801() : Room() {}
+ ~Room801() override {}
+
+ void init() override;
+ void daemon() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
new file mode 100644
index 00000000000..e59c348614d
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section8/room802.h"
+#include "m4/burger/rooms/section8/section8.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+static const seriesStreamBreak STREAMS1[] = {
+ { 0, "802_012", 1, 150, -1, 0, nullptr, 0 },
+ { 8, "802_003", 2, 175, -1, 0, nullptr, 0 },
+ { 24, "802_010", 2, 255, -1, 0, nullptr, 0 },
+ { 33, "802f004", 1, 255, -1, 0, nullptr, 0 },
+ { 46, "801_003", 2, 150, -1, 0, nullptr, 0 },
+ { 63, nullptr, 0, 0, 24, 0, nullptr, 0 },
+ { 66, "802_007", 2, 150, -1, 0, nullptr, 0 },
+ { 68, "802f005", 1, 255, -1, 0, nullptr, 0 },
+ { 112, "802f006", 1, 255, -1, 0, nullptr, 0 },
+ { 194, "802f007", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+void Room802::init() {
+ _G(player).walker_in_this_scene = false;
+ interface_hide();
+ player_set_commands_allowed(false);
+ digi_preload("800_001");
+ pal_fade_set_start(_G(master_palette), 0);
+ pal_fade_init(_G(master_palette), 0, 255, 100, 40, -1);
+
+ _val1 = 11;
+ _val2 = 2;
+ _val3 = 0;
+ _val4 = 0;
+
+ if (_G(flags)[NEURO_TEST_COUNTER] > 1) {
+ kernel_trigger_dispatch_now(24);
+ digi_preload_stream_breaks(STREAMS1);
+ kernel_trigger_dispatch_now(14);
+ } else {
+ kernel_trigger_dispatch_now(1);
+ }
+}
+
+void Room802::daemon() {
+ warning("TODO: room 802 daemon");
+}
+
+void Room802::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv81")) {
+ kernel_trigger_dispatch_now(19);
+ _G(player).command_ready = false;
+ }
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/room802.h b/engines/m4/burger/rooms/section8/room802.h
new file mode 100644
index 00000000000..f438c2a0b6c
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/room802.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION8_ROOM802_H
+#define M4_BURGER_ROOMS_SECTION8_ROOM802_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room802 : public Room {
+private:
+ int _val1 = 11;
+ int _val2 = 2;
+ int _val3 = 0;
+ int _val4 = 0;
+public:
+ Room802() : Room() {}
+ ~Room802() override {}
+
+ void init() override;
+ void daemon() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section8/section8.cpp b/engines/m4/burger/rooms/section8/section8.cpp
new file mode 100644
index 00000000000..a580390e26b
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/section8.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section8/section8.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section8::Section8() : Rooms::Section() {
+ add(801, &_room801);
+ add(802, &_room802);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/section8.h b/engines/m4/burger/rooms/section8/section8.h
new file mode 100644
index 00000000000..52e2edad83e
--- /dev/null
+++ b/engines/m4/burger/rooms/section8/section8.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION8_H
+#define M4_BURGER_ROOMS_SECTION8_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section8/room801.h"
+#include "m4/burger/rooms/section8/room802.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section8 : public Rooms::Section {
+private:
+ Room801 _room801;
+ Room802 _room802;
+
+public:
+ Section8();
+ virtual ~Section8() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index f23b78114b6..5613253bb1d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -110,6 +110,9 @@ MODULE_OBJS = \
burger/rooms/section1/room174.o \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
+ burger/rooms/section8/section8.o \
+ burger/rooms/section8/room801.o \
+ burger/rooms/section8/room802.o \
burger/rooms/section9/section9.o \
burger/rooms/section9/menu_room.o \
burger/rooms/section9/room901.o \
Commit: 0c6689430239d2944b7b17c852085475e774949e
https://github.com/scummvm/scummvm/commit/0c6689430239d2944b7b17c852085475e774949e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented digi_ticks_to_play
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index d66bd17e186..86b17200f91 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -215,6 +215,20 @@ int Digi::get_overall_volume() {
return _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType);
}
+int32 Digi::ticks_to_play(const char *name, int roomNum) {
+ // Get the file and retrieve it's size
+ Common::String filename = expand_name_2_RAW(name, roomNum);
+ SysFile sf(filename);
+ double size = sf.size();
+ sf.close();
+
+ term_message(" digi_ticks_to_play");
+ term_message(" %s", filename.c_str());
+ term_message(" size = %f, room = %d", size, roomNum);
+
+ return (int32)floor(size * 0.000090702946 * 60.0);
+}
+
} // namespace Sound
bool digi_preload(const Common::String &name, int roomNum) {
@@ -257,8 +271,8 @@ int digi_get_overall_volume() {
return _G(digi).get_overall_volume();
}
-int32 digi_ticks_to_play(const char *name, int val2) {
- error("TODO: digi_ticks_to_play");
+int32 digi_ticks_to_play(const char *name, int roomNum) {
+ return _G(digi).ticks_to_play(name, roomNum);
}
} // namespace M4
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 7d78592ad03..33d0b57df54 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -97,6 +97,7 @@ public:
void set_overall_volume(int vol);
int get_overall_volume();
+ int32 ticks_to_play(const char *name, int roomNum = -1);
};
} // namespace Sound
@@ -111,7 +112,7 @@ extern bool digi_play_state(int channel);
extern void digi_change_volume(int channel, int vol);
extern void digi_set_overall_volume(int vol);
extern int digi_get_overall_volume();
-extern int32 digi_ticks_to_play(const char *name, int val2 = -1);
+extern int32 digi_ticks_to_play(const char *name, int roomNum = -1);
} // namespace M4
Commit: e14b28a48d748baabc29e8624e9df16aba86de03
https://github.com/scummvm/scummvm/commit/e14b28a48d748baabc29e8624e9df16aba86de03
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 102 startup fixes
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 11a3882e03b..adcffc6c26d 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -149,10 +149,11 @@ void Room102::init() {
_trigger = -1;
if (_G(game).previous_room == -2) {
- ws_demand_location(_G(my_walker), 321, 343);
- ws_demand_facing(_G(my_walker), 4);
- ws_hide_walker(_G(my_walker));
-
+ if (_G(flags)[V012] == 1) {
+ ws_demand_location(321, 343);
+ ws_demand_facing(4);
+ ws_hide_walker();
+ }
} else {
_G(roomVal1) = 1;
_val16 = 1;
@@ -233,12 +234,12 @@ void Room102::daemon() {
case 20:
_val12 = 20;
- series_play("102ha01", 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
break;
case 21:
_val12 = 21;
- series_play("102ha01", 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
break;
case 26:
@@ -984,8 +985,9 @@ void Room102::daemon() {
case 2:
if (_G(flags)[V012] == 2) {
+ _G(roomVal1) = 3;
_G(walker).wilbur_speech("102w003", gTELEPORT);
- } else if (_G(flags)[V012]) {
+ } else if (_G(flags)[V012] == 0) {
_G(roomVal1) = 5;
if (_G(flags)[V018]) {
Commit: 452aa1aba1eaae60bf0458b55e94d2635894c006
https://github.com/scummvm/scummvm/commit/452aa1aba1eaae60bf0458b55e94d2635894c006
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further room 102 startup fixes
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/platform/sound/digi.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index adcffc6c26d..e5adc2e4f17 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -357,6 +357,7 @@ void Room102::daemon() {
series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
+ _val12 = 19;
series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
}
break;
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 86b17200f91..97b32e1d919 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -190,11 +190,10 @@ void Digi::read_another_chunk() {
if (c._trigger != -1 && !_mixer->isSoundHandleActive(c._soundHandle)) {
int trigger = c._trigger;
c._trigger = -1;
+ stop(channel);
// Dispatch the trigger
kernel_trigger_dispatchx(trigger);
-
- stop(channel);
}
}
}
Commit: 4ba5d3685957d3f7ce6d0307cf628f092d40c530
https://github.com/scummvm/scummvm/commit/4ba5d3685957d3f7ce6d0307cf628f092d40c530
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing room 104
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room104.h
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 0d5717d5919..fb83fd709eb 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -83,11 +83,11 @@ void cdd_init(void) {
_G(cdd).mesg_snd_file = nullptr;
}
-void set_conv_name(char *s) {
+void set_conv_name(const char *s) {
Common::strcpy_s(_GC(conv_name), s);
}
-char *get_conv_name(void) {
+const char *get_conv_name() {
return _GC(conv_name);
}
@@ -127,7 +127,7 @@ long conv_current_node(void) {
return 0;
}
-void conv_reset(char *filename) {
+void conv_reset(const char *filename) {
Conv *c = nullptr;
_GC(restore_conv) = 0;
@@ -140,7 +140,7 @@ void conv_reset_all(void) {
_G(conversations).conv_reset_all();
}
-char *conv_sound_to_play(void) {
+const char *conv_sound_to_play(void) {
return _G(cdd).mesg_snd_file;
}
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 285373a9a15..16f0ca5f5d4 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -86,9 +86,9 @@ extern void conv_reset(char *filename);
extern void conv_reset_all();
extern void conv_play(Conv *c);
-extern void set_conv_name(char *s);
-extern char *get_conv_name();
-extern char *conv_sound_to_play();
+extern void set_conv_name(const char *s);
+extern const char *get_conv_name();
+extern const char *conv_sound_to_play();
extern int32 conv_whos_talking();
extern long conv_get_decl_val(decl_chunk *decl);
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 91c67787321..bbc72eb2e09 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -28,17 +28,142 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID1[][4] = {
+ { "TOWN HALL", "104W001", "104W002", "104w002" },
+ { "DOORS", "104W003", "104W002", nullptr },
+ { "STOLIE", "104W004", "104W002", "104W002" },
+ { "MAIN STREET", nullptr, "104W002", "104W002" },
+ { "AUNT POLLY'S HOUSE", nullptr, "104W002", "104W002" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
void Room104::init() {
_G(player).walker_in_this_scene = true;
+ _val1 = 0;
+ _val2 = 14;
+ _val3 = 0;
+
+ digi_preload("104_001");
+
+ switch (_G(game).previous_room) {
+ case 20:
+ break;
+
+ case 101:
+ _G(roomVal1) = 1;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 105:
+ _G(roomVal1) = 2;
+ digi_preload("104_005");
+ digi_play("104_005", 2, 255, 2);
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 107:
+ _G(roomVal1) = 3;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 170:
+ _G(roomVal1) = 4;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ default:
+ ws_demand_location(213, 297);
+ ws_demand_facing(5);
+ break;
+ }
+
+ static const char *NAMES[14] = {
+ "104W101", "104W100A", "104W100B", "104W100C", "104W100D",
+ "104W100E", "104W100F", "104W100G", "104s100a", "104s100b",
+ "104s100c", "104s100d", "104s100e", "104s101"
+ };
+ for (int i = 0; i < 14; ++i)
+ digi_preload(NAMES[i]);
+
+ digi_play_loop("104_001", 3, 200, -1);
+ _G(flags)[V028] = 1;
+ kernel_trigger_dispatch_now(3);
}
void Room104::daemon() {
}
void Room104::pre_parser() {
+ _G(kernel).call_daemon_every_loop = player_said("MAIN STREET") &&
+ player_said_any("look at", "enter");
}
void Room104::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(walker).wilbur_said(SAID1)) {
+ if (player_said("MAIN STREET") && player_said_any("look at", "enter")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+
+ } else if (player_said("ENTER", "DOORS") || player_said("ENTER", "DOOR HANDLE") ||
+ player_said("gear", "doors") || player_said("gear", "door handle")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1);
+
+ } else if (player_said("LOOK AT", "AUNT POLLY'S HOUSE")) {
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1017);
+
+ } else if (player_said("ENTER", "AUNT POLLY'S HOUSE")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1017);
+
+ } else if (player_said("talk to", "stolie")) {
+ if (_G(flags)[V028]) {
+ player_set_commands_allowed(false);
+
+ switch (_G(flags)[V027]) {
+ case 0:
+ _val2 = 12;
+ _G(walker).wilbur_speech_random("104W100A", "104W100B", "104W100C",
+ "104W100D", "104W100E", "104W100F", "104W100G");
+ break;
+ case 12:
+ _G(walker).wilbur_speech("104W101");
+ _G(flags)[V028] = 0;
+ player_set_commands_allowed(true);
+ break;
+ default:
+ _val2 = 10;
+ break;
+ }
+ } else {
+ _G(walker).wilbur_speech("104W101");
+ }
+ } else if (player_said("conv16")) {
+ conv();
+ } else {
+ return;
+ }
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room104::conv() {
+ if (conv_sound_to_play()) {
+ switch (conv_whos_talking()) {
+ case 0:
+ _val2 = 17;
+ kernel_trigger_dispatch_now(3);
+ break;
+ case 1:
+ _G(walker).wilbur_speech(conv_sound_to_play(), 10001);
+ break;
+ default:
+ break;
+ }
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room104.h b/engines/m4/burger/rooms/section1/room104.h
index d9cec0f34ec..03919f3c88c 100644
--- a/engines/m4/burger/rooms/section1/room104.h
+++ b/engines/m4/burger/rooms/section1/room104.h
@@ -29,6 +29,13 @@ namespace Burger {
namespace Rooms {
class Room104 : public Room {
+private:
+ int _val1 = 0;
+ int _val2 = 14;
+ int _val3 = 0;
+
+ void conv();
+
public:
Room104() : Room() {}
~Room104() override {}
Commit: febfb12860fb30803a43b0fe731bfd8699cdc1ef
https://github.com/scummvm/scummvm/commit/febfb12860fb30803a43b0fe731bfd8699cdc1ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 104
Changed paths:
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/adv_player.h
engines/m4/adv_r/conv_io.h
engines/m4/burger/core/play_break.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room104.h
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index fca0cc1bee8..e09f850d0ec 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -201,6 +201,10 @@ PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info) {
return player_info;
}
+PlayerInfo *player_update_info() {
+ return player_update_info(_G(my_walker), &_G(player_info));
+}
+
void player_set_facing_hotspot(int trigger) {
player_set_facing_at(trigger, _G(hotspot_x), _G(hotspot_y));
}
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index a67941fece5..e8c4aacacae 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -114,6 +114,7 @@ extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger =
extern bool player_commands_allowed();
extern PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
+extern PlayerInfo *player_update_info();
extern void adv_kill_digi_between_rooms(bool true_or_false);
extern void player_set_facing_hotspot(int trigger = -1);
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 16f0ca5f5d4..a6711daef2a 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -72,7 +72,7 @@ struct Converstation_Globals {
};
extern Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
-extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt = true);
+extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt);
extern void conv_unload(Conv *c);
extern void conv_shutdown();
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index d0509f21b14..8415a3a98cf 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -50,7 +50,7 @@ enum {
#define PLAY_BREAK_END { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
extern int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name,
- frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 0,
+ frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 6,
int32 scale = 100, int32 x = 0, int32 y = 0);
extern void digi_preload_play_breaks(const seriesPlayBreak list[]);
extern void digi_unload_play_breaks(const seriesPlayBreak list[]);
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index d12cf92d3ef..81689d3e36e 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -141,7 +141,7 @@ void Flags::reset1() {
(*this)[V018] = 0;
(*this)[V019] = 0;
(*this)[V023] = 0;
- (*this)[V027] = 0;
+ (*this)[WAKE_UP_STOLIE_COUNT] = 0;
(*this)[V028] = 0;
(*this)[V031] = 0;
(*this)[V032] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 08c92b3d6d5..c8b6a096d65 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -57,7 +57,7 @@ enum {
V024 = 24,
V025 = 25,
V026 = 26,
- V027 = 27,
+ WAKE_UP_STOLIE_COUNT = 27,
V028 = 28,
V029 = 29,
V030 = 30,
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index bbc72eb2e09..f25d982b194 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section1/room104.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
+#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
@@ -37,6 +38,18 @@ static const char *SAID1[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesPlayBreak PLAY1[] = {
+ { 1, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 23, "104S101", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 18, 28, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 29, 47, "104_003", 2, 150, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
void Room104::init() {
_G(player).walker_in_this_scene = true;
_val1 = 0;
@@ -91,6 +104,355 @@ void Room104::init() {
}
void Room104::daemon() {
+ int frame, frameRate;
+
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ player_update_info();
+
+ if (_G(player_info).y > 374) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ _G(kernel).call_daemon_every_loop = false;
+ }
+ }
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_play("104_006", 2, 255, 1005);
+ break;
+
+ case 2:
+ digi_unload("104_005");
+ break;
+
+ case 3:
+ switch (_val2) {
+ case 6:
+ _flag1 = false;
+ _val2 = 9;
+ series_play("104dr04", 512, 2, 3, 6, 0, 100, 0, 0, 0, 10);
+ series_play("104dr04s", 513, 2, -1, 6, 0, 100, 0, 0, 0, 10);
+ break;
+
+ case 8:
+ _flag1 = false;
+ _val2 = 13;
+ series_play("104dr04", 512, 2, 3, 6, 0, 100, 0, 0, 0, 10);
+ series_play("104dr04s", 513, 2, -1, 6, 0, 100, 0, 0, 0, 10);
+ break;
+
+ case 9:
+ _flag1 = false;
+ _val2 = 14;
+ series_play("104dr02", 512, 0, 3, 6, 0, 100, 0, 0, 0, 7);
+ series_play("104dr02s", 513, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 10:
+ digi_stop(2);
+ freeSeries();
+ _flag1 = true;
+ _series1 = series_play("104DR04", 512, 16, 4, 6, 0, 100, 0, 0, 0, 10);
+ _series2 = series_play("104DR04S", 513, 16, -1, 6, 0, 100, 0, 0, 0, 10);
+ break;
+
+ case 12:
+ freeSeries();
+ _val2 = 10;
+ series_play_with_breaks(PLAY1, "104DR03", 512, 3, 1);
+ break;
+
+ case 13:
+ _flag1 = false;
+ _val2 = 9;
+ series_play_with_breaks(PLAY2, "104dr01", 512, 3, 1);
+ break;
+
+ case 14:
+ if (!digi_play_state(2)) {
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val2 = 15;
+ series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 13, 14);
+ series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 13, 14);
+ return;
+ }
+
+ _val1 = 0;
+
+ switch (getRandom()) {
+ case 1:
+ digi_play("104s100a", 2, 125, -1);
+ break;
+ case 2:
+ digi_play("104s100b", 2, 125, -1);
+ _val1 = 100;
+ break;
+ case 3:
+ digi_play("104s100c", 2, 125, -1);
+ break;
+ case 4:
+ digi_play("104s100d", 2, 125, -1);
+ break;
+ case 5:
+ digi_play("104s100e", 2, 125, -1);
+ break;
+ default:
+ break;
+ }
+ }
+
+ _flag1 = false;
+ ++_val1;
+
+ frame = 0;
+ if (_val1 < 3)
+ frame = 22;
+ else if (_val1 < 14)
+ frame = 23;
+ else {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ frame = 22;
+ break;
+ case 2:
+ frame = 24;
+ break;
+ case 3:
+ frame = 25;
+ break;
+ default:
+ break;
+ }
+ }
+
+ frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
+ series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 15:
+ if (!digi_play_state(2)) {
+ switch (imath_ranged_rand(1, 6)) {
+ case 1:
+ _val2 = 14;
+ series_play("104dr02", 512, 2, 3, 8, 0, 100, 0, 0, 13, 14);
+ series_play("104dr02s", 513, 2, -1, 8, 0, 100, 0, 0, 13, 14);
+ return;
+ case 2:
+ _val2 = 16;
+ series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 20, 20);
+ series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 20, 20);
+ return;
+ default:
+ break;
+ }
+
+ _val1 = 0;
+
+ switch (getRandom()) {
+ case 1:
+ digi_play("104s100a", 2, 125, -1);
+ break;
+ case 2:
+ digi_play("104s100b", 2, 125, -1);
+ _val1 = 100;
+ break;
+ case 3:
+ digi_play("104s100c", 2, 125, -1);
+ break;
+ case 4:
+ digi_play("104s100d", 2, 125, -1);
+ break;
+ case 5:
+ digi_play("104s100e", 2, 125, -1);
+ break;
+ default:
+ break;
+ }
+
+ _flag1 = false;
+ ++_val1;
+
+ frame = 0;
+ if (_val1 < 3)
+ frame = 16;
+ else if (_val1 < 14)
+ frame = 18;
+ else {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ frame = 15;
+ break;
+ case 2:
+ frame = 17;
+ break;
+ case 3:
+ frame = 19;
+ break;
+ default:
+ break;
+ }
+ }
+
+ frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
+ series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
+ }
+ break;
+
+ case 16:
+ if (!digi_play_state(2)) {
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val2 = 15;
+ series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 20, 20);
+ series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 20, 20);
+ break;
+ } else {
+ switch (getRandom()) {
+ case 1:
+ digi_play("104s100a", 2, 125, -1);
+ break;
+ case 2:
+ digi_play("104s100b", 2, 125, -1);
+ _val1 = 100;
+ break;
+ case 3:
+ digi_play("104s100c", 2, 125, -1);
+ break;
+ case 4:
+ digi_play("104s100d", 2, 125, -1);
+ break;
+ case 5:
+ digi_play("104s100e", 2, 125, -1);
+ break;
+ default:
+ break;
+ }
+
+ _flag1 = false;
+ ++_val1;
+
+ frame = 0;
+ if (_val1 < 3)
+ frame = 16;
+ else if (_val1 < 14)
+ frame = 18;
+ else {
+ switch (getRandom()) {
+ case 1:
+ frame = 15;
+ break;
+ case 2:
+ frame = 17;
+ break;
+ case 3:
+ frame = 19;
+ break;
+ default:
+ break;
+ }
+ }
+
+ frameRate = (_val1 < 14) ? 15 : imath_ranged_rand(6, 15);
+ series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
+ }
+ }
+ break;
+
+ case 17:
+ freeSeries();
+ _flag1 = true;
+ _val2 = 18;
+ _series1 = series_play("104DR04", 512, 4, -1, 6, -1, 100, 0, 0, 11, 15);
+ _series2 = series_show("104DR04S", 513, 0, -1, -1, 11);
+ digi_play(conv_sound_to_play(), 1, 255, 3);
+ break;
+
+ case 18:
+ freeSeries();
+ _flag1 = true;
+ _series1 = series_show("104DR04", 512, 0, -1, -1, 11);
+ _series2 = series_show("104DR04S", 513, 0, -1, -1, 11);
+ conv_resume_curr();
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ conv_load_and_prepare("conv16", 5, false);
+ conv_export_pointer_curr(&_G(flags)[WAKE_UP_STOLIE_COUNT], 0);
+ conv_play_curr();
+ break;
+
+ case 5:
+ term_message("WAKE UP STOLIE COUNT = %d", _G(flags)[WAKE_UP_STOLIE_COUNT]);
+ if (!_G(flags)[WAKE_UP_STOLIE_COUNT]) {
+ term_message("AT END OF CONV? COUNT = %d", _G(flags)[WAKE_UP_STOLIE_COUNT]);
+ _G(flags)[V028] = 0;
+ _G(flags)[WAKE_UP_STOLIE_COUNT]++;
+ }
+
+ freeSeries();
+
+ switch (_G(flags)[WAKE_UP_STOLIE_COUNT]) {
+ case 1:
+ case 4:
+ case 7:
+ case 11:
+ _val2 = 6;
+ break;
+ case 2:
+ case 3:
+ case 5:
+ case 6:
+ case 8:
+ case 9:
+ case 10:
+ _val2 = 8;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(3);
+ player_set_commands_allowed(true);
+ break;
+
+ case gTELEPORT:
+ switch (_G(roomVal1)) {
+ case 1:
+ ws_demand_location(315, 373);
+ ws_demand_facing(10);
+ ws_walk(271, 348, 0, -1, 10);
+ break;
+ case 2:
+ ws_demand_location(208, 243);
+ ws_demand_facing(7);
+ ws_walk(180, 287, 0, -1, 7);
+ break;
+ case 3:
+ ws_demand_location(417, 361);
+ ws_demand_facing(3);
+ break;
+ case 4:
+ ws_demand_location(0, 326);
+ ws_demand_facing(3);
+ ws_walk(36, 338, 0, -1, 3);
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room104::pre_parser() {
@@ -122,7 +484,7 @@ void Room104::parser() {
if (_G(flags)[V028]) {
player_set_commands_allowed(false);
- switch (_G(flags)[V027]) {
+ switch (_G(flags)[WAKE_UP_STOLIE_COUNT]) {
case 0:
_val2 = 12;
_G(walker).wilbur_speech_random("104W100A", "104W100B", "104W100C",
@@ -166,6 +528,31 @@ void Room104::conv() {
}
}
+void Room104::freeSeries() {
+ if (_flag1) {
+ TerminateMachine(_series1);
+ TerminateMachine(_series2);
+ _flag1 = false;
+ }
+}
+
+int Room104::getRandom() const {
+ if (imath_ranged_rand(1, 4) == 1) {
+ return imath_ranged_rand(3, 4);
+ } else {
+ switch (imath_ranged_rand(1, 5)) {
+ case 1:
+ case 2:
+ return 1;
+ case 3:
+ return 2;
+ default:
+ return 5;
+ }
+ }
+}
+
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room104.h b/engines/m4/burger/rooms/section1/room104.h
index 03919f3c88c..7886711d143 100644
--- a/engines/m4/burger/rooms/section1/room104.h
+++ b/engines/m4/burger/rooms/section1/room104.h
@@ -33,8 +33,13 @@ private:
int _val1 = 0;
int _val2 = 14;
int _val3 = 0;
+ bool _flag1 = false;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
void conv();
+ void freeSeries();
+ int getRandom() const;
public:
Room104() : Room() {}
Commit: 555c0fcadd92c34febf3485e8eb32764b2ce58d5
https://github.com/scummvm/scummvm/commit/555c0fcadd92c34febf3485e8eb32764b2ce58d5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove unused gr series declarations
Changed paths:
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 1ac718800a9..91bfc932a15 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -57,21 +57,18 @@ extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
-extern machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
-extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
+//extern machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
+//extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
-extern machine *series_play(char *seriesName, int32 loopCount, uint32 flags,
- int32 s, int32 layer, int32 frameRate, int16 triggerNum,
- bool stick_when_done);
extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags,
int16 triggerNum, int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
int32 firstFrame = 0, int32 lastFrame = -1);
-extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
+//extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
extern machine *series_show(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
-extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
+/*extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
int32 firstFrame, int32 lastFrame,
int32 s, int32 layer, int32 frameRate,
int16 triggerNum, bool stick_when_done);
@@ -81,7 +78,7 @@ machine *series_ranged_play_xy(char *seriesName, int32 loopCount, uint32 flags,
int32 x, int32 y,
int32 s, int32 layer, int32 frameRate,
int16 triggerNum, bool stick_when_done);
-
+ */
machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger);
bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
void series_set_frame_rate(machine *m, int32 newFrameRate);
Commit: 1896b9018759adca02004b1c508a300e94b04328
https://github.com/scummvm/scummvm/commit/1896b9018759adca02004b1c508a300e94b04328
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 135 init/parser
Changed paths:
engines/m4/adv_r/conv_io.h
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room135.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index a6711daef2a..30df8066516 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -72,7 +72,7 @@ struct Converstation_Globals {
};
extern Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
-extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt);
+extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt = false);
extern void conv_unload(Conv *c);
extern void conv_shutdown();
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 73a482eb012..2eb86ae4047 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -27,7 +27,9 @@
#include "m4/burger/core/stream_break.h"
#include "m4/burger/core/conv.h"
#include "m4/adv_r/conv_io.h"
+#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
+#include "m4/adv_r/adv_hotspot.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 71653c404e9..4fdc5618055 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -22,23 +22,206 @@
#include "m4/burger/rooms/section1/room135.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
-#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID1[][4] = {
+ { "OLD BRIDGE", "134W001", "134W002", "134W002" },
+ { "NEW BRIDGE", "134W003", "134W002", "134W002" },
+ { "WATER", "134W004", "134W002", "134W005" },
+ { "BANK", "134W004", "134W002", "134W005" },
+ { "WRECKED TRUCK", nullptr, "134W002", "134w002" },
+ { "FORK IN THE ROAD", nullptr, "134W002", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const char *SAID2[][4] = {
+ { "ODIE", "135W001", "135W002", "135W002" },
+ { "OLD BRIDGE", "135W005", "135W002", "135W002" },
+ { "NEW BRIDGE", "135W006", "135W002", "135W002" },
+ { "WATER", "135W007", "135W002", "135W008" },
+ { "FORK IN THE ROAD", nullptr, "135W002", nullptr },
+ { "MAIN STREET", nullptr, "135W002", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
void Room135::init() {
_G(player).walker_in_this_scene = true;
+ _val1 = 255;
+ _val2 = 0;
+ _odieLoaded = false;
+ _val4 = 1000;
+ _val5 = 1;
+ _val6 = 1;
+
+ digi_preload("135_005");
+ digi_preload("135_002");
+ digi_preload("135_004");
+
+ switch (_G(game).previous_room) {
+ case -2:
+ break;
+
+ case 101:
+ if (_G(flags)[V000] == 1002)
+ _G(flags)[V039] = 1;
+
+ _G(roomVal1) = 37;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 133:
+ case 136:
+ if (_G(flags)[V000] == 1002)
+ _G(flags)[V039] = 1;
+
+ _G(roomVal1) = 38;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 135:
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(24);
+ _val6 = 22;
+ series_play_with_breaks(PLAY1, "134bu01");
+ ws_demand_location(340, 250);
+ ws_demand_facing(11);
+ break;
+
+ default:
+ ws_demand_location(320, 271);
+ ws_demand_facing(5);
+ break;
+ }
+
+ if (_G(flags)[V000] == 1002) {
+ hotspot_set_active("odie", false);
+ hotspot_set_active("baitbox", false);
+ } else {
+ hotspot_set_active("wrecked truck", false);
+ }
+
+ _G(global_sound_room) = 135;
+ _series1 = series_play("135cw01", 3840, 0, -1, 10, -1, 100, 0, 0, 0, 3);
+
+ if (!_G(flags)[V039])
+ kernel_trigger_dispatch_now(32);
+
+ digi_preload("135_001");
+ digi_play_loop("135_001", 3, 90, -1);
+
+ if (_G(flags)[V000] == 1002) {
+ _val7 = 27;
+ _val8 = 27;
+ kernel_trigger_dispatch_now(34);
+ kernel_timing_trigger(imath_ranged_rand(200, 500), 21);
+ }
}
void Room135::daemon() {
}
void Room135::pre_parser() {
+ if (player_said("fork in the road") && player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(9);
+
+ if (player_said("main street") && player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(3);
+
+ if (player_said("take", "baitbox") || player_said("gear", "baitbox"))
+ player_hotspot_walk_override(308, 249, 10, -1);
}
void Room135::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if ((_G(flags)[V000] == 1002 && !_G(walker).wilbur_said(SAID1)) ||
+ (_G(flags)[V000] != 1002 && !_G(walker).wilbur_said(SAID2))) {
+ if (player_said("ENTER", "FORK IN THE ROAD") || player_said("gear", "fork in the road") ||
+ (lookFlag && player_said("fork in the road"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1009);
+
+ } else if (player_said("ENTER", "MAIN STREET") || player_said("gear", "main street") ||
+ (lookFlag && player_said("main street"))) {
+ pal_fade_init(1001);
+ } else if (player_said("conv01")) {
+ conv01();
+ } else if (player_said("conv02")) {
+ conv02();
+ } else if (player_said("conv03")) {
+ conv03();
+ } else if (player_said("odie") && inv_player_has(_G(player).verb)) {
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ loadOdie();
+ _val9 = 31;
+ _val10 = 30;
+ kernel_trigger_dispatch_now(33);
+ } else if (inv_player_has(_G(player).verb) && player_said_any("fork in the road", "main street")) {
+ _G(walker).wilbur_speech("135w002");
+ } else if (lookFlag && player_said("baitbox")) {
+ _G(walker).wilbur_speech(_G(flags)[V038] ? "135w004" : "135w003");
+ } else if (lookFlag && player_said("wrecked truck")) {
+ _G(walker).wilbur_speech(_G(flags)[V038] ? "135w007" : "135w006");
+ } else if (player_said("take", "baitbox") || player_said("gear", "baitbox")) {
+ player_set_commands_allowed(false);
+ loadOdie();
+ _val9 = 34;
+ _val10 = 30;
+ kernel_trigger_dispatch_now(33);
+ } else if (player_said("talk to", "odie")) {
+ player_set_commands_allowed(false);
+ loadOdie();
+ _flag1 = true;
+ conv_load_and_prepare("conv03", 31);
+ conv_export_pointer_curr(&_G(flags)[V038], 1);
+ conv_export_value_curr(_G(flags)[V001], 3);
+ conv_play_curr();
+ } else if (player_said("conv06")) {
+ conv03();
+ }
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room135::conv01() {
+ error("TODO: conv01");
+}
+
+void Room135::conv02() {
+ error("TODO: conv02");
+}
+
+void Room135::conv03() {
+ error("TODO: conv03");
+}
+
+void Room135::loadOdie() {
+ static const char *NAMES[30] = {
+ "135od05", "135od05s", "135od06", "135od06s", "135od04",
+ "135od04s", "135od08", "135od08s", "135od09", "135od09s",
+ "135od10", "135od10s", "135od11", "135od11s", "135od12",
+ "135od12s", "135od13", "135od13s", "135od14", "135od14s",
+ "135od16", "135od16s", "135od17", "135od17s", "135od18",
+ "135od18s", "135od20", "135od20s", "135od21", "135od21s"
+ };
+
+ if (!_odieLoaded) {
+ _odieLoaded = true;
+
+ for (int i = 0; i < 30; ++i)
+ series_load(NAMES[i], -1);
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room135.h b/engines/m4/burger/rooms/section1/room135.h
index 9ad4d5893bc..5f9cbae43a3 100644
--- a/engines/m4/burger/rooms/section1/room135.h
+++ b/engines/m4/burger/rooms/section1/room135.h
@@ -29,6 +29,25 @@ namespace Burger {
namespace Rooms {
class Room135 : public Room {
+private:
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
+ int _val10 = 0;
+ bool _flag1 = false;
+ bool _odieLoaded = false;
+ machine *_series1 = nullptr;
+
+ void conv01();
+ void conv02();
+ void conv03();
+ void odie();
+
public:
Room135() : Room() {}
~Room135() override {}
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 39e18caad67..fdb7f62fd1c 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -562,6 +562,14 @@ void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry,
_G(pal_fade_in_progress) = true;
}
+void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum) {
+ pal_fade_init(_G(master_palette), firstPalEntry, lastPalEntry, targetPercent, numTicks, triggerNum);
+}
+
+void pal_fade_init(int32 triggerNum) {
+ pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, triggerNum);
+}
+
void disable_player_commands_and_fade_init(int trigger) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, trigger);
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index dbb3f54ce62..50b22e931f2 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -85,6 +85,9 @@ struct KernelPal_Globals {
extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
+extern void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
+extern void pal_fade_init(int32 triggerNum);
+
extern void disable_player_commands_and_fade_init(int trigger);
extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, int32 triggerNum);
Commit: 13b0b633f109b12eb711231334546d52756d5287
https://github.com/scummvm/scummvm/commit/13b0b633f109b12eb711231334546d52756d5287
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 135 daemon
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room135.h
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index fb83fd709eb..8eba4467935 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -103,6 +103,10 @@ void conv_resume(Conv *c) {
conv_go(c);
}
+void conv_resume() {
+ conv_resume(conv_get_handle());
+}
+
int conv_is_event_ready(void) {
return _GC(event_ready);
}
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 30df8066516..ca0ba74db99 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -81,6 +81,7 @@ extern Conv *conv_get_handle();
extern void conv_set_handle(Conv *c);
extern void conv_resume(Conv *c);
+extern void conv_resume();
extern void conv_reset(char *filename);
extern void conv_reset_all();
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 4fdc5618055..f05a119ed6b 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -47,14 +47,45 @@ static const char *SAID2[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesStreamBreak STREAMS1[] = {
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak STREAMS2[] = {
+ { 6, nullptr, 2, 255, 5, 0, nullptr, 0 },
+ { 10, "100_022", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
static const seriesPlayBreak PLAY1[] = {
{ 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 14, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
void Room135::init() {
_G(player).walker_in_this_scene = true;
- _val1 = 255;
+ _volume = 255;
_val2 = 0;
_odieLoaded = false;
_val4 = 1000;
@@ -126,6 +157,581 @@ void Room135::init() {
}
void Room135::daemon() {
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ _val2 = 1;
+ _val6 = 21;
+
+ if (_play1)
+ TerminateMachineAndNull(_play1);
+ TerminateMachineAndNull(_series1);
+ TerminateMachineAndNull(_series2);
+ TerminateMachineAndNull(_series3);
+ Section1::updateWalker(340, 250, 7, 4);
+ break;
+
+ case 2:
+ kernel_trigger_dispatch_now(_G(flags)[V043] ? 26 : 1);
+ break;
+
+ case 3:
+ _volume -= 10;
+ if (_volume > 0) {
+ digi_change_volume(2, _volume);
+ kernel_timing_trigger(3, 3);
+ } else {
+ digi_stop(1);
+ digi_unload_stream_breaks(STREAMS1);
+ digi_stop(2);
+ digi_unload("100_013");
+ player_set_commands_allowed(true);
+ _volume = 255;
+ }
+ break;
+
+ case 4:
+ _val2 = 0;
+ _series1 = series_play("135cw01", 3840, 0, -1, 10, -1, 100, 0, 0, 0, 3);
+ _val5 = 1;
+ _val6 = 1;
+ kernel_trigger_dispatch_now(32);
+
+ _val7 = 27;
+ _val8 = 27;
+ kernel_trigger_dispatch_now(34);
+ kernel_timing_trigger(imath_ranged_rand(200, 500), 21);
+ _G(walker).reset_walker_sprites();
+ series_stream_with_breaks(STREAMS1, "135dt01", 5, 512, 3);
+ break;
+
+ case 5:
+ digi_change_volume(2, 0);
+ break;
+
+ case 6:
+ pal_fade_set_start(0);
+ _val2 = 1;
+ ws_hide_walker();
+ _val6 = 21;
+
+ if (_play1)
+ TerminateMachineAndNull(_play1);
+
+ TerminateMachineAndNull(_series1);
+ TerminateMachineAndNull(_series2);
+ TerminateMachineAndNull(_series3);
+ gr_backup_palette();
+ digi_preload("100_022");
+ digi_preload_stream_breaks(STREAMS2);
+ kernel_timing_trigger(70, 7);
+ break;
+
+ case 9:
+ ws_unhide_walker();
+ break;
+
+ case 10:
+ ws_unhide_walker();
+ conv_resume_curr();
+ break;
+
+ case 11:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ break;
+
+
+ case 14:
+ _series5 = series_play("135od07", 2560, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _series6 = series_play("135od07s", 2560, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ ws_hide_walker();
+ series_play("135wi01", 1536, 0, 15, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 0, 14);
+ break;
+
+ case 15:
+ _play3 = series_play("135wi01", 1536, 0, -1, 600, -1, 100, 0, 0, 14, 14);
+ _play4 = series_play("135wi01s", 1536, 0, -1, 600, -1, 100, 0, 0, 14, 14);
+ conv_resume();
+ break;
+
+ case 16:
+ TerminateMachineAndNull(_series5);
+ TerminateMachineAndNull(_series6);
+ series_play("135od06", 2560, 0, 17, 6, 0, 100, 0, 0, 0, 4);
+ series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 17:
+ TerminateMachineAndNull(_play3);
+ TerminateMachineAndNull(_play4);
+ _val6 = 1;
+ _val5 = 1;
+ _G(flags)[V001]--;
+ series_play("135od06", 2560, 0, 32, 6, 0, 100, 0, 0, 5, 13);
+ series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 5, 13);
+ series_play("135wi01", 1536, 0, 9, 6, 0, 100, 0, 0, 14, 15);
+ series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 14, 15);
+ conv_resume();
+ break;
+
+ case 18:
+ series_play("135od17", 2560, 0, 19, 6, 0, 100, 0, 0, 0, 1);
+ series_play("135od17s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 1);
+ break;
+
+ case 19:
+ _series5 = series_play("135od17", 1536, 0, -1, 600, -1, 100, 0, 0, 1, 1);
+ _series6 = series_play("135od17s", 1536, 0, -1, 600, -1, 100, 0, 0, 1, 1);
+ ws_hide_walker();
+ series_play("135wi01", 1536, 2, 20, 6, 0, 100, 0, 0, 14, 15);
+ series_play("135wi01s", 1536, 2, -1, 6, 0, 100, 0, 0, 14, 15);
+ break;
+
+ case 20:
+ TerminateMachineAndNull(_series5);
+ TerminateMachineAndNull(_series6);
+ _val5 = 1;
+ _val6 = 1;
+ inv_give_to_player("broken puz dispenser");
+ series_play("135od17", 2560, 0, 32, 6, 0, 100, 0, 0, 2, 6);
+ series_play("135od17s", 2560, 0, -1, 6, 0, 100, 0, 0, 2, 6);
+ series_play("135wi01", 1536, 2, 10, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135wi01s", 1536, 2, -1, 6, 0, 100, 0, 0, 0, 14);
+ break;
+
+ case 21:
+ if (!_val2) {
+ _xp = imath_ranged_rand(0, 140);
+ _yp = imath_ranged_rand(0, 30);
+ _play1 = series_play("135bf01", 3840, 0, 22, 6, 0, 100, _xp - 60, _yp, 0, 4);
+ }
+ break;
+
+ case 22:
+ kernel_timing_trigger(imath_ranged_rand(300, 700), 21);
+ _play1 = series_play("135bf01", 3840, 0, 23, 6, 0, 100, _xp - 60, _yp, 5, 9);
+
+ if (player_commands_allowed())
+ digi_play("135_005", 2, 80, -1);
+ break;
+
+ case 23:
+ _play1 = 0;
+ break;
+
+ case 24:
+ _play2 = series_play("134bf02", 3840, 0, 25, 6, 0, 100, 0, 0, 0, 8);
+
+ if (!digi_play_state(2))
+ digi_play("135_002", 2, 150, -1);
+ break;
+
+ case 25:
+ if (player_commands_allowed())
+ digi_stop(2);
+
+ _play2 = series_play("134bf02", 3840, 0, 24, imath_ranged_rand(200, 500), 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 26:
+ digi_preload("135_006");
+ _series4 = series_play("135dt02", 3840, 0, 27, 6, 0, 100, 0, 0, 0, 13);
+ break;
+
+ case 28:
+ _series4 = series_play("135dt02", 3840, 0, 6, 6, 0, 100, 0, 0, 26, 36);
+ break;
+
+ case 29:
+ case 31:
+ _val8 = 27;
+ _val6 = 1;
+
+ if (_flag1)
+ player_set_commands_allowed(true);
+ break;
+
+ case 30:
+ player_set_commands_allowed(false);
+ _val9 = 33;
+ break;
+
+ case 32:
+ switch (_val5) {
+ case 1:
+ switch (_val6) {
+ case 1:
+ if (imath_ranged_rand(5, 20) < _val4) {
+ _val4 = 0;
+ _frame = imath_ranged_rand(0, 5);
+ }
+
+ series_play("135od01", 2560, 0, 32, 60, 0, 100, 0, 0, _frame, _frame);
+ series_play("135od01s", 2560, 0, -1, 60, 0, 100, 0, 0, _frame, _frame);
+ break;
+
+ case 2:
+ frame = imath_ranged_rand(0, 8);
+ series_play("135od03", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od03s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ break;
+
+ case 3:
+ _val6 = 1;
+ series_play_with_breaks(PLAY2, "135od04", 2560, 32, 3, 6, 100, 0, 0);
+ break;
+
+ case 4:
+ _val6 = 1;
+ series_play_with_breaks(PLAY3, "1350d05", 2560, 32, 3, 6, 100, 0, 0);
+ break;
+
+ case 5:
+ case 7:
+ _val5 = 5;
+ series_play("135od08", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od08s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 8:
+ _val6 = 11;
+ _val5 = 11;
+ series_play("135od06", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 9:
+ kernel_trigger_dispatch_now(14);
+ break;
+
+ case 10:
+ _val6 = 1;
+ series_play("135od22", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 6);
+ series_play("135od22s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 6);
+ break;
+
+ case 12:
+ _val5 = 11;
+ series_play("135od04", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 22:
+ _val6 = 23;
+ series_play("134od23", 2560, 0, 32, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od23s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ break;
+
+ case 23:
+ _val6 = 24;
+ kernel_timing_trigger(300, 32);
+ break;
+
+ case 24:
+ _val6 = 25;
+ series_play("134od24", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 36);
+ series_play("134od24s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 36);
+ break;
+
+ case 25:
+ TerminateMachineAndNull(_play2);
+ _val6 = 26;
+ series_play("134od24", 2560, 0, 32, 6, 0, 100, 0, 0, 37, -1);
+ series_play("134od24s", 2560, 0, -1, 6, 0, 100, 0, 0, 37, -1);
+ break;
+
+ case 26:
+ _G(flags)[V039] = 1;
+ _val6 = 25;
+ series_play("134od25", 2560, 0, 12, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od25s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ if (_val6 == 2) {
+ frame = imath_ranged_rand(0, 5);
+ series_play("135od05", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od05s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ } else {
+ _val5 = 1;
+ kernel_trigger_dispatch_now(32);
+ }
+ break;
+
+ case 5:
+ switch (_val6) {
+ case 5:
+ series_play("135od09", 2560, 0, 32, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od09s", 2560, 0, -1, 20, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 7:
+ frame = imath_ranged_rand(0, 5);
+ series_play("135od10", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od10s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ break;
+
+ default:
+ _val5 = 6;
+ series_play("135od09", 2560, 0, 32, 10, 0, 100, 0, 0, 1, 3);
+ series_play("135od09s", 2560, 0, -1, 10, 0, 100, 0, 0, 1, 3);
+ break;
+ }
+ break;
+
+ case 6:
+ _val5 = 1;
+ series_play("135od11", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 18);
+ series_play("135od11s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 18);
+ break;
+
+ case 11:
+ switch (_val6) {
+ case 11:
+ series_play("135od12", 2560, 0, 32, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od12s", 2560, 0, -1, 20, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 12:
+ frame = imath_ranged_rand(0, 5);
+ series_play("135od12", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od12s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ break;
+
+ case 14:
+ _val6 = 15;
+ series_play("135od07", 2560, 0, 32, 6, 0, 100, 0, 0, 2, 4);
+ series_play("135od07s", 2560, 0, -1, 6, 0, 100, 0, 0, 2, 4);
+ break;
+
+ case 15:
+ _val6 = 16;
+ _val5 = 16;
+ series_play("135od13", 2560, 0, 32, 6, 0, 100, 0, 0, 1, 3);
+ series_play("135od13s", 2560, 0, -1, 6, 0, 100, 0, 0, 1, 3);
+
+ if (_val11 == 0)
+ inv_move_object("puz dispenser", 135);
+ if (_val11 == 1)
+ inv_move_object("broken puz dispenser", 135);
+
+ _val9 = 33;
+ break;
+
+ default:
+ _val5 = 1;
+ series_play("135od04", 2560, 2, 32, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04s", 2560, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ break;
+ }
+ break;
+
+ case 16:
+ if (_val6 == 16) {
+ if (_val11 == 0) {
+ series_play("135od18", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135od18s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 14);
+ } else if (_val11 == 1) {
+ series_play("135od14", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 5);
+ series_play("135od14s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ }
+ } else {
+ _val5 = 17;
+ kernel_trigger_dispatch_now(32);
+ }
+ break;
+
+ case 19:
+ switch (_val6) {
+ case 19:
+ series_play("135od16", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od16s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 20:
+ frame = imath_ranged_rand(0, 4);
+ series_play("135od16", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od16s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ break;
+
+ default:
+ kernel_trigger_dispatch_now(18);
+ break;
+ }
+
+ // TODO:
+ default:
+ break;
+ }
+
+ case 33:
+ switch (_val10) {
+ case 30:
+ switch (_val9) {
+ case 31:
+ _val9 = 32;
+ series_play("135wi01", 1536, 0, 33, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 0, 14);
+ break;
+ case 32:
+ conv_load_and_prepare("conv01", 29);
+
+ if (player_said("puz dispenser", "odie")) {
+ conv_export_value_curr(17, 0);
+ _val11 = 0;
+ } else if (player_said("broken puz dispenser", "odie")) {
+ conv_export_value_curr(16, 0);
+ _val11 = 1;
+ } else {
+ conv_export_value_curr(0, 0);
+ _val11 = 2;
+ }
+
+ _val10 = 31;
+ _val9 = 31;
+ kernel_trigger_dispatch_now(33);
+ conv_export_value_curr(inv_player_has("block of ice") ? 1 : 0, 1);
+ conv_export_pointer_curr(&_G(flags)[V040], 3);
+ _flag1 = true;
+ conv_play_curr();
+ _val8 = 28;
+ break;
+
+ case 34:
+ _val9 = 35;
+ ws_hide_walker();
+ series_play("135wi01", 1536, 0, 33, 6, 0, 100, 0, 0, 16, 18);
+ series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 16, 18);
+ break;
+
+ case 35:
+ conv_load_and_prepare("conv02", 30);
+ conv_export_value_curr(inv_player_has("block of ice") ? 1 : 0, 0);
+ conv_play_curr();
+ _val10 = 34;
+ _val9 = 34;
+ kernel_trigger_dispatch_now(33);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 31:
+ switch (_val9) {
+ case 31:
+ series_play("135wi01", 1536, 0, 33, 15, 0, 100, 0, 0, 14, 14);
+ series_play("135wi01s", 1536, 0, -1, 15, 0, 100, 0, 0, 14, 14);
+ break;
+ case 33:
+ series_play("135wi01", 1536, 0, 9, 6, 0, 100, 0, 0, 15, 15);
+ series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 15, 15);
+ break;
+ case 36:
+ series_play("135wi01", 1536, 2, 11, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135wi01s", 1536, 2, -1, 6, 0, 100, 0, 0, 0, 14);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 34:
+ switch (_val9) {
+ case 33:
+ series_play("135wi01", 1536, 2, 11, 6, 0, 100, 0, 0, 16, 18);
+ series_play("135wi01s", 1536, 2, -1, 6, 0, 100, 0, 0, 16, 18);
+ break;
+ case 34:
+ series_play("135wi01", 1536, 0, 33, 15, 0, 100, 0, 0, 18, 18);
+ series_play("135wi01s", 1536, 0, -1, 15, 0, 100, 0, 0, 18, 18);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 34:
+ if (_val7 == 27) {
+ switch (_val8) {
+ case 27:
+ if (imath_ranged_rand(1, 15) == 1) {
+ _series2 = series_play("135bb01", 2560, 0, 34, 6, 0, 100, 0, 0, 0, 11);
+ _series3 = series_play("135bb01s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+
+ if (player_commands_allowed())
+ digi_play("135_004", 2, 205, -1);
+ } else {
+ _series2 = series_play("135bb01", 2560, 0, 34, 30, 0, 100, 0, 0, 0, 0);
+ _series3 = series_play("135bb01s", 2560, 0, -1, 30, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 28:
+ _series2 = series_play("135bb01", 2560, 0, 34, 30, 0, 100, 0, 0, 0, 0);
+ _series3 = series_play("135bb01s", 2560, 0, -1, 30, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case gTELEPORT:
+ switch (_G(roomVal1)) {
+ case 37:
+ player_set_commands_allowed(true);
+ player_first_walk(639, 373, 9, 579, 359, 9, true);
+ break;
+
+ case 38:
+ player_set_commands_allowed(true);
+ player_first_walk(0, 248, 3, 42, 260, 3, true);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 10028:
+ if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ Section1::updateDisablePlayer();
+ digi_preload("100_013");
+ digi_play("100_013", 2, 255, -1);
+ kernel_timing_trigger(240, 2);
+ } else {
+ kernel_timing_trigger(60, 10028);
+ }
+ break;
+
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room135::pre_parser() {
@@ -224,6 +830,14 @@ void Room135::loadOdie() {
}
}
+void Room135::loadDigi() {
+ if (_name1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_name1, 1, 255, 35);
+ _name1 = nullptr;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room135.h b/engines/m4/burger/rooms/section1/room135.h
index 5f9cbae43a3..269671229ec 100644
--- a/engines/m4/burger/rooms/section1/room135.h
+++ b/engines/m4/burger/rooms/section1/room135.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Room135 : public Room {
private:
- int _val1 = 0;
+ int _volume = 0;
int _val2 = 0;
int _val4 = 0;
int _val5 = 0;
@@ -39,14 +39,28 @@ private:
int _val8 = 0;
int _val9 = 0;
int _val10 = 0;
+ int _val11 = 0;
bool _flag1 = false;
bool _odieLoaded = false;
machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_play1 = nullptr;
+ machine *_play2 = nullptr;
+ machine *_play3 = nullptr;
+ machine *_play4 = nullptr;
+ int _xp = 0, _yp = 0;
+ int _frame = 0;
+ const char *_name1 = nullptr;
void conv01();
void conv02();
void conv03();
- void odie();
+ void loadOdie();
+ void loadDigi();
public:
Room135() : Room() {}
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index fdb7f62fd1c..f91f8bfd75d 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -623,6 +623,10 @@ void pal_fade_set_start(RGB8 *origPalette, int32 percent) {
pal_fx_update();
}
+void pal_fade_set_start(int32 percent) {
+ pal_fade_set_start(_G(master_palette), percent);
+}
+
static void pal_cycle_callback(frac16 myMessage) {
kernel_trigger_dispatchx((uint32)myMessage);
}
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 50b22e931f2..34eb7c97cc7 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -84,6 +84,7 @@ struct KernelPal_Globals {
};
extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
+extern void pal_fade_set_start(int32 percent);
extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
extern void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
extern void pal_fade_init(int32 triggerNum);
Commit: b7cb8e8b2cb96577c8108dbc4c791d1dad710b84
https://github.com/scummvm/scummvm/commit/b7cb8e8b2cb96577c8108dbc4c791d1dad710b84
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 135 daemon
Changed paths:
engines/m4/burger/rooms/section1/room135.cpp
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index f05a119ed6b..3927ffab7cf 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -228,6 +228,15 @@ void Room135::daemon() {
kernel_timing_trigger(70, 7);
break;
+ case 7:
+ series_stream_with_breaks(STREAMS2, "120dt01", 9, 0, 1008);
+ kernel_timing_trigger(1, 8);
+ break;
+
+ case 8:
+ pal_fade_init(15, 255, 100, 0, -1);
+ break;
+
case 9:
ws_unhide_walker();
break;
@@ -242,6 +251,9 @@ void Room135::daemon() {
player_set_commands_allowed(true);
break;
+ case 12:
+ player_set_commands_allowed(true);
+ break;
case 14:
_series5 = series_play("135od07", 2560, 0, -1, 600, -1, 100, 0, 0, 0, 0);
@@ -341,6 +353,11 @@ void Room135::daemon() {
_series4 = series_play("135dt02", 3840, 0, 27, 6, 0, 100, 0, 0, 0, 13);
break;
+ case 27:
+ digi_play("135_006", 1, 255, -1);
+ _series4 = series_play("135dt02", 3840, 0, 28, 6, 0, 100, 0, 0, 14, 25);
+ break;
+
case 28:
_series4 = series_play("135dt02", 3840, 0, 6, 6, 0, 100, 0, 0, 26, 36);
break;
@@ -553,6 +570,32 @@ void Room135::daemon() {
}
break;
+ case 17:
+ switch (_val6) {
+ case 13:
+ kernel_trigger_dispatch_now(18);
+ break;
+
+ case 17:
+ series_play("135od20", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od20s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 18:
+ frame = imath_ranged_rand(0, 5);
+ series_play("135od20", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od20s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ loadDigi();
+ break;
+
+ default:
+ _val5 = 1;
+ series_play("135od21", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 2);
+ series_play("135od21s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 2);
+ break;
+ }
+ break;
+
case 19:
switch (_val6) {
case 19:
@@ -571,11 +614,12 @@ void Room135::daemon() {
kernel_trigger_dispatch_now(18);
break;
}
+ break;
- // TODO:
default:
break;
}
+ break;
case 33:
switch (_val10) {
@@ -697,6 +741,10 @@ void Room135::daemon() {
}
break;
+ case 37:
+ player_set_commands_allowed(true);
+ break;
+
case gTELEPORT:
switch (_G(roomVal1)) {
case 37:
@@ -727,7 +775,6 @@ void Room135::daemon() {
}
break;
-
default:
_G(kernel).continue_handling_trigger = true;
break;
Commit: 3dac49f048ac3727007eaae3d385dc6dbc73d629
https://github.com/scummvm/scummvm/commit/3dac49f048ac3727007eaae3d385dc6dbc73d629
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 135 conv methods
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/rooms/section1/room135.cpp
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 8eba4467935..2102d8c65c1 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -125,12 +125,16 @@ void conv_play(Conv *c) {
conv_go(c);
}
-long conv_current_node(void) {
+long conv_current_node() {
if (conv_get_handle())
return conv_get_handle()->node_hash;
return 0;
}
+int32 conv_current_entry() {
+ return _GC(ent);
+}
+
void conv_reset(const char *filename) {
Conv *c = nullptr;
_GC(restore_conv) = 0;
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index ca0ba74db99..b656b04d694 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -42,6 +42,7 @@ struct Converstation_Globals {
long myFinalTrigger = 0;
bool interface_was_visible = false; // to remember to turn it back on
int restore_conv = 1;
+ int ent = 0;
int32 conv_font_spacing_h = 0;
int32 conv_font_spacing_v = 5;
@@ -117,6 +118,8 @@ extern void conv_set_event(int e);
extern int conv_is_event_ready();
extern void conv_swap_words(Conv *c);
+extern long conv_current_node();
+extern int32 conv_current_entry();
} // End of namespace M4
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 3927ffab7cf..766f0968010 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -852,11 +852,67 @@ void Room135::conv01() {
}
void Room135::conv02() {
- error("TODO: conv02");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+
+ if (_G(kernel).trigger == 35) {
+ if (who == 0) {
+ _val6 = 1;
+ conv_resume();
+ }
+ } else if (conv_sound_to_play()) {
+ if (who == 0) {
+ _name1 = conv_sound_to_play();
+ _val6 = 12;
+ }
+ } else {
+ conv_resume();
+ }
}
void Room135::conv03() {
- error("TODO: conv03");
+ _G(kernel).trigger_mode = KT_PARSE;
+
+ if (_G(kernel).trigger == 35) {
+ int who = conv_whos_talking();
+ if (who <= 0) {
+ if (conv_current_node() == 8 && !conv_current_entry()) {
+ digi_preload("03p1001");
+ _val6 = 9;
+ } else {
+ _val6 = 1;
+ conv_resume();
+ }
+ } else if (who == 1) {
+ SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ conv_resume();
+ }
+ } else if (conv_sound_to_play()) {
+ int who = conv_whos_talking();
+ if (who <= 0) {
+ if (conv_current_node() == 8 && conv_current_entry()) {
+ kernel_timing_trigger(1, 35);
+ } else {
+ _name1 = conv_sound_to_play();
+ _val6 = 2;
+ }
+ } else if (who == 1) {
+ if (conv_current_node() == 1 || conv_current_node() == 2)
+ _val6 = 3;
+
+ if (conv_current_node() == 9 && !conv_current_entry()) {
+ digi_preload("03p1001");
+ _val6 = 9;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ digi_play(conv_sound_to_play(), 1, 255, 16);
+ } else {
+ SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ }
+ }
+ } else {
+ conv_resume();
+ }
}
void Room135::loadOdie() {
Commit: 9610461e3900d22a80bdb9001f1a161a844dfc22
https://github.com/scummvm/scummvm/commit/9610461e3900d22a80bdb9001f1a161a844dfc22
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining room 135 conv methods
Changed paths:
engines/m4/burger/rooms/section1/room135.cpp
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 766f0968010..6b4ec982d02 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -848,7 +848,86 @@ void Room135::parser() {
}
void Room135::conv01() {
- error("TODO: conv01");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ switch (_G(kernel).trigger) {
+ case 13:
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ break;
+
+ case 35:
+ if (who <= 0) {
+ if (node == 14 || node == 12 || node == 13 || node == 4) {
+ _val9 = 36;
+ _flag1 = false;
+ }
+
+ if ((node == 7 && !entry) || (node == 2 && !entry)) {
+ _val6 = 8;
+ } else if (node == 2 && entry == 3) {
+ _val6 = 13;
+ } else if (!(node == 6 && !entry) && !(node == 2 && entry == 1) &&
+ !(node == 2 && entry == 2)) {
+ if (node == 6 && entry == 1)
+ _val6 = 17;
+ else
+ _val6 = 1;
+ }
+ } else if (who == 1) {
+ if (!(node == 2 && entry == 2) &&
+ !(node == 4 && node == 10) &&
+ !(node == 6 && entry == 0) &&
+ !(node == 2 && entry == 1) &&
+ !(node == 7 && node == 0)) {
+ SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ }
+ }
+ break;
+
+ default:
+ if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if ((node == 2 && entry == 2) || (node == 2 && entry == 3)) {
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ } else if ((node == 7 && entry == 1) || (node == 2 && entry == 1)) {
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ } else if (node == 6 && entry == 1) {
+ kernel_timing_trigger(120, 13);
+ } else if ((node == 7 && entry == 0) || (node == 2 && entry == 0)) {
+ _val6 = 12;
+ _name1 = conv_sound_to_play();
+ } else if (node == 6 && entry == 0) {
+ _val6 = 14;
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ } else if (node == 9 && entry == 1) {
+ _val6 = 4;
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ } else {
+ _val6 = (node == 9 && entry == 0) ? 7 : 2;
+ _name1 = conv_sound_to_play();
+ }
+ } else if (who == 1) {
+ if ((node == 2 && entry == 0) ||
+ (node == 4) ||
+ (node == 10) ||
+ (node == 6 && entry == 0) ||
+ (node == 7 && entry == 0)) {
+ _val6 = 11;
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ } else if ((node == 7 && entry == 1) || (node == 2 && entry == 1)) {
+ _val6 = 14;
+ } else {
+ SendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(conv_sound_to_play(), 1, 255, 35);
+ }
+ }
+ } else {
+ conv_resume();
+ }
+ }
}
void Room135::conv02() {
Commit: 60ffdccbbc2ba8a30dcd51da58600b7f1db24615
https://github.com/scummvm/scummvm/commit/60ffdccbbc2ba8a30dcd51da58600b7f1db24615
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix refreshing user interface between rooms
Changed paths:
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/vars.cpp
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index 081f9d2c4c7..8631b1a1a29 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -26,12 +26,13 @@
namespace M4 {
-void Interface::init(int arrow, int wait, int look, int grab, int use) {
+bool Interface::init(int arrow, int wait, int look, int grab, int use) {
_arrow = arrow;
_wait = wait;
_look = look;
_grab = grab;
_use = use;
+ return true;
}
void Interface::showWaitCursor() {
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index 3e417dd91f7..6bf8992c05a 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -43,7 +43,7 @@ public:
virtual ~Interface() {
}
- virtual void init(int arrow, int wait, int look, int grab, int use);
+ virtual bool init(int arrow, int wait, int look, int grab, int use);
virtual void cancel_sentence() = 0;
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 1bb2fd84b4f..809285b86e9 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -42,19 +42,22 @@ Interface::Interface() : M4::Interface() {
_y2 = SCREEN_HEIGHT;
}
-void Interface::init(int arrow, int wait, int look, int grab, int use) {
+bool Interface::init(int arrow, int wait, int look, int grab, int use) {
M4::Interface::init(arrow, wait, look, grab, use);
_sprite = series_load("999intr", 22, nullptr);
if (_sprite != 22)
error_show(FL, 'SLF!');
- mouse_set_sprite(wait);
-
- _G(gameInterfaceBuff) = new GrBuff(_x2 - _x1, _y2 - _y1);
- setup();
-
mouse_set_sprite(arrow);
+
+ if (!_G(gameInterfaceBuff)) {
+ _G(gameInterfaceBuff) = new GrBuff(_x2 - _x1, _y2 - _y1);
+ setup();
+ return true;
+ } else {
+ return false;
+ }
}
Interface::~Interface() {
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 3ae854679e7..055a6353d07 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -65,7 +65,7 @@ public:
Interface();
~Interface() override;
- void init(int arrow, int wait, int look, int grab, int use) override;
+ bool init(int arrow, int wait, int look, int grab, int use) override;
void cancel_sentence() override;
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index d0127c2be52..af312aa35a8 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -119,9 +119,8 @@ void Vars::global_menu_system_init() {
AddSystemHotkey(Common::KEYCODE_F2, cb_F2);
AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
- _interface.init(0, 5, 6, 8, 9);
-
- static_cast<Inventory *>(_inventory)->init();
+ if (_interface.init(0, 5, 6, 8, 9))
+ static_cast<Inventory *>(_inventory)->init();
}
void Vars::initialize_game() {
Commit: 506b33fcccd869b88e0352c53afeebf05e80ffe5
https://github.com/scummvm/scummvm/commit/506b33fcccd869b88e0352c53afeebf05e80ffe5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 142
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/core/rooms.h
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 316195e4e45..78b19b9eead 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -260,7 +260,7 @@ void ws_demand_facing(machine *myWalker, int32 facing) {
}
}
-void ws_demand_location(machine *myWalker, int32 x, int32 y) {
+void ws_demand_location(machine *myWalker, int32 x, int32 y, int facing) {
frac16 s;
if (!myWalker || !myWalker->myAnim8 || !_G(globals)) {
@@ -275,6 +275,9 @@ void ws_demand_location(machine *myWalker, int32 x, int32 y) {
_G(globals)[GLB_TEMP_3] = s;
SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+
+ if (facing != -1)
+ ws_demand_facing(myWalker, facing);
}
static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, int32 facing) {
@@ -337,8 +340,8 @@ void ws_nosepick(machine *myWalker, int32 seriesHash) {
SendWSMessage(NOSEPICK << 16, 0, myWalker, 0, nullptr, 1);
}
-void ws_demand_location(int32 x, int32 y) {
- ws_demand_location(_G(my_walker), x, y);
+void ws_demand_location(int32 x, int32 y, int facing) {
+ ws_demand_location(_G(my_walker), x, y, facing);
}
void ws_hide_walker(machine *myWalker) {
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 4600fa03f6d..122322414f8 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -43,7 +43,7 @@ extern void set_walker_scaling(SceneDef *rdef);
* Called every time s/he hits a node
*/
extern bool walker_has_walk_finished(machine *sender);
-extern void ws_demand_location(machine *myWalker, int32 x, int32 y);
+extern void ws_demand_location(machine *myWalker, int32 x, int32 y, int facing = -1);
extern void ws_demand_facing(machine *myWalker, int32 newFacing);
extern void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger);
extern void ws_nosepick(machine *myWalker, int32 seriesHash);
@@ -51,7 +51,7 @@ extern void ws_hide_walker(machine *myWalker);
extern void ws_unhide_walker(machine *myWalker);
extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int32 finalFacing, bool complete_walk = true);
-extern void ws_demand_location(int32 x, int32 y);
+extern void ws_demand_location(int32 x, int32 y, int facing = -1);
extern void ws_demand_facing(int32 newFacing);
extern void ws_turn_to_face(int32 facing, int32 trigger);
extern void ws_nosepick(int32 seriesHash);
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index bb3c92d95e3..d9978c1164a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -131,7 +131,7 @@ void Room101::init() {
door();
switch (_G(game).previous_room) {
- case -2:
+ case RESTORING_GAME:
// Do nothing
break;
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 6b4ec982d02..7856e555e01 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -97,7 +97,7 @@ void Room135::init() {
digi_preload("135_004");
switch (_G(game).previous_room) {
- case -2:
+ case RESTORING_GAME:
break;
case 101:
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 80dbc1b5af6..695ccd9ea11 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -30,12 +30,90 @@ namespace Rooms {
void Room142::init() {
_G(player).walker_in_this_scene = true;
+ digi_preload("142_004");
+ digi_play_loop("142_004", 3, 255, -1);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ if (_G(flags)[V059]) {
+ ws_hide_walker();
+ _G(roomVal1) = 2;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ }
+ break;
+
+ case 101:
+ ws_demand_location(120, 400, 2);
+ ws_walk(120, 344, 0, -1, -1);
+ break;
+
+ case 139:
+ ws_demand_location(-40, 375, 2);
+ ws_walk(25, 344, 0, -1, -1);
+ break;
+
+ case 143:
+ ws_demand_location(350, 270, 8);
+ ws_walk(297, 275, 0, -1, -1);
+ break;
+
+ case 145:
+ ws_demand_location(293, 275, 7);
+ ws_walk(282, 280, 0, -1, -1);
+ break;
+
+ case 170:
+ ws_demand_location(680, 325, 9);
+ ws_walk(613, 331, 0, -1, -1);
+ break;
+
+ default:
+ ws_demand_location(270, 320);
+ ws_demand_facing(5);
+ break;
+ }
+
+ series_play("142sm01", 0xf00, 4, -1, 6, -1);
+ _series1 = series_show("142door", 0xe00);
+
+ if (inv_player_has("PANTYHOSE")) {
+ hotspot_set_active("FANBELT", false);
+ hotspot_set_active("ENGINE", true);
+ } else {
+ hotspot_set_active("FANBELT", true);
+ hotspot_set_active("ENGINE", false);
+ }
+
+ hotspot_set_active("TRUCK", false);
+
+ if (_G(flags)[V000] == 1003) {
+ _noWalk = intr_add_no_walk_rect(230, 250, 294, 277, 229, 278,
+ _G(screenCodeBuff)->get_buffer());
+ _series2 = series_show("142dt01", 0xd00, 0, -1, -1, 22);
+ _series3 = series_show("142dt01s", 0xd01, 0, -1, -1, 22);
+ hotspot_set_active("TRUCK", true);
+ }
+
+ hotspot_set_active("TOUR BUS", false);
+
+ if (_G(flags)[V058]) {
+ _series4 = series_show("142ba01", 0xf00, 0, -1, -1, 21);
+ hotspot_set_active("TOUR BUS", true);
+ }
+
+ if (!_G(flags)[V059]) {
+ _series5 = series_show("142icedr", 0xe00);
+ hotspot_set_active("ICE", false);
+ }
}
void Room142::daemon() {
}
void Room142::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ // TODO
}
void Room142::parser() {
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index f97a3ab3f70..79d60354bfc 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -29,6 +29,14 @@ namespace Burger {
namespace Rooms {
class Room142 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
+ noWalkRect *_noWalk = nullptr;
+
public:
Room142() : Room() {}
~Room142() override {}
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 34a452ed33b..ea74a0982b3 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -28,6 +28,10 @@
namespace M4 {
+enum {
+ RESTORING_GAME = -2
+};
+
class Room {
public:
Room() {}
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 91bfc932a15..d0c51ac069f 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -61,12 +61,13 @@ extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, i
//extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags,
- int16 triggerNum, int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
- int32 firstFrame = 0, int32 lastFrame = -1);
+ int16 triggerNum, int32 frameRate, int32 loopCount, int32 s = 100,
+ int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
//extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
-extern machine *series_show(const char *seriesName, frac16 layer, uint32 flags, int16 triggerNum,
- int32 duration, int32 index, int32 s = 100, int32 x = 0, int32 y = 0);
+extern machine *series_show(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
+ int32 x = 0, int32 y = 0);
/*extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
int32 firstFrame, int32 lastFrame,
Commit: dab0688744a13936ce46678958d42768acac0626
https://github.com/scummvm/scummvm/commit/dab0688744a13936ce46678958d42768acac0626
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 142 preparser
Changed paths:
engines/m4/adv_r/adv_player.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index e8c4aacacae..c775b06c307 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -109,7 +109,7 @@ extern void player_set_commands_allowed(bool t_or_f);
extern void player_set_defaults();
extern void player_noun_becomes_verb(int32 spriteNum);
-extern void player_hotspot_walk_override(int32 x, int32 y, int32 facing, int32 trigger = -1);
+extern void player_hotspot_walk_override(int32 x, int32 y, int32 facing = -1, int32 trigger = -1);
extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1); //mar4
extern bool player_commands_allowed();
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 695ccd9ea11..3f39fd3240c 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -113,12 +113,107 @@ void Room142::daemon() {
void Room142::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- // TODO
+ if (_G(flags)[V059]) {
+ _G(player).ready_to_walk = false;
+ _G(player).need_to_walk = false;
+
+ if (player_said("GEAR", "ICE BOX")) {
+ _G(roomVal1) = 5;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ } else if (player_said("ICE")) {
+ if (player_said("LOOK AT")) {
+ if (_G(flags)[V040] && !inv_player_has("BLOCK OF ICE")) {
+ _G(walker).wilbur_speech("142w008");
+ } else {
+ _G(walker).wilbur_speech("142w007");
+ }
+ } else if (player_said("TAKE")) {
+ if (!_G(flags)[V040]) {
+ _G(walker).wilbur_speech("142w017");
+ } else if (inv_player_has("BLOCK_OF_ICE")) {
+ _G(walker).wilbur_speech("142w009");
+ } else {
+ kernel_trigger_dispatch_now(gTELEPORT);
+ }
+ } else if (player_said("GEAR")) {
+ _G(walker).wilbur_speech("142w002");
+ } else {
+ term_message("ERROR - don't know what to do with ice!!!");
+ }
+ } else {
+ _G(roomVal1) = 7;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ }
+
+ _G(player).command_ready = false;
+
+ } else {
+ if (_G(flags)[V000] == 1003 &&
+ _G(player).walk_x >= 230 && _G(player).walk_x <= 294 &&
+ _G(player).walk_y >= 250 && _G(player).walk_y <= 277) {
+ player_hotspot_walk_override(_G(hotspot_x), 278);
+ } else if (player_said_any("GEAR", "LOOK AT")) {
+ if (player_said("MAIN STREET")) {
+ player_hotspot_walk_override(_G(player).walk_x, 400);
+ checkAction();
+ _G(kernel).call_daemon_every_loop = true;
+ _G(player).command_ready = false;
+ } else if (player_said("PARKING LOT") && _G(flags)[V058]) {
+ checkAction();
+ _G(kernel).call_daemon_every_loop = true;
+ _G(player).command_ready = false;
+ }
+
+ } else if (player_said("MAIN STREET")) {
+ player_set_facing_at(120, 400);
+ } else if (player_said("HANLON'S POINT")) {
+ player_set_facing_at(-40, 375);
+ } else if (player_said("AUNT POLLY'S HOUSE")) {
+ player_set_facing_at(680, 325);
+ } else if (player_said("FRONT DOOR")) {
+ player_set_facing_at(350, 270);
+ } else if (player_said("HIGHWAY 2")) {
+ player_set_facing_at(192, 252);
+ } else if (player_said("PARKING LOT")) {
+ player_set_facing_at(303, 247);
+ } else if (player_said("TOUR BUS")) {
+ checkAction();
+ _G(kernel).call_daemon_every_loop = true;
+ _G(player).command_ready = false;
+ }
+ }
}
void Room142::parser() {
}
+void Room142::checkAction() {
+ _actionType = 0;
+
+ if (player_said_any("GEAR", "LOOK AT", "GO TO")) {
+ if (player_said("MAIN STREET")) {
+ _actionType = 1;
+ } else if (_G(flags)[V058] && (player_said("PARKING LOT") ||
+ player_said("GO TO", "TOUR BUS"))) {
+ _actionType = 2;
+ }
+ }
+
+ if (_actionType) {
+ player_update_info();
+
+ if (_actionType == 1 && _G(player_info).y > 375 && player_commands_allowed()) {
+ player_update_info();
+ player_hotspot_walk_override(_G(player_info).x, 400);
+ disable_player_commands_and_fade_init(1001);
+
+ } else if (_actionType == 2 && _G(player_info).y < 280 &&
+ player_commands_allowed()) {
+ disable_player_commands_and_fade_init(1016);
+ }
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 79d60354bfc..af448a9e05b 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -36,6 +36,9 @@ private:
machine *_series4 = nullptr;
machine *_series5 = nullptr;
noWalkRect *_noWalk = nullptr;
+ int _actionType = 0;
+
+ void checkAction();
public:
Room142() : Room() {}
Commit: 7998e5c9f32eb7d9761bbb78c61259b2cd8ef544
https://github.com/scummvm/scummvm/commit/7998e5c9f32eb7d9761bbb78c61259b2cd8ef544
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 142 parser, wilbur_match method
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 3f39fd3240c..ec81dad4b40 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -28,6 +28,49 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID1[][4] = {
+ { "VERA'S DINER", "142w001", "142w002", "142w002" },
+ { "CAR", "142w003", nullptr, "142w004" },
+ { "FANBELT", "142w005", nullptr, "142w002" },
+ { "ICE BOX", "142w006", "142w002", nullptr },
+ { "ICE", nullptr, nullptr, "142w002" },
+ { "GARBAGE CANS", "142w010", "142w011", "142w012" },
+ { "BACK DOOR", "142w013", "142w002", nullptr },
+ { "PLANTS", "142w014", "142w015", "142w002" },
+ { "SIGN", "142w016", "142w017", "142w002" },
+ { "SIGN ", "142w018", "142w002", "142w002" },
+ { "FRONT DOOR", nullptr, "142w002", nullptr },
+ { "MAIN STREET", nullptr, "142w002", nullptr },
+ { "HANLON'S POINT", nullptr, "142w002", nullptr },
+ { "AUNT POLLY'S HOUSE", nullptr, "142w002", nullptr },
+ { "PARKING LOT", nullptr, "142w002", nullptr },
+ { "HIGHWAY 2", "142w020", "142w002", "142w021" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+int Room142::_val1;
+int Room142::_val2;
+
+Room142::Room142() : Room() {
+ _val1 = 0;
+ _val2 = 0;
+
+ _MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 9,
+ &_G(flags)[V000], 1003, &_val1, 18));
+ _MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 9,
+ &_G(flags)[V000], 1003, &_val1, 18));
+ _MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 5,
+ &_G(flags)[V058], 0, &_val2, 13));
+ _MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 5,
+ &_G(flags)[V058], 0, &_val2, 13));
+ _MATCH.push_back(WilburMatch("GEAR", "ICE BOX", gTELEPORT,
+ &_G(flags)[V059], 0, &_G(roomVal1), 1));
+ _MATCH.push_back(WilburMatch("TAKE", "FANBELT", gTELEPORT,
+ nullptr, 0, &_G(roomVal1), 9));
+ _MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
+ nullptr, 0, nullptr, 0));
+}
+
void Room142::init() {
_G(player).walker_in_this_scene = true;
digi_preload("142_004");
@@ -185,6 +228,21 @@ void Room142::pre_parser() {
}
void Room142::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(walker).wilbur_said(SAID1)) {
+ if (player_said_any("GEAR", "LOOK AT") && player_said("HANLON'S POINT")) {
+ disable_player_commands_and_fade_init(1012);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
+ disable_player_commands_and_fade_init(1015);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("AUNT POLLY'S HOUSE")) {
+ disable_player_commands_and_fade_init(1017);
+ } else if (!_G(walker).wilbur_match(_MATCH)) {
+ return;
+ }
+ }
+
+ _G(player).command_ready = false;
}
void Room142::checkAction() {
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index af448a9e05b..ffcf1823b05 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION1_ROOM142_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
@@ -30,6 +31,7 @@ namespace Rooms {
class Room142 : public Room {
private:
+ Common::Array<WilburMatch> _MATCH;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
@@ -37,11 +39,13 @@ private:
machine *_series5 = nullptr;
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
+ static int _val1;
+ static int _val2;
void checkAction();
public:
- Room142() : Room() {}
+ Room142();
~Room142() override {}
void init() override;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index d8ff1857d90..c24b42e806e 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -362,6 +362,29 @@ bool Walker::wilbur_parser(const char **list) {
return false;
}
+bool Walker::wilbur_match(const Common::Array<WilburMatch> &list) {
+ for (uint idx = 0; idx < list.size(); ++idx) {
+ const WilburMatch &m = list[idx];
+
+ if (player_said(m._word0, m._word1)) {
+ term_message("matched %s and %s", m._word0, m._word1);
+ term_message("test variable:%d value:%d", *m._testVariable, m._testValue);
+
+ if (!m._testVariable || *m._testVariable == m._testValue) {
+ if (m._newVariable)
+ *m._newVariable = m._newValue;
+
+ if (m._trigger != -1)
+ kernel_trigger_dispatch_now(m._trigger);
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
void Walker::wilbur_poof() {
error("TODO: Walker::wilbur_poof");
}
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index de974203682..3b625602ed9 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -23,11 +23,30 @@
#ifndef M4_BURGER_WALKER_H
#define M4_BURGER_WALKER_H
+#include "common/array.h"
#include "m4/adv_r/adv_walk.h"
namespace M4 {
namespace Burger {
+struct WilburMatch {
+ const char *_word0 = nullptr;
+ const char *_word1 = nullptr;
+ int _trigger = -1;
+ const long *_testVariable = nullptr;
+ int _testValue = 0;
+ int *_newVariable = nullptr;
+ int _newValue = 0;
+
+ WilburMatch() {}
+ WilburMatch(const char *word0, const char *word1, int trigger,
+ const long *testVariable, int testValue, int *newVariable,
+ int newValue) : _word0(word0), _word1(word1),
+ _trigger(trigger), _testVariable(testVariable),
+ _testValue(testValue), _newVariable(newVariable),
+ _newValue(newValue) {}
+};
+
class Walker : public M4::Walker {
private:
const char *_name = nullptr;
@@ -101,6 +120,8 @@ public:
bool wilbur_parser(const char **list);
+ bool wilbur_match(const Common::Array<WilburMatch> &list);
+
void wilbur_poof();
void wilbur_unpoof();
};
Commit: cca7efca84b8a598931355b8dba5de5763e16031
https://github.com/scummvm/scummvm/commit/cca7efca84b8a598931355b8dba5de5763e16031
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing room 142 daemon
Changed paths:
engines/m4/adv_r/adv_interface.cpp
engines/m4/adv_r/adv_interface.h
engines/m4/adv_r/adv_player.h
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/adv_rails.h
engines/m4/adv_r/adv_walk.h
engines/m4/adv_r/conv.h
engines/m4/burger/burger.cpp
engines/m4/burger/core/play_break.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/gui/gui_dialog.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/adv_r/adv_interface.cpp b/engines/m4/adv_r/adv_interface.cpp
index 8631b1a1a29..6ca5150895a 100644
--- a/engines/m4/adv_r/adv_interface.cpp
+++ b/engines/m4/adv_r/adv_interface.cpp
@@ -75,4 +75,8 @@ void intr_cancel_sentence() {
_GI().cancel_sentence();
}
+void intr_freshen_sentence() {
+ _GI().freshen_sentence();
+}
+
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_interface.h b/engines/m4/adv_r/adv_interface.h
index 6bf8992c05a..3e792b91b5b 100644
--- a/engines/m4/adv_r/adv_interface.h
+++ b/engines/m4/adv_r/adv_interface.h
@@ -78,6 +78,7 @@ extern void track_hotspots_refresh();
extern bool intr_EventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z);
extern void intr_cancel_sentence();
+extern void intr_freshen_sentence();
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index c775b06c307..9d5783a79a8 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -110,7 +110,7 @@ extern void player_set_defaults();
extern void player_noun_becomes_verb(int32 spriteNum);
extern void player_hotspot_walk_override(int32 x, int32 y, int32 facing = -1, int32 trigger = -1);
-extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1); //mar4
+extern void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1);
extern bool player_commands_allowed();
extern PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index b362f103b56..ebe73cc8e50 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -167,6 +167,9 @@ noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32
return newRect;
}
+noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY) {
+ return intr_add_no_walk_rect(x1, y1, x2, y2, altX, altY, _G(screenCodeBuff)->get_buffer());
+}
void intr_move_no_walk_rect(noWalkRect *myRect, int32 new_x1, int32 new_y1,
int32 new_x2, int32 new_y2, int32 new_altX, int32 new_altY, Buffer *walkCodes) {
@@ -222,6 +225,10 @@ void intr_remove_no_walk_rect(noWalkRect *myRect, Buffer *walkCodes) {
RestoreEdgeList(walkCodes);
}
+void intr_remove_no_walk_rect(noWalkRect *myRect) {
+ intr_remove_no_walk_rect(myRect, _G(screenCodeBuff)->get_buffer());
+}
+
bool intr_LineCrossesRect(int32 line_x1, int32 line_y1, int32 line_x2, int32 line_y2,
int32 rect_x1, int32 rect_y1, int32 rect_x2, int32 rect_y2) {
int32 p1X, p1Y, p2X, p2Y, mX, mY;
diff --git a/engines/m4/adv_r/adv_rails.h b/engines/m4/adv_r/adv_rails.h
index 168520c227a..3361ce98b39 100644
--- a/engines/m4/adv_r/adv_rails.h
+++ b/engines/m4/adv_r/adv_rails.h
@@ -42,10 +42,12 @@ struct Rails_Globals {
extern bool InitRails();
extern void rail_system_shutdown();
extern void ClearRails();
-noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY, Buffer *walkCodes);
+extern noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY, Buffer *walkCodes);
+extern noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32 altX, int32 altY);
extern void intr_move_no_walk_rect(noWalkRect *myRect, int32 new_x1, int32 new_y1,
int32 new_x2, int32 new_y2, int32 new_altX, int32 new_altY, Buffer *walkCodes);
extern void intr_remove_no_walk_rect(noWalkRect *myRect, Buffer *walkCodes);
+extern void intr_remove_no_walk_rect(noWalkRect *myRect);
extern void CreateEdge(int32 node1, int32 node2, Buffer *walkCodes);
extern void RestoreNodeEdges(int32 nodeID, Buffer *walkCodes);
extern void RestoreEdgeList(Buffer *walkCodes);
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 122322414f8..d1fe8fb416c 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -45,7 +45,7 @@ extern void set_walker_scaling(SceneDef *rdef);
extern bool walker_has_walk_finished(machine *sender);
extern void ws_demand_location(machine *myWalker, int32 x, int32 y, int facing = -1);
extern void ws_demand_facing(machine *myWalker, int32 newFacing);
-extern void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger);
+extern void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger = -1);
extern void ws_nosepick(machine *myWalker, int32 seriesHash);
extern void ws_hide_walker(machine *myWalker);
extern void ws_unhide_walker(machine *myWalker);
@@ -53,7 +53,7 @@ extern void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigge
extern void ws_demand_location(int32 x, int32 y, int facing = -1);
extern void ws_demand_facing(int32 newFacing);
-extern void ws_turn_to_face(int32 facing, int32 trigger);
+extern void ws_turn_to_face(int32 facing, int32 trigger = -1);
extern void ws_nosepick(int32 seriesHash);
extern void ws_hide_walker();
extern void ws_unhide_walker();
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index 4f25b157abc..f99b81f31bf 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -61,9 +61,7 @@ namespace M4 {
#define CONV_CHUNK ((long) ('C' << 24) | ('O' << 16) | ('N' << 8) | 'V')
#define DECL_CHUNK ((long) ('D' << 24) | ('E' << 16) | ('C' << 8) | 'L')
-//mar22
#define FALL_CHUNK ((long) ('F' << 24) | ('A' << 16) | ('L' << 8) | 'L')
-//mar15
#define LNODE_CHUNK ((long) ('L' << 24) | ('N' << 16) | ('O' << 8) | 'D')
#define NODE_CHUNK ((long) ('N' << 24) | ('O' << 16) | ('D' << 8) | 'E')
#define ENTRY_CHUNK ((long) ('E' << 24) | ('T' << 16) | ('R' << 8) | 'Y')
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index e20da233cc2..e87797ebeca 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -432,7 +432,8 @@ void BurgerEngine::global_daemon() {
break;
case gSET_FACING:
- player_set_facing_at(_G(player_facing_x), _G(player_facing_y));
+ player_set_facing_at(_G(player_facing_x), _G(player_facing_y),
+ _G(player_trigger));
break;
case gSET_DEST:
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index 8415a3a98cf..2a47ad95176 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -38,7 +38,7 @@ struct seriesPlayBreak {
int32 trigger;
uint32 flags;
int32 loopCount;
- int32 *variable;
+ int *variable;
int32 value;
};
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index ec81dad4b40..169ac7f3447 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -48,12 +48,76 @@ static const char *SAID1[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const seriesPlayBreak Room142::PLAY1[] = {
+ { 8, 12, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 8, 12, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 8, 12, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 13, -1, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY2[] = {
+ { 0, -1, "100_015", 2, 255, -1, 1, 3, nullptr, 0 },
+ { 0, -1, "100_017", 2, 255, -1, 1, 3, nullptr, 0 },
+ { 1, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY3[] = {
+ { 0, 26, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 27, -1, nullptr, 0, 0, 14, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY4[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 6, "142b901", 2, 255, -1, 4, -1, nullptr, 0 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY5[] = {
+ { 1, 1, "100_021", 2, 255, -1, 0, 12, nullptr, 0 },
+ { 0, -1, "100_015", 2, 255, -1, 1, 4, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY6[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 1, 10, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 1, 10, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 1, 10, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 11, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY7[] = {
+ { 15, -1, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 15, -1, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 15, -1, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY8[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 25, nullptr, 0, 0, 13, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
int Room142::_val1;
int Room142::_val2;
+int Room142::_val3;
Room142::Room142() : Room() {
_val1 = 0;
_val2 = 0;
+ _val3 = 0;
_MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 9,
&_G(flags)[V000], 1003, &_val1, 18));
@@ -151,6 +215,140 @@ void Room142::init() {
}
void Room142::daemon() {
+ switch (_G(kernel).trigger) {
+ case 4:
+ digi_unload("142_006");
+ digi_play_loop("142_004", 3);
+ hotspot_set_active("TOUR BUS", true);
+ _series4 = series_play("142ba01", 0xf00, 16, -1, 10, 0, 100, 0, 0, 20, 21);
+ break;
+
+ case 5:
+ switch (_val2) {
+ case 11:
+ _G(walker).wilbur_speech("142w007");
+ break;
+ case 12:
+ _G(walker).wilbur_speech(inv_player_has("BLOCK OF ICE") ?
+ "142w007" : "142w008");
+ break;
+ case 13:
+ _G(walker).wilbur_speech("142w019");
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 6:
+ player_set_commands_allowed(false);
+ digi_play("142v901", 1, 255, 7);
+ break;
+
+ case 7:
+ digi_play("142e901", 1, 255, 8);
+ break;
+
+ case 9:
+ switch (_val1) {
+ case 14:
+ _val3 = imath_ranged_rand(1, 3);
+ _val1 = 15;
+ _volume = 155;
+ series_play_with_breaks(PLAY1, "142dt01", 0xd00, 9, 3, 6, 100);
+ break;
+
+ case 15:
+ digi_stop(1);
+ digi_unload("100_015");
+ faceTruck();
+ hotspot_set_active("TRUCK", true);
+ _val1 = 16;
+ series_play_with_breaks(PLAY2, "142dt02", 0xd00, 9, 3, 8, 100);
+ break;
+
+ case 16:
+ _val1 = 17;
+ series_play_with_breaks(PLAY3, "142bu01", 0xd00, 9, 3, 6, 100);
+ break;
+
+ case 17:
+ _noWalk = intr_add_no_walk_rect(230, 250, 294, 277, 229, 278);
+ player_set_commands_allowed(true);
+ _series2 = series_show("142dt01", 0xd00, 0, -1, -1, 22);
+ _series3 = series_show("142dt01s", 0xd01, 0, -1, -1, 22);
+ _series1 = series_show("142door", 0xe00);
+ break;
+
+ case 18:
+ player_set_commands_allowed(false);
+ ws_turn_to_face(3);
+ series_play_with_breaks(PLAY4, "142bu02", 0xd00, 8, 2, 6, 100);
+ break;
+
+ case 19:
+ _val1 = 20;
+ series_play_with_breaks(PLAY5, "142dt02", 0xd00, 9, 3, 8, 100);
+ break;
+
+ case 20:
+ digi_preload("100_015");
+ digi_play_loop("100_015", 1);
+ _val3 = imath_ranged_rand(1, 3);
+ _val1 = 21;
+ series_play_with_breaks(PLAY6, "142dt03", 0xd00, 9, 3);
+ break;
+
+ case 21:
+ _val3 = imath_ranged_rand(1, 3);
+ series_play_with_breaks(PLAY7, "142dt03", 0xf00, 8, 3);
+ _volume = 255;
+ kernel_trigger_dispatch_now(11);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case gTELEPORT:
+ // TODO
+ break;
+
+ case 10031:
+ if (_G(flags)[V000] == 1002) {
+ _G(kernel).continue_handling_trigger = true;
+
+ } else {
+ player_update_info();
+
+ if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ player_set_commands_allowed(false);
+
+ if (_G(player_info).y > 285) {
+ faceTruck();
+ } else {
+ player_walk_to(267, 290, 262, 278);
+ }
+
+ preloadAssets();
+ _G(flags)[V000] = 1004;
+ intr_remove_no_walk_rect(_noWalk);
+ hotspot_set_active("TRUCK", false);
+
+ TerminateMachineAndNull(_series1);
+ TerminateMachineAndNull(_series2);
+
+ _val1 = 19;
+ series_play_with_breaks(PLAY8, "142bu03", 0xd00, 9, 3);
+ } else {
+ kernel_timing_trigger(15, 10031);
+ }
+ }
+ break;
+ // TODO
+ }
}
void Room142::pre_parser() {
@@ -272,6 +470,21 @@ void Room142::checkAction() {
}
}
+void Room142::faceTruck() {
+ ws_turn_to_face(calc_facing(262, 277));
+}
+
+void Room142::preloadAssets() {
+ series_load("142dt02", -1);
+ series_load("142dt02s", -1);
+ series_load("142dt03", -1);
+ series_load("142dt03s", -1);
+
+ digi_preload_play_breaks(PLAY5);
+ digi_preload_play_breaks(PLAY6);
+ digi_preload_play_breaks(PLAY7);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index ffcf1823b05..6b1394c55cd 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -30,6 +30,14 @@ namespace Burger {
namespace Rooms {
class Room142 : public Room {
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
private:
Common::Array<WilburMatch> _MATCH;
machine *_series1 = nullptr;
@@ -39,10 +47,15 @@ private:
machine *_series5 = nullptr;
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
+ int _volume = 0;
static int _val1;
static int _val2;
+ static int _val3;
+ int _val4 = 0;
void checkAction();
+ void faceTruck();
+ void preloadAssets();
public:
Room142();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index cfddee24427..3a3dbce06d6 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -109,6 +109,7 @@ public:
int _npcTrigger = -1;
int _player_facing_x = 0, _player_facing_y = 0;
int _player_dest_x = 0, _player_dest_y = 0;
+ int _player_trigger = 0;
public:
Vars();
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index c24b42e806e..3cbd0568208 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -394,5 +394,17 @@ void Walker::wilbur_unpoof() {
_wilburPoof = -1;
}
+
+void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigger) {
+ _G(player_facing_x) = facing_x;
+ _G(player_facing_y) = facing_y;
+ _G(player_trigger) = trigger;
+ player_hotspot_walk_override(x, y, -1, gSET_FACING);
+}
+
+void player_walk_to(int32 x, int32 y, int trigger) {
+ player_walk_to(x, y, _G(hotspot_x), _G(hotspot_y), trigger);
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 3b625602ed9..de329512e79 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -128,6 +128,8 @@ public:
extern void enable_player();
extern void wilbur_abduct(int trigger);
+extern void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigger = -1);
+extern void player_walk_to(int32 x, int32 y, int trigger = -1);
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 2056c683899..ba9616ec6a6 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -1106,11 +1106,9 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
myBuff = myGrBuff->get_buffer();
while (myItem) {
if (myItem == myTextScrn->hiliteItem) {
- //mar4
//gr_font_set_color(myTextScrn->hiliteColor);
font_set_colors(myTextScrn->hiliteColor_alt1, myTextScrn->hiliteColor_alt2, myTextScrn->hiliteColor);
} else {
- //mar4
//gr_font_set_color(myTextScrn->textColor);
font_set_colors(myTextScrn->textColor_alt1, myTextScrn->textColor_alt2, myTextScrn->textColor);
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 33d0b57df54..6acd63d17b6 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -104,8 +104,10 @@ public:
extern bool digi_preload(const Common::String &name, int roomNum = -1);
extern void digi_unload(const Common::String &name);
-extern int32 digi_play(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
-extern int32 digi_play_loop(const char *name, uint channel, int32 vol, int32 trigger, int32 room_num = -1);
+extern int32 digi_play(const char *name, uint channel, int32 vol = 255,
+ int32 trigger = -1, int32 room_num = -1);
+extern int32 digi_play_loop(const char *name, uint channel, int32 vol = 255,
+ int32 trigger = -1, int32 room_num = -1);
extern void digi_read_another_chunk();
extern void digi_stop(int channel);
extern bool digi_play_state(int channel);
Commit: ee2d4808aa9f70b7ea7fa8b771feef5d13f49d62
https://github.com/scummvm/scummvm/commit/ee2d4808aa9f70b7ea7fa8b771feef5d13f49d62
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More room 142 daemon
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 169ac7f3447..aa366c07120 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section1/room142.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
@@ -109,6 +110,36 @@ const seriesPlayBreak Room142::PLAY8[] = {
PLAY_BREAK_END
};
+const seriesPlayBreak Room142::PLAY9[] = {
+ { 0, 3, "142_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY10[] = {
+ { 3, 0, "142_002", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY11[] = {
+ { 4, 13, "142_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 14, -1, "142_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY12[] = {
+ { 0, -1, "142_005", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room142::PLAY13[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 7, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 2, 7, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 2, 7, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
int Room142::_val1;
int Room142::_val2;
@@ -226,14 +257,14 @@ void Room142::daemon() {
case 5:
switch (_val2) {
case 11:
- _G(walker).wilbur_speech("142w007");
+ wilbur_speech("142w007");
break;
case 12:
- _G(walker).wilbur_speech(inv_player_has("BLOCK OF ICE") ?
+ wilbur_speech(inv_player_has("BLOCK OF ICE") ?
"142w007" : "142w008");
break;
case 13:
- _G(walker).wilbur_speech("142w019");
+ wilbur_speech("142w019");
break;
default:
break;
@@ -312,7 +343,92 @@ void Room142::daemon() {
break;
case gTELEPORT:
- // TODO
+ switch (_G(roomVal1)) {
+ case 1:
+ TerminateMachineAndNull(_series5);
+ disable_player();
+ _G(roomVal1) = 2;
+ series_play_with_breaks(PLAY9, "142wi04", 0xdff, gTELEPORT, 3);
+ break;
+
+ case 2:
+ player_set_commands_allowed(true);
+ _G(flags)[V059] = 1;
+ hotspot_set_active("ICE", true);
+ _series6 = series_show("142wi04", 0xdff, 0, -1, -1, 3);
+ _series7 = series_show("142wi04s", 0xdfe, 0, -1, -1, 3);
+ break;
+
+ case 3:
+ if (inv_player_has("BLOCK OF ICE")) {
+ wilbur_speech("142w009");
+ } else {
+ player_set_commands_allowed(false);
+ TerminateMachineAndNull(_series6);
+ TerminateMachineAndNull(_series7);
+ _G(roomVal1) = 4;
+
+ series_play_with_breaks(PLAY11, "142wi04", 0xdff, gTELEPORT, 3);
+ }
+ break;
+
+ case 4:
+ _G(flags)[V059] = 0;
+ hotspot_set_active("ICE", false);
+ _series5 = series_show("142icedr", 0xf00);
+ enable_player();
+ inv_give_to_player("BLOCK OF ICE");
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ TerminateMachineAndNull(_series6);
+ TerminateMachineAndNull(_series7);
+ _G(roomVal1) = 6;
+
+ series_play_with_breaks(PLAY10, "142wi02", 0xdff, gTELEPORT, 3);
+ break;
+
+ case 6:
+ _G(flags)[V059] = 0;
+ hotspot_set_active("ICE", false);
+ _series5 = series_show("142icedr", 0xe00);
+ enable_player();
+ break;
+
+ case 7:
+ player_set_commands_allowed(false);
+ TerminateMachineAndNull(_series6);
+ TerminateMachineAndNull(_series7);
+ _G(roomVal1) = 8;
+
+ series_play_with_breaks(PLAY10, "142wi04", 0xdff, gTELEPORT, 3);
+ break;
+
+ case 8:
+ _G(flags)[V059] = 0;
+ hotspot_set_active("ICE", false);
+ _series5 = series_show("142icedr", 0xe00);
+ enable_player();
+ triggerParser();
+ break;
+
+ case 9:
+ disable_player();
+ _G(roomVal1) = 10;
+ series_play_with_breaks(PLAY12, "142wi05", 0x400, gTELEPORT, 3);
+ break;
+
+ case 10:
+ enable_player();
+ hotspot_set_active("FANBELT", false);
+ inv_give_to_player("PANTYHOSE");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
break;
case 10031:
@@ -364,20 +480,20 @@ void Room142::pre_parser() {
} else if (player_said("ICE")) {
if (player_said("LOOK AT")) {
if (_G(flags)[V040] && !inv_player_has("BLOCK OF ICE")) {
- _G(walker).wilbur_speech("142w008");
+ wilbur_speech("142w008");
} else {
- _G(walker).wilbur_speech("142w007");
+ wilbur_speech("142w007");
}
} else if (player_said("TAKE")) {
if (!_G(flags)[V040]) {
- _G(walker).wilbur_speech("142w017");
+ wilbur_speech("142w017");
} else if (inv_player_has("BLOCK_OF_ICE")) {
- _G(walker).wilbur_speech("142w009");
+ wilbur_speech("142w009");
} else {
kernel_trigger_dispatch_now(gTELEPORT);
}
} else if (player_said("GEAR")) {
- _G(walker).wilbur_speech("142w002");
+ wilbur_speech("142w002");
} else {
term_message("ERROR - don't know what to do with ice!!!");
}
@@ -485,6 +601,19 @@ void Room142::preloadAssets() {
digi_preload_play_breaks(PLAY7);
}
+void Room142::triggerParser() {
+ _G(player).waiting_for_walk = true;
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+ _G(player).command_ready = true;
+ _G(kernel).trigger = -1;
+ _G(kernel).trigger_mode = KT_PREPARSE;
+ _G(player).walker_trigger = -1;
+
+ pre_parser();
+ g_engine->global_pre_parser();
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 6b1394c55cd..96ea3eff935 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -38,6 +38,11 @@ class Room142 : public Room {
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
private:
Common::Array<WilburMatch> _MATCH;
machine *_series1 = nullptr;
@@ -45,6 +50,9 @@ private:
machine *_series3 = nullptr;
machine *_series4 = nullptr;
machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
+
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
int _volume = 0;
@@ -56,6 +64,7 @@ private:
void checkAction();
void faceTruck();
void preloadAssets();
+ void triggerParser();
public:
Room142();
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 3cbd0568208..38eb9ce7869 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -263,6 +263,11 @@ void enable_player() {
ws_unhide_walker(_G(my_walker));
}
+void disable_player() {
+ player_set_commands_allowed(false);
+ ws_hide_walker(_G(my_walker));
+}
+
void wilbur_abduct(int trigger) {
player_set_commands_allowed(false);
digi_stop(1);
@@ -406,5 +411,11 @@ void player_walk_to(int32 x, int32 y, int trigger) {
player_walk_to(x, y, _G(hotspot_x), _G(hotspot_y), trigger);
}
+void wilbur_speech(const char *name, int trigger, int room, byte flags,
+ int vol, int channel) {
+ _G(walker).wilbur_speech(name, trigger, room, flags, vol, channel);
+}
+
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index de329512e79..e9a174a9938 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -127,9 +127,12 @@ public:
};
extern void enable_player();
+extern void disable_player();
extern void wilbur_abduct(int trigger);
extern void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigger = -1);
extern void player_walk_to(int32 x, int32 y, int trigger = -1);
+extern void wilbur_speech(const char *name, int trigger = -1, int room = -1, byte flags = 0,
+ int vol = 256, int channel = 1);
} // namespace Burger
} // namespace M4
Commit: 80d5041914b8754a22a2e318ee5910bcafebda78
https://github.com/scummvm/scummvm/commit/80d5041914b8754a22a2e318ee5910bcafebda78
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 142 daemon
Changed paths:
engines/m4/burger/core/play_break.cpp
engines/m4/burger/core/play_break.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index ede582c1bfb..8fe54964814 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -182,13 +182,13 @@ int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name, fr
return slot;
}
-void digi_preload_play_breaks(const seriesPlayBreak list[]) {
+void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll) {
int32 i = 0;
// While there is a legitimate frame to break on
while (list[i].firstFrame >= 0) {
// If variable is null or variable = value then this break is used
- if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
+ if ((!list[i].variable) || (*(list[i].variable) == list[i].value) || loadAll) {
// If there is a sound to load for this break
if (list[i].sound) {
if (!digi_preload(list[i].sound)) {
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index 2a47ad95176..67a05450e67 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -52,7 +52,7 @@ enum {
extern int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name,
frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 6,
int32 scale = 100, int32 x = 0, int32 y = 0);
-extern void digi_preload_play_breaks(const seriesPlayBreak list[]);
+extern void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll = false);
extern void digi_unload_play_breaks(const seriesPlayBreak list[]);
extern void handle_series_play_break(int32 slot);
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index aa366c07120..888f77c57fb 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -140,6 +140,11 @@ const seriesPlayBreak Room142::PLAY13[] = {
PLAY_BREAK_END
};
+const seriesPlayBreak Room142::PLAY14[] = {
+ { 0, 19, "142_007", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
int Room142::_val1;
int Room142::_val2;
@@ -247,6 +252,30 @@ void Room142::init() {
void Room142::daemon() {
switch (_G(kernel).trigger) {
+ case 1:
+ TerminateMachineAndNull(_series8);
+ TerminateMachineAndNull(_series5);
+ TerminateMachineAndNull(_series1);
+
+ if (_G(player_info.y) < 285) {
+ Section1::updateWalker(adjustY(_G(player_info).y), 285, 9, 2);
+ } else {
+ Section1::updateWalker(adjustY(_G(player_info).y), _G(player_info).y, 9, 2);
+ }
+ break;
+
+ case 2:
+ _series8 = series_play("142sm01", 0xf00, 4);
+ _series5 = series_play("142icedr", 0xe00);
+ _series1 = series_play("142door", 0xe00);
+ _G(walker).reset_walker_sprites();
+ play015();
+ break;
+
+ case 3:
+ play015();
+ break;
+
case 4:
digi_unload("142_006");
digi_play_loop("142_004", 3);
@@ -280,6 +309,10 @@ void Room142::daemon() {
digi_play("142e901", 1, 255, 8);
break;
+ case 8:
+ player_set_commands_allowed(true);
+ break;
+
case 9:
switch (_val1) {
case 14:
@@ -342,6 +375,42 @@ void Room142::daemon() {
}
break;
+ case 10:
+ _volume -= 10;
+ if (_volume > 0) {
+ term_message("fading truck theme, current volume = %d", _volume);
+ digi_change_volume(3, _volume);
+ kernel_timing_trigger(6, 10);
+ } else {
+ digi_stop(3);
+ digi_unload("100_013");
+ digi_play_loop("142_004", 3);
+ }
+ break;
+
+ case 11:
+ _volume -= 20;
+ if (_volume > 0) {
+ term_message("fading truck noise, current volume = %d", _volume);
+ digi_change_volume(1, _volume);
+ kernel_timing_trigger(6, 10);
+ } else {
+ digi_stop(1);
+ digi_stop(2);
+ digi_unload("100_015");
+ digi_unload("100_021");
+ }
+ break;
+
+ case 13:
+ _series1 = series_show("142door", 0xe00);
+ break;
+
+ case 14:
+ TerminateMachineAndNull(_series1);
+ break;
+
+
case gTELEPORT:
switch (_G(roomVal1)) {
case 1:
@@ -431,6 +500,40 @@ void Room142::daemon() {
}
break;
+ case 10028:
+ if (!_G(flags)[V043]) {
+ if (_series2) {
+ TerminateMachineAndNull(_series2);
+ TerminateMachineAndNull(_series3);
+ }
+ if (_series4) {
+ TerminateMachineAndNull(_series4);
+ _G(flags)[V058] = 0;
+ }
+
+ _G(flags)[V000] = 1003;
+
+ if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ digi_preload("100_013");
+ digi_play("100_013", 3, 155);
+ Section1::updateDisablePlayer();
+ preloadAssets2();
+
+ if (adjustY(_G(player_info).y) > _G(player_info).x ||
+ (_G(player_info).x < 298 && _G(player_info).y < 285)) {
+ kernel_timing_trigger(240, 1);
+ } else {
+ kernel_timing_trigger(240, 3);
+ }
+ } else {
+ kernel_timing_trigger(15, 10028);
+ }
+ } else {
+ _G(kernel).continue_handling_trigger = true;
+ }
+ break;
+
case 10031:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
@@ -463,7 +566,32 @@ void Room142::daemon() {
}
}
break;
- // TODO
+
+ case 10032:
+ if (_series2) {
+ TerminateMachineAndNull(_series2);
+ _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1004;
+ }
+
+ if (!_G(flags)[V058]) {
+ _G(flags)[V058] = 1;
+ digi_preload("142_006");
+ digi_play("142_006", 3, 255, 4);
+ series_play_with_breaks(PLAY14, "142ba01", 0xf00, -1, 2);
+ }
+ break;
+
+ case CALLED_EACH_LOOP:
+ if (_actionType == 0) {
+ _G(kernel).call_daemon_every_loop = false;
+ } else {
+ checkAction();
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
}
}
@@ -591,16 +719,25 @@ void Room142::faceTruck() {
}
void Room142::preloadAssets() {
- series_load("142dt02", -1);
- series_load("142dt02s", -1);
- series_load("142dt03", -1);
- series_load("142dt03s", -1);
+ series_load("142dt02");
+ series_load("142dt02s");
+ series_load("142dt03");
+ series_load("142dt03s");
digi_preload_play_breaks(PLAY5);
digi_preload_play_breaks(PLAY6);
digi_preload_play_breaks(PLAY7);
}
+void Room142::preloadAssets2() {
+ series_load("142dt01");
+ series_load("142dt01s");
+ series_load("142dt02");
+ series_load("142dt02s");
+ digi_preload_play_breaks(PLAY1, true);
+ digi_preload_play_breaks(PLAY1, true);
+}
+
void Room142::triggerParser() {
_G(player).waiting_for_walk = true;
_G(player).ready_to_walk = true;
@@ -614,6 +751,15 @@ void Room142::triggerParser() {
g_engine->global_pre_parser();
}
+void Room142::play015() {
+ digi_preload("100_015");
+ digi_play_loop("100_015", 1);
+
+ _val3 = imath_ranged_rand(1, 3);
+ _val1 = 14;
+ series_play_with_breaks(PLAY13, "142dt01", 0x100, 9, 3);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 96ea3eff935..161b37c67f7 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -43,6 +43,7 @@ class Room142 : public Room {
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
private:
Common::Array<WilburMatch> _MATCH;
machine *_series1 = nullptr;
@@ -52,6 +53,7 @@ private:
machine *_series5 = nullptr;
machine *_series6 = nullptr;
machine *_series7 = nullptr;
+ machine *_series8 = nullptr;
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
@@ -64,7 +66,12 @@ private:
void checkAction();
void faceTruck();
void preloadAssets();
+ void preloadAssets2();
void triggerParser();
+ void play015();
+ int adjustY(int val) const {
+ return (int)((double)val * -1.428571428571429);
+ }
public:
Room142();
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index d0c51ac069f..ae04cf99b04 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -52,7 +52,7 @@ enum {
HASH_STREAM_MACHINE = 6
};
-extern int32 series_load(const char *seriesName, int32 assetIndex, RGB8 *myPal = nullptr);
+extern int32 series_load(const char *seriesName, int32 assetIndex = -1, RGB8 *myPal = nullptr);
extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
@@ -60,8 +60,8 @@ extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, i
//extern machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer); // was series_show_sprite
//extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
-extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags,
- int16 triggerNum, int32 frameRate, int32 loopCount, int32 s = 100,
+extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
//extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
Commit: 9f2fca7c32bcfd71e2bf45a139e7dda88c1a420b
https://github.com/scummvm/scummvm/commit/9f2fca7c32bcfd71e2bf45a139e7dda88c1a420b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix room 142 crash
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 888f77c57fb..85b97de985f 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -154,7 +154,10 @@ Room142::Room142() : Room() {
_val1 = 0;
_val2 = 0;
_val3 = 0;
+}
+void Room142::init() {
+ _MATCH.clear();
_MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 9,
&_G(flags)[V000], 1003, &_val1, 18));
_MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 9,
@@ -169,9 +172,7 @@ Room142::Room142() : Room() {
nullptr, 0, &_G(roomVal1), 9));
_MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
nullptr, 0, nullptr, 0));
-}
-void Room142::init() {
_G(player).walker_in_this_scene = true;
digi_preload("142_004");
digi_play_loop("142_004", 3, 255, -1);
Commit: d0df59a7261495753a1fae16db3a186c6a6a5247
https://github.com/scummvm/scummvm/commit/d0df59a7261495753a1fae16db3a186c6a6a5247
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Make mouse pointer a bit more responsive
Changed paths:
engines/m4/platform/events.cpp
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index c6bc8ee0590..727c3c8f7e8 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -229,7 +229,7 @@ void Events::delay(uint amount) {
do {
krn_pal_game_task();
- g_system->delayMillis(10);
+ g_system->delayMillis(5);
process();
newTime = g_system->getMillis();
Commit: 4209036235f160d28eb05fcc6e9b91f6fdd5bcfc
https://github.com/scummvm/scummvm/commit/4209036235f160d28eb05fcc6e9b91f6fdd5bcfc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix picking up fanbelt in room 142
Changed paths:
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 38eb9ce7869..33c8671caa4 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -373,7 +373,8 @@ bool Walker::wilbur_match(const Common::Array<WilburMatch> &list) {
if (player_said(m._word0, m._word1)) {
term_message("matched %s and %s", m._word0, m._word1);
- term_message("test variable:%d value:%d", *m._testVariable, m._testValue);
+ term_message("test variable:%d value:%d",
+ m._testVariable ? *m._testVariable : 0, m._testValue);
if (!m._testVariable || *m._testVariable == m._testValue) {
if (m._newVariable)
Commit: f0c847dbe7dcde61a2b3a0f0469e71ea4c886d36
https://github.com/scummvm/scummvm/commit/f0c847dbe7dcde61a2b3a0f0469e71ea4c886d36
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix highlighting inventory items
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/gui_cheapo.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index beb64187f0e..19275d7a16c 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -539,7 +539,7 @@ Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cell
error_show(FL, 'CGIC');
}
- _highlight = _dehighlight = -1;
+ _highlight = -1;
_must_redraw_all = true;
_must_redraw1 = -1;
_must_redraw2 = -1;
@@ -720,7 +720,6 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
if (!_GI(visible))
return NOTHING;
- static int16 interface_tracking = -1;
ControlStatus result = NOTHING;
int16 over = inside(x, y);
diff --git a/engines/m4/burger/gui/gui_cheapo.h b/engines/m4/burger/gui/gui_cheapo.h
index 48b7eeb23f6..b83568c20ea 100644
--- a/engines/m4/burger/gui/gui_cheapo.h
+++ b/engines/m4/burger/gui/gui_cheapo.h
@@ -188,13 +188,14 @@ private:
int16 cell_pos_x(int16 index);
int16 cell_pos_y(int16 index);
+ int16 interface_tracking = -1;
public:
int16 _scroll = 0;
int16 _cells_h = 0, _cells_v = 0;
int16 _cell_w = 0, _cell_h = 0;
int16 _must_redraw1 = 0, _must_redraw2 = 0;
- int16 _highlight = 0, _dehighlight = 0;
+ int16 _highlight = 0;
bool _must_redraw_all = false;
Entry _items[INVENTORY_CELLS_COUNT];
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 809285b86e9..791f0d9d152 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -213,8 +213,10 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
break;
}
- if (_state == 0 || _state == 2) {
- _state = _inventory->track(event, _x1, _y1) ? 2 : 0;
+ if (_state == NOTHING || _state == OVER_CONTROL) {
+ status = _inventory->track(event, x - _x1, y - _y1);
+ handleState(status);
+ _state = status ? OVER_CONTROL : NOTHING;
}
if (!_state) {
@@ -433,6 +435,68 @@ void Interface::dispatch_command() {
g_engine->global_pre_parser();
}
+void Interface::handleState(ControlStatus status) {
+ int highlight = _inventory->_highlight;
+ int index = _inventory->_scroll + highlight;
+
+ switch (status) {
+ case NOTHING:
+ cstrncpy(_nounText, " ", 40);
+ _textField->set_string(" ");
+ break;
+
+ case OVER_CONTROL:
+ if (highlight < -1 || (highlight != -1 && (
+ highlight < 128 || highlight > 129))) {
+ _hotspot = nullptr;
+ cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+ }
+ break;
+
+ case SELECTED:
+ if (highlight != -1 && _inventory->_items[index]._cell != -1) {
+ if (_flag1) {
+ _hotspot = nullptr;
+ cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+
+ term_message("got %d", index);
+ dispatch_command();
+
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = false;
+ _G(player).waiting_for_walk = false;
+ } else {
+ _hotspot = nullptr;
+ cstrncpy(_verbText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+
+ mouse_set_sprite(_inventory->_items[index]._cursor);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
void Interface::l_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "look at");
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 055a6353d07..58b9533668a 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -40,6 +40,7 @@ private:
void trackIcons();
ControlStatus trackHotspots(int event, int x, int y);
void dispatch_command();
+ void handleState(ControlStatus status);
public:
int _sprite = 22; // main_interface_sprite;
Commit: d75a34748838f3ab7913156c19109f5e6d90dc80
https://github.com/scummvm/scummvm/commit/d75a34748838f3ab7913156c19109f5e6d90dc80
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix green highlight box for inventory items
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 19275d7a16c..60bf660a957 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -694,10 +694,12 @@ void Inventory::draw(GrBuff *myBuffer) {
// Draw box around icon
if (_highlight == cell_iter) {
- gr_line(left, top, left + _cell_w - 2, top + 1, __LTGRAY, myBuff);
- gr_line(left, top + _cell_h - 2, left + _cell_w - 2, top + _cell_h - 2, __LTGRAY, myBuff);
- gr_line(left, top, left, top + _cell_h - 2, __LTGRAY, myBuff);
- gr_line(left + _cell_w - 2, top + 1, left + _cell_w - 2, top + _cell_h - 2, __LTGRAY, myBuff);
+ left += 2;
+ top += 20;
+ gr_line(left, top, left + 35, top, __GREEN, myBuff);
+ gr_line(left + 35, top, left + 35, top + 35, __GREEN, myBuff);
+ gr_line(left, top, left, top + 35, __GREEN, myBuff);
+ gr_line(left, top + 35, left + 35, top + 35, __GREEN, myBuff);
}
}
}
Commit: e452ffd9f78c2629c2eaa733537b2f97501f4827
https://github.com/scummvm/scummvm/commit/e452ffd9f78c2629c2eaa733537b2f97501f4827
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix using inventory items in scene
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 791f0d9d152..d9fd33f13ef 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -120,7 +120,7 @@ void Interface::cancel_sentence() {
_prepText[0] = '\0';
_nounText[0] = '\0';
_verbText[0] = '\0';
- _flag1 = false;
+ _iconSelected = false;
track_hotspots_refresh();
}
@@ -203,13 +203,13 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
switch (status) {
case NOTHING:
- _state = 0;
+ _state = NOTHING;
break;
case SELECTED:
trackIcons();
break;
default:
- _state = 1;
+ _state = IN_CONTROL;
break;
}
@@ -224,7 +224,7 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
if (y >= _y1) {
- if (!_flag1)
+ if (!_iconSelected)
mouse_set_sprite(kArrowCursor);
_textField->set_string(" ");
@@ -288,7 +288,7 @@ void Interface::trackIcons() {
case 6:
mouse_set_sprite(_arrow);
- _flag1 = false;
+ _iconSelected = false;
if (_btnScrollRight->is_hidden())
refresh_right_arrow();
@@ -372,7 +372,7 @@ ControlStatus Interface::trackHotspots(int event, int x, int y) {
} else {
if (hotspot != _hotspot) {
- if (!_flag1) {
+ if (!_iconSelected) {
if (!mouse_set_sprite(hotspot->cursor_number))
mouse_set_sprite(kArrowCursor);
@@ -426,7 +426,7 @@ void Interface::dispatch_command() {
_G(player).command_ready = true;
_G(kernel).trigger = -1;
_G(kernel).trigger_mode = KT_PREPARSE;
- _flag1 = false;
+ _iconSelected = false;
mouse_set_sprite(_arrow);
_G(player).walker_trigger = -1;
@@ -461,7 +461,7 @@ void Interface::handleState(ControlStatus status) {
case SELECTED:
if (highlight != -1 && _inventory->_items[index]._cell != -1) {
- if (_flag1) {
+ if (_iconSelected) {
_hotspot = nullptr;
cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
@@ -488,6 +488,7 @@ void Interface::handleState(ControlStatus status) {
}
mouse_set_sprite(_inventory->_items[index]._cursor);
+ _iconSelected = true;
}
}
break;
@@ -501,7 +502,7 @@ void Interface::l_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "look at");
mouse_set_sprite(_look);
- _flag1 = true;
+ _iconSelected = true;
_G(cursor_state) = kLOOK;
}
}
@@ -510,7 +511,7 @@ void Interface::u_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "gear");
mouse_set_sprite(_use);
- _flag1 = true;
+ _iconSelected = true;
_G(cursor_state) = kUSE;
}
}
@@ -519,7 +520,7 @@ void Interface::t_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "take");
mouse_set_sprite(_grab);
- _flag1 = true;
+ _iconSelected = true;
_G(cursor_state) = kTAKE;
}
}
@@ -528,7 +529,7 @@ void Interface::a_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "<><><><><><><><>");
mouse_set_sprite(_arrow);
- _flag1 = true;
+ _iconSelected = true;
_G(cursor_state) = kARROW;
}
}
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index 58b9533668a..dea986d70b3 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -60,7 +60,7 @@ public:
char _prepText[40] = { 0 };
char _nounText[40] = { 0 };
char _verbText[40] = { 0 };
- bool _flag1 = false;
+ bool _iconSelected = false;
int _state = 0;
Interface();
Commit: b2b85becacbc17e4d540a4bb4fb9d26770b975c4
https://github.com/scummvm/scummvm/commit/b2b85becacbc17e4d540a4bb4fb9d26770b975c4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further fixes for using items
Changed paths:
engines/m4/burger/gui/interface.cpp
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index d9fd33f13ef..71f2a8b4fd4 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -219,7 +219,7 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
_state = status ? OVER_CONTROL : NOTHING;
}
- if (!_state) {
+ if (_state == NOTHING) {
int32 scrStatus;
ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
@@ -365,52 +365,51 @@ ControlStatus Interface::trackHotspots(int event, int x, int y) {
if (!hotspot)
hotspot = hotspot_which(_G(currentSceneDef).hotspots, x, y);
- if (hotspot != _hotspot && !hotspot) {
- _textField->set_string(" ");
- _hotspot = nullptr;
- return NOTHING;
+ if (hotspot != _hotspot) {
+ if (!hotspot) {
+ _textField->set_string(" ");
+ _hotspot = nullptr;
+ return NOTHING;
+ }
- } else {
- if (hotspot != _hotspot) {
- if (!_iconSelected) {
- if (!mouse_set_sprite(hotspot->cursor_number))
- mouse_set_sprite(kArrowCursor);
+ if (!_iconSelected) {
+ if (!mouse_set_sprite(hotspot->cursor_number))
+ mouse_set_sprite(kArrowCursor);
- strncpy(_verbText, hotspot->verb, 40);
- }
+ strncpy(_verbText, hotspot->verb, 40);
+ }
- Common::String tmp = (g_engine->getLanguage() == Common::EN_ANY) ?
- hotspot->vocab : hotspot->prep;
- tmp.toUppercase();
- _textField->set_string(tmp.c_str());
+ Common::String tmp = (g_engine->getLanguage() == Common::EN_ANY) ?
+ hotspot->vocab : hotspot->prep;
+ tmp.toUppercase();
+ _textField->set_string(tmp.c_str());
- tmp = hotspot->vocab;
- tmp.toUppercase();
- strncpy(_nounText, tmp.c_str(), 40);
+ tmp = hotspot->vocab;
+ tmp.toUppercase();
+ strncpy(_nounText, tmp.c_str(), 40);
- _hotspot = hotspot;
- }
+ _hotspot = hotspot;
+ }
- if (event == 5 && hotspot) {
- _G(player).walk_x = x;
- _G(player).walk_y = y;
- _G(hotspot_x) = x;
- _G(hotspot_y) = y;
-
- if (hotspot) {
- if (hotspot->feet_x != 0x7fff)
- _G(player).walk_x = hotspot->feet_x;
- if (hotspot->feet_y != 0x7fff)
- _G(player).walk_y = hotspot->feet_y;
- }
+ if (event == 5 && hotspot) {
+ _G(player).walk_x = x;
+ _G(player).walk_y = y;
+ _G(hotspot_x) = x;
+ _G(hotspot_y) = y;
+
+ if (hotspot) {
+ if (hotspot->feet_x != 0x7fff)
+ _G(player).walk_x = hotspot->feet_x;
+ if (hotspot->feet_y != 0x7fff)
+ _G(player).walk_y = hotspot->feet_y;
+ }
- _G(player).walk_facing = hotspot->facing;
- _hotspot = nullptr;
+ _G(player).walk_facing = hotspot->facing;
+ _hotspot = nullptr;
- return SELECTED;
- } else {
- return NOTHING;
- }
+ return SELECTED;
+ } else {
+ return IN_CONTROL;
}
}
@@ -441,6 +440,7 @@ void Interface::handleState(ControlStatus status) {
switch (status) {
case NOTHING:
+ _hotspot = nullptr;
cstrncpy(_nounText, " ", 40);
_textField->set_string(" ");
break;
Commit: ad0d02ac7e222a62216033743f79cb7248c2cfdf
https://github.com/scummvm/scummvm/commit/ad0d02ac7e222a62216033743f79cb7248c2cfdf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 106 methods
Changed paths:
engines/m4/adv_r/adv_walk.h
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index d1fe8fb416c..42dd7d022b0 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -57,7 +57,7 @@ extern void ws_turn_to_face(int32 facing, int32 trigger = -1);
extern void ws_nosepick(int32 seriesHash);
extern void ws_hide_walker();
extern void ws_unhide_walker();
-extern void ws_walk(int32 x, int32 y, GrBuff **buffer, int16 trigger, int32 finalFacing, bool complete_walk = true);
+extern void ws_walk(int32 x, int32 y, GrBuff **buffer, int16 trigger, int32 finalFacing = -1, bool complete_walk = true);
extern void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing);
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 05211bed5d9..98cebd95ae2 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -28,17 +28,133 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "GARBAGE CANS", "106w002", "106w003", nullptr },
+ { "POLICE STATION", "106w004", "106w004z", "106w004z" },
+ { "JAIL CELL", "106w005", "106w004z", "106w004z" },
+ { "BARRED WINDOW", "106w006", "106w004z", nullptr },
+ { "FENCE ", "106w008", "106w004z", "106w009" },
+ { "RAZOR WIRE", "106w010", "106w011", "106w011" },
+ { "GATE", "106w012", "106w004z", "106w013" },
+ { "SIGN", "106w015", nullptr, nullptr },
+ { "TIRE", "106w016", "106w017", "106w018" },
+ { "TOW TRUCK", "106w019", "106w004z", "106w020" },
+ { "PEGLEG", "106w021", "106w022", "106w022" },
+ { "PEGLEG ", "106w021", "106w022", "106w022" },
+ { "TIRE ", "106w023", "106w020", "106w020" },
+ { "MAIN STREET", nullptr, "106w004z", nullptr },
+ { "DOG COLLAR ", "106w900", nullptr, "106w901" },
+ { "DOG COLLAR ", "106w900", nullptr, "106w901" },
+ { "HOOK ", "106w903", "106w904", "106w004z" },
+ { "WINCH", "106w902", "106w004z", "106w904" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
void Room106::init() {
- _G(player).walker_in_this_scene = true;
+ _G(player).walker_in_this_scene = _G(game).room_id != 137 &&
+ _G(game).room_id != 138;
+
+ _MATCH.clear();
+ _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_val1, 2));
+ _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_val1, 2));
+ _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_val1, 2));
+
+ digi_preload("100_001");
+ digi_preload("106_101");
+ _digi1 = "100_001";
+
+ kernel_trigger_dispatch_now(1);
+ player_set_commands_allowed(false);
+ _val1 = 0;
+
+ setHotspots();
+ loadSeries();
+
+ if (_G(game).previous_room == -1) {
+ _val2 = _G(flags)[V172] == 10023 ? 9 : 15;
+ } else {
+ _val2 = imath_ranged_rand(1, 2) == 1 ? 5 : 6;
+ }
+
+ kernel_trigger_dispatch_now(3);
+ series_show("106gate", 0x4fd);
+ series_show("106gates", 0x4fe);
+ series_show("106tt", 0x600);
+ series_show("106tire", 0x600);
+
+ switch (_G(game).previous_room) {
+ case 101:
+ ws_demand_location(-40, 317, 3);
+ ws_walk(62, 340, nullptr, 0);
+ break;
+
+ case 138:
+ digi_play("106_102", 1, 255, 4);
+ break;
+
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ ws_demand_location(169, 336, 5);
+ break;
+ }
}
void Room106::daemon() {
}
void Room106::pre_parser() {
+ if (player_said("SKY"))
+ player_set_facing_hotspot();
+
+ if (player_said("MAIN STREET") && player_said_any("GEAR", "LOOK AT")) {
+ player_set_facing_at(-40, 317);
+ }
}
void Room106::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(walker).wilbur_said(SAID)) {
+ if (player_said_any("GEAR", "LOOK AT") && player_said("MAIN STREET")) {
+ disable_player_commands_and_fade_init(1001);
+ _G(player).command_ready = false;
+ } else if (_G(walker).wilbur_match(_MATCH)) {
+ _G(player).command_ready = false;
+ }
+ }
+}
+
+void Room106::setHotspots() {
+ hotspot_set_active("PEGLEG", false);
+ hotspot_set_active("PEGLEG ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+
+ switch (_G(flags)[V172]) {
+ case 10023:
+ hotspot_set_active("PEGLEG", true);
+ hotspot_set_active("DOG COLLAR ", true);
+ break;
+
+ case 10024:
+ hotspot_set_active("PEGLEG ", true);
+ hotspot_set_active("DOG COLLAR ", true);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Room106::loadSeries() {
+ series_load("106dg04");
+ series_load("106dg04s");
+ series_load("106dg07");
+ series_load("106dg07s");
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index ee659dca60b..33ecd2a1e45 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -23,12 +23,22 @@
#define M4_BURGER_ROOMS_SECTION1_ROOM106_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room106 : public Room {
+private:
+ Common::Array<WilburMatch> _MATCH;
+ const char *_digi1 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+
+ void setHotspots();
+ void loadSeries();
+
public:
Room106() : Room() {}
~Room106() override {}
Commit: c98fc8aeabbaa031710af23eefb2175162ad4ff1
https://github.com/scummvm/scummvm/commit/c98fc8aeabbaa031710af23eefb2175162ad4ff1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Starting room 106 daemon
Changed paths:
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 98cebd95ae2..b9c004f98cd 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -50,10 +50,75 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const seriesPlayBreak Room106::PLAY1[] = {
+ { 0, -1, "106d003a", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 0, -1, "106d003b", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 0, -1, "106d003c", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 0, -1, "106d003d", 2, 255, -1, 0, 0, &_val3, 4 },
+ { 0, -1, "106d003e", 2, 255, -1, 0, 0, &_val3, 5 },
+ { 0, -1, "106d003f", 2, 255, -1, 0, 0, &_val3, 6 },
+ { 0, -1, "106d003g", 2, 255, -1, 0, 0, &_val3, 7 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY2[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY3[] = {
+ { 0, -1, "106d001a", 2, 255, -1, 0, -1, &_val3, 1 },
+ { 0, -1, "106d001b", 2, 255, -1, 0, -1, &_val3, 2 },
+ { 0, -1, "106d001c", 2, 255, -1, 0, -1, &_val3, 3 },
+ { 0, -1, "106d001d", 2, 255, -1, 0, -1, &_val3, 4 },
+ { 0, -1, "106d001e", 2, 255, -1, 0, -1, &_val3, 5 },
+ { 0, -1, "106d001f", 2, 255, -1, 0, -1, &_val3, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY4[] = {
+ { 0, -1, "106d002a", 2, 255, -1, 0, -1, &_val3, 1 },
+ { 0, -1, "106d002b", 2, 255, -1, 0, -1, &_val3, 2 },
+ { 0, -1, "106d002c", 2, 255, -1, 0, -1, &_val3, 3 },
+ { 0, -1, "106d002d", 2, 255, -1, 0, -1, &_val3, 4 },
+ { 0, -1, "106d002e", 2, 255, -1, 0, -1, &_val3, 5 },
+ { 0, -1, "106d002f", 2, 255, -1, 0, -1, &_val3, 6 },
+ { 0, -1, "106d002g", 2, 255, -1, 0, -1, &_val3, 7 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY5[] = {
+ { 0, 4, "106d006a", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 0, 4, "106d006b", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 0, 4, "106d006c", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 5, -1, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY6[] = {
+ { 0, 4, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 5, -1, "106d007a", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 5, -1, "106d007b", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 5, -1, "106d007c", 2, 255, -1, 0, 0, &_val3, 3 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room106::PLAY7[] = {
+ { 0, -1, "106d005", 2, 255, -1, 0, 0, &_val3, 1 },
+ { 0, -1, "106d005b", 2, 255, -1, 0, 0, &_val3, 2 },
+ { 0, -1, "106d005c", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 0, -1, "106d005d", 2, 255, -1, 0, 0, &_val3, 4 },
+ { 0, -1, "106d005e", 2, 255, -1, 0, 0, &_val3, 5 },
+ { 0, -1, "106d005f", 2, 255, -1, 0, 0, &_val3, 6 },
+ PLAY_BREAK_END
+};
+
+int Room106::_val3;
void Room106::init() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
_G(game).room_id != 138;
+ _val3 = 0;
_MATCH.clear();
_MATCH.push_back(WilburMatch("JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_val1, 2));
@@ -104,6 +169,13 @@ void Room106::init() {
}
void Room106::daemon() {
+ switch (_G(kernel).trigger) {
+ case 5:
+ _val3 = imath_ranged_rand(1, 7);
+ _val2 = 7;
+ series_play_with_breaks(PLAY1, "106dg01", 0x501, 3, 3);
+ break;
+ }
}
void Room106::pre_parser() {
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index 33ecd2a1e45..bcff5f552e2 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -30,11 +30,19 @@ namespace Burger {
namespace Rooms {
class Room106 : public Room {
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
private:
Common::Array<WilburMatch> _MATCH;
const char *_digi1 = nullptr;
int _val1 = 0;
int _val2 = 0;
+ static int _val3;
void setHotspots();
void loadSeries();
Commit: 5667ab5fb60e1e37ec0b6773c15cea8b571d9ffd
https://github.com/scummvm/scummvm/commit/5667ab5fb60e1e37ec0b6773c15cea8b571d9ffd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 106 daemon
Changed paths:
engines/m4/burger/rooms/section1/room106.cpp
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index b9c004f98cd..ac70ad3355e 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -170,10 +170,186 @@ void Room106::init() {
void Room106::daemon() {
switch (_G(kernel).trigger) {
+ case 1:
+ _digi1 = !strcmp(_digi1, "106_101") ? "100_001" : "106_101";
+ digi_play(_digi1, 3, 255, 1);
+ break;
+
+ case 2:
+ switch (_val1) {
+ case 1:
+ player_set_commands_allowed(true);
+ _G(walker).wilbur_speech_random("106w001a", "106w001b", "106w001c");
+ break;
+ case 2:
+ wilbur_speech("106w014");
+ break;
+ case 3:
+ wilbur_speech("106w501", 5);
+ break;
+ case 4:
+ wilbur_speech("106w500", 10022);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ switch (_val2) {
+ case 5:
+ _val3 = imath_ranged_rand(1, 7);
+ _val2 = 7;
+ series_play_with_breaks(PLAY1, "106dg01", 0x501, 3, 3);
+ break;
+
+ case 6:
+ _val2 = 7;
+ series_play_with_breaks(PLAY2, "106dg02", 0x501, 3, 3);
+ break;
+
+ case 7:
+ _val3 = imath_ranged_rand(1, 6);
+ _val2 = _G(game).previous_room == 137 || _G(game).previous_room == 138 ? 9 : 8;
+ series_play_with_breaks(PLAY3, "106dg04", 0x501, 3, 3);
+ break;
+
+ case 8:
+ _val1 = 1;
+ ws_turn_to_face(calc_facing(415, 234), 2);
+ _val2 = 9;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 9:
+ _G(flags)[V172] = 10023;
+
+ switch (imath_ranged_rand(1, 6)) {
+ case 1:
+ _val2 = 10;
+ break;
+ case 2:
+ _val2 = 11;
+ break;
+ case 3:
+ _val2 = 12;
+ break;
+ default:
+ _val2 = 9;
+ break;
+ }
+
+ series_show("106dg07", 0x501, 0, 3, 120);
+ series_show("106dg07s", 0x502, 0, -1, 120);
+ break;
+
+ case 10:
+ if (digi_play_state(1)) {
+ _val2 = 9;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ _val3 = imath_ranged_rand(1, 7);
+ _val2 = 9;
+ series_play_with_breaks(PLAY4, "106dg05", 0x501, 3, 3);
+ }
+ break;
+
+ case 11:
+ if (digi_play_state(1)) {
+ _val2 = 9;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ _val3 = imath_ranged_rand(1, 3);
+ _val2 = 15;
+ series_play_with_breaks(PLAY5, "106dg07", 0x501, 3, 3);
+ }
+ break;
+
+ case 12:
+ if (digi_play_state(1)) {
+ _val2 = 9;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ _val3 = imath_ranged_rand(1, 6);
+ _val2 = 9;
+ series_play_with_breaks(PLAY3, "106dg04", 0x501, 3, 3);
+ }
+ break;
+
+ case 13:
+ if (digi_play_state(1)) {
+ _val2 = 15;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ _val3 = imath_ranged_rand(1, 6);
+ _val2 = 15;
+ series_play_with_breaks(PLAY3, "106dg09", 0x501, 3, 3);
+ }
+ break;
+
+ case 14:
+ if (digi_play_state(1)) {
+ _val2 = 15;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ _val3 = imath_ranged_rand(1, 3);
+ _val2 = 9;
+ series_play_with_breaks(PLAY6, "106dg11", 0x501, 3, 3);
+ }
+ break;
+
+ case 15:
+ _G(flags)[V172] = 10024;
+
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ _val2 = 13;
+ break;
+ case 2:
+ _val2 = 14;
+ break;
+ default:
+ _val2 = 15;
+ break;
+ }
+
+ series_show("106dg07", 0x501, 0, 3, 120, 8);
+ series_show("106dg07s", 0x502, 0, -1, 120, 8);
+ break;
+
+ case 16:
+ _val3 = imath_ranged_rand(1, 6);
+ _val2 = 11;
+ series_play_with_breaks(PLAY7, "106dg06", 0x501, 3, 3);
+ break;
+
+ case 17:
+ _val3 = imath_ranged_rand(1, 6);
+ _val2 = 13;
+ series_play_with_breaks(PLAY7, "106dg10", 0x501, 3, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ _val1 = 3;
+ digi_play("106s001", 1, 255, 2);
+ break;
+
case 5:
- _val3 = imath_ranged_rand(1, 7);
- _val2 = 7;
- series_play_with_breaks(PLAY1, "106dg01", 0x501, 3, 3);
+ _val1 = 4;
+ digi_play("106_103", 1, 255, 2);
+ break;
+
+ case 10008:
+ _val2 = _G(flags)[V172] == 10023 ? 16 : 17;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
break;
}
}
Commit: 45a08c2577f388849d557ea4aee7fdf4e0ed365a
https://github.com/scummvm/scummvm/commit/45a08c2577f388849d557ea4aee7fdf4e0ed365a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added flag command to console
Changed paths:
engines/m4/console.cpp
engines/m4/console.h
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 9ca37062a89..57d129b8301 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -21,12 +21,14 @@
#include "m4/console.h"
#include "m4/vars.h"
+#include "m4/burger/vars.h"
namespace M4 {
Console::Console() : GUI::Debugger() {
registerCmd("test", WRAP_METHOD(Console, Cmd_test));
registerCmd("room", WRAP_METHOD(Console, Cmd_room));
+ registerCmd("flag", WRAP_METHOD(Console, Cmd_flag));
}
Console::~Console() {
@@ -47,5 +49,22 @@ bool Console::Cmd_room(int argc, const char **argv) {
}
}
+bool Console::Cmd_flag(int argc, const char **argv) {
+ if (!Burger::g_vars) {
+ debugPrintf("Not Orion Burger\n");
+ } else if (argc == 2) {
+ int flagNum = atol(argv[1]);
+ debugPrintf("Flag %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
+ } else if (argc == 3) {
+ int flagNum = atol(argv[1]);
+ int flagVal = atol(argv[2]);
+ Burger::g_vars->_flags[flagNum] = flagVal;
+ debugPrintf("Flag set\n");
+ } else {
+ debugPrintf("Flag <num> [<value>]\n");
+ }
+
+ return true;
+}
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index 5350be7f457..7a2fb015bad 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -31,6 +31,7 @@ class Console : public GUI::Debugger {
private:
bool Cmd_test(int argc, const char **argv);
bool Cmd_room(int argc, const char **argv);
+ bool Cmd_flag(int argc, const char **argv);
public:
Console();
~Console() override;
Commit: b74998098991ec9dc22259661df157b3a975155c
https://github.com/scummvm/scummvm/commit/b74998098991ec9dc22259661df157b3a975155c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implementing room 103 methods
Changed paths:
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room103.h
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 1cce724ca97..d9718d6ef2c 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -28,17 +28,173 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "SATELLITE DISH", "103W001", "103W002", nullptr },
+ { "FIRE ESCAPE", "103W005", "103W006", nullptr },
+ { "SCARECROW", "103W008", "103W009", "103W009" },
+ { "DOOR", "103W010", "103W011", nullptr },
+ { "STAIRWAY", "103W010", "103W011", nullptr },
+ { "AIR VENT", "103W013", "103W014", "103W015" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room103::SERIES1[] = {
+ { 0, "103_004", 2, 255, -1, 0, nullptr, 0 },
+ { 5, nullptr, 2, 255, -1, 2048, nullptr, 0 },
+ { 7, "103_007", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room103::SERIES2[] = {
+ { 13, "103_006", 2, 125, -1, 0, nullptr, 0 },
+ { 19, nullptr, 1, 125, 6, 0, nullptr, 0 },
+ { 54, nullptr, 1, 125, 16, 0, nullptr, 0 },
+ { -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room103::SERIES3[] = {
+ { 5, "103_005", 2, 255, -1, 0, &_val0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room103::SERIES4[] = {
+ { 7, "103_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 1, 15, nullptr, 2, 255, -1, 0, 0, nullptr, 0 },
+ { 16, -1, "103_004", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 0, "103_002", 2, 100, -1, 0, 0, 0, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 2, 2, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 1, 1, "103_002", 2, 100, -1, 0, 0, 0, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 1, 1, "103_002", 2, 100, -1, 0, 0, 0, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 2, 2, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 1, 1, "103_002", 2, 100, -1, 0, 0, 0, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 0, 0, "103_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 0, 5, "103h006", 1, 255, 23, 0, 0, nullptr, 0 },
+ { 6, 11, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+int32 Room103::_val0 = 0;
+
void Room103::init() {
_G(player).walker_in_this_scene = true;
+ _val1 = 0;
+ _val2 = 0;
+ _val3 = 0;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 101:
+ ws_demand_location(327, 178, 7);
+ _G(flags)[V012] = 0;
+
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(roomVal1) = 1;
+ digi_preload_stream_breaks(SERIES1);
+ series_play("103wi01s", 0x100);
+ series_stream_with_breaks(SERIES1, "103wi01", 6, 0xa00, 10016);
+ break;
+
+ default:
+ ws_demand_location(320, 271, 5);
+ break;
+ }
+
+ if (_G(flags)[V023]) {
+ _series1 = series_play("103wi06", 0x500, 0, -1, 100);
+ } else {
+ _series1 = series_play("103wi05", 0x500, 0, -1, 100);
+ }
+
+ _series2 = series_play("103door", 0x800, 0, -1, 100);
+ series_play("103vent", 0x100);
+
+ _val4 = 12;
+ kernel_trigger_dispatch_now(10);
+ _val5 = 19;
+ kernel_trigger_dispatch_now(12);
+ _val6 = 21;
+ kernel_trigger_dispatch_now(13);
+
+ digi_play_loop("103_001", 3, 60);
}
void Room103::daemon() {
+ // TODO
}
void Room103::pre_parser() {
+ if (player_said("gear", "satellite dish"))
+ player_hotspot_walk_override(225, 257, 8);
+
+ if (player_said("gear", "door") || player_said("gear", "stairway"))
+ player_hotspot_walk_override(391, 264, 1);
}
void Room103::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(walker).wilbur_said(SAID)) {
+ if (player_said("gear", "satellite dish") && _G(flags)[V023] == 0) {
+ _G(roomVal1) = 4;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ player_set_commands_allowed(false);
+ _G(player).command_ready = false;
+
+ } else if (player_said("gear", "door") || player_said("gear", "stairway")) {
+ _G(roomVal1) = 2;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ player_set_commands_allowed(false);
+ _G(player).command_ready = false;
+
+ } else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "FIRE ESCAPE")) {
+ _val2 = 1;
+ _G(roomVal1) = 6;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ player_set_commands_allowed(false);
+ _G(player).command_ready = false;
+ }
+ } else {
+ _G(player).command_ready = false;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
index 77615861e92..758cf5a5ef8 100644
--- a/engines/m4/burger/rooms/section1/room103.h
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -29,6 +29,21 @@ namespace Burger {
namespace Rooms {
class Room103 : public Room {
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+ static const seriesStreamBreak SERIES4[];
+private:
+ static int32 _val0;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+
public:
Room103() : Room() {}
~Room103() override {}
Commit: 7bf08dc64bb91e7c00ad3d061e4bc69fabf3e0cf
https://github.com/scummvm/scummvm/commit/7bf08dc64bb91e7c00ad3d061e4bc69fabf3e0cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 103 daemon
Changed paths:
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room103.h
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index d9718d6ef2c..1ed27c22cc6 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -113,7 +113,7 @@ int32 Room103::_val0 = 0;
void Room103::init() {
_G(player).walker_in_this_scene = true;
- _val1 = 0;
+ _flag1 = false;
_val2 = 0;
_val3 = 0;
@@ -158,7 +158,471 @@ void Room103::init() {
}
void Room103::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ term_message("death timer");
+
+ if (_flag1) {
+ term_message("++");
+
+ if (++_val7 < 5 || (_val2 != 0 && _val2 != 2)) {
+ kernel_timing_trigger(60, 1);
+
+ } else if (_val2 == 2) {
+ kernel_timing_trigger(1, 3);
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ term_message("left");
+
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ term_message("caught");
+ kernel_timing_trigger(1, 8);
+ intr_freshen_sentence();
+ Section1::walk();
+ player_set_commands_allowed(false);
+ _flag1 = false;
+
+ } else {
+ term_message("again");
+ kernel_timing_trigger(60, 1);
+ }
+ }
+ break;
+
+ case 2:
+ if (++_val0 >= 5) {
+ static const char *NAMES[7] = {
+ "103h002a", "103h002b", "103h002c", "103h002d",
+ "103h002e", "103h002f", "103h002g"
+ };
+ assert(_digi1 >= 1 && _digi1 <= 7);
+ digi_play(NAMES[_digi1 - 1], 2, 255, 1);
+ } else {
+ kernel_timing_trigger(60, 2);
+ }
+ break;
+
+ case 3:
+ TerminateMachineAndNull(_series2);
+ series_load("103ha03");
+ series_load("103ha03s");
+ digi_preload("103H005");
+ digi_preload_stream_breaks(SERIES2);
+ series_play("103ha01s", 0x201);
+ series_stream_with_breaks(SERIES2, "103ha01", 6, 0x200, 4);
+ break;
+
+ case 4:
+ digi_unload_stream_breaks(SERIES2);
+ series_play_with_breaks(PLAY2, "103ha03", 0x200, 9, 3, 12);
+ break;
+
+ case 6:
+ digi_play("103H005", 1, 255, 7);
+ break;
+
+ case 7:
+ _G(flags)[V023] = 0;
+ _G(flags)[GLB_TEMP_3] = _G(flags).get_boonsville_time_and_display() + 1800;
+ _G(flags)[V012] = 2;
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
+ break;
+
+ case 8:
+ player_update_info();
+ digi_stop(1);
+
+ if ((_G(player_info).x > 391 && _G(player_info).y < 321) ||
+ (_G(player_info).x > 490 && _G(player_info).y < 374) ||
+ (_G(player_info).x > 215 && _G(player_info).y < 267) ||
+ (_G(player_info).y < 224)) {
+ ws_walk(271, 265, 0, 19, 2);
+ term_message("walk to caught");
+
+ } else {
+ kernel_timing_trigger(1, 19);
+ term_message("don't walk to caught");
+ }
+ break;
+
+ case 9:
+ series_play_with_breaks(PLAY3, "103ha03", 0x201, 9, 3, 12);
+ series_play_with_breaks(PLAY2, "103ha03", 0x200, 9, 3, 12);
+ break;
+
+ case 10:
+ switch (_val4) {
+ case 12:
+ if (imath_ranged_rand(1, 3) == 1) {
+ series_play("103cr01", 0x100, 0, 10, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr01s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
+ } else {
+ series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 0, 0);
+ series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 13:
+ switch (imath_ranged_rand(1, 8)) {
+ case 1:
+ _val4 = 12;
+ series_play("103cr01", 0x100, 2, 10, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr01s", 0x100, 2, -1, 30, 0, 100, 0, 0, 1, 2);
+ break;
+
+ case 3:
+ series_play("103cr01", 0x100, 0, 10, 6, 0, 100, 0, 0, 7, 15);
+ series_play("103cr01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 7, 15);
+ break;
+
+ case 4:
+ case 5:
+ _val4 = 14;
+ series_play("103cr01", 0x100, 0, 10, 30, 0, 100, 0, 0, 3, 4);
+ series_play("103cr01s", 0x100, 0, -1, 30, 0, 100, 0, 0, 3, 4);
+ break;
+
+ default:
+ series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 2, 2);
+ series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 2, 2);
+ break;
+ }
+ break;
+
+ case 14:
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val4 = 13;
+ series_play("103cr01", 0x100, 0, 10, 6, 0, 100, 0, 0, 5, 15);
+ series_play("103cr01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 5, 15);
+ } else {
+ series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 4, 4);
+ series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 4, 4);
+ }
+ break;
+ }
+ break;
+
+ case 11:
+ switch (_val9) {
+ case 15:
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val9 = 16;
+ series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
+ } else {
+ series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 0, 0);
+ series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 16:
+ switch (imath_ranged_rand(1, 5)) {
+ case 1:
+ _val9 = 15;
+ series_play("103cr02", 0x100, 2, 11, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 1, 2);
+ break;
+
+ case 2:
+ _val9 = 17;
+ series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 3, 4);
+ series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 3, 4);
+ break;
+
+ default:
+ series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 2, 2);
+ series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 2, 2);
+ break;
+ }
+ break;
+
+ case 17:
+ switch (imath_ranged_rand(1, 6)) {
+ case 1:
+ _val9 = 16;
+ series_play("103cr02", 0x100, 2, 11, 30, 0, 100, 0, 0, 3, 4);
+ series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 3, 4);
+ break;
+
+ case 2:
+ _val9 = 18;
+ series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 5, 8);
+ series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 5, 8);
+ break;
+
+ default:
+ series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 4, 4);
+ series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 4, 4);
+ break;
+ }
+ break;
+
+ case 18:
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val9 = 17;
+ series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 9, 12);
+ series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 9, 12);
+ } else {
+ series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 8, 8);
+ series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 8, 8);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 12:
+ switch (_val5) {
+ case 19:
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val5 = 20;
+ series_play("103cr03", 0x100, 0, 12, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr03s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
+ } else {
+ series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 0, 0);
+ series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 20:
+ switch (imath_ranged_rand(1, 6)) {
+ case 1:
+ _val5 = 19;
+ series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 4, 4);
+ series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 4, 4);
+ break;
+
+ case 3:
+ series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 2, 2);
+ series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 2, 2);
+ break;
+
+ default:
+ series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 3, 3);
+ series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 3, 3);
+ break;
+ }
+ break;
+ }
+ break;
+
+ case 13:
+ switch (_val6) {
+ case 21:
+ switch (imath_ranged_rand(1, 6)) {
+ case 1:
+ series_play("103cr04", 0x100, 0, 13, 6, 0, 100, 0, 0, 5, 9);
+ series_play("103cr04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 5, 9);
+ break;
+
+ case 2:
+ _val6 = 22;
+ series_play("103cr04", 0x100, 0, 13, 30, 0, 100, 0, 0, 1, 2);
+ series_play("103cr04s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
+ break;
+
+ default:
+ series_play("103cr04", 0x100, 0, 13, 90, 0, 100, 0, 0, 0, 0);
+ series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 22:
+ if (imath_ranged_rand(1, 4) == 1) {
+ _val6 = 21;
+ series_play("103cr04", 0x100, 2, 13, 30, 0, 100, 0, 0, 0, 1);
+ series_play("103cr04s", 0x100, 2, -1, 30, 0, 100, 0, 0, 0, 1);
+ } else {
+ series_play("103cr04", 0x100, 0, 13, 90, 0, 100, 0, 0, 0, 2);
+ series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 2, 2);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 14:
+ _digi1 = imath_ranged_rand(1, 7);
+ preloadDigi1();
+ _G(flags)[V298] = 1;
+
+ if (_G(flags)[V024]) {
+ player_set_commands_allowed(true);
+ kernel_timing_trigger(60, 2);
+ } else {
+ wilbur_speech("103w003", 15);
+ }
+
+ _G(flags)[V023] = 1;
+ _G(flags)[V024] = 1;
+ _flag1 = true;
+ _val7 = 0;
+ _val0 = 0;
+ break;
+
+ case 15:
+ player_set_commands_allowed(true);
+ kernel_timing_trigger(1, 2);
+ break;
+
+ case 16:
+ TerminateMachineAndNull(_series1);
+ break;
+
+ case 17:
+ _G(flags)[V023] = 0;
+ _G(roomVal1) = 6;
+ _G(flags)[V298] = 0;
+ ws_walk(325, 173, 0, 10016);
+ break;
+
+ case 19:
+ _G(flags)[V298] = 1;
+ TerminateMachineAndNull(_series2);
+ series_play_with_breaks(PLAY4, "103ha02", 0x100, 20, 2, 10, 100, 0, 0);
+ _frame = 10;
+ _val8 = 9;
+ break;
+
+ case 20:
+ switch (_val8) {
+ case 9:
+ if (imath_ranged_rand(1, 2) == 1) {
+ if (++_frame >= 17)
+ _frame = 15;
+ } else {
+ if (--_frame <= 10)
+ _frame = 12;
+ }
+
+ series_play("103ha02", 0x101, 0, 20, 10, 0, 100, 0, 0, _frame, _frame);
+ break;
+
+ case 10:
+ series_play("103ha02", 0x101, 0, 22, 6, 0, 100, 0, 0, 17, 22);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 21:
+ _val8 = 10;
+ kernel_timing_trigger(1, 24);
+ break;
+
+ case 22:
+ series_play("103ha02", 0x101, 0, -1, 6, -1, 100, 0, 0, 22, 22);
+ break;
+
+ case 23:
+ if (_G(flags)[GLB_TEMP_4] == 2 || _G(flags)[V013]) {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("103h008a", 1, 255, 21);
+ break;
+ case 2:
+ digi_play("103h008b", 1, 255, 21);
+ break;
+ case 3:
+ digi_play("103h008c", 1, 255, 21);
+ break;
+ default:
+ break;
+ }
+ } else {
+ digi_play("103h007", 1, 255, 21);
+ }
+
+ _G(flags)[GLB_TEMP_3] = _G(flags).get_boonsville_time_and_display() + 1800;
+ _G(flags)[V012] = 2;
+ ws_walk(271, 265, 0, 24, 2);
+ break;
+
+ case 24:
+ if (++_val3 > 1) {
+ wilbur_speech("103w004", 17, -1, 0, 75);
+ _G(flags)[V013] = 1;
+ }
+ break;
+
+ case gTELEPORT:
+ switch (_G(roomVal1)) {
+ case 1:
+ digi_unload_stream_breaks(SERIES1);
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(roomVal1) = 10002;
+ break;
+
+ case 2:
+ ws_hide_walker();
+ _G(roomVal1) = 3;
+ digi_preload_stream_breaks(SERIES3);
+ series_play("103wi04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
+ series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, gTELEPORT);
+ break;
+
+ case 3:
+ digi_unload_stream_breaks(SERIES3);
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(roomVal1) = 10002;
+ wilbur_speech("103w012");
+ break;
+
+ case 4:
+ _G(roomVal1) = 5;
+ TerminateMachineAndNull(_series1);
+ ws_hide_walker();
+ series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
+ series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, gTELEPORT);
+ break;
+
+ case 5:
+ ws_unhide_walker();
+ _G(roomVal1) = 10002;
+ _series1 = series_play("103wi06", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ digi_play(Common::String::format("103h001%c",
+ 'a' + imath_ranged_rand(0, 4)).c_str(), 2, 255, 14);
+ break;
+
+ case 6:
+ _G(roomVal1) = 7;
+ kernel_timing_trigger(1, gTELEPORT);
+ break;
+
+ case 7:
+ _G(roomVal1) = 8;
+ ws_hide_walker();
+ series_play_with_breaks(PLAY1, "103wi02", 0xa00, gTELEPORT, 2);
+ series_play("103wi02s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 27);
+ player_set_commands_allowed(false);
+ break;
+
+ case 8:
+ _val2 = 2;
+
+ if (!_G(flags)[V023])
+ pal_fade_init(1001);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room103::pre_parser() {
@@ -197,6 +661,16 @@ void Room103::parser() {
}
}
+void Room103::preloadDigi1() {
+ const char *NAMES[7] = {
+ "103h002a", "103h002b", "103h002c", "103h002d",
+ "103h002e", "103h002f", "103h002g"
+ };
+
+ assert(_digi1 >= 1 && _digi1 <= 7);
+ digi_preload(NAMES[_digi1 - 1]);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
index 758cf5a5ef8..dc3010545d0 100644
--- a/engines/m4/burger/rooms/section1/room103.h
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -35,15 +35,22 @@ class Room103 : public Room {
static const seriesStreamBreak SERIES4[];
private:
static int32 _val0;
- int _val1 = 0;
+ bool _flag1 = false;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
+ int _frame = 0;
+ int _digi1 = 0;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
+ void preloadDigi1();
+
public:
Room103() : Room() {}
~Room103() override {}
Commit: caec8484c0a91ca2afd99f09f627f8eed47fd11c
https://github.com/scummvm/scummvm/commit/caec8484c0a91ca2afd99f09f627f8eed47fd11c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change lots of methods to be camelcase
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/walker.cpp
engines/m4/core/rooms.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index 573d3da146a..e842a034351 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -57,10 +57,10 @@ void player_set_commands_allowed(bool t_or_f) {
void game_pause(bool flag) {
if (flag) {
_G(kernel).pause = true;
- PauseEngines();
+ pauseEngines();
} else {
_G(kernel).pause = false;
- UnpauseEngines();
+ unpauseEngines();
}
}
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index e87797ebeca..001a5b311b8 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -306,9 +306,9 @@ void BurgerEngine::global_daemon() {
case gNONPLAYERS_SPEECH_FINISHED:
if (_G(npcSpeech1))
- TerminateMachineAndNull(_G(npcSpeech1));
+ terminateMachineAndNull(_G(npcSpeech1));
if (_G(npcSpeech2))
- TerminateMachineAndNull(_G(npcSpeech2));
+ terminateMachineAndNull(_G(npcSpeech2));
kernel_trigger_dispatch_now(_G(npcTrigger));
break;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index d9978c1164a..f3cb460e116 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -351,8 +351,8 @@ void Room101::daemon() {
if (_G(flags)[ROOM101_FLAG4] || _G(flags)[ROOM101_FLAG22] ||
_G(flags)[ROOM101_FLAG23] || _G(flags)[V002]) {
- TerminateMachineAndNull(_machine1);
- TerminateMachineAndNull(_machine2);
+ terminateMachineAndNull(_machine1);
+ terminateMachineAndNull(_machine2);
kernel_trigger_dispatch_now(10);
}
break;
@@ -372,8 +372,8 @@ void Room101::daemon() {
if (_G(flags)[ROOM101_FLAG4]) {
if (_G(flags)[ROOM101_FLAG10] || _G(flags)[V112] ||
_G(flags)[V080] || _G(flags)[V126]) {
- TerminateMachineAndNull(_machine1);
- TerminateMachineAndNull(_machine2);
+ terminateMachineAndNull(_machine1);
+ terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 13);
}
}
@@ -392,8 +392,8 @@ void Room101::daemon() {
daemon15();
if (_G(flags)[ROOM101_FLAG10] && (_G(flags)[ROOM101_FLAG16] || _G(flags)[V220])) {
- TerminateMachineAndNull(_machine1);
- TerminateMachineAndNull(_machine2);
+ terminateMachineAndNull(_machine1);
+ terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 16);
}
break;
@@ -412,8 +412,8 @@ void Room101::daemon() {
if (_G(flags)[ROOM101_FLAG16]) {
if (_G(flags)[ROOM101_FLAG20] || _G(flags)[V220]) {
- TerminateMachineAndNull(_machine1);
- TerminateMachineAndNull(_machine2);
+ terminateMachineAndNull(_machine1);
+ terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 19);
}
}
@@ -470,7 +470,7 @@ void Room101::daemon() {
break;
case 27:
- TerminateMachineAndNull(_doorMachine);
+ terminateMachineAndNull(_doorMachine);
Section1::updateWalker(226, 281, 8, 26);
break;
@@ -517,7 +517,7 @@ void Room101::daemon() {
case 8:
// Barbershop door open
_G(roomVal1) = 9;
- TerminateMachineAndNull(_doorMachine);
+ terminateMachineAndNull(_doorMachine);
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
break;
@@ -538,7 +538,7 @@ void Room101::daemon() {
break;
case 14:
- TerminateMachineAndNull(_doorMachine);
+ terminateMachineAndNull(_doorMachine);
_G(roomVal1) = 15;
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
break;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index e5adc2e4f17..ddb3e397cf4 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -271,7 +271,7 @@ void Room102::daemon() {
case 32:
series_unload(_index1);
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series2);
_val11 = 33;
series_play("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
digi_preload_stream_breaks(STREAMS1);
@@ -311,11 +311,11 @@ void Room102::daemon() {
_play1 = nullptr;
}
if (_series3)
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series3);
_series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 24, 29);
} else {
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
@@ -331,7 +331,7 @@ void Room102::daemon() {
_series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 31, 42);
} else {
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
@@ -647,8 +647,8 @@ void Room102::daemon() {
case 54:
switch (_val11) {
case 46:
- TerminateMachineAndNull(_series1);
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series2);
_val11 = 47;
series_play_with_breaks(PLAY2, "102ha06", 2560, 3, 3, 6, 100, 0, 0);
hotspot_set_active("harry", true);
@@ -731,8 +731,8 @@ void Room102::daemon() {
kernel_timing_trigger(80, 16);
}
} else {
- TerminateMachineAndNull(_series3);
- TerminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series6);
_series3 = nullptr;
_val12 = 54;
series_play("102ha07", 3840, 2, 3, 6, 0, 100, 0, 0, 30, 30);
@@ -750,8 +750,8 @@ void Room102::daemon() {
_play1 = nullptr;
}
} else {
- TerminateMachineAndNull(_series3);
- TerminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series6);
_series3 = nullptr;
_val12 = 54;
series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 20, 21);
@@ -856,7 +856,7 @@ void Room102::daemon() {
break;
case 13:
- TerminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series7);
series_play("102ha02s", 3841, 0, -1, 6, 0, 100, 0, 0, 42, -1);
series_set_frame_rate(_stream1, 6);
ws_OverrideCrunchTime(_stream1);
@@ -1090,8 +1090,8 @@ void Room102::daemon() {
case 79:
ws_hide_walker();
- TerminateMachineAndNull(_laz1);
- TerminateMachineAndNull(_laz2);
+ terminateMachineAndNull(_laz1);
+ terminateMachineAndNull(_laz2);
_G(flags)[V019] = 1;
_G(roomVal1) = 80;
@@ -1120,8 +1120,8 @@ void Room102::daemon() {
case 82:
ws_hide_walker();
- TerminateMachineAndNull(_laz1);
- TerminateMachineAndNull(_laz2);
+ terminateMachineAndNull(_laz1);
+ terminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
_G(roomVal1) = 83;
series_play_with_breaks(PLAY4, "102wi08", 256, gTELEPORT, 3, 6, 100, 0, 0);
@@ -1474,8 +1474,8 @@ const char *Room102::getDigi2(int num) const {
void Room102::sub1() {
if (_series4) {
- TerminateMachineAndNull(_series4);
- TerminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series4);
+ terminateMachineAndNull(_series5);
}
}
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 1ed27c22cc6..8c920081571 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -203,7 +203,7 @@ void Room103::daemon() {
break;
case 3:
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series2);
series_load("103ha03");
series_load("103ha03s");
digi_preload("103H005");
@@ -471,7 +471,7 @@ void Room103::daemon() {
break;
case 16:
- TerminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series1);
break;
case 17:
@@ -483,7 +483,7 @@ void Room103::daemon() {
case 19:
_G(flags)[V298] = 1;
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series2);
series_play_with_breaks(PLAY4, "103ha02", 0x100, 20, 2, 10, 100, 0, 0);
_frame = 10;
_val8 = 9;
@@ -579,7 +579,7 @@ void Room103::daemon() {
case 4:
_G(roomVal1) = 5;
- TerminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series1);
ws_hide_walker();
series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, gTELEPORT);
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index f25d982b194..7ef758ac125 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -530,8 +530,8 @@ void Room104::conv() {
void Room104::freeSeries() {
if (_flag1) {
- TerminateMachine(_series1);
- TerminateMachine(_series2);
+ terminateMachine(_series1);
+ terminateMachine(_series2);
_flag1 = false;
}
}
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 7856e555e01..b1ada6eed85 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -165,10 +165,10 @@ void Room135::daemon() {
_val6 = 21;
if (_play1)
- TerminateMachineAndNull(_play1);
- TerminateMachineAndNull(_series1);
- TerminateMachineAndNull(_series2);
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_play1);
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series3);
Section1::updateWalker(340, 250, 7, 4);
break;
@@ -217,11 +217,11 @@ void Room135::daemon() {
_val6 = 21;
if (_play1)
- TerminateMachineAndNull(_play1);
+ terminateMachineAndNull(_play1);
- TerminateMachineAndNull(_series1);
- TerminateMachineAndNull(_series2);
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series3);
gr_backup_palette();
digi_preload("100_022");
digi_preload_stream_breaks(STREAMS2);
@@ -270,15 +270,15 @@ void Room135::daemon() {
break;
case 16:
- TerminateMachineAndNull(_series5);
- TerminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series6);
series_play("135od06", 2560, 0, 17, 6, 0, 100, 0, 0, 0, 4);
series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 4);
break;
case 17:
- TerminateMachineAndNull(_play3);
- TerminateMachineAndNull(_play4);
+ terminateMachineAndNull(_play3);
+ terminateMachineAndNull(_play4);
_val6 = 1;
_val5 = 1;
_G(flags)[V001]--;
@@ -303,8 +303,8 @@ void Room135::daemon() {
break;
case 20:
- TerminateMachineAndNull(_series5);
- TerminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series6);
_val5 = 1;
_val6 = 1;
inv_give_to_player("broken puz dispenser");
@@ -455,7 +455,7 @@ void Room135::daemon() {
break;
case 25:
- TerminateMachineAndNull(_play2);
+ terminateMachineAndNull(_play2);
_val6 = 26;
series_play("134od24", 2560, 0, 32, 6, 0, 100, 0, 0, 37, -1);
series_play("134od24s", 2560, 0, -1, 6, 0, 100, 0, 0, 37, -1);
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 85b97de985f..5451bb0297c 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -254,9 +254,9 @@ void Room142::init() {
void Room142::daemon() {
switch (_G(kernel).trigger) {
case 1:
- TerminateMachineAndNull(_series8);
- TerminateMachineAndNull(_series5);
- TerminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series8);
+ terminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series1);
if (_G(player_info.y) < 285) {
Section1::updateWalker(adjustY(_G(player_info).y), 285, 9, 2);
@@ -408,14 +408,14 @@ void Room142::daemon() {
break;
case 14:
- TerminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series1);
break;
case gTELEPORT:
switch (_G(roomVal1)) {
case 1:
- TerminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series5);
disable_player();
_G(roomVal1) = 2;
series_play_with_breaks(PLAY9, "142wi04", 0xdff, gTELEPORT, 3);
@@ -434,8 +434,8 @@ void Room142::daemon() {
wilbur_speech("142w009");
} else {
player_set_commands_allowed(false);
- TerminateMachineAndNull(_series6);
- TerminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
_G(roomVal1) = 4;
series_play_with_breaks(PLAY11, "142wi04", 0xdff, gTELEPORT, 3);
@@ -452,8 +452,8 @@ void Room142::daemon() {
case 5:
player_set_commands_allowed(false);
- TerminateMachineAndNull(_series6);
- TerminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
_G(roomVal1) = 6;
series_play_with_breaks(PLAY10, "142wi02", 0xdff, gTELEPORT, 3);
@@ -468,8 +468,8 @@ void Room142::daemon() {
case 7:
player_set_commands_allowed(false);
- TerminateMachineAndNull(_series6);
- TerminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
_G(roomVal1) = 8;
series_play_with_breaks(PLAY10, "142wi04", 0xdff, gTELEPORT, 3);
@@ -504,11 +504,11 @@ void Room142::daemon() {
case 10028:
if (!_G(flags)[V043]) {
if (_series2) {
- TerminateMachineAndNull(_series2);
- TerminateMachineAndNull(_series3);
+ terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series3);
}
if (_series4) {
- TerminateMachineAndNull(_series4);
+ terminateMachineAndNull(_series4);
_G(flags)[V058] = 0;
}
@@ -557,8 +557,8 @@ void Room142::daemon() {
intr_remove_no_walk_rect(_noWalk);
hotspot_set_active("TRUCK", false);
- TerminateMachineAndNull(_series1);
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series2);
_val1 = 19;
series_play_with_breaks(PLAY8, "142bu03", 0xd00, 9, 3);
@@ -570,7 +570,7 @@ void Room142::daemon() {
case 10032:
if (_series2) {
- TerminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series2);
_G(flags)[V000] = _G(flags)[V043] ? 1002 : 1004;
}
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 832d0647e41..b9ce035a6cf 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -180,7 +180,7 @@ void Section1::daemon() {
series_play("110bu01", 0, 0, 1029, 5, 0, 100, 0, 0, frame, frame);
} else {
pal_fade_set_start(_G(master_palette), 0);
- TerminateMachineAndNull(_play);
+ terminateMachineAndNull(_play);
kernel_timing_trigger(1, 1031);
}
break;
@@ -211,7 +211,7 @@ void Section1::daemon() {
break;
case 1035:
pal_fade_set_start(_G(master_palette), 0);
- TerminateMachineAndNull(_play);
+ terminateMachineAndNull(_play);
kernel_timing_trigger(1, 1036);
break;
case 1036:
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index e08cbf2dc3d..558df7ff8c1 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -74,7 +74,7 @@ void MenuRoom::setButtonState(int index, ButtonState newState) {
if (index >= 0 && index < (int)_buttons.size()) {
MenuButton &btn = _buttons[index];
if (btn._state != BTNSTATE_DISABLED && newState != btn._state) {
- TerminateMachineAndNull(btn._machine);
+ terminateMachineAndNull(btn._machine);
btn._state = newState;
drawButton(index);
}
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 33c8671caa4..18014ff5a99 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -171,7 +171,7 @@ machine *Walker::walk_initialize_walker() {
m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
// we need to all init sequences to happen immediately (init coordinates)
- CycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
+ cycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
nullptr, (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
_G(inverse_pal)->release();
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 3e682d3a667..f84057fa6e2 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -375,7 +375,7 @@ void Sections::pal_game_task() {
updateVideo = !_cameraShiftAmount && !_cameraShift_vert_Amount;
- CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
+ cycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
_G(screenCodeBuff)->get_buffer(), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), updateVideo);
_G(inverse_pal)->release();
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 15c664f6b12..3cdfd9e2e7f 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -146,7 +146,7 @@ bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger) {
void series_set_frame_rate(machine *m, int32 newFrameRate) {
CHECK_SERIES
- if ((!m) || (!m->myAnim8) || !VerifyMachineExists(m))
+ if ((!m) || (!m->myAnim8) || !verifyMachineExists(m))
error_show(FL, 'SSFR');
m->myAnim8->myRegs[IDX_CELS_FRAME_RATE] = newFrameRate << 16;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index f91f8bfd75d..172b3341067 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -346,9 +346,9 @@ void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
player_set_commands_allowed(false);
game_pause(false);
- UnpauseEngines();
+ unpauseEngines();
- TerminateMachine(_GP(seriesAnim8));
+ terminateMachine(_GP(seriesAnim8));
series_unload(_GP(seriesHash));
_GP(seriesAnim8) = NULL;
_GP(seriesHash) = 0;
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 97313b01448..391cb5cee9d 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -638,19 +638,19 @@ void (*condOpTable[])(machine *m, int32 *pcOffset) = {
&op_SWITCH_GT //9
};
-void PauseEngines(void) {
+void pauseEngines(void) {
_GWS(enginesPaused) = true;
}
-void UnpauseEngines(void) {
+void unpauseEngines(void) {
_GWS(enginesPaused) = false;
}
-void AddPauseTime(int32 myTime) {
+void addPauseTime(int32 myTime) {
_GWS(pauseTime) += myTime;
}
-void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
+void cycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
uint8 *myPalette, uint8 *ICT, bool updateVideo) {
int32 clockTime;
@@ -681,7 +681,7 @@ void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table,
screenCodes, myPalette, ICT);
}
-static void CancelAllEngineReqs(machine *m) {
+static void cancelAllEngineReqs(machine *m) {
globalMsgReq *myGMsg, *tempGMsg;
//---- CANCEL CRUNCHER REQS
@@ -712,7 +712,7 @@ static void CancelAllEngineReqs(machine *m) {
}
-static void ShutdownMachine(machine *m) {
+static void shutdownMachine(machine *m) {
dbg_RemoveWSMach(m);
if (m->myAnim8) {
@@ -762,28 +762,28 @@ void TerminateMachinesByHash(uint32 machHash) {
if (curr == _GWS(firstMachine)) { // maintain the beginning of machine chain
_GWS(firstMachine) = next;
}
- CancelAllEngineReqs(curr); // cancel its requests
- ShutdownMachine(curr); // deallocate the whole ball'o'wax
+ cancelAllEngineReqs(curr); // cancel its requests
+ shutdownMachine(curr); // deallocate the whole ball'o'wax
}
curr = next; // and pop aint32 the chain
}
}
-void TerminateMachine(machine *myMachine) {
- if ((!myMachine) || (!VerifyMachineExists(myMachine))) {
+void terminateMachine(machine *myMachine) {
+ if ((!myMachine) || (!verifyMachineExists(myMachine))) {
return;
}
- CancelAllEngineReqs(myMachine);
- ShutdownMachine(myMachine);
+ cancelAllEngineReqs(myMachine);
+ shutdownMachine(myMachine);
}
-void TerminateMachineAndNull(machine *&m) {
- TerminateMachine(m);
+void terminateMachineAndNull(machine *&m) {
+ terminateMachine(m);
m = nullptr;
}
-bool VerifyMachineExists(machine *m) {
+bool verifyMachineExists(machine *m) {
machine *tempM;
// Parameter verification
@@ -870,9 +870,9 @@ static int32 StepAt(int32 *pcOffset, machine *m) {
if (!keepProcessing) {
// Does the machine still exist
if (m->machID == machID) {
- CancelAllEngineReqs(m);
+ cancelAllEngineReqs(m);
if (m->curState == -1) {
- ShutdownMachine(m);
+ shutdownMachine(m);
} else { // If machine hasn't terminated
IntoTheState(m); // recurse to kickstart next state
}
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index 16b9b20b6ab..abd8ce3f75f 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -173,19 +173,19 @@ struct WSMachine_Globals {
extern bool ws_Initialize(frac16 *theGlobals);
extern void ws_Shutdown();
-extern void PauseEngines();
-extern void UnpauseEngines();
-extern void AddPauseTime(int32 myTime);
+extern void pauseEngines();
+extern void unpauseEngines();
+extern void addPauseTime(int32 myTime);
-void CycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
+void cycleEngines(Buffer *cleanBackground, int16 *depth_table, Buffer *screenCodes,
uint8 *myPalette, uint8 *ICT, bool updateVideo);
void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table,
Buffer *screenCodes, uint8 *myPalette, uint8 *ICT);
-void TerminateMachine(machine *m);
+void terminateMachine(machine *m);
void TerminateMachinesByHash(uint32 machHash);
-void TerminateMachineAndNull(machine *&m);
-bool VerifyMachineExists(machine *m);
+void terminateMachineAndNull(machine *&m);
+bool verifyMachineExists(machine *m);
int32 ws_KillMachines();
void ws_StepWhile(machine *m, int32 pcOffset, int32 pcCount);
void IntoTheState(machine *m);
@@ -198,7 +198,7 @@ extern void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
uint32 machHash, machine *sendM, int32 msgCount);
#define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, nullptr, -1, -1, callback, false, name)
-#define kernel_terminate_machine(m) TerminateMachine(m)
+#define kernel_terminate_machine(m) terminateMachine(m)
} // End of namespace M4
Commit: 95b0bdffa2f3e96681d5d6a78b4cf4f6dda8676d
https://github.com/scummvm/scummvm/commit/95b0bdffa2f3e96681d5d6a78b4cf4f6dda8676d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 105 methods
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 487443e4ecc..269a42f2806 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -28,17 +28,439 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "TOWN RECORDS", nullptr, nullptr, nullptr },
+ { "MAYOR'S OFFICE", "105W002", nullptr, nullptr },
+ { "COMPLAINTS DEPT.", "105W003", nullptr, nullptr },
+ { "CHAIR", nullptr, "105W004", "105W005" },
+ { "PETUNIA", "105W006", "105W007", "105W007" },
+ { "PICTURE", "105W008", "105W004", "105W009" }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 5, "105_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 6, -1, 0, 1, 255, 28, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 21, 31, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 32, 37, "105_009", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 0, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY5[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY6[] = {
+ { 10, 17, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 28, 29, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 29, 29, nullptr, 1, 255, 20, 0, 0, nullptr, 0 },
+ { 30, 32, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY7[] = {
+ { 32, 30, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 29, 28, nullptr, 1, 255, 45, 0, 0, nullptr, 0 },
+ { 19, 23, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY8[] = {
+ { 18, 23, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 28, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY9[] = {
+ { 0, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 16, 23, nullptr, 1, 255, 45, 0, 0, nullptr, 0 },
+ { 24, 28, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY10[] = {
+ { 0, 6, "105_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 7, -1, nullptr, 1, 255, 27, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY11[] = {
+ { 0, 12, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, -1, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY12[] = {
+ { 0, -1, "105_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY13[] = {
+ { 0, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 4, -1, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY14[] = {
+ { 0, 6, "105_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 12, nullptr, 1, 255, 22, 0, 0, nullptr, 0 },
+ { 13, 23, "105_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 45, "105_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 46, -1, nullptr, 1, 255, 24, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY15[] = {
+ { 0, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 1, 255, -1, 0, 12, nullptr, 0 },
+ { 4, 4, nullptr, 1, 255, -1, 0, 10, nullptr, 0 },
+ { 3, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY16[] = {
+ { 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 6, nullptr, 1, 255, 23, 0, 0, nullptr, 0 },
+ { 7, 11, "105_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 12, 12, "105_015", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 26, "105_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 27, -1, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY17[] = {
+ { 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 6, nullptr, 1, 255, 23, 0, 0, nullptr, 0 },
+ { 7, 11, "105_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 12, 12, "105_016", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 26, "105_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 27, -1, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY18[] = {
+ { 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 6, nullptr, 1, 255, 23, 0, 0, nullptr, 0 },
+ { 7, 11, "105_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 12, 12, "105_017", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 26, "105_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 27, -1, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY19[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY20[] = {
+ { 27, 30, "105_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY21[] = {
+ { 0, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 2, 2, nullptr, 1, 255, 9, 0, 0, nullptr, 0 },
+ { 3, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY22[] = {
+ { 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY23[] = {
+ { 8, 14, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY24[] = {
+ { 0, 13, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY25[] = {
+ { 14, 17, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY26[] = {
+ { 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY27[] = {
+ { 3, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, 38, "100_023", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY28[] = {
+ { 0, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 1, 255, 35, 0, 0, nullptr, 0 },
+ { 7, 13, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 14, 19, "105_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 19, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 5, 5, nullptr, 2, 255, 36, 0, 0, nullptr, 0 },
+ { 4, 1, nullptr, 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY29[] = {
+ { 0, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 6, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 5, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 6, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY30[] = {
+ { 7, 17, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY31[] = {
+ { 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, "105_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 3, 0, 0, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY32[] = {
+ { 8, 14, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room105::init() {
_G(player).walker_in_this_scene = true;
+ _val1 = 1;
+ _val2 = 0;
+ digi_preload("105_001");
+
+ if (_G(flags)[V112]) {
+ series_play("105do01", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _val3 = 59;
+ _val4 = 59;
+ kernel_trigger_dispatch_now(1);
+
+ } else {
+ hotspot_set_active("Angus", false);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 104:
+ ws_demand_location(310, 353, 11);
+ _G(roomVal1) = 62;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ default:
+ ws_demand_location(320, 271, 5);
+ break;
+ }
+
+ digi_play_loop("105_001", 3, 180);
}
void Room105::daemon() {
}
void Room105::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("gear", "town records") && !_G(flags)[V112])
+ player_hotspot_walk_override(186, 263, 10);
+
+ if (player_said("gear", "mayor's office"))
+ player_hotspot_walk_override(341, 216, 11);
+
+ if (player_said("GEAR", "complaints dept."))
+ player_hotspot_walk_override(415, 254, 2);
}
void Room105::parser() {
+ bool lookFlag = player_said("look") || player_said("look at");
+ _G(kernel).trigger_mode = KT_PARSE;
+
+ if (player_said("conv12")) {
+ conv12();
+ } else if (player_said("conv10")) {
+ conv10();
+ } else if (player_said("conv11")) {
+ conv11();
+ } else if (player_said("conv13")) {
+ conv13();
+ } else if (player_said("talk to")) {
+ talkTo();
+ } else if (lookFlag && player_said("town records")) {
+ if (_G(flags)[V112]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("105w010");
+ break;
+
+ case 1:
+ _val5 = 2;
+ _val6 = 21;
+ _digi1 = "105g001";
+ _val3 = 60;
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ wilbur_speech("105w001");
+ }
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ if (player_said("GEAR", "town records")) {
+ if (_G(flags)[V112]) {
+ wilbur_speech("105w011");
+ } else {
+ series_play_with_breaks(PLAY22, "105wi01", 0xa00, 18, 3);
+ }
+ } else if (player_said("GEAR", "mayor's office")) {
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY31, "105wi05", 0x100, 16, 3);
+
+ if (!_G(flags)[V112]) {
+ _G(flags)[V298] = 1;
+ enteringMayorsOffice();
+ }
+ } else if (player_said("GEAR", "complaints dept.")) {
+ player_set_commands_allowed(false);
+ _G(flags)[V298] = 1;
+ loadAssets3();
+ digi_preload("11n1402");
+ ws_hide_walker();
+ series_play_with_breaks(PLAY29, "105wi06", 0xa00, 15, 3);
+ } else if (player_said("gear", "town records")) {
+ wilbur_speech("105w011");
+ } else if (player_said("exit", "STAIRS")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(7);
+ } else if (!player_said("take", "baitbox")) {
+ return;
+ }
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room105::conv10() {
+
+}
+
+void Room105::conv11() {
+
+}
+
+void Room105::conv12() {
+
+}
+
+void Room105::conv13() {
+
+}
+
+void Room105::talkTo() {
+
+}
+
+void Room105::enteringMayorsOffice() {
+ if (_G(flags)[V031]) {
+ _val8 = 1;
+ loadAssets2();
+ _val3 = 23;
+ _val4 = 35;
+ } else {
+ _G(flags)[V031] = 1;
+ _val8 = 0;
+ loadAssets1();
+ _val3 = 23;
+ _val4 = 25;
+ }
+}
+
+void Room105::loadAssets1() {
+ static const char *NAMES[12] = {
+ "105mg02", "105mg02s", "105mg03", "105mg03s", "105mg04", "105mg04s",
+ "105mg05", "105mg05s", "105mg06", "105mg06s", "105mg07", "105mg07s"
+ };
+
+ for (int i = 0; i < 12; ++i)
+ _series1[i] = series_load(NAMES[i]);
+}
+
+void Room105::loadAssets2() {
+ static const char *NAMES[4] = {
+ "105mg10", "105mg11", "105mg12", "105mg13"
+ };
+
+ for (int i = 0; i < 4; ++i)
+ _series2[i] = series_load(NAMES[i]);
+}
+
+void Room105::loadAssets3() {
+ static const char *NAMES[12] = {
+ "105eg02", "105eg02s", "105eg04", "105eg04s", "105eg05", "105eg05s",
+ "105eg06", "105eg06s", "105eg07", "105eg07s", "105eg09", "105eg09s"
+ };
+
+ for (int i = 0; i < 12; ++i)
+ _series1[i] = series_load(NAMES[i]);
+
+ series_load("105eg10");
+ series_load("105eg10s");
+}
+
+void Room105::unloadAssets1() {
+ for (int i = 0; i < 12; ++i)
+ series_unload(_series1[i]);
+}
+
+void Room105::unloadAssets2() {
+ for (int i = 0; i < 4; ++i)
+ series_unload(_series2[i]);
+}
+
+void Room105::unloadAssets3() {
+ for (int i = 0; i < 12; ++i)
+ series_unload(_series3[i]);
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 5f31c918e12..0ddb572f41e 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -29,6 +29,33 @@ namespace Burger {
namespace Rooms {
class Room105 : public Room {
+private:
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ const char *_digi1 = nullptr;
+ int _series1[12];
+ int _series2[4];
+ int _series3[12];
+
+ void conv10();
+ void conv11();
+ void conv12();
+ void conv13();
+ void talkTo();
+ void enteringMayorsOffice();
+ void loadAssets1();
+ void loadAssets2();
+ void loadAssets3();
+ void unloadAssets1();
+ void unloadAssets2();
+ void unloadAssets3();
+
public:
Room105() : Room() {}
~Room105() override {}
Commit: e08ed8d3842a3e535754efa9cb00c51430ee6efe
https://github.com/scummvm/scummvm/commit/e08ed8d3842a3e535754efa9cb00c51430ee6efe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More room 105 methods
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 269a42f2806..8428b650493 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -382,23 +382,82 @@ void Room105::parser() {
}
void Room105::conv10() {
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+
+ if (_G(kernel).trigger == 10) {
+ if (who <= 0) {
+ if (node == 1) {
+ digi_stop(2);
+
+ // TODO: Double-check if the belows should be !strcmp
+ if (strcmp(conv_sound_to_play(), "10n02011")) {
+ digi_unload("105gucr1");
+ } else if (strcmp(conv_sound_to_play(), "10n02012")) {
+ digi_unload("105gucr2");
+ } else {
+ digi_unload("105gucr3");
+ }
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ _val3 = _val8 ? 36 : 26;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+ }
+ } else {
+ SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ conv_resume();
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if (node == 23)
+ _flag1 = true;
+ if (node == 21)
+ _flag2 = true;
+
+ if (node == 1) {
+ if (strcmp(conv_sound_to_play(), "10n02011")) {
+ digi_preload("105gucr1");
+ digi_play("105gucr1", 2, 150);
+ } else if (strcmp(conv_sound_to_play(), "10n02012")) {
+ digi_preload("105gucr2");
+ digi_play("105gucr2", 2, 150);
+ } else if (strcmp(conv_sound_to_play(), "10n02013")) {
+ digi_preload("105gucr3");
+ digi_play("105gucr3", 2, 150);
+ }
+
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ } else {
+ _val3 = _val8 ? 37 : 27;
+ }
+ } else if (who == 1) {
+ SendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ }
+ } else {
+ conv_resume();
+ }
}
void Room105::conv11() {
-
+ error("TODO: Room105::conv11");
}
void Room105::conv12() {
-
+ error("TODO: Room105::conv12");
}
void Room105::conv13() {
-
+ error("TODO: Room105::conv13");
}
void Room105::talkTo() {
-
+ error("TODO: Room105::talkTo");
}
void Room105::enteringMayorsOffice() {
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 0ddb572f41e..3cb22b59830 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -38,6 +38,8 @@ private:
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
+ bool _flag1 = false;
+ bool _flag2 = false;
const char *_digi1 = nullptr;
int _series1[12];
int _series2[4];
Commit: e03a38712bab55654af1b2098972429b5740a21f
https://github.com/scummvm/scummvm/commit/e03a38712bab55654af1b2098972429b5740a21f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 105 daemon
Changed paths:
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/walker.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index e09f850d0ec..fe2fd27b16c 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -163,7 +163,7 @@ bool player_load_series(const char *walkerName, const char *shadowName, bool loa
AddWSAssetCELS(assetPath, i + 4, nullptr);
}
- SendWSMessage(0, 0, nullptr, 6, nullptr, 1); // Hash 6 is the shadow machine
+ sendWSMessage(0, 0, nullptr, 6, nullptr, 1); // Hash 6 is the shadow machine
return true;
}
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 78b19b9eead..7ef1ef4e110 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -70,9 +70,9 @@ static void ws_walkto_node(machine *myWalker, railNode *destNode, bool firstTime
} else {
_G(globals)[GLB_TEMP_6] = 0; // so the walker will freeze when he reaches the last node
}
- SendWSMessage(STARTWALK << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(STARTWALK << 16, 0, myWalker, 0, nullptr, 1);
} else {
- SendWSMessage(WALKSEQ << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(WALKSEQ << 16, 0, myWalker, 0, nullptr, 1);
}
}
@@ -256,7 +256,7 @@ void ws_demand_facing(machine *myWalker, int32 facing) {
if (facing > 0 && facing < 13) {
_G(globals)[GLB_TEMP_4] = directions[facing] << 16;
- SendWSMessage(DEMAND_FACING << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(DEMAND_FACING << 16, 0, myWalker, 0, nullptr, 1);
}
}
@@ -274,7 +274,7 @@ void ws_demand_location(machine *myWalker, int32 x, int32 y, int facing) {
_G(globals)[GLB_TEMP_2] = y << 16;
_G(globals)[GLB_TEMP_3] = s;
- SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
if (facing != -1)
ws_demand_facing(myWalker, facing);
@@ -298,9 +298,9 @@ static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, i
if (facing > 0 && facing < 13) {
// If there is a facing to be set
_G(globals)[GLB_TEMP_4] = directions[facing] << 16;
- SendWSMessage(747 << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(747 << 16, 0, myWalker, 0, nullptr, 1);
} else {
- SendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
_G(player).waiting_for_walk = false; // lets parse code get called when there is no facing set (from scenedit)
}
}
@@ -326,7 +326,7 @@ void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger) {
// Make sure the _G(completeWalk) flag is set
_G(globals)[GLB_TEMP_6] = 0x10000;
- SendWSMessage(TURN_TO_FACE << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(TURN_TO_FACE << 16, 0, myWalker, 0, nullptr, 1);
}
void ws_nosepick(machine *myWalker, int32 seriesHash) {
@@ -337,7 +337,7 @@ void ws_nosepick(machine *myWalker, int32 seriesHash) {
}
myAnim8 = myWalker->myAnim8;
myAnim8->myRegs[IDX_CELS_HASH] = seriesHash << 16;
- SendWSMessage(NOSEPICK << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(NOSEPICK << 16, 0, myWalker, 0, nullptr, 1);
}
void ws_demand_location(int32 x, int32 y, int facing) {
@@ -350,7 +350,7 @@ void ws_hide_walker(machine *myWalker) {
return;
}
- SendWSMessage(PLAYER_HIDE << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(PLAYER_HIDE << 16, 0, myWalker, 0, nullptr, 1);
}
void ws_unhide_walker(machine *myWalker) {
@@ -359,7 +359,7 @@ void ws_unhide_walker(machine *myWalker) {
return;
}
- SendWSMessage(PLAYER_UNHIDE << 16, 0, myWalker, 0, nullptr, 1);
+ sendWSMessage(PLAYER_UNHIDE << 16, 0, myWalker, 0, nullptr, 1);
}
void ws_demand_facing(int32 newFacing) {
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 001a5b311b8..0088c30094d 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -426,7 +426,7 @@ void BurgerEngine::global_daemon() {
case 10017:
if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
_G(player).walker_in_this_scene && _G(roomVal2))
- SendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
+ sendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
break;
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 8428b650493..cb3acc00f25 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -262,7 +262,7 @@ static const seriesPlayBreak PLAY32[] = {
void Room105::init() {
_G(player).walker_in_this_scene = true;
_val1 = 1;
- _val2 = 0;
+ _series5 = 0;
digi_preload("105_001");
if (_G(flags)[V112]) {
@@ -294,6 +294,438 @@ void Room105::init() {
}
void Room105::daemon() {
+ const int ZERO = 0;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val4) {
+ case 5:
+ switch (_val3) {
+ case 1:
+ digi_preload("105_011");
+ digi_preload("105_012");
+ _val3 = 2;
+ digi_play("105_007", 2, 255, 1);
+ digi_change_volume(3, 0);
+ break;
+
+ case 2:
+ _val3 = 3;
+ series_play_with_breaks(PLAY14, "105eg01", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ break;
+
+ case 3:
+ _val3 = 5;
+ series_play("105eg02", 0xa00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg02s", 0xa01, 0, -1, 10, 0, 100, 0, ZERO, 0, 0);
+ _flag3 = false;
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ player_set_commands_allowed(true);
+
+ if (_G(flags)[V033] == 3) {
+ handleDeed2();
+ } else {
+ conv_resume();
+ }
+ break;
+
+ case 5:
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ case 2:
+ series_play("105eg04", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 1, 1);
+ series_play("105eg04s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 1, 1);
+ break;
+
+ case 3:
+ series_play_with_breaks(PLAY21, "105eg03", 0xa00, 1, 3, 9, 100, 0, ZERO);
+ break;
+
+ default:
+ series_play("105eg04", 0xa00, 0, 1, 30, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg04s", 0xa01, 0, -1, 30, 0, 100, 0, ZERO, 0, 0);
+ break;
+ }
+ break;
+
+ case 6:
+ _val3 = 5;
+ kernel_trigger_dispatch_now(1);
+ conv_resume();
+ break;
+
+ case 7:
+ _val4 = 7;
+ series_play("105eg05", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg05s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 8:
+ _val4 = 8;
+ series_play("105eg06", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 1);
+ series_play("105eg06s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 1);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 9:
+ _val3 = 10;
+ series_play_with_breaks(PLAY15, "105eg07", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ break;
+
+ case 10:
+ _val3 = 7;
+ kernel_trigger_dispatch_now(1);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 14:
+ _val3 = 15;
+ series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 5);
+ series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 5);
+ break;
+
+ case 15:
+ _val3 = 16;
+ _val4 = 16;
+ series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 6, 8);
+ series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 6, 8);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 18:
+ {
+ const seriesPlayBreak *PLAYS[3] = { PLAY16, PLAY17, PLAY18 };
+ series_play_with_breaks(PLAYS[imath_ranged_rand(0, 2)],
+ "105eg10", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ break;
+ }
+
+ case 19:
+ _val3 = 20;
+ series_play_with_breaks(PLAY19, "105eg11", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ break;
+
+ case 20:
+ _val3 = 21;
+ series_play_with_breaks(PLAY20, "105eg10", 0xa00, 1, 3, 4, 100, 0, ZERO);
+ break;
+
+ case 21:
+ kernel_timing_trigger(60, 8);
+ _val3 = 22;
+ kernel_timing_trigger(1, 1);
+ break;
+
+ case 22:
+ unloadAssets3();
+ digi_unload("11n1402");
+
+ if (_flag4) {
+ _flag3 = false;
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ enteringMayorsOffice();
+ handleDeed3();
+ kernel_timing_trigger(60, 12);
+ } else {
+ player_set_commands_allowed(true);
+ _G(flags)[V298] = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ if (_val3 == 7) {
+ _series6 = series_play("105eg05", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 0, 5);
+ _series7 = series_play("105eg05s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 0, 5);
+ } else {
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ _val4 = 5;
+ kernel_trigger_dispatch_now(1);
+ }
+ break;
+
+ case 8:
+ if (_val3 == 8) {
+ _series6 = series_play("105eg06", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 2, 6);
+ _series7 = series_play("105eg06s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 2, 6);
+ } else {
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ _val4 = 5;
+ series_play("105eg06", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 7, 9);
+ series_play("105eg06s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 7, 9);
+ }
+ break;
+
+ case 16:
+ if (_val3 == 16) {
+ _series6 = series_play("105eg06", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 4, 9);
+ _series7 = series_play("105eg06s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 4, 9);
+ } else {
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ _val4 = 5;
+ kernel_trigger_dispatch_now(1);
+ }
+ break;
+
+ case 25:
+ switch (_val3) {
+ case 23:
+ _val3 = 24;
+ series_play_with_breaks(PLAY10, "105mg01", 0xf00, 1, 3, 6, 100, 0, ZERO);
+ break;
+
+ case 24:
+ _val3 = 25;
+ kernel_trigger_dispatch_now(1);
+
+ if (_G(flags)[V033] == 2) {
+ handleDeed3();
+ } else {
+ conv_resume();
+ }
+ break;
+
+ case 25:
+ if (imath_ranged_rand(1, 13) == 1) {
+ series_play("105mg04", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg04s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
+ } else {
+ series_play("105mg02", 0xf00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg02s", 0xf01, 0, -1, 10, 0, 100, 0, ZERO, 0, 0);
+ }
+ break;
+
+ case 26:
+ _val3 = 25;
+ kernel_trigger_dispatch_now(1);
+ conv_resume();
+ break;
+
+ case 27:
+ _val4 = 27;
+ series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 10, 10);
+ series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 10, 10);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 28:
+ _val4 = 27;
+ series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
+ series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 29:
+ _val4 = 25;
+ series_play("105mg03", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
+ series_play("105mg03s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
+ break;
+
+ case 30:
+ _val4 = 25;
+ series_play("105mg05", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 7);
+ series_play("105mg05s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 7);
+ break;
+
+ case 31:
+ _val4 = 31;
+ series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 2);
+ series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 2);
+ break;
+
+ case 32:
+ _val4 = 33;
+ series_play_with_breaks(PLAY11, "105mg08", 0xf00, 1, 3, 6, 100, 0, ZERO);
+ break;
+
+ case 33:
+ _val3 = 34;
+ kernel_timing_trigger(1, 1);
+ break;
+
+ case 34:
+ unloadAssets1();
+
+ if (_flag1) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ loadAssets3();
+ handleDeed2();
+ kernel_timing_trigger(60, 13);
+ } else if (_flag2) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ loadAssets4();
+ handleDeed1();
+ kernel_timing_trigger(60, 11);
+ } else {
+ player_set_commands_allowed(true);
+ _G(flags)[V298] = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ // TODO
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ if (!_val1) {
+ player_set_commands_allowed(true);
+ } else {
+ _val3 = _series5 ? 54 : 56;
+ player_set_commands_allowed(false);
+ }
+ break;
+
+ case 3:
+ _val3 = 32;
+ player_set_commands_allowed(false);
+ break;
+
+ case 4:
+ digi_unload("105_011");
+ digi_unload("105_012");
+ _val3 = _flag3 ? 19 : 18;
+ player_set_commands_allowed(_flag5);
+ _flag5 = false;
+ break;
+
+ case 5:
+ player_set_commands_allowed(true);
+ break;
+
+ case 6:
+ player_set_commands_allowed(true);
+ break;
+
+ case 7:
+ digi_play("105_014", 2, 255, 1004);
+ break;
+
+ case 8:
+ digi_play_loop("105_001", 3, 180);
+ break;
+
+ case 9:
+ digi_play(imath_ranged_rand(1, 2) == 1 ? "105_011" : "105_012", 2, 180, -1);
+ break;
+
+ case 12:
+ ws_walk(341, 216, nullptr, -1, 11);
+ break;
+
+ case 15:
+ ws_unhide_walker();
+
+ if (_G(flags)[V112]) {
+ _val5 = 2;
+ _val6 = 21;
+ _digi1 = "105g003";
+ _val3 = 60;
+ } else if (_G(flags)[V033] == 3 && !_G(flags)[V032]) {
+ _val3 = 1;
+ _val4 = 5;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ _flag5 = _G(flags)[V032] != 0;
+ _flag3 = false;
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ handleDeed2();
+ }
+ break;
+
+ case 16:
+ ws_unhide_walker();
+ kernel_timing_trigger(1, 17);
+ break;
+
+ case 17:
+ if (_G(flags)[V112]) {
+ _val5 = 2;
+ _val6 = 21;
+ _digi1 = "105g002";
+ _val3 = 60;
+ } else if (_G(flags)[V033] != 2) {
+ _flag3 = false;
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ handleDeed3();
+ } else {
+ kernel_trigger_dispatch_now(1);
+ }
+ break;
+
+ case 18:
+ ws_unhide_walker();
+
+ if (_G(flags)[V033] == 1) {
+ _val3 = 40;
+ _val4 = 42;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ handleDeed1();
+ }
+ break;
+
+ case 19:
+ talkTo();
+ break;
+
+ case 20:
+ _series5 = series_play("105deed", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ break;
+
+ case 21:
+ player_set_commands_allowed(true);
+ _val3 = 59;
+ break;
+
+ case 25:
+ ws_unhide_walker();
+ break;
+
+ case 26:
+ player_set_commands_allowed(true);
+ break;
+
+ case 36:
+ terminateMachineAndNull(_series8);
+ _series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 24, 24);
+ break;
+
+ // TODO
+ }
}
void Room105::pre_parser() {
@@ -408,7 +840,7 @@ void Room105::conv10() {
kernel_trigger_dispatch_now(1);
}
} else {
- SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
}
} else if (conv_sound_to_play()) {
@@ -436,7 +868,7 @@ void Room105::conv10() {
_val3 = _val8 ? 37 : 27;
}
} else if (who == 1) {
- SendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(conv_sound_to_play(), 1, 255, 10);
}
} else {
@@ -507,6 +939,16 @@ void Room105::loadAssets3() {
series_load("105eg10s");
}
+void Room105::loadAssets4() {
+ static const char *NAMES[5] = {
+ "105ag02", "105ag03", "105ag05", "105ag06", "105ag07"
+ };
+
+ for (int i = 0; i < 5; ++i)
+ _series1[i] = series_load(NAMES[i]);
+}
+
+
void Room105::unloadAssets1() {
for (int i = 0; i < 12; ++i)
series_unload(_series1[i]);
@@ -522,6 +964,39 @@ void Room105::unloadAssets3() {
series_unload(_series3[i]);
}
+void Room105::unloadAssets4() {
+ for (int i = 0; i < 5; ++i)
+ series_unload(_series4[i]);
+}
+
+void Room105::handleDeed1() {
+ _val1 = 1;
+ conv_load_and_prepare("conv12", 2);
+ conv_export_pointer_curr(&_G(flags)[V033], 0);
+ conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 2);
+ conv_export_value_curr(_G(flags)[V001], 3);
+ conv_play_curr();
+}
+
+void Room105::handleDeed2() {
+ _val1 = 1;
+ conv_load_and_prepare("conv12", 4);
+ conv_export_pointer_curr(&_G(flags)[V032], 0);
+ conv_export_pointer_curr(&_G(flags)[V033], 3);
+ conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 5);
+ conv_play_curr();
+}
+
+void Room105::handleDeed3() {
+ _val1 = 1;
+ conv_load_and_prepare("conv10", 3);
+ conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 0);
+ conv_export_pointer_curr(&_G(flags)[V033], 1);
+ conv_export_value_curr(_G(flags)[V016], 4);
+ conv_export_value_curr(player_been_here(137) ? 1 : 0, 5);
+ conv_play_curr();
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 3cb22b59830..1bbb585b058 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -31,7 +31,6 @@ namespace Rooms {
class Room105 : public Room {
private:
int _val1 = 0;
- int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
@@ -40,10 +39,18 @@ private:
int _val8 = 0;
bool _flag1 = false;
bool _flag2 = false;
+ bool _flag3 = false;
+ bool _flag4 = false;
+ bool _flag5 = false;
const char *_digi1 = nullptr;
int _series1[12];
int _series2[4];
int _series3[12];
+ int _series4[5];
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
+ machine *_series8 = nullptr;
void conv10();
void conv11();
@@ -54,9 +61,14 @@ private:
void loadAssets1();
void loadAssets2();
void loadAssets3();
+ void loadAssets4();
void unloadAssets1();
void unloadAssets2();
void unloadAssets3();
+ void unloadAssets4();
+ void handleDeed1();
+ void handleDeed2();
+ void handleDeed3();
public:
Room105() : Room() {}
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index b1ada6eed85..1fc171ba618 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -882,7 +882,7 @@ void Room135::conv01() {
!(node == 6 && entry == 0) &&
!(node == 2 && entry == 1) &&
!(node == 7 && node == 0)) {
- SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
}
}
break;
@@ -920,7 +920,7 @@ void Room135::conv01() {
} else if ((node == 7 && entry == 1) || (node == 2 && entry == 1)) {
_val6 = 14;
} else {
- SendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(conv_sound_to_play(), 1, 255, 35);
}
}
@@ -963,7 +963,7 @@ void Room135::conv03() {
conv_resume();
}
} else if (who == 1) {
- SendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
}
} else if (conv_sound_to_play()) {
@@ -985,7 +985,7 @@ void Room135::conv03() {
_G(kernel).trigger_mode = KT_DAEMON;
digi_play(conv_sound_to_play(), 1, 255, 16);
} else {
- SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
digi_play(conv_sound_to_play(), 1, 255, 35);
}
}
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 18014ff5a99..da36581140d 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -80,7 +80,7 @@ void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
// Walker has arrived at a node
if (walker_has_walk_finished(sender)) {
// Walks walker to next node if not at end of walk
- SendWSMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
+ sendWSMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
}
break;
@@ -210,7 +210,7 @@ void Walker::wilbur_say() {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
if (_flag && _G(player).walker_in_this_scene && _G(roomVal2))
- SendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
term_message("wilbur_say: wilburs_talk_trigger = %d", _trigger);
digi_stop(_channel);
@@ -248,7 +248,7 @@ bool Walker::wilbur_said(const char *list[][4]) {
void Walker::wilburs_speech_finished() {
if (_flag && !_G(player).walker_in_this_scene && !_G(roomVal2))
- SendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
term_message("wilburs_speech_finished: dispatching wilburs_talk_trigger = %d", _trigger);
kernel_trigger_dispatchx(_trigger);
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 3cdfd9e2e7f..7cb79e03592 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -138,7 +138,7 @@ bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger) {
_G(globals)[GLB_TEMP_3] = kernel_trigger_create(trigger);
// Send the message to the machine to accept the new callback frame num and trigger
- SendWSMessage(0x10000, 0, m, 0, nullptr, 1);
+ sendWSMessage(0x10000, 0, m, 0, nullptr, 1);
return true;
}
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 1661f67fc78..fa98aff2de8 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -969,7 +969,7 @@ static void op_SEQ_SEND_MSG(Anim8 *myAnim8) {
msgValue = 0;
}
- SendWSMessage(*_GWS(myArg2), msgValue, nullptr, (*_GWS(myArg1)) >> 16, nullptr, 1);
+ sendWSMessage(*_GWS(myArg2), msgValue, nullptr, (*_GWS(myArg1)) >> 16, nullptr, 1);
return;
}
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index ef02c992d5f..ed209f39efb 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -158,7 +158,7 @@ bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash) {
case _WS_ASSET_MACH:
// Clear the machines table for entries [minHash, maxHash]
for (i = minHash; i <= maxHash; i++) {
- TerminateMachinesByHash(i);
+ terminateMachinesByHash(i);
if (_GWS(globalMACHnames)[i]) {
rtoss(_GWS(globalMACHnames)[i]);
mem_free(_GWS(globalMACHnames)[i]);
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 391cb5cee9d..b7f7d2b4799 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -419,7 +419,7 @@ static bool op_SEND_MSG(machine *m, int32 *pcOffset) {
} else {
msgValue = 0;
}
- SendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 1);
+ sendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 1);
return true;
}
@@ -435,7 +435,7 @@ static bool op_SEND_GMSG(machine *m, int32 *pcOffset) {
msgValue = 0;
}
- SendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 0);
+ sendWSMessage(*_GWS(myArg2), msgValue, nullptr, *_GWS(myArg1) >> 16, m, 0);
return true;
}
@@ -451,7 +451,7 @@ static bool op_REPLY_MSG(machine *m, int32 *pcOffset) {
msgValue = 0;
}
- SendWSMessage(*_GWS(myArg1), msgValue, m->msgReplyXM, 0, m, 1);
+ sendWSMessage(*_GWS(myArg1), msgValue, m->msgReplyXM, 0, m, 1);
return true;
}
@@ -752,7 +752,7 @@ static void shutdownMachine(machine *m) {
}
-void TerminateMachinesByHash(uint32 machHash) {
+void terminateMachinesByHash(uint32 machHash) {
machine *curr, *next;
curr = _GWS(firstMachine); // Start at beginning of machine chain
@@ -1117,7 +1117,7 @@ static bool SearchMsgList(uint32 msgHash, uint32 msgValue, machine *recvM, int32
// This proc is what allows a machine to send a message to another machine(s)
-void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
+void sendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
uint32 machHash, machine *sendM, int32 msgCount) {
bool found, more_to_send;
machine *currMachine;
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index abd8ce3f75f..ab32ab2b660 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -183,7 +183,7 @@ void ws_RefreshWoodscriptBuffer(Buffer *cleanBackground, int16 *depth_table,
Buffer *screenCodes, uint8 *myPalette, uint8 *ICT);
void terminateMachine(machine *m);
-void TerminateMachinesByHash(uint32 machHash);
+void terminateMachinesByHash(uint32 machHash);
void terminateMachineAndNull(machine *&m);
bool verifyMachineExists(machine *m);
int32 ws_KillMachines();
@@ -194,7 +194,7 @@ machine *TriggerMachineByHash(int32 myHash, Anim8 *parentAnim8, int32 dataHash,
/**
* This proc is what allows a machine to send a message to another machine(s)
*/
-extern void SendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
+extern void sendWSMessage(uint32 msgHash, frac16 msgValue, machine *recvM,
uint32 machHash, machine *sendM, int32 msgCount);
#define kernel_spawn_machine(name,hash,callback) TriggerMachineByHash(hash, nullptr, -1, -1, callback, false, name)
Commit: 53a95d54a81dd8c0ded546e68d5db96440248266
https://github.com/scummvm/scummvm/commit/53a95d54a81dd8c0ded546e68d5db96440248266
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More of room 105 daemon
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index cb3acc00f25..f6134898904 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -295,6 +295,7 @@ void Room105::init() {
void Room105::daemon() {
const int ZERO = 0;
+ int frame;
switch (_G(kernel).trigger) {
case 1:
@@ -589,7 +590,424 @@ void Room105::daemon() {
}
break;
- // TODO
+ case 27:
+ if (_val3 == 27) {
+ _series6 = series_play("105mg06", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 10, 14);
+ _series7 = series_play("105mg06s", 0xf01, 4, -1, 4, -1, 100, 0, ZERO, 10, 14);
+ } else {
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ _val4 = 25;
+
+ series_play("105mg02", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg02s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
+ }
+ break;
+
+ case 31:
+ if (_val3 == 31) {
+ _series6 = series_play("105mg07", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 3, 6);
+ _series7 = series_play("105mg07s", 0xf01, 4, -1, 4, -1, 100, 0, ZERO, 3, 6);
+ } else {
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ _val3 = 32;
+ _val4 = 25;
+
+ series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 7, 8);
+ series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 7, 8);
+ }
+ break;
+
+ case 35:
+ switch (_val3) {
+ case 23:
+ _val3 = 24;
+ series_play_with_breaks(PLAY12, "105mg09", 0xf00, 1, 2, 6, 100, 0, ZERO);
+ break;
+
+ case 24:
+ _val3 = 35;
+ kernel_trigger_dispatch_now(1);
+
+ if (_G(flags)[V033] == 2) {
+ handleDeed3();
+ } else {
+ conv_resume();
+ }
+ break;
+
+ case 32:
+ _val3 = 33;
+ series_play_with_breaks(PLAY13, "105mg14", 0xf00, 1, 2, 6, 100, 0, ZERO);
+ break;
+
+ case 33:
+ _val3 = 34;
+ kernel_timing_trigger(1, 1);
+ break;
+
+ case 34:
+ unloadAssets2();
+
+ if (_flag1) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ loadAssets3();
+ handleDeed2();
+ kernel_timing_trigger(60, 13);
+ } else if (_flag2) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ loadAssets4();
+ handleDeed1();
+ kernel_timing_trigger(60, 11);
+ } else {
+ player_set_commands_allowed(true);
+ _G(flags)[V298] = 0;
+ }
+ break;
+
+ case 35:
+ if (imath_ranged_rand(1, 13) == 1) {
+ series_play("105mg11", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ } else {
+ series_play("105mg11", 0xf00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ }
+ break;
+
+ case 36:
+ _val3 = 35;
+ kernel_trigger_dispatch_now(1);
+ conv_resume();
+ break;
+
+ case 37:
+ _val4 = 37;
+ series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 16, 16);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 38:
+ _val4 = 38;
+ series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 10);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 39:
+ _val4 = 37;
+ series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 15);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 37:
+ if (_val3 == 37) {
+ _series6 = series_play("105mg12", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 16, 18);
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 35;
+ series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 19, 19);
+ }
+ break;
+
+ case 38:
+ if (_val3 == 38) {
+ _series6 = series_play("105mg13", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 11, 14);
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 35;
+ series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 15, 16);
+ }
+ break;
+
+ case 42:
+ switch (_val3) {
+ case 40:
+ _val3 = 41;
+ series_play_with_breaks(PLAY1, "105ag01", 0xe00, 1, 2, 6, 100, 0, 0);
+ break;
+
+ case 41:
+ _val3 = 42;
+ series_play("105ag02", 0xe00, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+
+ if (_G(flags)[V033] == 1) {
+ handleDeed1();
+ } else {
+ conv_resume();
+ }
+ break;
+
+ case 42:
+ switch (imath_ranged_rand(1, 35)) {
+ case 1:
+ case 2:
+ case 3:
+ series_play_with_breaks(PLAY3, "105ag04", 0xe00, 1, 2, 4, 100, 0, 0);
+ break;
+
+ case 4:
+ series_play_with_breaks(PLAY5, "105ag03", 0xe00, 1, 2, 6, 100, 0, 0);
+ break;
+
+ default:
+ series_play("105ag02", 0xe00, 0, 1, 15, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 43:
+ _val3 = 42;
+ kernel_trigger_dispatch_now(1);
+ conv_resume();
+ break;
+
+ case 44:
+ if (imath_ranged_rand(1, 2) == 1) {
+ _val4 = 45;
+ series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 4);
+ } else {
+ _val4 = 46;
+ series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 19);
+ }
+
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 47:
+ _val4 = 47;
+ series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 6);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ break;
+
+ case 49:
+ _val4 = 50;
+ series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 9);
+ break;
+
+ case 50:
+ conv_resume();
+ _val4 = 49;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 51:
+ _val4 = 51;
+ series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 52:
+ _val4 = 52;
+ series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 24);
+ break;
+
+ case 54:
+ series_play_with_breaks(PLAY9, "105ag10", 0xe00, 26, 2, 6, 100, 0, 0);
+ break;
+
+ case 55:
+ series_play_with_breaks(PLAY7, "105ag07", 0xe00, 34, 2, 6, 100, 0, 0);
+ break;
+
+ case 56:
+ _val3 = 57;
+ series_play_with_breaks(PLAY8, "105ag09", 0xe00, 1, 2, 6, 100, 0, 0);
+ break;
+
+ case 57:
+ _val3 = 58;
+ kernel_timing_trigger(1, 1);
+ break;
+
+ case 58:
+ unloadAssets4();
+
+ if (_flag1) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ loadAssets3();
+ handleDeed2();
+ kernel_timing_trigger(60, 13);
+
+ } else if (_flag4) {
+ _flag1 = false;
+ _flag4 = false;
+ _flag2 = false;
+ kernel_timing_trigger(60, 12);
+
+ } else {
+ player_set_commands_allowed(true);
+ _G(flags)[V298] = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 45:
+ if (_val3 == 44) {
+ _series6 = series_play("105ag05", 0xe00, 4, -1, 4, -1, 100, 0, 0, 5, 8);
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 42;
+ series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 4);
+ }
+ break;
+
+ case 46:
+ if (_val3 == 44) {
+ _series6 = series_play("105ag05", 0xe00, 4, -1, 4, -1, 100, 0, 0, 11, 15);
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 42;
+ series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 16, 19);
+ }
+ break;
+
+ case 47:
+ if (_val3 == 47) {
+ if (imath_ranged_rand(1, 10) == 1) {
+ series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 7, 11);
+ } else {
+ _series6 = series_play("105ag06", 0xe00, 4, -1, 4, -1, 100, 0, 0, 6, 9);
+ }
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 42;
+ series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 6);
+ }
+ break;
+
+ case 48:
+ if (_val3 == 47) {
+ if (imath_ranged_rand(1, 10) == 1) {
+ _val4 = 47;
+ series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 7, 11);
+ } else {
+ _series6 = series_play("105ag06", 0xe00, 4, -1, 4, -1, 100, 0, 0, 12, 15);
+ }
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 42;
+ series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 18);
+ }
+ break;
+
+ case 49:
+ if (_val3 == 50) {
+ series_play("105ag07", 0xe00, 0, 1, 10, 0, 100, 0, 0, 9, 9);
+ } else {
+ terminateMachineAndNull(_series6);
+ _val4 = 42;
+ series_play_with_breaks(PLAY6, "105ag07", 0xe00, 1, 2, 6, 100, 0, 0);
+ }
+ break;
+
+ case 51:
+ switch (_val3) {
+ case 51:
+ frame = imath_ranged_rand(3, 6);
+ series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 54:
+ _val4 = 42;
+ _val3 = 58;
+ series_play_with_breaks(PLAY9, "105ag10", 0xe00, 1, 3, 6, 100, 0, 0);
+ break;
+
+ default:
+ _val4 = 42;
+ _val3 = 58;
+ series_play_with_breaks(PLAY8, "105ag14", 0xe00, 1, 3, 6, 100, 0, 0);
+ break;
+ }
+ break;
+
+ case 53:
+ if (_val3 == 52) {
+ series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 29, 29);
+ } else {
+ _val4 = 42;
+ series_play("105ag07", 0xe00, 2, 1, 4, 0, 100, 0, 0, 30, 33);
+ }
+ break;
+
+ case 59:
+ switch (_val3) {
+ case 59:
+ frame = imath_ranged_rand(0, 1);
+ series_play("105ag12", 0xa00, 0, 1, 40, 0, 100, 0, 0, frame, frame);
+ series_play("105ag12s", 0xa01, 0, -1, 40, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 60:
+ _val4 = 60;
+ series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 0);
+ series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 0);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = _savedMode;
+ digi_play(_digi1, 1, 255, _savedTrigger);
+ _digi1 = nullptr;
+ }
+ break;
+
+ case 61:
+ _val4 = 61;
+ series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 5);
+ series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 5);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = _savedMode;
+ digi_play(_digi1, 1, 255, _savedTrigger);
+ _digi1 = nullptr;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 60:
+ if (_val3 == 60) {
+ frame = imath_ranged_rand(4, 8);
+ series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ } else {
+ _val4 = 59;
+ series_play("105ag13", 0xa00, 2, 1, 4, 0, 100, 0, 0, 0, 3);
+ series_play("105ag13s", 0xa01, 2, -1, 4, 0, 100, 0, 0, 0, 3);
+ }
+ break;
+
+ case 61:
+ if (_val3 == 61) {
+ frame = imath_ranged_rand(6, 9);
+ series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ } else {
+ _val4 = 59;
+ series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 12, 15);
+ series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 12, 15);
+ }
+ break;
default:
break;
@@ -646,8 +1064,8 @@ void Room105::daemon() {
ws_unhide_walker();
if (_G(flags)[V112]) {
- _val5 = 2;
- _val6 = 21;
+ _savedMode = 2;
+ _savedTrigger = 21;
_digi1 = "105g003";
_val3 = 60;
} else if (_G(flags)[V033] == 3 && !_G(flags)[V032]) {
@@ -671,8 +1089,8 @@ void Room105::daemon() {
case 17:
if (_G(flags)[V112]) {
- _val5 = 2;
- _val6 = 21;
+ _savedMode = 2;
+ _savedTrigger = 21;
_digi1 = "105g002";
_val3 = 60;
} else if (_G(flags)[V033] != 2) {
@@ -765,8 +1183,8 @@ void Room105::parser() {
break;
case 1:
- _val5 = 2;
- _val6 = 21;
+ _savedMode = 2;
+ _savedTrigger = 21;
_digi1 = "105g001";
_val3 = 60;
break;
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 1bbb585b058..0a91191d465 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -33,8 +33,8 @@ private:
int _val1 = 0;
int _val3 = 0;
int _val4 = 0;
- int _val5 = 0;
- int _val6 = 0;
+ KernelTriggerType _savedMode = (KernelTriggerType)0;
+ int _savedTrigger = 0;
int _val7 = 0;
int _val8 = 0;
bool _flag1 = false;
Commit: 3591d1c77a8999895100a83c9dbe8ad76d3543cb
https://github.com/scummvm/scummvm/commit/3591d1c77a8999895100a83c9dbe8ad76d3543cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 105 daemon
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index f6134898904..f0e3e45521f 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -1056,15 +1056,23 @@ void Room105::daemon() {
digi_play(imath_ranged_rand(1, 2) == 1 ? "105_011" : "105_012", 2, 180, -1);
break;
+ case 11:
+ ws_walk(186, 263, 0, -1, 10);
+ break;
+
case 12:
ws_walk(341, 216, nullptr, -1, 11);
break;
+ case 13:
+ ws_walk(415, 254, 0, -1, 2);
+ break;
+
case 15:
ws_unhide_walker();
if (_G(flags)[V112]) {
- _savedMode = 2;
+ _savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g003";
_val3 = 60;
@@ -1089,7 +1097,7 @@ void Room105::daemon() {
case 17:
if (_G(flags)[V112]) {
- _savedMode = 2;
+ _savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g002";
_val3 = 60;
@@ -1129,6 +1137,22 @@ void Room105::daemon() {
_val3 = 59;
break;
+ case 22:
+ ws_demand_location(376, 226, 5);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY30, "105wi06", 0xf00, 25, 3);
+ break;
+
+ case 23:
+ ws_demand_location(346, 226, 5);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY30, "105wi06", 0xf00, 25, 3, 6, 100, -30, 0);
+ break;
+
+ case 24:
+ ws_walk(385, 254, 0, -1, 2);
+ break;
+
case 25:
ws_unhide_walker();
break;
@@ -1137,12 +1161,110 @@ void Room105::daemon() {
player_set_commands_allowed(true);
break;
+ case 27:
+ ws_demand_location(358, 246, 11);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY32, "105wi05", 0x100, 25, 3);
+ break;
+
+ case 28:
+ ws_demand_location(228, 262, 10);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY23, "105wi01", 0x100, 25, 3);
+ break;
+
+ case 29:
+ ws_hide_walker();
+ _series12 = series_load("105wi07");
+ digi_preload("100_023");
+ series_play("105wi07", 0x100, 0, 30, 6, 0, 100, -30, 0, 0, 15);
+ series_play("105wi07s", 0x101, 0, -1, 6, 0, 100, -30, 0, 0, 15);
+ break;
+
+ case 30:
+ series_play("105wi07", 0x100, 0, 31, 6, 0, 100, -30, 0, 16, 21);
+ series_play("105wi07s", 0x101, 0, -1, 6, 0, 100, -30, 0, 16, 21);
+ digi_play("100_023", 2, 255);
+ conv_resume_curr();
+ break;
+
+ case 31:
+ digi_stop(2);
+ _series9 = series_play("105wi07", 0x100, 0, 30, 600, -1, 100, -30, 0, 21, 21);
+ _series10 = series_play("105wi07s", 0x100, 0, -1, 600, -1, 100, -30, 0, 21, 21);
+ break;
+
+ case 32:
+ terminateMachineAndNull(_series9);
+ terminateMachineAndNull(_series10);
+ digi_play("100_023", 2, 255);
+ series_play("105wi07", 0x100, 0, 33, 6, 0, 100, -30, 0, 21, 43);
+ series_play("105wi07s", 0x101, 0, -1, 6, 0, 100, -30, 0, 21, 43);
+ break;
+
+ case 33:
+ digi_stop(2);
+ digi_unload("100_023");
+ series_unload(_series12);
+ ws_unhide_walker();
+ break;
+
+ case 34:
+ _series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 23, 23);
+ series_play_with_breaks(PLAY28, "105wi03", 0x200, 46, 3, 6, 100, 40, 0);
+ break;
+
+
case 36:
terminateMachineAndNull(_series8);
_series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 24, 24);
break;
- // TODO
+ case 37:
+ _series5 = series_play("105deed", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ series_play("105ag07", 0xe00, 0, 38, 6, 0, 100, 0, 0, 31, 32);
+ break;
+
+ case 38:
+ series_play_with_breaks(PLAY4, "105ag08", 0xe00, 39, 2);
+ break;
+
+ case 39:
+ _series8 = series_play("105ag08", 0xe00, 0, -1, 600, -1, 100, 0, 0, 6, 6);
+ series_play_with_breaks(PLAY24, "105wi02", 0x200, 40, 3, 6, 100, 40, 0);
+ break;
+
+ case 40:
+ terminateMachineAndNull(_series8);
+ series_play("105ag08", 0xe00, 0, 41, 7, 0, 100, 0, 0, 11, 15);
+ series_play_with_breaks(PLAY25, "105wi02", 0x200, 46, 3, 6, 100, 40, 0);
+ break;
+
+ case 41:
+ terminateMachineAndNull(_series5);
+ _G(flags)[V001] = 0;
+ series_play_with_breaks(PLAY2, "105ag08", 0xe00, 42, 2);
+ break;
+
+ case gTELEPORT:
+ switch (_G(roomVal1)) {
+ case 62:
+ if (_G(flags)[V112] && !_G(flags)[V034]) {
+ player_set_commands_allowed(false);
+ _G(flags)[V034] = 1;
+ ws_walk(199, 279, 0, 19, 9);
+
+ } else {
+ ws_walk(301, 313, 0, -1, 11);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
}
}
@@ -1183,7 +1305,7 @@ void Room105::parser() {
break;
case 1:
- _savedMode = 2;
+ _savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g001";
_val3 = 60;
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 0a91191d465..288cfd8c7da 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -51,6 +51,10 @@ private:
machine *_series6 = nullptr;
machine *_series7 = nullptr;
machine *_series8 = nullptr;
+ machine *_series9 = nullptr;
+ machine *_series10 = nullptr;
+ int _series11 = 0;
+ int _series12 = 0;
void conv10();
void conv11();
Commit: ae4452ba4fcf91c47be4e53a521a96cb3b836f99
https://github.com/scummvm/scummvm/commit/ae4452ba4fcf91c47be4e53a521a96cb3b836f99
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Consistent handling of a few sourceOffsets
At least one of them wouldn't compile with GCC before this change.
Changed paths:
engines/m4/burger/gui/game_menu.cpp
engines/m4/graphics/gr_series.cpp
engines/m4/wscript/ws_hal.cpp
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index e137b899835..12008f91f19 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -267,7 +267,7 @@ void gui_DrawSprite(Sprite *mySprite, Buffer *myBuff, int32 x, int32 y) {
if (mySprite->sourceHandle) {
HLock(mySprite->sourceHandle);
- mySprite->data = (uint8 *)((int32) * (mySprite->sourceHandle) + mySprite->sourceOffset);
+ mySprite->data = (uint8 *)((intptr)*(mySprite->sourceHandle) + mySprite->sourceOffset);
drawSpriteBuff.w = mySprite->w;
drawSpriteBuff.stride = mySprite->w;
@@ -2332,7 +2332,7 @@ guiMenu *menu_Create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFla
// draw the sprite
if (backgroundSprite->sourceHandle) {
HLock(backgroundSprite->sourceHandle);
- backgroundSprite->data = (uint8 *)((int32) * (backgroundSprite->sourceHandle) + backgroundSprite->sourceOffset);
+ backgroundSprite->data = (uint8 *)((intptr)*(backgroundSprite->sourceHandle) + backgroundSprite->sourceOffset);
drawSpriteBuff.w = backgroundSprite->w;
drawSpriteBuff.stride = backgroundSprite->w;
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 7cb79e03592..d2dad793538 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -62,7 +62,7 @@ bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x
HLock(srcSpritePtr->sourceHandle);
//gr_pal_interface(&master_palette[0]);
- srcSpritePtr->data = (uint8 *)((int32) * (srcSpritePtr->sourceHandle) + srcSpritePtr->sourceOffset);
+ srcSpritePtr->data = (uint8 *)((intptr)*(srcSpritePtr->sourceHandle) + srcSpritePtr->sourceOffset);
RendGrBuff Destination;
DrawRequestX dr;
diff --git a/engines/m4/wscript/ws_hal.cpp b/engines/m4/wscript/ws_hal.cpp
index 247f37095b9..6dd75f4d58a 100644
--- a/engines/m4/wscript/ws_hal.cpp
+++ b/engines/m4/wscript/ws_hal.cpp
@@ -156,7 +156,7 @@ static void drawSprite(CCB *myCCB, Anim8 *myAnim8, Buffer *halScrnBuf, Buffer *s
// Lock the sprite handle
HLock(source->sourceHandle);
- source->data = (uint8 *)((byte *)*(source->sourceHandle) + source->sourceOffset);
+ source->data = (uint8 *)((intptr)*(source->sourceHandle) + source->sourceOffset);
}
assert(myCCB->currLocation);
Commit: e7eb97aca3954d151aa23bdbc2444fb2dd1333aa
https://github.com/scummvm/scummvm/commit/e7eb97aca3954d151aa23bdbc2444fb2dd1333aa
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix another GCC compile error
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index ed209f39efb..80606a645ca 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1127,7 +1127,7 @@ CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB) {
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
ws_LogErrorMsg(FL, "WS loader has not been initialized.");
- return false;
+ return nullptr;
}
//If a memory location to store the CCB has not been provided...
Commit: 71eb0c427607f1bb5f1defa63ce7da73c1b8cb20
https://github.com/scummvm/scummvm/commit/71eb0c427607f1bb5f1defa63ce7da73c1b8cb20
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify a bunch of byte * as being intptr
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index f0e3e45521f..6f92cee36f9 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -1246,6 +1246,37 @@ void Room105::daemon() {
series_play_with_breaks(PLAY2, "105ag08", 0xe00, 42, 2);
break;
+ case 42:
+ _series11 = series_load("105ag08");
+ _series8 = series_play("105ag08", 0xe00, 0, -1, 600, -1, 100, 0, 0, 37, 37);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY26, "105wi04", 0x200, 43, 3, 6, 100, 40, 0);
+ break;
+
+ case 43:
+ terminateMachineAndNull(_series8);
+ series_play("105ag08", 0xe00, 0, 44, 6, 0, 100, 0, 0, 38, 42);
+ series_play_with_breaks(PLAY27, "105wi04", 0x200, 46, 3, 6, 100, 40, 0);
+ inv_give_to_player("deed"); // Finally get the deed after all the above code
+ inv_move_object("money", NOWHERE); // No! My money!
+ break;
+
+ case 44:
+ series_unload(_series11);
+ _val3 = 42;
+ _val4 = 42;
+ kernel_trigger_dispatch_now(1);
+ conv_resume();
+ break;
+
+ case 45:
+ terminateMachineAndNull(_series5);
+ break;
+
+ case 46:
+ ws_unhide_walker();
+ break;
+
case gTELEPORT:
switch (_G(roomVal1)) {
case 62:
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index fa98aff2de8..d0ff828a013 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -444,7 +444,7 @@ static bool ExtractArg(Anim8 *myAnim8, int32 myFormat, int32 myData, frac16 **ar
}
// Dereferrence the dataHandle, add the offset to find the array of data for this anim8
- dataArray = (frac16 *)((byte *)*(myAnim8->dataHandle) + myAnim8->dataOffset);
+ dataArray = (frac16 *)((intptr)*(myAnim8->dataHandle) + myAnim8->dataOffset);
// Copy the data field into dataArg1, and set myArg1 to point to this location
*argValue = dataArray[myIndex];
@@ -1376,7 +1376,7 @@ bool CrunchAnim8(Anim8 *myAnim8) {
while (_GWS(keepProcessing)) {
dbg_SetCurrSequInstr(myAnim8, _GWS(compareCCR));
- myPC = (uint32 *)((byte *)*(myAnim8->sequHandle) + myAnim8->pcOffset);
+ myPC = (uint32 *)((intptr)*(myAnim8->sequHandle) + myAnim8->pcOffset);
oldPC = myPC;
_GWS(pcOffsetOld) = myAnim8->pcOffset;
@@ -1384,7 +1384,7 @@ bool CrunchAnim8(Anim8 *myAnim8) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x025c, nullptr);
}
- myAnim8->pcOffset += (byte *)myPC - (byte *)oldPC;
+ myAnim8->pcOffset += (intptr)myPC - (intptr)oldPC;
pCodeJmpTable[myInstruction](myAnim8);
}
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 80606a645ca..3e025a6b942 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -627,7 +627,7 @@ bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH)
// Lock the handle, and get the cels source
HLock(ssHandle);
- celsPtr = (int32 *)((byte *)*ssHandle + ssOffset);
+ celsPtr = (int32 *)((intptr)*ssHandle + ssOffset);
// Return the values
if (maxW) {
@@ -1374,7 +1374,7 @@ MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
sequPtr = (uint32 *)((intptr)*(_GWS(globalSEQUHandles)[hash]) + (uint32)(_GWS(globalSEQUoffsets)[hash]));
// Return the offset into the resource chunk, and the number of local vars used by the sequence
- *offset = (byte *)(&sequPtr[SEQU_SEQU_START]) - (byte *)*(_GWS(globalSEQUHandles)[hash]);
+ *offset = (intptr)(&sequPtr[SEQU_SEQU_START]) - (intptr)*(_GWS(globalSEQUHandles)[hash]);
*numLocalVars = sequPtr[SEQU_NUM_VARS];
// Return the resource handle
Commit: 3e24d2c8d26bd46279a8e1356bdecaccc5b630c0
https://github.com/scummvm/scummvm/commit/3e24d2c8d26bd46279a8e1356bdecaccc5b630c0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixing casts to intptr
Changed paths:
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 3e025a6b942..7f64e9aa5da 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -351,7 +351,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the resource name, and the offset into the resource block
_GWS(globalSEQUnames)[*chunkHash] = mem_strdup(wsAssetName);
_GWS(globalSEQUHandles)[*chunkHash] = workHandle;
- _GWS(globalSEQUoffsets)[*chunkHash] = (byte *)parseAssetPtr - (byte *)mainAssetPtr;
+ _GWS(globalSEQUoffsets)[*chunkHash] = (intptr)parseAssetPtr - (intptr)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -390,7 +390,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the resource name, and the offset into the resource block
_GWS(globalDATAnames)[*chunkHash] = mem_strdup(wsAssetName);
_GWS(globalDATAHandles)[*chunkHash] = workHandle;
- _GWS(globalDATAoffsets)[*chunkHash] = (byte *)parseAssetPtr - (byte *)mainAssetPtr;
+ _GWS(globalDATAoffsets)[*chunkHash] = (intptr)parseAssetPtr - (intptr)mainAssetPtr;
// Check that the assetblocksize is big enough that the chunk body was read in...
if ((endOfAssetBlock - parseAssetPtr) < (int)(*chunkSize - 12)) {
@@ -437,12 +437,12 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
// Store the Handle, and calculate the offsets
_GWS(globalCELSHandles)[*chunkHash] = workHandle;
if (celsPtr) {
- _GWS(globalCELSoffsets)[*chunkHash] = (byte *)celsPtr - (byte *)mainAssetPtr;
+ _GWS(globalCELSoffsets)[*chunkHash] = (intptr)celsPtr - (intptr)mainAssetPtr;
} else {
_GWS(globalCELSoffsets)[*chunkHash] = -1;
}
if (palPtr) {
- _GWS(globalCELSPaloffsets)[*chunkHash] = (byte *)palPtr - (byte *)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[*chunkHash] = (intptr)palPtr - (intptr)mainAssetPtr;
} else {
_GWS(globalCELSPaloffsets)[*chunkHash] = -1;
}
@@ -450,7 +450,7 @@ bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette) {
default:
error_show(FL, 'WSLT', "Asset Name: %s, %d bytes into the file.", wsAssetName,
- (int32)parseAssetPtr - 12 - (int32)mainAssetPtr);
+ (intptr)parseAssetPtr - 12 - (intptr)mainAssetPtr);
break;
}
@@ -560,8 +560,8 @@ int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *ce
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
- *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
+ *celsOffset = (intptr)celsPtr - (intptr)mainAssetPtr;
+ *palOffset = (intptr)palPtr - (intptr)mainAssetPtr;
HUnLock(workHandle);
@@ -609,8 +609,8 @@ int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
- *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
+ *celsOffset = (intptr)celsPtr - (intptr)mainAssetPtr;
+ *palOffset = (intptr)palPtr - (intptr)mainAssetPtr;
HUnLock(workHandle);
return celsSize;
@@ -703,7 +703,7 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
if ((i > MAX_ASSET_HASH) && (emptySlot >= 0)) {
if ((workHandle = rget(wsAssetName, &assetSize)) == nullptr) {
- error_show(FL, 'FNF!', (char *)wsAssetName);
+ error_show(FL, 'FNF!', wsAssetName);
}
// Lock the handle so we can step through the chunk
@@ -727,12 +727,12 @@ int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette) {
// Store the Handle, and calculate the offsets
_GWS(globalCELSHandles)[emptySlot] = workHandle;
if (celsPtr) {
- _GWS(globalCELSoffsets)[emptySlot] = (byte *)celsPtr - (byte *)mainAssetPtr;
+ _GWS(globalCELSoffsets)[emptySlot] = (intptr)celsPtr - (intptr)mainAssetPtr;
} else {
_GWS(globalCELSoffsets)[emptySlot] = -1;
}
if (palPtr) {
- _GWS(globalCELSPaloffsets)[emptySlot] = (byte *)palPtr - (byte *)mainAssetPtr;
+ _GWS(globalCELSPaloffsets)[emptySlot] = (intptr)palPtr - (intptr)mainAssetPtr;
} else {
_GWS(globalCELSPaloffsets)[emptySlot] = -1;
}
@@ -851,7 +851,7 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
*palDataOffset = (int32 *)numColors;
palData = (uint32 *)numColors;
- if (((int32)endOfAssetBlock - (int32)(*parseAssetPtr)) < ((int32)(*celsSize) - 8)) {
+ if (((intptr)endOfAssetBlock - (intptr)(*parseAssetPtr)) < ((int32)(*celsSize) - 8)) {
ws_LogErrorMsg(FL, "Pal info is larger than asset block.");
return -1;
}
@@ -919,7 +919,7 @@ static int32 ProcessCELS(const char * /*assetName*/, char **parseAssetPtr, char
return -1;
}
- if (((byte *)endOfAssetBlock - (byte *)data) < (int32)*celsSize) {
+ if (((intptr)endOfAssetBlock - (intptr)data) < (int32)*celsSize) {
ws_LogErrorMsg(FL, "SS info is larger than asset block.");
return -1;
}
@@ -1060,8 +1060,8 @@ int32 LoadSpriteSeries(const char *assetName, Handle *seriesHandle, int32 *celsO
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
- *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
+ *celsOffset = (intptr)celsPtr - (intptr)mainAssetPtr;
+ *palOffset = (intptr)palPtr - (intptr)mainAssetPtr;
HUnLock(workHandle);
@@ -1113,8 +1113,8 @@ int32 LoadSpriteSeriesDirect(const char *assetName, Handle *seriesHandle, int32
// Store the handle and offsets
*seriesHandle = workHandle;
- *celsOffset = (byte *)celsPtr - (byte *)mainAssetPtr;
- *palOffset = (byte *)palPtr - (byte *)mainAssetPtr;
+ *celsOffset = (intptr)celsPtr - (intptr)mainAssetPtr;
+ *palOffset = (intptr)palPtr - (intptr)mainAssetPtr;
HUnLock(workHandle);
return celsSize;
@@ -1411,8 +1411,8 @@ MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int
// Set the number of states, the state offset table, the start of the mach instructions
*numStates = (int32)machPtr[MACH_NUM_STATES];
- *stateTableOffset = (byte *)(&machPtr[MACH_OFFSETS]) - (byte *)(*_GWS(globalMACHHandles)[hash]);
- *machInstrOffset = ((byte *)machPtr + ((*numStates + 1) << 2)) - (byte *)(*_GWS(globalMACHHandles)[hash]);
+ *stateTableOffset = (intptr)(&machPtr[MACH_OFFSETS]) - (intptr)(*_GWS(globalMACHHandles)[hash]);
+ *machInstrOffset = ((intptr)machPtr + ((*numStates + 1) << 2)) - (intptr)(*_GWS(globalMACHHandles)[hash]);
// Unlock and return the handle
HUnLock(_GWS(globalMACHHandles)[hash]);
@@ -1451,8 +1451,8 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
return nullptr;
}
- *rowOffset = (int32)((byte *)(&dataPtr[DATA_REC_START]) + ((index * dataPtr[DATA_REC_SIZE]) << 2)
- - (byte *)(*_GWS(globalDATAHandles)[hash]));
+ *rowOffset = (int32)((intptr)(&dataPtr[DATA_REC_START]) + ((index * dataPtr[DATA_REC_SIZE]) << 2)
+ - (intptr)(*_GWS(globalDATAHandles)[hash]));
// Return the data handle
return _GWS(globalDATAHandles)[hash];
}
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index b7f7d2b4799..68061534abb 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -522,8 +522,8 @@ static bool op_TRIG_W(machine *m, int32 *pcOffset) {
}
// This is a double length instruction - up to 128 bits, we must read in the next pCode
- machInstr = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->machInstrOffset);
- myPC = (uint32 *)((uint32)(machInstr)+*pcOffset);
+ machInstr = (uint32 *)((intptr)(*(m->machHandle)) + (uint32)m->machInstrOffset);
+ myPC = (uint32 *)((intptr)machInstr + *pcOffset);
oldPC = myPC;
if ((myInstruction = ws_PreProcessPcode(&myPC, m->myAnim8)) < 0) {
ws_Error(m, ERR_MACH, 0x0266, "trig_w() failed.");
@@ -932,7 +932,7 @@ void IntoTheState(machine *m) {
ws_Error(m, ERR_INTERNAL, 0x2f2, "IntoTheState() failed.");
}
- stateTable = (uint32 *)((uint32)(*(m->machHandle)) + (uint32)m->stateTableOffset);
+ stateTable = (uint32 *)((intptr)(*(m->machHandle)) + (intptr)m->stateTableOffset);
pcOffset = stateTable[m->curState];
// Increment and remember the recurseLevel and the machine ID
Commit: c2c254c0f677025d2e3c95ae79ff2708708bd56c
https://github.com/scummvm/scummvm/commit/c2c254c0f677025d2e3c95ae79ff2708708bd56c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix a bunch of compiler warnings
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/console.cpp
engines/m4/fileio/fstream.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_item.cpp
engines/m4/vars.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 604c6e450a8..cdf8f3a10cd 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -110,14 +110,14 @@ static int32 count_catalog_items() {
}
static int compare_catalog_entries_for_sort(const void *n1, const void *n2) {
- char *entry1 = *(char **)n1;
- if (convert_intel16(*(short *)&entry1[2]) == _T_ROOM)
+ const char *entry1 = *(const char **)n1;
+ if (convert_intel16(*(const short *)&entry1[2]) == _T_ROOM)
entry1 = &entry1[6];
else
entry1 = &entry1[4];
- char *entry2 = *(char **)n2;
- if (convert_intel16(*(short *)&entry2[2]) == _T_ROOM)
+ const char *entry2 = *(const char **)n2;
+ if (convert_intel16(*(const short *)&entry2[2]) == _T_ROOM)
entry2 = &entry2[6];
else
entry2 = &entry2[4];
@@ -143,7 +143,7 @@ static void sort_catalog() {
switch (tag) {
case _T_ROOM:
- snprintf(&pCatalogIter[(3 * sizeof(short))], 256, "%03d!\0", room_number);
+ snprintf(&pCatalogIter[(3 * sizeof(short))], 256, "%03d!", room_number);
i = (3 * sizeof(short)) + (5 * sizeof(char));
@@ -259,14 +259,14 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
}
static int compare_catalog_entries_for_search(const void *n1, const void *n2) {
- char *cat_entry = *(char **)n2;
+ const char *cat_entry = *(const char **)n2;
- if (convert_intel16(*(short *)&cat_entry[2]) == _T_ROOM)
+ if (convert_intel16(*(const short *)&cat_entry[2]) == _T_ROOM)
cat_entry = &cat_entry[6];
else
cat_entry = &cat_entry[4];
- return (scumm_strnicmp((char *)n1, cat_entry, 80));
+ return (scumm_strnicmp((const char *)n1, cat_entry, 80));
}
} // End of namespace M4
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index f3cb460e116..aad1aee1c20 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -203,8 +203,6 @@ void Room101::init() {
}
void Room101::daemon() {
- const int FIFTY_THREE = -53;
-
if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
player_update_info(_G(my_walker), &_G(player_info));
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 57d129b8301..576431d9b27 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -54,7 +54,7 @@ bool Console::Cmd_flag(int argc, const char **argv) {
debugPrintf("Not Orion Burger\n");
} else if (argc == 2) {
int flagNum = atol(argv[1]);
- debugPrintf("Flag %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
+ debugPrintf("Flag %d = %ld\n", flagNum, Burger::g_vars->_flags[flagNum]);
} else if (argc == 3) {
int flagNum = atol(argv[1]);
int flagVal = atol(argv[2]);
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 1467c7ad2eb..60fb4a50819 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -76,8 +76,6 @@ strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuff
void *bufferHandle;
int32 memAvail;
- const int32 PADDING = 256;
-
// Parameter verification
if (!srcFile) {
error_show(FL, 'FSF!');
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 172b3341067..44820b9eea2 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -817,9 +817,12 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
b = _G(master_palette)[i].b + (MulSF16(percent, db) >> 16);
// Check for under/overflow
- if (r > 255) r = 255; if (r < 0) r = 0;
- if (g > 255) g = 255; if (g < 0) g = 0;
- if (b > 255) b = 255; if (b < 0) b = 0;
+ if (r > 255) r = 255;
+ if (r < 0) r = 0;
+ if (g > 255) g = 255;
+ if (g < 0) g = 0;
+ if (b > 255) b = 255;
+ if (b < 0) b = 0;
color.r = (byte)r;
color.g = (byte)g;
@@ -857,9 +860,12 @@ void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 l
b = (_G(master_palette)[i].b - (db >> 16));
// Check for under/overflow
- if (r > 255) r = 255; if (r < 0) r = 0;
- if (g > 255) g = 255; if (g < 0) g = 0;
- if (b > 255) b = 255; if (b < 0) b = 0;
+ if (r > 255) r = 255;
+ if (r < 0) r = 0;
+ if (g > 255) g = 255;
+ if (g < 0) g = 0;
+ if (b > 255) b = 255;
+ if (b < 0) b = 0;
color.r = (byte)r;
color.g = (byte)g;
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index fa01beea123..54258e533ea 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -487,7 +487,11 @@ Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *pr
case REPEAT_BUTTON:
item->prompt = mem_strdup(prompt);
break;
+
+ default:
+ break;
}
+
CorrectItemWidthHeight(item, fontHeight);
if (type == LISTBOX) {
if (!sizeofGUIelement_border(LISTBOX, &listboxWidth, &listboxHeight)) return nullptr;
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 0237237f231..57ad40655bb 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -90,7 +90,7 @@ bool Vars::init() {
if (_cheat_keys_enabled) {
if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals))
- error(FL, 'DWIF');
+ error_show(FL, 'DWIF', "cheat system");
}
main_cold_data_init();
@@ -111,7 +111,7 @@ void Vars::game_systems_initialize(byte flags) {
debugC(kDebugCore, _G(kernel).suppress_cache ?
"Cache System Disabled" : "Cache System Enabled");
- debugC(kDebugCore, "Available memory: %d", totalMem);
+ debugC(kDebugCore, "Available memory: %ld", totalMem);
mem_stash_init(32);
Commit: cd78359c24260492ca10f8a24345299a3e7c0080
https://github.com/scummvm/scummvm/commit/cd78359c24260492ca10f8a24345299a3e7c0080
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix further compiler warnings
Changed paths:
engines/m4/graphics/gr_font.cpp
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_surface.cpp
engines/m4/graphics/gr_surface.h
engines/m4/gui/gui_item.cpp
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index 43c5c1760bb..23a6f95ce80 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -230,7 +230,7 @@ int32 gr_font_string_width(char *out_string, int32 auto_spacing) {
byte *widthArray = _G(font)->width;
while (*out_string) {
- width += widthArray[*out_string] + auto_spacing;
+ width += widthArray[(byte)*out_string] + auto_spacing;
out_string++;
}
@@ -298,7 +298,7 @@ int32 gr_font_write(Buffer *target, char *out_string, int32 x, int32 y, int32 w,
short *offsetArray = _G(font)->offset;
while (*out_string) {
- char c = (*out_string++) & (char)0x7f;
+ byte c = (*out_string++) & 0x7f;
int32 wdth = widthArray[c];
// if width is zero, nothing to draw
@@ -389,7 +389,7 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'WIDT')
- error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 1);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", fontName, 1);
// width table
newFont->width = (byte *)mem_alloc(256, STR_FONTWIDTH);
@@ -405,7 +405,7 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'OFFS')
- error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 2);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", fontName, 2);
// offset table
newFont->offset = (short *)mem_alloc(256 * sizeof(short), STR_FONTOFF);
@@ -424,7 +424,7 @@ Font *gr_font_load(const char *fontName) {
bumpf = (uint32 *)&buffer[0];
tag = convert_intel32(*bumpf);
if (tag != 'PIXS')
- error_show(FL, 'FNTL', "font: %s chkpnt: %d", (char *)fontName, 3);
+ error_show(FL, 'FNTL', "font: %s chkpnt: %d", fontName, 3);
// pixData
newFont->pixData = (byte *)mem_alloc(newFont->dataSize, STR_FONTDATA);
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index b3ec64cf4ff..7ba5e595954 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -56,7 +56,6 @@ byte gr_color_get_current() {
void gr_pal_clear(RGB8 *palette) {
int i;
- RGB8 x = { 0, 0, 0 };
for (i = 0; i < 256; i++) {
palette[i].r = 0;
@@ -89,8 +88,6 @@ void gr_pal_set_entry(int32 index, RGB8 *entry) {
}
void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color) {
- RGB8 x = { 0, 0, 0 };
-
for (int i = first_color; i <= last_color; i++) {
palette[i].r = 0;
palette[i].g = 0;
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 261c41e7bc3..f0a60bd0824 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -25,23 +25,23 @@
namespace M4 {
-M4Surface::M4Surface(int w, int h) : Buffer() {
- this->w = w;
- this->h = h;
- this->stride = w;
+M4Surface::M4Surface(int sw, int sh) : Buffer() {
+ this->w = sw;
+ this->h = sh;
+ this->stride = sw;
this->encoding = NO_COMPRESS;
- this->data = new byte[w * h];
- Common::fill(this->data, this->data + w * h, 0);
+ this->data = new byte[sw * sh];
+ Common::fill(this->data, this->data + sw * sh, 0);
_disposeAfterUse = DisposeAfterUse::YES;
}
-M4Surface::M4Surface(const byte *src, int w, int h) {
- this->w = w;
- this->h = h;
- this->stride = w;
+M4Surface::M4Surface(const byte *src, int sw, int sh) {
+ this->w = sw;
+ this->h = sh;
+ this->stride = sw;
this->encoding = NO_COMPRESS;
- this->data = new byte[w * h];
- Common::fill(this->data, this->data + w * h, 0);
+ this->data = new byte[sw * sh];
+ Common::fill(this->data, this->data + sw * sh, 0);
_disposeAfterUse = DisposeAfterUse::YES;
rleDraw(src);
diff --git a/engines/m4/graphics/gr_surface.h b/engines/m4/graphics/gr_surface.h
index 8e86907e0f5..0ef36739065 100644
--- a/engines/m4/graphics/gr_surface.h
+++ b/engines/m4/graphics/gr_surface.h
@@ -37,8 +37,8 @@ private:
public:
M4Surface() : Buffer() {}
M4Surface(const Buffer &src) : Buffer(src) {}
- M4Surface(int w, int h);
- M4Surface(const byte *src, int w, int h);
+ M4Surface(int sw, int sh);
+ M4Surface(const byte *src, int sw, int sh);
~M4Surface();
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 54258e533ea..d0b937a4330 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -60,7 +60,7 @@ static const byte scrollUpData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer scrollUpBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpData[0], 0, 0 };
+static const Buffer scrollUpBuff = { scrollUpWidth, scrollUpHeight, const_cast<uint8 *>(&scrollUpData[0]), 0, 0 };
static const byte scrollUpPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -76,7 +76,7 @@ static const byte scrollUpPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
};
-static const Buffer scrollUpPressedBuff = { scrollUpWidth, scrollUpHeight, (uint8 *)&scrollUpPressedData[0], 0, 0 };
+static const Buffer scrollUpPressedBuff = { scrollUpWidth, scrollUpHeight, const_cast<uint8 *>(&scrollUpPressedData[0]), 0, 0 };
#define scrollDownWidth 11
#define scrollDownHeight 12
@@ -94,7 +94,7 @@ static const byte scrollDownData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer scrollDownBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownData[0], 0, 0 };
+static const Buffer scrollDownBuff = { scrollDownWidth, scrollDownHeight, const_cast<uint8 *>(&scrollDownData[0]), 0, 0 };
static const byte scrollDownPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -110,7 +110,7 @@ static const byte scrollDownPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_WHITE, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
};
-static const Buffer scrollDownPressedBuff = { scrollDownWidth, scrollDownHeight, (uint8 *)&scrollDownPressedData[0], 0, 0 };
+static const Buffer scrollDownPressedBuff = { scrollDownWidth, scrollDownHeight, const_cast<uint8 *>(&scrollDownPressedData[0]), 0, 0 };
#define thumbWidth 11
#define thumbHeight 11
@@ -127,7 +127,7 @@ static const byte thumbData[] = {
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_WHITE, _LB_LTGREY, _LB_LTGREY,
_LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY, _LB_LTGREY
};
-static const Buffer thumbBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbData[0], 0, 0 };
+static const Buffer thumbBuff = { thumbWidth, thumbHeight, const_cast<uint8 *>(&thumbData[0]), 0, 0 };
static const byte thumbPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY,
@@ -142,7 +142,7 @@ static const byte thumbPressedData[] = {
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_BLACK, _LB_DKGREY, _LB_DKGREY,
_LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY, _LB_DKGREY
};
-static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, (uint8 *)&thumbPressedData[0], 0, 0 };
+static const Buffer thumbPressedBuff = { thumbWidth, thumbHeight, const_cast<uint8 *>(&thumbPressedData[0]), 0, 0 };
#define minThumbY (scrollUpHeight + _G(items).buttonHeight)
#define maxThumbY (scrollDownHeight + thumbHeight + (_G(items).buttonHeight<<1))
Commit: ceb2647cb6eeb2b479d7626b08ecb1741501a48f
https://github.com/scummvm/scummvm/commit/ceb2647cb6eeb2b479d7626b08ecb1741501a48f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining methods of room 105
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 0088c30094d..b907ffe5665 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -95,7 +95,7 @@ static const char *SAID1[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
-static const char *PARSER_LIST[] = {
+static const char *GLOBAL_PARSER_LIST[] = {
"DEED",
"LOOK AT",
"999w101",
@@ -594,7 +594,7 @@ void BurgerEngine::global_parser() {
} else if (player_said("GEAR")) {
_G(walker).wilbur_speech_random("999w017", "999w018", "999w019", "999w020");
- } else if (!_G(walker).wilbur_parser(PARSER_LIST)) {
+ } else if (!_G(walker).wilbur_parser(GLOBAL_PARSER_LIST)) {
if (player_said("LOOK AT")) {
_G(walker).wilbur_speech_random("999w013", "999w014", "999w015");
} else if (player_said("WALK") || player_said("WALK TO") ||
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 6f92cee36f9..1bf6e36ea7b 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -28,6 +28,9 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+// TODO: Double-check if the belows should be !strcmp
+#define COMPARE(X) strcmp(conv_sound_to_play(), X)
+
static const char *SAID[][4] = {
{ "TOWN RECORDS", nullptr, nullptr, nullptr },
{ "MAYOR'S OFFICE", "105W002", nullptr, nullptr },
@@ -1394,10 +1397,9 @@ void Room105::conv10() {
if (node == 1) {
digi_stop(2);
- // TODO: Double-check if the belows should be !strcmp
- if (strcmp(conv_sound_to_play(), "10n02011")) {
+ if (COMPARE("10n02011")) {
digi_unload("105gucr1");
- } else if (strcmp(conv_sound_to_play(), "10n02012")) {
+ } else if (COMPARE("10n02012")) {
digi_unload("105gucr2");
} else {
digi_unload("105gucr3");
@@ -1422,13 +1424,13 @@ void Room105::conv10() {
_flag2 = true;
if (node == 1) {
- if (strcmp(conv_sound_to_play(), "10n02011")) {
+ if (COMPARE("10n02011")) {
digi_preload("105gucr1");
digi_play("105gucr1", 2, 150);
- } else if (strcmp(conv_sound_to_play(), "10n02012")) {
+ } else if (COMPARE("10n02012")) {
digi_preload("105gucr2");
digi_play("105gucr2", 2, 150);
- } else if (strcmp(conv_sound_to_play(), "10n02013")) {
+ } else if (COMPARE("10n02013")) {
digi_preload("105gucr3");
digi_play("105gucr3", 2, 150);
}
@@ -1448,19 +1450,214 @@ void Room105::conv10() {
}
void Room105::conv11() {
- error("TODO: Room105::conv11");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 10) {
+ if (who <= 0) {
+ if (node == 1) {
+ digi_stop(2);
+
+ if (COMPARE("10n02011")) {
+ digi_unload("105e1cr1");
+ } else if (COMPARE("10n02012")) {
+ digi_unload("105e1cr2");
+ } else if (COMPARE("10n02013")) {
+ digi_unload("105e1cr3");
+ }
+
+ _val3 = 1;
+ _val4 = 5;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(30, 1);
+
+ } else if ((node == 8 && entry == 1) ||
+ (node == 1 && entry == 4 && inv_player_has("deed"))) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(1, 29);
+ _val3 = 5;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ _val3 = 6;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+ }
+ } else if (who == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+ conv_resume();
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if (node == 9 && entry == 2)
+ _flag3 = true;
+ if (node == 10)
+ _flag4 = true;
+
+ if (node != 7 &&
+ (node != 8 || entry != 0) && (node != 9 || node != 2) &&
+ (node != 11 || entry != 3) && (node != 12 || entry != 3)) {
+ if (node == 13 && entry == 0) {
+ _val3 = 9;
+ } else if (node == 13 && entry == 1) {
+ _val3 = 14;
+ } else if (node != 1) {
+ _val3 = 7;
+ } else {
+ if (COMPARE("10n02011")) {
+ digi_preload("105e1cr1");
+ digi_play("105e1cr1", 2, 150);
+ } else if (COMPARE("10n02012")) {
+ digi_preload("105e1cr2");
+ digi_play("105e1cr2", 2, 150);
+ } else if (COMPARE("10n02013")) {
+ digi_preload("105e1cr3");
+ digi_play("105e1cr3", 2, 150);
+ }
+
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ }
+ } else {
+ _val3 = 8;
+ }
+ } else if (who == 1) {
+ if (node == 13 && entry == 1) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(1, 32);
+ _G(kernel).trigger_mode = KT_PARSE;
+ } else if (node != 13 || entry != 0) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ }
+
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ }
+ } else {
+ conv_resume();
+ }
}
void Room105::conv12() {
- error("TODO: Room105::conv12");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 10) {
+ if (who <= 0) {
+ if (node == 1) {
+ digi_stop(2);
+
+ if (COMPARE("10n02011")) {
+ digi_unload("105ancr1");
+ } else if (COMPARE("10n02012")) {
+ digi_unload("105ancr2");
+ } else if (COMPARE("10n02013")) {
+ digi_unload("105ancr3");
+ }
+
+ _val3 = 40;
+ _val4 = 42;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+
+ } else if (node == 7 && entry == 6) {
+ _val3 = 49;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+
+ } else if (node == 15 && entry == 4) {
+ _val3 = 55;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+
+ } else if (node == 9) {
+ conv_resume();
+
+ } else {
+ _val3 = 43;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(1);
+ }
+ } else if (who == 1) {
+ if (node == 16 && entry == 1)
+ digi_unload("12p1702");
+
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+ conv_resume();
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if (node == 17)
+ _flag1 = true;
+ if (node == 7 && entry == 7)
+ _flag4 = true;
+
+ if (node == 1) {
+ if (COMPARE("10n02011")) {
+ digi_preload("105ancr1");
+ digi_play("105ancr1", 2, 150);
+ } else if (COMPARE("10n02012")) {
+ digi_preload("105ancr2");
+ digi_play("105ancr2", 2, 150);
+ } else if (COMPARE("10n02013")) {
+ digi_preload("105ancr3");
+ digi_play("105ancr3", 2, 150);
+ }
+
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+
+ } else if (node == 9) {
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+
+ } else {
+ _val3 = 44;
+ }
+ } else if (who == 1) {
+ if (node == 16 && entry == 1) {
+ digi_preload("12p1702");
+ _val3 = 56;
+ _val1 = 0;
+ }
+
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ }
+ } else {
+ conv_resume();
+ }
}
void Room105::conv13() {
- error("TODO: Room105::conv13");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+
+ if (_G(kernel).trigger == 10) {
+ if (who <= 0) {
+ _val3 = 59;
+ } else if (who == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ _val3 = (node == 2) ? 61 : 60;
+ _savedMode = KT_PARSE;
+ _savedTrigger = 10;
+ _digi1 = conv_sound_to_play();
+ } else if (who == 1) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
+ digi_play(conv_sound_to_play(), 1, 255, 10);
+ }
+ } else {
+ conv_resume();
+ }
}
void Room105::talkTo() {
- error("TODO: Room105::talkTo");
+ _val1 = 1;
+ conv_load_and_prepare("conv13", 5);
+ conv_play_curr();
}
void Room105::enteringMayorsOffice() {
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index da36581140d..99befdb15e9 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -359,7 +359,7 @@ bool Walker::wilbur_parser(const char **list) {
return true;
}
} else {
- for (; !*curr && scumm_stricmp(*curr, "Th-th-th-that's all folks..."); ++curr) {
+ for (; !*curr || scumm_stricmp(*curr, "Th-th-th-that's all folks..."); ++curr) {
}
}
}
Commit: bc1c52836b5b709ba78baf23c83e068a17885864
https://github.com/scummvm/scummvm/commit/bc1c52836b5b709ba78baf23c83e068a17885864
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added item console command
Changed paths:
engines/m4/console.cpp
engines/m4/console.h
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 576431d9b27..9201d4ea25b 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -29,6 +29,7 @@ Console::Console() : GUI::Debugger() {
registerCmd("test", WRAP_METHOD(Console, Cmd_test));
registerCmd("room", WRAP_METHOD(Console, Cmd_room));
registerCmd("flag", WRAP_METHOD(Console, Cmd_flag));
+ registerCmd("item", WRAP_METHOD(Console, Cmd_item));
}
Console::~Console() {
@@ -67,4 +68,14 @@ bool Console::Cmd_flag(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_item(int argc, const char **argv) {
+ if (argc == 2) {
+ inv_give_to_player(argv[1]);
+ return false;
+ } else {
+ debugPrintf("item <item name>\n");
+ return true;
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index 7a2fb015bad..7102d0f837c 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -32,6 +32,7 @@ private:
bool Cmd_test(int argc, const char **argv);
bool Cmd_room(int argc, const char **argv);
bool Cmd_flag(int argc, const char **argv);
+ bool Cmd_item(int argc, const char **argv);
public:
Console();
~Console() override;
Commit: 2cb8cbd20353cf10e0a0696361a74b578e9e2e59
https://github.com/scummvm/scummvm/commit/2cb8cbd20353cf10e0a0696361a74b578e9e2e59
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix leaving room 105
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 1bf6e36ea7b..b62dd719a58 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -1299,6 +1299,9 @@ void Room105::daemon() {
}
break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
}
}
@@ -1317,7 +1320,7 @@ void Room105::pre_parser() {
void Room105::parser() {
bool lookFlag = player_said("look") || player_said("look at");
- _G(kernel).trigger_mode = KT_PARSE;
+ _G(kernel).trigger_mode = KT_DAEMON;
if (player_said("conv12")) {
conv12();
Commit: b385e848de2bf526e590f9b5c330ab11a25ab154
https://github.com/scummvm/scummvm/commit/b385e848de2bf526e590f9b5c330ab11a25ab154
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove default initializers to fix GCC build
Changed paths:
engines/m4/burger/core/stream_break.h
diff --git a/engines/m4/burger/core/stream_break.h b/engines/m4/burger/core/stream_break.h
index df7257d10fb..40f8bee847f 100644
--- a/engines/m4/burger/core/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -30,14 +30,14 @@ namespace M4 {
namespace Burger {
struct seriesStreamBreak {
- int32 frame = 0;
- const char *sound = nullptr;
- int32 channel = 0;
- int32 volume = 0;
- int32 trigger = 0;
- uint32 flags = 0;
- const int32 *variable = nullptr;
- int32 value = 0;
+ int32 frame;
+ const char *sound;
+ int32 channel;
+ int32 volume;
+ int32 trigger;
+ uint32 flags;
+ const int32 *variable;
+ int32 value;
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
Commit: 18012c3acef916186271eae90a7d2ba0af7b2120
https://github.com/scummvm/scummvm/commit/18012c3acef916186271eae90a7d2ba0af7b2120
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Guard against empty file open creating InvPal
Changed paths:
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 30ce56448b3..445e5517dfb 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -100,6 +100,11 @@ void SysFile::open_read_low_level() {
Common::String local_name, resource_hag;
Common::File hagfile_fp;
+ if (filename.empty()) {
+ _fp = nullptr;
+ return;
+ }
+
if (!_G(hag).first_read_flag) {
// First time to read
if (_G(hag).hag_flag) {
Commit: 6da6406ed5b207649d19d005827cd9907536175e
https://github.com/scummvm/scummvm/commit/6da6406ed5b207649d19d005827cd9907536175e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Suppress warning for empty InvPal
Changed paths:
engines/m4/graphics/gr_color.cpp
engines/m4/vars.cpp
diff --git a/engines/m4/graphics/gr_color.cpp b/engines/m4/graphics/gr_color.cpp
index 404e311c183..2600355f336 100644
--- a/engines/m4/graphics/gr_color.cpp
+++ b/engines/m4/graphics/gr_color.cpp
@@ -27,7 +27,10 @@
namespace M4 {
InvPal::InvPal(const char *filename) {
- handle = NULL;
+ handle = nullptr;
+ if (!filename)
+ return;
+
SysFile ipl5(filename, BINARY);
if (!ipl5.exists())
@@ -55,7 +58,7 @@ InvPal::~InvPal() {
uint8 *InvPal::get_ptr() {
if (!handle)
- return NULL;
+ return nullptr;
HLock(handle);
return (uint8 *)*handle;
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 57ad40655bb..9465aaa5fbe 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -152,7 +152,7 @@ void Vars::game_systems_initialize(byte flags) {
inv_init(128); // Initialize with 128 objects
if (flags & INSTALL_INVERSE_PALETTE)
- _inverse_pal = new InvPal(""); // Ceate an empty color table.
+ _inverse_pal = new InvPal(nullptr); // Create an empty color table.
else
_inverse_pal = nullptr;
}
Commit: 8a2feea23bc3393f2a06b34708095fb734265518
https://github.com/scummvm/scummvm/commit/8a2feea23bc3393f2a06b34708095fb734265518
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix uninitialized read in db_rmlst_get_asset_room_path
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index cdf8f3a10cd..04eb31042e0 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -65,7 +65,7 @@ char *db_get_catalog() {
}
char *db_rmlst_get_asset_room_path(const char *asset_name, char *result, int32 *sceneCode) {
- char name[MAX_FILENAME_SIZE], path[MAX_FILENAME_SIZE];
+ char name[MAX_FILENAME_SIZE] = { 0 }, path[MAX_FILENAME_SIZE] = { 0 };
short tag = 0, room = 0;
short c_size = 0;
long str_len;
Commit: 9e7deb461831c9e95f89d336dd1944fd3c103175
https://github.com/scummvm/scummvm/commit/9e7deb461831c9e95f89d336dd1944fd3c103175
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 120
Changed paths:
engines/m4/burger/rooms/section1/room120.cpp
engines/m4/burger/rooms/section1/room120.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/section1/room120.cpp b/engines/m4/burger/rooms/section1/room120.cpp
index f0b0d161ea7..f058a1b420f 100644
--- a/engines/m4/burger/rooms/section1/room120.cpp
+++ b/engines/m4/burger/rooms/section1/room120.cpp
@@ -29,16 +29,20 @@ namespace Burger {
namespace Rooms {
void Room120::init() {
- _G(player).walker_in_this_scene = true;
+ _G(player).walker_in_this_scene = false;
+ player_set_commands_allowed(false);
+ kernel_timing_trigger(200, 1);
}
void Room120::daemon() {
-}
-
-void Room120::pre_parser() {
-}
-
-void Room120::parser() {
+ // After reimplementing for ScummVM the massive mess of multi-level switch
+ // statements that are the previous rooms' daemons, I seriously love
+ // the simplicity of this room's daemon. It's awesome!
+ if (_G(kernel).trigger == 1) {
+ _G(game).new_room = _G(game).previous_room;
+ } else {
+ _G(kernel).continue_handling_trigger = true;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room120.h b/engines/m4/burger/rooms/section1/room120.h
index 13c27564624..306fb6455c9 100644
--- a/engines/m4/burger/rooms/section1/room120.h
+++ b/engines/m4/burger/rooms/section1/room120.h
@@ -35,8 +35,6 @@ public:
void init() override;
void daemon() override;
- void pre_parser() override;
- void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index f84057fa6e2..c208eb6bbad 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -41,6 +41,10 @@
namespace M4 {
+void Room::parser() {
+ _G(kernel).trigger = KT_DAEMON;
+}
+
HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
warning("TODO: walker_spotter");
return nullptr;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index ea74a0982b3..e8e84190f3b 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -41,7 +41,7 @@ public:
virtual void init() {}
virtual void daemon() {}
virtual void pre_parser() {}
- virtual void parser() {}
+ virtual void parser();
virtual void parser_code() {}
virtual void roomError() {}
virtual void shutdown() {}
Commit: 29df2e5194cc79a70d9daa61ff36eb6ab167d4d8
https://github.com/scummvm/scummvm/commit/29df2e5194cc79a70d9daa61ff36eb6ab167d4d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 133/136 methods
Changed paths:
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room133_136.h
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 9e51f610b63..fd09c2de481 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -28,17 +28,130 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "SIGN", "136w001", "136W003", nullptr },
+ { "SIGN ", "136w002", "136W003", "136w005" },
+ { "CONSTRUCTION", nullptr, "136W008", "136W008" },
+ { "OLD BRIDGE", nullptr, "136W008", nullptr },
+ { "TOWN LIMITS", nullptr, "136W008", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
void Room133_136::init() {
_G(player).walker_in_this_scene = true;
+ _flag = true;
+ _volume = 255;
+ _walkCodes = nullptr;
+ _G(kernel).call_daemon_every_loop = true;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 134:
+ case 135:
+ _G(roomVal1) = 3;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ case 136:
+ ws_demand_location(444, 230, 2);
+ break;
+
+ case 137:
+ _G(roomVal1) = 4;
+ kernel_trigger_dispatch_now(gTELEPORT);
+ break;
+
+ default:
+ ws_demand_location(320, 271, 5);
+ break;
+ }
+
+ setupSign();
+ setupSignWalkAreas();
+ digi_preload("136_001");
+ digi_play_loop("136_001", 3, 180);
}
void Room133_136::daemon() {
}
void Room133_136::pre_parser() {
+ if (player_said("gear", "sign") && !_G(flags)[V043])
+ player_hotspot_walk_override(246, 247, 8);
+
+ if (player_said("old bridge") &&
+ player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(3);
+
+ if (player_said("town limits") &&
+ player_said_any("enter", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(9);
+
+ if (player_said("enter", "construction"))
+ player_hotspot_walk_override(292, 173, 1);
}
void Room133_136::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("gear", "sign") && !_G(flags)[V043]) {
+ kernel_trigger_dispatch_now(16);
+
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+
+ } else if (lookFlag && player_said("construction")) {
+ wilbur_speech(_G(flags)[V000] == 1002 ? "136w006" : "136w007");
+
+ } else if (player_said("enter", "old bridge") || player_said("gear", "old bridge") ||
+ (lookFlag && player_said("old bridge"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1008);
+
+ } else if (player_said("enter", "town limits") || player_said("gear", "town limits") ||
+ (lookFlag && player_said("town limits"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1010);
+
+ } else if (inv_player_has(_G(player).verb) &&
+ player_said_any("old bridge", "town limits", "construction")) {
+ wilbur_speech("136w008");
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room133_136::setupSign() {
+ if (_G(flags)[V043]) {
+ hotspot_set_active("sign", false);
+ hotspot_set_active("sign ", true);
+ _sign1 = series_play("136signr", 0x800, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _sign2 = series_play("136sinrs", 0x801, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ } else {
+ hotspot_set_active("sign ", false);
+ hotspot_set_active("sign", true);
+
+ _sign1 = series_play("136sign1", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _sign2 = series_play("136sin1s", 0xa01, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ }
+}
+
+void Room133_136::setupSignWalkAreas() {
+ if (_G(flags)[V043]) {
+ intr_add_no_walk_rect(294, 263, 332, 278, 297, 292);
+ intr_add_no_walk_rect(332, 278, 380, 300, 297, 292);
+
+ if (_walkCodes)
+ intr_remove_no_walk_rect(_walkCodes);
+ } else {
+ _walkCodes = intr_add_no_walk_rect(144, 241, 244, 252, 167, 272);
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room133_136.h b/engines/m4/burger/rooms/section1/room133_136.h
index ba1a32074f9..916f88fc1c5 100644
--- a/engines/m4/burger/rooms/section1/room133_136.h
+++ b/engines/m4/burger/rooms/section1/room133_136.h
@@ -29,6 +29,16 @@ namespace Burger {
namespace Rooms {
class Room133_136 : public Room {
+private:
+ bool _flag = false;
+ int _volume = 255;
+ noWalkRect *_walkCodes = nullptr;
+ machine *_sign1 = nullptr;
+ machine *_sign2 = nullptr;
+
+ void setupSign();
+ void setupSignWalkAreas();
+
public:
Room133_136() : Room() {}
~Room133_136() override {}
Commit: 95c8899485ab4cec688533a347e53c7695c86b1d
https://github.com/scummvm/scummvm/commit/95c8899485ab4cec688533a347e53c7695c86b1d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 133 daemon
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room133_136.h
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index b907ffe5665..2e62b1f7f3f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -321,7 +321,7 @@ void BurgerEngine::global_daemon() {
_G(walker).wilbur_say();
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 10001:
ws_unhide_walker(_G(my_walker));
@@ -339,7 +339,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10013;
- series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gTELEPORT, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10004:
@@ -347,7 +347,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10012;
- series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10005:
@@ -355,7 +355,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10009;
- series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10006:
@@ -363,7 +363,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10001;
- series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gTELEPORT, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10007:
@@ -371,7 +371,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10014;
- series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10008:
@@ -379,17 +379,17 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 10001;
- series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gTELEPORT, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
_G(roomVal1) = 10018;
- _G(walker).wilbur_speech("602w012x", gTELEPORT);
+ _G(walker).wilbur_speech("602w012x", gCHANGE_WILBUR_ANIMATION);
break;
case 10010:
_G(roomVal1) = 10011;
- _G(walker).wilbur_speech("602w012y", gTELEPORT);
+ _G(walker).wilbur_speech("602w012y", gCHANGE_WILBUR_ANIMATION);
break;
case 10011:
player_set_commands_allowed(true);
@@ -452,7 +452,7 @@ void BurgerEngine::global_daemon() {
case 10022:
if (_G(game).room_id < 200) {
_G(roomVal1) = 10017;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
}
@@ -461,7 +461,7 @@ void BurgerEngine::global_daemon() {
case 10023:
if (_G(game).room_id < 700) {
_G(roomVal1) = 10018;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
@@ -513,7 +513,7 @@ void BurgerEngine::global_parser() {
} else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(flags)[V123] = 1;
_G(roomVal1) = 10004;
- ws_turn_to_face(_G(my_walker), 3, gTELEPORT);
+ ws_turn_to_face(_G(my_walker), 3, gCHANGE_WILBUR_ANIMATION);
goto done;
}
}
@@ -522,21 +522,21 @@ void BurgerEngine::global_parser() {
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10003;
- ws_turn_to_face(_G(my_walker), 7, gTELEPORT);
+ ws_turn_to_face(_G(my_walker), 7, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10005;
- ws_turn_to_face(_G(my_walker), 9, gTELEPORT);
+ ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10006;
- ws_turn_to_face(_G(my_walker), 9, gTELEPORT);
+ ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
@@ -550,7 +550,7 @@ void BurgerEngine::global_parser() {
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(roomVal1) = 10008;
- ws_turn_to_face(_G(my_walker), 5, gTELEPORT);
+ ws_turn_to_face(_G(my_walker), 5, gCHANGE_WILBUR_ANIMATION);
goto done;
}
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 81689d3e36e..4cd04448cbc 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -153,7 +153,7 @@ void Flags::reset1() {
(*this)[V172] = 10023;
(*this)[V037] = 1;
(*this)[V039] = 0;
- (*this)[V043] = 0;
+ (*this)[kRoadOpened] = 0;
(*this)[V046] = 0;
(*this)[V047] = 0;
(*this)[V048] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index c8b6a096d65..b9b936a5f53 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -73,7 +73,7 @@ enum {
V040 = 40,
V041 = 41,
V042 = 42,
- V043 = 43,
+ kRoadOpened = 43,
V044 = 44,
V045 = 45,
V046 = 46,
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 71f2a8b4fd4..e0a858eabf8 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -339,13 +339,13 @@ void Interface::trackIcons() {
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
_G(roomVal1) = 10017;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
_G(roomVal1) = 10015;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index aad1aee1c20..5de512acbe0 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -96,7 +96,7 @@ static const seriesPlayBreak PLAY_BREAKS3[] = {
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
- { 10, -1, nullptr, 1, 255, gTELEPORT, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 1, 255, gCHANGE_WILBUR_ANIMATION, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
@@ -160,27 +160,27 @@ void Room101::init() {
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 6;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 104:
_G(roomVal1) = 2;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 106:
_G(roomVal1) = 3;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 135:
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 142:
_G(roomVal1) = 5;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -429,7 +429,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
_G(roomVal1) = 18;
- series_play("101ha01", 3840, 0, gTELEPORT, 6, 0, 100, 0, 0, 14, -1);
+ series_play("101ha01", 3840, 0, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
@@ -472,7 +472,7 @@ void Room101::daemon() {
Section1::updateWalker(226, 281, 8, 26);
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 2:
player_set_commands_allowed(true);
@@ -504,7 +504,7 @@ void Room101::daemon() {
case 6:
_G(roomVal1) = 7;
- series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gTELEPORT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 7:
@@ -516,7 +516,7 @@ void Room101::daemon() {
// Barbershop door open
_G(roomVal1) = 9;
terminateMachineAndNull(_doorMachine);
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 9:
@@ -526,7 +526,7 @@ void Room101::daemon() {
case 10:
_G(roomVal1) = 11;
- series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gTELEPORT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 11:
@@ -538,17 +538,17 @@ void Room101::daemon() {
case 14:
terminateMachineAndNull(_doorMachine);
_G(roomVal1) = 15;
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gTELEPORT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 15:
_G(roomVal1) = 16;
- digi_play("101h001", 1, 255, gTELEPORT);
+ digi_play("101h001", 1, 255, gCHANGE_WILBUR_ANIMATION);
break;
case 16:
_G(roomVal1) = 17;
- series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gTELEPORT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 17:
@@ -558,9 +558,9 @@ void Room101::daemon() {
if (_G(flags)[V005]) {
Common::String name = Common::String::format("101h003%c",
'a' + imath_ranged_rand(0, 5));
- digi_play(name.c_str(), 1, 255, gTELEPORT);
+ digi_play(name.c_str(), 1, 255, gCHANGE_WILBUR_ANIMATION);
} else {
- digi_play("101h002", 1, 255, gTELEPORT);
+ digi_play("101h002", 1, 255, gCHANGE_WILBUR_ANIMATION);
_G(flags)[V005] = 1;
}
@@ -579,7 +579,7 @@ void Room101::daemon() {
case 20:
_G(roomVal1) = 21;
- series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gTELEPORT, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 21:
@@ -599,7 +599,7 @@ void Room101::daemon() {
break;
case 10028:
- if (_G(flags)[V043]) {
+ if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(roomVal2) &&
@@ -647,26 +647,26 @@ void Room101::parser() {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 8;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V013]) {
ws_demand_location(_G(my_walker), 338, 265);
ws_demand_facing(_G(my_walker), 10);
ws_hide_walker(_G(my_walker));
player_set_commands_allowed(false);
_G(roomVal1) = 14;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(roomVal1) = 8;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
player_set_commands_allowed(false);
_G(roomVal1) = 20;
ws_hide_walker(_G(my_walker));
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "TOWN HALL") || player_said("gear", "town hall") ||
(lookFlag && player_said("town hall"))) {
@@ -787,7 +787,7 @@ void Room101::daemon15() {
_G(flags)[V001] = 0;
inv_move_object("MONEY", NOWHERE);
_G(flags)[V039] = 1;
- _G(flags)[V043] = 1;
+ _G(flags)[kRoadOpened] = 1;
inv_give_to_player("DEED");
_G(flags)[V112] = 1;
} else {
@@ -796,7 +796,7 @@ void Room101::daemon15() {
_G(flags)[V001] = 12;
_G(flags)[V039] = 0;
- _G(flags)[V043] = 0;
+ _G(flags)[kRoadOpened] = 0;
_G(flags)[V058] = 0;
}
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index ddb3e397cf4..fba13b55d3e 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -158,7 +158,7 @@ void Room102::init() {
_G(roomVal1) = 1;
_val16 = 1;
digi_preload("102_038");
- digi_play("102_038", 2, 255, gTELEPORT);
+ digi_play("102_038", 2, 255, gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
}
@@ -974,33 +974,33 @@ void Room102::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 1:
digi_unload("102_038");
ws_demand_location(628, 325);
ws_demand_facing(9);
_G(roomVal1) = 2;
- ws_walk(435, 329, 0, gTELEPORT, 9, 1);
+ ws_walk(435, 329, 0, gCHANGE_WILBUR_ANIMATION, 9, 1);
break;
case 2:
if (_G(flags)[V012] == 2) {
_G(roomVal1) = 3;
- _G(walker).wilbur_speech("102w003", gTELEPORT);
+ _G(walker).wilbur_speech("102w003", gCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V012] == 0) {
_G(roomVal1) = 5;
if (_G(flags)[V018]) {
- _G(walker).wilbur_speech("102w002", gTELEPORT);
+ _G(walker).wilbur_speech("102w002", gCHANGE_WILBUR_ANIMATION);
} else {
- queuePlay("102h001", gTELEPORT);
+ queuePlay("102h001", gCHANGE_WILBUR_ANIMATION);
}
}
break;
case 3:
- _G(walker).wilbur_speech("102w004", gTELEPORT);
+ _G(walker).wilbur_speech("102w004", gCHANGE_WILBUR_ANIMATION);
_G(roomVal1) = 4;
break;
@@ -1037,7 +1037,7 @@ void Room102::daemon() {
_G(roomVal1) = 72;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, gTELEPORT);
+ series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, gCHANGE_WILBUR_ANIMATION);
break;
case 72:
@@ -1051,7 +1051,7 @@ void Room102::daemon() {
_G(roomVal1) = 74;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, gTELEPORT);
+ series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, gCHANGE_WILBUR_ANIMATION);
break;
case 74:
@@ -1065,7 +1065,7 @@ void Room102::daemon() {
_G(roomVal1) = 76;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, gTELEPORT);
+ series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, gCHANGE_WILBUR_ANIMATION);
break;
case 76:
@@ -1079,7 +1079,7 @@ void Room102::daemon() {
_G(roomVal1) = 78;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, gTELEPORT);
+ series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, gCHANGE_WILBUR_ANIMATION);
break;
case 78:
@@ -1098,7 +1098,7 @@ void Room102::daemon() {
if (!_G(flags)[V020])
digi_preload("102w008");
- series_play_with_breaks(PLAY4, "102wi09", 256, gTELEPORT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi09", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 80:
@@ -1124,7 +1124,7 @@ void Room102::daemon() {
terminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
_G(roomVal1) = 83;
- series_play_with_breaks(PLAY4, "102wi08", 256, gTELEPORT, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi08", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 83:
@@ -1186,7 +1186,7 @@ void Room102::parser() {
if (player_said("USE", "GO", "DOORWAY")) {
_G(roomVal1) = 1;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
if (player_said("USE", "GO", "FIRE ESCAPE")) {
@@ -1200,7 +1200,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(roomVal1) = _G(flags)[V019] ? 82 : 79;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h005");
}
@@ -1210,7 +1210,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(roomVal1) = player_said("hair wax") ? 71 : 75;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
}
@@ -1224,7 +1224,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(roomVal1) = player_said("hair wax ") ? 73 : 77;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
}
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 8c920081571..2907017f305 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -552,7 +552,7 @@ void Room103::daemon() {
}
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 1:
digi_unload_stream_breaks(SERIES1);
@@ -566,7 +566,7 @@ void Room103::daemon() {
_G(roomVal1) = 3;
digi_preload_stream_breaks(SERIES3);
series_play("103wi04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
- series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, gTELEPORT);
+ series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
break;
case 3:
@@ -582,7 +582,7 @@ void Room103::daemon() {
terminateMachineAndNull(_series1);
ws_hide_walker();
series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
- series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, gTELEPORT);
+ series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
break;
case 5:
@@ -595,13 +595,13 @@ void Room103::daemon() {
case 6:
_G(roomVal1) = 7;
- kernel_timing_trigger(1, gTELEPORT);
+ kernel_timing_trigger(1, gCHANGE_WILBUR_ANIMATION);
break;
case 7:
_G(roomVal1) = 8;
ws_hide_walker();
- series_play_with_breaks(PLAY1, "103wi02", 0xa00, gTELEPORT, 2);
+ series_play_with_breaks(PLAY1, "103wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 2);
series_play("103wi02s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 27);
player_set_commands_allowed(false);
break;
@@ -639,20 +639,20 @@ void Room103::parser() {
if (!_G(walker).wilbur_said(SAID)) {
if (player_said("gear", "satellite dish") && _G(flags)[V023] == 0) {
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("gear", "door") || player_said("gear", "stairway")) {
_G(roomVal1) = 2;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "FIRE ESCAPE")) {
_val2 = 1;
_G(roomVal1) = 6;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
}
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 7ef758ac125..f9798eb4386 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -64,24 +64,24 @@ void Room104::init() {
case 101:
_G(roomVal1) = 1;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 105:
_G(roomVal1) = 2;
digi_preload("104_005");
digi_play("104_005", 2, 255, 2);
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 107:
_G(roomVal1) = 3;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 170:
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -422,7 +422,7 @@ void Room104::daemon() {
player_set_commands_allowed(true);
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 1:
ws_demand_location(315, 373);
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index b62dd719a58..8bd1e5d6b7a 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -285,7 +285,7 @@ void Room105::init() {
case 104:
ws_demand_location(310, 353, 11);
_G(roomVal1) = 62;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -1280,7 +1280,7 @@ void Room105::daemon() {
ws_unhide_walker();
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 62:
if (_G(flags)[V112] && !_G(flags)[V034]) {
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index fd09c2de481..1e2a14ec424 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -37,6 +37,33 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 12, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 13, 30, "136_002", 2, 255, -1, 0, 0, 0, 0 },
+ { 31, 57, "136_002", 2, 255, -1, 0, 0, 0, 0 },
+ { 58, -1, nullptr, 2, 255, -1, 2048, 0, 0, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesStreamBreak SERIES1[] = {
+ { 6, nullptr, 2, 255, 9, 0, 0, 0 },
+ { 10, "100_022", 2, 255, -1, 0, 0, 0 },
+ { -1, nullptr, 0, 0, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES3[] = {
+ { 0, "100_010", 1, 255, -1, 0, nullptr, 0 },
+ { 14, "100_011", 1, 255, -1, 0, nullptr, 0 },
+ { 20, nullptr, 1, 255, 14, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
void Room133_136::init() {
_G(player).walker_in_this_scene = true;
_flag = true;
@@ -51,7 +78,7 @@ void Room133_136::init() {
case 134:
case 135:
_G(roomVal1) = 3;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 136:
@@ -60,7 +87,7 @@ void Room133_136::init() {
case 137:
_G(roomVal1) = 4;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -75,10 +102,189 @@ void Room133_136::init() {
}
void Room133_136::daemon() {
+ int frame;
+
+ if (player_commands_allowed() && _G(roomVal2)) {
+ player_update_info();
+
+ if (_G(player_info).y < 188 && _flag) {
+ _flag = false;
+ kernel_timing_trigger(120, 1);
+ player_set_commands_allowed(false);
+ intr_freshen_sentence();
+ series_play("136cw01", 0xf00, 0, 2, 6, 0, 100, 0, 0, 0, 10);
+ }
+ }
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ Section1::walk();
+ break;
+
+ case 2:
+ _G(flags)[V298] = 1;
+ digi_play("136c001", 1, 255, 5, 136);
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 3:
+ if (_val1 == 1) {
+ frame = imath_ranged_rand(8, 10);
+ series_play("136cw01", 0xf00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
+ } else {
+ ws_walk(217, 268, 0, 4, 2);
+ series_play("136cw01", 0xf00, 2, -1, 6, 0, 100, 0, 0, 0, 10);
+ }
+ break;
+
+ case 4:
+ wilbur_speech("136w009");
+ _flag = true;
+ player_set_commands_allowed(true);
+ break;
+
+ case 5:
+ _G(flags)[V298] = 0;
+ _val1 = 2;
+ break;
+
+ case 6:
+ pal_fade_set_start(0);
+ terminateMachineAndNull(_sign1);
+ terminateMachineAndNull(_sign2);
+ ws_hide_walker();
+ gr_backup_palette();
+ digi_preload("100_022");
+ digi_preload_stream_breaks(SERIES1);
+ kernel_timing_trigger(30, 7);
+ break;
+
+ case 7:
+ series_stream_with_breaks(SERIES1, "120dt01", 9, 0, 1009);
+ kernel_timing_trigger(1, 8);
+ break;
+
+ case 8:
+ pal_fade_init(15, 255, 100, 0, -1);
+ break;
+
+ case 9:
+ digi_change_volume(2, 0);
+ break;
+
+ case 10:
+ player_set_commands_allowed(true);
+ break;
+
+ case 11:
+ terminateMachineAndNull(_sign1);
+ terminateMachineAndNull(_sign2);
+
+ if (_G(flags)[kRoadOpened]) {
+ Section1::updateWalker(413, 281, 9, 15, true);
+ } else {
+ Section1::updateWalker(238, 226, 4, 15);
+ }
+ break;
+
+ case 13:
+ if ((_G(player_info).x < 320 && _G(player_info).y > 250) ||
+ (_G(player_info).y > 227 && !_G(flags)[kRoadOpened])) {
+ kernel_trigger_dispatch_now(11);
+ } else if (!_G(flags)[kRoadOpened]) {
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "136dt01", 6, 0x400, 14);
+ } else {
+ kernel_trigger_dispatch_now(11);
+ }
+ break;
+
+ case 14:
+ if (!_G(flags)[kRoadOpened]) {
+ _volume -= 10;
+ if (_volume > 0) {
+ digi_change_volume(2, _volume);
+ kernel_timing_trigger(3, 14);
+ } else {
+ digi_stop(1);
+ digi_unload_stream_breaks(SERIES2);
+ digi_stop(2);
+ digi_unload("100_013");
+ player_set_commands_allowed(true);
+ _volume = 255;
+ }
+ }
+ break;
+
+ case 15:
+ setupSign();
+ _G(walker).reset_walker_sprites();
+ digi_preload_stream_breaks(SERIES2);
+
+ if (_G(flags)[kRoadOpened]) {
+ _G(flags)[V000] = 1002;
+ series_stream_with_breaks(SERIES3, "136dt02", 6, 0x200, 6);
+ } else {
+ series_stream_with_breaks(SERIES2, "136dt01", 6, 0x200, 14);
+ }
+ break;
+
+ case 16:
+ ws_demand_location(398, 297, 8);
+ ws_hide_walker();
+ terminateMachineAndNull(_sign1);
+ terminateMachineAndNull(_sign2);
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY1, "136wi01", 0x300, 17, 3);
+ break;
+
+ case 17:
+ _G(flags)[kRoadOpened] = 1;
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ setupSign();
+ setupSignWalkAreas();
+ wilbur_speech("136w0004");
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(roomVal1)) {
+ case 3:
+ player_set_commands_allowed(true);
+ player_first_walk(639, 264, 9, 588, 252, 9, true);
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+ player_first_walk(0, 355, 3, 96, 340, 3, true);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 10028:
+ if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ Section1::updateDisablePlayer();
+ digi_preload("100_013");
+ digi_play("100_013", 2);
+ kernel_timing_trigger(240, 13);
+ } else {
+ kernel_timing_trigger(60, 10028);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room133_136::pre_parser() {
- if (player_said("gear", "sign") && !_G(flags)[V043])
+ if (player_said("gear", "sign") && !_G(flags)[kRoadOpened])
player_hotspot_walk_override(246, 247, 8);
if (player_said("old bridge") &&
@@ -97,7 +303,7 @@ void Room133_136::parser() {
bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
- if (player_said("gear", "sign") && !_G(flags)[V043]) {
+ if (player_said("gear", "sign") && !_G(flags)[kRoadOpened]) {
kernel_trigger_dispatch_now(16);
} else if (_G(walker).wilbur_said(SAID)) {
@@ -127,7 +333,7 @@ void Room133_136::parser() {
}
void Room133_136::setupSign() {
- if (_G(flags)[V043]) {
+ if (_G(flags)[kRoadOpened]) {
hotspot_set_active("sign", false);
hotspot_set_active("sign ", true);
_sign1 = series_play("136signr", 0x800, 0, -1, 600, -1, 100, 0, 0, 0, 0);
@@ -137,13 +343,13 @@ void Room133_136::setupSign() {
hotspot_set_active("sign ", false);
hotspot_set_active("sign", true);
- _sign1 = series_play("136sign1", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
- _sign2 = series_play("136sin1s", 0xa01, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _sign1 = series_play("136signl", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _sign2 = series_play("136sinls", 0xa01, 0, -1, 600, -1, 100, 0, 0, 0, 0);
}
}
void Room133_136::setupSignWalkAreas() {
- if (_G(flags)[V043]) {
+ if (_G(flags)[kRoadOpened]) {
intr_add_no_walk_rect(294, 263, 332, 278, 297, 292);
intr_add_no_walk_rect(332, 278, 380, 300, 297, 292);
diff --git a/engines/m4/burger/rooms/section1/room133_136.h b/engines/m4/burger/rooms/section1/room133_136.h
index 916f88fc1c5..82be24f224f 100644
--- a/engines/m4/burger/rooms/section1/room133_136.h
+++ b/engines/m4/burger/rooms/section1/room133_136.h
@@ -35,6 +35,7 @@ private:
noWalkRect *_walkCodes = nullptr;
machine *_sign1 = nullptr;
machine *_sign2 = nullptr;
+ int _val1 = 0;
void setupSign();
void setupSignWalkAreas();
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 1fc171ba618..9c2adc80817 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -105,7 +105,7 @@ void Room135::init() {
_G(flags)[V039] = 1;
_G(roomVal1) = 37;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 133:
@@ -114,7 +114,7 @@ void Room135::init() {
_G(flags)[V039] = 1;
_G(roomVal1) = 38;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 135:
@@ -173,7 +173,7 @@ void Room135::daemon() {
break;
case 2:
- kernel_trigger_dispatch_now(_G(flags)[V043] ? 26 : 1);
+ kernel_trigger_dispatch_now(_G(flags)[kRoadOpened] ? 26 : 1);
break;
case 3:
@@ -745,7 +745,7 @@ void Room135::daemon() {
player_set_commands_allowed(true);
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 37:
player_set_commands_allowed(true);
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 5451bb0297c..a534bf5fc00 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -166,9 +166,9 @@ void Room142::init() {
&_G(flags)[V058], 0, &_val2, 13));
_MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 5,
&_G(flags)[V058], 0, &_val2, 13));
- _MATCH.push_back(WilburMatch("GEAR", "ICE BOX", gTELEPORT,
+ _MATCH.push_back(WilburMatch("GEAR", "ICE BOX", gCHANGE_WILBUR_ANIMATION,
&_G(flags)[V059], 0, &_G(roomVal1), 1));
- _MATCH.push_back(WilburMatch("TAKE", "FANBELT", gTELEPORT,
+ _MATCH.push_back(WilburMatch("TAKE", "FANBELT", gCHANGE_WILBUR_ANIMATION,
nullptr, 0, &_G(roomVal1), 9));
_MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
nullptr, 0, nullptr, 0));
@@ -182,7 +182,7 @@ void Room142::init() {
if (_G(flags)[V059]) {
ws_hide_walker();
_G(roomVal1) = 2;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
@@ -412,13 +412,13 @@ void Room142::daemon() {
break;
- case gTELEPORT:
+ case gCHANGE_WILBUR_ANIMATION:
switch (_G(roomVal1)) {
case 1:
terminateMachineAndNull(_series5);
disable_player();
_G(roomVal1) = 2;
- series_play_with_breaks(PLAY9, "142wi04", 0xdff, gTELEPORT, 3);
+ series_play_with_breaks(PLAY9, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -438,7 +438,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(roomVal1) = 4;
- series_play_with_breaks(PLAY11, "142wi04", 0xdff, gTELEPORT, 3);
+ series_play_with_breaks(PLAY11, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -456,7 +456,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(roomVal1) = 6;
- series_play_with_breaks(PLAY10, "142wi02", 0xdff, gTELEPORT, 3);
+ series_play_with_breaks(PLAY10, "142wi02", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
@@ -472,7 +472,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(roomVal1) = 8;
- series_play_with_breaks(PLAY10, "142wi04", 0xdff, gTELEPORT, 3);
+ series_play_with_breaks(PLAY10, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
@@ -486,7 +486,7 @@ void Room142::daemon() {
case 9:
disable_player();
_G(roomVal1) = 10;
- series_play_with_breaks(PLAY12, "142wi05", 0x400, gTELEPORT, 3);
+ series_play_with_breaks(PLAY12, "142wi05", 0x400, gCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
@@ -502,7 +502,7 @@ void Room142::daemon() {
break;
case 10028:
- if (!_G(flags)[V043]) {
+ if (!_G(flags)[kRoadOpened]) {
if (_series2) {
terminateMachineAndNull(_series2);
terminateMachineAndNull(_series3);
@@ -571,7 +571,7 @@ void Room142::daemon() {
case 10032:
if (_series2) {
terminateMachineAndNull(_series2);
- _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1004;
+ _G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1004;
}
if (!_G(flags)[V058]) {
@@ -605,7 +605,7 @@ void Room142::pre_parser() {
if (player_said("GEAR", "ICE BOX")) {
_G(roomVal1) = 5;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("ICE")) {
if (player_said("LOOK AT")) {
if (_G(flags)[V040] && !inv_player_has("BLOCK OF ICE")) {
@@ -619,7 +619,7 @@ void Room142::pre_parser() {
} else if (inv_player_has("BLOCK_OF_ICE")) {
wilbur_speech("142w009");
} else {
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR")) {
wilbur_speech("142w002");
@@ -628,7 +628,7 @@ void Room142::pre_parser() {
}
} else {
_G(roomVal1) = 7;
- kernel_trigger_dispatch_now(gTELEPORT);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
_G(player).command_ready = false;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index b9ce035a6cf..964d6e71b10 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -83,7 +83,7 @@ void Section1::updateDisablePlayer() {
g_vars->getInterface()->freshen_sentence();
walk(-1);
- _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1003;
+ _G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1003;
}
void Section1::walk(int facing, int trigger) {
@@ -237,18 +237,18 @@ void Section1::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
case 10028:
- _G(flags)[V000] = _G(flags)[V043] ? 1002 : 1003;
+ _G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1003;
break;
case 10029:
- if (!_G(flags)[V043])
+ if (!_G(flags)[kRoadOpened])
_G(flags)[V063] = 1;
break;
case 10030:
- if (_G(flags)[V043])
+ if (_G(flags)[kRoadOpened])
_G(flags)[V063] = 0;
break;
case 10031:
- if (_G(flags)[V043])
+ if (_G(flags)[kRoadOpened])
_G(flags)[V000] = 1004;
break;
case 10032:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 3a3dbce06d6..8256d7e36de 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -55,7 +55,7 @@ enum global_triggers {
gNONPLAYERS_SPEECH_FINISHED = 10011, // digi_play trigger, used in talk.cpp
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
- gTELEPORT = 10016,
+ gCHANGE_WILBUR_ANIMATION = 10016,
gSET_FACING = 10018,
gSET_DEST = 10019,
gSET_COMMANDS_ALLOWED = 10020,
Commit: 36330fe43a449f9407e68c44e461eb99e18b4673
https://github.com/scummvm/scummvm/commit/36330fe43a449f9407e68c44e461eb99e18b4673
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Explicitly initialize entire mem stash arrays
Changed paths:
engines/m4/vars.cpp
engines/m4/vars.h
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 9465aaa5fbe..c873ae7cf9c 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -43,6 +43,10 @@ Vars *g_vars;
Vars::Vars() : _digi(g_engine->_mixer) {
g_vars = this;
_cheating_enabled = gDebugLevel > 0;
+
+ Common::fill(_sizeMem, _sizeMem + _MEMTYPE_LIMIT, 0);
+ Common::fill(_requests, _requests + _MEMTYPE_LIMIT, 0);
+ Common::fill(_memBlock, _memBlock + _MEMTYPE_LIMIT, nullptr);
}
Vars::~Vars() {
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index cac68f51060..0c014d888b3 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -152,9 +152,9 @@ public:
int32 _memtypeSCRN = 0; // Memory slots used by the memory manager
int32 _memtypeMATTE = 0;
int32 _memtypeRECT = 0;
- int32 _sizeMem[_MEMTYPE_LIMIT] = { 0 };
- int32 _requests[_MEMTYPE_LIMIT] = { 0 };
- void *_memBlock[_MEMTYPE_LIMIT] = { nullptr };
+ int32 _sizeMem[_MEMTYPE_LIMIT];
+ int32 _requests[_MEMTYPE_LIMIT];
+ void *_memBlock[_MEMTYPE_LIMIT];
RGB8 _master_palette[256];
RGB8 _backup_palette[256];
bool _pal_fade_in_progress = false;
Commit: babaaa8acc3717eb647e6e05ab209ae3c51050cc
https://github.com/scummvm/scummvm/commit/babaaa8acc3717eb647e6e05ab209ae3c51050cc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 137 methods
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 2e62b1f7f3f..a2da933d67d 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -322,13 +322,13 @@ void BurgerEngine::global_daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 10001:
ws_unhide_walker(_G(my_walker));
player_set_commands_allowed(true);
_G(flags)[V299] = 0;
_G(flags)[V298] = 0;
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
break;
case 10002:
_G(flags)[V299] = 0;
@@ -338,7 +338,7 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10013;
+ _G(wilbur_should) = 10013;
series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
@@ -346,7 +346,7 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10012;
+ _G(wilbur_should) = 10012;
series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
@@ -354,7 +354,7 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10009;
+ _G(wilbur_should) = 10009;
series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
@@ -362,7 +362,7 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10001;
+ _G(wilbur_should) = 10001;
series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
@@ -370,7 +370,7 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10014;
+ _G(wilbur_should) = 10014;
series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
@@ -378,38 +378,38 @@ void BurgerEngine::global_daemon() {
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 10001;
+ _G(wilbur_should) = 10001;
series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
- _G(roomVal1) = 10018;
+ _G(wilbur_should) = 10018;
_G(walker).wilbur_speech("602w012x", gCHANGE_WILBUR_ANIMATION);
break;
case 10010:
- _G(roomVal1) = 10011;
+ _G(wilbur_should) = 10011;
_G(walker).wilbur_speech("602w012y", gCHANGE_WILBUR_ANIMATION);
break;
case 10011:
player_set_commands_allowed(true);
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
_G(walker).wilbur_speech("602w012z");
break;
case 10012:
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
_G(walker).wilbur_speech("300w055");
break;
case 10013:
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
break;
case 10014:
enable_player();
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
_G(walker).wilbur_speech("999w208");
break;
case 10017:
@@ -451,7 +451,7 @@ void BurgerEngine::global_daemon() {
case 10022:
if (_G(game).room_id < 200) {
- _G(roomVal1) = 10017;
+ _G(wilbur_should) = 10017;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
@@ -460,7 +460,7 @@ void BurgerEngine::global_daemon() {
case 10023:
if (_G(game).room_id < 700) {
- _G(roomVal1) = 10018;
+ _G(wilbur_should) = 10018;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
@@ -512,7 +512,7 @@ void BurgerEngine::global_parser() {
} else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
_G(flags)[V123] = 1;
- _G(roomVal1) = 10004;
+ _G(wilbur_should) = 10004;
ws_turn_to_face(_G(my_walker), 3, gCHANGE_WILBUR_ANIMATION);
goto done;
}
@@ -521,35 +521,35 @@ void BurgerEngine::global_parser() {
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
- _G(roomVal1) = 10003;
+ _G(wilbur_should) = 10003;
ws_turn_to_face(_G(my_walker), 7, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
- _G(roomVal1) = 10005;
+ _G(wilbur_should) = 10005;
ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
- _G(roomVal1) = 10006;
+ _G(wilbur_should) = 10006;
ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("broken puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
- _G(roomVal1) = 10007;
+ _G(wilbur_should) = 10007;
ws_turn_to_face(_G(my_walker), 5, 10016);
goto done;
}
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
- _G(roomVal1) = 10008;
+ _G(wilbur_should) = 10008;
ws_turn_to_face(_G(my_walker), 5, gCHANGE_WILBUR_ANIMATION);
goto done;
}
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index e0a858eabf8..03176ebc58a 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -338,13 +338,13 @@ void Interface::trackIcons() {
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
- _G(roomVal1) = 10017;
+ _G(wilbur_should) = 10017;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
- _G(roomVal1) = 10015;
+ _G(wilbur_should) = 10015;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 5de512acbe0..780f59f488b 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -141,12 +141,12 @@ void Room101::init() {
_G(flags)[ROOM101_FLAG1] = 0;
ws_demand_facing(_G(my_walker), 10);
ws_demand_location(_G(my_walker), 338, 265);
- _G(roomVal1) = 16;
+ _G(wilbur_should) = 16;
} else {
ws_demand_facing(_G(my_walker), 4);
ws_demand_location(_G(my_walker), 264, 259);
- _G(roomVal1) = 10;
+ _G(wilbur_should) = 10;
}
ws_hide_walker(_G(my_walker));
@@ -159,27 +159,27 @@ void Room101::init() {
ws_demand_location(_G(my_walker), 197, 276);
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 6;
+ _G(wilbur_should) = 6;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 104:
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 106:
- _G(roomVal1) = 3;
+ _G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 135:
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 142:
- _G(roomVal1) = 5;
+ _G(wilbur_should) = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -428,7 +428,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
- _G(roomVal1) = 18;
+ _G(wilbur_should) = 18;
series_play("101ha01", 3840, 0, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 14, -1);
break;
@@ -473,7 +473,7 @@ void Room101::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 2:
player_set_commands_allowed(true);
ws_demand_location(_G(my_walker), 336, 184);
@@ -503,7 +503,7 @@ void Room101::daemon() {
break;
case 6:
- _G(roomVal1) = 7;
+ _G(wilbur_should) = 7;
series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
@@ -514,7 +514,7 @@ void Room101::daemon() {
case 8:
// Barbershop door open
- _G(roomVal1) = 9;
+ _G(wilbur_should) = 9;
terminateMachineAndNull(_doorMachine);
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
@@ -525,7 +525,7 @@ void Room101::daemon() {
break;
case 10:
- _G(roomVal1) = 11;
+ _G(wilbur_should) = 11;
series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
@@ -537,22 +537,22 @@ void Room101::daemon() {
case 14:
terminateMachineAndNull(_doorMachine);
- _G(roomVal1) = 15;
+ _G(wilbur_should) = 15;
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 15:
- _G(roomVal1) = 16;
+ _G(wilbur_should) = 16;
digi_play("101h001", 1, 255, gCHANGE_WILBUR_ANIMATION);
break;
case 16:
- _G(roomVal1) = 17;
+ _G(wilbur_should) = 17;
series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 17:
- _G(roomVal1) = 19;
+ _G(wilbur_should) = 19;
_val2 = 12;
if (_G(flags)[V005]) {
@@ -578,12 +578,12 @@ void Room101::daemon() {
break;
case 20:
- _G(roomVal1) = 21;
+ _G(wilbur_should) = 21;
series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 21:
- _G(roomVal1) = 22;
+ _G(wilbur_should) = 22;
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1003);
break;
@@ -646,25 +646,25 @@ void Room101::parser() {
if (_G(flags)[V012] == 2) {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 8;
+ _G(wilbur_should) = 8;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V013]) {
ws_demand_location(_G(my_walker), 338, 265);
ws_demand_facing(_G(my_walker), 10);
ws_hide_walker(_G(my_walker));
player_set_commands_allowed(false);
- _G(roomVal1) = 14;
+ _G(wilbur_should) = 14;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
- _G(roomVal1) = 8;
+ _G(wilbur_should) = 8;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
player_set_commands_allowed(false);
- _G(roomVal1) = 20;
+ _G(wilbur_should) = 20;
ws_hide_walker(_G(my_walker));
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index fba13b55d3e..c2adc79ffac 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -155,7 +155,7 @@ void Room102::init() {
ws_hide_walker();
}
} else {
- _G(roomVal1) = 1;
+ _G(wilbur_should) = 1;
_val16 = 1;
digi_preload("102_038");
digi_play("102_038", 2, 255, gCHANGE_WILBUR_ANIMATION);
@@ -975,21 +975,21 @@ void Room102::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 1:
digi_unload("102_038");
ws_demand_location(628, 325);
ws_demand_facing(9);
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
ws_walk(435, 329, 0, gCHANGE_WILBUR_ANIMATION, 9, 1);
break;
case 2:
if (_G(flags)[V012] == 2) {
- _G(roomVal1) = 3;
+ _G(wilbur_should) = 3;
_G(walker).wilbur_speech("102w003", gCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V012] == 0) {
- _G(roomVal1) = 5;
+ _G(wilbur_should) = 5;
if (_G(flags)[V018]) {
_G(walker).wilbur_speech("102w002", gCHANGE_WILBUR_ANIMATION);
@@ -1001,7 +1001,7 @@ void Room102::daemon() {
case 3:
_G(walker).wilbur_speech("102w004", gCHANGE_WILBUR_ANIMATION);
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
break;
case 4:
@@ -1034,7 +1034,7 @@ void Room102::daemon() {
case 71:
ws_hide_walker();
- _G(roomVal1) = 72;
+ _G(wilbur_should) = 72;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, gCHANGE_WILBUR_ANIMATION);
@@ -1048,7 +1048,7 @@ void Room102::daemon() {
case 73:
ws_hide_walker();
- _G(roomVal1) = 74;
+ _G(wilbur_should) = 74;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, gCHANGE_WILBUR_ANIMATION);
@@ -1062,7 +1062,7 @@ void Room102::daemon() {
case 75:
ws_hide_walker();
- _G(roomVal1) = 76;
+ _G(wilbur_should) = 76;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, gCHANGE_WILBUR_ANIMATION);
@@ -1076,7 +1076,7 @@ void Room102::daemon() {
case 77:
ws_hide_walker();
- _G(roomVal1) = 78;
+ _G(wilbur_should) = 78;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, gCHANGE_WILBUR_ANIMATION);
@@ -1093,7 +1093,7 @@ void Room102::daemon() {
terminateMachineAndNull(_laz1);
terminateMachineAndNull(_laz2);
_G(flags)[V019] = 1;
- _G(roomVal1) = 80;
+ _G(wilbur_should) = 80;
if (!_G(flags)[V020])
digi_preload("102w008");
@@ -1123,7 +1123,7 @@ void Room102::daemon() {
terminateMachineAndNull(_laz1);
terminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
- _G(roomVal1) = 83;
+ _G(wilbur_should) = 83;
series_play_with_breaks(PLAY4, "102wi08", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
@@ -1185,7 +1185,7 @@ void Room102::parser() {
_G(walker).wilbur_speech("102W003");
if (player_said("USE", "GO", "DOORWAY")) {
- _G(roomVal1) = 1;
+ _G(wilbur_should) = 1;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
@@ -1199,7 +1199,7 @@ void Room102::parser() {
} else if (player_said("GEAR", "LAZY SUSAN")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
- _G(roomVal1) = _G(flags)[V019] ? 82 : 79;
+ _G(wilbur_should) = _G(flags)[V019] ? 82 : 79;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h005");
@@ -1209,7 +1209,7 @@ void Room102::parser() {
} else if (player_said("take", "hair wax") || player_said("take", "hair wax ")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
- _G(roomVal1) = player_said("hair wax") ? 71 : 75;
+ _G(wilbur_should) = player_said("hair wax") ? 71 : 75;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
@@ -1223,7 +1223,7 @@ void Room102::parser() {
} else if (player_said("take", "hair wax ") || player_said("take", "hair wax ")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
- _G(roomVal1) = player_said("hair wax ") ? 73 : 77;
+ _G(wilbur_should) = player_said("hair wax ") ? 73 : 77;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 2907017f305..3a00c49bfa0 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -127,7 +127,7 @@ void Room103::init() {
player_set_commands_allowed(false);
ws_hide_walker();
- _G(roomVal1) = 1;
+ _G(wilbur_should) = 1;
digi_preload_stream_breaks(SERIES1);
series_play("103wi01s", 0x100);
series_stream_with_breaks(SERIES1, "103wi01", 6, 0xa00, 10016);
@@ -476,7 +476,7 @@ void Room103::daemon() {
case 17:
_G(flags)[V023] = 0;
- _G(roomVal1) = 6;
+ _G(wilbur_should) = 6;
_G(flags)[V298] = 0;
ws_walk(325, 173, 0, 10016);
break;
@@ -553,17 +553,17 @@ void Room103::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 1:
digi_unload_stream_breaks(SERIES1);
player_set_commands_allowed(true);
ws_unhide_walker();
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
break;
case 2:
ws_hide_walker();
- _G(roomVal1) = 3;
+ _G(wilbur_should) = 3;
digi_preload_stream_breaks(SERIES3);
series_play("103wi04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
@@ -573,12 +573,12 @@ void Room103::daemon() {
digi_unload_stream_breaks(SERIES3);
player_set_commands_allowed(true);
ws_unhide_walker();
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
wilbur_speech("103w012");
break;
case 4:
- _G(roomVal1) = 5;
+ _G(wilbur_should) = 5;
terminateMachineAndNull(_series1);
ws_hide_walker();
series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
@@ -587,19 +587,19 @@ void Room103::daemon() {
case 5:
ws_unhide_walker();
- _G(roomVal1) = 10002;
+ _G(wilbur_should) = 10002;
_series1 = series_play("103wi06", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
digi_play(Common::String::format("103h001%c",
'a' + imath_ranged_rand(0, 4)).c_str(), 2, 255, 14);
break;
case 6:
- _G(roomVal1) = 7;
+ _G(wilbur_should) = 7;
kernel_timing_trigger(1, gCHANGE_WILBUR_ANIMATION);
break;
case 7:
- _G(roomVal1) = 8;
+ _G(wilbur_should) = 8;
ws_hide_walker();
series_play_with_breaks(PLAY1, "103wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 2);
series_play("103wi02s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 27);
@@ -638,20 +638,20 @@ void Room103::parser() {
if (!_G(walker).wilbur_said(SAID)) {
if (player_said("gear", "satellite dish") && _G(flags)[V023] == 0) {
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("gear", "door") || player_said("gear", "stairway")) {
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "FIRE ESCAPE")) {
_val2 = 1;
- _G(roomVal1) = 6;
+ _G(wilbur_should) = 6;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index f9798eb4386..957fa6ff066 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -63,24 +63,24 @@ void Room104::init() {
break;
case 101:
- _G(roomVal1) = 1;
+ _G(wilbur_should) = 1;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 105:
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
digi_preload("104_005");
digi_play("104_005", 2, 255, 2);
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 107:
- _G(roomVal1) = 3;
+ _G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 170:
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -423,7 +423,7 @@ void Room104::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 1:
ws_demand_location(315, 373);
ws_demand_facing(10);
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 8bd1e5d6b7a..e35d320f633 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -284,7 +284,7 @@ void Room105::init() {
case 104:
ws_demand_location(310, 353, 11);
- _G(roomVal1) = 62;
+ _G(wilbur_should) = 62;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -1281,7 +1281,7 @@ void Room105::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 62:
if (_G(flags)[V112] && !_G(flags)[V034]) {
player_set_commands_allowed(false);
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 1e2a14ec424..f72a37ed4f7 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -77,7 +77,7 @@ void Room133_136::init() {
case 134:
case 135:
- _G(roomVal1) = 3;
+ _G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -86,7 +86,7 @@ void Room133_136::init() {
break;
case 137:
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -248,7 +248,7 @@ void Room133_136::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 3:
player_set_commands_allowed(true);
player_first_walk(639, 264, 9, 588, 252, 9, true);
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 9c2adc80817..735ca69836b 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -104,7 +104,7 @@ void Room135::init() {
if (_G(flags)[V000] == 1002)
_G(flags)[V039] = 1;
- _G(roomVal1) = 37;
+ _G(wilbur_should) = 37;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -113,7 +113,7 @@ void Room135::init() {
if (_G(flags)[V000] == 1002)
_G(flags)[V039] = 1;
- _G(roomVal1) = 38;
+ _G(wilbur_should) = 38;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -746,7 +746,7 @@ void Room135::daemon() {
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 37:
player_set_commands_allowed(true);
player_first_walk(639, 373, 9, 579, 359, 9, true);
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index fc162103fb1..f7b21600986 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -28,19 +28,211 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "PATROL CAR", "137W002", "137W003", "137W004" },
+ { "TRUNK", nullptr, "137W008", "137W008" },
+ { "JAWZ O' LIFE", "137W010", nullptr, nullptr },
+ { "SIGN", "137W012", "137W008", "137W008" },
+ { "CAR WINDOW", nullptr, "137W008", "137W008" },
+ { "HIGHWAY 2", "137W013", "137W008", "137W008" },
+ { "FORK IN THE ROAD", nullptr, "137W008", "137W008" },
+ { "KEYS", "137W009", nullptr, nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesStreamBreak SERIES1[] = {
+ { 9, "100_010", 1, 255, -1, 0, 0, 0 },
+ { 20, nullptr, 1, 255, 12, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 24, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 25, 32, "137_005", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 33, 33, nullptr, 1, 255, 16, 0, 0, nullptr, 0 },
+ { 34, 40, nullptr, 1, 255, 22, 0, 0, nullptr, 0 },
+ { 41, -1, nullptr, 1, 255, 19, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 8, nullptr, 1, 255, 17, 0, 0, nullptr, 0 },
+ { 9, 13, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 14, 14, nullptr, 1, 255, 21, 0, 0, nullptr, 0 },
+ { 14, 14, "137_006", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 15, -1, nullptr, 1, 255, 18, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 11, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 12, 12, nullptr, 1, 255, 20, 0, 0, nullptr, 0 },
+ { 13, -1, "137_007", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
void Room137::init() {
_G(player).walker_in_this_scene = true;
+ player_set_commands_allowed(true);
+ _G(kernel).call_daemon_every_loop = true;
+ _volume = 255;
+ _flag1 = true;
+ _flag2 = false;
+ _flag3 = false;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ if (_G(flags)[V048])
+ _G(flags)[V048] = 1;
+ break;
+
+ case 136:
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ kernel_timing_trigger(1, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 138:
+ ws_demand_facing(2);
+
+ if (_G(flags)[V048] >= 200) {
+ ws_demand_location(264, 347);
+ _flag1 = false;
+ digi_preload("137_003");
+ } else {
+ ws_demand_location(290, 334);
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+
+ if (_G(flags)[V048] < 200 && _G(flags)[V048] && _G(flags)[V047] == 4)
+ _G(flags)[V047] = 5;
+ break;
+
+ default:
+ ws_demand_location(183, 216, 8);
+ break;
+ }
+
+ _series1 = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ const char *NAMES[18] = {
+ "137_120", "137_021", "137_022", "137_023", "137_024", "137_025",
+ "137_026", "137_027", "137_028", "137_013", "137_014", "137_026",
+ "137_027", "137_028", "137_013", "137_014", "137_015", "137_016"
+ };
+ for (int i = 0; i < 18; ++i)
+ digi_preload(NAMES[i]);
+
+ if (inv_object_in_scene("keys", 138) && _G(flags)[V047] != 2) {
+ digi_preload("137_001");
+ digi_play_loop("137_001", 3);
+ } else {
+ digi_preload("137_002");
+ digi_play_loop("137_002", 3);
+ }
+
+ if (_G(flags)[V048] < 200) {
+ _mode1 = 27;
+ } else {
+ _mode1 = _G(flags)[V047] == 2 || _G(flags)[V047] == 3 || _G(flags)[V047] == 4 ? 34 : 27;
+ digi_play("137_003", 1);
+ }
+
+ _mode2 = 27;
+ kernel_trigger_dispatch_now(2);
}
void Room137::daemon() {
+ // TODO
}
-void Room137::pre_parser() {
+void Room137::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(flags)[V046] && (player_said("gear", "trunk") || player_said("gear", "trunk "))) {
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("conv15")) {
+ conv15();
+
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Nothing needed
+ } else if (player_said("LOOK AT", "TRUNK") || player_said("LOOK AT", "TRUNK ")) {
+ if (!_G(flags)[V046]) {
+ wilbur_speech("137w005");
+ } else {
+ wilbur_speech(inv_object_is_here("JAWZ O' LIFE") ? "137w006" : "137w007");
+ }
+ } else if (player_said("keys", "trunk")) {
+ _G(wilbur_should) = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("take", "jawz o' life") && inv_object_is_here("jawz o' life")) {
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if ((player_said("take", "keys") || player_said("gear", "keys")) &&
+ !inv_player_has("keys")) {
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("gear", "jawz o' life") && inv_object_is_here("jawz o' life")) {
+ wilbur_speech("137w011");
+
+ } else if (player_said("ENTER", "FORK IN THE ROAD") ||
+ player_said("look at", "FORK IN THE ROAD")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1009);
+
+ } else if (player_said("LOOK AT", "CAR WINDOW")) {
+ _G(wilbur_should) = 35;
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
-void Room137::parser() {
+void Room137::conv15() {
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 14) {
+ if (who <= 0) {
+ if (node == 7) {
+ _mode3 = 25;
+ } else {
+ _mode3 = 22;
+ conv_resume_curr();
+ }
+ } else if (who == 1) {
+ conv_resume_curr();
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if (node == 3 || node == 9 || node == 12 || node == 13 || node == 19 || node == 11)
+ _flag3 = true;
+ _mode3 = (node == 20 && entry == 1) || (node == 21 && entry == 1) ? 24 : 23;
+ _digi1 = conv_sound_to_play();
+
+ } else if (who == 1) {
+ wilbur_speech(conv_sound_to_play(), 14);
+ }
+ } else {
+ conv_resume_curr();
+ }
}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index c7f596eac58..4718868882f 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -29,13 +29,25 @@ namespace Burger {
namespace Rooms {
class Room137 : public Room {
+private:
+ bool _flag1 = false;
+ bool _flag2 = false;
+ bool _flag3 = false;
+ int _volume = 255;
+ machine *_series1 = nullptr;
+ int _mode1 = 0;
+ int _mode2 = 0;
+ int _mode3 = 0;
+ const char *_digi1 = nullptr;
+
+ void conv15();
+
public:
Room137() : Room() {}
~Room137() override {}
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index a534bf5fc00..6ae3ca490f6 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -167,9 +167,9 @@ void Room142::init() {
_MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 5,
&_G(flags)[V058], 0, &_val2, 13));
_MATCH.push_back(WilburMatch("GEAR", "ICE BOX", gCHANGE_WILBUR_ANIMATION,
- &_G(flags)[V059], 0, &_G(roomVal1), 1));
+ &_G(flags)[V059], 0, &_G(wilbur_should), 1));
_MATCH.push_back(WilburMatch("TAKE", "FANBELT", gCHANGE_WILBUR_ANIMATION,
- nullptr, 0, &_G(roomVal1), 9));
+ nullptr, 0, &_G(wilbur_should), 9));
_MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
nullptr, 0, nullptr, 0));
@@ -181,7 +181,7 @@ void Room142::init() {
case RESTORING_GAME:
if (_G(flags)[V059]) {
ws_hide_walker();
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
break;
@@ -413,11 +413,11 @@ void Room142::daemon() {
case gCHANGE_WILBUR_ANIMATION:
- switch (_G(roomVal1)) {
+ switch (_G(wilbur_should)) {
case 1:
terminateMachineAndNull(_series5);
disable_player();
- _G(roomVal1) = 2;
+ _G(wilbur_should) = 2;
series_play_with_breaks(PLAY9, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -436,7 +436,7 @@ void Room142::daemon() {
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _G(roomVal1) = 4;
+ _G(wilbur_should) = 4;
series_play_with_breaks(PLAY11, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
}
@@ -454,7 +454,7 @@ void Room142::daemon() {
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _G(roomVal1) = 6;
+ _G(wilbur_should) = 6;
series_play_with_breaks(PLAY10, "142wi02", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -470,7 +470,7 @@ void Room142::daemon() {
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _G(roomVal1) = 8;
+ _G(wilbur_should) = 8;
series_play_with_breaks(PLAY10, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -485,7 +485,7 @@ void Room142::daemon() {
case 9:
disable_player();
- _G(roomVal1) = 10;
+ _G(wilbur_should) = 10;
series_play_with_breaks(PLAY12, "142wi05", 0x400, gCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -604,7 +604,7 @@ void Room142::pre_parser() {
_G(player).need_to_walk = false;
if (player_said("GEAR", "ICE BOX")) {
- _G(roomVal1) = 5;
+ _G(wilbur_should) = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("ICE")) {
if (player_said("LOOK AT")) {
@@ -627,7 +627,7 @@ void Room142::pre_parser() {
term_message("ERROR - don't know what to do with ice!!!");
}
} else {
- _G(roomVal1) = 7;
+ _G(wilbur_should) = 7;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8256d7e36de..837d0b2a85c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -100,7 +100,7 @@ public:
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
- int _roomVal1 = 0;
+ int _wilbur_should = 0;
int _roomVal2 = 0;
int _roomVal3 = 0;
int _walkTrigger = 0;
Commit: a5986df3c9cde8f8a64d009c36911ba5f3a2eca4
https://github.com/scummvm/scummvm/commit/a5986df3c9cde8f8a64d009c36911ba5f3a2eca4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further array initialization fixes
Changed paths:
engines/m4/adv_r/adv.h
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv.h b/engines/m4/adv_r/adv.h
index 72154489445..7e7b85fcca3 100644
--- a/engines/m4/adv_r/adv.h
+++ b/engines/m4/adv_r/adv.h
@@ -23,7 +23,7 @@
#ifndef M4_ADV_R_ADV_H
#define M4_ADV_R_ADV_H
-#include "common/textconsole.h"
+#include "common/algorithm.h"
#include "m4/adv_r/adv_hotspot.h"
#include "m4/m4_types.h"
@@ -90,8 +90,12 @@ struct SceneDef {
int32 front_y = 400, back_y = 100; // Player scaling baselines
int32 front_scale = 100, back_scale = 85; // Player scaling factors
- int16 depth_table[16] = { 0 }; // Player sprite depth table
+ int16 depth_table[16]; // Player sprite depth table
int32 numRailNodes = 0; // # of rails
+
+ SceneDef() {
+ Common::fill(depth_table, depth_table + 16, 0);
+ }
};
} // namespace M4
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index ab32ab2b660..cbfd62b0dd2 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -23,6 +23,7 @@
#ifndef M4_WSCRIPT_WS_MACHINE_H
#define M4_WSCRIPT_WS_MACHINE_H
+#include "common/algorithm.h"
#include "m4/m4_types.h"
#include "m4/gui/gui.h"
@@ -117,6 +118,11 @@ struct Anim8 {
int32 returnStackIndex = 0;
uint32 returnHashes[JSR_STACK_MAX] = { 0 };
int32 returnOffsets[JSR_STACK_MAX] = { 0 };
+
+ Anim8() {
+ Common::fill(returnHashes, returnHashes + JSR_STACK_MAX, 0);
+ Common::fill(returnOffsets, returnOffsets + JSR_STACK_MAX, 0);
+ }
};
struct machine {
Commit: 03ab6c229891fe0bcb60703bd37eb80a363b913f
https://github.com/scummvm/scummvm/commit/03ab6c229891fe0bcb60703bd37eb80a363b913f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: in progress room 137 daemon
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index f7b21600986..aaf335d298e 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -147,7 +147,79 @@ void Room137::init() {
}
void Room137::daemon() {
- // TODO
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ player_update_info();
+
+ if (_G(player_info).y < 235 && player_said("FORK IN THE ROAD")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1009);
+ }
+ }
+
+ if (!digi_play_state(2) && _flag1 && imath_ranged_rand(1, 3000) == 235) {
+ // Ocassional actions. *VERY* occasional actions
+ if (_flag2 && inv_object_in_scene("keys", 138)) {
+ digi_play("137_022", 2, 100);
+ _flag2 = false;
+ } else if (inv_object_in_scene("keys", 138)) {
+ digi_play(imath_ranged_rand(1, 7) == 1 ? "137_020" : "137_021", 2);
+
+ } else {
+ digi_play(Common::String::format("137_0%d", imath_ranged_rand(23, 28)).c_str(), 2, 150);
+ }
+ }
+
+ switch (_G(kernel).trigger) {
+ case 3:
+ ws_walk(276, 292, 0, -1, 4);
+ break;
+
+ case 5:
+ unloadAssets();
+
+ if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] == 4)
+ _mode1 = 30;
+
+ _mode4 = 5;
+ _mode3 = 10;
+
+ if (_G(player_info).y > 308) {
+ _mode3 = 14;
+ ws_walk(307, 349, 0, -1, 2);
+ }
+
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 12:
+ _volume -= 10;
+ if (_volume > 0) {
+ digi_change_volume(2, _volume);
+ kernel_timing_trigger(4, 12);
+ } else {
+ digi_stop(1);
+ digi_unload_stream_breaks(SERIES1);
+ digi_stop(2);
+ digi_unload("100_013");
+ player_set_commands_allowed(true);
+ _volume = 255;
+ }
+ break;
+
+ case 20:
+ terminateMachineAndNull(_series2);
+ inv_give_to_player("jawz o' life");
+ break;
+
+ case 21:
+ if (inv_object_is_here("jawz o' life"))
+ terminateMachineAndNull(_series2);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room137::parser() {
@@ -232,6 +304,16 @@ void Room137::conv15() {
}
}
+void Room137::unloadAssets() {
+ const char *NAMES[13] = {
+ "137_020", "137_021", "137_022", "137_023", "137_024",
+ "137_025", "137_026", "137_027", "138_028", "138_013",
+ "137_014", "137_015", "137_016"
+ };
+
+ for (int i = 0; i < 13; ++i)
+ digi_unload(NAMES[i]);
+}
} // namespace Rooms
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 4718868882f..06bcc9f465a 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -34,13 +34,16 @@ private:
bool _flag2 = false;
bool _flag3 = false;
int _volume = 255;
- machine *_series1 = nullptr;
int _mode1 = 0;
int _mode2 = 0;
int _mode3 = 0;
+ int _mode4 = 0;
const char *_digi1 = nullptr;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
void conv15();
+ void unloadAssets();
public:
Room137() : Room() {}
Commit: 9cae40deb0d5cdab3dbfe0e85006ecb270b8f544
https://github.com/scummvm/scummvm/commit/9cae40deb0d5cdab3dbfe0e85006ecb270b8f544
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 137 daemon
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/vars.h
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index aaf335d298e..f268c426b24 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -120,7 +120,7 @@ void Room137::init() {
_series1 = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
const char *NAMES[18] = {
- "137_120", "137_021", "137_022", "137_023", "137_024", "137_025",
+ "137_020", "137_021", "137_022", "137_023", "137_024", "137_025",
"137_026", "137_027", "137_028", "137_013", "137_014", "137_026",
"137_027", "137_028", "137_013", "137_014", "137_015", "137_016"
};
@@ -147,6 +147,8 @@ void Room137::init() {
}
void Room137::daemon() {
+ int frame;
+
if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
player_update_info();
@@ -170,10 +172,204 @@ void Room137::daemon() {
}
switch (_G(kernel).trigger) {
+ case 1:
+ switch (_mode4) {
+ case 5:
+ switch (_mode3) {
+ case 10:
+ _mode3 = 11;
+ series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ break;
+
+ case 11:
+ _mode3 = 12;
+ series_play("137sh07", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 12:
+ sub2();
+ _mode3 = 22;
+ _mode4 = 10;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 14:
+ _mode3 = 15;
+ series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ break;
+
+ case 15:
+ sub2();
+ _mode4 = 14;
+ _mode3 = 22;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 17:
+ _mode3 = 18;
+ series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ break;
+
+ case 18:
+ _mode3 = 19;
+ series_play("137sh07", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 19:
+ _mode3 = 20;
+ series_play("137sh09", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 20:
+ sub2();
+ _mode3 = 22;
+ _mode4 = 17;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 13:
+ if (_mode3 == 23) {
+ frame = imath_ranged_rand(0, 6);
+ series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 14);
+ _digi1 = nullptr;
+ }
+ } else {
+ _mode4 = 10;
+ series_play("137sh08", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 16:
+ if (_mode3 == 23) {
+ frame = imath_ranged_rand(0, 8);
+ series_play("137sh03", 0x800, 0, 1, 6, 0, 100, 0, 0);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 14);
+ _digi1 = nullptr;
+ }
+ } else {
+ _mode4 = 14;
+ series_play("137sh03", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 17:
+ switch (_mode3) {
+ case 22:
+ series_play("137sh09", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 23:
+ _mode4 = 21;
+ series_play("137sh10", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 21:
+ if (_mode3 == 23) {
+ frame = imath_ranged_rand(0, 5);
+ series_play("137sh10", 0x800, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 14);
+ _digi1 = nullptr;
+ }
+ } else {
+ _mode4 = 17;
+ series_play("137sh10", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_mode2) {
+ case 27:
+ switch (_mode1) {
+ case 27:
+ sub1();
+ kernel_timing_trigger(10, 2);
+ break;
+
+ case 29:
+ _mode1 = 30;
+ series_play("137dp02", 0x700, 0, 2, 8, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 30:
+ terminateMachineAndNull(_series1);
+ _mode2 = 31;
+ series_play("137dp03", 0x700, 0, 2, 8, 0, 100, 0, 0, 0, 14);
+ digi_play("137_003", 1, 255);
+ break;
+
+ case 34:
+ sub1();
+ _mode1 = 29;
+ series_play("137dp01", 0x700, 0, 2, 60, 0, 100, 0, 0, 6, 6);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 31:
+ if (imath_ranged_rand(1, 20) == 1) {
+ _mode2 = 32;
+ series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 0, 0);
+ } else {
+ series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 7, 7);
+ }
+ break;
+
+ case 32:
+ if (imath_ranged_rand(1, 20) == 1) {
+ _mode2 = 33;
+ series_play("137dp04", 0x700, 0, 2, imath_ranged_rand(60, 90),
+ 0, 100, 0, 0, 0, 5);
+ } else {
+ series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 33:
+ _mode2 = 31;
+ series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 6, 7);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case 3:
ws_walk(276, 292, 0, -1, 4);
break;
+ case 4:
+ digi_play("137_014", 2, 200, 5);
+ break;
+
case 5:
unloadAssets();
@@ -191,6 +387,65 @@ void Room137::daemon() {
kernel_trigger_dispatch_now(1);
break;
+ case 6:
+ digi_play("137_015", 2, 200, 7);
+ break;
+
+ case 7:
+ _mode4 = 5;
+ _mode3 = 14;
+ unloadAssets();
+
+ if (_G(player_info).y < 308)
+ _mode3 = 10;
+ if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] != 4)
+ _mode1 = 30;
+
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 8:
+ player_set_commands_allowed(true);
+ break;
+
+ case 9:
+ terminateMachineAndNull(_series1);
+
+ if (_G(flags)[V046]) {
+ terminateMachineAndNull(_series3);
+
+ if (inv_object_is_here("jawz o' life"))
+ terminateMachineAndNull(_series2);
+ }
+
+ Section1::updateWalker(227, 309, 11, 13);
+ break;
+
+ case 10:
+ switch (_mode3) {
+ case 22:
+ series_play("137sh08", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 23:
+ _mode4 = 13;
+ series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 11:
+ if (_G(player_info).y >= 300) {
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "137dt01", 6, 0xf00, -1);
+ } else {
+ kernel_trigger_dispatch_now(9);
+ }
+ break;
+
case 12:
_volume -= 10;
if (_volume > 0) {
@@ -206,6 +461,86 @@ void Room137::daemon() {
}
break;
+ case 13:
+ jawz();
+ _series1 = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _G(walker).reset_walker_sprites();
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "137dt01", 0, 0xf00, -1);
+ _G(flags)[V049] = 1;
+ break;
+
+ case 14:
+ switch (_mode3) {
+ case 22:
+ if (imath_ranged_rand(1, 30) == 2) {
+ series_play("137sh04", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 14);
+ } else {
+ series_play("137sh01", 0x800, 0, 1, 12, 0, 100, 0, 0, 17, 17);
+ }
+ break;
+
+ case 23:
+ _mode4 = 16;
+ series_play("137sh03", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 24:
+ _mode3 = 23;
+ series_play("137sh05", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 17);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 14);
+ }
+ break;
+
+ case 25:
+ _mode3 = 26;
+ series_play("137sh06", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 23);
+ break;
+
+ case 26:
+ conv_resume_curr();
+ _mode3 = 22;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 15:
+ if (_flag3) {
+ inv_move_object("keys", 138);
+ inv_move_object("jawz o' life", 137);
+ _G(flags)[V046] = 0;
+ pal_fade_init(1006);
+
+ } else {
+ pal_fade_init(1009);
+ }
+ break;
+
+ case 16:
+ terminateMachineAndNull(_series3);
+ inv_move_object("keys", NOWHERE);
+ break;
+
+ case 17:
+ terminateMachineAndNull(_series3);
+ break;
+
+ case 18:
+ _series3 = series_play("137tr02", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ inv_give_to_player("keys");
+ break;
+
+ case 19:
+ _series3 = series_play("137tr01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ break;
+
case 20:
terminateMachineAndNull(_series2);
inv_give_to_player("jawz o' life");
@@ -216,6 +551,113 @@ void Room137::daemon() {
terminateMachineAndNull(_series2);
break;
+ case 22:
+ if (inv_object_is_here("jawz o' life"))
+ _series2 = series_play("137jaws", 0x600, 0, -1, 7, -1, 100, 0, 0, 0, 0);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _G(wilbur_should) = 2;
+ series_play("137wi01", 0x100, 2, gCHANGE_WILBUR_ANIMATION,
+ 6, 0, 100, 0, 0, 0, 9);
+ series_play("137wi01s", 0x101, 2, -1, 6, 0, 100, 0, 0, 0, 9);
+ break;
+
+ case 2:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ break;
+
+ case 3:
+ ws_demand_location(183, 216, 8);
+ _G(wilbur_should) = 4;
+ ws_walk(171, 236, 0, gCHANGE_WILBUR_ANIMATION, 5);
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+
+ if (!_G(visited_room))
+ wilbur_speech("137w001");
+ break;
+
+ case 6:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ series_load("137jaws");
+ series_play_with_breaks(PLAY1, "137wi02", 0x100, gCHANGE_WILBUR_ANIMATION,
+ 3, 6, 100, 0, 0);
+ hotspot_set_active("keys", true);
+ hotspot_set_active("trunk ", true);
+
+ if (inv_object_is_here("jawz o' life"))
+ hotspot_set_active("jawz o' life", true);
+
+ _G(flags)[V046] = 1;
+ break;
+
+ case 7:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 9;
+ series_play_with_breaks(PLAY2, "137wi03", 0x100, gCHANGE_WILBUR_ANIMATION,
+ 3, 6, 100, 0, 0);
+ hotspot_set_active("keys", false);
+ hotspot_set_active("trunk ", false);
+ hotspot_set_active("jawz o' life", false);
+ _G(flags)[V046] = 0;
+ break;
+
+ case 8:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 9;
+ series_play_with_breaks(PLAY3, "137wi04", 0x100, gCHANGE_WILBUR_ANIMATION,
+ 3, 6, 100, 0, 0);
+ hotspot_set_active("jawz o' life", false);
+ break;
+
+ case 9:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ break;
+
+ case 35:
+ _G(wilbur_should) = 36;
+ ws_hide_walker();
+ series_play("137wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION,
+ 6, 0, 100, 0, 0, 0, 9);
+ series_play("137wi01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
+ break;
+
+ case 36:
+ series_play("137wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION,
+ 600, 0, 100, 0, 0, 9, 9);
+ series_play("137wi01s", 0x100, 0, -1, 600, 0, 100, 0, 0, 9, 9);
+ pal_fade_init(1011);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 10028:
+ if (player_commands_allowed() && _G(roomVal2) &&
+ INTERFACE_VISIBLE && !digi_play_state(1)) {
+ Section1::updateDisablePlayer();
+ digi_preload("100_013");
+ digi_play("100_013", 2);
+ kernel_timing_trigger(240, 11);
+
+ } else {
+ kernel_timing_trigger(60, 10028);
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -315,6 +757,94 @@ void Room137::unloadAssets() {
digi_unload(NAMES[i]);
}
+void Room137::jawz() {
+ if (_G(flags)[V046]) {
+ _series3 = series_play("137tr01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ if (inv_object_is_here("jawz o' life")) {
+ _series2 = series_play("137jaws", 0x600, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("jawz o' life", false);
+ }
+ } else {
+ _series3 = series_play("137tr02", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ hotspot_set_active("keys", false);
+ hotspot_set_active("trunk", false);
+ hotspot_set_active("jawz o' life", false);
+ }
+}
+
+void Room137::sub1() {
+ if (_G(flags)[V048] && player_commands_allowed()) {
+ ++_G(flags)[V048];
+ player_update_info();
+
+ if (_G(player_info).y < 300 && inv_player_has("keys")) {
+ _G(flags)[V047] = 6;
+ _G(flags)[V048] = 201;
+ }
+
+ if (_G(player_info).y < 308 && _G(flags)[V046])
+ _G(flags)[V048] = 201;
+
+ if (_G(flags)[V048] >= 200) {
+ player_set_commands_allowed(false);
+ intr_freshen_sentence();
+ _G(flags)[V048] = 0;
+ _flag1 = false;
+
+ if (_G(flags)[V042] == 6) {
+ kernel_timing_trigger(100, 3);
+ digi_play("137_013", 2, 200, 4);
+
+ } else if (_G(player_info).x > 460) {
+ ws_walk(307, 349, nullptr, -1, 2);
+
+ if (_G(flags)[V046]) {
+ digi_play("137_013", 2, 200, 6);
+ } else {
+ digi_play("137_013", 2, 200, 7);
+ }
+ } else if (_G(flags)[V047] == 1 || _G(flags)[V047] == 2 ||
+ _G(flags)[V047] == 3 || _G(flags)[V047] == 4) {
+ kernel_timing_trigger(30, 7);
+ } else {
+ digi_play("137_013", 2, 200, 7);
+ player_update_info();
+
+ if (_G(player_info).y < 308)
+ kernel_timing_trigger(180, 3);
+ }
+ }
+ }
+}
+
+void Room137::sub2() {
+ conv_load_and_prepare("conv15", 15);
+
+ switch (_G(flags)[V047]) {
+ case 1:
+ conv_export_value_curr(0, 0);
+ break;
+ case 2:
+ case 3:
+ conv_export_value_curr(1, 0);
+ break;
+ case 4:
+ conv_export_value_curr(4, 0);
+ break;
+ case 5:
+ conv_export_value_curr(2, 0);
+ break;
+ default:
+ break;
+ }
+
+ conv_export_value_curr(_G(flags)[V049], 2);
+ conv_export_value_curr(_G(flags)[kRoadOpened], 3);
+ conv_play_curr();
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 06bcc9f465a..1904344acaf 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -41,9 +41,13 @@ private:
const char *_digi1 = nullptr;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
void conv15();
void unloadAssets();
+ void jawz();
+ void sub1();
+ void sub2();
public:
Room137() : Room() {}
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index c208eb6bbad..5811c08bfd1 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -155,7 +155,7 @@ void Sections::m4SceneLoad() {
MoveScreenAbs(_G(game_buff_ptr), _G(player_info).camera_x, _G(player_info).camera_y);
}
- _visited_room = player_been_here(_G(game).room_id);
+ _G(visited_room) = player_been_here(_G(game).room_id);
term_message("calling room_init_code");
room_init();
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index e8e84190f3b..59a3196e685 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -92,7 +92,6 @@ private:
int32 _cameraShift_vert_Amount = 0;
bool shut_down_digi_tracks_between_rooms = true;
int32 camera_pan_step = 10;
- bool _visited_room = false;
void get_ipl();
void get_walker();
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 0c014d888b3..d94ba9fbbd0 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -186,6 +186,7 @@ public:
cursor_states _cursor_state = kARROW;
int _iPitch = 0;
int _hotspot_x = 0, _hotspot_y = 0;
+ bool _visited_room = false;
};
#define _G(X) (g_vars->_##X)
Commit: 4cf0158a3ab26763fb6090eaf568ed45d91473f7
https://github.com/scummvm/scummvm/commit/4cf0158a3ab26763fb6090eaf568ed45d91473f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Disable type size match check in mem_register_stash_type
On eriktorbjorn's system, the InvObj and RectList structs
had the exact same size, whereas on Windows they weren't.
This resulted in the stash slot running out of space with
being used for both types at the same time.
Removing the size check allows the correct behaviour to
occur, with both types being separate, on all systems.
Changed paths:
engines/m4/mem/mem.cpp
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 9901a6f43c5..3619ce0be3b 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -52,10 +52,7 @@ bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumReques
bool found = false;
while ((i < _MEMTYPE_LIMIT) && (_G(sizeMem)[i] > 0) && (!found)) {
- if (blockSize == _G(sizeMem)[i])
- break;
- else
- i++;
+ i++;
}
if (i == _MEMTYPE_LIMIT)
error_show(FL, 'MSIF', "stash: %s", name.c_str());
Commit: 999b44d9fe97ca1958148f49334ba9bd3f516fd7
https://github.com/scummvm/scummvm/commit/999b44d9fe97ca1958148f49334ba9bd3f516fd7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: walker_in_scene should be set in rooms' preload method
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
engines/m4/burger/rooms/section1/room120.cpp
engines/m4/burger/rooms/section1/room120.h
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room138.h
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room144.cpp
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room173.cpp
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room801.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 780f59f488b..eeed9e7f962 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -120,7 +120,6 @@ static const char *SAID1[][4] = {
};
void Room101::init() {
- _G(player).walker_in_this_scene = true;
_val1 = 255;
digi_stop(1);
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index c2adc79ffac..0b191169c65 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -92,7 +92,6 @@ static const seriesPlayBreak PLAY4[] = {
void Room102::init() {
- _G(player).walker_in_this_scene = true;
_val1 = 0;
_series3 = 0;
_val3 = -1;
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 3a00c49bfa0..75315a93202 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -112,7 +112,6 @@ static const seriesPlayBreak PLAY4[] = {
int32 Room103::_val0 = 0;
void Room103::init() {
- _G(player).walker_in_this_scene = true;
_flag1 = false;
_val2 = 0;
_val3 = 0;
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 957fa6ff066..d1e51a55e5d 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -51,7 +51,6 @@ static const seriesPlayBreak PLAY2[] = {
};
void Room104::init() {
- _G(player).walker_in_this_scene = true;
_val1 = 0;
_val2 = 14;
_val3 = 0;
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index e35d320f633..7956ec55d55 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -263,7 +263,6 @@ static const seriesPlayBreak PLAY32[] = {
void Room105::init() {
- _G(player).walker_in_this_scene = true;
_val1 = 1;
_series5 = 0;
digi_preload("105_001");
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index ac70ad3355e..9f815fa7267 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -115,9 +115,12 @@ const seriesPlayBreak Room106::PLAY7[] = {
int Room106::_val3;
-void Room106::init() {
+void Room106::preload() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
_G(game).room_id != 138;
+}
+
+void Room106::init() {
_val3 = 0;
_MATCH.clear();
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index bcff5f552e2..3f67e5ed1d0 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -51,6 +51,7 @@ public:
Room106() : Room() {}
~Room106() override {}
+ void preload() override;
void init() override;
void daemon() override;
void pre_parser() override;
diff --git a/engines/m4/burger/rooms/section1/room120.cpp b/engines/m4/burger/rooms/section1/room120.cpp
index f058a1b420f..08cf0c3582d 100644
--- a/engines/m4/burger/rooms/section1/room120.cpp
+++ b/engines/m4/burger/rooms/section1/room120.cpp
@@ -28,8 +28,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room120::init() {
+void Room120::preload() {
_G(player).walker_in_this_scene = false;
+}
+
+void Room120::init() {
player_set_commands_allowed(false);
kernel_timing_trigger(200, 1);
}
diff --git a/engines/m4/burger/rooms/section1/room120.h b/engines/m4/burger/rooms/section1/room120.h
index 306fb6455c9..3992ecb7724 100644
--- a/engines/m4/burger/rooms/section1/room120.h
+++ b/engines/m4/burger/rooms/section1/room120.h
@@ -33,6 +33,7 @@ public:
Room120() : Room() {}
~Room120() override {}
+ void preload() override;
void init() override;
void daemon() override;
};
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index f72a37ed4f7..1581a1dc76b 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -65,7 +65,6 @@ static const seriesStreamBreak SERIES3[] = {
};
void Room133_136::init() {
- _G(player).walker_in_this_scene = true;
_flag = true;
_volume = 255;
_walkCodes = nullptr;
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 735ca69836b..1268a8402be 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -84,7 +84,6 @@ static const seriesPlayBreak PLAY3[] = {
};
void Room135::init() {
- _G(player).walker_in_this_scene = true;
_volume = 255;
_val2 = 0;
_odieLoaded = false;
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index f268c426b24..385317190d5 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -73,7 +73,6 @@ static const seriesPlayBreak PLAY3[] = {
};
void Room137::init() {
- _G(player).walker_in_this_scene = true;
player_set_commands_allowed(true);
_G(kernel).call_daemon_every_loop = true;
_volume = 255;
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index e49bd46690d..77d4920947f 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -28,8 +28,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+void Room138::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room138::init() {
- _G(player).walker_in_this_scene = true;
}
void Room138::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room138.h b/engines/m4/burger/rooms/section1/room138.h
index db4a5a65096..ee88875c2e2 100644
--- a/engines/m4/burger/rooms/section1/room138.h
+++ b/engines/m4/burger/rooms/section1/room138.h
@@ -33,6 +33,7 @@ public:
Room138() : Room() {}
~Room138() override {}
+ void preload() override;
void init() override;
void daemon() override;
void pre_parser() override;
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 70739930497..f8e0f86bdac 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room141::init() {
- _G(player).walker_in_this_scene = true;
}
void Room141::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 6ae3ca490f6..572d32bdb63 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -173,7 +173,6 @@ void Room142::init() {
_MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
nullptr, 0, nullptr, 0));
- _G(player).walker_in_this_scene = true;
digi_preload("142_004");
digi_play_loop("142_004", 3, 255, -1);
diff --git a/engines/m4/burger/rooms/section1/room144.cpp b/engines/m4/burger/rooms/section1/room144.cpp
index ccc635beb76..ba071c66689 100644
--- a/engines/m4/burger/rooms/section1/room144.cpp
+++ b/engines/m4/burger/rooms/section1/room144.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room144::init() {
- _G(player).walker_in_this_scene = true;
}
void Room144::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index eaabd22c36b..d1e0cc1b716 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room170::init() {
- _G(player).walker_in_this_scene = true;
}
void Room170::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index e3f66e542cd..a8e1fb32d84 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room171::init() {
- _G(player).walker_in_this_scene = true;
}
void Room171::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index 762f5b2770d..b7703c9d2a1 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room172::init() {
- _G(player).walker_in_this_scene = true;
}
void Room172::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
index 4b5ca8f51aa..168aae781b0 100644
--- a/engines/m4/burger/rooms/section1/room173.cpp
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room173::init() {
- _G(player).walker_in_this_scene = true;
}
void Room173::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 128335958eb..77262f906d7 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room174::init() {
- _G(player).walker_in_this_scene = true;
}
void Room174::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index bcced9a380d..59ac93245aa 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room175::init() {
- _G(player).walker_in_this_scene = true;
}
void Room175::daemon() {
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index 44530c58197..c8d9edaa3a4 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -29,7 +29,6 @@ namespace Burger {
namespace Rooms {
void Room176::init() {
- _G(player).walker_in_this_scene = true;
}
void Room176::daemon() {
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 89a4584a3fc..5b4b74e982a 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -121,10 +121,12 @@ static const seriesStreamBreak STREAMS9[] = {
STREAM_BREAK_END
};
+void Room801::preload() {
+ _G(player).walker_in_this_scene = false;
+}
void Room801::init() {
const char *HEADER = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++";
- _G(player).walker_in_this_scene = false;
interface_hide();
player_set_commands_allowed(false);
pal_fade_set_start(_G(master_palette), 0);
diff --git a/engines/m4/burger/rooms/section8/room801.h b/engines/m4/burger/rooms/section8/room801.h
index 747bf7a8593..0cd64255786 100644
--- a/engines/m4/burger/rooms/section8/room801.h
+++ b/engines/m4/burger/rooms/section8/room801.h
@@ -36,6 +36,7 @@ public:
Room801() : Room() {}
~Room801() override {}
+ void preload() override;
void init() override;
void daemon() override;
void parser() override;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 5811c08bfd1..19417b35b02 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -41,6 +41,10 @@
namespace M4 {
+void Room::preload() {
+ _G(player).walker_in_this_scene = true;
+}
+
void Room::parser() {
_G(kernel).trigger = KT_DAEMON;
}
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 59a3196e685..6a41b3b6f36 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -37,7 +37,7 @@ public:
Room() {}
virtual ~Room() {}
- virtual void preload() {}
+ virtual void preload();
virtual void init() {}
virtual void daemon() {}
virtual void pre_parser() {}
Commit: cbc7a8a6b022a9eedeeaf5e6b61f741142eecb01
https://github.com/scummvm/scummvm/commit/cbc7a8a6b022a9eedeeaf5e6b61f741142eecb01
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 138 methods
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room138.h
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 77d4920947f..dd7c3515826 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -28,20 +28,181 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "DONUTS", "138W002", "138W003", "138W003" },
+ { "IGNITION SWITCH", "138W006", "138W007", "138W006" },
+ { "HORN", "138W008", "138W007", nullptr },
+ { "RADIO", "138W009", "138W007", nullptr },
+ { "POLICE RADIO", "138W010", "138W007", "138W004" },
+ { "RADAR", "138W011", "138W007", "138W004" },
+ { "SHERIFF", "138W012", "138W013", "138W004" },
+ { "DEPUTY", "138W014", "138W013", "138W004" },
+ { "PATROL CAR", "138W015", "138W013", "138W016" },
+ { "EXIT", nullptr, "138W017", "138W017" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 3, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 4, 4, 0, 1, 255, 8, 0, 0, 0, 0 },
+ { 5, -1, 0, 1, 255, 10, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 11, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 12, 12, "138_003", 1, 255, -1, 0, 0, 0, 0 },
+ { 12, 12, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 12, 12, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 12, 12, nullptr, 1, 255, 5, 0, 0, 0, 0 },
+ { 12, 12, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 11, 0, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 6, 8, nullptr, 1, 255, 12, 0, 0, 0, 0 },
+ { 7, 6, "138_006", 1, 255, -1, 0, 0, 0, 0 },
+ { 7, 8, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 8, 6, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 6, 7, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 6, 7, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 7, 6, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 6, 8, nullptr, 1, 255, -1, 0, 0, 0, 0 },
+ { 8, 6, nullptr, 1, 255, -1, 2048, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 25, 5, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 4, 0, 0, 1, 255, 11, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
void Room138::preload() {
_G(player).walker_in_this_scene = false;
}
void Room138::init() {
-}
+ static const char *NAMES[12] = {
+ "138_004", "137_012", "137_013", "137_020", "137_021",
+ "137_022", "137_023", "137_024", "137_025", "137_026",
+ "137_027", "137_028"
+ };
+ for (int i = 0; i < 12; ++i)
+ digi_preload(NAMES[i]);
-void Room138::daemon() {
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ if (_G(flags)[V048])
+ _G(flags)[V048] = 1;
+ break;
+
+ default:
+ break;
+ }
+
+ if (inv_object_is_here("keys")) {
+ digi_preload("138_001");
+ digi_play_loop("138_001", 3, 255);
+
+ } else {
+ digi_preload("138_002");
+ digi_play_loop("138_002", 3, 255);
+ }
+
+ if (inv_object_is_here("keys")) {
+ hotspot_set_active("ignition switch", false);
+ _series1 = series_play("138keys", 0xa00, 0, -1, 7, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("keys", false);
+ }
+
+ _val1 = 22;
+ _val2 = 18;
+ _val3 = 18;
+ kernel_trigger_dispatch_now(1);
+ _val4 = -1;
+ _val5 = 26;
+ _val6 = 26;
+ kernel_trigger_dispatch_now(2);
+ _val7 = 2;
+ _val8 = 1;
+ kernel_trigger_dispatch_now(3);
+ _series2 = series_play("138donut", 0x400, 0, -1, 7, -1, 100, 0, 0, 0, 0);
+
+ if (!inv_object_is_here("keys"))
+ kernel_timing_trigger(10, 13);
+
+ if (!player_been_here(138)) {
+ player_set_commands_allowed(false);
+ wilbur_speech("138w001");
+ }
+
+ digi_play("137_021", 2);
}
-void Room138::pre_parser() {
+void Room138::daemon() {
}
void Room138::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Nothing needed
+ } else if (player_said("keys", "ignition switch")) {
+ _val8 = 16;
+ player_set_commands_allowed(false);
+
+ } else if ((player_said("donuts") || player_said("keys") ||
+ player_said("ignition switch") || player_said("horn") ||
+ player_said("radio") || player_said("police radio") ||
+ player_said("radar") || player_said("deputy") ||
+ player_said("patrol car")) && inv_player_has(_G(player).verb)) {
+ wilbur_speech("138w004");
+
+ } else if (player_said("gear", "horn")) {
+ player_set_commands_allowed(false);
+ _G(flags)[V047] = 1;
+ _val8 = 10;
+
+ } else if (player_said("gear", "radio")) {
+ player_set_commands_allowed(false);
+
+ if (inv_object_is_here("keys"))
+ _G(flags)[V047] = 2;
+
+ _val8 = 11;
+
+ } else if (player_said("talk to") &&
+ (player_said("sherrif") || player_said("deputy"))) {
+ player_set_commands_allowed(false);
+ _G(flags)[V047] = 3;
+ wilbur_speech("138w610");
+ _val8 = 15;
+
+ } else if (player_said("take", "keys") && inv_player_has("keys")) {
+ _val8 = 7;
+ player_set_commands_allowed(false);
+
+ } else if (player_said("look at", "keys") && inv_object_is_here("keys")) {
+ wilbur_speech("138w005");
+
+ } else if (player_said("gear", "keys")) {
+ wilbur_speech("138w004");
+
+ } else if (player_said("keys") && inv_player_has(_G(player).verb)) {
+ wilbur_speech("138w004");
+
+ } else if (player_said("exit") || player_said("look at", "exit")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1010);
+
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room138.h b/engines/m4/burger/rooms/section1/room138.h
index ee88875c2e2..399cadc821d 100644
--- a/engines/m4/burger/rooms/section1/room138.h
+++ b/engines/m4/burger/rooms/section1/room138.h
@@ -29,6 +29,18 @@ namespace Burger {
namespace Rooms {
class Room138 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+
public:
Room138() : Room() {}
~Room138() override {}
@@ -36,7 +48,6 @@ public:
void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: 0c8d89e7832e6c513f3cac3b259ea8a30ba53929
https://github.com/scummvm/scummvm/commit/0c8d89e7832e6c513f3cac3b259ea8a30ba53929
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 138 daemon
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room138.h
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index dd7c3515826..7d50dd23eca 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -118,7 +118,7 @@ void Room138::init() {
hotspot_set_active("keys", false);
}
- _val1 = 22;
+ _frame = 22;
_val2 = 18;
_val3 = 18;
kernel_trigger_dispatch_now(1);
@@ -143,6 +143,475 @@ void Room138::init() {
}
void Room138::daemon() {
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val2) {
+ case 18:
+ switch (_val3) {
+ case 18:
+ case 23:
+ case 25:
+ if (_val3 == 23 && _frame == 42) {
+ freeAssets();
+ _val2 = 23;
+ series_play("138cp06", 0x500, 0, 1, 7, 0, 100, 0, 0, 30, 45);
+
+ } else if (_val3 == 25 && _frame == 42) {
+ _val3 = 18;
+ series_play("138cp02", 0x500, 0, 1, 7, 0, 100, 0, 0, 31, 61);
+
+ } else if (_frame == 42 && imath_ranged_rand(1, 5) != 1) {
+ series_play("138cp01", 0x500, 0, 1, 60, 0, 100, 0, 0, 23, 23);
+
+ } else {
+ if (++_frame == 43)
+ _frame = 23;
+
+ series_play("138cp01", 0x500, 0, 1, 7, 0, 100, 0, 0, _frame, _frame);
+ }
+ break;
+
+ case 22:
+ freeAssets();
+ _val2 = 22;
+ series_play("138cp04", 0x500, 0, 1, 7, 0, 100, 0, 0, 10, 16);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 22:
+ if (imath_ranged_rand(1, 10) == 1) {
+ series_play("138cp04", 0x500, 1, 1, 7, 0, 100, 0, 0, 16, 18);
+ } else {
+ series_play("138cp04", 0x500, 0, 1, 10, 0, 100, 0, 0, 16, 16);
+ }
+ break;
+
+ case 23:
+ _val2 = 24;
+ series_play("138cp06", 0500, 0, 1, 6, 0, 100, 0, 0, 46, 49);
+ digi_play("138_004", 1, 255);
+ break;
+
+ case 24:
+ series_play("138cp06", 0x500, 0, -1, 60, -1, 100, 0, 0, 49, 49);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_val5) {
+ case 26:
+ switch (_val6) {
+ case 26:
+ case 33:
+ case 36:
+ if (_val6 == 33 && _val4 == 22) {
+ freeAssets();
+ term_message("xxx");
+ _val6 = 34;
+ series_play("138cp06", 0x100, 0, 2, 8, 0, 100, 0, 0, 0, 18);
+ digi_play("138_005", 2);
+
+ } else if (_val6 == 36 && _val4 == 22) {
+ _val6 = 26;
+ series_play("138cp02", 0x100, 0, 2, 8, 0, 100, 0, 0, 0, 30);
+ randomDigi();
+
+ } else if (_val4 == 22 && !inv_object_is_here("keys") &&
+ imath_ranged_rand(1, 2) == 1) {
+ term_message(".........................");
+ _val6 = 37;
+ series_play("138cp02", 0x100, 2, 2, 8, 0, 100, 0, 0, 25, 30);
+
+ } else if (_val4 == 22 && imath_ranged_rand(1, 6) != 1) {
+ series_play("138cp01", 0x100, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+
+ } else {
+ _flag1 = false;
+
+ switch (++_val4) {
+ case 13:
+ digi_play("137_022", 2);
+ break;
+
+ case 23:
+ _val4 = 0;
+ digi_play(imath_ranged_rand(1, 2) == 1 ? "137_020" : "137_021", 2);
+ break;
+
+ default:
+ break;
+ }
+
+ series_play("138cp01", 0x100, 0, 2, 7, 0, 100, 0, 0, _val4, _val4);
+ }
+ break;
+
+ case 31:
+ freeAssets();
+ _val6 = 32;
+ series_play("138cp04", 0x100, 0, 2, 7, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 32:
+ kernel_timing_trigger(120, 7);
+
+ if (!inv_object_is_here("keys"))
+ _G(flags)[V047] = 6;
+
+ _G(flags)[V048] = 200;
+ _val5 = 31;
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 34:
+ terminateMachineAndNull(_series2);
+ _val6 = 35;
+ series_play("138cp06", 0x100, 0, 2, 8, 0, 100, 0, 0, 19, 29);
+ break;
+
+ case 35:
+ kernel_timing_trigger(120, 7);
+
+ if (inv_object_is_here("keys"))
+ _G(flags)[V047] = 6;
+
+ _G(flags)[V048] = 200;
+ _val5 = 33;
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 37:
+ _val6 = 38;
+ series_play("138cp02", 0x100, 2, 2, 8, 0, 100, 0, 0, 10, 24);
+ randomDigi();
+ break;
+
+ case 38:
+ _val6 = 26;
+ series_play("138cp02", 0x100, 0, 2, 8, 0, 100, 0, 0, 26, 30);
+ _flag1 = true;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 31:
+ if (imath_ranged_rand(1, 10) == 1) {
+ series_play("138cp04", 0x100, 1, 2, 7, 0, 100, 0, 0, 7, 9);
+ } else {
+ series_play("138cp04", 0x100, 0, 2, 10, 0, 100, 0, 0, 7, 7);
+ }
+ break;
+
+ case 33:
+ if (imath_ranged_rand(1, 10) == 1) {
+ series_play("138cp06", 0x100, 1, 2, 7, 0, 100, 0, 0, 27, 29);
+ } else {
+ series_play("138cp06", 0x100, 0, 2, 10, 0, 100, 0, 0, 27, 27);
+ }
+ break;
+
+ }
+ break;
+
+ case 3:
+ switch (_val7) {
+ case 2:
+ switch (_val8) {
+ case 1:
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val7 = 3;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 2:
+ _val7 = 6;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 17, 17);
+ break;
+
+ default:
+ series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 7:
+ series_load("138wi03");
+ digi_preload("138_002");
+ _val8 = 8;
+ series_play("138wi05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 8:
+ _val8 = 9;
+ series_play_with_breaks(PLAY1, "138wi03", 0xa00, 3, 2, 6, 100, 0, 0);
+ break;
+
+ case 9:
+ player_set_commands_allowed(true);
+ _val8 = 1;
+ kernel_trigger_dispatch_now(3);
+ _val3 = 25;
+ _val6 = 36;
+ break;
+
+ case 10:
+ _val8 = 1;
+ series_play_with_breaks(PLAY2, "138wi05", 0xa00, 3, 2, 6, 100, 0, 0);
+ break;
+
+ case 11:
+ series_load("138wi06");
+ digi_preload("138_002");
+ _val8 = 12;
+ series_play("138wi05", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 12:
+ _val8 = 13;
+ series_play_with_breaks(PLAY3, "138wi06", 0xa00, 3, 2, 6, 100, 0, 0);
+ break;
+
+ case 13:
+ _val8 = 14;
+ series_play("138wi05", 0xa00, 2, 3, 7, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 14:
+ _val8 = 1;
+ kernel_trigger_dispatch_now(3);
+
+ if (inv_object_is_here("keys")) {
+ _val6 = 33;
+ _val3 = 23;
+ } else {
+ player_set_commands_allowed(true);
+ }
+ break;
+
+ case 15:
+ _val7 = 15;
+ _G(walker).wilbur_say();
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 16:
+ series_load("138wi03");
+ digi_preload("138_001");
+ _val8 = 17;
+ series_play_with_breaks(PLAY4, "138wi03", 0xa00, 3, 2, 6, 100, 0, 0);
+ break;
+
+ case 17:
+ _val8 = 9;
+ series_play("138wi05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 11);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ if (_val8 == 1) {
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val7 = 2;
+ series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 2:
+ _val7 = 4;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 4, 9);
+ break;
+
+ default:
+ series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 3, 3);
+ break;
+ }
+ } else {
+ _val7 = 4;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 4, 9);
+ }
+ break;
+
+ case 4:
+ if (_val8 == 1) {
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val7 = 3;
+ series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 4, 9);
+ break;
+
+ case 2:
+ _val7 = 5;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 10, 12);
+ break;
+
+ default:
+ series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 9, 9);
+ break;
+ }
+ } else {
+ _val7 = 5;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 10, 12);
+ }
+ break;
+
+ case 5:
+ if (_val8 == 1) {
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val7 = 4;
+ series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 10, 12);
+ break;
+
+ case 2:
+ _val7 = 6;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 13, 17);
+ break;
+
+ default:
+ series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 12, 12);
+ break;
+ }
+ } else {
+ _val7 = 6;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 13, 17);
+ }
+ break;
+
+ case 6:
+ if (_val8 == 1) {
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val7 = 5;
+ series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 13, 17);
+ break;
+
+ case 2:
+ _val7 = 2;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 17, 17);
+ break;
+ }
+ } else {
+ _val7 = 2;
+ series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 15:
+ if (_val8 == 15) {
+ loadSeries();
+ frame = imath_ranged_rand(0, 4);
+ series_play("138wi02", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ freeSeries();
+ _val8 = 1;
+ _val7 = 2;
+ kernel_trigger_dispatch_now(2);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+ break;
+
+ case 5:
+ _val6 = 31;
+ _val3 = 22;
+ break;
+
+ case 6:
+ _val6 = 33;
+ _val3 = 23;
+ player_set_commands_allowed(false);
+ break;
+
+ case 7:
+ pal_fade_init(1010);
+ break;
+
+ case 8:
+ terminateMachineAndNull(_series1);
+ break;
+
+ case 10:
+ digi_play_loop("138_002", 3, 255);
+ _G(flags)[V047] = 4;
+ inv_give_to_player("keys");
+ hotspot_set_active("keys", false);
+ hotspot_set_active("ignition switch", true);
+ _G(flags)[V048]++;
+ kernel_timing_trigger(10, 13);
+ break;
+
+ case 11:
+ digi_preload("138_001");
+ digi_play_loop("138_001", 3, 255);
+ _series1 = series_play("138keys", 0xa00, 0, -1, 7, -1, 100, 0, 0, 0, 0);
+ _G(flags)[V047] = 0;
+ _G(flags)[V048] = 0;
+ inv_move_object("keys", 138);
+ hotspot_set_active("keys", true);
+ hotspot_set_active("ignition switch", false);
+ break;
+
+ case 12:
+ digi_play_loop("138_002", 3, 255);
+ break;
+
+ case 13:
+ if (_G(flags)[V048] && player_commands_allowed()) {
+ if (++_G(flags)[V048] >= 200) {
+ player_set_commands_allowed(false);
+ _G(flags)[V047] = 4;
+ _val6 = 33;
+ _val3 = 23;
+ }
+ }
+
+ kernel_timing_trigger(10, 13);
+ break;
+
+ case gWILBURS_SPEECH_START:
+ _val8 = 15;
+ player_set_commands_allowed(false);
+ break;
+
+ case gWILBURS_SPEECH_FINISHED:
+ _val8 = 1;
+ player_set_commands_allowed(true);
+ _G(kernel).continue_handling_trigger = true;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room138::parser() {
@@ -205,6 +674,39 @@ void Room138::parser() {
_G(player).command_ready = false;
}
+void Room138::freeAssets() {
+ if (!_assetsFreed) {
+ _assetsFreed = true;
+ digi_stop(2);
+
+ static const char *NAMES[11] = {
+ "137_020", "137_021", "137_022", "137_023", "137_024",
+ "137_025", "137_026", "137_027", "137_028", "137_012",
+ "137_013"
+ };
+ for (int i = 0; i < 11; ++i)
+ digi_unload(NAMES[i]);
+
+ digi_unload(inv_object_is_here("keys") ? "138_002" : "138_001");
+ }
+}
+
+void Room138::randomDigi() {
+ digi_play(Common::String::format("137_0%d", imath_ranged_rand(23, 27)).c_str(), 2);
+}
+
+void Room138::loadSeries() {
+ if (_series3 == -1)
+ _series3 = series_load("138wi02");
+}
+
+void Room138::freeSeries() {
+ if (_series3 != -1) {
+ series_unload(_series3);
+ _series3 = -1;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room138.h b/engines/m4/burger/rooms/section1/room138.h
index 399cadc821d..05cfe5eaf1d 100644
--- a/engines/m4/burger/rooms/section1/room138.h
+++ b/engines/m4/burger/rooms/section1/room138.h
@@ -32,7 +32,8 @@ class Room138 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
- int _val1 = 0;
+ int _series3 = 0;
+ int _frame = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
@@ -40,6 +41,13 @@ private:
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
+ bool _assetsFreed = false;
+ bool _flag1 = false;
+
+ void freeAssets();
+ void randomDigi();
+ void loadSeries();
+ void freeSeries();
public:
Room138() : Room() {}
Commit: ab55bf819908c1a422e0e3d1a583c4610885b94d
https://github.com/scummvm/scummvm/commit/ab55bf819908c1a422e0e3d1a583c4610885b94d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix crash on room 138 startup
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 7d50dd23eca..933d60111db 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -84,6 +84,10 @@ void Room138::preload() {
}
void Room138::init() {
+ _assetsFreed = false;
+ _series3 = -1;
+ _flag1 = false;
+
static const char *NAMES[12] = {
"138_004", "137_012", "137_013", "137_020", "137_021",
"137_022", "137_023", "137_024", "137_025", "137_026",
Commit: 6370b277d2dbc88dce094bfd70113f468ab301fd
https://github.com/scummvm/scummvm/commit/6370b277d2dbc88dce094bfd70113f468ab301fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Explicitly zero out allocated memory
Changed paths:
engines/m4/mem/memman.h
diff --git a/engines/m4/mem/memman.h b/engines/m4/mem/memman.h
index f38c6464354..45db0749a92 100644
--- a/engines/m4/mem/memman.h
+++ b/engines/m4/mem/memman.h
@@ -22,7 +22,7 @@
#ifndef M4_MEM_MEMMAN_H
#define M4_MEM_MEMMAN_H
-#include "common/memory.h"
+#include "common/algorithm.h"
#include "m4/m4_types.h"
namespace M4 {
@@ -30,7 +30,9 @@ namespace M4 {
#define _MEMTYPE_LIMIT 33
inline Handle mem_alloc(size_t size, const char *) {
- return (Handle)malloc(size);
+ byte *ptr = (byte *)malloc(size);
+ Common::fill(ptr, ptr + size, 0);
+ return (Handle)ptr;
}
inline void mem_free(Handle ptr) {
Commit: 222904287ddf1cadd65cb30a0d033fd99c2542cf
https://github.com/scummvm/scummvm/commit/222904287ddf1cadd65cb30a0d033fd99c2542cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect strng field allocation
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 60bf660a957..fddd4f3d591 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -118,7 +118,7 @@ void TextField::set_string(const char *string) {
int16 string_len = (int16)(cstrlen(string) + 1);
if (_string == nullptr) {
- _string = (char *)mem_alloc(_string_len, "string");
+ _string = (char *)mem_alloc(string_len, "string");
} else {
if (_string_len < string_len) {
_string = (char *)mem_realloc(_string, string_len, "string");
Commit: 0cc99478e48dc6a1ad8770c2e14b3e4160b7a13e
https://github.com/scummvm/scummvm/commit/0cc99478e48dc6a1ad8770c2e14b3e4160b7a13e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix disappearing Wilbur in room 138
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 933d60111db..473dff069a8 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -531,7 +531,7 @@ void Room138::daemon() {
freeSeries();
_val8 = 1;
_val7 = 2;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(3);
}
break;
Commit: 4b9b37111d53c135186a5fa1628a1cc413175dee
https://github.com/scummvm/scummvm/commit/4b9b37111d53c135186a5fa1628a1cc413175dee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting keys in room 138
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 473dff069a8..8a5f86fc566 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -654,7 +654,7 @@ void Room138::parser() {
wilbur_speech("138w610");
_val8 = 15;
- } else if (player_said("take", "keys") && inv_player_has("keys")) {
+ } else if (player_said("take", "keys") && !inv_player_has("keys")) {
_val8 = 7;
player_set_commands_allowed(false);
Commit: c5bd72b81a399e15e1a1e0aa35f188c1777c63bd
https://github.com/scummvm/scummvm/commit/c5bd72b81a399e15e1a1e0aa35f188c1777c63bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 141 methods
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index f8e0f86bdac..0f1c8068b4f 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -28,16 +28,159 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "TRUFFLES", "141W002", "141W003", "141W003" },
+ { "ISLAND", "141W004", "141W003", "141W003" },
+ { "CABIN", "141W005", "141W003", "141W006" },
+ { "GARDEN", "141W007", "141W003", "141W006" },
+ { "TROUGH", "141W008", "141W006", "141W006" },
+ { "SIGN", "141W009", "141W006", "141W006" },
+ { "TREES", "141W010", "141W003", "141W003" },
+ { "WATER", "141W011", "141W003", "141W012" },
+ { "ROCKS", "141W013", "141W003", nullptr },
+ { "DOCK", "141W002", nullptr, nullptr },
+ { "HANLON'S POINT", nullptr, "141W003", "141W003" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
+void Room141::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room141::init() {
+ digi_preload("144_001");
+
+ if (_G(game).previous_room != RESTORING_GAME)
+ player_set_commands_allowed(false);
+
+ if (!_G(flags)[V112]) {
+ digi_preload("140t001a", 140);
+ digi_preload("140t001b", 140);
+ digi_preload("140t001c", 140);
+ digi_preload("140t001d", 140);
+ digi_preload("140t001e", 140);
+ digi_preload("140t001f", 140);
+
+ series_load("140tr01");
+ series_load("140tr01s");
+ series_load("140tr02");
+ series_load("140tr02s");
+ series_load("140tr03");
+ series_load("140tr03s");
+ }
+
+ series_load("140tr04");
+ series_load("140tr04s");
+ series_load("140tr05");
+ series_load("140tr05s");
+ series_load("140tr06");
+ series_load("140tr06s");
+ series_load("140tr07");
+ series_load("140tr07s");
+
+ if (!_G(flags)[V112]) {
+ _series1 = series_play(_G(flags)[V000] == 1002 ? "141pboat" : "140pboat",
+ 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
+
+ series_load("140pe01");
+ series_load("140pe01s");
+ digi_preload("20n01011", 140);
+ digi_preload("20n01012", 140);
+ digi_preload("20n01013", 140);
+ digi_preload("20n01014", 140);
+
+ _val1 = 14;
+ _val2 = 14;
+ kernel_trigger_dispatch_now(7);
+ }
+
+ if (_G(game).previous_room == RESTORING_GAME) {
+ _series2 = series_play("141wave", 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
+ _val3 = 9;
+ _val4 = 9;
+ _val5 = 52;
+ _val6 = 52;
+
+ } else {
+ _val5 = 52;
+ _val6 = 50;
+
+ if (_G(flags)[V112]) {
+ _val3 = 1;
+ _val4 = 8;
+ } else {
+ _val3 = 1;
+ _val4 = 1;
+ _val7 = 0;
+ }
+ }
+
+ kernel_trigger_dispatch_now(8);
+ kernel_trigger_dispatch_now(6);
+ digi_play_loop("144_001", 3, 180);
}
void Room141::daemon() {
}
-void Room141::pre_parser() {
+void Room141::parser() {
+ bool lookFlag = player_said("look") || player_said("look at");
+
+ if (player_said("conv20")) {
+ conv20();
+
+ } else if (player_said("whistle") && player_said_any("GEAR", "WILBUR")) {
+ player_set_commands_allowed(false);
+ _val6 = 62;
+
+ } else if (player_said("gear", "dock") || player_said("try to dock")) {
+ _val4 = 12;
+
+ } else if (inv_player_has(_G(player).verb) &&
+ player_said_any("cabin", "garden", "trough", "sign")) {
+ wilbur_speech("141w006");
+
+ } else if (inv_player_has(_G(player).verb) && player_said_any("trees", "water")) {
+ wilbur_speech("141w003");
+
+ } else if (player_said("take") && !inv_player_has(_G(player).noun)) {
+ if (player_said("trough") || player_said("sign")) {
+ _val4 = 12;
+
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ goto check_exit;
+ }
+
+ } else if (player_said("gear") && !inv_player_has(_G(player).noun)) {
+ if (player_said("cabin") || player_said("garden") ||
+ player_said("trough") || player_said("sign")) {
+ _val4 = 12;
+
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ goto check_exit;
+ }
+
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ goto check_exit;
+ }
+ goto done;
+
+check_exit:
+ if (player_said("exit") || (player_said("hanlon's point") && lookFlag)) {
+ player_set_commands_allowed(false);
+ _val6 = 55;
+
+ } else {
+ return;
+ }
+
+done:
+ _G(player).command_ready = false;
}
-void Room141::parser() {
+void Room141::conv20() {
+ error("TODO: Room141::conv20");
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 2fa91973e38..d1f160f74df 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -29,13 +29,26 @@ namespace Burger {
namespace Rooms {
class Room141 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+
+ void conv20();
+
public:
Room141() : Room() {}
~Room141() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: 61dd9e3a1ad2311da760133ac43d70ba579a2a1d
https://github.com/scummvm/scummvm/commit/61dd9e3a1ad2311da760133ac43d70ba579a2a1d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: series stream/play arrays for room 141
Changed paths:
engines/m4/burger/core/stream_break.h
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/core/stream_break.h b/engines/m4/burger/core/stream_break.h
index 40f8bee847f..0d4d00f11f3 100644
--- a/engines/m4/burger/core/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -38,6 +38,13 @@ struct seriesStreamBreak {
uint32 flags;
const int32 *variable;
int32 value;
+
+ seriesStreamBreak() = default;
+ seriesStreamBreak(int32 frame_, const char *sound_, int32 channel_,
+ int32 volume_, int32 trigger_, uint32 flags_, const int32 *variable_,
+ int32 value_) :
+ frame(frame_), sound(sound_), channel(channel_), volume(volume_),
+ trigger(trigger_), flags(flags_), variable(variable_), value(value_) {}
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 0f1c8068b4f..07682e11db7 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -43,9 +43,92 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesPlayBreak PLAY1[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 0, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY5[] = {
+ { 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 8, 10, "999blow", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, 11, nullptr, 1, 255, 14, 0, 0, nullptr, 0 },
+ { 12, -1, nullptr, 1, 255, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY6[] = {
+ { 0, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, "999blow", 1, 125, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, 15, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 9, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 1, 255, 20, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY7[] = {
+ { 5, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesStreamBreak SERIES1[] = {
+ { 9, "141_005", 1, 255, -1, 0, nullptr, 0 },
+ { 18, nullptr, 2, 255, 1, 0, nullptr, 0 },
+ { -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 5, "141_007", 1, 255, -1, 0, 0, 0 },
+ { 9, 0, 2, 255, 3, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES3[] = {
+ { 0, "140_002", 2, 255, -1, 0, nullptr, 0 },
+ { 14, "140_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
void Room141::preload() {
_G(player).walker_in_this_scene = false;
+
+ SERIES4.clear();
+ SERIES4.push_back(seriesStreamBreak(0, "140_002", 2, 255, -1, 0, 0, 0));
+ SERIES4.push_back(seriesStreamBreak(10, nullptr, 2, 255, 13, 0, &_G(flags)[V112], 0));
+ SERIES4.push_back(seriesStreamBreak(25, "140_002", 2, 255, -1, 0, 0, 0));
+ SERIES4.push_back(seriesStreamBreak(-1, 0, 0, 0, -1, 0, 0, 0));
}
void Room141::init() {
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index d1f160f74df..193eb5ce5e0 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -30,6 +30,7 @@ namespace Rooms {
class Room141 : public Room {
private:
+ Common::Array<seriesStreamBreak> SERIES4;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
int _val1 = 0;
Commit: 6544618ccb5d75854b2a5cbab8505e528a2aabb3
https://github.com/scummvm/scummvm/commit/6544618ccb5d75854b2a5cbab8505e528a2aabb3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 141 daemon
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 07682e11db7..4a64c5bc33b 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -205,6 +205,695 @@ void Room141::init() {
}
void Room141::daemon() {
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_play("141_002", 2, 200, 2);
+ break;
+
+ case 2:
+ digi_play_loop("141_003", 2, 200);
+ break;
+
+ case 3:
+ digi_play("141_006", 2, 200, 4);
+ break;
+
+ case 4:
+ _val8 = 0;
+ break;
+
+ case 5:
+ _val6 = 52;
+ player_set_commands_allowed(true);
+ break;
+
+ case 6:
+ switch (_val3) {
+ case 1:
+ switch (_val4) {
+ case 1:
+ _flag1 = true;
+
+ if (imath_ranged_rand(1, 8) == 1) {
+ _val3 = 2;
+ _val7 = 0;
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 1, 1);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 1, 1);
+
+ } else {
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 5:
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ _val2 = 42;
+ break;
+
+ case 6:
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 7:
+ digi_play("140t002", 2, 255, 11);
+ series_play("140tr02", 0xa00, 0, 6, 8, 0, 100, 0, 0, 0, 4);
+ series_play("140tr02s", 0xa01, 0, -1, 8, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 8:
+ _val3 = 9;
+ _val4 = 9;
+ series_play_with_breaks(PLAY1, "140tr03", 0xa00, 6, 3, 6, 100, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ if (_val4 == 1) {
+ playRandom();
+
+ if (imath_ranged_rand(1, 3) == 1) {
+ if (--_val7 <= 1)
+ _val7 = 3;
+
+ } else {
+ if (++_val7 >= 6) {
+ _val7 = 5;
+ _val3 = 4;
+ }
+ if (_val7 < 1)
+ _val7 = 1;
+ }
+
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, _val7, _val7);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, _val7, _val7);
+
+ } else {
+ _val3 = 4;
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 6, 6);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 6, 6);
+ }
+ break;
+
+ case 3:
+ if (_val4 == 1) {
+ if (imath_ranged_rand(1, 15) == 1) {
+ digi_stop(2);
+ _val3 = 1;
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ } else {
+ playRandom();
+ frame = imath_ranged_rand(7, 8);
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, frame, frame);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, frame, frame);
+ }
+ } else {
+ digi_stop(2);
+ _val3 = 1;
+ series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 4:
+ _val3 = 3;
+ series_play("140tr01", 0xa00, 0, 6, 6, 0, 100, 0, 0, 9, 11);
+ series_play("140tr01s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ break;
+
+ case 7:
+ if (_val4 == 7) {
+ frame = imath_ranged_rand(5, 6);
+ series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
+ series_play("140tr02s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
+ series_play("140tr02s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ }
+ break;
+
+ case 9:
+ switch (_val4) {
+ case 10:
+ digi_play("140t002", 2, 255, 12);
+ _val3 = 10;
+ series_play("140tr06", 0xa00, 0, 6, 8, 0, 100, 0, 0, 0, 4);
+ series_play("140tr06s", 0xa01, 0, -1, 8, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 12:
+ digi_play(Common::String::format("140t004%c", 'a' + imath_ranged_rand(0, 3)).c_str(),
+ 2, 255, 10);
+ _val3 = 12;
+ series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, 0, 3);
+ series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 0, 3);
+
+ if (player_said("gear", "dock") || player_said("try to dock")) {
+ kernel_timing_trigger(90, 16);
+ }
+ break;
+
+ default:
+ if (imath_ranged_rand(1, 10) == 1) {
+ _flag1 = true;
+ playRandom();
+ _val3 = 11;
+ series_play("140tr05", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 2);
+ series_play("140tr05s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 2);
+
+ } else {
+ series_play("140tr04", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140tr04s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+ }
+ break;
+
+ case 10:
+ if (_val4 == 10) {
+ frame = imath_ranged_rand(5, 6);
+ series_play("140tr06", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
+ series_play("140tr06s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ series_play("140tr06", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
+ series_play("140tr06s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ }
+ break;
+
+ case 11:
+ if (_val4 == 11) {
+ if (imath_ranged_rand(1, 10) == 1) {
+ if (!_val8)
+ digi_stop(2);
+
+ _val3 = 9;
+ series_play("140tr05", 0xa00, 2, 6, 10, 0, 100, 0, 0, 0, 2);
+ series_play("140tr05s", 0xa01, 2, -1, 10, 0, 100, 0, 0, 0, 2);
+ } else {
+ playRandom();
+ frame = imath_ranged_rand(3, 5);
+ series_play("140tr05", 0xa00, 0, 6, 10, 0, 100, 0, 0, frame, frame);
+ series_play("140tr05s", 0xa01, 0, -1, 10, 0, 100, 0, 0, frame, frame);
+ }
+ } else {
+ _val3 = 9;
+ series_play("140tr05", 0xa00, 2, 6, 7, 0, 100, 0, 0, 0, 2);
+ series_play("140tr05s", 0xa01, 2, -1, 7, 0, 100, 0, 0, 0, 2);
+ }
+ break;
+
+ case 12:
+ if (_val4 == 12) {
+ frame = imath_ranged_rand(4, 6);
+ series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
+ series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ _val3 = 9;
+ series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
+ series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ switch (_val1) {
+ case 14:
+ switch (_val2) {
+ case 14:
+ series_play("140pe01", 0xa00, 0, 7, 6, 0, 100, 0, 0, 1, 1);
+ series_play("140pe01s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 1, 1);
+ break;
+
+ case 15:
+ _val2 = 16;
+ series_play_with_breaks(PLAY2, "140pe01", 0x500, 7, 3);
+ break;
+
+ case 16:
+ _val2 = 17;
+ series_play_with_breaks(PLAY3, "140pe02", 0x500, 7, 3);
+ break;
+
+ case 17:
+ _val2 = _val1 = 18;
+ kernel_trigger_dispatch_now(7);
+ conv_resume_curr();
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 18:
+ switch (_val2) {
+ case 18:
+ series_play("140pe03", 0x500, 0, 7, 10, 0, 100, 0, 0, 0, 0);
+ series_play("140pe03s", 0x501, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 19:
+ series_play("140pe05", 0x500, 0, 7, 6, 0, 100, 0, 0, 1, 1);
+ series_play("140pe05s", 0x501, 0, -1, 6, 0, 100, 0, 0, 1, 1);
+ break;
+
+ case 20:
+ frame = imath_ranged_rand(0, 4);
+ series_play("140pe04", 0x500, 0, 7, 5, 0, 100, 0, 0, frame, frame);
+ series_play("140pe04s", 0x501, 0, -1, 5, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 21:
+ _val2 = 22;
+ series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 3);
+ series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 22:
+ _val2 = 23;
+ series_play("140pe06", 0x500, 0, 7, 50, 0, 100, 0, 0, 3, 3);
+ series_play("140pe06s", 0x501, 0, -1, 50, 0, 100, 0, 0, 3, 3);
+ break;
+
+ case 23:
+ _val2 = 18;
+ series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 5, 7);
+ series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 5, 7);
+ break;
+
+ case 24:
+ _val2 = 24;
+ series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 5);
+ series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ kernel_timing_trigger(60, 19);
+ break;
+
+ case 25:
+ _val2 = 26;
+ series_play("140pe08", 0x500, 0, 7, 3, 0, 100, 0, 0, 0, 7);
+ series_play("140pe08s", 0x501, 0, -1, 3, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 26:
+ _val1 = _val2 = 27;
+ series_play("140pe08", 0x500, 0, 7, 10, 0, 100, 0, 0, 10, 10);
+ series_play("140pe08s", 0x501, 0, -1, 10, 0, 100, 0, 0, 10, 10);
+ conv_resume_curr();
+ break;
+
+ default:
+ _val1 = 27;
+ series_play("140pe08", 0x500, 0, 7, 3, 0, 100, 0, 0, 0, 7);
+ series_play("140pe08s", 0x501, 0, -1, 3, 0, 100, 0, 0, 0, 7);
+ break;
+ }
+ break;
+
+ case 24:
+ if (_val2 == 24) {
+ if (imath_ranged_rand(1, 8) == 1) {
+ digi_play("140_003", 1, 200);
+ series_play("140pe07", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 5);
+ series_play("140pe07s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ } else {
+ series_play("140pe03", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ series_play("140pe03s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ }
+ }
+ break;
+
+ case 27:
+ switch (_val2) {
+ case 18:
+ case 19:
+ case 20:
+ case 24:
+ case 39:
+ _val1 = 18;
+ series_play("140pe15", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
+ series_play("140pe15s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 27:
+ series_play("140pe08", 0x500, 0, 7, 10, 0, 100, 0, 0, 10, 10);
+ series_play("140pe08s", 0x501, 0, -1, 10, 0, 100, 0, 0, 10, 10);
+ break;
+
+ case 28:
+ frame = imath_ranged_rand(8, 10);
+ series_play("140pe08", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
+ series_play("140pe08s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 29:
+ _val1 = 29;
+ series_play("140pe11", 0x500, 0, 7, 4, 0, 100, 0, 0, 0, 3);
+ series_play("140pe11s", 0x501, 0, -1, 4, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 31:
+ series_play("140pe14", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
+ series_play("140pe14s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 32:
+ series_load("141pe24");
+ terminateMachineAndNull(_series1);
+ _val2 = 33;
+
+ digi_preload("141_002");
+ digi_preload("141_003");
+ digi_preload("141_006");
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "141pe22", 6, 0xf00, 7);
+ series_play("141pe22s", 0xf01);
+ break;
+
+ case 33:
+ _val2 = 45;
+ _val1 = 45;
+ series_play("141pe24", 0xf00, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ conv_resume_curr();
+ break;
+
+ case 34:
+ _val2 = 35;
+ series_play("140pe13", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ series_play("140pe13s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 35:
+ _val2 = 36;
+ series_play("140pe13", 0x500, 0, 7, 120, 0, 100, 0, 0, 1, 1);
+ series_play("140pe13s", 0x501, 0, -1, 120, 0, 100, 0, 0, 1, 1);
+ conv_resume_curr();
+ break;
+
+ case 36:
+ _val2 = 27;
+ series_play("140pe13", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ series_play("140pe13s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ conv_resume_curr();
+ break;
+
+ default:
+ _val1 = 40;
+ series_play("140pe16", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 40);
+ series_play("140pe16s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 29:
+ if (_val2 == 29) {
+ frame = imath_ranged_rand(4, 6);
+ series_play("140pe11", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
+ series_play("140pe11s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+
+ } else {
+ _val1 = 27;
+ series_play("140pe11", 0x500, 0, 7, 6, 0, 100, 0, 0, 7, 9);
+ series_play("140pe11s", 0x501, 0, -1, 6, 0, 100, 0, 0, 7, 9);
+ }
+ break;
+
+ case 40:
+ switch(_val2) {
+ case 38:
+ series_play("140pe17", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ series_play("140pe17s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ conv_resume_curr();
+ break;
+
+ case 40:
+ series_play("140pe17", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ series_play("140pe17s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 41:
+ frame = imath_ranged_rand(0, 4);
+ series_play("140pe18", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
+ series_play("140pe18s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 42:
+ _val2 = 40;
+ _val4 = 6;
+ series_play_with_breaks(PLAY5, "140pe20", 0x500, 7, 3, 6, 100, 0, 0);
+ break;
+
+ case 43:
+ _val2 = 40;
+ series_play("140pe19", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
+ series_play("140pe19s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 44:
+ _val1 = _val2 = 27;
+ series_play("140pe21", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 4);
+ series_play("140pe21s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ default:
+ _val2 = 27;
+ series_play("140pe21", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 4);
+ series_play("140pe21s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 45:
+ switch (_val2) {
+ case 45:
+ series_play("141pe24", 0xf00, 0, 7, 10, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 46:
+ frame = imath_ranged_rand(0, 3);
+ series_play("141pe24", 0xf00, 0, 7, 6, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 47:
+ _val2 = 45;
+ series_play_with_breaks(PLAY4, "140pe25", 0x500, 7, 3, 6, 100, 0, 0);
+ break;
+
+ case 48:
+ _val2 = 49;
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "141pe26", 6, 0x100, 7);
+ _G(flags)[V112] = 1;
+ break;
+
+ case 49:
+ player_set_commands_allowed(true);
+ digi_unload("141_002");
+ digi_unload("141_003");
+ break;
+ }
+ }
+ break;
+
+ case 8:
+ switch (_val5) {
+ case 52:
+ switch (_val6) {
+ case 50:
+ _val6 = 51;
+ _val8 = 1;
+ digi_preload_stream_breaks(&SERIES4[0]);
+ series_stream_with_breaks(&SERIES4[0], _G(flags)[V000] == 1002 ? "141wi01" : "140wi01",
+ 6, 0xf00, 8);
+ break;
+
+ case 51:
+ _val8 = 0;
+ _series2 = series_play(_G(flags)[V000] == 1002 ? "141wave" : "140wave",
+ 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
+ _val6 = 52;
+ kernel_trigger_dispatch_now(8);
+
+ if (_G(flags)[V112])
+ _G(walker).wilbur_speech("141w001");
+ break;
+
+ case 52:
+ series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
+ 0x200, 0, 8, 30, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 53:
+ frame = imath_ranged_rand(0, 4);
+ series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
+ 0x200, 0, 8, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 54:
+ _val6 = 52;
+ series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
+ 0x200, 0, 8, 6, 0, 100, 0, 0, 9, 11);
+ break;
+
+ case 55:
+ terminateMachineAndNull(_series2);
+ _val8 = 1;
+
+ series_stream_with_breaks(SERIES3, _G(flags)[V000] == 1002 ? "141wi03" : "140wi03",
+ 10, 0xf00, 18);
+ break;
+
+ case 56:
+ terminateMachineAndNull(_series2);
+ _val8 = 1;
+
+ series_stream_with_breaks(SERIES3, _G(flags)[V000] == 1002 ? "141wi03" : "140wi03",
+ 6, 0xf00, 18);
+ break;
+
+ case 57:
+ _val6 = 52;
+ series_play_with_breaks(PLAY7, "141wi02", 0x200, 8, 2, 7, 100, 0, 0);
+ break;
+
+ case 58:
+ digi_preload("100_023");
+ _val6 = 59;
+ series_play("141wi05", 0x200, 0, 8, 6, 0, 100, 0, 0, 0, 12);
+ break;
+
+ case 59:
+ _val6 = 60;
+ series_play("141wi05", 0x200, 0, 8, 6, 0, 100, 0, 0, 13, 18);
+ digi_play("100_023", 2, 255);
+ break;
+
+ case 60:
+ digi_stop(2);
+ _val5 = _val6 = 58;
+ kernel_trigger_dispatch_now(8);
+ conv_resume_curr();
+ break;
+
+ case 62:
+ _val6 = 52;
+ series_play_with_breaks(PLAY6, "141wi06", 0x200, 8, 2, 6, 100, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 58:
+ if (_val6 == 58) {
+ series_play("141wi05", 0x200, 0, 8, 10, 0, 100, 0, 0, 18, 18);
+ } else {
+ _val5 = 61;
+ series_play("141wi05", 0x200, 2, 8, 6, 0, 100, 0, 0, 0, 18);
+ digi_play("100_023", 2, 255);
+ }
+ break;
+
+ case 61:
+ _val5 = 52;
+ kernel_trigger_dispatch_now(8);
+ digi_stop(2);
+ digi_unload("100_023");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ _flag1 = true;
+ break;
+
+ case 10:
+ _val4 = 9;
+ if (!player_said("gear", "dock") && !player_said("try to dock"))
+ _G(walker).wilbur_said(SAID);
+ break;
+
+ case 11:
+ _val4 = 1;
+ _val2 = 27;
+ conv_resume_curr();
+ break;
+
+ case 12:
+ _val4 = 9;
+ break;
+
+ case 13:
+ _val2 = 15;
+ conv_load_and_prepare("conv20", 22);
+ conv_export_value_curr(1, _G(flags)[V000] == 1002 ? 1 : 0);
+ conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 2);
+
+ if (_G(flags)[V000] == 1002 && inv_player_has("deed")) {
+ conv_export_value_curr(1, 5);
+ } else {
+ conv_export_value_curr(0, 5);
+ }
+
+ conv_play_curr();
+ break;
+
+ case 14:
+ _val4 = 7;
+ break;
+
+ case 15:
+ _val4 = 10;
+ break;
+
+ case 16:
+ _G(walker).wilbur_speech_random("141w014a", "141w01b", "141w014c", 17);
+ break;
+
+ case 17:
+ wilbur_speech("141w015", 5);
+ break;
+
+ case 18:
+ pal_fade_init(1012);
+ break;
+
+ case 19:
+ _val6 = 56;
+ break;
+
+ case 20:
+ player_set_commands_allowed(true);
+ break;
+
+ case g10013:
+ _G(kernel).continue_handling_trigger = 1;
+ _val6 = 53;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room141::parser() {
@@ -266,6 +955,14 @@ void Room141::conv20() {
error("TODO: Room141::conv20");
}
+void Room141::playRandom() {
+ if (_flag1 && !_val8) {
+ _flag1 = false;
+ digi_play(Common::String::format("140t001%c", 'c' + imath_ranged_rand(0, 5)).c_str(),
+ 2, 100, 9);
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 193eb5ce5e0..203a3de8c3e 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -40,8 +40,11 @@ private:
int _val5 = 0;
int _val6 = 0;
int _val7 = 0;
+ int _val8 = 0;
+ bool _flag1 = false;
void conv20();
+ void playRandom();
public:
Room141() : Room() {}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 837d0b2a85c..a3b89e49619 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -53,6 +53,7 @@ enum global_triggers {
gRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
gNONPLAYERS_SPEECH_FINISHED = 10011, // digi_play trigger, used in talk.cpp
+ g10013 = 10013,
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
gCHANGE_WILBUR_ANIMATION = 10016,
Commit: 7a73cf0cb58bd80de5abb12d3028d8e072af8fbf
https://github.com/scummvm/scummvm/commit/7a73cf0cb58bd80de5abb12d3028d8e072af8fbf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining conv code for room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 4a64c5bc33b..62f5faa630f 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -952,7 +952,126 @@ done:
}
void Room141::conv20() {
- error("TODO: Room141::conv20");
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 21) {
+ if (who <= 0) {
+ if (node == 4 && entry == 0) {
+ conv_resume_curr();
+ } else if (node == 15 && entry == 1) {
+ _val2 = 43;
+ } else if (node == 16) {
+ _val4 = 5;
+ } else if (node != 0) {
+ if (node == 20 && (entry == 2 || entry == 3)) {
+ _val2 = 40;
+ conv_resume_curr();
+ } else if (node == 20 && entry == 1) {
+ _val2 = 43;
+ } else if (node == 20 && entry == 6) {
+ _val2 = 38;
+ } else if (node == 20 && entry == 7) {
+ _val4 = 8;
+ _val2 = 32;
+ } else if (node == 20 && entry == 8) {
+ _val2 = 45;
+ conv_resume_curr();
+ } else if (node == 20 && entry == 9) {
+ _val2 = 48;
+ conv_resume_curr();
+ } else if (node == 6 && entry == 1) {
+ _val2 = 27;
+ conv_resume_curr();
+ } else if (node == 4 && (entry == 0 || entry == 4)) {
+ _val2 = 25;
+ } else if (node == 6 && entry == 3) {
+ _val2 = 31;
+ _val6 = 55;
+ conv_resume_curr();
+ } else if (node == 7 ||
+ (node == 4 && (entry == 1 || entry == 6 || entry == 7 || entry == 9)) ||
+ (node == 5 && entry == 1) ||
+ (node == 11 && entry == 5) ||
+ (node == 8 && (entry == 0 || entry == 2)) ||
+ (node == 10 && entry == 1) ||
+ (node == 9)) {
+ digi_preload("140_003");
+ _val2 = 24;
+ conv_resume_curr();
+
+ } else if ((node == 4 && (entry == 2 || entry == 5 || entry == 10 || entry == 11)) ||
+ (node == 15 && entry == 5) ||
+ (node == 18 && entry == 1) ||
+ (node == 19 && (entry == 2 || entry == 3))) {
+ _val6 = 55;
+ _val2 = (_val1 == 27 || _val1 == 40) ? 27 : 18;
+ conv_resume_curr();
+
+ } else {
+ _val2 = (_val1 == 27 || _val1 == 40) ? 27 : 18;
+ conv_resume_curr();
+
+ }
+ }
+ } else if (who == 1) {
+ if (node == 20 && entry == 1) {
+ _val6 = 57;
+ conv_resume_curr();
+ } else if (node == 20 && entry == 5) {
+ _val6 = 58;
+ } else if ((node == 6 && entry == 1) || (node == 8 && entry == 3)) {
+ _val2 = 25;
+ _val6 = 52;
+ } else if ((node == 4 && entry == 0) || (node == 20 && entry == 0)) {
+ _val2 = 21;
+ _val6 = 52;
+ } else {
+ _val6 = (node == 14) ? 55 : 52;
+ conv_resume_curr();
+ }
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ if (node == 20 && entry == 7)
+ _val6 = 52;
+
+ if (node != 0) {
+ if (node == 1 || node == 2) {
+ _val2 = 20;
+ digi_unload("20n01011");
+ digi_unload("20n01012");
+ digi_unload("20n01013");
+ digi_unload("20n01014");
+ } else if (node == 6 && entry == 1) {
+ _val2 = 28;
+ } else if (node == 20 && entry == 4) {
+ _val2 = 28;
+ } else if (node == 20 && (entry == 2 || entry == 3 || entry == 7)) {
+ _val2 = 41;
+ } else if (node == 20 && (entry == 8 || entry == 9)) {
+ _val2 = 46;
+ } else if (node == 13 || node == 16) {
+ _val2 = 41;
+ } else if (node == 11 && entry == 5) {
+ _val2 = 20;
+ } else if (node == 6 && (entry == 2 || entry == 3)) {
+ _val2 = 28;
+ } else {
+ _val2 = (_val1 == 27) ? 28 : 20;
+ }
+ }
+ } else if (who == 1) {
+ _val6 = 53;
+ }
+
+ digi_play(conv_sound_to_play(), 1, 255, 21, 140);
+
+ } else {
+ conv_resume_curr();
+ }
}
void Room141::playRandom() {
Commit: 35435e68f75215f0a38c3cc5824798db82bcd9cb
https://github.com/scummvm/scummvm/commit/35435e68f75215f0a38c3cc5824798db82bcd9cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 144 methods
Changed paths:
engines/m4/burger/rooms/section1/room144.cpp
engines/m4/burger/rooms/section1/room144.h
diff --git a/engines/m4/burger/rooms/section1/room144.cpp b/engines/m4/burger/rooms/section1/room144.cpp
index ba071c66689..66967934324 100644
--- a/engines/m4/burger/rooms/section1/room144.cpp
+++ b/engines/m4/burger/rooms/section1/room144.cpp
@@ -28,16 +28,220 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID1[][4] = {
+ { "ISLAND", nullptr, "999w011", "999w011" },
+ { "ROCK", "144W004", "999w011", "999w011" },
+ { "SHACK", "144W005", "999w011", nullptr },
+ { "SIGN", "144W006", nullptr, nullptr },
+ { "ROWBOAT", "144W007", nullptr, nullptr },
+ { "WATER", "144W008", "999w011", "144W009" },
+ { "BURL", "144W010", "999w011", "999w011" },
+ { "MOTORBOAT", "144W012", nullptr, "144W013" },
+ { "VERA'S DINER", nullptr, "999w011", "999w011" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const char *SAID2[][4] = {
+ { "ISLAND", "139W001", "139W002", "139W002" },
+ { "ROCK", nullptr, "139W002", "139W002" },
+ { "SHACK", "139W005", "139W002", nullptr },
+ { "SIGN", "139W006", nullptr, nullptr },
+ { "ROWBOAT", "139W007", nullptr, nullptr },
+ { "WATER", "139W008", "139W002", "139W009" },
+ { "VERA'S DINER", nullptr, "139W002", "139W002" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 32, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 33, 39, "139_002", 2, 255, -1, 0, 0, 0, 0 },
+ { 40, 43, 0, 1, 255, 8, 0, 0, 0, 0 },
+ { 44, 52, "139_003", 2, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ { 52, 52, 0, 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 35, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 36, 39, "144_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 40, 46, nullptr, 1, 255, 8, 0, 0, nullptr, 0 },
+ { 47, 52, "144_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesStreamBreak SERIES1[] = {
+ { 6, 0, 2, 255, 2, 0, 0, 0 },
+ { 10, "100_022", 2, 255, -1, 0, 0, 0 },
+ { -1, 0, 0, 0, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 1, "144b001", 1, 255, -1, 0, nullptr, 0 },
+ { 45, nullptr, 1, 255, 5, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room144::init() {
+ _val1 = 0;
+ _val2 = 15;
+ digi_preload("144_001");
+
+ if (_G(game).previous_room == 144)
+ preloadDigi();
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 139:
+ player_set_commands_allowed(false);
+ ws_demand_location(470, 269, 8);
+ _val3 = 1;
+ _val4 = 3;
+ kernel_trigger_dispatch_now(9);
+ break;
+
+ case 141:
+ ws_demand_location(250, 224, 4);
+ break;
+
+ case 142:
+ ws_demand_location(670, 257, 9);
+ ws_walk(596, 245, 0, -1, 8);
+ break;
+
+ default:
+ ws_demand_location(320, 271, 5);
+ break;
+ }
+
+ if (_G(game).previous_room != 139 && _G(flags)[V000] == 1002) {
+ _val3 = _val4 = 3;
+ kernel_trigger_dispatch_now(9);
+ }
+
+ if (_G(flags)[V112]) {
+ series_play("144mb01", 0x600, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("motorboat", false);
+ }
+
+ _series1 = series_play((_G(flags)[V000] == 1002) ? "144rboat" : "139rboat",
+ 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ digi_play_loop("144_001", 3);
}
void Room144::daemon() {
+ // TODO
}
void Room144::pre_parser() {
+ if (player_said("vera's diner") && player_said_any("enter", "look", "look at"))
+ player_hotspot_walk_override_just_face(3);
}
void Room144::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("talk to")) {
+ conv_load_and_prepare("conv31", 6);
+ conv_export_value_curr(_G(flags)[V052], 0);
+ conv_export_value_curr(_G(flags)[V112], 1);
+ conv_play_curr();
+
+ } else if (_G(flags)[V000] == 1002 && _G(walker).wilbur_said(SAID1)) {
+ // Do nothing
+ } else if (_G(flags)[V000] == 1002 && _G(walker).wilbur_said(SAID2)) {
+ // Do nothing
+ } else if (player_said("conv31")) {
+ conv31();
+
+ } else if (inv_player_has(_G(player).verb) && _G(flags)[V000] == 1002 &&
+ player_said_any("island", "rock")) {
+ _G(walker).wilbur_speech("999w011");
+
+ } else if (inv_player_has(_G(player).verb) && _G(flags)[V000] == 1002 &&
+ player_said("burl")) {
+ _G(walker).wilbur_speech("144w011");
+
+ } else if (inv_player_has(_G(player).verb) && _G(flags)[V000] != 1002 &&
+ player_said_any("rock", "island")) {
+ _G(walker).wilbur_speech("139w002");
+
+ } else if (lookFlag && player_said("rock")) {
+ wilbur_speech(inv_player_has("deed") ? "139w004" : "139w003");
+
+ } else if (lookFlag && player_said("island") && _G(flags)[V000] == 1002) {
+ wilbur_speech(_G(flags)[V112] ? "144w002" : "144w001");
+
+ } else if (player_said("enter", "vera's diner") || (lookFlag && player_said("vera's diner"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(1014);
+
+ } else if (player_said("gear", "rowboat") || player_said("go island")) {
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(7);
+
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room144::preloadDigi() {
+ digi_preload("144b002");
+ digi_preload("144b003a");
+ digi_preload("144b003b");
+ digi_preload("144b003c");
+}
+
+void Room144::conv31() {
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+
+ if (_G(kernel).trigger == 1) {
+ if (who <= 0) {
+ _val3 = 4;
+ conv_resume();
+ } else if (who == 1) {
+ conv_resume();
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ }
+ } else if (conv_sound_to_play()) {
+ if (who <= 0) {
+ _val3 = 5;
+ _digi1 = conv_sound_to_play();
+ } else if (who == 1) {
+ wilbur_speech(conv_sound_to_play(), 1);
+ }
+ } else {
+ conv_resume();
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room144.h b/engines/m4/burger/rooms/section1/room144.h
index cf2e6e98eac..4bda5f2db58 100644
--- a/engines/m4/burger/rooms/section1/room144.h
+++ b/engines/m4/burger/rooms/section1/room144.h
@@ -29,6 +29,17 @@ namespace Burger {
namespace Rooms {
class Room144 : public Room {
+private:
+ machine *_series1 = nullptr;
+ const char *_digi1 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+
+ void preloadDigi();
+ void conv31();
+
public:
Room144() : Room() {}
~Room144() override {}
Commit: fc37ba4531e2f0bc0aa2bb890c0c0ea2f214e905
https://github.com/scummvm/scummvm/commit/fc37ba4531e2f0bc0aa2bb890c0c0ea2f214e905
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 144 daemon
Changed paths:
engines/m4/burger/rooms/section1/room144.cpp
engines/m4/burger/rooms/section1/room144.h
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/rooms/section1/room144.cpp b/engines/m4/burger/rooms/section1/room144.cpp
index 66967934324..8adba701946 100644
--- a/engines/m4/burger/rooms/section1/room144.cpp
+++ b/engines/m4/burger/rooms/section1/room144.cpp
@@ -155,7 +155,239 @@ void Room144::init() {
}
void Room144::daemon() {
- // TODO
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 2:
+ digi_change_volume(2, 0);
+ break;
+
+ case 3:
+ pal_fade_set_start(0);
+ ws_hide_walker();
+ terminateMachineAndNull(_series1);
+ gr_backup_palette();
+
+ digi_preload("100_022");
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "120dt01", 8, 0, 1012);
+ kernel_timing_trigger(1, 4);
+ break;
+
+ case 4:
+ pal_fade_init(15, 255, 100, 0, -1);
+ break;
+
+ case 5:
+ digi_play("144b003d", 1);
+ break;
+
+ case 6:
+ player_set_commands_allowed(true);
+ _val3 = 3;
+ break;
+
+ case 7:
+ ws_hide_walker();
+ terminateMachineAndNull(_series1);
+
+ if (_G(flags)[V000] == 1002) {
+ series_play_with_breaks(PLAY2, "144wi01", 0xf00, -1, 3, 6, 100, 0, 0);
+ } else {
+ series_play_with_breaks(PLAY1, "139wi01", 0xf00, -1, 3, 6, 100, 0, 0);
+ }
+ break;
+
+ case 8:
+ pal_fade_init(1013);
+ break;
+
+ case 9:
+ switch (_val4) {
+ case 3:
+ switch (_val3) {
+ case 1:
+ _val3 = 2;
+ series_play("144bu01s", 0x301, 0, -1, 8);
+ digi_preload("144b003d");
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "144bu01", 8, 0x300, 9);
+ break;
+
+ case 2:
+ digi_unload_stream_breaks(SERIES2);
+ player_set_commands_allowed(true);
+ randomDigi();
+ _val3 = 3;
+
+ series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
+ break;
+
+ case 3:
+ if (imath_ranged_rand(5, 10) < ++_val1) {
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ _val2 = 25;
+ break;
+
+ case 2:
+ _val2 = 36;
+ break;
+
+ case 3:
+ _val3 = 41;
+ break;
+
+ case 4:
+ _val2 = 42;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (imath_ranged_rand(1, 10) == 1) {
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ randomDigi();
+ series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 16, 24);
+ series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 16, 24);
+ break;
+
+ case 2:
+ randomDigi();
+ series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 26, 35);
+ series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 26, 35);
+ break;
+
+ case 3:
+ randomDigi();
+ series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 37, 40);
+ series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 37, 40);
+ break;
+
+ case 4:
+ _val3 = 7;
+ series_play("144bu06", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 12);
+ series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 12);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, _val2, _val2);
+ series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, _val2, _val2);
+ }
+ break;
+
+ case 4:
+ case 5:
+ digi_play("144b002", 2);
+ series_play("144bu06", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 2);
+ series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 7:
+ digi_change_volume(2, 0);
+ _val4 = 7;
+ series_play("144bu07", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 2);
+ series_play("144bu07s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ switch (_val3) {
+ case 4:
+ series_play("144bu08", 0x300, 0, 9, 10, 0, 100, 0, 0, 3, 3);
+ series_play("144bu08s", 0x301, 0, -1, 10, 0, 100, 0, 0, 3, 3);
+ break;
+
+ case 5:
+ _val4 = 5;
+ series_play("144bu08", 0x300, 0, 9, 4, 0, 100, 0, 0, 4, 7);
+ series_play("144bu08s", 0x301, 0, -1, 4, 0, 100, 0, 0, 4, 7);
+ break;
+
+ default:
+ digi_play("144b002", 2);
+ _val4 = 3;
+ _val3 = 2;
+ series_play("144bu08", 0x300, 2, 9, 7, 0, 100, 0, 0, 0, 3);
+ series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 0, 3);
+ break;
+ }
+ break;
+
+ case 5:
+ if (_val3 == 5) {
+ frame = imath_ranged_rand(0, 2);
+ series_play("144bu09", 0x300, 0, 9, 4, 0, 100, 0, 0, frame, frame);
+ series_play("144bu09s", 0x301, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 1);
+ _digi1 = nullptr;
+ }
+ } else {
+ _val4 = 4;
+ series_play("144bu08", 0x300, 2, 9, 7, 0, 100, 0, 0, 4, 7);
+ series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 4, 7);
+ }
+ break;
+
+ case 6:
+ _val4 = 4;
+ series_play("144bu08", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 3);
+ series_play("144bu08s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 7:
+ if (_val3 == 7) {
+ if (imath_ranged_rand(1, 10) == 1) {
+ randomDigi();
+ _val4 = 3;
+ _val3 = 3;
+ series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
+ } else {
+ series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 0, 0);
+ series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ }
+ } else {
+ _val4 = 3;
+ series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case g10028:
+ if (!_G(flags)[kRoadOpened]) {
+ _G(kernel).continue_handling_trigger = true;
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ Section1::updateDisablePlayer();
+ kernel_timing_trigger(1, 3);
+ } else {
+ kernel_timing_trigger(60, g10028);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room144::pre_parser() {
@@ -220,6 +452,14 @@ void Room144::preloadDigi() {
digi_preload("144b003c");
}
+void Room144::randomDigi() {
+ if (!digi_play_state(2)) {
+ digi_play(Common::String::format("144b003%c", 'a' + imath_ranged_rand(0, 2)).c_str(), 2, 255);
+ }
+
+ digi_change_volume(2, 255);
+}
+
void Room144::conv31() {
_G(kernel).trigger_mode = KT_PARSE;
int who = conv_whos_talking();
diff --git a/engines/m4/burger/rooms/section1/room144.h b/engines/m4/burger/rooms/section1/room144.h
index 4bda5f2db58..c15faba4ee7 100644
--- a/engines/m4/burger/rooms/section1/room144.h
+++ b/engines/m4/burger/rooms/section1/room144.h
@@ -38,6 +38,7 @@ private:
int _val4 = 0;
void preloadDigi();
+ void randomDigi();
void conv31();
public:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index a3b89e49619..5060d7b9092 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -63,6 +63,7 @@ enum global_triggers {
gUNPOOF = 10021,
gTELEPROTED1 = 10024,
gTELEPROTED2 = 10025,
+ g10028 = 10028,
CALLED_EACH_LOOP = 32764,
Commit: 5735adf163cdcba566650ae6758d1b0f7d6141c1
https://github.com/scummvm/scummvm/commit/5735adf163cdcba566650ae6758d1b0f7d6141c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 144 is also mapped to room 139
Changed paths:
A engines/m4/burger/rooms/section1/room139_144.cpp
A engines/m4/burger/rooms/section1/room139_144.h
R engines/m4/burger/rooms/section1/room144.cpp
R engines/m4/burger/rooms/section1/room144.h
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section1/room144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
similarity index 97%
rename from engines/m4/burger/rooms/section1/room144.cpp
rename to engines/m4/burger/rooms/section1/room139_144.cpp
index 8adba701946..78328ae5602 100644
--- a/engines/m4/burger/rooms/section1/room144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/rooms/section1/room144.h"
+#include "m4/burger/rooms/section1/room139_144.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
@@ -104,7 +104,7 @@ static const seriesStreamBreak SERIES2[] = {
};
-void Room144::init() {
+void Room139_144::init() {
_val1 = 0;
_val2 = 15;
digi_preload("144_001");
@@ -154,7 +154,7 @@ void Room144::init() {
digi_play_loop("144_001", 3);
}
-void Room144::daemon() {
+void Room139_144::daemon() {
int frame;
switch (_G(kernel).trigger) {
@@ -390,12 +390,12 @@ void Room144::daemon() {
}
}
-void Room144::pre_parser() {
+void Room139_144::pre_parser() {
if (player_said("vera's diner") && player_said_any("enter", "look", "look at"))
player_hotspot_walk_override_just_face(3);
}
-void Room144::parser() {
+void Room139_144::parser() {
bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
@@ -445,14 +445,14 @@ void Room144::parser() {
_G(player).command_ready = false;
}
-void Room144::preloadDigi() {
+void Room139_144::preloadDigi() {
digi_preload("144b002");
digi_preload("144b003a");
digi_preload("144b003b");
digi_preload("144b003c");
}
-void Room144::randomDigi() {
+void Room139_144::randomDigi() {
if (!digi_play_state(2)) {
digi_play(Common::String::format("144b003%c", 'a' + imath_ranged_rand(0, 2)).c_str(), 2, 255);
}
@@ -460,7 +460,7 @@ void Room144::randomDigi() {
digi_change_volume(2, 255);
}
-void Room144::conv31() {
+void Room139_144::conv31() {
_G(kernel).trigger_mode = KT_PARSE;
int who = conv_whos_talking();
diff --git a/engines/m4/burger/rooms/section1/room144.h b/engines/m4/burger/rooms/section1/room139_144.h
similarity index 94%
rename from engines/m4/burger/rooms/section1/room144.h
rename to engines/m4/burger/rooms/section1/room139_144.h
index c15faba4ee7..100ac103920 100644
--- a/engines/m4/burger/rooms/section1/room144.h
+++ b/engines/m4/burger/rooms/section1/room139_144.h
@@ -28,7 +28,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-class Room144 : public Room {
+class Room139_144 : public Room {
private:
machine *_series1 = nullptr;
const char *_digi1 = nullptr;
@@ -42,8 +42,8 @@ private:
void conv31();
public:
- Room144() : Room() {}
- ~Room144() override {}
+ Room139_144() : Room() {}
+ ~Room139_144() override {}
void init() override;
void daemon() override;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 964d6e71b10..3b6291ada24 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -42,9 +42,10 @@ Section1::Section1() : Rooms::Section() {
add(136, &_room133_136);
add(137, &_room137);
add(138, &_room138);
+ add(139, &_room139_144);
add(141, &_room141);
add(142, &_room142);
- add(144, &_room144);
+ add(144, &_room139_144);
add(170, &_room170);
add(171, &_room171);
add(172, &_room172);
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 0f13bab2a7a..594d756fdd3 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -35,9 +35,9 @@
#include "m4/burger/rooms/section1/room135.h"
#include "m4/burger/rooms/section1/room137.h"
#include "m4/burger/rooms/section1/room138.h"
+#include "m4/burger/rooms/section1/room139_144.h"
#include "m4/burger/rooms/section1/room141.h"
#include "m4/burger/rooms/section1/room142.h"
-#include "m4/burger/rooms/section1/room144.h"
#include "m4/burger/rooms/section1/room170.h"
#include "m4/burger/rooms/section1/room171.h"
#include "m4/burger/rooms/section1/room172.h"
@@ -70,7 +70,7 @@ private:
Room138 _room138;
Room141 _room141;
Room142 _room142;
- Room144 _room144;
+ Room139_144 _room139_144;
Room170 _room170;
Room171 _room171;
Room172 _room172;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 5613253bb1d..445ca83b4d0 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -100,9 +100,9 @@ MODULE_OBJS = \
burger/rooms/section1/room135.o \
burger/rooms/section1/room137.o \
burger/rooms/section1/room138.o \
+ burger/rooms/section1/room139_144.o \
burger/rooms/section1/room141.o \
burger/rooms/section1/room142.o \
- burger/rooms/section1/room144.o \
burger/rooms/section1/room170.o \
burger/rooms/section1/room171.o \
burger/rooms/section1/room172.o \
Commit: dbae78c0d87067b54d95216ed6cf341694701ed5
https://github.com/scummvm/scummvm/commit/dbae78c0d87067b54d95216ed6cf341694701ed5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 170 methods
Changed paths:
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room170.h
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index d1e0cc1b716..f5dfb93b409 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -28,16 +28,139 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "HOUSE", "170w001", "170w002", "170w002" },
+ { "FRONT DOOR", nullptr, nullptr, nullptr },
+ { "VERA'S DINER", nullptr, "170w002", nullptr },
+ { "TOWN HALL", nullptr, "170w002", nullptr },
+ { "HIGHWAY 2", "170w009", "170w002", "170w009" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 9, "100_004", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, "100_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 11, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
+ { 12, 19, "170_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 20, 20, "170w005", 1, 255, -1, 0, -1, nullptr, 0 },
+ { 21, 39, "170_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 40, 40, "170w006", 1, 125, -1, 0, -1, nullptr, 0 },
+ { 41, 52, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 0, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 12, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
+ { 23, 52, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 0, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room170::init() {
+ digi_preload("100_001");
+ digi_play_loop("100_001", 3, 255);
+
+ _firstTime = player_been_here(170);
+ series_show("170box", 0xa00);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 104:
+ ws_demand_location(494, 400, 10);
+ ws_walk(355, 353, nullptr, 1);
+ break;
+
+ case 142:
+ ws_demand_location(-40, 375, 2);
+ ws_walk(25, 350, 0, 1);
+ break;
+
+ case 171:
+ ws_demand_location(319, 192, 8);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ ws_demand_location(134, 307, 5);
+ kernel_trigger_dispatch_now(1);
+ break;
+ }
}
void Room170::daemon() {
+ // TODO
}
void Room170::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said_any("GEAR", "LOOK AT")) {
+ if (player_said("TOWN HALL")) {
+ setupTownHall();
+ _G(kernel).call_daemon_every_loop = true;
+ }
+ } else {
+ if (player_said("VERA'S DINER"))
+ player_set_facing_at(-40, 375);
+
+ if (player_said("TOWN HALL"))
+ player_set_facing_at(494, 400);
+ }
+
+ if (player_said("YARD"))
+ player_set_facing_hotspot();
}
void Room170::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Handled
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("VERA'S DINER")) {
+ disable_player_commands_and_fade_init(1014);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("MAILBOX")) {
+ if (_G(flags)[V079]) {
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V080]) {
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 3;
+ wilbur_speech("170w004", gCHANGE_WILBUR_ANIMATION);
+ }
+ } else {
+ wilbur_speech("170w008");
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room170::setupTownHall() {
+ if (player_said_any("GEAR", "LOOK AT") && player_said("TOWN HALL"))
+ _lookTownHall = true;
+
+ if (_lookTownHall) {
+ player_update_info();
+
+ if (_G(player_info).y > 375 && player_commands_allowed())
+ disable_player_commands_and_fade_init(1004);
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room170.h b/engines/m4/burger/rooms/section1/room170.h
index ccfd5699bf5..5712c12535d 100644
--- a/engines/m4/burger/rooms/section1/room170.h
+++ b/engines/m4/burger/rooms/section1/room170.h
@@ -29,6 +29,12 @@ namespace Burger {
namespace Rooms {
class Room170 : public Room {
+private:
+ bool _firstTime = false;
+ bool _lookTownHall = false;
+
+ void setupTownHall();
+
public:
Room170() : Room() {}
~Room170() override {}
Commit: b8e7f9f7562abeb0d8ec9f49eabfd776444c343c
https://github.com/scummvm/scummvm/commit/b8e7f9f7562abeb0d8ec9f49eabfd776444c343c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 170 daemon
Changed paths:
engines/m4/burger/rooms/section1/room170.cpp
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index f5dfb93b409..c66ee0f29e3 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -97,7 +97,71 @@ void Room170::init() {
}
void Room170::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ if (_firstTime)
+ wilbur_speech("170w001");
+ break;
+
+ case 2:
+ disable_player_commands_and_fade_init(1018);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ series_play_with_breaks(PLAY1, "170wi01", 0x900, 2, 2, 6, 100, 0, 0);
+ break;
+
+ case 3:
+ disable_player();
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY2, "170wi03", 0xa00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ break;
+
+ case 4:
+ enable_player();
+ wilbur_speech("170w007");
+ _G(flags)[V080] = 1;
+ _G(flags)[V079] = 0;
+ inv_give_to_player("WHISTLE");
+ inv_give_to_player("PHONE BILL");
+ break;
+
+ case 5:
+ disable_player();
+ _G(wilbur_should) = 6;
+ series_play_with_breaks(PLAY3, "170wi03", 0xa00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ break;
+
+ case 6:
+ enable_player();
+ _G(flags)[V079] = 0;
+ inv_give_to_player("WHISTLE");
+ inv_give_to_player("PHONE BILL");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case CALLED_EACH_LOOP:
+ term_message("Calling daemon each loop..............");
+
+ if (_lookTownHall) {
+ setupTownHall();
+ } else {
+ _G(kernel).call_daemon_every_loop = false;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room170::pre_parser() {
Commit: 7796bf4907efa2fcd6d08512d07a7d2a97e04e8f
https://github.com/scummvm/scummvm/commit/7796bf4907efa2fcd6d08512d07a7d2a97e04e8f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 171 init
Changed paths:
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room171.h
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index a8e1fb32d84..a95475f2ba8 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -29,6 +29,147 @@ namespace Burger {
namespace Rooms {
void Room171::init() {
+ _flag1 = false;
+ _val1 = 0;
+
+ if (_G(flags)[V092]) {
+ hotspot_set_active("AUNT POLLY", false);
+ } else {
+ switch (_G(game).previous_room) {
+ case 170:
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V084] && _G(flags)[V085] && _G(flags)[V086]) {
+ loadSeries1();
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ } else {
+ while (!_val1) {
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ if (!_G(flags)[V083]) {
+ _val1 = 10019;
+ loadSeries2();
+ _val2 = 5;
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
+ case 2:
+ _val1 = 10021;
+ loadSeries3();
+ digi_preload("171_002");
+ digi_play_loop("171_002", 2);
+ break;
+
+ case 3:
+ if (!_G(flags)[V085]) {
+ _val1 = 10020;
+ loadSeries4();
+
+ if (imath_rand_bool(2)) {
+ digi_preload("171_013a");
+ digi_play_loop("171_013a", 2, 255);
+ } else {
+ digi_preload("171_013b");
+ digi_play_loop("171_013b", 2, 255);
+ }
+ }
+ break;
+
+ case 4:
+ if (!_G(flags)[V086]) {
+ _val1 = 10022;
+ loadSeries5();
+ _val2 = 20;
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ break;
+
+ case 175:
+ if (!_G(flags)[V092]) {
+ if (_G(flags)[V086]) {
+ loadSeries1();
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ } else {
+ _val1 = 10022;
+ loadSeries5();
+ kernel_trigger_dispatch_now(6);
+ }
+ }
+ break;
+
+ default:
+ loadSeries1();
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ break;
+ }
+ }
+
+ _series3 = series_show("171pills", 0x700);
+
+ if (_val1 || _G(flags)[V092]) {
+ _chair1 = series_show("171chair", 0x900);
+ _chair2 = series_show("171chars", 0x901);
+ }
+
+ hotspot_set_active("PIANO STOOL", false);
+ hotspot_set_active("PIANO STOOL ", false);
+
+ if (_val1 == 10020 || _val1 == 10019) {
+ hotspot_set_active("PIANO STOOL ", true);
+ intr_add_no_walk_rect(378, 300, 518, 354, 377, 355, _G(screenCodeBuff)->get_buffer());
+
+ if (_val1 == 10020) {
+ series_show("171stool", 0x300);
+ series_show("171stols", 0x301);
+ }
+ } else {
+ series_show("171st02", 0x100);
+ hotspot_set_active("PIANO STOOL", true);
+ }
+
+ _lid = series_show("171plid", 0);
+
+ if (_val1 != 10022)
+ series_show("171phone", 0x700);
+
+ switch (_G(game).previous_room) {
+ case 170:
+ ws_demand_location(84, 275, 3);
+
+ if (_G(flags)[V092] || (_G(flags)[V083] && _G(flags)[V084] &&
+ _G(flags)[V085] && _G(flags)[V086])) {
+ ws_walk(134, 275, nullptr, -1);
+ } else {
+ ws_walk(134, 275, nullptr, 6);
+ }
+ break;
+
+ case 172:
+ ws_demand_location(639, 289, 9);
+ ws_walk(541, 295, nullptr, -1);
+ break;
+
+ case 175:
+ ws_demand_location(237, 232, 9);
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ ws_demand_location(324, 319, 5);
+ break;
+ }
}
void Room171::daemon() {
@@ -40,6 +181,58 @@ void Room171::pre_parser() {
void Room171::parser() {
}
+void Room171::loadSeries1() {
+ series_load("171ap11");
+ series_load("171ap12");
+ series_load("171ap13");
+ series_load("171ap11s");
+ series_load("171ap12s");
+ series_load("171ap13s");
+ digi_preload("171_009");
+}
+
+void Room171::loadSeries2() {
+ series_load("171ap01");
+ series_load("171ap02");
+ series_load("171ap03");
+ series_load("171ap01s");
+ series_load("171ap02s");
+ series_load("171ap03s");
+ loadSeries1();
+}
+
+void Room171::loadSeries3() {
+ series_load("171ap04");
+ series_load("171ap05");
+ series_load("171ap06");
+ series_load("171ap04s");
+ series_load("171ap05s");
+ series_load("171ap06s");
+ loadSeries1();
+}
+
+void Room171::loadSeries4() {
+ series_load("171ap07");
+ series_load("171ap08");
+ series_load("171ap09");
+ series_load("171ap09s");
+ loadSeries1();
+}
+
+void Room171::loadSeries5() {
+ series_load("171ap10");
+ series_load("171ap10s");
+ loadSeries1();
+}
+
+void Room171::freeSeries() {
+ if (_series1)
+ terminateMachineAndNull(_series1);
+ if (_series2)
+ terminateMachineAndNull(_series2);
+}
+
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room171.h b/engines/m4/burger/rooms/section1/room171.h
index 7753233cc04..e40495c26da 100644
--- a/engines/m4/burger/rooms/section1/room171.h
+++ b/engines/m4/burger/rooms/section1/room171.h
@@ -29,6 +29,24 @@ namespace Burger {
namespace Rooms {
class Room171 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_chair1 = nullptr;
+ machine *_chair2 = nullptr;
+ machine *_lid = nullptr;
+ bool _flag1 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+
+ void loadSeries1();
+ void loadSeries2();
+ void loadSeries3();
+ void loadSeries4();
+ void loadSeries5();
+ void freeSeries();
+
public:
Room171() : Room() {}
~Room171() override {}
Commit: 3e843f6526ccfb5c7bf73592975ac582e7507399
https://github.com/scummvm/scummvm/commit/3e843f6526ccfb5c7bf73592975ac582e7507399
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Simplifying static arrays
Changed paths:
engines/m4/burger/core/play_break.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index 67a05450e67..a3d7f963935 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -38,7 +38,7 @@ struct seriesPlayBreak {
int32 trigger;
uint32 flags;
int32 loopCount;
- int *variable;
+ long *variable;
int32 value;
};
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 4cd04448cbc..22a3369d792 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -28,8 +28,6 @@
namespace M4 {
namespace Burger {
-#define FLAGS_COUNT 512
-
struct BoonsvilleRec {
int32 _time;
int32 _trigger;
@@ -57,8 +55,10 @@ static const BoonsvilleRec ARRAY[] = {
{ 0, 0, nullptr }
};
+long Flags::_flags[FLAGS_COUNT];
+
Flags::Flags() {
- resize(FLAGS_COUNT);
+ Common::fill(_flags, _flags + FLAGS_COUNT, 0);
}
void Flags::sync(Common::Serializer &s) {
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index b9b936a5f53..87b5fb88f08 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -29,6 +29,8 @@
namespace M4 {
namespace Burger {
+#define FLAGS_COUNT 512
+
enum {
V000 = 0,
V001 = 1,
@@ -549,9 +551,12 @@ enum {
V511 = 511
};
-class Flags : public Common::Array<long> {
+class Flags {
private:
Common::Array<byte> _convSave;
+public:
+ static long _flags[FLAGS_COUNT];
+
public:
Flags();
@@ -580,6 +585,14 @@ public:
* Save/load values to a save file
*/
void sync(Common::Serializer &s);
+
+ size_t size() const {
+ return FLAGS_COUNT;
+ }
+ long &operator[](uint idx) {
+ assert(idx < FLAGS_COUNT);
+ return _flags[idx];
+ }
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 9f815fa7267..291dbfd6089 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -50,6 +50,13 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const WilburMatch Room106::MATCH[] = {
+ { "JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_val1, 2 },
+ { "JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_val1, 2 },
+ { "JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_val1, 2 },
+ WILBUR_MATCH_END
+};
+
const seriesPlayBreak Room106::PLAY1[] = {
{ 0, -1, "106d003a", 2, 255, -1, 0, 0, &_val3, 1 },
{ 0, -1, "106d003b", 2, 255, -1, 0, 0, &_val3, 2 },
@@ -113,7 +120,8 @@ const seriesPlayBreak Room106::PLAY7[] = {
PLAY_BREAK_END
};
-int Room106::_val3;
+long Room106::_val1;
+long Room106::_val3;
void Room106::preload() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
@@ -123,11 +131,6 @@ void Room106::preload() {
void Room106::init() {
_val3 = 0;
- _MATCH.clear();
- _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_val1, 2));
- _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_val1, 2));
- _MATCH.push_back(WilburMatch("JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_val1, 2));
-
digi_preload("100_001");
digi_preload("106_101");
_digi1 = "100_001";
@@ -373,7 +376,7 @@ void Room106::parser() {
if (player_said_any("GEAR", "LOOK AT") && player_said("MAIN STREET")) {
disable_player_commands_and_fade_init(1001);
_G(player).command_ready = false;
- } else if (_G(walker).wilbur_match(_MATCH)) {
+ } else if (_G(walker).wilbur_match(MATCH)) {
_G(player).command_ready = false;
}
}
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index 3f67e5ed1d0..b814ec7e3ce 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -30,6 +30,7 @@ namespace Burger {
namespace Rooms {
class Room106 : public Room {
+ static const WilburMatch MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
@@ -38,11 +39,10 @@ class Room106 : public Room {
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
private:
- Common::Array<WilburMatch> _MATCH;
const char *_digi1 = nullptr;
- int _val1 = 0;
+ static long _val1;
int _val2 = 0;
- static int _val3;
+ static long _val3;
void setHotspots();
void loadSeries();
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 572d32bdb63..42abc88b5ee 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -29,7 +29,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-static const char *SAID1[][4] = {
+static const char *SAID[][4] = {
{ "VERA'S DINER", "142w001", "142w002", "142w002" },
{ "CAR", "142w003", nullptr, "142w004" },
{ "FANBELT", "142w005", nullptr, "142w002" },
@@ -49,6 +49,17 @@ static const char *SAID1[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const WilburMatch Room142::_MATCH[] = {
+ { "GEAR", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
+ { "LOOK AT", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
+ { "GEAR", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
+ { "LOOK AT", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
+ { "GEAR", "ICE BOX", gCHANGE_WILBUR_ANIMATION, &_G(flags)[V059], 0, &Vars::_wilbur_should, 1 },
+ { "TAKE", "FANBELT", gCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
+ { "GEAR", "BACK DOOR", 6, nullptr, 0, nullptr, 0 },
+ WILBUR_MATCH_END
+};
+
const seriesPlayBreak Room142::PLAY1[] = {
{ 8, 12, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
{ 8, 12, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
@@ -146,9 +157,9 @@ const seriesPlayBreak Room142::PLAY14[] = {
};
-int Room142::_val1;
-int Room142::_val2;
-int Room142::_val3;
+long Room142::_val1;
+long Room142::_val2;
+long Room142::_val3;
Room142::Room142() : Room() {
_val1 = 0;
@@ -157,22 +168,6 @@ Room142::Room142() : Room() {
}
void Room142::init() {
- _MATCH.clear();
- _MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 9,
- &_G(flags)[V000], 1003, &_val1, 18));
- _MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 9,
- &_G(flags)[V000], 1003, &_val1, 18));
- _MATCH.push_back(WilburMatch("GEAR", "PARKING LOT", 5,
- &_G(flags)[V058], 0, &_val2, 13));
- _MATCH.push_back(WilburMatch("LOOK AT", "PARKING LOT", 5,
- &_G(flags)[V058], 0, &_val2, 13));
- _MATCH.push_back(WilburMatch("GEAR", "ICE BOX", gCHANGE_WILBUR_ANIMATION,
- &_G(flags)[V059], 0, &_G(wilbur_should), 1));
- _MATCH.push_back(WilburMatch("TAKE", "FANBELT", gCHANGE_WILBUR_ANIMATION,
- nullptr, 0, &_G(wilbur_should), 9));
- _MATCH.push_back(WilburMatch("GEAR", "BACK DOOR", 6,
- nullptr, 0, nullptr, 0));
-
digi_preload("142_004");
digi_play_loop("142_004", 3, 255, -1);
@@ -672,7 +667,7 @@ void Room142::pre_parser() {
void Room142::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (!_G(walker).wilbur_said(SAID1)) {
+ if (!_G(walker).wilbur_said(SAID)) {
if (player_said_any("GEAR", "LOOK AT") && player_said("HANLON'S POINT")) {
disable_player_commands_and_fade_init(1012);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 161b37c67f7..3550d6dbd5c 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -30,6 +30,7 @@ namespace Burger {
namespace Rooms {
class Room142 : public Room {
+ static const WilburMatch _MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
@@ -45,7 +46,6 @@ class Room142 : public Room {
static const seriesPlayBreak PLAY13[];
static const seriesPlayBreak PLAY14[];
private:
- Common::Array<WilburMatch> _MATCH;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
@@ -58,9 +58,9 @@ private:
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
int _volume = 0;
- static int _val1;
- static int _val2;
- static int _val3;
+ static long _val1;
+ static long _val2;
+ static long _val3;
int _val4 = 0;
void checkAction();
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index af312aa35a8..ccd7f3c3338 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -37,6 +37,7 @@ namespace Burger {
Vars *g_vars;
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
+long Vars::_wilbur_should = 0;
/**
* Structure for accented character replacement
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 5060d7b9092..17a42b26608 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -85,6 +85,9 @@ private:
protected:
void main_cold_data_init() override;
+public:
+ // These are defined as statics because they're referenced in data arrays
+ static long _wilbur_should;
public:
Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
@@ -102,7 +105,6 @@ public:
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
- int _wilbur_should = 0;
int _roomVal2 = 0;
int _roomVal3 = 0;
int _walkTrigger = 0;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 99befdb15e9..c5c0ac20c41 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -367,9 +367,9 @@ bool Walker::wilbur_parser(const char **list) {
return false;
}
-bool Walker::wilbur_match(const Common::Array<WilburMatch> &list) {
- for (uint idx = 0; idx < list.size(); ++idx) {
- const WilburMatch &m = list[idx];
+bool Walker::wilbur_match(const WilburMatch *list) {
+ for (; list->_word0 || list->_word1; ++list) {
+ const WilburMatch &m = *list;
if (player_said(m._word0, m._word1)) {
term_message("matched %s and %s", m._word0, m._word1);
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index e9a174a9938..edaf3ea7daf 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -30,23 +30,17 @@ namespace M4 {
namespace Burger {
struct WilburMatch {
- const char *_word0 = nullptr;
- const char *_word1 = nullptr;
- int _trigger = -1;
- const long *_testVariable = nullptr;
- int _testValue = 0;
- int *_newVariable = nullptr;
- int _newValue = 0;
-
- WilburMatch() {}
- WilburMatch(const char *word0, const char *word1, int trigger,
- const long *testVariable, int testValue, int *newVariable,
- int newValue) : _word0(word0), _word1(word1),
- _trigger(trigger), _testVariable(testVariable),
- _testValue(testValue), _newVariable(newVariable),
- _newValue(newValue) {}
+ const char *_word0;
+ const char *_word1;
+ int _trigger;
+ const long *_testVariable;
+ int _testValue;
+ long *_newVariable;
+ int _newValue;
};
+#define WILBUR_MATCH_END { nullptr, nullptr, -1, nullptr, 0, nullptr, 0 }
+
class Walker : public M4::Walker {
private:
const char *_name = nullptr;
@@ -120,7 +114,7 @@ public:
bool wilbur_parser(const char **list);
- bool wilbur_match(const Common::Array<WilburMatch> &list);
+ bool wilbur_match(const WilburMatch *list);
void wilbur_poof();
void wilbur_unpoof();
Commit: aa98975976b03d3e11c4cdffc9dc9056d8873366
https://github.com/scummvm/scummvm/commit/aa98975976b03d3e11c4cdffc9dc9056d8873366
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 171 methods
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room171.h
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 42abc88b5ee..8263a909206 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -49,7 +49,7 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
-const WilburMatch Room142::_MATCH[] = {
+const WilburMatch Room142::MATCH[] = {
{ "GEAR", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
{ "LOOK AT", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
{ "GEAR", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
@@ -674,7 +674,7 @@ void Room142::parser() {
disable_player_commands_and_fade_init(1015);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("AUNT POLLY'S HOUSE")) {
disable_player_commands_and_fade_init(1017);
- } else if (!_G(walker).wilbur_match(_MATCH)) {
+ } else if (!_G(walker).wilbur_match(MATCH)) {
return;
}
}
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 3550d6dbd5c..0c0299a1d82 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -30,7 +30,7 @@ namespace Burger {
namespace Rooms {
class Room142 : public Room {
- static const WilburMatch _MATCH[];
+ static const WilburMatch MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index a95475f2ba8..29fdbd1351e 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -28,6 +28,146 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "AUNT POLLY", "171w001", "171w002", "171w002" },
+ { "FRONT DOOR", "171w003", "171w002", nullptr },
+ { "KITCHEN", nullptr, "171w002", nullptr },
+ { "STAIRS", "171w004", "171w002", nullptr },
+ { "FIREPLACE", nullptr, "171w002", "171w005" },
+ { "KINDLING ", "171w006", "171w007", "171w007" },
+ { "WINDOW", "171w008", "171w002", "171w009" },
+ { "TELEPHONE", "171w010", "171w011", "171w012" },
+ { "ARMCHAIR", "171w013", "171w014", "171w015" },
+ { "PIANO", "171w019", "171w020", "171w021" },
+ { "PICTURE", "171w022", "171w023", "171w024" },
+ { "PICTURE ", "171w025", "171w023", nullptr },
+ { "PAINTING", "171w026", "171w027", nullptr },
+ { "CLOCK", "171w028", "171w029", "171w030" },
+ { "PILLS", "171w031", "171w032", "171w033" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room171::PLAY1[] = {
+ { 0, 2, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 3, 6, "171_014a", 1, 100, -1, 0, 0, 0, 0 },
+ { 7, 12, "171_014b", 1, 100, -1, 0, 0, 0, 0 },
+ { 13, 18, "171_014a", 1, 100, -1, 0, 0, 0, 0 },
+ { 19, 22, "171_014b", 1, 100, -1, 0, 0, 0, 0 },
+ { 23, 27, "171_014a", 1, 100, -1, 0, 0, 0, 0 },
+ { 28, 32, "171_014b", 1, 100, -1, 0, 0, 0, 0 },
+ { 33, 39, "171_014a", 1, 100, -1, 0, 0, 0, 0 },
+ { 40, -1, "171_014b", 1, 100, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY2[] = {
+ { 0, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 1, 6, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 7, 12, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 13, 17, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 18, 22, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 24, 29, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 30, 35, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 36, 40, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 41, -1, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
+ { 1, 6, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 7, 12, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 13, 17, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 18, 22, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 24, 29, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 30, 35, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 36, 40, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ { 41, -1, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY3[] = {
+ { 0, 4, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 5, 16, 0, 0, 0, 3, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY4[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY5[] = {
+ { 0, -1, "171_001", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY6[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY7[] = {
+ { 0, -1, 0, 2, 0, -1, 2048, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY8[] = {
+ { 0, 4, "171_011", 2, 255, -1, 0, 0, 0, 0 },
+ { 5, 19, 0, 0, 0, 3, 0, 0, 0, 0 },
+ { 20, 25, "171_012", 2, 255, -1, 0, 0, 0, 0 },
+ { 26, 33, "171_010", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY9[] = {
+ { 34, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY10[] = {
+ { 7, 8, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 8, 8, 0, 0, 0, -1, 0, 2, 0, 0 },
+ { 7, 8, 0, 0, 0, -1, 2, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY11[] = {
+ { 7, 12, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 13, -1, "171_006", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY12[] = {
+ { 0, 4, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 4, 4, 0, 0, 0, -1, 0, 10, 0, 0 },
+ { 0, 4, 0, 0, 0, -1, 2, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY13[] = {
+ { 0, -1, 0, 0, 0, -1, 1, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY14[] = {
+ { 0, 17, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 18, -1, "171_004", 2, 255, -1, 0, 0, 0, 0 },
+ { 0, 11, 0, 0, 0, -1, 2, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY15[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY16[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room171::PLAY17[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room171::init() {
_flag1 = false;
_val1 = 0;
@@ -102,7 +242,7 @@ void Room171::init() {
} else {
_val1 = 10022;
loadSeries5();
- kernel_trigger_dispatch_now(6);
+kernel_trigger_dispatch_now(6);
}
}
break;
@@ -148,7 +288,7 @@ void Room171::init() {
ws_demand_location(84, 275, 3);
if (_G(flags)[V092] || (_G(flags)[V083] && _G(flags)[V084] &&
- _G(flags)[V085] && _G(flags)[V086])) {
+ _G(flags)[V085] && _G(flags)[V086])) {
ws_walk(134, 275, nullptr, -1);
} else {
ws_walk(134, 275, nullptr, 6);
@@ -176,9 +316,75 @@ void Room171::daemon() {
}
void Room171::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if ((_val1 == 10019 || _val1 == 10020) &&
+ _G(player).walk_x > 378 && _G(player).walk_x <= 518 &&
+ _G(player).walk_y >= 300 && _G(player).walk_y <= 354) {
+ player_walk_to(_G(hotspot_x), 355);
+ }
+
+ if (player_said("GEAR") && player_said("FRONT DOOR")) {
+ player_set_facing_at(94, 281);
+
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
+ player_set_facing_at(601, 296);
+
+ } else if (player_said("GEAR", "FRONT DOOR")) {
+ frontDoor();
+ _G(kernel).call_daemon_every_loop = true;
+ _G(player).command_ready = false;
+ }
}
void Room171::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Do nothing
+ } else if (player_said("conv40")) {
+ conv40();
+
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
+ if (_G(flags)[V091]) {
+ disable_player_commands_and_fade_init(1019);
+ } else {
+ player_set_commands_allowed(false);
+ _val2 = 30;
+ }
+
+ } else if (player_said("GEAR", "STAIRS")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("WHISTLE", "AUNT POLLY")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ wilbur_speech("171w901", gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("TALK", "AUNT POLLY")) {
+ kernel_trigger_dispatch_now(6);
+
+ } else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
+ player_set_commands_allowed(false);
+ _digi1 = "171p901";
+ _val2 = 28;
+
+ } else if (player_said("ROCKER")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech(_G(flags)[V092] ? "171w017" : "171w016");
+
+ } else if (player_said("GEAR")) {
+ wilbur_speech(_G(flags)[V092] ? "171w015" : "171w018");
+
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
void Room171::loadSeries1() {
@@ -232,6 +438,155 @@ void Room171::freeSeries() {
terminateMachineAndNull(_series2);
}
+void Room171::frontDoor() {
+ if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR"))
+ _doorFlag = true;
+
+ if (_doorFlag) {
+ player_update_info();
+
+ if (_G(player_info).x < 94 && _G(player_info).y < 281 && player_commands_allowed())
+ disable_player_commands_and_fade_init(1017);
+ }
+}
+
+void Room171::conv40() {
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (!conv_sound_to_play())
+ return;
+
+ if (who == 1) {
+ wilbur_speech(conv_sound_to_play(), 10001);
+
+ switch (node) {
+ case 6:
+ if (entry <= 0 || (entry == 6 || entry == 7))
+ _val2 = 36;
+ break;
+
+ case 7:
+ _val2 = 36;
+ break;
+
+ case 10:
+ if (entry == 0)
+ _val2 = 36;
+ break;
+
+ case 15:
+ if (entry == 1 || entry == 2 || entry == 5)
+ _val2 = 36;
+ break;
+
+ default:
+ break;
+ }
+
+ } else {
+ switch (node) {
+ case 1:
+ switch (entry) {
+ case 0:
+ _val2 = 6;
+ break;
+ case 1:
+ _val2 = 7;
+ break;
+ case 2:
+ _val2 = 8;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 2:
+ switch (entry) {
+ case 0:
+ _val2 = 11;
+ break;
+ case 1:
+ _val2 = 12;
+ break;
+ case 2:
+ _val2 = 13;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 3:
+ switch (entry) {
+ case 0:
+ _val2 = 15;
+ break;
+ case 1:
+ _val2 = 17;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 4:
+ switch (entry) {
+ case 0:
+ _val2 = 21;
+ break;
+ case 1:
+ _val2 = 22;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 5:
+ case 7:
+ _val2 = 34;
+ break;
+
+ case 6:
+ _val2 = (entry == 6) ? 33 : 34;
+ break;
+
+ case 8:
+ switch (entry) {
+ case 0:
+ _val2 = 33;
+ break;
+ case 1:
+ _val2 = 38;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 9:
+ _val2 = 34;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
} // namespace Rooms
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room171.h b/engines/m4/burger/rooms/section1/room171.h
index e40495c26da..2befaea2eec 100644
--- a/engines/m4/burger/rooms/section1/room171.h
+++ b/engines/m4/burger/rooms/section1/room171.h
@@ -29,6 +29,24 @@ namespace Burger {
namespace Rooms {
class Room171 : public Room {
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
@@ -36,7 +54,9 @@ private:
machine *_chair1 = nullptr;
machine *_chair2 = nullptr;
machine *_lid = nullptr;
+ const char *_digi1 = nullptr;
bool _flag1 = false;
+ bool _doorFlag = false;
int _val1 = 0;
int _val2 = 0;
@@ -46,6 +66,8 @@ private:
void loadSeries4();
void loadSeries5();
void freeSeries();
+ void frontDoor();
+ void conv40();
public:
Room171() : Room() {}
Commit: e74fbdc4203874ca3638d64fe819faa8158fe7e0
https://github.com/scummvm/scummvm/commit/e74fbdc4203874ca3638d64fe819faa8158fe7e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 171 daemon
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index a2da933d67d..f0124a43a8f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -304,7 +304,7 @@ void BurgerEngine::global_daemon() {
kernel_timing_trigger(300, 10007);
break;
- case gNONPLAYERS_SPEECH_FINISHED:
+ case gNPC_SPEECH_FINISHED:
if (_G(npcSpeech1))
terminateMachineAndNull(_G(npcSpeech1));
if (_G(npcSpeech2))
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index f99640a58ed..ba167ddf34e 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -33,6 +33,39 @@ void Room::parser_code() {
warning("TODO: global_parser_code");
}
+void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
+ int layer, int channel, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
+ term_message("npc_say: %s npc_series: %s npc_trigger: %d",
+ digiName, seriesName, trigger);
+
+ _G(npcTrigger) = trigger;
+
+ if (seriesName) {
+ _G(npcSpeech1) = series_play(seriesName, layer, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
+
+ if (channel) {
+ char temp[20];
+ strcpy_s(temp, 20, seriesName);
+ strcat_s(temp, 20, "s");
+ _G(npcSpeech2) = series_play(temp, layer + 1, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
+ }
+ }
+
+ kernel_trigger_dispatch_now(gNPC_SPEECH_STARTED);
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ digi_play(digiName, digiSlot, digiVol, gNPC_SPEECH_FINISHED);
+
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void Room::npc_say(int trigger, const char *seriesName, int layer, int channel,
+ int firstFrame, int lastFrame, int digiSlot, int digiVol) {
+ npc_say(conv_sound_to_play(), trigger, seriesName, layer, channel,
+ firstFrame, lastFrame, digiSlot, digiVol);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 2eb86ae4047..ca2b664c76e 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -44,6 +44,13 @@ public:
void parser_code() override;
void compact_mem_and_report() {}
+
+ void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
+ int layer = 0, int channel = 1, int firstFrame = 0, int lastFrame = -1,
+ int digiSlot = 1, int digiVol = 255);
+ void npc_say(int trigger = -1, const char *seriesName = nullptr,
+ int layer = 0, int channel = 1, int firstFrame = 0, int lastFrame = -1,
+ int digiSlot = 1, int digiVol = 255);
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 29fdbd1351e..f1bcf7ef6c7 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -313,6 +313,160 @@ kernel_trigger_dispatch_now(6);
}
void Room171::daemon() {
+ switch (_G(kernel).trigger) {
+ case 2:
+ disable_player_commands_and_fade_init(1022);
+ break;
+
+ case 5:
+ switch (_val2) {
+ case 5:
+ digi_play_loop("171_003", 2);
+ _series1 = series_play("171ap01", 0x300);
+ _series2 = series_play("171ap01s", 0x301);
+ break;
+
+ case 6:
+ npc_say(conv_sound_to_play(), 10001, "171ap01n", 0x2ff);
+ break;
+
+ case 7:
+ digi_stop(2);
+ freeSeries();
+ series_play_with_breaks(PLAY3, "171ap02", 0x300, 10001, 3);
+ break;
+
+ case 8:
+ _val2 = 9;
+ npc_say(conv_sound_to_play(), 5, "171ap02", 0x300, 1, 17, 22);
+ break;
+
+ case 9:
+ freeSeries();
+ _val2 = 10;
+ series_play_with_breaks(PLAY4, "171ap03", 0x300, 5, 3);
+ break;
+
+ case 10:
+ _G(flags)[V083] = 1;
+ terminateMachineAndNull(_chair1);
+ terminateMachineAndNull(_chair2);
+
+ series_show("171stool", 0x300);
+ series_show("171stols", 0x301);
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 11:
+ npc_say(10001);
+ break;
+
+ case 12:
+ digi_stop(2);
+ npc_say();
+ series_play_with_breaks(PLAY5, "171ap04", 0x800, 10001, 3);
+ break;
+
+ case 13:
+ _val2 = 14;
+ npc_say(5, "171ap05", 0x800);
+ break;
+
+ case 14:
+ _G(flags)[V084] = 1;
+ terminateMachineAndNull(_chair1);
+ terminateMachineAndNull(_chair1);
+ _val2 = 26;
+ series_play_with_breaks(PLAY6, "171ap06", 0x800, 5, 3);
+ break;
+
+ case 15:
+ terminateMachineAndNull(_lid);
+ _val2 = 16;
+ series_play_with_breaks(PLAY7, "171ap07", 0, 6, 2);
+ break;
+
+ case 16:
+ npc_say(10001, "171ap08");
+ break;
+
+ case 17:
+ freeSeries();
+ _val2 = 18;
+ series_play_with_breaks(PLAY8, "171ap09", 0, 5, 3);
+ break;
+
+ case 18:
+ _val2 = 19;
+ series_play_with_breaks(PLAY9, "171ap09", 0x301, 5, 3);
+ series_show("171plid", 0);
+ break;
+
+ case 19:
+ _G(flags)[V085] = 1;
+ terminateMachineAndNull(_chair1);
+ terminateMachineAndNull(_chair2);
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 20:
+ _series1 = series_show("171ap10", 0x700);
+ _series2 = series_show("171ap10s", 0x701);
+ break;
+
+ case 21:
+ freeSeries();
+ npc_say(10001, "171ap10", 0x700);
+ break;
+
+ case 22:
+ npc_say(5);
+ series_play_with_breaks(PLAY10, "171ap10", 0x700, 5, 3);
+ break;
+
+ case 23:
+ _val2 = 24;
+ _series1 = series_play("171ap10", 0x700);
+ _series2 = series_play("171ap10s", 0x701);
+ break;
+
+ case 24:
+ freeSeries();
+ _val2 = 25;
+ series_play_with_breaks(PLAY11, "171ap10", 0x700, 5, 3);
+ break;
+
+ case 25:
+ _G(flags)[V086] = 1;
+ terminateMachineAndNull(_chair1);
+ terminateMachineAndNull(_chair2);
+ series_show("171phone", 0x700);
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 26:
+ player_update_info();
+
+ if (_flag1 && (_G(player_info).x != 436 || _G(player_info).y != 288))
+ ws_walk(436, 288, 0, 10001, 2);
+
+ digi_play_loop("171_009", 2, 50);
+ // TODO
+ break;
+
+ default:
+ // TODO
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room171::pre_parser() {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 17a42b26608..1f06ca340a4 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -52,7 +52,8 @@ enum global_triggers {
gSERIES_PLAY_BREAK_2 = 10005,
gRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
- gNONPLAYERS_SPEECH_FINISHED = 10011, // digi_play trigger, used in talk.cpp
+ gNPC_SPEECH_STARTED = 10010, // NPC talk started
+ gNPC_SPEECH_FINISHED = 10011, // NPC talk finished
g10013 = 10013,
gWILBURS_SPEECH_FINISHED = 10014,
gWILBURS_SPEECH_START = 10015,
Commit: 95ceee7e9b97b56bdbd347edaf0d23f1002018d5
https://github.com/scummvm/scummvm/commit/95ceee7e9b97b56bdbd347edaf0d23f1002018d5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 171 daemon
Changed paths:
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room171.h
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/vars.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index ba167ddf34e..5263fed1b8f 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -34,7 +34,7 @@ void Room::parser_code() {
}
void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
- int layer, int channel, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
+ int layer, bool shadow, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
term_message("npc_say: %s npc_series: %s npc_trigger: %d",
digiName, seriesName, trigger);
@@ -43,7 +43,7 @@ void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
if (seriesName) {
_G(npcSpeech1) = series_play(seriesName, layer, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
- if (channel) {
+ if (shadow) {
char temp[20];
strcpy_s(temp, 20, seriesName);
strcat_s(temp, 20, "s");
@@ -60,9 +60,9 @@ void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
_G(kernel).trigger_mode = oldMode;
}
-void Room::npc_say(int trigger, const char *seriesName, int layer, int channel,
+void Room::npc_say(int trigger, const char *seriesName, int layer, bool shadow,
int firstFrame, int lastFrame, int digiSlot, int digiVol) {
- npc_say(conv_sound_to_play(), trigger, seriesName, layer, channel,
+ npc_say(conv_sound_to_play(), trigger, seriesName, layer, shadow,
firstFrame, lastFrame, digiSlot, digiVol);
}
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index ca2b664c76e..5853bbf5d1f 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -46,10 +46,10 @@ public:
void compact_mem_and_report() {}
void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
- int layer = 0, int channel = 1, int firstFrame = 0, int lastFrame = -1,
+ int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
int digiSlot = 1, int digiVol = 255);
void npc_say(int trigger = -1, const char *seriesName = nullptr,
- int layer = 0, int channel = 1, int firstFrame = 0, int lastFrame = -1,
+ int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
int digiSlot = 1, int digiVol = 255);
};
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index 285df1e41fd..5a0e2f1270a 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -132,7 +132,7 @@ void Section::init_series_players() {
void Section::tick() {
int oldTrigger = _G(kernel).trigger;
- _G(kernel).trigger = CALLED_EACH_LOOP;
+ _G(kernel).trigger = gCALLED_EACH_LOOP;
g_engine->game_daemon_code();
_G(kernel).trigger = oldTrigger;
}
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 8263a909206..33a0b291eec 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -576,7 +576,7 @@ void Room142::daemon() {
}
break;
- case CALLED_EACH_LOOP:
+ case gCALLED_EACH_LOOP:
if (_actionType == 0) {
_G(kernel).call_daemon_every_loop = false;
} else {
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index c66ee0f29e3..7cebd5ecc1a 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -148,7 +148,7 @@ void Room170::daemon() {
}
break;
- case CALLED_EACH_LOOP:
+ case gCALLED_EACH_LOOP:
term_message("Calling daemon each loop..............");
if (_lookTownHall) {
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index f1bcf7ef6c7..0abbe5b4798 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -258,8 +258,7 @@ kernel_trigger_dispatch_now(6);
_series3 = series_show("171pills", 0x700);
if (_val1 || _G(flags)[V092]) {
- _chair1 = series_show("171chair", 0x900);
- _chair2 = series_show("171chars", 0x901);
+ _chair.show("171chair", 0x900);
}
hotspot_set_active("PIANO STOOL", false);
@@ -314,16 +313,32 @@ kernel_trigger_dispatch_now(6);
void Room171::daemon() {
switch (_G(kernel).trigger) {
+ case 1:
+ disable_player_commands_and_fade_init(1019);
+ break;
+
case 2:
disable_player_commands_and_fade_init(1022);
break;
+ case 3:
+ npc_say();
+ break;
+
+ case 4:
+ if (_val2 == 28 || _val2 == 36 || _val2 == 34 || _val2 == 33 ||
+ _val2 == 38 || _val2 == 30) {
+ digi_stop(2);
+ freeSeries();
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
case 5:
switch (_val2) {
case 5:
digi_play_loop("171_003", 2);
- _series1 = series_play("171ap01", 0x300);
- _series2 = series_play("171ap01s", 0x301);
+ _series.play("171ap01", 0x300);
break;
case 6:
@@ -349,8 +364,7 @@ void Room171::daemon() {
case 10:
_G(flags)[V083] = 1;
- terminateMachineAndNull(_chair1);
- terminateMachineAndNull(_chair2);
+ _chair.terminate();
series_show("171stool", 0x300);
series_show("171stols", 0x301);
@@ -375,8 +389,7 @@ void Room171::daemon() {
case 14:
_G(flags)[V084] = 1;
- terminateMachineAndNull(_chair1);
- terminateMachineAndNull(_chair1);
+ _chair.terminate();
_val2 = 26;
series_play_with_breaks(PLAY6, "171ap06", 0x800, 5, 3);
break;
@@ -405,15 +418,13 @@ void Room171::daemon() {
case 19:
_G(flags)[V085] = 1;
- terminateMachineAndNull(_chair1);
- terminateMachineAndNull(_chair2);
+ _chair.terminate();
_val2 = 26;
kernel_trigger_dispatch_now(5);
break;
case 20:
- _series1 = series_show("171ap10", 0x700);
- _series2 = series_show("171ap10s", 0x701);
+ _series.show("171ap10", 0x700);
break;
case 21:
@@ -428,8 +439,7 @@ void Room171::daemon() {
case 23:
_val2 = 24;
- _series1 = series_play("171ap10", 0x700);
- _series2 = series_play("171ap10s", 0x701);
+ _series.play("171ap10", 0x700);
break;
case 24:
@@ -440,8 +450,7 @@ void Room171::daemon() {
case 25:
_G(flags)[V086] = 1;
- terminateMachineAndNull(_chair1);
- terminateMachineAndNull(_chair2);
+ _chair.terminate();
series_show("171phone", 0x700);
_val2 = 26;
kernel_trigger_dispatch_now(5);
@@ -454,13 +463,174 @@ void Room171::daemon() {
ws_walk(436, 288, 0, 10001, 2);
digi_play_loop("171_009", 2, 50);
- // TODO
+ _series.play("171ap11", 0x8ff, 32, 4);
+ break;
+
+ case 28:
+ _val2 = 29;
+ npc_say(_digi1, 5, "171ap13", 0x8fe);
+ break;
+
+ case 29:
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ player_set_commands_allowed(true);
+ break;
+
+ case 30:
+ _val2 = 32;
+ series_play_with_breaks(PLAY15, "171ap16", 0x8ff, 5, 3);
+ break;
+
+ case 31:
+ _val2 = 32;
+ series_play_with_breaks(PLAY16, "171ap17", 0x8ff, 5, 3);
+ break;
+
+ case 32:
+ _chair.show("171chair", "171chars", 0x900);
+ series_play_with_breaks(PLAY17, "171ap18", 0x400, 1, 3);
+ break;
+
+ case 33:
+ npc_say(10001, "171ap13", 0x8fe);
+ break;
+
+ case 34:
+ _val2 = 35;
+ npc_say(5, "171ap13", 0x8fe);
+ break;
+
+ case 35:
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ conv_resume_curr();
+ break;
+
+ case 36:
+ _val2 = 26;
+ series_play_with_breaks(PLAY12, "171ap12", 0x8ff, 5, 3);
+ break;
+
+ case 37:
+ series_play_with_breaks(PLAY13, "171ap14", 0x8ff, 5, 3);
+ break;
+
+ case 38:
+ _val2 = 39;
+ npc_say(5, "171ap13", 0x8fe);
+ break;
+
+ case 39:
+ _chair.show("171chair", "171chars", 0x900);
+
+ if (_series3)
+ terminateMachineAndNull(_series3);
+
+ series_play_with_breaks(PLAY14, "171ap15", 0x700, 5, 2, 8);
+ break;
+
+ case 40:
+ _chair.terminate();
+ _series3 = series_show("171pills", 0x700);
+ _val2 = 26;
+ kernel_trigger_dispatch_now(5);
+ conv_resume_curr();
break;
default:
- // TODO
+ term_message("ERROR!!!! polly_should not set!");
+ break;
+ }
+ break;
+
+ case 6:
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ _flag1 = true;
+ conv_load_and_prepare("conv40", 7);
+
+ switch (_val1) {
+ case 10019:
+ conv_export_value_curr(1, 0);
+ break;
+ case 10020:
+ conv_export_value_curr(3, 0);
+ break;
+ case 10021:
+ conv_export_value_curr(2, 0);
+ break;
+ case 10022:
+ conv_export_value_curr(4, 0);
+ break;
+ default:
+ conv_export_value_curr(0, 0);
break;
}
+
+ conv_export_value_curr(inv_player_has("WHISTLE") ? 1 : 0, 1);
+ conv_export_pointer_curr(&_G(flags)[V087], 2);
+ conv_export_pointer_curr(&_G(flags)[V088], 3);
+ conv_play_curr();
+ break;
+
+ case 7:
+ _val1 = 0;
+ _G(flags)[V298] = 0;
+ _G(flags)[V299] = 0;
+ _flag1 = false;
+ player_set_commands_allowed(true);
+ _val2 = 26;
+
+ if (_series) {
+ freeSeries();
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ series_play_with_breaks(PLAY1, "171wi01", 0xc01, 2, 3, 5);
+ break;
+
+ case 2:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY2, "171wi02", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5, 100, 0, -3);
+ break;
+
+ case 3:
+ if (_G(flags)[V087]) {
+ _digi1 = "171p903";
+ } else {
+ _digi1 = "1711p902";
+ _G(flags)[V087] = 1;
+ }
+
+ _val2 = 28;
+ break;
+
+ case 10001:
+ ws_unhide_walker();
+
+ if (_G(flags)[V092] || _G(flags)[V086])
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case gCALLED_EACH_LOOP:
+ if (_doorFlag) {
+ frontDoor();
+ } else {
+ _G(kernel).call_daemon_every_loop = false;
+ }
break;
default:
@@ -586,10 +756,7 @@ void Room171::loadSeries5() {
}
void Room171::freeSeries() {
- if (_series1)
- terminateMachineAndNull(_series1);
- if (_series2)
- terminateMachineAndNull(_series2);
+ _series.terminate();
}
void Room171::frontDoor() {
diff --git a/engines/m4/burger/rooms/section1/room171.h b/engines/m4/burger/rooms/section1/room171.h
index 2befaea2eec..64865721aa5 100644
--- a/engines/m4/burger/rooms/section1/room171.h
+++ b/engines/m4/burger/rooms/section1/room171.h
@@ -48,11 +48,9 @@ class Room171 : public Room {
static const seriesPlayBreak PLAY17[];
private:
- machine *_series1 = nullptr;
- machine *_series2 = nullptr;
+ Series _series;
+ Series _chair;
machine *_series3 = nullptr;
- machine *_chair1 = nullptr;
- machine *_chair2 = nullptr;
machine *_lid = nullptr;
const char *_digi1 = nullptr;
bool _flag1 = false;
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index 558df7ff8c1..e6ab92cc26d 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -37,7 +37,7 @@ void MenuRoom::init() {
void MenuRoom::daemon() {
- if (_G(kernel).trigger == CALLED_EACH_LOOP) {
+ if (_G(kernel).trigger == gCALLED_EACH_LOOP) {
if (player_commands_allowed())
buttonsFrame();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 1f06ca340a4..8fd170e9975 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -66,7 +66,7 @@ enum global_triggers {
gTELEPROTED2 = 10025,
g10028 = 10028,
- CALLED_EACH_LOOP = 32764,
+ gCALLED_EACH_LOOP = 32764,
gLAST_GLOBAL_TRIGGER
#if UNUSED
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index d2dad793538..4e3326e0501 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -30,6 +30,52 @@ namespace M4 {
#define CHECK_SERIES if (!_G(globals)) error_show(FL, 'SERI');
+void Series::play(const char *seriesName, frac16 layer, uint32 flags,
+ int16 triggerNum, int32 frameRate, int32 loopCount, int32 s,
+ int32 x, int32 y, int32 firstFrame, int32 lastFrame) {
+ _series = M4::series_play(seriesName, layer, flags, triggerNum, frameRate,
+ loopCount, s, x, y, firstFrame, lastFrame);
+ _seriesS = M4::series_play(seriesName, layer + 1, flags, -1, frameRate,
+ loopCount, s, x, y, firstFrame, lastFrame);
+}
+
+void Series::show(const char *seriesName, frac16 layer, uint32 flags,
+ int16 triggerNum, int32 duration, int32 index, int32 s, int32 x, int32 y) {
+ _series = M4::series_show(seriesName, layer, flags, triggerNum, duration,
+ index, s, x, y);
+ _seriesS = M4::series_show(seriesName, layer + 1, flags, -1, duration,
+ index, s, x, y);
+}
+
+void Series::show(const char *series1, const char *series2, int layer) {
+ _series = M4::series_show(series1, layer);
+ _seriesS = M4::series_show(series2, layer + 1);
+}
+
+void Series::series_play(const char *seriesName, frac16 layer, uint32 flags,
+ int16 triggerNum, int32 frameRate, int32 loopCount, int32 s,
+ int32 x, int32 y, int32 firstFrame, int32 lastFrame) {
+ Series tmp;
+ tmp.play(seriesName, layer, flags, triggerNum, frameRate,
+ loopCount, s, x, y, firstFrame, lastFrame);
+}
+
+void Series::series_show(const char *seriesName, frac16 layer, uint32 flags,
+ int16 triggerNum, int32 duration, int32 index, int32 s, int32 x, int32 y) {
+ Series tmp;
+ tmp.show(seriesName, layer, flags, triggerNum, duration,
+ index, s, x, y);
+}
+
+
+void Series::terminate() {
+ if (_series)
+ terminateMachineAndNull(_series);
+ if (_seriesS)
+ terminateMachineAndNull(_seriesS);
+}
+
+
static void series_trigger_dispatch_callback(frac16 myMessage, machine * /*sender*/) {
kernel_trigger_dispatchx(myMessage);
}
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index ae04cf99b04..51c356f9e36 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -52,6 +52,34 @@ enum {
HASH_STREAM_MACHINE = 6
};
+/**
+ * Since series are normally started in pairs, this simplifies doing so
+ */
+struct Series {
+ machine *_series = nullptr;
+ machine *_seriesS = nullptr;
+
+ void play(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
+ int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
+ void show(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
+ int32 x = 0, int32 y = 0);
+ void show(const char *series1, const char *series2, int layer);
+ void terminate();
+
+ operator bool() const {
+ return _series != nullptr;
+ }
+
+ static void series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
+ int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
+ static void series_show(const char *seriesName, frac16 layer, uint32 flags = 0,
+ int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
+ int32 x = 0, int32 y = 0);
+};
+
extern int32 series_load(const char *seriesName, int32 assetIndex = -1, RGB8 *myPal = nullptr);
extern void series_unload(int32 assetIndex);
extern bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
Commit: 2a2902557c0bae864649434753317dc60fb6b34e
https://github.com/scummvm/scummvm/commit/2a2902557c0bae864649434753317dc60fb6b34e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added chunkops methods
Changed paths:
engines/m4/adv_r/chunk_ops.cpp
engines/m4/adv_r/chunk_ops.h
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index b8cfbcb916b..f4fe3c79f38 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -21,10 +21,272 @@
#include "common/textconsole.h"
#include "m4/adv_r/chunk_ops.h"
+#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/vars.h"
namespace M4 {
+long conv_ops_text_strlen(char *s) {
+ long len = 0;
+ len = strlen(s) + 1; // Added +1 for null char.
+
+ if ((len % 4) == 0)
+ return len;
+
+ len += 4 - (len % 4);
+ return len;
+}
+
+static void conv_ops_unknown_chunk(long tag, const char *s) {
+ char *tag_name = nullptr;
+
+ tag_name = (char *)&tag;
+
+ error_show(FL, 'PARS', "'%s' What type is this chunk: %c%c%c%c ?", s, tag_name[3], tag_name[2], tag_name[1], tag_name[0]);
+}
+
+/*
+ * Find an entry and auto-advance the pointer past it.
+ */
+char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
+ long num_blocks = 0;
+ long j = 0, k = 0;
+ lnode_chunk *L;
+ node_chunk *N;
+ text_chunk *T;
+ w_reply_chunk *W;
+ conv_chunk *CC;
+ char *outChunk = nullptr;
+
+ if ((i + c->myCNode) > c->chunkSize) {
+ error_show(FL, 'PARS', "Conv pointer skipped past chunk EOF. Please check script and make sure HAG is up to date");
+ }
+
+ outChunk = &(c->conv[c->myCNode]);
+ *tag = *(long *)&outChunk[i];
+
+ if (_GC(swap))
+ *tag = convert_intel32(*tag);
+
+ switch (*tag) {
+ case C_ASGN_CHUNK:
+ //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
+ k = sizeof(c_assign_chunk);
+ break;
+
+ case ASGN_CHUNK:
+ //fprintf( conv_fp, "ASGN_CHUNK\n" );
+ k = sizeof(assign_chunk);
+ break;
+
+ case CONV_CHUNK:
+ //fprintf( conv_fp, "CONV_CHUNK\n" );
+ CC = (conv_chunk *)&outChunk[i];
+
+ j = CC->size; //oct11 was +=
+ break;
+
+ case DECL_CHUNK:
+ //fprintf( conv_fp, "DECL_CHUNK\n" );
+ k = sizeof(decl_chunk);
+ break;
+
+ case FALL_CHUNK:
+ //fprintf( conv_fp, "FALL_CHUNK\n" );
+ k = sizeof(fall_chunk);
+ break;
+
+ case LNODE_CHUNK:
+ //fprintf( conv_fp, "LNODE_CHUNK\n" );
+ L = (lnode_chunk *)&outChunk[i];
+
+ //oct11
+ k = sizeof(lnode_chunk);
+
+ if (_GC(swap)) {
+ j = convert_intel32(L->num_entries) * sizeof(long); //was +=
+ j = convert_intel32(j); //oct11
+ } else {
+ j = L->num_entries * sizeof(long); //was +=
+ }
+ break;
+
+ case NODE_CHUNK:
+ //fprintf( conv_fp, "NODE_CHUNK\n" );
+ N = (node_chunk *)&outChunk[i];
+
+ //oct11
+ k = sizeof(node_chunk);
+
+ if (_GC(swap)) {
+ j = convert_intel32(N->num_entries) * sizeof(long); //was +=
+ j = convert_intel32(j);
+ } else {
+ j = N->num_entries * sizeof(long); //was +=
+ }
+ break;
+
+ case ENTRY_CHUNK:
+ //fprintf( conv_fp, "ENTRY_CHUNK\n" );
+ k = sizeof(entry_chunk);
+ break;
+
+ case TEXT_CHUNK:
+ case MESSAGE_CHUNK:
+ //if( *tag == TEXT_CHUNK )
+ // fprintf( conv_fp, "MESSAGE_CHUNK\n" );
+ //if( *tag == TEXT_CHUNK )
+ // fprintf( conv_fp, "TEXT_CHUNK\n" );
+
+ T = (text_chunk *)&outChunk[i];
+ num_blocks = T->size;
+
+ k = sizeof(text_chunk);
+ j = num_blocks;
+
+ //fprintf( conv_fp, "%s\n", outChunk[i+j] );
+ break;
+
+ case REPLY_CHUNK:
+ //fprintf( conv_fp, "REPLY_CHUNK\n" );
+ k = sizeof(reply_chunk);
+ break;
+
+ case WEIGHT_REPLY_CHUNK:
+ //fprintf( conv_fp, "WREPLY_CHUNK\n" );
+ W = (w_reply_chunk *)&outChunk[i];
+ k = sizeof(w_reply_chunk);
+
+ if (_GC(swap)) {
+ j = convert_intel32(W->num_replies) * (2 * sizeof(long)); //was +=
+ j = convert_intel32(j);
+ } else {
+ j = W->num_replies * (2 * sizeof(long)); //was +=
+ }
+ break;
+
+ case WEIGHT_PREPLY_CHUNK:
+ //fprintf( conv_fp, "WREPLY_CHUNK\n" );
+ W = (w_reply_chunk *)&outChunk[i];
+ k = sizeof(w_reply_chunk);
+
+ if (_GC(swap)) {
+ j = convert_intel32(W->num_replies) * (2 * sizeof(long)); //was +=
+ j = convert_intel32(j);
+ } else {
+ j = W->num_replies * (2 * sizeof(long)); //was +=
+ }
+ break;
+
+ case COND_REPLY_CHUNK:
+ //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
+ k = sizeof(c_reply_chunk);
+ break;
+
+ case COND_EXIT_GOTO_CHUNK:
+ case COND_GOTO_CHUNK:
+ //if( *tag == COND_EXIT_GOTO_CHUNK )
+ // fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
+ //if( *tag == COND_GOTO_CHUNK )
+ // fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
+ k = sizeof(c_goto_chunk);
+ break;
+
+ case GOTO_CHUNK:
+ case EXIT_GOTO_CHUNK:
+ //if( *tag == EXIT_GOTO_CHUNK )
+ // fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
+ //if( *tag == GOTO_CHUNK )
+ // fprintf( conv_fp, "GOTO_CHUNK\n" );
+
+ k = sizeof(goto_chunk);
+ break;
+
+ case HIDE_CHUNK:
+ case UHID_CHUNK:
+ case DSTR_CHUNK:
+ //fprintf( conv_fp, "MISC_CHUNK\n" );
+ k = sizeof(misc_chunk);
+ break;
+
+ case CHDE_CHUNK:
+ case CUHD_CHUNK:
+ case CDST_CHUNK:
+ //fprintf( conv_fp, "CMISC_CHUNK\n" );
+ k = sizeof(c_misc_chunk);
+ break;
+
+ default:
+#ifdef TEST_CONV
+ printf("tag %d node %d %x\n", *tag, c->myCNode, c->myCNode);
+#else
+ //oct11
+ error_show(FL, 'PARS', "Tag: %d (%x) Node: %d (%x hex)", *tag, *tag, c->myCNode, c->myCNode);
+#endif
+
+ conv_ops_unknown_chunk(*tag, "conv_ops_get_entry");
+ //exit( 1 ); //fix me!!!! //oct10
+ break;
+ }
+
+ //oct11
+ if (_GC(swap))
+ j = convert_intel32(j);
+ j += k;
+
+ j += i;
+ *next = j;
+ //fprintf( conv_fp, "\n\n" );
+ return &outChunk[i];
+}
+
+static void swap_assign(assign_chunk *a) {
+ a->tag = convert_intel32(a->tag);
+ a->index = convert_intel32(a->index);
+ a->op = convert_intel32(a->op);
+ a->opnd1 = convert_intel32(a->opnd1);
+}
+
+static assign_chunk *get_asgn(Conv *c, long cSize) {
+ char *s = nullptr;
+ assign_chunk *a = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ a = (assign_chunk *)&s[cSize];
+
+ //swap_assign( a );
+ return a;
+}
+
+static void swap_c_asgn(c_assign_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+
+ c->c_op_l = convert_intel32(c->c_op_l);
+ c->c_op = convert_intel32(c->c_op);
+ c->c_op_r = convert_intel32(c->c_op_r);
+
+ c->index = convert_intel32(c->index);
+ c->op = convert_intel32(c->op);
+ c->opnd1 = convert_intel32(c->opnd1);
+}
+
+static c_assign_chunk *get_c_asgn(Conv *c, long cSize) {
+ char *s = nullptr;
+ c_assign_chunk *c_a = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ c_a = (c_assign_chunk *)&s[cSize];
+
+ //swap_c_asgn( c_a );
+ return c_a;
+}
+
+static void swap_conv(conv_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+ c->size = convert_intel32(c->size);
+}
+
conv_chunk *get_conv(Conv *c, long cSize) {
char *s = nullptr;
conv_chunk *c_v = nullptr;
@@ -32,11 +294,15 @@ conv_chunk *get_conv(Conv *c, long cSize) {
s = &(c->conv[c->myCNode]);
c_v = (conv_chunk *)&s[cSize];
+ //swap_conv( c_v );
return c_v;
}
-char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
- error("TODO: conv_ops_get_entry");
+static void swap_decl(decl_chunk *d) {
+ d->tag = convert_intel32(d->tag);
+ d->val = convert_intel32(d->val);
+ d->flags = convert_intel32(d->flags);
+ //long = convert_intel32( *addr );
}
decl_chunk *get_decl(Conv *c, long cSize) {
@@ -46,9 +312,309 @@ decl_chunk *get_decl(Conv *c, long cSize) {
s = c->conv;
d = (decl_chunk *)&s[cSize];
+ //swap_decl( d );
return d;
}
+static void swap_fall(fall_chunk *l) {
+ l->tag = convert_intel32(l->tag);
+ l->val = convert_intel32(l->val);
+ l->index = convert_intel32(l->index);
+}
+
+fall_chunk *get_fall(Conv *c, long cSize) {
+ char *s = nullptr;
+ fall_chunk *f = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ f = (fall_chunk *)&s[cSize];
+
+ //swap_fall( f );
+ return f;
+}
+
+static void swap_lnode(lnode_chunk *l) {
+ int i = 0;
+ long *L = nullptr;
+
+ l->tag = convert_intel32(l->tag);
+ l->hash = convert_intel32(l->hash);
+ l->size = convert_intel32(l->size);
+ l->entry_num = convert_intel32(l->entry_num);
+ l->num_entries = convert_intel32(l->num_entries);
+
+ //oct11
+ //
+ L = (long *)l; //was &l
+ L += 5; // *sizeof( long );
+ for (i = 0; i < l->num_entries; i++) {
+ L[i] = convert_intel32(L[i]);
+ }
+ //
+}
+
+lnode_chunk *get_lnode(Conv *c, long cSize) {
+ char *s = nullptr;
+ lnode_chunk *l = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ l = (lnode_chunk *)&s[cSize];
+
+ //swap_lnode( l );
+ return l;
+}
+
+static void swap_node(node_chunk *n) {
+ int i = 0, j = 0;
+ long *L = nullptr;
+
+ n->tag = convert_intel32(n->tag);
+ n->hash = convert_intel32(n->hash);
+ n->size = convert_intel32(n->size);
+ n->num_entries = convert_intel32(n->num_entries);
+
+ //oct11
+ //
+ j = sizeof(long);
+ L = (long *)n; //was &n
+ L += 4; // *sizeof( long ); //was sizeof node_chunk
+ for (i = 0; i < n->num_entries; i++) {
+ L[i] = convert_intel32(L[i]);
+ }
+ //
+}
+
+node_chunk *get_node(Conv *c, long cSize) {
+ char *s = nullptr;
+ node_chunk *n = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ n = (node_chunk *)&s[cSize];
+
+ //swap_node( n );
+ return n;
+}
+
+static void swap_entry(entry_chunk *e) {
+ e->tag = convert_intel32(e->tag);
+ e->size = convert_intel32(e->size);
+ e->status = convert_intel32(e->status);
+}
+
+entry_chunk *get_entry(Conv *c, long cSize) {
+ char *s = nullptr;
+ entry_chunk *e = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ e = (entry_chunk *)&s[cSize];
+
+ //swap_entry( e );
+ return e;
+}
+
+static void swap_hash_entry(entry_chunk *e) {
+ e->tag = convert_intel32(e->tag);
+ e->size = convert_intel32(e->size);
+ e->status = convert_intel32(e->status);
+}
+
+entry_chunk *get_hash_entry(Conv *c, long cSize) {
+ char *s = nullptr;
+ entry_chunk *e = nullptr;
+
+ s = &(c->conv[0]);
+ e = (entry_chunk *)&s[cSize];
+
+ //swap_hash_entry( e );
+ return e;
+}
+
+static void swap_text(text_chunk *t) {
+ t->tag = convert_intel32(t->tag);
+ t->size = convert_intel32(t->size);
+}
+
+text_chunk *get_text(Conv *c, long cSize) {
+ char *s = nullptr;
+ text_chunk *t = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ t = (text_chunk *)&s[cSize];
+
+ //swap_text( t );
+ return t;
+}
+
+static void swap_mesg(mesg_chunk *m) {
+ m->tag = convert_intel32(m->tag);
+ m->size = convert_intel32(m->size);
+}
+
+mesg_chunk *get_mesg(Conv *c, long cSize) {
+ char *s = nullptr;
+ mesg_chunk *m = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ m = (mesg_chunk *)&s[cSize];
+
+ //swap_mesg( m );
+ return m;
+}
+
+static void swap_reply(reply_chunk *r) {
+ r->tag = convert_intel32(r->tag);
+ r->index = convert_intel32(r->index);
+}
+
+reply_chunk *get_reply(Conv *c, long cSize) {
+ char *s = nullptr;
+ reply_chunk *r = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ r = (reply_chunk *)&s[cSize];
+
+ //swap_reply( r );
+ return r;
+}
+
+static void swap_c_reply(c_reply_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+ c->op_l = convert_intel32(c->op_l);
+ c->op = convert_intel32(c->op);
+ c->op_r = convert_intel32(c->op_r);
+ c->index = convert_intel32(c->index);
+}
+
+c_reply_chunk *get_c_reply(Conv *c, long cSize) {
+ char *s = nullptr;
+ c_reply_chunk *c_r = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ c_r = (c_reply_chunk *)&s[cSize];
+
+ //swap_c_reply( c_r );
+ return c_r;
+}
+
+static void swap_w_reply(w_reply_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+ c->num_replies = convert_intel32(c->num_replies);
+}
+
+w_reply_chunk *get_w_reply(Conv *c, long cSize) {
+ char *s = nullptr;
+ w_reply_chunk *w = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ w = (w_reply_chunk *)&s[cSize];
+
+ //swap_w_reply( w );
+ return w;
+}
+
+static void swap_w_entry(w_entry_chunk *w) {
+ w->weight = convert_intel32(w->weight);
+ w->index = convert_intel32(w->index);
+}
+
+w_entry_chunk *get_w_entry(Conv *c, long cSize) {
+ char *s = nullptr;
+ w_entry_chunk *w = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ w = (w_entry_chunk *)&s[cSize];
+
+ //swap_w_entry( w );
+ return w;
+}
+
+static void swap_goto(goto_chunk *g) {
+ g->tag = convert_intel32(g->tag);
+ g->index = convert_intel32(g->index);
+}
+
+goto_chunk *get_goto(Conv *c, long cSize) {
+ char *s = nullptr;
+ goto_chunk *g = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ g = (goto_chunk *)&s[cSize];
+
+ //swap_goto( g );
+ return g;
+}
+
+static void swap_c_goto(c_goto_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+ c->opnd1 = convert_intel32(c->opnd1);
+ c->op = convert_intel32(c->op);
+ c->opnd2 = convert_intel32(c->opnd2);
+ c->index = convert_intel32(c->index);
+}
+
+c_goto_chunk *get_c_goto(Conv *c, long cSize) {
+ char *s = nullptr;
+ c_goto_chunk *cg = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ cg = (c_goto_chunk *)&s[cSize];
+
+ //swap_c_goto( cg );
+ return cg;
+}
+
+static void swap_misc(misc_chunk *m) {
+ m->tag = convert_intel32(m->tag);
+ m->index = convert_intel32(m->index);
+}
+
+misc_chunk *get_misc(Conv *c, long cSize) {
+ char *s = nullptr;
+ misc_chunk *m = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ m = (misc_chunk *)&s[cSize];
+
+ //swap_misc( m );
+ return m;
+}
+
+static void swap_c_misc(c_misc_chunk *c) {
+ c->tag = convert_intel32(c->tag);
+
+ c->c_op_l = convert_intel32(c->c_op_l);
+ c->c_op = convert_intel32(c->c_op);
+ c->c_op_r = convert_intel32(c->c_op_r);
+
+ c->index = convert_intel32(c->index);
+}
+
+c_misc_chunk *get_c_misc(Conv *c, long cSize) {
+ char *s = nullptr;
+ c_misc_chunk *cm = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ cm = (c_misc_chunk *)&s[cSize];
+
+ //swap_c_misc( cm );
+ return cm;
+}
+
+static void swap_long(long *l) {
+ *l = convert_intel32(*l);
+}
+
+long get_long(Conv *c, long cSize) {
+ char *s = nullptr;
+ long *l = nullptr;
+
+ s = &(c->conv[c->myCNode]);
+ l = (long *)&s[cSize];
+
+ //swap_long( l );
+ return *l;
+}
+
char *get_string(Conv *c, long cSize) {
char *s = nullptr;
char *c_s = nullptr;
@@ -58,29 +624,224 @@ char *get_string(Conv *c, long cSize) {
return c_s;
}
-text_chunk *get_text(Conv *c, long cSize) {
- char *s = NULL;
- text_chunk *t = NULL;
+int conv_ops_cond_successful(long l_op, long op, long r_op) {
+ switch (op) {
+ case PERCENT:
+ return l_op % r_op;
- s = &(c->conv[c->myCNode]);
- t = (text_chunk *)&s[cSize];
+ case GE:
+ return l_op >= r_op;
- return t;
+ case LE:
+ return l_op <= r_op;
+
+ case GT:
+ return l_op > r_op;
+
+ case LT:
+ return l_op < r_op;
+
+ case NE:
+ case CNE:
+ return !(l_op == r_op);
+
+ case IS_ASSIGNED:
+ return l_op == r_op;
+
+ case ANDAND:
+ return l_op && r_op;
+
+ case OROR:
+ return l_op || r_op;
+ }
+ return 0;
}
-long conv_ops_text_strlen(char *s) {
- long len = 0;
- len = strlen(s) + 1; //added +1 for null char.
+long conv_ops_process_asgn(long val, long oprtr, long opnd) {
+ switch (oprtr) {
+ case PPLUS:
+ val += opnd;
+ break;
- if ((len % 4) == 0)
- return len;
+ case MINUS:
+ val -= opnd;
+ break;
- len += 4 - (len % 4);
- return len;
+ case TIMES:
+ val *= opnd;
+ break;
+
+ case DIVIDE:
+ val /= opnd;
+ break;
+
+ case IS_ASSIGNED:
+ val = opnd;
+ break;
+
+ default:
+#ifdef TEST_CONV
+ printf("uh-oh\n");
+#else
+ error_show(FL, 'PARS', "Operator must be a +,-,*,/,=, Please check tag type: %d in token header file", oprtr);
+#endif
+ break;
+ }
+ return val;
}
void conv_swap_words(Conv *c) {
- error("TODO: conv_swap_words");
+ long ent = 0, tag = 0, next;
+ long ent_old = 0;
+ long tempEnt = 0;
+ int x = 0;
+
+ conv_chunk *conv = nullptr;
+ decl_chunk *decl = nullptr;
+ node_chunk *node = nullptr;
+ fall_chunk *fall = nullptr;
+ lnode_chunk *lnode = nullptr;
+ entry_chunk *entry = nullptr;
+ entry_chunk *hash_entry = nullptr;
+
+ text_chunk *text = nullptr;
+ mesg_chunk *mesg = nullptr;
+ reply_chunk *reply = nullptr;
+ c_reply_chunk *c_reply = nullptr;
+ goto_chunk *go = nullptr;
+ c_goto_chunk *c_goto = nullptr;
+ c_assign_chunk *c_asgn = nullptr;
+ w_reply_chunk *w_reply = nullptr;
+ w_entry_chunk *w_entry = nullptr;
+ misc_chunk *misc = nullptr;
+ c_misc_chunk *c_misc = nullptr;
+ assign_chunk *asgn = nullptr;
+
+ if (!c)
+ return;
+
+ c->myCNode = 0;
+ ent_old = c->myCNode;
+ c->myCNode = 0;
+
+ _GC(swap) = true;
+
+ while (ent < c->chunkSize) {
+ conv_ops_get_entry(ent, &next, &tag, c);
+
+ switch (tag) {
+ case C_ASGN_CHUNK:
+ c_asgn = get_c_asgn(c, ent);
+ swap_c_asgn(c_asgn);
+ break;
+
+ case ASGN_CHUNK:
+ asgn = get_asgn(c, ent);
+ swap_assign(asgn);
+ break;
+
+ case HIDE_CHUNK:
+ case DSTR_CHUNK:
+ case UHID_CHUNK:
+ misc = get_misc(c, ent);
+ swap_misc(misc);
+ break;
+
+ case CHDE_CHUNK:
+ case CUHD_CHUNK:
+ case CDST_CHUNK:
+ c_misc = get_c_misc(c, ent);
+ swap_c_misc(c_misc);
+ break;
+
+ case CONV_CHUNK:
+ conv = get_conv(c, ent);
+ swap_conv(conv);
+ break;
+
+ case DECL_CHUNK:
+ decl = get_decl(c, ent);
+ swap_decl(decl);
+ break;
+
+ case FALL_CHUNK:
+ fall = get_fall(c, ent);
+ swap_fall(fall);
+ break;
+
+ case LNODE_CHUNK:
+ lnode = get_lnode(c, ent);
+ swap_lnode(lnode);
+ break;
+
+ case NODE_CHUNK:
+ node = get_node(c, ent);
+ swap_node(node);
+ break;
+
+ case ENTRY_CHUNK:
+ entry = get_entry(c, ent);
+ swap_entry(entry);
+ break;
+
+ case TEXT_CHUNK:
+ text = get_text(c, ent);
+ swap_text(text);
+ break;
+
+ case REPLY_CHUNK:
+ reply = get_reply(c, ent);
+ swap_reply(reply);
+ break;
+
+ case WEIGHT_REPLY_CHUNK:
+ case WEIGHT_PREPLY_CHUNK:
+ w_reply = get_w_reply(c, ent);
+ swap_w_reply(w_reply);
+
+ //dec1
+ tempEnt = ent + sizeof(w_reply_chunk);
+
+ for (x = 0; x < w_reply->num_replies; x++) {
+ w_entry = get_w_entry(c, tempEnt);
+ swap_w_entry(w_entry);
+ tempEnt += sizeof(w_entry_chunk);
+ }
+ break;
+
+ case COND_REPLY_CHUNK:
+ c_reply = get_c_reply(c, ent);
+ swap_c_reply(c_reply);
+ break;
+
+ case MESSAGE_CHUNK:
+ mesg = get_mesg(c, ent);
+ swap_mesg(mesg);
+ break;
+
+ case GOTO_CHUNK:
+ case EXIT_GOTO_CHUNK:
+ go = get_goto(c, ent);
+ swap_goto(go);
+ break;
+
+ case COND_GOTO_CHUNK:
+ case COND_EXIT_GOTO_CHUNK:
+ c_goto = get_c_goto(c, ent);
+ swap_c_goto(c_goto);
+ break;
+
+ default:
+ //term_message( "uh-oh" );
+ ent = 0;
+ break;
+ }
+
+ ent = next;
+ }
+
+ _GC(swap) = false;
+ c->myCNode = ent_old;
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/chunk_ops.h b/engines/m4/adv_r/chunk_ops.h
index 9fdffd9e770..5ca0dcfbebb 100644
--- a/engines/m4/adv_r/chunk_ops.h
+++ b/engines/m4/adv_r/chunk_ops.h
@@ -28,6 +28,41 @@
namespace M4 {
+#define PPLUS 402
+#define MINUS 403
+#define TIMES 404
+#define PERCENT 405
+#define POWER 406
+#define IS_ASSIGNED 407
+#define PERIOD 410
+#define DOLLAR 411
+#define LT 412
+#define GT 413
+#define L_BRAK 416
+#define R_BRAK 417
+
+#define DIVIDE 418
+#define NOT 419
+
+#define LE 420
+#define GE 421
+#define NE 422
+#define PE 423
+#define ME 424
+#define TE 425
+#define DE 426
+#define AE 427
+#define OE 428
+#define EQ 429
+#define AND 430
+#define OR 431
+#define TILDA 432
+#define DBL_QUOTE 433
+#define ANDAND 444
+#define OROR 445
+#define DOT 446
+#define CNE 448
+
extern conv_chunk *get_conv(Conv *c, long cSize);
extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
extern decl_chunk *get_decl(Conv *c, long cSize);
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 2102d8c65c1..abd66cc7368 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -966,7 +966,8 @@ Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want
term_message("conv_load");
- _GC(playerCommAllowed) = _G(player).comm_allowed; // Remember if player commands are on before we start the conversation
+ // Remember if player commands are on before we start the conversation
+ _GC(playerCommAllowed) = _G(player).comm_allowed;
_GC(interface_was_visible) = INTERFACE_VISIBLE;
term_message("conv load: %s", filename);
@@ -1002,8 +1003,7 @@ Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want
cSize = fp.size();
if (conv_get_handle() != nullptr) {
- ////fprintf( conv_fp, "conv_get_handle != nullptr conv_unload()\n" );
- conv_unload(conv_get_handle());
+ conv_unload();
}
convers = (Conv *)mem_alloc(sizeof(Conv), "Conv struct");
@@ -1035,7 +1035,7 @@ Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want
goto done;
}
- conv_swap_words(convers); //oct10
+ conv_swap_words(convers);
find_and_set_conv_name(convers);
_GC(glob_x) = x1;
@@ -1098,6 +1098,10 @@ void conv_unload(Conv *c) {
_GC(globConv) = c = nullptr;
}
+void conv_unload() {
+ conv_unload(conv_get_handle());
+}
+
// only called if node is visible.
// gets the TEXT chunks inside a node.
int conv_get_text(long offset, long size, Conv *c) {
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index b656b04d694..993335a2555 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -43,6 +43,7 @@ struct Converstation_Globals {
bool interface_was_visible = false; // to remember to turn it back on
int restore_conv = 1;
int ent = 0;
+ bool swap = false;
int32 conv_font_spacing_h = 0;
int32 conv_font_spacing_v = 5;
@@ -76,6 +77,7 @@ extern Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bo
extern void conv_load_and_prepare(const char *filename, int trigger, bool ignoreIt = false);
extern void conv_unload(Conv *c);
+extern void conv_unload();
extern void conv_shutdown();
extern Conv *conv_get_handle();
Commit: 1d73320fb81622fa6185e5d1adf4d1ae5a3d08b9
https://github.com/scummvm/scummvm/commit/1d73320fb81622fa6185e5d1adf4d1ae5a3d08b9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding conv save/restore state
Changed paths:
engines/m4/adv_r/chunk_ops.h
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
diff --git a/engines/m4/adv_r/chunk_ops.h b/engines/m4/adv_r/chunk_ops.h
index 5ca0dcfbebb..fede655314b 100644
--- a/engines/m4/adv_r/chunk_ops.h
+++ b/engines/m4/adv_r/chunk_ops.h
@@ -64,6 +64,7 @@ namespace M4 {
#define CNE 448
extern conv_chunk *get_conv(Conv *c, long cSize);
+extern entry_chunk *get_entry(Conv *c, long cSize);
extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
extern decl_chunk *get_decl(Conv *c, long cSize);
extern char *get_string(Conv *c, long cSize);
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index abd66cc7368..6cdd8081ca7 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -288,10 +288,9 @@ void conv_init(Conv *c) {
}
}
-#ifdef TODO
static long find_state(char *s, char *c, int file_size) {
- char name[9];
- long size, offset = 0;
+ char name[9];
+ long size = 0, offset = 0;
////fprintf( conv_fp, "find_state %s\n", s );
while (offset < file_size) {
@@ -307,11 +306,11 @@ static long find_state(char *s, char *c, int file_size) {
offset += 8 * sizeof(char);
if (offset < file_size) {
- memcpy(&size, &c[offset], sizeof(long));
+ memcpy(&size, &c[offset], sizeof(int32));
////fprintf( conv_fp, "size %x\n", size );
}
- offset += size + sizeof(long);
+ offset += size + sizeof(int32);
}
offset = -1;
@@ -320,7 +319,6 @@ static long find_state(char *s, char *c, int file_size) {
handled:
return offset;
}
-#endif
void find_and_set_conv_name(Conv *c) {
long ent = 0, tag = 0, next = 0;
@@ -344,202 +342,13 @@ void find_and_set_conv_name(Conv *c) {
}
}
-/*
-void save_state( Conv *c )
-{
- long ent=0;
- long tag, next;
- long offset=-1, size=0, amt_to_write=0;
-
- entry_chunk *entry;
- decl_chunk *decl;
- conv_chunk *conv;
- short num_decls=0, num_entries=0;
- short flag_num=0, flag_index=0;
- long e_flags=0, myCNode, val;
-
- FILE *fp=nullptr;
- char fname[9];
- char *conv_save_buff=nullptr;
- long file_size;
- bool overwrite_file=false;
- long prev_size=0;
-
- myCNode = c->myCNode; c->myCNode=0; ent=0;
-
- while( ent < c->chunkSize ) {
- conv_ops_get_entry( ent, &next, &tag, c );
-
- switch( tag ) {
- case CONV_CHUNK:
- conv = get_conv( c, ent );
- cstrncpy( fname, get_string( c, c->myCNode+ent+sizeof( conv_chunk ) ), 8 );
- fname[8] = '\0';
- break;
-
- case DECL_CHUNK:
- num_decls++;
- amt_to_write += sizeof( long );
- break;
-
- case ENTRY_CHUNK:
- num_entries++;
- break;
-
- default:
- break;
- }
- ent = next;
- }
-
- sprintf( _GC(conv_file_name), "%sconvsave.dat", argv );
- //file_size = f_info_get_file_size( _GC(conv_file_name) ); //oct11
-
- //oct11
- if( !f_info_exists(_GC(conv_file_name)) )
- file_size = 0; //was -1
- else
- file_size = f_info_get_file_size( _GC(conv_file_name) );
-
- amt_to_write += 3*sizeof( long );
- amt_to_write += (num_entries / 8) * sizeof( long );
- if( (num_entries%8) != 0 )
- amt_to_write += sizeof( long );
-
- fp = f_io_open( _GC(conv_file_name), "rb" ); //was r+b
-
- if( fp ) {
- conv_save_buff = (char *)mem_alloc( file_size, "conv save buff" );
- fread( conv_save_buff, file_size, 1, fp );
-
- f_io_close( fp );
- offset = find_state( fname, conv_save_buff, file_size );
-
- if( offset != -1 ) {
- overwrite_file=true;
- memcpy( &prev_size, &conv_save_buff[offset], sizeof( long ) );
- prev_size += 3*sizeof(long);
- offset += sizeof( long ); //skip header. (name + size)
- } else {
- //append!!!
- offset=0;
- if( conv_save_buff )
- mem_free( conv_save_buff );
-
- conv_save_buff = (char *)mem_alloc( amt_to_write+3*sizeof(long), "conv save buff" );
- memcpy( &conv_save_buff[offset], fname, 8*sizeof(char) );
- offset += 8*sizeof( char );
- memcpy( &conv_save_buff[offset], &amt_to_write, sizeof( long ));
- offset += sizeof( long );
- }
- } else {
- offset=0;
- conv_save_buff = (char *)mem_alloc( amt_to_write+3*sizeof(long), "conv save buff" );
- memcpy( &conv_save_buff[offset], fname, 8*sizeof(char) );
- offset += 8*sizeof( char );
- memcpy( &conv_save_buff[offset], &amt_to_write, sizeof( long ));
- offset += sizeof( long );
- }
-
- memcpy( &conv_save_buff[offset], &myCNode, sizeof( long ) );
- offset += sizeof( long );
-
- memcpy( &conv_save_buff[offset], &num_decls, sizeof( long ) );
- offset += sizeof( long );
-
- memcpy( &conv_save_buff[offset], &num_entries, sizeof( long ) );
- offset += sizeof( long );
- size += 3*sizeof( long );
-
- ent=0; c->myCNode = 0;
- while( ent < c->chunkSize ) {
- conv_ops_get_entry( ent, &next, &tag, c );
-
- switch( tag ) {
- case DECL_CHUNK:
- decl = get_decl( c, ent );
- val = conv_get_decl_val( decl );
-
- memcpy( &conv_save_buff[offset], &val, sizeof( long ) );
- offset+=sizeof( long );
-
- size+=sizeof( long );
- break;
-
- case LNODE_CHUNK:
- case NODE_CHUNK:
- break;
-
- case ENTRY_CHUNK:
- entry = get_entry( c, ent );
-
- if( flag_index == 32 ) {
- flag_index = 0;
- flag_num++;
-
- memcpy( &conv_save_buff[offset], &e_flags, sizeof( long ) );
- offset += sizeof( long );
- size += sizeof( long );
-
- e_flags = 0;
- }
-
- //fprintf( conv_fp, "entry->status %d\n", entry->status );
- e_flags |= ( (entry->status & 0x0000000f) << flag_index );
-
- flag_index += 4;
- break;
-
- default:
- break;
- }
- ent = next;
- }
-
- if( flag_index != 0 ) {
- memcpy( &conv_save_buff[offset], &e_flags, sizeof(long) );
- offset += sizeof( long );
- size += sizeof( long );
- }
-
- if( (amt_to_write != size) )
- error_show( FL, 'CNVS', "save_state: error! size written != size (%d %d)", amt_to_write, size );
-
- if( overwrite_file == true ) {
- ////fprintf( conv_fp, "overwrite conversation\n" );
- fp = f_io_open( _GC(conv_file_name), "wb" );
- fwrite( conv_save_buff, file_size, 1, fp );
-
- //if( prev_size != file_size )
- // error_show( FL, 'CNVS', "save_state() Prev save size != Curr save size (%d, %d)", prev_size, file_size );
-
- } else {
- ////fprintf( conv_fp, "append conversation\n" );
- fp = f_io_open( _GC(conv_file_name), "ab+" );
- fwrite( conv_save_buff, amt_to_write+3*sizeof(long), 1, fp );
- }
-
- if( conv_save_buff )
- mem_free( conv_save_buff );
-
- f_io_close( fp );
-}
-*/
-
-//-------------------------------------------------------------------------------
-// nick documented and error checking added 960501
-// variables moved into their scopes because I'm a picky S.O.B.
-
-void save_state(Conv *c) {
-#ifndef TODO
- error("TODO: save_state");
-#else
+static void conv_save_state(Conv *c) {
//-------------------------------------------------------------------------------
// calculate amt_to_write by counting up the size of DECL_CHUNKs.
// the number of ENTRY_CHUNKs affects the amt_to_write
// also extract fname from the CONV_CHUNK
- long amt_to_write = 3 * sizeof(long); // mystery padding
+ long amt_to_write = 3 * sizeof(int32); // mystery padding
long ent = 0;
long next, tag; // receive conv_ops_get_entry results
long myCNode = c->myCNode;
@@ -564,7 +373,7 @@ void save_state(Conv *c) {
case DECL_CHUNK:
num_decls++;
- amt_to_write += sizeof(long);
+ amt_to_write += sizeof(int32);
break;
case ENTRY_CHUNK:
@@ -577,14 +386,9 @@ void save_state(Conv *c) {
ent = next;
}
- amt_to_write += (num_entries / 8) * sizeof(long);
+ amt_to_write += (num_entries / 8) * sizeof(int32);
if ((num_entries % 8) != 0)
- amt_to_write += sizeof(long); // pad the sucker
-
- //-------------------------------------------------------------------------------
- // get the name of consave.dat
-
- Common::strcpy_s(_GC(conv_file_name), "convsave.dat");
+ amt_to_write += sizeof(int32); // pad the sucker
//-------------------------------------------------------------------------------
// if consave.dat exists, read it in
@@ -595,17 +399,14 @@ void save_state(Conv *c) {
char *conv_save_buff = nullptr;
bool overwrite_file = false;
- if (f_info_exists(_GC(conv_file_name))) {
- file_size = f_info_get_file_size(_GC(conv_file_name));
- FILE *fp = f_io_open(_GC(conv_file_name), "rb"); //was r+b
+ if (!_GC(convSave).empty()) {
+ file_size = _GC(convSave).size();
conv_save_buff = (char *)mem_alloc(file_size, "conv save buff");
if (!conv_save_buff)
error_show(FL, 'OOM!');
- fread(conv_save_buff, file_size, 1, fp);
-
- f_io_close(fp);
+ Common::copy(&_GC(convSave)[0], &_GC(convSave)[0] + file_size, &conv_save_buff[0]);
//----------------------------------------------------------------------------
// if this conversation already in save file, overwrite it,
@@ -616,9 +417,9 @@ void save_state(Conv *c) {
if (offset != -1) {
overwrite_file = true;
- memcpy(&prev_size, &conv_save_buff[offset], sizeof(long));
- prev_size += 3 * sizeof(long);
- offset += sizeof(long); //skip header. (name + size)
+ memcpy(&prev_size, &conv_save_buff[offset], sizeof(int32));
+ prev_size += 3 * sizeof(int32);
+ offset += sizeof(int32); //skip header. (name + size)
} else {
//append!!!
offset = 0;
@@ -626,14 +427,14 @@ void save_state(Conv *c) {
if (conv_save_buff)
mem_free(conv_save_buff);
- conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(long), "conv save buff");
+ conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(int32), "conv save buff");
if (!conv_save_buff)
error_show(FL, 'OOM!');
memcpy(&conv_save_buff[offset], fname, 8 * sizeof(char));
offset += 8 * sizeof(char);
- memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(int32));
+ offset += sizeof(int32);
}
} else
{
@@ -642,29 +443,29 @@ void save_state(Conv *c) {
offset = 0;
- conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(long), "conv save buff");
+ conv_save_buff = (char *)mem_alloc(amt_to_write + 3 * sizeof(int32), "conv save buff");
if (!conv_save_buff)
error_show(FL, 'OOM!');
memcpy(&conv_save_buff[offset], fname, 8 * sizeof(char));
offset += 8 * sizeof(char);
- memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &amt_to_write, sizeof(int32));
+ offset += sizeof(int32);
}
//----------------------------------------------------------------------------
// finish filling in conv_save_buff data with num of entries etc.
- memcpy(&conv_save_buff[offset], &myCNode, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &myCNode, sizeof(int32));
+ offset += sizeof(int32);
- memcpy(&conv_save_buff[offset], &num_decls, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &num_decls, sizeof(int32));
+ offset += sizeof(int32);
- memcpy(&conv_save_buff[offset], &num_entries, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &num_entries, sizeof(int32));
+ offset += sizeof(int32);
- long size = 3 * sizeof(long);
+ long size = 3 * sizeof(int32);
// fill in all the entries themselves
@@ -688,10 +489,10 @@ void save_state(Conv *c) {
decl = get_decl(c, ent);
val = conv_get_decl_val(decl);
- memcpy(&conv_save_buff[offset], &val, sizeof(long));
- offset += sizeof(long);
+ memcpy(&conv_save_buff[offset], &val, sizeof(int32));
+ offset += sizeof(int32);
- size += sizeof(long);
+ size += sizeof(int32);
break;
case LNODE_CHUNK:
@@ -705,9 +506,9 @@ void save_state(Conv *c) {
flag_index = 0;
//flag_num++;
- memcpy(&conv_save_buff[offset], &e_flags, sizeof(long));
- offset += sizeof(long);
- size += sizeof(long);
+ memcpy(&conv_save_buff[offset], &e_flags, sizeof(int32));
+ offset += sizeof(int32);
+ size += sizeof(int32);
e_flags = 0;
}
@@ -724,50 +525,36 @@ void save_state(Conv *c) {
ent = next;
}
- // copy the flags
+ // Copy the flags
if (flag_index != 0) {
- memcpy(&conv_save_buff[offset], &e_flags, sizeof(long));
- offset += sizeof(long);
- size += sizeof(long);
+ memcpy(&conv_save_buff[offset], &e_flags, sizeof(int32));
+ offset += sizeof(int32);
+ size += sizeof(int32);
}
if ((amt_to_write != size))
error_show(FL, 'CNVS', "save_state: error! size written != size (%d %d)", amt_to_write, size);
- // finally, write out the conversation data. Scoped to contain fp.
- {
- FILE *fp = nullptr;
- if (overwrite_file == true)
- {
- ////fprintf( conv_fp, "overwrite conversation\n" );
- fp = f_io_open(_GC(conv_file_name), "wb");
- if (!fp)
- error_show(FL, 'FNF!', "consave.dat");
-
- fwrite(conv_save_buff, file_size, 1, fp);
- } else
- {
- ////fprintf( conv_fp, "append conversation\n" );
- fp = f_io_open(_GC(conv_file_name), "ab+");
- if (!fp)
- error_show(FL, 'FNF!', "consave.dat");
-
- fwrite(conv_save_buff, amt_to_write + 3 * sizeof(long), 1, fp);
- }
+ // Finally, write out the conversation data
+ if (overwrite_file == true) {
+ _GC(convSave).resize(file_size);
+ Common::copy(conv_save_buff, conv_save_buff + file_size, &_GC(convSave)[0]);
- if (conv_save_buff)
- mem_free(conv_save_buff);
+ } else {
+ // Append conversation
+ size_t oldSize = _GC(convSave).size();
+ file_size = amt_to_write + 3 * sizeof(int32);
- f_io_close(fp);
+ _GC(convSave).resize(_GC(convSave).size() + file_size);
+ Common::copy(conv_save_buff, conv_save_buff + file_size, &_GC(convSave)[oldSize]);
}
-#endif
+
+ if (conv_save_buff)
+ mem_free(conv_save_buff);
}
-Conv *restore_state(Conv *c) {
-#ifndef TODO
- error("TODO: restore_state");
-#else
+static Conv *conv_restore_state(Conv *c) {
long ent = 0;
long tag, next, offset;
@@ -780,7 +567,6 @@ Conv *restore_state(Conv *c) {
long e_flags = 0;
long myCNode;
- FILE *fp = nullptr;
char fname[9];
int dont_update_ents = 0;
int file_size = 0;
@@ -792,17 +578,12 @@ Conv *restore_state(Conv *c) {
cstrncpy(fname, get_conv_name(), 8);
fname[8] = '\0';
- sprintf(_GC(conv_file_name), "%sconvsave.dat", argv);
- //oct11
- //file_size = f_info_get_file_size( _GC(conv_file_name) );
- if (!f_info_exists(_GC(conv_file_name)))
+ if (_GC(convSave).empty())
file_size = -1;
else
- file_size = f_info_get_file_size(_GC(conv_file_name));
+ file_size = _GC(convSave).size();
- fp = f_io_open(_GC(conv_file_name), "rb");
- if (!fp)
- {
+ if (file_size <= 0) {
conv_init(c);
return c;
}
@@ -813,8 +594,7 @@ Conv *restore_state(Conv *c) {
// ------------------
- fread(conv_save_buff, file_size, 1, fp);
- f_io_close(fp);
+ Common::copy(&_GC(convSave)[0], &_GC(convSave)[0] + file_size, &conv_save_buff[0]);
offset = find_state(fname, conv_save_buff, file_size);
// nick 960501 changed from a return c to a goto in order to corret an insidious memory leak!
@@ -822,16 +602,16 @@ Conv *restore_state(Conv *c) {
goto i_am_so_done;
//skip header.
- offset += sizeof(long);
+ offset += sizeof(int32);
- memcpy(&myCNode, &conv_save_buff[offset], sizeof(long));
- offset += sizeof(long);
+ memcpy(&myCNode, &conv_save_buff[offset], sizeof(int32));
+ offset += sizeof(int32);
- memcpy(&num_decls, &conv_save_buff[offset], sizeof(long));
- offset += sizeof(long);
+ memcpy(&num_decls, &conv_save_buff[offset], sizeof(int32));
+ offset += sizeof(int32);
- memcpy(&num_entries, &conv_save_buff[offset], sizeof(long));
- offset += sizeof(long);
+ memcpy(&num_entries, &conv_save_buff[offset], sizeof(int32));
+ offset += sizeof(int32);
ent = 0; c->myCNode = 0;
@@ -840,8 +620,8 @@ Conv *restore_state(Conv *c) {
switch (tag) {
case DECL_CHUNK:
- memcpy(&val, &conv_save_buff[offset], sizeof(long));
- offset += sizeof(long);
+ memcpy(&val, &conv_save_buff[offset], sizeof(int32));
+ offset += sizeof(int32);
decl = get_decl(c, ent);
conv_set_decl_val(decl, val);
@@ -880,8 +660,8 @@ Conv *restore_state(Conv *c) {
}
if (flag_index == 0) {
- memcpy(&e_flags, &conv_save_buff[offset], sizeof(long));
- offset += sizeof(long);
+ memcpy(&e_flags, &conv_save_buff[offset], sizeof(int32));
+ offset += sizeof(int32);
}
val = (e_flags >> flag_index) & 0x0000000f;
@@ -909,7 +689,6 @@ i_am_so_done:
if (conv_save_buff)
mem_free(conv_save_buff);
return c;
-#endif
}
void conv_set_font_spacing(int32 h, int32 v) {
@@ -1045,7 +824,7 @@ Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want
set_dlg_rect();
if (_GC(restore_conv))
- convers = restore_state(convers);
+ convers = conv_restore_state(convers);
_GC(restore_conv) = 1;
conv_set_handle(convers);
@@ -1077,7 +856,7 @@ void conv_unload(Conv *c) {
_GC(globConv) = nullptr;
if (c)
- save_state(c);
+ conv_save_state(c);
player_set_commands_allowed(_GC(playerCommAllowed));
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 993335a2555..3d87b2147e2 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -33,9 +33,9 @@ namespace M4 {
struct Converstation_Globals {
Common::Array<byte> conv_save_buff;
+ Common::Array<byte> convSave;
int event = 0;
int event_ready = 0;
- char conv_file_name[MAX_FILENAME_SIZE] = { 0 };
char conv_name[16];
Conv *globConv = nullptr;
bool playerCommAllowed = false;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 22a3369d792..df8d5b4f14b 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -338,5 +338,9 @@ void Flags::reset5() {
(*this)[V181] = 0;
}
+void Flags::conv_reset_all() {
+ _GC(convSave).clear();
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 87b5fb88f08..5dc06919f16 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -552,8 +552,6 @@ enum {
};
class Flags {
-private:
- Common::Array<byte> _convSave;
public:
static long _flags[FLAGS_COUNT];
@@ -570,10 +568,7 @@ public:
void reset3();
void reset4();
void reset5();
-
- void conv_reset_all() {
- _convSave.clear();
- }
+ void conv_reset_all();
int32 get_boonsville_time_and_display(bool showTime = false);
void set_boonsville_time(int32 time);
Commit: 179154b11a60c2c74d3869a51f0acdc975f84bef
https://github.com/scummvm/scummvm/commit/179154b11a60c2c74d3869a51f0acdc975f84bef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More conversation code added
Changed paths:
engines/m4/adv_r/chunk_ops.cpp
engines/m4/adv_r/chunk_ops.h
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv.h
engines/m4/adv_r/conv_io.h
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index f4fe3c79f38..35afe4f71b2 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -38,7 +38,7 @@ long conv_ops_text_strlen(char *s) {
return len;
}
-static void conv_ops_unknown_chunk(long tag, const char *s) {
+void conv_ops_unknown_chunk(long tag, const char *s) {
char *tag_name = nullptr;
tag_name = (char *)&tag;
@@ -248,7 +248,7 @@ static void swap_assign(assign_chunk *a) {
a->opnd1 = convert_intel32(a->opnd1);
}
-static assign_chunk *get_asgn(Conv *c, long cSize) {
+assign_chunk *get_asgn(Conv *c, long cSize) {
char *s = nullptr;
assign_chunk *a = nullptr;
@@ -271,7 +271,7 @@ static void swap_c_asgn(c_assign_chunk *c) {
c->opnd1 = convert_intel32(c->opnd1);
}
-static c_assign_chunk *get_c_asgn(Conv *c, long cSize) {
+c_assign_chunk *get_c_asgn(Conv *c, long cSize) {
char *s = nullptr;
c_assign_chunk *c_a = nullptr;
@@ -412,11 +412,13 @@ entry_chunk *get_entry(Conv *c, long cSize) {
return e;
}
+#if 0
static void swap_hash_entry(entry_chunk *e) {
e->tag = convert_intel32(e->tag);
e->size = convert_intel32(e->size);
e->status = convert_intel32(e->status);
}
+#endif
entry_chunk *get_hash_entry(Conv *c, long cSize) {
char *s = nullptr;
@@ -600,9 +602,11 @@ c_misc_chunk *get_c_misc(Conv *c, long cSize) {
return cm;
}
+#if 0
static void swap_long(long *l) {
*l = convert_intel32(*l);
}
+#endif
long get_long(Conv *c, long cSize) {
char *s = nullptr;
@@ -702,7 +706,7 @@ void conv_swap_words(Conv *c) {
fall_chunk *fall = nullptr;
lnode_chunk *lnode = nullptr;
entry_chunk *entry = nullptr;
- entry_chunk *hash_entry = nullptr;
+ //entry_chunk *hash_entry = nullptr;
text_chunk *text = nullptr;
mesg_chunk *mesg = nullptr;
diff --git a/engines/m4/adv_r/chunk_ops.h b/engines/m4/adv_r/chunk_ops.h
index fede655314b..0a9f9fc773d 100644
--- a/engines/m4/adv_r/chunk_ops.h
+++ b/engines/m4/adv_r/chunk_ops.h
@@ -66,10 +66,28 @@ namespace M4 {
extern conv_chunk *get_conv(Conv *c, long cSize);
extern entry_chunk *get_entry(Conv *c, long cSize);
extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
+extern void conv_ops_unknown_chunk(long tag, const char *s);
extern decl_chunk *get_decl(Conv *c, long cSize);
extern char *get_string(Conv *c, long cSize);
extern text_chunk *get_text(Conv *c, long cSize);
extern long conv_ops_text_strlen(char *s);
+extern c_assign_chunk *get_c_asgn(Conv *c, long cSize);
+extern int conv_ops_cond_successful(long l_op, long op, long r_op);
+extern long conv_ops_process_asgn(long val, long oprtr, long opnd);
+extern assign_chunk *get_asgn(Conv *c, long cSize);
+extern misc_chunk *get_misc(Conv *c, long cSize);
+extern entry_chunk *get_hash_entry(Conv *c, long cSize);
+extern c_misc_chunk *get_c_misc(Conv *c, long cSize);
+extern c_goto_chunk *get_c_goto(Conv *c, long cSize);
+extern goto_chunk *get_goto(Conv *c, long cSize);
+extern reply_chunk *get_reply(Conv *c, long cSize);
+extern lnode_chunk *get_lnode(Conv *c, long cSize);
+extern node_chunk *get_node(Conv *c, long cSize);
+extern fall_chunk *get_fall(Conv *c, long cSize);
+extern long get_long(Conv *c, long cSize);
+extern c_reply_chunk *get_c_reply(Conv *c, long cSize);
+extern w_reply_chunk *get_w_reply(Conv *c, long cSize);
+extern w_entry_chunk *get_w_entry(Conv *c, long cSize);
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index f7e9d5ea8d9..dbb641ad2b0 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -20,14 +20,1063 @@
*/
#include "m4/adv_r/conv.h"
+#include "m4/adv_r/chunk_ops.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/gui/gui_univ.h"
#include "m4/gui/gui_vmng.h"
#include "m4/vars.h"
+#include "m4/m4.h"
namespace M4 {
+// ---------------
+
+//set entry stats,
+//get next node pointer
+//process declarations
+//get message text
+static void conv_exec_entry(long offset, Conv *c) {
+ long i = offset, entry_count;
+ long l_op, r_op;
+ long tag, next;
+
+ goto_chunk *go;
+ c_goto_chunk *c_goto;
+ entry_chunk *entry;
+ decl_chunk *decl;
+ assign_chunk *asgn;
+ c_assign_chunk *c_asgn;
+ misc_chunk *misc;
+ c_misc_chunk *c_misc;
+
+ l_op = r_op = entry_count = 0;
+
+ entry = get_entry(c, i);
+ entry_count = entry->size;
+ entry->status = conv_toggle_flags(entry);
+
+ i += sizeof(entry_chunk);
+
+ while (i < offset + entry_count) {
+ conv_ops_get_entry(i, &next, &tag, c);
+
+ switch (tag) {
+ case TEXT_CHUNK:
+ //fprintf( conv_fp, "TEXT_CHUNK\n" );
+ break;
+
+ case MESSAGE_CHUNK:
+ //fprintf( conv_fp, "MESSAGE_CHUNK\n" );
+ break;
+
+ case ENTRY_CHUNK:
+ //fprintf( conv_fp, "ENTRY_CHUNK\n" );
+ break;
+
+ case FALL_CHUNK:
+ //fprintf( conv_fp, "FALL_CHUNK\n" );
+ break;
+
+ case C_ASGN_CHUNK:
+ //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
+ c_asgn = get_c_asgn(c, i);
+
+ decl = get_decl(c, c_asgn->c_op_l);
+ l_op = conv_get_decl_val(decl);
+
+ if (conv_ops_cond_successful(l_op, c_asgn->c_op, c_asgn->c_op_r)) {
+ decl = get_decl(c, c_asgn->index);
+ conv_set_decl_val(decl, conv_ops_process_asgn(conv_get_decl_val(decl), c_asgn->op, c_asgn->opnd1));
+ }
+ break;
+
+ case ASGN_CHUNK:
+ //fprintf( conv_fp, "ASGN_CHUNK\n" );
+ asgn = get_asgn(c, i);
+ decl = get_decl(c, asgn->index);
+ conv_set_decl_val(decl, conv_ops_process_asgn(conv_get_decl_val(decl), asgn->op, asgn->opnd1));
+ break;
+
+ case HIDE_CHUNK:
+ //fprintf( conv_fp, "HIDE_CHUNK\n" );
+ misc = get_misc(c, i);
+ entry = get_hash_entry(c, misc->index);
+
+ if (!(entry->status & DESTROYED))
+ entry->status |= HIDDEN;
+ break;
+
+ case CHDE_CHUNK:
+ //fprintf( conv_fp, "CHDE_CHUNK\n" );
+ c_misc = get_c_misc(c, i);
+ entry = get_hash_entry(c, c_misc->index);
+
+ decl = get_decl(c, c_misc->c_op_l);
+ l_op = conv_get_decl_val(decl);
+
+ if (conv_ops_cond_successful(l_op, c_misc->c_op, c_misc->c_op_r)) {
+ if (!(entry->status & DESTROYED))
+ entry->status |= HIDDEN;
+ }
+ break;
+
+ case UHID_CHUNK:
+ //fprintf( conv_fp, "UHID_CHUNK\n" );
+ misc = get_misc(c, i);
+ entry = get_hash_entry(c, misc->index);
+ if (!(entry->status & DESTROYED)) {
+ entry->status &= 0xfffffffb; //mask HIDDEN bit
+ entry->status |= 0x00000001;
+ }
+ break;
+
+ case CUHD_CHUNK:
+ //fprintf( conv_fp, "CUHD_CHUNK\n" );
+ c_misc = get_c_misc(c, i);
+ entry = get_hash_entry(c, c_misc->index);
+
+ decl = get_decl(c, c_misc->c_op_l);
+ l_op = conv_get_decl_val(decl);
+
+ if (conv_ops_cond_successful(l_op, c_misc->c_op, c_misc->c_op_r)) {
+ if (!(entry->status & DESTROYED)) {
+ entry->status &= 0xfffffffb;
+ entry->status |= 0x00000001;
+ }
+ }
+ break;
+
+ case DSTR_CHUNK:
+ //fprintf( conv_fp, "DSTR_CHUNK\n" );
+ misc = get_misc(c, i);
+ entry = get_hash_entry(c, misc->index);
+ entry->status |= DESTROYED;
+ break;
+
+ case CDST_CHUNK:
+ //fprintf( conv_fp, "CDST_CHUNK\n" );
+ c_misc = get_c_misc(c, i);
+ entry = get_hash_entry(c, c_misc->index);
+
+ decl = get_decl(c, c_misc->c_op_l);
+ l_op = conv_get_decl_val(decl);
+
+ if (conv_ops_cond_successful(l_op, c_misc->c_op, c_misc->c_op_r))
+ entry->status |= DESTROYED;
+ break;
+
+ case COND_GOTO_CHUNK:
+ //fprintf( conv_fp, "COND_GOTO_CHUNK\n" ); //aug2
+ c_goto = get_c_goto(c, i);
+ decl = get_decl(c, c_goto->opnd1);
+
+ l_op = conv_get_decl_val(decl);
+ r_op = c_goto->opnd2; //val
+
+ if (conv_ops_cond_successful(l_op, c_goto->op, r_op)) {
+ c->myCNode = c_goto->index;
+
+ //////term_message( "COND GOTO %x", c->myCNode );
+ //fprintf( conv_fp, "COND GOTO %x\n", c->myCNode ); //aug2
+ return;
+ }
+ break;
+
+ case COND_EXIT_GOTO_CHUNK:
+ //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" ); //aug2
+ c_goto = get_c_goto(c, i);
+ decl = get_decl(c, c_goto->opnd1);
+
+ l_op = conv_get_decl_val(decl);
+ r_op = c_goto->opnd2; //val
+
+ if (conv_ops_cond_successful(l_op, c_goto->op, r_op)) {
+ if (c_goto->index != CONV_QUIT) { //was go->index
+ c->myCNode = c_goto->index; //was go->index
+ c->exit_now = CONV_BAIL;
+ } else {
+ c->exit_now = CONV_QUIT;
+ c->myCNode = CONV_QUIT;
+ }
+ //////term_message( "COND EXIT GOTO %x", c->myCNode );
+ //fprintf( conv_fp, "COND EXIT GOTO %x\n", c->myCNode ); //aug2
+
+ return;
+ }
+ break;
+
+ case EXIT_GOTO_CHUNK:
+ //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" ); //aug2
+ go = get_goto(c, i);
+
+ if (go->index != CONV_QUIT) {
+ c->myCNode = go->index;
+ c->exit_now = CONV_BAIL;
+ } else {
+ c->exit_now = CONV_QUIT;
+ c->myCNode = CONV_QUIT;
+ }
+ //////term_message( "EXIT GOTO %x", c->myCNode );
+ //fprintf( conv_fp, "EXIT GOTO %x\n", c->myCNode ); //aug2
+ return;
+
+ case GOTO_CHUNK:
+ //////fprintf( conv_fp, "GOTO_CHUNK\n" );
+ go = get_goto(c, i);
+ c->myCNode = go->index;
+ //////term_message( "GOTO %x", c->myCNode );
+ //fprintf( conv_fp, "GOTO %x\n", c->myCNode ); //aug2
+ return;
+
+ //replies are non-player responses
+ case REPLY_CHUNK:
+ //fprintf( conv_fp, "REPLY_CHUNK\n" );
+ break;
+
+ case COND_REPLY_CHUNK:
+ //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
+ break;
+
+ case WEIGHT_REPLY_CHUNK:
+ //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
+ break;
+
+ case WEIGHT_PREPLY_CHUNK:
+ //fprintf( conv_fp, "WEIGHT_PREPLY_CHUNK\n" );
+ break;
+
+ default:
+ conv_ops_unknown_chunk(tag, "conv_exec_entry");
+ break;
+ }
+ i = next;
+ }
+}
+
+static int conv_get_mesg(long offset, long is_valid, Conv *c) {
+ long i = offset, entry_count;
+ long l_op, r_op;
+ long x, y, s_offset = 0, cSize;
+ long tag, next;
+ long text_len;
+ int sum, result = 0;
+
+ entry_chunk *entry;
+ decl_chunk *decl;
+ reply_chunk *reply;
+ c_reply_chunk *c_reply;
+ w_reply_chunk *w_reply;
+ w_entry_chunk *w_entry;
+
+ l_op = r_op = entry_count = 0;
+
+ entry = get_entry(c, i);
+ entry_count = entry->size;
+
+ i += sizeof(entry_chunk);
+
+ while (i < offset + entry_count) {
+ conv_ops_get_entry(i, &next, &tag, c);
+
+ switch (tag) {
+ case TEXT_CHUNK:
+ //fprintf( conv_fp, "TEXT_CHUNK\n" );
+ break;
+
+ case MESSAGE_CHUNK:
+ //fprintf( conv_fp, "MESSAGE_CHUNK\n" );
+ break;
+
+ case ENTRY_CHUNK:
+ //fprintf( conv_fp, "ENTRY_CHUNK\n" );
+ break;
+
+ case FALL_CHUNK:
+ //fprintf( conv_fp, "FALL_CHUNK\n" ); //aug2
+ break;
+
+ case C_ASGN_CHUNK:
+ //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
+ break;
+
+ case ASGN_CHUNK:
+ //fprintf( conv_fp, "ASGN_CHUNK\n" );
+ break;
+
+ case HIDE_CHUNK:
+ //fprintf( conv_fp, "HIDE_CHUNK\n" );
+ break;
+
+ case CHDE_CHUNK:
+ //fprintf( conv_fp, "CHDE_CHUNK\n" );
+ break;
+
+ case UHID_CHUNK:
+ //fprintf( conv_fp, "UHID_CHUNK\n" );
+ break;
+
+ case CUHD_CHUNK:
+ //fprintf( conv_fp, "CUHD_CHUNK\n" );
+ break;
+
+ case DSTR_CHUNK:
+ //fprintf( conv_fp, "DSTR_CHUNK\n" );
+ break;
+
+ case CDST_CHUNK:
+ //fprintf( conv_fp, "CDST_CHUNK\n" );
+ break;
+
+ case COND_GOTO_CHUNK:
+ //fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
+ break;
+
+ case COND_EXIT_GOTO_CHUNK:
+ //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
+ break;
+
+ case EXIT_GOTO_CHUNK:
+ //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
+ break;
+
+ case GOTO_CHUNK:
+ //fprintf( conv_fp, "GOTO_CHUNK\n" );
+ break;
+
+ case REPLY_CHUNK:
+ reply = get_reply(c, i);
+ //fprintf( conv_fp, "REPLY_CHUNK\n" );
+
+ if (is_valid) {
+ result = 1;
+ _G(cdd).player_non_player = 0;
+
+ if (!strcmp(_G(cdd).mesg, "")) {
+ text_len = conv_ops_text_strlen(get_string(c, reply->index + sizeof(mesg_chunk)));
+
+ ////fprintf( conv_fp, "reply->index %x text_len %d\n", reply->index, text_len );
+ Common::strcpy_s(_G(cdd).mesg, get_string(c, reply->index + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, reply->index + sizeof(mesg_chunk));
+ //////term_message( "Rreply %s", _G(cdd).mesg_snd_file ); //jun10
+ ////fprintf( conv_fp, "Rreply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode ); //jun10/jun14
+ } else {
+ Common::strcat_s(_G(cdd).mesg, " ");
+ text_len = conv_ops_text_strlen(get_string(c, reply->index + sizeof(mesg_chunk)));
+ Common::strcat_s(_G(cdd).mesg, get_string(c, reply->index + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, reply->index + sizeof(mesg_chunk));
+ }
+ }
+ break;
+
+ case COND_REPLY_CHUNK:
+ //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
+ c_reply = get_c_reply(c, i);
+ decl = get_decl(c, c_reply->op_l);
+
+ l_op = conv_get_decl_val(decl);
+ r_op = c_reply->op_r; //val
+
+ if (is_valid && conv_ops_cond_successful(l_op, c_reply->op, r_op)) {
+ result = 1;
+ _G(cdd).player_non_player = 0;
+
+ if (!strcmp(_G(cdd).mesg, "")) {
+ text_len = conv_ops_text_strlen(get_string(c, c_reply->index + sizeof(mesg_chunk)));
+ Common::strcpy_s(_G(cdd).mesg, get_string(c, c_reply->index + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, c_reply->index + sizeof(mesg_chunk));
+ //////term_message( "cond reply %s", _G(cdd).mesg_snd_file );
+ ////fprintf( conv_fp, "cond reply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode );
+ } else {
+ Common::strcat_s(_G(cdd).mesg, " ");
+ text_len = conv_ops_text_strlen(get_string(c, c_reply->index + sizeof(mesg_chunk)));
+ Common::strcat_s(_G(cdd).mesg, get_string(c, c_reply->index + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, c_reply->index + sizeof(mesg_chunk));
+ }
+ }
+ break;
+
+ case WEIGHT_REPLY_CHUNK:
+ //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
+ cSize = i;
+ w_reply = get_w_reply(c, i);
+ cSize += sizeof(w_reply_chunk);
+
+ sum = 0;
+ for (x = 0; x < w_reply->num_replies; x++) {
+ w_entry = get_w_entry(c, cSize);
+ sum += w_entry->weight;
+ cSize += sizeof(w_entry_chunk);
+ }
+ y = g_engine->getRandomNumber(sum - 1) + 1;
+
+ cSize = i;
+ w_reply = get_w_reply(c, i);
+ cSize += sizeof(w_reply_chunk);
+
+ sum = 0;
+ for (x = 0; (x < w_reply->num_replies) && (sum < y); x++) {
+ w_entry = get_w_entry(c, cSize);
+ s_offset = w_entry->index;
+ sum += w_entry->weight;
+ cSize += sizeof(w_entry_chunk);
+ }
+
+ if (is_valid) {
+ result = 1;
+ _G(cdd).player_non_player = 0;
+
+ if (!strcmp(_G(cdd).mesg, "")) {
+ text_len = conv_ops_text_strlen(get_string(c, s_offset + sizeof(mesg_chunk)));
+ Common::strcpy_s(_G(cdd).mesg, get_string(c, s_offset + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, s_offset + sizeof(mesg_chunk));
+ } else {
+ Common::strcat_s(_G(cdd).mesg, " ");
+ text_len = conv_ops_text_strlen(get_string(c, s_offset + sizeof(mesg_chunk)));
+ Common::strcat_s(_G(cdd).mesg, get_string(c, s_offset + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, s_offset + sizeof(mesg_chunk));
+ }
+ }
+ break;
+
+ case WEIGHT_PREPLY_CHUNK:
+ //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
+ cSize = i;
+ w_reply = get_w_reply(c, i);
+ cSize += sizeof(w_reply_chunk);
+
+ sum = 0;
+ for (x = 0; x < w_reply->num_replies; x++) {
+ w_entry = get_w_entry(c, cSize);
+ sum += w_entry->weight;
+ cSize += sizeof(w_entry_chunk);
+ }
+ y = g_engine->getRandomNumber(sum - 1) + 1;
+
+ cSize = i;
+ w_reply = get_w_reply(c, i);
+ cSize += sizeof(w_reply_chunk);
+
+ sum = 0;
+ for (x = 0; (x < w_reply->num_replies) && (sum < y); x++) {
+ w_entry = get_w_entry(c, cSize);
+ s_offset = w_entry->index;
+ sum += w_entry->weight;
+ cSize += sizeof(w_entry_chunk);
+ }
+
+ if (is_valid) {
+ result = 1;
+ _G(cdd).player_non_player = 1; //jun27 was 0;
+
+ if (!strcmp(_G(cdd).mesg, "")) {
+ text_len = conv_ops_text_strlen(get_string(c, s_offset + sizeof(mesg_chunk)));
+ Common::strcpy_s(_G(cdd).mesg, get_string(c, s_offset + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, s_offset + sizeof(mesg_chunk));
+ } else {
+ Common::strcat_s(_G(cdd).mesg, " ");
+ text_len = conv_ops_text_strlen(get_string(c, s_offset + sizeof(mesg_chunk)));
+ Common::strcat_s(_G(cdd).mesg, get_string(c, s_offset + sizeof(mesg_chunk) + text_len));
+ _G(cdd).mesg_snd_file = get_string(c, s_offset + sizeof(mesg_chunk));
+ }
+ }
+ break;
+
+ default:
+ conv_ops_unknown_chunk(tag, "conv_get_mesg");
+ break;
+ }
+ i = next;
+ }
+ return result;
+}
+
+//oct10: here.
+static void find_true_ent(int entry_num, Conv *c) {
+ node_chunk *node = nullptr;
+ lnode_chunk *lnode = nullptr;
+ entry_chunk *entry = nullptr;
+ fall_chunk *fall = nullptr;
+ long offset = 0, ent = 0, n = 0;
+ long next = 0, tag = 0, num_ents = 0;
+ int i = 0;
+ long sub_ent = 0;
+ int result = 1;
+
+ for (;; ) {
+ //start by getting the current NODE or LNODE
+ conv_ops_get_entry(ent, &next, &tag, c);
+ switch (tag) {
+ case LNODE_CHUNK:
+ lnode = get_lnode(c, ent);
+ ent += sizeof(lnode_chunk);
+ num_ents = lnode->num_entries;
+ entry_num = lnode->entry_num;
+ c->node_hash = lnode->hash;
+ break;
+
+ case NODE_CHUNK:
+ node = get_node(c, ent);
+ ent += sizeof(node_chunk);
+ num_ents = node->num_entries;
+ c->node_hash = node->hash;
+ break;
+
+ default:
+ break;
+ }
+
+ //ent will now be pointing at an ENTRY or FALLTHROUGH
+ sub_ent = next;
+ conv_ops_get_entry(sub_ent, &next, &tag, c);
+ switch (tag) {
+ case FALL_CHUNK:
+ //we either want to jump to a new node
+ //or skip to the first offset.
+ //fprintf( conv_fp, "FALL_CHUNK 1.\n" ); //aug2
+
+ fall = get_fall(c, sub_ent);
+
+ //do this to skip the fall chunk and all will be fine.
+ ent += sizeof(long); //was get_long, sizeof( fall_chunk )
+ n++; //don't increment i.
+ break;
+
+ case ENTRY_CHUNK:
+ //don't bother.... result is 1 if FALL_CHUNK not encountered.
+ break;
+
+ default:
+ break;
+ }
+
+ if (result)
+ break;
+ }
+
+ _GC(ent) = 0;
+
+ //not only i<entry_num, check to see entry->num_entries
+ for (i = 0, n = 0; n < num_ents; n++) {
+ offset = get_long(c, ent);
+ entry = get_entry(c, ent + offset);
+
+ if (i == entry_num)
+ break;
+
+ if (((entry->status) & 0x00000003) && ok_status(entry)) //was 1
+ i++;
+
+ //fprintf( conv_fp, "find_true_ent _GC(ent)++\n" );
+ _GC(ent)++;
+
+ ent += sizeof(long);
+ }
+}
+
+
+//simplify me now that all changes have been made.
+static int conv_get_node_text(Conv *c) {
+ lnode_chunk *lnode = nullptr;
+ node_chunk *node = nullptr;
+ entry_chunk *entry = nullptr;
+ fall_chunk *fall = nullptr;
+
+ long ent = 0, offset = 0, tag, next, num_ents = 0;
+ int i = 0, num_vis = 0, result = 0;
+
+ _G(cdd).num_txt_ents = 0;
+ _GC(width) = 0; _GC(height) = 0;
+
+ //conv _get_node_text will either get a NODE or LNODE
+ conv_ops_get_entry(offset, &next, &tag, c);
+ offset = 0; //not needed.?
+ _GC(n_t_e) = 0;
+
+ switch (tag) {
+ case LNODE_CHUNK:
+ lnode = get_lnode(c, offset);
+ offset += sizeof(lnode_chunk);
+ num_ents = lnode->num_entries;
+ c->node_hash = lnode->hash;
+ break;
+
+ case NODE_CHUNK:
+ node = get_node(c, offset);
+ offset += sizeof(node_chunk);
+ num_ents = node->num_entries;
+ c->node_hash = node->hash;
+ break;
+
+ default:
+ //handle error.
+ break;
+ }
+
+ switch (tag) {
+ case LNODE_CHUNK:
+ //was in bounds.
+ //lnode->entry_num starts at 0. in the chunk.
+ if (lnode->entry_num >= lnode->num_entries) //aug4: was >
+ lnode->entry_num = 0;
+
+ for (i = 0; (i <= lnode->entry_num) && (i < num_ents); i++) {
+ ent = get_long(c, offset);
+ entry = get_entry(c, offset + ent);
+
+ offset += sizeof(long);
+ }
+
+ offset -= sizeof(long);
+
+ //set sound file name instead.?
+ if ((entry->status != 0) && (num_ents != 0) && ok_status(entry)) {
+ //here here here.
+ if (conv_get_text(offset + ent, entry->size, c)) {
+ result = 1;
+
+ _G(cdd).num_txt_ents = 0;
+ _G(cdd).mesg_snd_file = _G(cdd).snd_files[0];
+
+ _G(cdd).text[0] = nullptr;
+ _G(cdd).snd_files[0] = nullptr;
+ _G(cdd).player_non_player = 1;
+ c->c_entry_num = lnode->entry_num;
+ }
+ num_vis++;
+ }
+
+ lnode->entry_num++;
+ //fprintf( conv_fp, "2. lnode_chunk: conv_get_node_text _GC(ent)=lnode->entry_num++!!!!\n" );
+ _GC(ent) = lnode->entry_num;
+ break;
+
+ case NODE_CHUNK:
+ for (i = 0; i < num_ents; i++) {
+
+ ent = get_long(c, offset);
+ entry = get_entry(c, offset + ent);
+
+ if (entry->tag != FALL_CHUNK) {
+ if ((entry->status != 0) && (num_ents != 0) && ok_status(entry)) {
+ if (conv_get_text(offset + ent, entry->size, c)) {
+ result = 1;
+
+ _G(cdd).player_non_player = 1;
+ }
+ num_vis++;
+ _GC(n_t_e)++;
+ }
+ } else {
+ fall = get_fall(c, offset + ent);
+ }
+
+ offset += sizeof(long);
+ }
+
+ if (fall) {
+ if (num_vis <= fall->val) {
+ _GC(n_t_e) = 0;
+
+ c->myCNode = fall->index;
+ c->mode = CONV_GET_TEXT_MODE; //aug2: was CONV_UPDATE_MODE;
+ //fprintf( conv_fp, "FALLTHROUGH!\n" ); //aug2
+ result = 0; //was 1
+ }
+ }
+ break;
+ }
+
+ return result;
+}
+
+void conv_shutdown(void) {
+ if (conv_get_handle())
+ conv_unload(conv_get_handle());
+
+ //nov27
+ if (_GC(myTextScrn))
+ TextScrn_Destroy(_GC(myTextScrn));
+ _GC(myTextScrn) = nullptr;
+}
+
+//simplify me.
+static void conv_start(Conv *c) {
+ long ok = 1, ent = 0, tag = 0, next;
+ decl_chunk *decl;
+
+ switch (c->exit_now) {
+ case CONV_OK: //potential prob. when entering while loop.
+ break;
+
+ //goto_exit encountered.
+ //a conversation state.
+ case CONV_BAIL:
+ return;
+
+ //goodbye forever.
+ case CONV_QUIT:
+ return;
+
+ //new conv. no restore file on hard disk.
+ case CONV_NEW:
+ c->exit_now = CONV_OK;
+ c->myCNode = 0;
+ break;
+ }
+
+ while ((ent < c->chunkSize) && ok) {
+ conv_ops_get_entry(ent, &next, &tag, c); //ok if c->myCNode = 0
+
+ switch (tag) {
+ case LNODE_CHUNK:
+ case NODE_CHUNK:
+ ok = 0;
+ break;
+
+ case DECL_CHUNK:
+ decl = get_decl(c, ent);
+ break;
+
+ default:
+ break;
+ }
+
+ if (ok)
+ ent = next;
+ }
+ c->myCNode = ent;
+
+ //if we exit, the current node is set, the next node is null
+}
+
+static int conv_next_node(Conv *c) {
+ //delete me....
+ if (c->myCNode == -1)
+ return 0;
+
+ switch (c->exit_now) {
+ case CONV_OK:
+ return 1;
+
+ case CONV_QUIT:
+ case CONV_BAIL:
+ return 0;
+
+ case CONV_NEW:
+ conv_start(c); //should go in conv_load.
+ return 1;
+ }
+ return 1;
+}
+
+static int conv_process_entry(int entry_num, Conv *c, int mode) {
+ node_chunk *node = nullptr;
+ lnode_chunk *lnode = nullptr;
+ entry_chunk *entry = nullptr;
+ fall_chunk *fall = nullptr;
+ long offset = 0, ent = 0, is_valid = 0, n = 0;
+ long next = 0, tag = 0, num_ents = 0;
+ int i = 0;
+ long sub_ent = 0;
+ int result = 1;
+ //int changed = 0;
+
+ //repeat fallthrough till done
+ for (;; ) {
+ //start by getting the current NODE or LNODE
+ conv_ops_get_entry(ent, &next, &tag, c);
+ switch (tag) {
+ case LNODE_CHUNK:
+ lnode = get_lnode(c, ent);
+ ent += sizeof(lnode_chunk);
+ num_ents = lnode->num_entries;
+ entry_num = lnode->entry_num;
+ c->node_hash = lnode->hash;
+ break;
+
+ case NODE_CHUNK:
+ node = get_node(c, ent);
+ ent += sizeof(node_chunk);
+ num_ents = node->num_entries;
+ c->node_hash = node->hash;
+ break;
+
+ default:
+ break;
+ }
+
+ //ent will now be pointing at an ENTRY or FALLTHROUGH
+ sub_ent = next;
+ conv_ops_get_entry(sub_ent, &next, &tag, c);
+ switch (tag) {
+ case FALL_CHUNK:
+ //we either want to jump to a new node
+ //or skip to the first offset.
+
+ fall = get_fall(c, sub_ent);
+
+ //do this to skip the fall chunk and all will be fine.
+ ent += sizeof(long); //was get_long, sizeof( fall_chunk )
+ n++; //don't increment i.
+ break;
+
+ case ENTRY_CHUNK:
+ break;
+
+ default:
+ break;
+ }
+
+ if (result)
+ break;
+ }
+
+ //not only i<entry_num, check to see entry->num_entries
+ while ((i < entry_num) && (n < num_ents)) {
+ offset = get_long(c, ent);
+ entry = get_entry(c, ent + offset);
+
+ if (((entry->status) != 0) && ok_status(entry)) {
+ i++;
+ is_valid = 1;
+ }
+
+ ent += sizeof(long);
+ n++;
+ }
+
+ ent -= sizeof(long);
+
+ if (is_valid) {
+ switch (mode) {
+ case CONV_GET_MESG_MODE:
+ result = conv_get_mesg(ent + offset, is_valid, c);
+ break;
+
+ case CONV_UPDATE_MODE:
+ conv_exec_entry(ent + offset, c);
+ break;
+ }
+ }
+
+ return result;
+}
+
+static void textBoxInit();
+
+static int conv_run(Conv *c) {
+ if (!c)
+ return 0;
+
+ int /*i=0,*/ result = 0;
+ int ok = 1;
+
+ if (conv_next_node(c)) {
+ switch (c->exit_now) {
+ case CONV_NEW:
+ //term_message( "conv_run CONV_NEW" );
+ break;
+
+ case CONV_QUIT:
+ //term_message( "conv_run CONV_QUIT" );
+ break;
+
+ case CONV_BAIL:
+ //term_message( "conv_run CONV_BAIL" );
+ break;
+
+ case CONV_OK:
+ //term_message( "conv_run CONV_OK" );
+ while (ok && conv_next_node(c)) {
+ switch (c->mode) {
+ case CONV_GET_TEXT_MODE:
+ cdd_init();
+ //////fprintf( conv_fp, "conv_run cdd_init\n" );
+
+ //////term_message( "conv_run CONV_GET_TEXT_MODE" );
+ //////fprintf( conv_fp, "conv_run CONV_GET_TEXT_MODE %x\n", c->myCNode ); //aug2
+
+ c->mode = CONV_GET_MESG_MODE;
+ if (conv_get_node_text(c)) {
+ //////fprintf( conv_fp, "got some text %d\n", _G(cdd).num_txt_ents );
+ ok = 0;
+ if (_G(cdd).num_txt_ents) { //node
+ mouse_unlock_sprite();
+ mouse_lock_sprite(0);
+
+ textBoxInit();
+ } else { //linear node.
+ conv_set_event(-1);
+ //////term_message( "conv_run LNODE text entry" );
+ Common::strcpy_s(_G(player).verb, get_conv_name()); //was verb.
+ c->c_entry_num = 1; //jun11 : as from conv.cp1
+ }
+ } ////else fprintf( conv_fp, "didn't get any text\n" );
+ break;
+
+ case CONV_GET_MESG_MODE:
+ cdd_init();
+ //////fprintf( conv_fp, "conv_run cdd_init\n" );
+
+ //////term_message( "conv_run CONV_GET_MESG_MODE" );
+ //////fprintf( conv_fp, "conv_run CONV_GET_MESG_MODE %x %d\n", c->myCNode, c->c_entry_num ); //aug2
+
+ if (conv_process_entry(c->c_entry_num, c, CONV_GET_MESG_MODE)) {
+ //aug15
+ mouse_unlock_sprite();
+ mouse_lock_sprite(5);
+
+ //////fprintf( conv_fp, "conv_run successful\n" );
+ conv_set_event(-1);
+ Common::strcpy_s(_G(player).verb, get_conv_name());
+
+ ok = 0;
+ }
+ c->mode = CONV_UPDATE_MODE;
+ break;
+
+ case CONV_UPDATE_MODE:
+ //////term_message( "conv_run CONV_UPDATE_MODE" );
+ //////fprintf( conv_fp, "conv_run CONV_UPDATE_MODE %x\n", c->myCNode ); //aug2
+ //////term_message( "conv_process_entry %d", c->c_entry_num );
+ conv_process_entry(c->c_entry_num, c, CONV_UPDATE_MODE);
+
+ c->mode = CONV_GET_TEXT_MODE;
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ if (!conv_next_node(c))
+ conv_unload(c);
+
+ return result;
+}
+
+
+
+/*
+ "xxxxxxxx" means the size you have calculated a conversation box to be,
+ x x given the sentences that are in it, and whatever border
+ x x space you may have in it. The boxes in Figure A may be
+ xxxxxxxx where the user wants to place them. Obviously, the user
+ won't try to put them out in hyperspace, but may do this
+ if he wants the box to be flush with a corner (to grow
+ up, down, left, or right.) Figure B is the re-calculated
+ coordinates of the boxes in order to get them onto the
+ background. The new boxes should not be in the interface
+ or in the letterboxed areas at the top and bottom.
+
+
+
+
+ xxxxxxxxx
+ x (d) x
+ x x Figure A xxxxxxxxxxxx
+ 0,0 xxxxxxxxx x (b) x
+ x x
+ x x
+ (letterbox at top) xxxxxxxxxxxx
+
+
+
+
+ (background)
+
+
+
+
+
+
+
+
+
+ xxxxxxxxxxxxx
+ x (c) x
+ x x
+ x x
+ x x
+ x x
+ xxxxxxxxxxxxxxxxxx x x
+ x x xxxxxxxxxxxxx
+ x x (interface)
+ x x
+ x x
+ x x
+ x x (letterbox at bottom)
+ x x
+ x x
+ x (a) x 640,479
+ xxxxxxxxxxxxxxxxxx
+
+
+
+
+
+
+ Figure B
+ 0,0
+
+
+
+
+
+
+ xxxxxxxx xxxxxxxxxxx
+ x (d) x x (b) x
+ x x x x
+ xxxxxxxx x x
+ xxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ x x
+ x x
+ x x xxxxxxxxxxxxx
+ x x x (c) x
+ x x x x
+ x x x x
+ x x x x
+ x (a) x x x
+ xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
+
+
+
+
+
+
+
+
+
+
+
+ 640,479
+
+
+
+
+ If someone says to draw conversation box (a) at the location in Figure 1,
+ then have it automatically re-position itself into where it is in Figure 2.
+ The extra space around the newly re-positioned box should be about 10 pixels
+ wide and/or tall. Make the spacing visually look identical. In other
+ words, if the height of the border is 10 pixels, the width on the side of
+ the new conversation box may need to be 15. You may have to experiment
+ with this. In even other words, you should correct for the aspect ration.
+
+ The same thing should work for boxes (b), (c), and (d).
+
+
+*/
+
+
+
+static void convtestCallback(void *a, void *b);
+//static TextScrn *_GC(myTextScrn); //nov27
+
+int32 glob_x = 0, glob_y = 0;
+static int32 r_x1, r_y1, r_x2, r_y2;
+
void set_dlg_rect() {
int32 sizex = 0, sizey = 0;
int32 screen_x_center = 0, screen_y_center = 0;
@@ -35,74 +1084,147 @@ void set_dlg_rect() {
int32 status;
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
- if (!game_buff_ptr)
- error_show(FL, 'BUF!');
+ if (!game_buff_ptr) error_show(FL, 'BUF!');
screen_x_center = VIDEO_W / 2;
screen_y_center = (game_buff_ptr->y2 - game_buff_ptr->y1) / 2;
screen_x_size = VIDEO_W;
screen_y_size = (game_buff_ptr->y2 - game_buff_ptr->y1);
- _GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v);
+ //term_message( "y2 %d", game_buff_ptr->y2 );
+ //term_message( "y1 %d", game_buff_ptr->y1 );
+
+ _GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v); //must have....
_GC(width) += 2 * _GC(conv_font_spacing_h);
+ //fprintf( conv_fp, "_GC(width) %d _GC(height) %d _G(cdd).nte %d\n", _GC(width), _GC(height), _G(cdd).num_txt_ents );
sizex = _GC(width);
sizey = _G(cdd).num_txt_ents * (_GC(height))+_GC(conv_font_spacing_v);
- switch (_GC(glob_x)) {
+ switch (glob_x) {
case DLG_CENTER_H:
- _GC(r_x1) = screen_x_center - (sizex / 2);
+ r_x1 = screen_x_center - (sizex / 2);
break;
case DLG_FLUSH_LEFT:
- _GC(r_x1) = 0;
+ r_x1 = 0;
break;
case DLG_FLUSH_RIGHT:
- _GC(r_x1) = screen_x_size - sizex;
+ r_x1 = screen_x_size - sizex;
break;
default:
- _GC(r_x1) = _GC(glob_x);
- _GC(r_x1) += game_buff_ptr->x1;
+ r_x1 = glob_x;
+ r_x1 += game_buff_ptr->x1;
break;
}
- switch (_GC(glob_y)) {
+ switch (glob_y) {
case DLG_CENTER_V:
- _GC(r_y1) = screen_y_center - (sizey / 2);
+ r_y1 = screen_y_center - (sizey / 2);
break;
case DLG_FLUSH_TOP:
- _GC(r_y1) = 0;
+ r_y1 = 0;
break;
case DLG_FLUSH_BOTTOM:
- _GC(r_y1) = screen_y_size - sizey + game_buff_ptr->y1 - 10;
+ r_y1 = screen_y_size - sizey + game_buff_ptr->y1 - 10;
break;
default:
- _GC(r_y1) = _GC(glob_y);
- _GC(r_y1) += game_buff_ptr->y1;
+ r_y1 = glob_y;
+ r_y1 += game_buff_ptr->y1;
break;
}
- if (_GC(r_x1) < 0)
- _GC(r_x1) = 0;
+ if (r_x1 < 0)
+ r_x1 = 0;
+
+ if (r_y1 < 0)
+ r_y1 = 0;
+
+ //fprintf( conv_fp, "r_x1 %d sizex %d\n", r_x1, sizex );
+ r_y2 = r_y1 + sizey - 1;
+ r_x2 = r_x1 + sizex - 1;
+
+ r_x2 = imath_min(VIDEO_W, r_x2);
+ r_y2 = imath_min(VIDEO_H, r_y2);
+}
+
+static void textBoxInit() {
+ int32 i;
+
+ player_set_commands_allowed(true);
+ mouse_set_sprite(0);
+
+ gr_font_set(_G(font_conv));
+
+ conv_get_node_text(conv_get_handle());
+ set_dlg_rect();
+
+ _GC(myTextScrn) = TextScrn_Create(r_x1, r_y1, r_x2, r_y2, _GC(conv_shading),
+ 6 | SF_GET_MOUSE | SF_IMMOVABLE | SF_BLOCK_MOUSE,
+ _GC(conv_normal_colour), _GC(conv_hilite_colour), _GC(conv_normal_colour_alt1),
+ _GC(conv_hilite_colour_alt1), _GC(conv_normal_colour_alt2),
+ _GC(conv_hilite_colour_alt2));
+
+ for (i = 0; i < _G(cdd).num_txt_ents; i++) {
+ TextScrn_Add_TextItem(_GC(myTextScrn), _GC(conv_font_spacing_h),
+ (i * _GC(height)) + _GC(conv_font_spacing_v), i + 1, TS_GIVEN,
+ _G(cdd).text[i], convtestCallback);
+ }
+
+ TextScrn_Activate(_GC(myTextScrn));
+}
+
+void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2) {
+ *x1 = r_x1;
+ *y1 = r_y1;
+ *x2 = r_x2;
+ *y2 = r_y2;
+}
+
+void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2) {
+ r_x1 = x1;
+ r_y1 = y1;
+ r_x2 = x2;
+ r_y2 = y2;
+}
+
+static void convtestCallback(void *a, void *) {
+ Conv *c;
+
+ //aug15
+ mouse_unlock_sprite();
+ mouse_lock_sprite(5);
+
+ player_set_commands_allowed(false);
+ TextItem *i = (TextItem *)a;
+
+ c = conv_get_handle();
+ if (!c)
+ return;
+
+ c->c_entry_num = i->tag;
+ c->mode = CONV_GET_MESG_MODE;
+
+ TextScrn_Destroy(_GC(myTextScrn));
+ _GC(myTextScrn) = nullptr; //nov27
- if (_GC(r_y1) < 0)
- _GC(r_y1) = 0;
+ find_true_ent(c->c_entry_num, c);
- //fprintf( conv_fp, "_GC(r_x1) %d sizex %d\n", _GC(r_x1), sizex );
- _GC(r_y2) = _GC(r_y1) + sizey - 1;
- _GC(r_x2) = _GC(r_x1) + sizex - 1;
+ _G(cdd).mesg_snd_file = _G(cdd).snd_files[c->c_entry_num - 1];
+ _G(cdd).player_non_player = 1;
- _GC(r_x2) = imath_min(VIDEO_W, _GC(r_x2));
- _GC(r_y2) = imath_min(VIDEO_H, _GC(r_y2));
+ Common::strcpy_s(_G(player).verb, get_conv_name());
+ _G(player).command_ready = true;
+ conv_set_event(-1); //must have or conv freezes.
}
void conv_go(Conv *c) {
- error("TODO: conv_go");
+ conv_run(c);
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index f99b81f31bf..962369216e2 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -97,7 +97,7 @@ struct Conv {
struct ConvDisplayData {
char *text[16];
char *snd_files[16];
- char mesg[1024];
+ char mesg[1024];
char *mesg_snd_file;
int num_txt_ents;
int player_non_player;
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index 3d87b2147e2..d8a55a82982 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -28,9 +28,29 @@
#include "m4/m4_types.h"
#include "m4/adv_r/conv.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/gui/gui_dialog.h"
namespace M4 {
+#define HIDDEN 0x00000004
+#define DESTROYED 0x00000008
+
+#define INITIAL 1
+#define PERSISTENT 2
+
+#define CONV_OK 0
+#define CONV_QUIT -1
+#define CONV_NEW -2
+#define CONV_BAIL -3
+
+#define CONV_UNKNOWN_MODE 0
+#define CONV_GET_TEXT_MODE 1
+#define CONV_SET_TEXT_MODE 2
+#define CONV_GET_MESG_MODE 3
+#define CONV_UPDATE_MODE 4
+
+#define DECL_POINTER 1
+
struct Converstation_Globals {
Common::Array<byte> conv_save_buff;
Common::Array<byte> convSave;
@@ -60,9 +80,11 @@ struct Converstation_Globals {
int32 conv_hilite_colour_alt2 = __YELLOW;
int32 conv_default_normal_colour = __BLACK;
+ TextScrn *myTextScrn = nullptr;
int32 width = 0, height = 0;
int32 glob_x = 0, glob_y = 0;
int32 r_x1 = 0, r_y1 = 0, r_x2 = 0, r_y2 = 0;
+ int n_t_e = 0;
void syncGame(Common::Serializer &s);
@@ -123,6 +145,11 @@ extern void conv_swap_words(Conv *c);
extern long conv_current_node();
extern int32 conv_current_entry();
+extern int conv_toggle_flags(entry_chunk *entry);
+extern int ok_status(entry_chunk *entry);
+extern int conv_get_text(long offset, long size, Conv *c);
+extern void cdd_init();
+
} // End of namespace M4
#endif
Commit: 270e5970c5a3d4a102dbe5c7e8a9b1935bc2a46f
https://github.com/scummvm/scummvm/commit/270e5970c5a3d4a102dbe5c7e8a9b1935bc2a46f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix random speech in room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 62f5faa630f..081269faf89 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -1077,7 +1077,7 @@ void Room141::conv20() {
void Room141::playRandom() {
if (_flag1 && !_val8) {
_flag1 = false;
- digi_play(Common::String::format("140t001%c", 'c' + imath_ranged_rand(0, 5)).c_str(),
+ digi_play(Common::String::format("140t001%c", 'a' + imath_ranged_rand(0, 5)).c_str(),
2, 100, 9);
}
}
Commit: 3be76481c82ebd25fbaebe2d09c0ed1a17dc0c1b
https://github.com/scummvm/scummvm/commit/3be76481c82ebd25fbaebe2d09c0ed1a17dc0c1b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix crash exiting ScummVM whilst conversation is active
Changed paths:
engines/m4/burger/gui/interface.cpp
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 03176ebc58a..20127381bdd 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -222,6 +222,8 @@ bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int3
if (_state == NOTHING) {
int32 scrStatus;
ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
+ if (!screen)
+ return false;
if (y >= _y1) {
if (!_iconSelected)
Commit: 41850d49a2c5ef557857b86885583b84e20f7dcf
https://github.com/scummvm/scummvm/commit/41850d49a2c5ef557857b86885583b84e20f7dcf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 801 daemon
Changed paths:
engines/m4/burger/core/release_trigger.h
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room801.h
diff --git a/engines/m4/burger/core/release_trigger.h b/engines/m4/burger/core/release_trigger.h
index b0fb2c19ed4..79c2b305ca6 100644
--- a/engines/m4/burger/core/release_trigger.h
+++ b/engines/m4/burger/core/release_trigger.h
@@ -33,7 +33,8 @@ struct ReleaseTrigger_Globals {
uint32 _check_channels = 0, _match_value = 0;
};
-extern void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue);
+extern void release_trigger_on_digi_state(int32 trigger, int32 checkChannels,
+ int32 matchValue = 0);
extern void release_trigger_digi_check();
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 5b4b74e982a..48be685536b 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -27,20 +27,20 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-static const seriesStreamBreak STREAMS1[] = {
+static const seriesStreamBreak SERIES1[] = {
{ 0, "805_001", 3, 80, -1, 0, nullptr, 0 },
{ 1, "805w001", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS2[] = {
+static const seriesStreamBreak SERIES2[] = {
{ 1, "806f002", 1, 255, -1, 0, nullptr, 0 },
{ 22, "806z002", 1, 255, -1, 0, nullptr, 0 },
{ 36, "806f003", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS3[] = {
+static const seriesStreamBreak SERIES3[] = {
{ 0, "803w001", 1, 255, -1, 0, nullptr, 0 },
{ 59, "803z006", 1, 255, -1, 0, nullptr, 0 },
{ 86, "803z007", 1, 255, -1, 0, nullptr, 0 },
@@ -50,7 +50,7 @@ static const seriesStreamBreak STREAMS3[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS4[] = {
+static const seriesStreamBreak SERIES4[] = {
{ 5, "802_014", 2, 255, -1, 0, nullptr, 0 },
{ 16, "802f008", 1, 255, -1, 0, nullptr, 0 },
{ 28, "802f009", 1, 255, -1, 0, nullptr, 0 },
@@ -58,7 +58,7 @@ static const seriesStreamBreak STREAMS4[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS5[] = {
+static const seriesStreamBreak SERIES5[] = {
{ 0, "807_001", 3, 255, -1, 0, nullptr, 0 },
{ 0, "807_002", 2, 255, -1, 0, nullptr, 0 },
{ 1, "804_003", 2, 255, -1, 0, nullptr, 0 },
@@ -72,7 +72,7 @@ static const seriesStreamBreak STREAMS5[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS6[] = {
+static const seriesStreamBreak SERIES6[] = {
{ 0, nullptr, 0, 0, 37, 0, nullptr, 0 },
{ 5, "801w001", 1, 255, -1, 0, nullptr, 0 },
{ 10, "801_001", 2, 75, -1, 0, nullptr, 0 },
@@ -84,7 +84,7 @@ static const seriesStreamBreak STREAMS6[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS7[] = {
+static const seriesStreamBreak SERIES7[] = {
{ 0, nullptr, 0, 0, 37, 0, nullptr, 0 },
{ 7, "801_003", 1, 175, -1, 0, nullptr, 0 },
{ 23, "802_017", 2, 75, -1, 0, nullptr, 0 },
@@ -95,7 +95,7 @@ static const seriesStreamBreak STREAMS7[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS8[] = {
+static const seriesStreamBreak SERIES8[] = {
{ 0, "803_008", 2, 175, -1, 0, nullptr, 0 },
{ 10, "803_009", 1, 255, -1, 0, nullptr, 0 },
{ 10, "803_002", 2, 200, -1, 0, nullptr, 0 },
@@ -107,7 +107,7 @@ static const seriesStreamBreak STREAMS8[] = {
STREAM_BREAK_END
};
-static const seriesStreamBreak STREAMS9[] = {
+static const seriesStreamBreak SERIES9[] = {
{ 3, "804_002", 2, 150, -1, 0, nullptr, 0 },
{ 14, "804_003", 2, 150, -1, 0, nullptr, 0 },
{ 17, "804_003", 2, 150, -1, 0, nullptr, 0 },
@@ -138,11 +138,11 @@ void Room801::init() {
term_message(HEADER);
term_message("Toxic wax in hair");
- digi_preload_stream_breaks(STREAMS1);
- digi_preload_stream_breaks(STREAMS2);
- digi_preload_stream_breaks(STREAMS3);
- digi_preload_stream_breaks(STREAMS4);
- digi_preload_stream_breaks(STREAMS5);
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+ digi_preload_stream_breaks(SERIES5);
kernel_trigger_dispatch_now(20);
} else {
@@ -151,9 +151,9 @@ void Room801::init() {
term_message(HEADER);
term_message("FIRST ATTEMPT AT NEURO TEST");
- digi_preload_stream_breaks(STREAMS6);
- digi_preload_stream_breaks(STREAMS7);
- digi_preload_stream_breaks(STREAMS8);
+ digi_preload_stream_breaks(SERIES6);
+ digi_preload_stream_breaks(SERIES7);
+ digi_preload_stream_breaks(SERIES8);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 0, -1);
kernel_trigger_dispatch_now(1);
@@ -162,14 +162,14 @@ void Room801::init() {
case 1:
term_message(HEADER);
term_message("SECOND ATTEMPT AT NEURO TEST");
- digi_preload_stream_breaks(STREAMS8);
+ digi_preload_stream_breaks(SERIES8);
kernel_trigger_dispatch_now(4);
break;
case 2:
term_message(HEADER);
term_message("THIRD ATTEMPT AT NEURO TEST");
- digi_preload_stream_breaks(STREAMS8);
+ digi_preload_stream_breaks(SERIES8);
kernel_trigger_dispatch_now(41);
kernel_trigger_dispatch_now(7);
break;
@@ -177,7 +177,7 @@ void Room801::init() {
default:
term_message(HEADER);
term_message("FOURTH OR GREATER ATTEMPT AT NEURO TEST");
- digi_preload_stream_breaks(STREAMS5);
+ digi_preload_stream_breaks(SERIES5);
kernel_trigger_dispatch_now(20);
break;
}
@@ -185,7 +185,83 @@ void Room801::init() {
}
void Room801::daemon() {
- warning("TODO: Room 801 daemon");
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_init(-1);
+ series_stream_with_breaks(SERIES6, "801A", 6, 1, 2);
+ kernel_timing_trigger(1, 39);
+ break;
+
+ case 2:
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(4, 1, 0);
+ break;
+
+ case 4:
+ digi_play_loop("802_002", 3);
+ pal_fade_init(-1);
+ series_stream_with_breaks(SERIES7, "802A", 6, 1, 5);
+ kernel_timing_trigger(1, 39);
+ break;
+
+ case 5:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 6);
+ break;
+
+ case 6:
+ compact_mem_and_report();
+
+ if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ release_trigger_on_digi_state(7, 3);
+ } else {
+ release_trigger_on_digi_state(10, 3);
+ }
+ break;
+
+ case 7:
+ digi_unload_stream_breaks(SERIES6);
+ series_stream_with_breaks(SERIES8, "803A", 6, 1, 8);
+ pal_fade_init(-1);
+ kernel_timing_trigger(1, 40);
+ break;
+
+ case 8:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 9);
+ break;
+
+ case 9:
+ pal_cycle_stop();
+ compact_mem_and_report();
+
+ if (_G(flags)[NEURO_TEST_COUNTER] == 2) {
+ release_trigger_on_digi_state(20, 1);
+ } else {
+ release_trigger_on_digi_state(10, 1);
+ }
+ break;
+
+ case 10:
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES9);
+ _series1 = series_load("804FX01");
+ _series2 = series_load("804FX02");
+ _series3 = series_load("804FX03");
+ _series4 = series_load("804FX04");
+ series_stream_with_breaks(SERIES9, "804A", 6, 1, 11);
+ pal_fade_init(-1);
+ break;
+
+ // TODO: More cases
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room801::parser() {
diff --git a/engines/m4/burger/rooms/section8/room801.h b/engines/m4/burger/rooms/section8/room801.h
index 0cd64255786..150aac47c9e 100644
--- a/engines/m4/burger/rooms/section8/room801.h
+++ b/engines/m4/burger/rooms/section8/room801.h
@@ -30,6 +30,10 @@ namespace Rooms {
class Room801 : public Room {
private:
+ int _series1 = 0;
+ int _series2 = 0;
+ int _series3 = 0;
+ int _series4 = 0;
int _val1 = 10;
public:
Commit: 003d6ca0b3245669fd78f51a5eaa40cf288cfea9
https://github.com/scummvm/scummvm/commit/003d6ca0b3245669fd78f51a5eaa40cf288cfea9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 801 daemon
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room801.h
engines/m4/burger/vars.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
engines/m4/wscript/ws_machine.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 48be685536b..90b3a13986b 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -257,7 +257,361 @@ void Room801::daemon() {
pal_fade_init(-1);
break;
- // TODO: More cases
+ case 11:
+ digi_unload_stream_breaks(SERIES8);
+ compact_mem_and_report();
+
+ if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ kernel_trigger_dispatch_now(13);
+ } else {
+ _G(wilbur_should) = getWilburShould();
+ _val2 = 2;
+ _val3 = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(16);
+ kernel_trigger_dispatch_now(15);
+
+ loadSeries1();
+ kernel_timing_trigger(6, 18);
+ }
+ break;
+
+ case 12:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(13, 1);
+ break;
+
+ case 13:
+ kernel_trigger_dispatch_now(41);
+ loadSeries1();
+ loadSeries2();
+
+ _G(wilbur_should) = getWilburShould();
+ _val2 = 2;
+ _val3 = 2;
+
+ _series9 = series_play("804FL01", 2);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(16);
+ kernel_trigger_dispatch_now(15);
+ conv_load_and_prepare("conv80", 18);
+ player_set_commands_allowed(true);
+ conv_play_curr();
+ break;
+
+ case 14:
+ if (conv_sound_to_play()) {
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (who <= 0) {
+ if ((node == 3 && entry == 0) || (node == 4 && entry == 0) ||
+ (node == 6 && entry == 1) || (node == 8 && entry == 0)) {
+ _val3 = 13;
+ } else {
+ _val2 = 13;
+ }
+ } else if (who == 1) {
+ _val3 = 13;
+ }
+ }
+ break;
+
+ case 15:
+ switch (_val2) {
+ case 3:
+ terminateMachineAndNull(_series10);
+ _series10 = series_show("804FLX01", 1);
+ digi_play("804_006", 2);
+ kernel_timing_trigger(60, 19);
+ break;
+
+ case 12:
+ terminateMachineAndNull(_series10);
+ _val2 = 2;
+ kernel_trigger_dispatch_now(15);
+ conv_resume_curr();
+ break;
+
+ case 13:
+ _val2 = 12;
+ _G(wilbur_should) = 6;
+ _series10 = series_play("804FLT01", 1, 4);
+ digi_play(conv_sound_to_play(), 1, 255, 15);
+ break;
+
+ default:
+ _val2 = 2;
+ _series10 = series_show("804FL01", 1, 0, 15, 30, 0);
+ break;
+ }
+ break;
+
+ case 16:
+ switch (_val3) {
+ case 2:
+ if (imath_ranged_rand(0, 15) <= 12) {
+ _val3 = 2;
+ _series11 = series_show("804ZL01", 1, 0, 16);
+ } else {
+ _val3 = 1;
+ kernel_trigger_dispatch_now(16);
+ }
+ break;
+
+ case 12:
+ terminateMachineAndNull(_series11);
+ _val3 = 2;
+ kernel_trigger_dispatch_now(16);
+ conv_resume_curr();
+ break;
+
+ case 13:
+ _val3 = 12;
+ _G(wilbur_should) = 4;
+ _series11 = series_play("804ZLT01", 1, 4);
+ digi_play(conv_sound_to_play(), 1, 255, 16);
+ break;
+
+ default:
+ _val3 = 2;
+ _series11 = series_play("804ZFX01", 1, 0, 16);
+ break;
+ }
+ break;
+
+ case 18:
+ terminateMachineAndNull(_series10);
+ terminateMachineAndNull(_series9);
+ _val2 = 3;
+ _series10 = series_play("804FLX01", 1, 16, -1, 6, 0, 100, 0, 0, 0, 7);
+ kernel_timing_trigger(180, 15);
+ break;
+
+ case 19:
+ pal_fade_set_start(0);
+
+ terminateMachineAndNull(_series12);
+ terminateMachineAndNull(_series10);
+ terminateMachineAndNull(_series11);
+
+ freeSeries1();
+ digi_unload_stream_breaks(SERIES7);
+ kernel_trigger_dispatch_now(20);
+ break;
+
+ case 20:
+ player_set_commands_allowed(false);
+ digi_preload_stream_breaks(SERIES5);
+ digi_preload("806w001");
+ adv_kill_digi_between_rooms(false);
+ series_stream_with_breaks(SERIES5, "807A", 6, 1, 21);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 21:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 16);
+ digi_unload_stream_breaks(SERIES9);
+ break;
+
+ case 22:
+ compact_mem_and_report();
+ kernel_trigger_dispatch_now(23);
+ break;
+
+ case 23:
+ if (_G(flags)[GLB_TEMP_5] == 1) {
+ kernel_trigger_dispatch_now(24);
+ } else if (_G(flags)[NEURO_TEST_COUNTER] <= 2) {
+ digi_unload("804_003");
+ digi_unload("807_002");
+ adv_kill_digi_between_rooms(false);
+ digi_play_loop("806w001", 1, 128, -1, 806);
+ digi_play_loop("807_003", 2, 255, -1, 807);
+ digi_play_loop("807_001", 3, 255, -1, 807);
+
+ _G(game).new_room = 802;
+ } else {
+ kernel_trigger_dispatch_now(g10027);
+ }
+ break;
+
+ case 24:
+ series_stream_with_breaks(SERIES1, "805A", 6, 1, 25);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 25:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 26);
+ break;
+
+ case 26:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(27, 1);
+ break;
+
+ case 27:
+ digi_unload_stream_breaks(SERIES5);
+ kernel_trigger_dispatch_now(41);
+ series_stream_with_breaks(SERIES2, "806B", 6, 1, 28);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 28:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 29);
+ break;
+
+ case 29:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(30, 1);
+ break;
+
+ case 30:
+ digi_unload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES3, "803c", 6, 1, 31);
+ pal_fade_init(0, 255, 100, 30, -1);
+ kernel_timing_trigger(1, 40);
+ break;
+
+ case 31:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 32);
+ break;
+
+ case 32:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(33, 1);
+ break;
+
+ case 33:
+ pal_cycle_stop();
+ digi_unload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES4, "802C", 6, 1, 34);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 34:
+ pal_fade_set_start(0);
+ digi_unload_stream_breaks(SERIES3);
+ kernel_timing_trigger(6, 35);
+ break;
+
+ case 35:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(36, 1);
+ break;
+
+ case 36:
+ _G(flags)[ROOM101_FLAG2] = 1;
+ adv_kill_digi_between_rooms(1);
+ kernel_trigger_dispatch_now(g10027);
+ break;
+
+ case 37:
+ pal_fade_init(30);
+ break;
+
+ case 38:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, -1);
+ break;
+
+ case 39:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ break;
+
+ case 40:
+ pal_mirror_colours(119, 112, _G(master_palette));
+ gr_pal_set_range(119, 8);
+ pal_cycle_init(119, 126, 6, -1, -1);
+ break;
+
+ case 41:
+ digi_play_loop("800_001", 3, 48, -1, 800);
+ break;
+
+ case 42:
+ if (_G(flags)[GLB_TEMP_5] != 1)
+ digi_play("806w001", 1, 128);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_val1) {
+ case 9:
+ switch (_G(wilbur_should)) {
+ case 7:
+ _series12 = series_play("804WI04", 0x200, 2, gCHANGE_WILBUR_ANIMATION);
+ _val1 = 11;
+ break;
+
+ default:
+ _G(wilbur_should) = getWilburShould();
+ _series12 = series_show("804Wi04", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 30, 1);
+ break;
+ }
+ break;
+
+ case 10:
+ switch (_G(wilbur_should)) {
+ case 4:
+ case 7:
+ _series12 = series_play("804WI05", 0x200, 2, gCHANGE_WILBUR_ANIMATION);
+ _val1 = 11;
+ break;
+
+ case 5:
+ _G(wilbur_should) = 12;
+ _series12 = series_play("804WI01", 0x200, 4);
+ digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 12:
+ terminateMachineAndNull(_series12);
+ _G(wilbur_should) = getWilburShould();
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ conv_resume_curr();
+ break;
+
+ default:
+ _G(wilbur_should) = getWilburShould();
+ _series12 = series_show("804WI05", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 30, 3);
+ break;
+ }
+ break;
+
+ case 11:
+ switch (_G(wilbur_should)) {
+ case 4:
+ _series12 = series_play("804WI04", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _val1 = 9;
+ break;
+
+ case 5:
+ case 6:
+ _series12 = series_play("804WI05", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _val1 = 10;
+ break;
+
+ case 7:
+ _G(wilbur_should) = getWilburShould();
+ _series12 = series_play("804WI03", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ _G(wilbur_should) = getWilburShould();
+ _series12 = series_play("804WI02", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -273,6 +627,51 @@ void Room801::parser() {
}
}
+int Room801::getWilburShould() const {
+ switch (imath_ranged_rand(0, 15)) {
+ case 1:
+ case 2:
+ return 7;
+ case 6:
+ case 7:
+ return 6;
+ case 12:
+ return 4;
+ default:
+ return 8;
+ }
+}
+
+void Room801::loadSeries1() {
+ _series5 = series_play("804FX01", 0x400, 0, -1, 10);
+ _series6 = series_play("804FX02", 0x400, 0, -1, 45);
+ _series7 = series_play("804FX03", 0x400, 0, -1, 10);
+ _series8 = series_play("804FX04", 0x400, 0, -1, 10);
+}
+
+void Room801::loadSeries2() {
+ static const char *NAMES[16] = {
+ "804FX01", "804FX02", "804FX03", "804FX04", "804Wi01", "804Wi02",
+ "804Wi03", "804Wi04", "804Wi05", "804FL01", "804ZL01", "804FL01",
+ "804FLT01", "804ZLT01", "804FLX01", "804ZFX01"
+ };
+
+ digi_preload("804_005");
+ for (int i = 0; i < 16; ++i)
+ series_load(NAMES[i]);
+}
+
+void Room801::freeSeries1() {
+ terminateMachineAndNull(_series5);
+ terminateMachineAndNull(_series6);
+ terminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series8);
+ series_unload(_series1);
+ series_unload(_series2);
+ series_unload(_series3);
+ series_unload(_series4);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/room801.h b/engines/m4/burger/rooms/section8/room801.h
index 150aac47c9e..b5e3b02cebb 100644
--- a/engines/m4/burger/rooms/section8/room801.h
+++ b/engines/m4/burger/rooms/section8/room801.h
@@ -34,7 +34,22 @@ private:
int _series2 = 0;
int _series3 = 0;
int _series4 = 0;
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
+ machine *_series8 = nullptr;
+ machine *_series9 = nullptr;
+ machine *_series10 = nullptr;
+ machine *_series11 = nullptr;
+ machine *_series12 = nullptr;
int _val1 = 10;
+ int _val2 = 0;
+ int _val3 = 0;
+
+ int getWilburShould() const;
+ void loadSeries1();
+ void loadSeries2();
+ void freeSeries1();
public:
Room801() : Room() {}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8fd170e9975..607100c24ea 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -64,6 +64,7 @@ enum global_triggers {
gUNPOOF = 10021,
gTELEPROTED1 = 10024,
gTELEPROTED2 = 10025,
+ g10027 = 10027,
g10028 = 10028,
gCALLED_EACH_LOOP = 32764,
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 7ba5e595954..9890c282279 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -23,6 +23,7 @@
#include "graphics/palette.h"
#include "common/textconsole.h"
#include "m4/graphics/gr_pal.h"
+#include "m4/core/errors.h"
#include "m4/vars.h"
namespace M4 {
@@ -82,6 +83,10 @@ void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors) {
g_system->updateScreen();
}
+void gr_pal_set_range(int first_color, int num_colors) {
+ gr_pal_set_range(_G(master_palette), first_color, num_colors);
+}
+
void gr_pal_set_entry(int32 index, RGB8 *entry) {
g_system->getPaletteManager()->setPalette((const byte *)entry, index, 1);
g_system->updateScreen();
@@ -174,4 +179,16 @@ void gr_restore_palette() {
Common::copy(_G(backup_palette), _G(backup_palette) + 768, _G(master_palette));
}
+void pal_mirror_colours(int first_color, int last_color, RGB8 *pal) {
+ if (first_color < 0 || last_color > 255 || first_color > last_color)
+ error_show(FL, 'Burg', "pal_mirror_colours index error");
+
+ int num_colors = last_color - first_color + 1;
+ for (int index = 0; index < num_colors; ++index) {
+ RGB8 *destP = pal + (last_color + num_colors - index);
+ RGB8 *srcP = pal + (first_color + index);
+ *destP = *srcP;
+ }
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index 1075fc32af8..e3e8ee28e3c 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -54,6 +54,7 @@ extern void gr_color_set(int32 c);
extern byte gr_color_get_current();
extern void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors);
+extern void gr_pal_set_range(int first_color, int num_colors);
extern void gr_pal_set(RGB8 *pal);
extern void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b);
extern void gr_pal_set_entry(int32 index, RGB8 *entry);
@@ -65,6 +66,8 @@ extern void gr_pal_reset_ega_colors(RGB8 *pal);
extern void gr_backup_palette();
extern void gr_restore_palette();
+extern void pal_mirror_colours(int first_color, int last_color, RGB8 *pal);
+
} // namespace M4
#endif
diff --git a/engines/m4/wscript/ws_machine.cpp b/engines/m4/wscript/ws_machine.cpp
index 68061534abb..2f999b52dcf 100644
--- a/engines/m4/wscript/ws_machine.cpp
+++ b/engines/m4/wscript/ws_machine.cpp
@@ -779,7 +779,8 @@ void terminateMachine(machine *myMachine) {
}
void terminateMachineAndNull(machine *&m) {
- terminateMachine(m);
+ if (m)
+ terminateMachine(m);
m = nullptr;
}
Commit: 6a80430628b23ca1179186186f53b2e8198d7719
https://github.com/scummvm/scummvm/commit/6a80430628b23ca1179186186f53b2e8198d7719
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of room 802 daemon
Changed paths:
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/rooms/section8/room802.h
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index e59c348614d..c563bc7e2e5 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -27,7 +27,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-static const seriesStreamBreak STREAMS1[] = {
+static const seriesStreamBreak SERIES1[] = {
{ 0, "802_012", 1, 150, -1, 0, nullptr, 0 },
{ 8, "802_003", 2, 175, -1, 0, nullptr, 0 },
{ 24, "802_010", 2, 255, -1, 0, nullptr, 0 },
@@ -41,6 +41,89 @@ static const seriesStreamBreak STREAMS1[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak SERIES2[] = {
+ { 0, "806B_001", 3, 100, -1, 0, nullptr, 0 },
+ { 6, "806z001", 1, 255, -1, 0, nullptr, 0 },
+ { 83, "806f001", 1, 255, -1, 0, nullptr, 0 },
+ { 98, "806A_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES3[] = {
+ { 4, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ { 5, "803f002", 1, 255, -1, 0, nullptr, 0 },
+ { 15, "803_006", 2, 75, -1, 0, nullptr, 0 },
+ { 19, "803_007", 2, 75, -1, 0, nullptr, 0 },
+ { 30, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ { 34, "803_006", 2, 75, -1, 0, nullptr, 0 },
+ { 40, "803_007", 2, 75, -1, 0, nullptr, 0 },
+ { 40, "803z004", 1, 255, -1, 0, nullptr, 0 },
+ { 57, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ { 61, "803_006", 2, 75, -1, 0, nullptr, 0 },
+ { 78, "803_007", 2, 75, -1, 0, nullptr, 0 },
+ { 82, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ { 99, "803_006", 2, 75, -1, 0, nullptr, 0 },
+ { 103, "803_007", 2, 75, -1, 0, nullptr, 0 },
+ { 115, "803z005", 1, 255, -1, 0, nullptr, 0 },
+ { 131, "803f003", 1, 255, -1, 0, nullptr, 0 },
+ { 133, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ { 137, "803_006", 2, 75, -1, 0, nullptr, 0 },
+ { 147, "803f004", 1, 255, -1, 0, nullptr, 0 },
+ { 154, "803_007", 2, 75, -1, 0, nullptr, 0 },
+ { 158, "803_005", 2, 75, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES4[] = {
+ { 6, "802f003", 1, 255, -1, 0, nullptr, 0 },
+ { 8, "802w002", 2, 255, -1, 0, nullptr, 0 },
+ { 22, "802_018", 1, 150, -1, 0, nullptr, 0 },
+ { 26, "802_005", 2, 75, -1, 0, nullptr, 0 },
+ { 40, "802_006", 2, 75, -1, 0, nullptr, 0 },
+ { 76, "802_008", 2, 75, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 2, 5, "802_008", 2, 100, -1, 1, 2, nullptr, 0 },
+ { 5, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 6, 9, "802_013", 2, 100, -1, 1, 1, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 10, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY5[] = {
+ { 0, 7, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 7, 7, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 7, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY6[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 8, 14, "802_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room802::init() {
_G(player).walker_in_this_scene = false;
interface_hide();
@@ -56,7 +139,7 @@ void Room802::init() {
if (_G(flags)[NEURO_TEST_COUNTER] > 1) {
kernel_trigger_dispatch_now(24);
- digi_preload_stream_breaks(STREAMS1);
+ digi_preload_stream_breaks(SERIES1);
kernel_trigger_dispatch_now(14);
} else {
kernel_trigger_dispatch_now(1);
@@ -64,7 +147,30 @@ void Room802::init() {
}
void Room802::daemon() {
- warning("TODO: room 802 daemon");
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+ loadSeries();
+ digi_preload_stream_breaks(SERIES1);
+
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+ digi_unload("800w001");
+ digi_unload("807_002");
+ digi_unload("807_001");
+
+ series_stream_with_breaks(SERIES2, "806A", 6, 1, 2);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ // TODO: More cases
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room802::parser() {
@@ -76,6 +182,19 @@ void Room802::parser() {
}
}
+void Room802::loadSeries() {
+ digi_preload_play_breaks(PLAY1);
+ digi_preload_play_breaks(PLAY2);
+ digi_preload_play_breaks(PLAY6);
+
+ static const char *NAMES[12] = {
+ "802BFX02", "802BFX03", "802BF01", "802BF01S", "802BF02", "802BF02S",
+ "802BF03", "802BF03S", "802BW01", "802BW02", "802BW03", "802BW04"
+ };
+ for (int i = 0; i < 12; ++i)
+ series_load(NAMES[i]);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/room802.h b/engines/m4/burger/rooms/section8/room802.h
index f438c2a0b6c..e76857d3f66 100644
--- a/engines/m4/burger/rooms/section8/room802.h
+++ b/engines/m4/burger/rooms/section8/room802.h
@@ -34,6 +34,9 @@ private:
int _val2 = 2;
int _val3 = 0;
int _val4 = 0;
+
+ void loadSeries();
+
public:
Room802() : Room() {}
~Room802() override {}
Commit: abb60a419920aaf052f6d68e10c629826a5b7dde
https://github.com/scummvm/scummvm/commit/abb60a419920aaf052f6d68e10c629826a5b7dde
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 802 daemon
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room801.h
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/rooms/section8/room802.h
engines/m4/burger/vars.h
engines/m4/graphics/gr_pal.cpp
engines/m4/graphics/gr_pal.h
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 90b3a13986b..6feddac02df 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -265,7 +265,7 @@ void Room801::daemon() {
kernel_trigger_dispatch_now(13);
} else {
_G(wilbur_should) = getWilburShould();
- _val2 = 2;
+ _G(roomVal4) = 2;
_val3 = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(16);
@@ -287,7 +287,7 @@ void Room801::daemon() {
loadSeries2();
_G(wilbur_should) = getWilburShould();
- _val2 = 2;
+ _G(roomVal4) = 2;
_val3 = 2;
_series9 = series_play("804FL01", 2);
@@ -310,7 +310,7 @@ void Room801::daemon() {
(node == 6 && entry == 1) || (node == 8 && entry == 0)) {
_val3 = 13;
} else {
- _val2 = 13;
+ _G(roomVal4) = 13;
}
} else if (who == 1) {
_val3 = 13;
@@ -319,7 +319,7 @@ void Room801::daemon() {
break;
case 15:
- switch (_val2) {
+ switch (_G(roomVal4)) {
case 3:
terminateMachineAndNull(_series10);
_series10 = series_show("804FLX01", 1);
@@ -329,20 +329,20 @@ void Room801::daemon() {
case 12:
terminateMachineAndNull(_series10);
- _val2 = 2;
+ _G(roomVal4) = 2;
kernel_trigger_dispatch_now(15);
conv_resume_curr();
break;
case 13:
- _val2 = 12;
+ _G(roomVal4) = 12;
_G(wilbur_should) = 6;
_series10 = series_play("804FLT01", 1, 4);
digi_play(conv_sound_to_play(), 1, 255, 15);
break;
default:
- _val2 = 2;
+ _G(roomVal4) = 2;
_series10 = series_show("804FL01", 1, 0, 15, 30, 0);
break;
}
@@ -384,7 +384,7 @@ void Room801::daemon() {
case 18:
terminateMachineAndNull(_series10);
terminateMachineAndNull(_series9);
- _val2 = 3;
+ _G(roomVal4) = 3;
_series10 = series_play("804FLX01", 1, 16, -1, 6, 0, 100, 0, 0, 0, 7);
kernel_timing_trigger(180, 15);
break;
diff --git a/engines/m4/burger/rooms/section8/room801.h b/engines/m4/burger/rooms/section8/room801.h
index b5e3b02cebb..c163a79d26e 100644
--- a/engines/m4/burger/rooms/section8/room801.h
+++ b/engines/m4/burger/rooms/section8/room801.h
@@ -43,7 +43,6 @@ private:
machine *_series11 = nullptr;
machine *_series12 = nullptr;
int _val1 = 10;
- int _val2 = 0;
int _val3 = 0;
int getWilburShould() const;
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index c563bc7e2e5..1e21eb3ca02 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -134,8 +134,8 @@ void Room802::init() {
_val1 = 11;
_val2 = 2;
- _val3 = 0;
- _val4 = 0;
+ _flag1 = false;
+ _flag2 = false;
if (_G(flags)[NEURO_TEST_COUNTER] > 1) {
kernel_trigger_dispatch_now(24);
@@ -166,7 +166,376 @@ void Room802::daemon() {
pal_fade_init(0, 255, 100, 30, -1);
break;
- // TODO: More cases
+ case 2:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ switch (_G(flags)[NEURO_TEST_COUNTER]) {
+ case 0:
+ release_trigger_on_digi_state(4, 1);
+ break;
+ case 1:
+ kernel_trigger_dispatch_now(24);
+ release_trigger_on_digi_state(7, 1);
+ break;
+ default:
+ kernel_trigger_dispatch_now(24);
+ release_trigger_on_digi_state(14, 1);
+ break;
+ }
+ break;
+
+ case 4:
+ kernel_trigger_dispatch_now(24);
+ series_stream_with_breaks(SERIES3, "803B", 6, 1, 5);
+ pal_fade_init(0, 255, 10, 30, -1);
+ kernel_timing_trigger(1, 23);
+ break;
+
+ case 5:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 6);
+ break;
+
+ case 6:
+ pal_cycle_stop();
+ compact_mem_and_report();
+ release_trigger_on_digi_state(7, 1);
+ break;
+
+ case 7:
+ digi_unload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES4, "802B1", 6, 1, 10);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 8:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 9);
+ break;
+
+ case 9:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(10, 1);
+ break;
+
+ case 10:
+ digi_preload("802_019");
+ digi_play_loop("802_019", 3, 128);
+
+ if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ player_set_commands_allowed(true);
+ digi_unload_stream_breaks(SERIES3);
+
+ _G(wilbur_should) = getWilburShould();
+ _val2 = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(17);
+
+ _series1 = series_play("802BFX03", 0x101);
+ _series2 = series_play("802BFX02", 0x100);
+ conv_load_and_prepare("conv81", 13);
+ conv_play_curr();
+
+ } else {
+ digi_unload_stream_breaks(SERIES3);
+ kernel_trigger_dispatch_now(14);
+ }
+ break;
+
+ case 13:
+ _G(wilbur_should) = 19;
+ _G(roomVal4) = 19;
+
+ if (_flag2 && _flag1) {
+ terminateMachineAndNull(_series5);
+ _flag2 = false;
+ _series3.terminate();
+ _flag1 = false;
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series2);
+ kernel_trigger_dispatch_now(14);
+
+ } else {
+ kernel_timing_trigger(30, 13);
+ }
+ break;
+
+ case 14:
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+ digi_unload("806w001");
+ digi_unload("807_002");
+ digi_unload("807_001");
+ digi_preload("802_019");
+ digi_play_loop("802_019", 3, 128);
+ digi_unload_stream_breaks(SERIES4);
+ digi_unload_play_breaks(PLAY1);
+ digi_unload_play_breaks(PLAY2);
+ series_stream_with_breaks(SERIES1, "802B3", 6, 1, 15);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 15:
+ disable_player_commands_and_fade_init(16);
+ break;
+
+ case 16:
+ release_trigger_on_digi_state(g10027, 1);
+ break;
+
+ case 17:
+ switch (_val2) {
+ case 1:
+ switch (_G(roomVal4)) {
+ case 5:
+ _flag1 = true;
+ _val2 = 3;
+ _series3.play("802BF03", 0x100, 0, 17, 6);
+ break;
+
+ case 6:
+ _flag1 = true;
+ _val2 = 2;
+ _series3.play("802BF03", 0x100, 0, 17, 6);
+ break;
+
+ case 9:
+ _flag1 = false;
+ _G(roomVal4) = getRoomVal();
+ series_play_with_breaks(PLAY2, "802BF02", 0x100, 17, 3);
+ break;
+
+ case 10:
+ _flag1 = false;
+ _G(roomVal4) = getRoomVal();
+ _val4 = 30;
+ series_play_with_breaks(PLAY3, "802BF02", 0x100, 17, 1);
+ break;
+
+ case 19:
+ _flag1 = true;
+ _series3.show("802BF02", 0x100, 0, -1, -1, 5);
+ break;
+
+ default:
+ _flag1 = false;
+ _val4 = 30;
+ _G(roomVal4) = getRoomVal();
+ series_play_with_breaks(PLAY1, "802BF02", 0x100, 17, 3);
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_G(roomVal4)) {
+ case 5:
+ _flag1 = true;
+ _val2 = 3;
+ _series3.show("802BF01", 0x100, 0, 17, 1);
+ break;
+
+ case 6:
+ _flag1 = true;
+ _G(roomVal4) = getRoomVal();
+ _series3.show("802BF03", 0x100, 0, 17, 30, 1);
+ break;
+
+ case 19:
+ _flag1 = true;
+ _series3.show("802BF02", 0x100, 0, -1, -1, 5);
+ break;
+
+ default:
+ _flag1 = true;
+ _val2 = 1;
+ _series3.show("802BF03", 0x100, 2, 17, 6);
+ break;
+ }
+ break;
+
+ case 3:
+ switch (_G(roomVal4)) {
+ case 5:
+ _flag1 = true;
+ _G(roomVal4) = 20;
+ _G(wilbur_should) = 16;
+ _series3.play("802BF01", 0x100, 4, -1, 6);
+ break;
+
+ case 20:
+ _series3.terminate();
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series3.show("802BF01", 0x100, 0, 17, 30, 0);
+ conv_resume_curr();
+ break;
+
+ case 21:
+ _flag1 = true;
+ _series3.show("802BF02", 0x100, 0, -1, -1, 5);
+ break;
+
+ default:
+ _val2 = 1;
+ _flag1 = true;
+ _series3.play("802BF03", 0x100, 2, 17, 6);
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 19:
+ if (conv_sound_to_play()) {
+ int who = conv_whos_talking();
+ if (who <= 0)
+ _G(roomVal4) = 5;
+ else if (who == 1)
+ _G(roomVal4) = 14;
+ }
+ break;
+
+ case 22:
+ pal_fade_init(0, 255, 0, 30, -1);
+ break;
+
+ case 23:
+ pal_mirror_colours(119, 122);
+ gr_pal_set_range(119, 8);
+ pal_cycle_init(119, 126, 6, -1, -1);
+ break;
+
+ case 24:
+ digi_play_loop("800_001", 3, 48, -1, 800);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_val1) {
+ case 11:
+ switch (_G(wilbur_should)) {
+ case 14:
+ _flag2 = true;
+ _G(wilbur_should) = 20;
+ _G(roomVal4) = 6;
+ _series5 = series_play("802BW03", 0x100, 4);
+ digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION, 802);
+ break;
+
+ case 15:
+ case 18:
+ _flag2 = true;
+ _val1 = 13;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 19:
+ if (_flag2)
+ terminateMachineAndNull(_series5);
+
+ _flag2 = true;
+ _series5 = series_show("802BW01", 0x100, 0, -1, -1, 0);
+ break;
+
+ case 20:
+ terminateMachineAndNull(_series5);
+ _flag2 = true;
+ _G(wilbur_should) = 16;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ conv_resume_curr();
+ break;
+
+ default:
+ _flag2 = true;
+ _val1 = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+ break;
+
+ case 12:
+ switch (_G(wilbur_should)) {
+ case 14:
+ _flag2 = true;
+ _G(roomVal4) = 6;
+ _val1 = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 15:
+ case 18:
+ _flag2 = true;
+ _val1 = 13;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 16:
+ _flag2 = true;
+ _G(wilbur_should) = getWilburShould();
+ _series5 = series_show("802BW01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 30, 1);
+ break;
+
+ case 19:
+ if (_flag2)
+ terminateMachineAndNull(_series5);
+
+ _flag2 = true;
+ _series5 = series_show("802BW01", 0x100, 0, -1, -1, 0);
+ break;
+
+ default:
+ _flag2 = false;
+ _val5 = imath_ranged_rand(15, 30);
+ _G(wilbur_should) = getWilburShould();
+ series_play_with_breaks(PLAY4, "802BW01", 0x100, gCHANGE_WILBUR_ANIMATION, 0, 12);
+ break;
+ }
+ break;
+
+ case 13:
+ switch (_G(wilbur_should)) {
+ case 14:
+ case 16:
+ case 17:
+ _flag2 = true;
+ _val1 = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 18:
+ _flag2 = false;
+ _G(wilbur_should) = 16;
+ _val1 = 12;
+ _val5 = imath_ranged_rand(120, 180);
+ series_play_with_breaks(PLAY5, "802BW02", 0x100, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 19:
+ if (_flag2)
+ terminateMachineAndNull(_series5);
+
+ _flag2 = true;
+ _series5 = series_show("802BW01", 0x100, 0, -1, -1, 0);
+ break;
+
+ default:
+ _flag2 = false;
+ _G(wilbur_should) = 16;
+ _val1 = 12;
+ series_play_with_breaks(PLAY6, "802BW04", 0x100, gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+ break;
+
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -195,6 +564,38 @@ void Room802::loadSeries() {
series_load(NAMES[i]);
}
+int Room802::getWilburShould() {
+ switch (imath_ranged_rand(1, 16)) {
+ case 1:
+ case 2:
+ case 3:
+ return 17;
+ case 11:
+ return 18;
+ case 16:
+ return 15;
+ default:
+ return 16;
+ }
+}
+
+int Room802::getRoomVal() {
+ switch (imath_ranged_rand(1, 16)) {
+ case 1:
+ case 3:
+ return 8;
+ case 5:
+ case 7:
+ return 9;
+ case 9:
+ case 11:
+ case 13:
+ return 6;
+ default:
+ return 10;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section8/room802.h b/engines/m4/burger/rooms/section8/room802.h
index e76857d3f66..c7f915ff727 100644
--- a/engines/m4/burger/rooms/section8/room802.h
+++ b/engines/m4/burger/rooms/section8/room802.h
@@ -30,12 +30,20 @@ namespace Rooms {
class Room802 : public Room {
private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ Series _series3;
+ machine *_series5 = nullptr;
int _val1 = 11;
int _val2 = 2;
- int _val3 = 0;
int _val4 = 0;
+ int _val5 = 0;
+ bool _flag1 = false;
+ bool _flag2 = false;
void loadSeries();
+ int getWilburShould();
+ int getRoomVal();
public:
Room802() : Room() {}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 607100c24ea..c599a425ffb 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -109,6 +109,7 @@ public:
int _room902Flag = 0;
int _roomVal2 = 0;
int _roomVal3 = 0;
+ int _roomVal4 = 0;
int _walkTrigger = 0;
machine *_npcSpeech1 = nullptr;
machine *_npcSpeech2 = nullptr;
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 9890c282279..36933bd48df 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -191,4 +191,8 @@ void pal_mirror_colours(int first_color, int last_color, RGB8 *pal) {
}
}
+void pal_mirror_colours(int first_color, int last_color) {
+ pal_mirror_colours(first_color, last_color, _G(master_palette));
+}
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_pal.h b/engines/m4/graphics/gr_pal.h
index e3e8ee28e3c..c9059bd7823 100644
--- a/engines/m4/graphics/gr_pal.h
+++ b/engines/m4/graphics/gr_pal.h
@@ -67,6 +67,7 @@ extern void gr_backup_palette();
extern void gr_restore_palette();
extern void pal_mirror_colours(int first_color, int last_color, RGB8 *pal);
+extern void pal_mirror_colours(int first_color, int last_color);
} // namespace M4
Commit: 477b98c3c724da733b8dda4e5c8bcda160e7a4ec
https://github.com/scummvm/scummvm/commit/477b98c3c724da733b8dda4e5c8bcda160e7a4ec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added skeleton room classes for section 7
Changed paths:
A engines/m4/burger/rooms/section7/room701.cpp
A engines/m4/burger/rooms/section7/room701.h
A engines/m4/burger/rooms/section7/room702.cpp
A engines/m4/burger/rooms/section7/room702.h
A engines/m4/burger/rooms/section7/room706.cpp
A engines/m4/burger/rooms/section7/room706.h
A engines/m4/burger/rooms/section7/section7.cpp
A engines/m4/burger/rooms/section7/section7.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index f0124a43a8f..25b42991213 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -251,8 +251,8 @@ BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
- _sections.push_back(&_section1); // TODO: Replace me
- _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section7);
+ _sections.push_back(&_section8);
_sections.push_back(&_section9);
}
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index e7e27e92c20..1fe572c73d9 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -24,6 +24,7 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section7/section7.h"
#include "m4/burger/rooms/section8/section8.h"
#include "m4/burger/rooms/section9/section9.h"
@@ -38,7 +39,7 @@ private:
Rooms::Section1 _section4;
Rooms::Section1 _section5;
Rooms::Section1 _section6;
- Rooms::Section1 _section7;
+ Rooms::Section7 _section7;
Rooms::Section8 _section8;
Rooms::Section9 _section9;
diff --git a/engines/m4/burger/rooms/section7/room701.cpp b/engines/m4/burger/rooms/section7/room701.cpp
new file mode 100644
index 00000000000..188b47b783f
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room701.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section7/room701.h"
+#include "m4/burger/rooms/section7/section7.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room701::init() {
+}
+
+void Room701::daemon() {
+}
+
+void Room701::pre_parser() {
+}
+
+void Room701::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section7/room701.h b/engines/m4/burger/rooms/section7/room701.h
new file mode 100644
index 00000000000..1db234e15fa
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room701.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION7_ROOM701_H
+#define M4_BURGER_ROOMS_SECTION7_ROOM701_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room701 : public Room {
+public:
+ Room701() : Room() {}
+ ~Room701() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
new file mode 100644
index 00000000000..df5afb22b4c
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section7/room702.h"
+#include "m4/burger/rooms/section7/section7.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room702::init() {
+}
+
+void Room702::daemon() {
+}
+
+void Room702::pre_parser() {
+}
+
+void Room702::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section7/room702.h b/engines/m4/burger/rooms/section7/room702.h
new file mode 100644
index 00000000000..83504365c5e
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room702.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION7_ROOM702_H
+#define M4_BURGER_ROOMS_SECTION7_ROOM702_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room702 : public Room {
+public:
+ Room702() : Room() {
+ }
+ ~Room702() override {
+ }
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
new file mode 100644
index 00000000000..85c79b6bdbd
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section7/room706.h"
+#include "m4/burger/rooms/section7/section7.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room706::init() {
+}
+
+void Room706::daemon() {
+}
+
+void Room706::pre_parser() {
+}
+
+void Room706::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section7/room706.h b/engines/m4/burger/rooms/section7/room706.h
new file mode 100644
index 00000000000..e772a6cbcf4
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/room706.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION7_ROOM706_H
+#define M4_BURGER_ROOMS_SECTION7_ROOM706_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room706 : public Room {
+public:
+ Room706() : Room() {
+ }
+ ~Room706() override {
+ }
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section7/section7.cpp b/engines/m4/burger/rooms/section7/section7.cpp
new file mode 100644
index 00000000000..142e03afb21
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/section7.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section7/section7.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section7::Section7() : Rooms::Section() {
+ add(701, &_room701);
+ add(702, &_room702);
+ add(706, &_room706);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section7/section7.h b/engines/m4/burger/rooms/section7/section7.h
new file mode 100644
index 00000000000..ae8fe043da2
--- /dev/null
+++ b/engines/m4/burger/rooms/section7/section7.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION7_H
+#define M4_BURGER_ROOMS_SECTION7_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section7/room701.h"
+#include "m4/burger/rooms/section7/room702.h"
+#include "m4/burger/rooms/section7/room706.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section7 : public Rooms::Section {
+private:
+ Room701 _room701;
+ Room702 _room702;
+ Room706 _room706;
+
+public:
+ Section7();
+ virtual ~Section7() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 445ca83b4d0..6dbc8eb6655 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -110,6 +110,10 @@ MODULE_OBJS = \
burger/rooms/section1/room174.o \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
+ burger/rooms/section7/section7.o \
+ burger/rooms/section7/room701.o \
+ burger/rooms/section7/room702.o \
+ burger/rooms/section7/room706.o \
burger/rooms/section8/section8.o \
burger/rooms/section8/room801.o \
burger/rooms/section8/room802.o \
Commit: b91569722e1ec88cc4d84240ed025f92e5355f5d
https://github.com/scummvm/scummvm/commit/b91569722e1ec88cc4d84240ed025f92e5355f5d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Static arrays for section 7 rooms
Changed paths:
engines/m4/burger/rooms/section7/room701.cpp
engines/m4/burger/rooms/section7/room701.h
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room706.cpp
diff --git a/engines/m4/burger/rooms/section7/room701.cpp b/engines/m4/burger/rooms/section7/room701.cpp
index 188b47b783f..242988e47a8 100644
--- a/engines/m4/burger/rooms/section7/room701.cpp
+++ b/engines/m4/burger/rooms/section7/room701.cpp
@@ -27,13 +27,124 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room701::init() {
+static const seriesStreamBreak SERIES1[] = {
+ { 0, "700Z001", 1, 255, -1, 0, 0, 0 },
+ { 64, "700A_001", 2, 200, -1, 0, 0, 0 },
+ { 66, "700W001", 1, 255, -1, 0, 0, 0 },
+ { 68, "700F001", 2, 255, -1, 0, 0, 0 },
+ { 92, "700A_002", 2, 255, -1, 0, 0, 0 },
+ { 96, "700Z002", 1, 255, -1, 0, 0, 0 },
+ { 130, "700F002", 1, 255, -1, 0, 0, 0 },
+ { 172, "700W002", 1, 255, -1, 0, 0, 0 },
+ { 208, "700F003", 1, 255, -1, 0, 0, 0 },
+ { 268, "700Z003", 1, 255, -1, 0, 0, 0 },
+ { 350, "700F004", 1, 255, -1, 0, 0, 0 },
+ { 368, "700F005", 1, 255, -1, 0, 0, 0 },
+ { 415, "700Z004", 1, 255, -1, 0, 0, 0 },
+ { 476, "700F006", 1, 255, -1, 0, 0, 0 },
+ { 527, "700F007", 1, 255, -1, 0, 0, 0 },
+ { 565, "700W003", 1, 255, -1, 0, 0, 0 },
+ { 601, "700F008", 1, 255, -1, 0, 0, 0 },
+ { 769, "700Z005", 1, 255, -1, 0, 0, 0 },
+ { 796, "700Z006", 1, 255, -1, 0, 0, 0 },
+ { 869, "700Z007", 1, 255, -1, 0, 0, 0 },
+ { 910, "700F009", 1, 255, -1, 0, 0, 0 },
+ { 945, "700Z008", 1, 255, -1, 0, 0, 0 },
+ { 989, "700Z009", 1, 255, -1, 0, 0, 0 },
+ { 1028, "700C001", 1, 255, -1, 0, 0, 0 },
+ { 1073, "700F010", 1, 255, -1, 0, 0, 0 },
+ { 1085, "700F011", 1, 255, -1, 0, 0, 0 },
+ { 1095, "700F012", 1, 255, -1, 0, 0, 0 },
+ { 1105, "700F013", 1, 255, -1, 0, 0, 0 },
+ { 1119, "700F014", 1, 255, -1, 0, 0, 0 },
+ { 1145, "700F015", 1, 255, -1, 0, 0, 0 },
+ { 1175, "700F016", 1, 255, -1, 0, 0, 0 },
+ { 1189, "700Z010", 1, 255, -1, 0, 0, 0 },
+ { 1227, "700Z011", 1, 255, -1, 0, 0, 0 },
+ { 1255, "700C002", 1, 255, -1, 0, 0, 0 },
+ { 1296, "700A001", 1, 255, -1, 0, 0, 0 },
+ { 1317, "700Z012", 1, 255, -1, 0, 0, 0 },
+ { 1318, "700A_003", 2, 255, -1, 0, 0, 0 },
+ { 1335, "700A_004", 2, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 0, "701_002", 2, 255, -1, 0, nullptr, 0 },
+ { 2, "701Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 15, "700A002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES3[] = {
+ { 8, "700Z013", 1, 255, -1, 0, nullptr, 0 },
+ { 12, "700B_001", 2, 255, -1, 0, nullptr, 0 },
+ { 64, "700A003", 1, 255, -1, 0, nullptr, 0 },
+ { 74, nullptr, 0, 0, 25, 0, nullptr, 0 },
+ { 121, "700Z014", 1, 255, -1, 0, nullptr, 0 },
+ { 137, "700Z015", 1, 255, -1, 0, nullptr, 0 },
+ { 181, "700W004", 1, 255, -1, 0, nullptr, 0 },
+ { 226, "700Z016", 1, 255, -1, 0, nullptr, 0 },
+ { 312, "700A005", 1, 255, -1, 0, nullptr, 0 },
+ { 331, "700Z017", 1, 255, -1, 0, nullptr, 0 },
+ { 356, "700Z018", 1, 255, -1, 0, nullptr, 0 },
+ { 399, "700Z018z", 1, 255, -1, 0, nullptr, 0 },
+ { 415, "700B_002", 2, 255, -1, 0, nullptr, 0 },
+ { 439, "700B_003", 2, 255, -1, 0, nullptr, 0 },
+ { 472, "700Z019", 1, 200, -1, 0, nullptr, 0 },
+ { 510, "700A006", 1, 255, -1, 0, nullptr, 0 },
+ { 533, "700Z020", 1, 255, -1, 0, nullptr, 0 },
+ { 641, "700Z020z", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES4[] = {
+ { 6, "702W016", 1, 255, -1, 0, nullptr, 0 },
+ { 24, "702_001", 2, 75, -1, 0, nullptr, 0 },
+ { 30, "702_002", 2, 100, -1, 0, nullptr, 0 },
+ { 35, "702W001", 1, 255, -1, 0, nullptr, 0 },
+ { 55, nullptr, 0, 0, 22, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES5[] = {
+ { 0, "703W001", 1, 255, -1, 0, nullptr, 0 },
+ { 88, "703W002", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES6[] = {
+ { 7, "702F001", 1, 255, -1, 0, nullptr, 0 },
+ { 27, "702F001z", 1, 255, -1, 0, nullptr, 0 },
+ { 67, "702F002", 1, 255, -1, 0, nullptr, 0 },
+ { 95, "702_003", 2, 175, -1, 0, nullptr, 0 },
+ { 120, "702_004", 2, 255, -1, 0, nullptr, 0 },
+ { 126, "702f004", 1, 255, -1, 0, nullptr, 0 },
+ { 128, "702_005", 2, 255, -1, 0, nullptr, 0 },
+ { 130, nullptr, 0, 0, 22, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES7[] = {
+ { 0, "704F001", 1, 255, -1, 0, nullptr, 0 },
+ { 16, nullptr, 1, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+void Room701::preload() {
+ _G(player).walker_in_this_scene = false;
}
-void Room701::daemon() {
+void Room701::init() {
+ player_set_commands_allowed(false);
+ _G(flags).set_boonsville_time(505210);
+ pal_fade_set_start(0);
+ pal_fade_init(0, 255, 100, 40, -1);
+ digi_preload("700_001");
+
}
-void Room701::pre_parser() {
+void Room701::daemon() {
}
void Room701::parser() {
diff --git a/engines/m4/burger/rooms/section7/room701.h b/engines/m4/burger/rooms/section7/room701.h
index 1db234e15fa..be3ec0dce23 100644
--- a/engines/m4/burger/rooms/section7/room701.h
+++ b/engines/m4/burger/rooms/section7/room701.h
@@ -33,9 +33,9 @@ public:
Room701() : Room() {}
~Room701() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index df5afb22b4c..ce28e42b059 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -27,6 +27,20 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "DOOR", nullptr, "702W002", nullptr },
+ { "FLUMIX", "702w001z", "702W002", "702W002" },
+ { "ABDUCT-O-TRON", "702W006", nullptr, "702W007" },
+ { "ABDUCT-O CONTROLS", "702W008", nullptr, "702W009" },
+ { "NEUTRINO PULSE GUN", "702W010", nullptr, "702W011" },
+ { "NEUTRINO GUN CONTROL", "702W012", nullptr, "702W009" },
+ { "VENT", "702W013", nullptr, "702W013" },
+ { "BRIG", "702W014", "702W002", "702W015" },
+ { "MIRROR", "999W010", nullptr, "999W010" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
void Room702::init() {
}
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 85c79b6bdbd..52e6fb5ef4a 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -27,6 +27,181 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesStreamBreak SERIES1[] = {
+ { 0, "706F001", 1, 255, -1, 0, nullptr, 0 },
+ { 31, "706W001", 1, 255, -1, 0, nullptr, 0 },
+ { 52, "706F002", 1, 255, -1, 0, nullptr, 0 },
+ { 83, "706A_001", 2, 150, -1, 0, nullptr, 0 },
+ { 105, "706A_002", 2, 125, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 0, "706w002", 1, 255, -1, 0, nullptr, 0 },
+ { 50, "706F003", 1, 255, -1, 0, nullptr, 0 },
+ { 103, "706W003", 1, 255, -1, 0, nullptr, 0 },
+ { 140, "706F004", 1, 255, -1, 0, nullptr, 0 },
+ { 145, "706A_003", 2, 200, -1, 0, nullptr, 0 },
+ { 170, "706W004", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES3[] = {
+ { 3, "707A_002", 1, 125, -1, 0, nullptr, 0 },
+ { 11, "707A_001", 2, 175, -1, 0, nullptr, 0 },
+ { 32, "707W001", 1, 255, -1, 0, nullptr, 0 },
+ { 56, "707F001", 1, 255, -1, 0, nullptr, 0 },
+ { 100, "707W002", 1, 255, -1, 0, nullptr, 0 },
+ { 104, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 115, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 120, "707F002", 1, 255, -1, 0, nullptr, 0 },
+ { 134, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 147, "707W003", 1, 255, -1, 0, nullptr, 0 },
+ { 163, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 180, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 190, "707F003", 1, 255, -1, 0, nullptr, 0 },
+ { 192, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 201, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 214, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 222, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 233, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 237, "707W004", 1, 255, -1, 0, nullptr, 0 },
+ { 239, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 253, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 259, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 267, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 268, "707F004", 1, 255, -1, 0, nullptr, 0 },
+ { 271, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 277, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 281, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 295, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 303, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 317, "707F005", 1, 255, -1, 0, nullptr, 0 },
+ { 323, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 345, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 347, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 365, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 379, "707Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 389, "707Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 450, "707Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 473, "707F006", 1, 255, -1, 0, nullptr, 0 },
+ { 478, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 491, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 509, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 523, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 529, "707A_007", 2, 255, -1, 0, nullptr, 0 },
+ { 535, "707Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 536, "707A_007", 2, 255, -1, 0, nullptr, 0 },
+ { 543, "707Z004a", 1, 255, -1, 0, nullptr, 0 },
+ { 544, "707A_007", 2, 255, -1, 0, nullptr, 0 },
+ { 550, "707Z005a", 1, 255, -1, 0, nullptr, 0 },
+ { 556, "707Z007", 1, 255, -1, 0, nullptr, 0 },
+ { 589, "707F007", 1, 255, -1, 0, nullptr, 0 },
+ { 618, "707Z008", 1, 255, -1, 0, nullptr, 0 },
+ { 645, "707F008", 1, 255, -1, 0, nullptr, 0 },
+ { 686, "707F009", 1, 255, -1, 0, nullptr, 0 },
+ { 710, "707W005", 1, 255, -1, 0, nullptr, 0 },
+ { 711, "707A_006", 2, 100, -1, 0, nullptr, 0 },
+ { 718, "707A_006", 2, 100, -1, 0, nullptr, 0 },
+ { 725, "707A_006", 2, 100, -1, 0, nullptr, 0 },
+ { 729, "707Z009", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES4[] = {
+ { 0, "708Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 48, "708W001", 1, 255, -1, 0, nullptr, 0 },
+ { 107, "708Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 187, "708W002", 1, 255, -1, 0, nullptr, 0 },
+ { 206, "708Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 296, "708A001", 1, 200, -1, 0, nullptr, 0 },
+ { 312, "708Z004", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES5[] = {
+ { 0, "707A001", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES6[] = {
+ { 0, "708Z005", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES7[] = {
+ { 0, "707C_001", 3, 100, -1, (uint)-1, nullptr, 0 },
+ { 1, nullptr, 0, 0, 37, 0, nullptr, 0 },
+ { 2, "707A002", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "707Z010", 1, 255, -1, 0, nullptr, 0 },
+ { 95, "707C_002", 2, 200, -1, 0, nullptr, 0 },
+ { 100, "707Z011", 1, 255, -1, 0, nullptr, 0 },
+ { 124, "707F010", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES8[] = {
+ { 0, "709A_004", 3, 75, -1, (uint)-1, nullptr, 0 },
+ { 0, "709W001", 1, 255, -1, 0, nullptr, 0 },
+ { 5, "709A_002", 2, 110, -1, 0, nullptr, 0 },
+ { 16, "709A001", 1, 255, -1, 0, nullptr, 0 },
+ { 41, "709A_003", 2, 75, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES9[] = {
+ { 0, "707D_005", 3, 75, -1, (uint)-1, nullptr, 0 },
+ { 0, "707W006", 1, 255, -1, 0, nullptr, 0 },
+ { 16, "707W007", 1, 255, -1, 0, nullptr, 0 },
+ { 28, nullptr, 0, 0, 35, 0, nullptr, 0 },
+ { 29, "707D_001", 2, 150, -1, 0, nullptr, 0 },
+ { 31, "707A003", 1, 255, -1, 0, nullptr, 0 },
+ { 41, "707A004", 1, 255, -1, 0, nullptr, 0 },
+ { 84, "707W008", 1, 255, -1, 0, nullptr, 0 },
+ { 126, "707W009", 1, 255, -1, 0, nullptr, 0 },
+ { 132, nullptr, 0, 0, 36, 0, nullptr, 0 },
+ { 134, "707D_006", 3, 100, -1, 0, nullptr, 0 },
+ { 138, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 141, "707A_003", 2, 50, -1, 0, nullptr, 0 },
+ { 143, "707A_002", 2, 125, -1, 0, nullptr, 0 },
+ { 158, "707A005", 1, 255, -1, 0, nullptr, 0 },
+ { 175, "707W010", 1, 255, -1, 0, nullptr, 0 },
+ { 223, "707W010z", 1, 255, -1, 0, nullptr, 0 },
+ { 320, "707A006", 1, 255, -1, 0, nullptr, 0 },
+ { 353, "707W011", 1, 125, -1, 0, nullptr, 0 },
+ { 364, "707W012", 1, 255, -1, 0, nullptr, 0 },
+ { 453, "707W013", 1, 125, -1, 0, nullptr, 0 },
+ { 475, "707A007", 1, 255, -1, 0, nullptr, 0 },
+ { 600, "707W014", 1, 255, -1, 0, nullptr, 0 },
+ { 601, nullptr, 0, 0, 38, 0, nullptr, 0 },
+ { 650, "707A008", 1, 255, -1, 0, nullptr, 0 },
+ { 676, "707W015", 1, 255, -1, 0, nullptr, 0 },
+ { 696, "707W016", 1, 255, -1, 0, nullptr, 0 },
+ { 698, "707D_008", 2, 200, -1, 0, nullptr, 0 },
+ { 715, "707D_004", 2, 150, -1, 0, nullptr, 0 },
+ { 729, "707A009", 1, 255, -1, 0, nullptr, 0 },
+ { 730, "707D_008", 2, 200, -1, 0, nullptr, 0 },
+ { 753, "707W017", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES10[] = {
+ { 0, "709A002", 1, 255, -1, 0, nullptr, 0 },
+ { 45, "709B_001", 2, 100, -1, 0, nullptr, 0 },
+ { 56, "709A003", 1, 255, -1, 0, nullptr, 0 },
+ { 83, "709W002", 2, 255, -1, 0, nullptr, 0 },
+ { 92, "709A004", 1, 255, -1, 0, nullptr, 0 },
+ { 95, "709B_002", 2, 255, -1, 0, nullptr, 0 },
+ { 103, "709W003", 1, 255, -1, 0, nullptr, 0 },
+ { 110, nullptr, 0, 0, 39, 0, nullptr, 0 },
+ { 115, nullptr, 0, 0, 40, 0, nullptr, 0 },
+ { 120, "709B_006", 2, 255, -1, 0, nullptr, 0 },
+ { 124, "709B_004", 3, 50, -1, 1024, nullptr, 0 },
+ { 264, nullptr, 0, 0, 41, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room706::init() {
}
Commit: 365a103b6ec5ebae1db87984ba176f156f068fcf
https://github.com/scummvm/scummvm/commit/365a103b6ec5ebae1db87984ba176f156f068fcf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 701 methods
Changed paths:
engines/m4/burger/rooms/section7/room701.cpp
engines/m4/burger/rooms/section7/room701.h
diff --git a/engines/m4/burger/rooms/section7/room701.cpp b/engines/m4/burger/rooms/section7/room701.cpp
index 242988e47a8..861b7e9f341 100644
--- a/engines/m4/burger/rooms/section7/room701.cpp
+++ b/engines/m4/burger/rooms/section7/room701.cpp
@@ -131,6 +131,7 @@ static const seriesStreamBreak SERIES7[] = {
STREAM_BREAK_END
};
+
void Room701::preload() {
_G(player).walker_in_this_scene = false;
}
@@ -141,13 +142,161 @@ void Room701::init() {
pal_fade_set_start(0);
pal_fade_init(0, 255, 100, 40, -1);
digi_preload("700_001");
-
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ kernel_trigger_dispatch_now(1);
}
void Room701::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_play_loop("700_001", 3, 50, -1, 700);
+ series_stream_with_breaks(SERIES1, "700A", 6, 1, 2);
+ pal_fade_init(0, 255, 100, 30, -1);
+ kernel_timing_trigger(1, 23);
+ break;
+
+ case 2:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 4);
+ break;
+
+ case 4:
+ series_stream_with_breaks(SERIES2, "701A", 6, 1, 5);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 5:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 6);
+ break;
+
+ case 6:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 7);
+ break;
+
+ case 7:
+ digi_unload_stream_breaks(SERIES1);
+ digi_unload_stream_breaks(SERIES3);
+ series_stream_with_breaks(SERIES3, "700B", 6, 1, 8);
+ pal_fade_init(0, 255, 100, 30, -1);
+ kernel_timing_trigger(1, 24);
+ break;
+
+ case 8:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 9);
+ break;
+
+ case 9:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 10);
+ break;
+
+ case 10:
+ digi_unload_stream_breaks(SERIES2);
+ digi_unload_stream_breaks(SERIES4);
+ series_stream_with_breaks(SERIES4, "702A", 6, 1, 11);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 11:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 12);
+ break;
+
+ case 12:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 13);
+ break;
+
+ case 13:
+ digi_unload_stream_breaks(SERIES3);
+ digi_unload_stream_breaks(SERIES5);
+ digi_preload_stream_breaks(SERIES6);
+ series_stream_with_breaks(SERIES5, "703A", 6, 1, 14);
+ break;
+
+ case 14:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 15);
+ break;
+
+ case 15:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 16);
+ break;
+
+ case 16:
+ digi_unload_stream_breaks(SERIES4);
+ series_stream_with_breaks(SERIES6, "702B", 6, 1, 17);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 17:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 18);
+ break;
+
+ case 18:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 19);
+ break;
+
+ case 19:
+ digi_unload_stream_breaks(SERIES5);
+ digi_unload_stream_breaks(SERIES6);
+ digi_preload_stream_breaks(SERIES7);
+ series_stream_with_breaks(SERIES7, "704A", 6, 1, 20);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 20:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 21);
+ break;
+
+ case 21:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 26);
+ break;
+
+ case 22:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 60, -1);
+ break;
+
+ case 23:
+ pal_mirror_colours(119, 121);
+ gr_pal_set_range(120, 8);
+ pal_cycle_init(119, 124, 10, -1, -1);
+ break;
+
+ case 24:
+ pal_mirror_colours(120, 122);
+ gr_pal_set_range(120, 8);
+ pal_cycle_init(120, 122, 10, -1, -1);
+ break;
+
+ case 25:
+ inv_give_to_player("MIRROR");
+ break;
+
+ case 26:
+ _G(game).new_room = 702;
+ break;
-void Room701::parser() {
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section7/room701.h b/engines/m4/burger/rooms/section7/room701.h
index be3ec0dce23..8a6fd930103 100644
--- a/engines/m4/burger/rooms/section7/room701.h
+++ b/engines/m4/burger/rooms/section7/room701.h
@@ -36,7 +36,6 @@ public:
void preload() override;
void init() override;
void daemon() override;
- void parser() override;
};
} // namespace Rooms
Commit: 6d008fb1d32cf43338ba5ce8e362ada0a2e27adc
https://github.com/scummvm/scummvm/commit/6d008fb1d32cf43338ba5ce8e362ada0a2e27adc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 702 daemon
Changed paths:
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room702.h
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index ce28e42b059..8e55f445fb5 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -42,15 +42,180 @@ static const char *SAID[][4] = {
void Room702::init() {
+ pal_fade_set_start(0);
+ _flag1 = false;
+ _flag2 = false;
+ _val1 = 1;
+
+ _series1 = series_load("702FLT01");
+ _series2 = series_load("702FLX02");
+ _series3 = series_load("702C1FL1");
+ _series4 = series_load("702C1FL2");
+ _series5 = series_load("702C1FL3");
+ _series1 = series_load("702C1FX1");
+
+ digi_preload("700_001");
+ digi_preload("702f003b");
+ digi_preload("702_007");
+ digi_preload("702_006");
+
+ kernel_trigger_dispatch_now(1);
}
void Room702::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ player_set_commands_allowed(true);
+ ws_demand_location(302, 284, 6);
+ _val2 = 12;
+ _G(roomVal4) = 8;
+ _G(wilbur_should) = 10;
+ digi_play_loop("700_001", 3, 50, -1, 700);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(6);
+ _G(flags)[V298] = 1;
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 2:
+ conv_load_and_prepare("conv82", 3);
+ conv_play_curr();
+ break;
+
+ case 5:
+ switch (_val1) {
+ case 1:
+ switch (_G(roomVal4)) {
+ case 3:
+ _val1 = 2;
+ break;
+
+ case 4:
+ if (_flag1)
+ terminateMachineAndNull(_series10);
+
+ _series10 = series_play("702FLX02", 0, 0, 4);
+ break;
+
+ case 5:
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series10 = series_play("702C1FL2", 0, 2, 5);
+
+ if (imath_ranged_rand(0, 1) == 1) {
+ digi_play("702F003B", 2, 100);
+ } else {
+ digi_play("702_007", 2, 100);
+ }
+ break;
+
+ case 6:
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series10 = series_play("702C1FL3", 0, 1, 5);
+
+ if (imath_ranged_rand(0, 1) == 1) {
+ digi_play("702F003B", 2, 100);
+ } else {
+ digi_play("702_007", 2, 100);
+ }
+ break;
+
+ case 7:
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series10 = series_play("702C1FL2", 0, 0, 5);
+
+ if (imath_ranged_rand(0, 1) == 1) {
+ digi_play("702F003B", 2, 100);
+ } else {
+ digi_play("702_007", 2, 100);
+ }
+ break;
-void Room702::pre_parser() {
+ case 8:
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series10 = series_play("702C1FL1", 0, 0, 5);
+ digi_play("702F003B", 2, 120);
+ break;
+
+ case 9:
+ _G(roomVal4) = getRoomVal();
+ _flag1 = true;
+ _series10 = series_play("702FLT01", 0, 0, 5, 60);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ }
+ }
}
void Room702::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("TALK", "FLUMIX")) {
+ kernel_trigger_dispatch_now(2);
+
+ } else if (player_said("conv82")) {
+ conv82();
+
+ } else if (player_said("DOOR", "LOOK AT")) {
+ if (_flag2) {
+ wilbur_speech("702W004");
+ } else {
+ _flag2 = true;
+ wilbur_speech("702W003");
+ }
+ } else if (player_said("DOOR", "GEAR")) {
+ ws_walk(174, 316, 0, -1, 10);
+ wilbur_speech("702W005");
+
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room702::conv82() {
+ int who = conv_whos_talking();
+
+ if (conv_sound_to_play()) {
+ if (who <= 0) {
+ _G(roomVal4) = 3;
+ kernel_trigger_dispatch_now(5);
+
+ } else if (who == 1) {
+ wilbur_speech(conv_sound_to_play(), 10001);
+ }
+ }
+}
+
+int Room702::getRoomVal() {
+ switch (imath_ranged_rand(1, 12)) {
+ case 1:
+ case 2:
+ case 3:
+ return 7;
+ case 4:
+ case 5:
+ case 6:
+ return 5;
+ case 7:
+ case 8:
+ return 6;
+ case 9:
+ case 10:
+ return 8;
+ default:
+ return 9;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section7/room702.h b/engines/m4/burger/rooms/section7/room702.h
index 83504365c5e..068c707ccb6 100644
--- a/engines/m4/burger/rooms/section7/room702.h
+++ b/engines/m4/burger/rooms/section7/room702.h
@@ -29,6 +29,22 @@ namespace Burger {
namespace Rooms {
class Room702 : public Room {
+private:
+ int _series1 = -1;
+ int _series2 = -1;
+ int _series3 = -1;
+ int _series4 = -1;
+ int _series5 = -1;
+ int _series6 = -1;
+ machine *_series10 = nullptr;
+ bool _flag1 = false;
+ bool _flag2 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+
+ void conv82();
+ int getRoomVal();
+
public:
Room702() : Room() {
}
@@ -37,7 +53,6 @@ public:
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: c89b29438b4a2c7887ab3cc11d720ed894145236
https://github.com/scummvm/scummvm/commit/c89b29438b4a2c7887ab3cc11d720ed894145236
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 702 daemon
Changed paths:
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room702.h
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index 8e55f445fb5..f6ee1e12b7e 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -83,6 +83,16 @@ void Room702::daemon() {
conv_play_curr();
break;
+ case 3:
+ _G(roomVal4) = 4;
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 90, -1);
+ kernel_timing_trigger(30, 5);
+ break;
+
+ case 4:
+ _G(game).new_room = 706;
+ break;
+
case 5:
switch (_val1) {
case 1:
@@ -152,7 +162,72 @@ void Room702::daemon() {
}
break;
+ case 2:
+ switch (_G(roomVal4)) {
+ case 3:
+ if (_flag1)
+ terminateMachineAndNull(_series10);
+
+ _flag1 = true;
+ _G(roomVal4) = 21;
+ _series10 = series_play("702FLT01", 0, 4);
+ digi_play(conv_sound_to_play(), 1, 255, 5);
+ break;
+
+ case 21:
+ terminateMachineAndNull(_series10);
+ _flag1 = false;
+ _G(roomVal4) = getRoomVal();
+ kernel_trigger_dispatch_now(5);
+ conv_resume_curr();
+ break;
+
+
+ default:
+ _val1 = 1;
+ kernel_trigger_dispatch_now(5);
+ break;
+ }
+ break;
+
+ default:
+ break;
}
+ break;
+
+ case 6:
+ switch (_val2) {
+ case 12:
+ _val2 = 13;
+ _series11 = series_play("702C1FX1", 0xf00, 0, 6, 6);
+ digi_play("702_006", 1, 200);
+ break;
+
+ case 13:
+ series_unload(_series6);
+ digi_unload("702_006");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 10:
+ ws_walk(236, 338, 0, 11, 4);
+ break;
+
+ case 11:
+ _G(flags)[V298] = 0;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
}
}
diff --git a/engines/m4/burger/rooms/section7/room702.h b/engines/m4/burger/rooms/section7/room702.h
index 068c707ccb6..c661eb2f9ff 100644
--- a/engines/m4/burger/rooms/section7/room702.h
+++ b/engines/m4/burger/rooms/section7/room702.h
@@ -37,6 +37,7 @@ private:
int _series5 = -1;
int _series6 = -1;
machine *_series10 = nullptr;
+ machine *_series11 = nullptr;
bool _flag1 = false;
bool _flag2 = false;
int _val1 = 0;
Commit: 1b88e507f9bbc0f9178483c825a95f6d5cc4236d
https://github.com/scummvm/scummvm/commit/1b88e507f9bbc0f9178483c825a95f6d5cc4236d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 706 methods
Changed paths:
engines/m4/burger/rooms/section7/room706.cpp
engines/m4/burger/rooms/section7/room706.h
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 52e6fb5ef4a..456b7e30e9b 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -201,17 +201,371 @@ static const seriesStreamBreak SERIES10[] = {
STREAM_BREAK_END
};
+void Room706::preload() {
+ _G(player).walker_in_this_scene = false;
+}
void Room706::init() {
+ player_set_commands_allowed(false);
+ pal_fade_set_start(0);
+ pal_fade_init(0, 255, 100, 40, -1);
+ _flag5 = false;
+ _flag6 = false;
+ _flag7 = false;
+ _volume = 100;
+
+ _series1 = series_load("706FLX01");
+ digi_preload("706A_004");
+ digi_preload_stream_breaks(SERIES1);
+ _series2 = series_load("706AST01");
+ _series3 = series_load("706AST02");
+ _series4 = series_load("706WIT01");
+
+ digi_preload_stream_breaks(SERIES2);
+ kernel_trigger_dispatch_now(1);
}
void Room706::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_play_loop("706A_004", 3, 50, -1, 706);
+ series_stream_with_breaks(SERIES1, "706A1", 6, 1, 2);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 2:
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 4);
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+ getRoomVal();
+ kernel_trigger_dispatch_now(34);
+ conv_load_and_prepare("conv83", 5);
+ conv_play_curr();
+ break;
+
+ case 5:
+ if (_flag5)
+ terminateMachineAndNull(_series5);
+ if (_flag7) {
+ terminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series8);
+ }
+ if (_flag6)
+ terminateMachineAndNull(_series6);
+
+ _flag5 = _flag6 = _flag7 = false;
+ series_unload(_series2);
+ series_unload(_series3);
+ series_unload(_series4);
+ kernel_timing_trigger(6, 6);
+ break;
+
+ case 6:
+ digi_unload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES2, "706A3", 6, 1, 7);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 7:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 8);
+ break;
+
+ case 8:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 9);
+ break;
+
+ case 9:
+ series_unload(_series1);
+ digi_unload_stream_breaks(SERIES2);
+ digi_unload("706A_004");
+ digi_preload("700_001");
+ digi_preload_stream_breaks(SERIES3);
+ digi_play_loop("700_001", 3, 50, -1, 700);
+ series_stream_with_breaks(SERIES3, "707A", 6, 1, 10);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 10:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 11);
+ break;
+
+ case 11:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 12);
+ break;
+
+ case 12:
+ digi_unload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+ digi_preload("707B_001");
+ digi_preload_stream_breaks(SERIES5);
+ digi_preload_stream_breaks(SERIES6);
+ digi_preload_stream_breaks(SERIES7);
+ series_stream_with_breaks(SERIES4, "708A", 6, 1, 13);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 13:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 14);
+ break;
+
+ case 14:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 15);
+ break;
+
+ case 15:
+ digi_unload_stream_breaks(SERIES4);
+ digi_play("707B_001", 2, 125);
+ series_stream_with_breaks(SERIES5, "707B", 6, 1, 16);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 16:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 17);
+ break;
+
+ case 17:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 18);
+ break;
+
+ case 18:
+ series_stream_with_breaks(SERIES6, "708B", 6, 1, 19);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 19:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 20);
+ break;
+
+ case 20:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 21);
+ break;
+
+ case 21:
+ digi_unload_stream_breaks(SERIES5);
+ digi_unload_stream_breaks(SERIES6);
+ series_stream_with_breaks(SERIES7, "707C", 6, 1, 22);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 22:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 23);
+ break;
+
+ case 23:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 24);
+ break;
+
+ case 24:
+ digi_unload_stream_breaks(SERIES7);
+ digi_preload_stream_breaks(SERIES8);
+ series_stream_with_breaks(SERIES8, "709A", 6, 1, 25);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 25:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 26);
+ break;
+
+ case 26:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 27);
+ break;
+
+ case 27:
+ digi_unload_stream_breaks(SERIES8);
+ digi_preload_stream_breaks(SERIES9);
+ digi_preload("707D_007");
+ series_stream_with_breaks(SERIES9, "70D", 6, 1, 28);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
-void Room706::pre_parser() {
+ case 28:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 29);
+ break;
+
+ case 29:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 30);
+ break;
+
+ case 30:
+ digi_unload_stream_breaks(SERIES9);
+ digi_preload("909B_005");
+ digi_preload_stream_breaks(SERIES10);
+ series_stream_with_breaks(SERIES10, "709B", 6, 1, 31);
+ pal_fade_init(0, 255, 100, 31, -1);
+ break;
+
+ case 31:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 32);
+ digi_unload_stream_breaks(SERIES10);
+ break;
+
+ case 32:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 42);
+ break;
+
+ case 33:
+ switch (_val1) {
+ case 1:
+ _val1 = 21;
+ _flag7 = true;
+ _series7 = series_play("706AST01", 0x300);
+ _series8 = series_play("706AST02", 0x300);
+ digi_play(conv_sound_to_play(), 1, 255, 33);
+ break;
+
+ case 21:
+ if (_flag7) {
+ terminateMachineAndNull(_series7);
+ terminateMachineAndNull(_series8);
+ }
+
+ _flag7 = false;
+ conv_resume_curr();
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 34:
+ switch (_G(roomVal4)) {
+ case 2:
+ getRoomVal();
+ series_play("706FLX01", 0x400, 0, 34, 6);
+ break;
+
+ case 3:
+ getRoomVal();
+ kernel_timing_trigger(60, 34);
+ break;
+
+ default:
+ _G(roomVal4) = 4;
+ break;
+ }
+ break;
+
+ case 35:
+ inv_move_object("MIRROR", NOWHERE);
+ break;
+
+ case 36:
+ digi_stop(3);
+ break;
+
+ case 37:
+ digi_stop(2);
+ digi_unload("707B_001");
+ break;
+
+ case 38:
+ digi_play_loop("707D_007", 3, 100, -1, 707);
+ break;
+
+ case 39:
+ _volume -= 20;
+ if (_volume > 0) {
+ term_message("fading hero tune, current volume = %d", _volume);
+ digi_change_volume(3, _volume);
+ kernel_timing_trigger(20, 39);
+
+ } else {
+ digi_stop(3);
+ }
+ break;
+
+ case 40:
+ digi_play("709B_005", 1, 255, -1, 709);
+ break;
+
+ case 41:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 150, -1);
+ break;
+
+ case 42:
+ adv_kill_digi_between_rooms(false);
+ _G(game).setRoom(_G(executing) == WHOLE_GAME ? 903 : 901);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _G(wilbur_should) = 21;
+ _flag6 = true;
+ _series6 = series_play("706WIT01", 0x200);
+ digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 21:
+ if (_flag6)
+ terminateMachineAndNull(_series6);
+
+ _flag6 = false;
+ conv_resume_curr();
+ break;
+
+ default:
+ break;
+ }
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room706::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv83")) {
+ conv83();
+ _G(player).command_ready = false;
+ }
+}
+
+void Room706::conv83() {
+ if (conv_sound_to_play()) {
+ int who = conv_whos_talking();
+
+ if (who <= 0) {
+ _val1 = 1;
+ kernel_trigger_dispatch_now(33);
+
+ } else if (who == 1) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ }
+}
+
+void Room706::getRoomVal() {
+ _G(roomVal4) = imath_ranged_rand(1, 100) >= 10 ? 3 : 2;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section7/room706.h b/engines/m4/burger/rooms/section7/room706.h
index e772a6cbcf4..fc9e926f848 100644
--- a/engines/m4/burger/rooms/section7/room706.h
+++ b/engines/m4/burger/rooms/section7/room706.h
@@ -29,15 +29,33 @@ namespace Burger {
namespace Rooms {
class Room706 : public Room {
+private:
+ int _series1 = -1;
+ int _series2 = -1;
+ int _series3 = -1;
+ int _series4 = -1;
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
+ machine *_series8 = nullptr;
+ bool _flag5 = false;
+ bool _flag6 = false;
+ bool _flag7 = false;
+ int _volume = 0;
+ int _val1 = 0;
+
+ void conv83();
+ void getRoomVal();
+
public:
Room706() : Room() {
}
~Room706() override {
}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: a01266dea7fd79195f119589e5f41d099d1ba9d7
https://github.com/scummvm/scummvm/commit/a01266dea7fd79195f119589e5f41d099d1ba9d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton room classes for section 6
Changed paths:
A engines/m4/burger/rooms/section6/room601.cpp
A engines/m4/burger/rooms/section6/room601.h
A engines/m4/burger/rooms/section6/room602.cpp
A engines/m4/burger/rooms/section6/room602.h
A engines/m4/burger/rooms/section6/room603.cpp
A engines/m4/burger/rooms/section6/room603.h
A engines/m4/burger/rooms/section6/room604.cpp
A engines/m4/burger/rooms/section6/room604.h
A engines/m4/burger/rooms/section6/room605.cpp
A engines/m4/burger/rooms/section6/room605.h
A engines/m4/burger/rooms/section6/room606.cpp
A engines/m4/burger/rooms/section6/room606.h
A engines/m4/burger/rooms/section6/room608.cpp
A engines/m4/burger/rooms/section6/room608.h
A engines/m4/burger/rooms/section6/room609.cpp
A engines/m4/burger/rooms/section6/room609.h
A engines/m4/burger/rooms/section6/room610.cpp
A engines/m4/burger/rooms/section6/room610.h
A engines/m4/burger/rooms/section6/room612.cpp
A engines/m4/burger/rooms/section6/room612.h
A engines/m4/burger/rooms/section6/section6.cpp
A engines/m4/burger/rooms/section6/section6.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 25b42991213..1eb6c758ee1 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -250,7 +250,7 @@ BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
- _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section6);
_sections.push_back(&_section7);
_sections.push_back(&_section8);
_sections.push_back(&_section9);
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 1fe572c73d9..ee45e353e48 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -24,6 +24,7 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section6/section6.h"
#include "m4/burger/rooms/section7/section7.h"
#include "m4/burger/rooms/section8/section8.h"
#include "m4/burger/rooms/section9/section9.h"
@@ -38,7 +39,7 @@ private:
Rooms::Section1 _section3;
Rooms::Section1 _section4;
Rooms::Section1 _section5;
- Rooms::Section1 _section6;
+ Rooms::Section6 _section6;
Rooms::Section7 _section7;
Rooms::Section8 _section8;
Rooms::Section9 _section9;
diff --git a/engines/m4/burger/rooms/section6/room601.cpp b/engines/m4/burger/rooms/section6/room601.cpp
new file mode 100644
index 00000000000..87b2af82ef2
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room601.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room601.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room601::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room601::init() {
+}
+
+void Room601::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room601.h b/engines/m4/burger/rooms/section6/room601.h
new file mode 100644
index 00000000000..66675649926
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room601.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM601_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM601_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room601 : public Room {
+public:
+ Room601() : Room() {}
+ ~Room601() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
new file mode 100644
index 00000000000..7fe473af57c
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room602.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room602::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room602::init() {
+}
+
+void Room602::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
new file mode 100644
index 00000000000..ed803711252
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM602_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM602_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room602 : public Room {
+public:
+ Room602() : Room() {}
+ ~Room602() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
new file mode 100644
index 00000000000..97cc3b1d4da
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room603.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room603::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room603::init() {
+}
+
+void Room603::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
new file mode 100644
index 00000000000..e4c5e31c50d
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM603_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM603_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room603 : public Room {
+public:
+ Room603() : Room() {}
+ ~Room603() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
new file mode 100644
index 00000000000..86e60d039ae
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room604.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room604::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room604::init() {
+}
+
+void Room604::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
new file mode 100644
index 00000000000..e3c617ff288
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM604_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM604_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room604 : public Room {
+public:
+ Room604() : Room() {}
+ ~Room604() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room605.cpp b/engines/m4/burger/rooms/section6/room605.cpp
new file mode 100644
index 00000000000..9a78d4b78e7
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room605.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room605.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room605::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room605::init() {
+}
+
+void Room605::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room605.h b/engines/m4/burger/rooms/section6/room605.h
new file mode 100644
index 00000000000..270fa1325b5
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room605.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM605_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM605_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room605 : public Room {
+public:
+ Room605() : Room() {}
+ ~Room605() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room606.cpp b/engines/m4/burger/rooms/section6/room606.cpp
new file mode 100644
index 00000000000..89eb9ff3cda
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room606.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room606.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room606::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room606::init() {
+}
+
+void Room606::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room606.h b/engines/m4/burger/rooms/section6/room606.h
new file mode 100644
index 00000000000..2d3dbd1ae4a
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room606.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM606_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM606_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room606 : public Room {
+public:
+ Room606() : Room() {}
+ ~Room606() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room608.cpp b/engines/m4/burger/rooms/section6/room608.cpp
new file mode 100644
index 00000000000..659d75254f2
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room608.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room608.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room608::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room608::init() {
+}
+
+void Room608::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room608.h b/engines/m4/burger/rooms/section6/room608.h
new file mode 100644
index 00000000000..a4e89792489
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room608.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM608_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM608_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room608 : public Room {
+public:
+ Room608() : Room() {}
+ ~Room608() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room609.cpp b/engines/m4/burger/rooms/section6/room609.cpp
new file mode 100644
index 00000000000..b948910acf9
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room609.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room609.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room609::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room609::init() {
+}
+
+void Room609::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room609.h b/engines/m4/burger/rooms/section6/room609.h
new file mode 100644
index 00000000000..ee563c121f7
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room609.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM609_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM609_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room609 : public Room {
+public:
+ Room609() : Room() {}
+ ~Room609() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room610.cpp b/engines/m4/burger/rooms/section6/room610.cpp
new file mode 100644
index 00000000000..b023c0e99ab
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room610.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room610.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room610::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room610::init() {
+}
+
+void Room610::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room610.h b/engines/m4/burger/rooms/section6/room610.h
new file mode 100644
index 00000000000..327f7fc6e5f
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room610.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM610_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM610_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room610 : public Room {
+public:
+ Room610() : Room() {}
+ ~Room610() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/room612.cpp b/engines/m4/burger/rooms/section6/room612.cpp
new file mode 100644
index 00000000000..2b344e9f8f5
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room612.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/room612.h"
+#include "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room612::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room612::init() {
+}
+
+void Room612::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room612.h b/engines/m4/burger/rooms/section6/room612.h
new file mode 100644
index 00000000000..b6c636e6fbd
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/room612.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM612_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM612_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room612 : public Room {
+public:
+ Room612() : Room() {}
+ ~Room612() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
new file mode 100644
index 00000000000..d180f724fa9
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section6/section6.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section6::Section6() : Rooms::Section() {
+ add(601, &_room601);
+ add(602, &_room602);
+ add(603, &_room603);
+ add(604, &_room604);
+ add(605, &_room605);
+ add(606, &_room606);
+ add(608, &_room608);
+ add(609, &_room609);
+ add(610, &_room610);
+ add(612, &_room612);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
new file mode 100644
index 00000000000..522dfa29d9c
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION6_H
+#define M4_BURGER_ROOMS_SECTION6_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section6/room601.h"
+#include "m4/burger/rooms/section6/room602.h"
+#include "m4/burger/rooms/section6/room603.h"
+#include "m4/burger/rooms/section6/room604.h"
+#include "m4/burger/rooms/section6/room605.h"
+#include "m4/burger/rooms/section6/room606.h"
+#include "m4/burger/rooms/section6/room608.h"
+#include "m4/burger/rooms/section6/room609.h"
+#include "m4/burger/rooms/section6/room610.h"
+#include "m4/burger/rooms/section6/room612.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section6 : public Rooms::Section {
+private:
+ Room601 _room601;
+ Room602 _room602;
+ Room603 _room603;
+ Room604 _room604;
+ Room605 _room605;
+ Room606 _room606;
+ Room608 _room608;
+ Room609 _room609;
+ Room610 _room610;
+ Room612 _room612;
+
+public:
+ Section6();
+ virtual ~Section6() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6dbc8eb6655..799b33df925 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -110,6 +110,17 @@ MODULE_OBJS = \
burger/rooms/section1/room174.o \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
+ burger/rooms/section6/section6.o \
+ burger/rooms/section6/room601.o \
+ burger/rooms/section6/room602.o \
+ burger/rooms/section6/room603.o \
+ burger/rooms/section6/room604.o \
+ burger/rooms/section6/room605.o \
+ burger/rooms/section6/room606.o \
+ burger/rooms/section6/room608.o \
+ burger/rooms/section6/room609.o \
+ burger/rooms/section6/room610.o \
+ burger/rooms/section6/room612.o \
burger/rooms/section7/section7.o \
burger/rooms/section7/room701.o \
burger/rooms/section7/room702.o \
Commit: 42a3afe30ec79b59114398ecae572a53fe6cdb6d
https://github.com/scummvm/scummvm/commit/42a3afe30ec79b59114398ecae572a53fe6cdb6d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 601
Changed paths:
engines/m4/burger/rooms/section6/room601.cpp
diff --git a/engines/m4/burger/rooms/section6/room601.cpp b/engines/m4/burger/rooms/section6/room601.cpp
index 87b2af82ef2..c8198b2f648 100644
--- a/engines/m4/burger/rooms/section6/room601.cpp
+++ b/engines/m4/burger/rooms/section6/room601.cpp
@@ -27,14 +27,65 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesStreamBreak SERIES1[] = {
+ { 3, "601Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 58, "601Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 109, "601_002", 2, 255, -1, 0, nullptr, 0 },
+ { 142, "601_003", 2, 255, -1, 0, nullptr, 0 },
+ { 154, "601_004", 2, 255, -1, 0, nullptr, 0 },
+ { 155, "601F001", 1, 255, -1, 0, nullptr, 0 },
+ { 208, "601W001", 1, 255, -1, 0, nullptr, 0 },
+ { 224, "601Z004", 1, 255, -1, 0, nullptr, 0 },
+ { 264, "601F003", 1, 255, -1, 0, nullptr, 0 },
+ { 304, "601Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 432, "601W002", 1, 255, -1, 0, nullptr, 0 },
+ { 462, "601Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 492, "601Z007", 1, 255, -1, 0, nullptr, 0 },
+ { 528, "601_009a", 2, 255, -1, 0, nullptr, 0 },
+ { 543, "601_009b", 2, 255, -1, 0, nullptr, 0 },
+ { 556, "601_009c", 2, 255, -1, 0, nullptr, 0 },
+ { 566, "601_005", 2, 255, -1, 0, nullptr, 0 },
+ { 580, "601_006", 2, 255, -1, 0, nullptr, 0 },
+ { 679, "601_010", 1, 255, -1, 0, nullptr, 0 },
+ { 689, "601_007", 2, 255, -1, 0, nullptr, 0 },
+ { 695, "601_011", 1, 255, -1, 0, nullptr, 0 },
+ { 706, "601_010", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room601::preload() {
_G(player).walker_in_this_scene = false;
}
void Room601::init() {
+ _G(flags).reset2();
+ digi_preload("601_001");
+ digi_play_loop("601_001", 3, 40);
+ digi_preload_stream_breaks(SERIES1);
+ kernel_trigger_dispatch_now(1);
+
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(0);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, -1);
+ pal_cycle_init(118, 127, 6, -1, -1);
}
void Room601::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ series_stream_with_breaks(SERIES1, "601lab", 6, 1, 6004);
+ _G(kernel).suppress_fadeup = false;
+ break;
+
+ case 6004:
+ _G(game).new_room = 604;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
Commit: bce013770d309e7065ebfafbc260807cc45f3f8e
https://github.com/scummvm/scummvm/commit/bce013770d309e7065ebfafbc260807cc45f3f8e
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Use Common:: for strcpy_s() and strcat_s()
Changed paths:
engines/m4/burger/rooms/room.cpp
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 5263fed1b8f..1e73c816f35 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -45,8 +45,8 @@ void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
if (shadow) {
char temp[20];
- strcpy_s(temp, 20, seriesName);
- strcat_s(temp, 20, "s");
+ Common::strcpy_s(temp, 20, seriesName);
+ Common::strcat_s(temp, 20, "s");
_G(npcSpeech2) = series_play(temp, layer + 1, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
}
}
Commit: 70c4c637636210013118aee6e86518ec0fe0e6e8
https://github.com/scummvm/scummvm/commit/70c4c637636210013118aee6e86518ec0fe0e6e8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Init for room 602/612
Changed paths:
R engines/m4/burger/rooms/section6/room612.cpp
R engines/m4/burger/rooms/section6/room612.h
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 7fe473af57c..17e843d0929 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -27,16 +27,197 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room602::preload() {
- _G(player).walker_in_this_scene = false;
-}
-
void Room602::init() {
+ player_set_commands_allowed(false);
+ _G(flags)[V256] = 0;
+ _series1 = 0;
+
+ if (_G(game).room_id == 612) {
+ digi_preload("612_001a");
+
+ switch (_G(flags)[V277]) {
+ case 6001:
+ _val1 = 55;
+ break;
+
+ case 6002:
+ _val1 = _G(flags)[V278] ? 56 : 55;
+ break;
+
+ case 6003:
+ if (_G(flags)[V278]) {
+ digi_preload("602_005");
+ _val1 = 58;
+ } else {
+ _val1 = 57;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (_G(flags)[V278]) {
+ term_message("Adding the pushed walk code.");
+ _walk1 = intr_add_no_walk_rect(322, 304, 472, 329, 312, 320);
+ hotspot_set_active("PAW", false);
+ hotspot_set_active("MOTOR ", true);
+ hotspot_set_active("MOTOR", false);
+ hotspot_set_active("FLOOR ", false);
+
+ } else {
+ term_message("Adding the non-pushed walk code.");
+ term_message("x1 = %d, y1 = %d, x2 = %d, y2 = %d", 208, 304, 369, 329);
+ _walk1 = intr_add_no_walk_rect(208, 304, 369, 329, 197, 322);
+ hotspot_set_active("PAW", true);
+ hotspot_set_active("MOTOR", true);
+ hotspot_set_active("MOTOR ", false);
+ hotspot_set_active("FLOOR ", true);
+ }
+
+ kernel_trigger_dispatch_now(12);
+
+ if (_G(game).previous_room != 609)
+ kernel_trigger_dispatch_now(1);
+
+ _val2 = 48;
+ } else {
+ _val2 = 0;
+ }
+
+ _G(flags)[V264] = 0;
+ if (_G(flags)[V255] == 1)
+ series_show("602spill", 0xf00);
+
+ if (_G(flags)[V255] && _G(flags)[V278])
+ _G(kernel).call_daemon_every_loop = true;
+
+ if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1) {
+ _series2 = series_play("612wheel", 0x5ff);
+
+ } else if (_G(game).room_id == 502) {
+ _series2 = series_show("602wheel", 0x6ff);
+
+ } else {
+ _series2 = series_show("612wheel", 0x6ff);
+ }
+
+ _series3 = series_show("602door", 0xf00, 1, -1, -1, 0, 100,
+ _G(flags)[V257] / 21, _G(flags)[V257]);
+
+ if (_G(flags)[V256] == 1) {
+ _val3 = 63;
+ kernel_trigger_dispatch_now(2);
+ }
+
+ if (_G(flags)[V256] == 3) {
+ _val3 = 64;
+ kernel_trigger_dispatch_now(2);
+ }
+
+ if (_G(flags)[V256]) {
+ hotspot_set_active("DOOR", false);
+ hotspot_set_active("EXIT", true);
+
+ } else {
+ hotspot_set_active("DOOR", true);
+ hotspot_set_active("EXIT", false);
+ }
+
+ if (_G(flags)[V256] == 10028) {
+ _G(roomVal5) = 6002;
+ kernel_trigger_dispatch_now(6013);
+ }
+
+ // TODO: Set table used for custom hotspot handling
+ error("TODO: Ptr1");
+
+ if (_G(flags)[V243] == 6006) {
+ _series4 = series_load("602mg01");
+ _series5 = series_load("602mg01s");
+ _series6 = series_load("602mg02");
+ _series7 = series_load("602mg02s");
+ _G(roomVal6) = 6001;
+ kernel_timing_trigger(60, 6011);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ if (_G(flags)[V263]) {
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 603:
+ ws_hide_walker();
+ if (_G(roomVal7) == 1) {
+ _G(wilbur_should) = 2;
+ kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 3;
+ kernel_timing_trigger(60, gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 604:
+ ws_hide_walker();
+ _G(wilbur_should) = 3;
+ kernel_timing_trigger(60, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 609:
+ ws_demand_location(548, 355, 9);
+ _G(wilbur_should) = 10002;
+
+ hotspot_set_active("PAW", true);
+ hotspot_set_active("MOTOR", true);
+ hotspot_set_active("MOTOR ", false);
+ hotspot_set_active("FLOOR ", true);
+
+ _series8 = series_play("612mot02", 0x700, 0, -1, 0, -1);
+ _val1 = 53;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(548, 355, 9);
+
+ if (_G(game).room_id == 612) {
+ _G(flags)[V277] = 6001;
+ _G(flags)[V243] = 6007;
+ _G(flags)[V244] = 6004;
+ _G(flags)[V245] = 10031;
+ _G(flags)[ROOM101_FLAG8] = 1;
+ _val1 = 53;
+ kernel_trigger_dispatch_now(1);
+ }
+ break;
+ }
+
+ if (_G(flags)[V243] == 6006)
+ _G(roomVal8) = 5;
+ if (_G(flags)[V243] == 6007)
+ _G(roomVal8) = 9;
+ else if (_G(flags)[V243] == 6000)
+ _G(roomVal8) = 2;
+
+ kernel_trigger_dispatch_now(6014);
}
void Room602::daemon() {
}
+void Room602::pre_parser() {
+
+}
+
+void Room602::parser() {
+
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index ed803711252..4dfc2f60c42 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -29,13 +29,28 @@ namespace Burger {
namespace Rooms {
class Room602 : public Room {
+private:
+ noWalkRect *_walk1 = nullptr;
+ int _series1 = 0;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ int _series4 = 0;
+ int _series5 = 0;
+ int _series6 = 0;
+ int _series7 = 0;
+ machine *_series8 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+
public:
Room602() : Room() {}
~Room602() override {}
- void preload() override;
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room612.cpp b/engines/m4/burger/rooms/section6/room612.cpp
deleted file mode 100644
index 2b344e9f8f5..00000000000
--- a/engines/m4/burger/rooms/section6/room612.cpp
+++ /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/ },.
- *
- */
-
-#include "m4/burger/rooms/section6/room612.h"
-#include "m4/burger/rooms/section6/section6.h"
-#include "m4/burger/vars.h"
-
-namespace M4 {
-namespace Burger {
-namespace Rooms {
-
-void Room612::preload() {
- _G(player).walker_in_this_scene = false;
-}
-
-void Room612::init() {
-}
-
-void Room612::daemon() {
-}
-
-} // namespace Rooms
-} // namespace Burger
-} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room612.h b/engines/m4/burger/rooms/section6/room612.h
deleted file mode 100644
index b6c636e6fbd..00000000000
--- a/engines/m4/burger/rooms/section6/room612.h
+++ /dev/null
@@ -1,45 +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/>.
- *
- */
-
-#ifndef M4_BURGER_ROOMS_SECTION6_ROOM612_H
-#define M4_BURGER_ROOMS_SECTION6_ROOM612_H
-
-#include "m4/burger/rooms/room.h"
-
-namespace M4 {
-namespace Burger {
-namespace Rooms {
-
-class Room612 : public Room {
-public:
- Room612() : Room() {}
- ~Room612() override {}
-
- void preload() override;
- void init() override;
- void daemon() override;
-};
-
-} // namespace Rooms
-} // namespace Burger
-} // namespace M4
-
-#endif
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index d180f724fa9..3279652f61a 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -36,7 +36,7 @@ Section6::Section6() : Rooms::Section() {
add(608, &_room608);
add(609, &_room609);
add(610, &_room610);
- add(612, &_room612);
+ add(612, &_room602);
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index 522dfa29d9c..38aeaf4e22d 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -33,7 +33,6 @@
#include "m4/burger/rooms/section6/room608.h"
#include "m4/burger/rooms/section6/room609.h"
#include "m4/burger/rooms/section6/room610.h"
-#include "m4/burger/rooms/section6/room612.h"
namespace M4 {
namespace Burger {
@@ -50,7 +49,6 @@ private:
Room608 _room608;
Room609 _room609;
Room610 _room610;
- Room612 _room612;
public:
Section6();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index c599a425ffb..945125d5731 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -110,6 +110,10 @@ public:
int _roomVal2 = 0;
int _roomVal3 = 0;
int _roomVal4 = 0;
+ int _roomVal5 = 6000;
+ int _roomVal6 = 0;
+ int _roomVal7 = 3;
+ int _roomVal8 = 0;
int _walkTrigger = 0;
machine *_npcSpeech1 = nullptr;
machine *_npcSpeech2 = nullptr;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 799b33df925..fb3854ac753 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -120,7 +120,6 @@ MODULE_OBJS = \
burger/rooms/section6/room608.o \
burger/rooms/section6/room609.o \
burger/rooms/section6/room610.o \
- burger/rooms/section6/room612.o \
burger/rooms/section7/section7.o \
burger/rooms/section7/room701.o \
burger/rooms/section7/room702.o \
Commit: c72406dfbc9880c2c5b68add045011c51ed06208
https://github.com/scummvm/scummvm/commit/c72406dfbc9880c2c5b68add045011c51ed06208
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of custom sections-wide room logic
Changed paths:
A engines/m4/burger/rooms/section6/section6_room.cpp
A engines/m4/burger/rooms/section6/section6_room.h
engines/m4/adv_r/adv_hotspot.cpp
engines/m4/adv_r/adv_hotspot.h
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section6/room601.h
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/room603.h
engines/m4/burger/rooms/section6/room604.h
engines/m4/burger/rooms/section6/room605.h
engines/m4/burger/rooms/section6/room606.h
engines/m4/burger/rooms/section6/room608.h
engines/m4/burger/rooms/section6/room609.h
engines/m4/burger/rooms/section6/room610.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_hotspot.cpp b/engines/m4/adv_r/adv_hotspot.cpp
index 7fa972d9952..ae2f7fc7257 100644
--- a/engines/m4/adv_r/adv_hotspot.cpp
+++ b/engines/m4/adv_r/adv_hotspot.cpp
@@ -32,6 +32,20 @@ namespace M4 {
#define STR_HOT_SPOT "hot spot"
#define _MAXPOSINT 0x7fffffff
+void HotSpotRec::clear() {
+ ul_x = ul_y = lr_x = lr_y = 0;
+ feet_x = feet_y = 0;
+ facing = 0;
+ active = false;
+ cursor_number = 0;
+ syntax = 0;
+ vocabID = verbID = 0;
+ vocab = verb = prep = nullptr;
+ sprite = nullptr;
+ hash = 0;
+ next = nullptr;
+}
+
void hotspot_new_sprite(HotSpotRec *h, const char *sprite) {
if (!h)
return;
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
index 3fdfb245814..ed0ebbe77ef 100644
--- a/engines/m4/adv_r/adv_hotspot.h
+++ b/engines/m4/adv_r/adv_hotspot.h
@@ -28,19 +28,21 @@
namespace M4 {
struct HotSpotRec {
- int32 ul_x = 0, ul_y = 0, lr_x = 0, lr_y = 0; // Hotspot screen coordinates
- int32 feet_x = 0, feet_y = 0; // Walk-to target for player
- int8 facing = 0; // Direction player should face
- bool active = false; // Flag if hotspot is active
- byte cursor_number = 0; // Mouse cursor number
- byte syntax = 0; // Word syntax
- int32 vocabID = 0, verbID = 0; // ids of name and verb
- char *vocab = nullptr; // Vocabulary name of hotspot
- char *verb = nullptr; // Vocabulary default verb name
- char *prep = nullptr; // Preposition
- char *sprite = nullptr; // Sprite name
- int16 hash = 0; // woodscript sprite hash (runtime only)
- HotSpotRec *next = nullptr;
+ int32 ul_x, ul_y, lr_x, lr_y; // Hotspot screen coordinates
+ int32 feet_x, feet_y; // Walk-to target for player
+ int8 facing; // Direction player should face
+ bool active; // Flag if hotspot is active
+ byte cursor_number; // Mouse cursor number
+ byte syntax; // Word syntax
+ int32 vocabID, verbID; // ids of name and verb
+ char *vocab; // Vocabulary name of hotspot
+ char *verb; // Vocabulary default verb name
+ char *prep; // Preposition
+ char *sprite; // Sprite name
+ int16 hash; // woodscript sprite hash (runtime only)
+ HotSpotRec *next;
+
+ void clear();
};
extern HotSpotRec *hotspot_add_dynamic(
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 1e73c816f35..adccb22677c 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -26,6 +26,22 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+HotSpotRec Room::_wilburHotspot;
+char Room::_wilburName[16];
+char Room::_wilburVerb = 0;
+
+void Room::setWilburHotspot() {
+ Common::strcpy_s(_wilburName, "Wilbur");
+
+ _wilburHotspot.clear();
+ _wilburHotspot.vocab = _wilburName;
+ _wilburHotspot.verb = &_wilburVerb;
+ _wilburHotspot.feet_x = 0x7fff;
+ _wilburHotspot.feet_y = 0x7fff;
+ _wilburHotspot.cursor_number = kArrowCursor;
+}
+
+
void Room::shutdown() {
}
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 5853bbf5d1f..e9d4a11c0de 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -36,6 +36,16 @@ namespace Burger {
namespace Rooms {
class Room : public M4::Room {
+private:
+ static char _wilburName[16];
+ static char _wilburVerb;
+
+protected:
+ static HotSpotRec _wilburHotspot;
+
+public:
+ static void setWilburHotspot();
+
public:
Room() : M4::Room() {}
~Room() override {}
diff --git a/engines/m4/burger/rooms/section6/room601.h b/engines/m4/burger/rooms/section6/room601.h
index 66675649926..9f2c4f9414e 100644
--- a/engines/m4/burger/rooms/section6/room601.h
+++ b/engines/m4/burger/rooms/section6/room601.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM601_H
#define M4_BURGER_ROOMS_SECTION6_ROOM601_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room601 : public Room {
+class Room601 : public Section6Room {
public:
- Room601() : Room() {}
+ Room601() : Section6Room() {}
~Room601() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index 4dfc2f60c42..2d7021cd491 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM602_H
#define M4_BURGER_ROOMS_SECTION6_ROOM602_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room602 : public Room {
+class Room602 : public Section6Room {
private:
noWalkRect *_walk1 = nullptr;
int _series1 = 0;
@@ -44,7 +44,7 @@ private:
int _val3 = 0;
public:
- Room602() : Room() {}
+ Room602() : Section6Room() {}
~Room602() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
index e4c5e31c50d..9611caaf28d 100644
--- a/engines/m4/burger/rooms/section6/room603.h
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM603_H
#define M4_BURGER_ROOMS_SECTION6_ROOM603_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room603 : public Room {
+class Room603 : public Section6Room {
public:
- Room603() : Room() {}
+ Room603() : Section6Room() {}
~Room603() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
index e3c617ff288..cd44e6c7f63 100644
--- a/engines/m4/burger/rooms/section6/room604.h
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM604_H
#define M4_BURGER_ROOMS_SECTION6_ROOM604_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room604 : public Room {
+class Room604 : public Section6Room {
public:
- Room604() : Room() {}
+ Room604() : Section6Room() {}
~Room604() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room605.h b/engines/m4/burger/rooms/section6/room605.h
index 270fa1325b5..f817dc7569a 100644
--- a/engines/m4/burger/rooms/section6/room605.h
+++ b/engines/m4/burger/rooms/section6/room605.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM605_H
#define M4_BURGER_ROOMS_SECTION6_ROOM605_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room605 : public Room {
+class Room605 : public Section6Room {
public:
- Room605() : Room() {}
+ Room605() : Section6Room() {}
~Room605() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room606.h b/engines/m4/burger/rooms/section6/room606.h
index 2d3dbd1ae4a..a481c902a96 100644
--- a/engines/m4/burger/rooms/section6/room606.h
+++ b/engines/m4/burger/rooms/section6/room606.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM606_H
#define M4_BURGER_ROOMS_SECTION6_ROOM606_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room606 : public Room {
+class Room606 : public Section6Room {
public:
- Room606() : Room() {}
+ Room606() : Section6Room() {}
~Room606() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room608.h b/engines/m4/burger/rooms/section6/room608.h
index a4e89792489..f0fa4485287 100644
--- a/engines/m4/burger/rooms/section6/room608.h
+++ b/engines/m4/burger/rooms/section6/room608.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM608_H
#define M4_BURGER_ROOMS_SECTION6_ROOM608_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room608 : public Room {
+class Room608 : public Section6Room {
public:
- Room608() : Room() {}
+ Room608() : Section6Room() {}
~Room608() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room609.h b/engines/m4/burger/rooms/section6/room609.h
index ee563c121f7..69e192596dd 100644
--- a/engines/m4/burger/rooms/section6/room609.h
+++ b/engines/m4/burger/rooms/section6/room609.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM609_H
#define M4_BURGER_ROOMS_SECTION6_ROOM609_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room609 : public Room {
+class Room609 : public Section6Room {
public:
- Room609() : Room() {}
+ Room609() : Section6Room() {}
~Room609() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room610.h b/engines/m4/burger/rooms/section6/room610.h
index 327f7fc6e5f..995f2f56ccb 100644
--- a/engines/m4/burger/rooms/section6/room610.h
+++ b/engines/m4/burger/rooms/section6/room610.h
@@ -22,15 +22,15 @@
#ifndef M4_BURGER_ROOMS_SECTION6_ROOM610_H
#define M4_BURGER_ROOMS_SECTION6_ROOM610_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section6/section6_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room610 : public Room {
+class Room610 : public Section6Room {
public:
- Room610() : Room() {}
+ Room610() : Section6Room() {}
~Room610() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
new file mode 100644
index 00000000000..48c6e47bcd2
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/section6_room.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 "m4/burger/rooms/section6/section6_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
+ HotSpotRec *hotspot = walker_spotter(x, y);
+ if (hotspot)
+ return hotspot;
+
+ return nullptr;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
new file mode 100644
index 00000000000..a8946753546
--- /dev/null
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION6_ROOM_H
+#define M4_BURGER_ROOMS_SECTION6_ROOM_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section6Room : public Rooms::Room {
+protected:
+ int16 *_table = nullptr;
+public:
+ Section6Room() : Room() {}
+ ~Section6Room() override {}
+
+ HotSpotRec *custom_hotspot_which(int x, int y) override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index ccd7f3c3338..bc53943e11b 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -22,6 +22,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "m4/burger/vars.h"
+#include "m4/burger/rooms/room.h"
#include "m4/adv_r/adv_file.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
@@ -138,6 +139,8 @@ void Vars::initialize_game() {
_flags.reset4();
_flags.reset5();
_flags.conv_reset_all();
+
+ Rooms::Room::setWilburHotspot();
}
void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 945125d5731..8b0bdc982e5 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -103,7 +103,6 @@ public:
Burger::Walker _walker;
int _wilburTerm = 2;
- const Common::String _wilburName = "WILBUR";
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 19417b35b02..251bcb047c4 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -49,7 +49,7 @@ void Room::parser() {
_G(kernel).trigger = KT_DAEMON;
}
-HotSpotRec *Section::walker_spotter(int32 x, int32 y) {
+HotSpotRec *Room::walker_spotter(int32 x, int32 y) {
warning("TODO: walker_spotter");
return nullptr;
}
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 6a41b3b6f36..75453f5e584 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -48,6 +48,11 @@ public:
virtual HotSpotRec *custom_hotspot_which(int x, int y) {
return nullptr;
}
+
+ /**
+ * Used to tell if x,y is over the walker hotspot
+ */
+ virtual HotSpotRec *walker_spotter(int32 x, int32 y);
};
class Section {
@@ -75,11 +80,6 @@ public:
*/
Room *operator[](uint roomNum);
- /**
- * Used to tell if x,y is over the walker hotspot
- */
- virtual HotSpotRec *walker_spotter(int32 x, int32 y);
-
virtual void global_room_init() {}
virtual void daemon();
virtual void tick() {}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index fb3854ac753..ea8e0d7e704 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -111,6 +111,7 @@ MODULE_OBJS = \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
burger/rooms/section6/section6.o \
+ burger/rooms/section6/section6_room.o \
burger/rooms/section6/room601.o \
burger/rooms/section6/room602.o \
burger/rooms/section6/room603.o \
Commit: 24d53d6137c575fec579281da02b95fa3c68f0ed
https://github.com/scummvm/scummvm/commit/24d53d6137c575fec579281da02b95fa3c68f0ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Gerbils hotspot setup
Changed paths:
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index 48c6e47bcd2..21d13030301 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -20,11 +20,24 @@
*/
#include "m4/burger/rooms/section6/section6_room.h"
+#include "m4/gui/gui_mouse.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+Section6Room::Section6Room() : Room() {
+ Common::strcpy_s(_gerbilsName, "GERBILS");
+ Common::strcpy_s(_gerbilsVerb, "LOOK AT");
+
+ _gerbilsHotspot.clear();
+ _gerbilsHotspot.vocab = _gerbilsName;
+ _gerbilsHotspot.verb = _gerbilsVerb;
+ _gerbilsHotspot.feet_x = 0x7fff;
+ _gerbilsHotspot.feet_y = 0x7fff;
+ _gerbilsHotspot.cursor_number = kArrowCursor;
+}
+
HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
HotSpotRec *hotspot = walker_spotter(x, y);
if (hotspot)
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index a8946753546..969c7e6dad3 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -29,10 +29,14 @@ namespace Burger {
namespace Rooms {
class Section6Room : public Rooms::Room {
+private:
+ char _gerbilsName[16];
+ char _gerbilsVerb[16];
protected:
int16 *_table = nullptr;
+ HotSpotRec _gerbilsHotspot;
public:
- Section6Room() : Room() {}
+ Section6Room();
~Section6Room() override {}
HotSpotRec *custom_hotspot_which(int x, int y) override;
Commit: 30b78b44ad0d4767a5f9b9be08764da5eedd5848
https://github.com/scummvm/scummvm/commit/30b78b44ad0d4767a5f9b9be08764da5eedd5848
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added walker_spotter
Changed paths:
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index adccb22677c..417814cf427 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -49,6 +49,21 @@ void Room::parser_code() {
warning("TODO: global_parser_code");
}
+HotSpotRec *Room::walker_spotter(int32 x, int32 y) {
+ if (!_G(player).walker_in_this_scene || !_G(roomVal2))
+ return nullptr;
+
+ player_update_info();
+ int y2 = _G(player_info).y - (_G(player_info).scale * 75 / 100);
+ int y1 = _G(player_info).y - (_G(player_info).scale * 150 / 100);
+ int xSize = _G(player_info).scale * 22 / 100;
+
+ if (y > y2 || y <= y1 || imath_abs(x - _G(player_info).x) >= xSize)
+ return nullptr;
+
+ return &_wilburHotspot;
+}
+
void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
int layer, bool shadow, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
term_message("npc_say: %s npc_series: %s npc_trigger: %d",
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index e9d4a11c0de..e1be8c0166f 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -53,6 +53,11 @@ public:
void shutdown() override;
void parser_code() override;
+ /**
+ * Used to tell if x,y is over the walker hotspot
+ */
+ HotSpotRec *walker_spotter(int32 x, int32 y) override;
+
void compact_mem_and_report() {}
void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index 21d13030301..d2776f9a97a 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -20,7 +20,7 @@
*/
#include "m4/burger/rooms/section6/section6_room.h"
-#include "m4/gui/gui_mouse.h"
+#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
@@ -43,6 +43,14 @@ HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
if (hotspot)
return hotspot;
+ if (_G(flags)[V243] != 6006 || !_table ||
+ !verifyMachineExists(_sectionMachine) ||
+ (_G(game).room_id != 602 && _G(game).room_id != 603 &&
+ _G(game).room_id != 604))
+ return nullptr;
+
+ // TODO
+ error("TODO: custom_hotspot_which");
return nullptr;
}
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index 969c7e6dad3..26cb660e01f 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -35,6 +35,8 @@ private:
protected:
int16 *_table = nullptr;
HotSpotRec _gerbilsHotspot;
+ machine *_sectionMachine = nullptr;
+
public:
Section6Room();
~Section6Room() override {}
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 251bcb047c4..d0a9d9ce23a 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -49,11 +49,6 @@ void Room::parser() {
_G(kernel).trigger = KT_DAEMON;
}
-HotSpotRec *Room::walker_spotter(int32 x, int32 y) {
- warning("TODO: walker_spotter");
- return nullptr;
-}
-
void Section::daemon() {
warning("TODO: section daemon");
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 75453f5e584..da5be58d685 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -52,7 +52,9 @@ public:
/**
* Used to tell if x,y is over the walker hotspot
*/
- virtual HotSpotRec *walker_spotter(int32 x, int32 y);
+ virtual HotSpotRec *walker_spotter(int32 x, int32 y) {
+ return nullptr;
+ }
};
class Section {
Commit: 34f344d1ff5ec0d3166c0ce057fd8b85ea496d83
https://github.com/scummvm/scummvm/commit/34f344d1ff5ec0d3166c0ce057fd8b85ea496d83
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress section 6 custom_hotspot_which
Changed paths:
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index d2776f9a97a..fca6dd7ee1f 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -30,28 +30,46 @@ Section6Room::Section6Room() : Room() {
Common::strcpy_s(_gerbilsName, "GERBILS");
Common::strcpy_s(_gerbilsVerb, "LOOK AT");
- _gerbilsHotspot.clear();
- _gerbilsHotspot.vocab = _gerbilsName;
- _gerbilsHotspot.verb = _gerbilsVerb;
- _gerbilsHotspot.feet_x = 0x7fff;
- _gerbilsHotspot.feet_y = 0x7fff;
- _gerbilsHotspot.cursor_number = kArrowCursor;
+ _gerbilHotspot.clear();
+ _gerbilHotspot.vocab = _gerbilsName;
+ _gerbilHotspot.verb = _gerbilsVerb;
+ _gerbilHotspot.feet_x = 0x7fff;
+ _gerbilHotspot.feet_y = 0x7fff;
+ _gerbilHotspot.cursor_number = kArrowCursor;
}
HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
HotSpotRec *hotspot = walker_spotter(x, y);
if (hotspot)
- return hotspot;
+ return &_wilburHotspot;
- if (_G(flags)[V243] != 6006 || !_table ||
+ if (_G(flags)[V243] != 6006 || !_gerbilTable ||
!verifyMachineExists(_sectionMachine) ||
(_G(game).room_id != 602 && _G(game).room_id != 603 &&
_G(game).room_id != 604))
return nullptr;
- // TODO
- error("TODO: custom_hotspot_which");
- return nullptr;
+ int x1, x2, x3, y1, y2, y3;
+ int total1, total2, total3;
+
+ if (_G(flags)[V266]) {
+ x1 = 189;
+ y1 = 232;
+ x2 = 318;
+ y2 = 219;
+ x3 = 439;
+ y3 = 232;
+ } else {
+ // TODO
+ x1 = y1 = x2 = y2 = x3 = y3 = 0;
+ }
+
+ total1 = (x - x1) * (x - x1) + (y - y1) * (y - y1);
+ total2 = (x - x2) * (x - x2) + (y - y2) * (y - y2);
+ total3 = (x - x3) * (x - x3) + (y - y3) * (y - y3);
+
+ return (total1 < 1600) || (total2 < 1600) < (total3 < 1600) ?
+ &_gerbilHotspot : nullptr;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index 26cb660e01f..8bfb6ed81fa 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -33,8 +33,17 @@ private:
char _gerbilsName[16];
char _gerbilsVerb[16];
protected:
- int16 *_table = nullptr;
- HotSpotRec _gerbilsHotspot;
+ struct GerbilEntry {
+ int16 _v1;
+ int16 _v2;
+ int16 _v3;
+ int16 _v4;
+ int16 _v5;
+ int16 _v6;
+ };
+
+ GerbilEntry *_gerbilTable = nullptr;
+ HotSpotRec _gerbilHotspot;
machine *_sectionMachine = nullptr;
public:
Commit: f6ff6437a5e9fd631d50ea7fe60e05dc509d6287
https://github.com/scummvm/scummvm/commit/f6ff6437a5e9fd631d50ea7fe60e05dc509d6287
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished section 6 custom_hotspot_which
Changed paths:
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index fca6dd7ee1f..9944edbc2bc 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section6/section6_room.h"
#include "m4/burger/vars.h"
+#include "m4/wscript/wst_regs.h"
namespace M4 {
namespace Burger {
@@ -51,6 +52,7 @@ HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
int x1, x2, x3, y1, y2, y3;
int total1, total2, total3;
+ int diff;
if (_G(flags)[V266]) {
x1 = 189;
@@ -60,8 +62,27 @@ HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
x3 = 439;
y3 = 232;
} else {
- // TODO
- x1 = y1 = x2 = y2 = x3 = y3 = 0;
+ int index = _sectionMachine->myAnim8->myRegs[IDX_CELS_INDEX];
+ const GerbilPoint *points = _gerbilTable + index;
+
+ // TODO: Double check the modulus/divisions are correct
+ diff = points[3]._x - points[0]._x;
+ x1 = points[0]._x + (index % 3) * diff / 3;
+
+ diff = points[4]._x - points[1]._x;
+ x2 = points[1]._x + (index % 3) * diff / 3;
+
+ diff = points[5]._x - points[2]._x;
+ x3 = points[2]._x + (index % 3) * diff / 3;
+
+ diff = points[3]._y - points[0]._y;
+ y1 = points[0]._y + (index % 3) * diff / 3;
+
+ diff = points[4]._y - points[1]._y;
+ y2 = points[1]._y + (index % 3) * diff / 3;
+
+ diff = points[5]._y - points[2]._y;
+ y3 = points[2]._y + (index % 3) * diff / 3;
}
total1 = (x - x1) * (x - x1) + (y - y1) * (y - y1);
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index 8bfb6ed81fa..13e3e3700be 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -33,16 +33,12 @@ private:
char _gerbilsName[16];
char _gerbilsVerb[16];
protected:
- struct GerbilEntry {
- int16 _v1;
- int16 _v2;
- int16 _v3;
- int16 _v4;
- int16 _v5;
- int16 _v6;
+ struct GerbilPoint {
+ int16 _x;
+ int16 _y;
};
- GerbilEntry *_gerbilTable = nullptr;
+ const GerbilPoint *_gerbilTable = nullptr;
HotSpotRec _gerbilHotspot;
machine *_sectionMachine = nullptr;
Commit: d8434c0e063731029e72b269182044fc4d973324
https://github.com/scummvm/scummvm/commit/d8434c0e063731029e72b269182044fc4d973324
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify the Section pre_parser calls
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 20127381bdd..f2582505a42 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -433,6 +433,7 @@ void Interface::dispatch_command() {
_G(player).walker_trigger = -1;
g_engine->_activeRoom->pre_parser();
+ g_engine->_activeSection->pre_parser();
g_engine->global_pre_parser();
}
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 3279652f61a..06b150665d2 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -39,6 +39,14 @@ Section6::Section6() : Rooms::Section() {
add(612, &_room602);
}
+void Section6::daemon() {
+ // TODO
+}
+
+void Section6::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index 38aeaf4e22d..fdd53bc6d0a 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -50,9 +50,14 @@ private:
Room609 _room609;
Room610 _room610;
+ int _val1 = 0;
+
public:
Section6();
virtual ~Section6() {}
+
+ void daemon() override;
+ void pre_parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index da5be58d685..04f90300447 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -85,6 +85,7 @@ public:
virtual void global_room_init() {}
virtual void daemon();
virtual void tick() {}
+ virtual void pre_parser() {}
virtual void parser() {}
};
Commit: def763df2d3756009dfe4cf6b815d1e21c976c63
https://github.com/scummvm/scummvm/commit/def763df2d3756009dfe4cf6b815d1e21c976c63
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change walker_spotter to be a base room custom_hotspot_which
Most sections' rooms simply point custom_hotspot_which to
walker_spotter, so it makes sense to simply implement it
as the default method implementation, and then let rooms
like in section 6 override it as needed.
Changed paths:
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 417814cf427..291ae48fb72 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -49,7 +49,7 @@ void Room::parser_code() {
warning("TODO: global_parser_code");
}
-HotSpotRec *Room::walker_spotter(int32 x, int32 y) {
+HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
if (!_G(player).walker_in_this_scene || !_G(roomVal2))
return nullptr;
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index e1be8c0166f..194a0f6450d 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -56,7 +56,7 @@ public:
/**
* Used to tell if x,y is over the walker hotspot
*/
- HotSpotRec *walker_spotter(int32 x, int32 y) override;
+ HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
void compact_mem_and_report() {}
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index 9944edbc2bc..5f92fdcbc9e 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -39,8 +39,8 @@ Section6Room::Section6Room() : Room() {
_gerbilHotspot.cursor_number = kArrowCursor;
}
-HotSpotRec *Section6Room::custom_hotspot_which(int x, int y) {
- HotSpotRec *hotspot = walker_spotter(x, y);
+HotSpotRec *Section6Room::custom_hotspot_which(int32 x, int32 y) {
+ HotSpotRec *hotspot = Rooms::Room::custom_hotspot_which(x, y);
if (hotspot)
return &_wilburHotspot;
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index 13e3e3700be..32ae6509efb 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -46,7 +46,7 @@ public:
Section6Room();
~Section6Room() override {}
- HotSpotRec *custom_hotspot_which(int x, int y) override;
+ HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
};
} // namespace Rooms
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 04f90300447..e2ee368cc8c 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -45,14 +45,11 @@ public:
virtual void parser_code() {}
virtual void roomError() {}
virtual void shutdown() {}
- virtual HotSpotRec *custom_hotspot_which(int x, int y) {
- return nullptr;
- }
/**
- * Used to tell if x,y is over the walker hotspot
+ * Used to return custom hotspots at a given position
*/
- virtual HotSpotRec *walker_spotter(int32 x, int32 y) {
+ virtual HotSpotRec *custom_hotspot_which(int32 x, int32 y) {
return nullptr;
}
};
Commit: c402a492b60565a62b8d1c105343a9fcd1da5229
https://github.com/scummvm/scummvm/commit/c402a492b60565a62b8d1c105343a9fcd1da5229
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 6 parser
Changed paths:
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 06b150665d2..766768b52f0 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -43,8 +43,72 @@ void Section6::daemon() {
// TODO
}
-void Section6::pre_parser() {
+void Section6::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
+ bool kibble = player_said("KIBBLE");
+
+ if (player_said("RAY GUN", "BLOCK OF ICE")) {
+ _G(flags)[V247] = 1;
+ _G(wilbur_should) = 6000;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "GERBILS") && _G(flags)[V243] == 6006) {
+ _G(flags)[V247] = 1;
+ term_message("Taking gun out to shoot gerbils...");
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "KIBBLE ")) {
+ if (inv_player_has("KIBBLE")) {
+ _G(wilbur_should) = gSERIES_PLAY_BREAK_2;
+ ws_turn_to_face(9, gCHANGE_WILBUR_ANIMATION);
+
+ } else {
+ wilbur_speech("602w011");
+ }
+ } else if (kibble && player_said("LOOK AT")) {
+ wilbur_speech("602w009");
+ } else if (kibble && (player_said("KIBBLE TRAY") || player_said("KIBBLE "))) {
+ wilbur_speech("602w048");
+ } else if (kibble && (player_said("MOTOR") || player_said("MOTOR "))) {
+ wilbur_speech("600w003");
+ } else if (kibble && player_said("TAKE") && inv_player_has("KIBBLE")) {
+ wilbur_speech("602w010");
+
+ } else if (player_said("RAY GUN")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech(_G(flags)[V247] ? "600w002" : "600w001");
+ } else if (player_said("GERBIL HEAD") || player_said("GERBIL HEAD ") ||
+ player_said("WILBUR")) {
+ wilbur_speech("600w005");
+ } else if (player_said("GERBIL PIECES")) {
+ wilbur_speech("600w004");
+ } else if (player_said("BARS")) {
+ wilbur_speech("999w018");
+ } else if (player_said("FLOOR") || player_said("FLOOR ") || player_said("ROOF")) {
+ wilbur_speech("600w007");
+ } else if (player_said("TUBE") || player_said("TUBE ") ||
+ player_said("TUBE ") || player_said("TUBE ")) {
+ wilbur_speech("600w003");
+ } else if (player_said("TAKE")) {
+ wilbur_speech("999w021");
+ } else {
+ wilbur_speech("600w003");
+ }
+ } else if (player_said("GERBILS")) {
+ if (player_said("BLOCK OF ICE")) {
+ wilbur_speech("600w013");
+ } else if (player_said("BOTTLE")) {
+ wilbur_speech("600w014");
+ } else if (player_said("KIBBLE")) {
+ wilbur_speech("600w009");
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index fdd53bc6d0a..db7cf1fd23d 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -57,7 +57,7 @@ public:
virtual ~Section6() {}
void daemon() override;
- void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: ce448cbf5b2a7d24e123d4cd12f99e3ea8ba4020
https://github.com/scummvm/scummvm/commit/ce448cbf5b2a7d24e123d4cd12f99e3ea8ba4020
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Section 6 daemon
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 1eb6c758ee1..316afec86b6 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -560,7 +560,7 @@ void BurgerEngine::global_parser() {
inv_give_to_player("PUZ DISPENSER");
} else if (player_said("LOOK AT", "BLOCK OF ICE")) {
- _G(walker).wilbur_speech(_G(flags)[ROOM101_FLAG22] ? "999w002" : "999w001");
+ _G(walker).wilbur_speech(_G(flags)[V250] ? "999w002" : "999w001");
} else if (player_said("PANTYHOSE", "WILBUR")) {
if (_G(flags)[V297]) {
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 5dc06919f16..dc2cfeed90f 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -284,7 +284,7 @@ enum {
V247 = 247,
ROOM101_FLAG8 = 248,
ROOM101_FLAG6 = 249,
- ROOM101_FLAG22 = 250,
+ V250 = 250,
V251 = 251,
V252 = 252,
V253 = 253,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index eeed9e7f962..ba0fc299ffa 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -346,7 +346,7 @@ void Room101::daemon() {
case 9:
daemon9();
- if (_G(flags)[ROOM101_FLAG4] || _G(flags)[ROOM101_FLAG22] ||
+ if (_G(flags)[ROOM101_FLAG4] || _G(flags)[V250] ||
_G(flags)[ROOM101_FLAG23] || _G(flags)[V002]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -744,7 +744,7 @@ void Room101::daemon9() {
}
void Room101::daemon12() {
- if (_G(flags)[ROOM101_FLAG22] || _G(flags)[ROOM101_FLAG4])
+ if (_G(flags)[V250] || _G(flags)[ROOM101_FLAG4])
inv_give_to_player("BLOCK OF ICE");
if (_G(flags)[ROOM101_FLAG23] || _G(flags)[ROOM101_FLAG4])
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 17e843d0929..7367834b599 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -125,7 +125,7 @@ void Room602::init() {
}
if (_G(flags)[V256] == 10028) {
- _G(roomVal5) = 6002;
+ Section6::_state1 = 6002;
kernel_trigger_dispatch_now(6013);
}
@@ -137,7 +137,7 @@ void Room602::init() {
_series5 = series_load("602mg01s");
_series6 = series_load("602mg02");
_series7 = series_load("602mg02s");
- _G(roomVal6) = 6001;
+ Section6::_state3 = 6001;
kernel_timing_trigger(60, 6011);
}
@@ -198,11 +198,11 @@ void Room602::init() {
}
if (_G(flags)[V243] == 6006)
- _G(roomVal8) = 5;
+ Section6::_state4 = 5;
if (_G(flags)[V243] == 6007)
- _G(roomVal8) = 9;
+ Section6::_state4 = 9;
else if (_G(flags)[V243] == 6000)
- _G(roomVal8) = 2;
+ Section6::_state4 = 2;
kernel_trigger_dispatch_now(6014);
}
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 766768b52f0..a3351ab6e1a 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -26,6 +26,19 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 10, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 11, 30, "600_011", 2, 255, -1, 0, 0, 0, 0 },
+ { 31, 33, "600_001", 2, 255, -1, 0, 0, 0, 0 },
+ { 34, -1, "600_002", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+int Section6::_state1;
+int Section6::_state2;
+int Section6::_state3;
+int Section6::_state4;
+
Section6::Section6() : Rooms::Section() {
add(601, &_room601);
add(602, &_room602);
@@ -37,10 +50,305 @@ Section6::Section6() : Rooms::Section() {
add(609, &_room609);
add(610, &_room610);
add(612, &_room602);
+
+ _state1 = 6000;
+ _state2 = 3;
+ _state3 = 0;
+ _state4 = 0;
}
void Section6::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+
+ case 6004:
+ case 6005:
+ case 6006:
+ _G(game).new_room = _G(kernel).trigger - 6000;
+ break;
+
+ case 6008:
+ _G(game).new_room = 609;
+ break;
+
+ case 6009:
+ _G(game).new_room = 610;
+ break;
+
+ case 6010:
+ _G(game).new_room = 612;
+ break;
+
+ case 6011:
+ if (_state3 == 6005)
+ kernel_trigger_dispatch_now(6006);
+ break;
+
+ case 6013:
+ switch (_state1) {
+ case 6001:
+ if (_G(flags)[V243] == 6000) {
+ if (_G(game).room_id == 602)
+ _state4 = 2;
+ if (_G(game).room_id == 603)
+ _state4 = 1;
+ if (_G(game).room_id == 604)
+ _state4 = 0;
+ }
+
+ _G(flags)[V250] = 1;
+ inv_move_object("BLOCK OF ICE", NOWHERE);
+ _state1 = 6002;
+ ws_unhide_walker();
+
+ if (_G(game).room_id == 602)
+ _G(flags)[V245] = 10028;
+ if (_G(game).room_id == 603)
+ _G(flags)[V245] = 10029;
+ if (_G(game).room_id == 604)
+ _G(flags)[V245] = 10030;
+
+ if (_G(flags)[V243] == 6000) {
+ if (_G(game).room_id == 602)
+ _state4 = 2;
+ if (_G(game).room_id == 603)
+ _state4 = 1;
+ if (_G(game).room_id == 604)
+ _state4 = 0;
+
+ kernel_trigger_dispatch_now(6014);
+ }
+
+ kernel_trigger_dispatch_now(6013);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 6002:
+ term_message("Ga-boingy boingy boingy boing!");
+ _series1 = series_play("602hop_1", 0xa80, 0, -1, 0);
+ _series2 = series_play("602hop_2", 0x780, 0, -1, 0);
+ _series3 = series_play("602hop_3", 0x400, 0, -1, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6014:
+ if (_val1)
+ freeDigi(_val1);
+
+ switch (_state4) {
+ case 0:
+ if (_G(flags)[V245] == 10030) {
+ term_message("** Ambience: Gerbils snoring with grasshoppers! 100 **");
+ _val1 = 6001;
+ digi_preload("604_003", 604);
+ digi_play_loop("604_003", 3, 125, -1, 604);
+ } else {
+ term_message("** Ambience: Gerbils snoring! 100 **");
+ _val1 = 6000;
+ digi_preload("600_003", 600);
+ digi_play_loop("600_003", 3, 155, -1, 600);
+ }
+ break;
+
+ case 1:
+ if (_G(flags)[V245] == 10029) {
+ term_message("** Ambience: Gerbils snoring with grasshoppers! 60 **");
+ _val1 = 6002;
+ digi_preload("600_003", 603);
+ digi_play_loop("600_003", 3, 125, -1, 603);
+ } else {
+ term_message("** Ambience: Gerbils snoring! 60 **");
+ _val1 = 6000;
+ digi_preload("600_003", 600);
+ digi_play_loop("600_003", 3, 65, -1, 600);
+ }
+ break;
+
+ case 2:
+ if (_G(flags)[V245] == 10028) {
+ term_message("** Ambience: Gerbils snoring with grasshoppers! 30 **");
+ _val1 = 6003;
+ digi_preload("602_003", 602);
+ digi_play_loop("602_003", 3, 125, -1, 602);
+ } else {
+ term_message("** Ambience: Gerbils snoring! 30 **");
+ _val1 = 6000;
+ digi_preload("600_003", 600);
+ digi_play_loop("600_003", 3, 20, -1, 600);
+ }
+ break;
+
+ case 3:
+ if (_G(flags)[V245] == 10030) {
+ term_message("** Ambience: Gerbils waking up with grasshoppers! 100 **");
+ _val1 = 6005;
+ digi_preload("604_005", 604);
+ digi_play_loop("604_005", 3, 125, -1, 604);
+ } else {
+ term_message("** Ambience: Gerbils waking up! 100 **");
+ _val1 = 6004;
+ digi_preload("604_004", 604);
+ digi_play_loop("604_004", 3, 155, -1, 604);
+ }
+ break;
+
+ case 4:
+ if ((_G(flags)[V245] == 10030 && _G(game).room_id == 604) ||
+ (_G(flags)[V245] == 10029 && _G(game).room_id == 603) ||
+ (_G(flags)[V245] == 10028 && _G(game).room_id == 602)) {
+ term_message("** Ambience: Gerbils arming weapons with grasshoppers! 100 **'");
+ _val1 = 6007;
+ digi_preload("600_005", 600);
+ digi_play_loop("600_005", 3, 155, -1, 600);
+ } else {
+ term_message("** Ambience: Gerbils arming weapons! 100 **");
+ _val1 = 6006;
+ digi_preload("600_004", 600);
+ digi_play_loop("600_004", 3, 155, -1, 600);
+ }
+ break;
+
+ case 5:
+ if ((_G(flags)[V245] == 10030 && _G(game).room_id == 604) ||
+ (_G(flags)[V245] == 10029 && _G(game).room_id == 603) ||
+ (_G(flags)[V245] == 10028 && _G(game).room_id == 602)) {
+ term_message("** Ambience: Gerbils entering with grasshoppers! 100 **");
+ _val1 = 6009;
+ digi_preload("600_007", 600);
+ digi_play_loop("600_007", 3, 155, -1, 600);
+ } else {
+ term_message("** Ambience: Gerbils entering! 100 **");
+ _val1 = 6008;
+ digi_preload("600_006", 600);
+ digi_play_loop("600_006", 3, 155, -1, 600);
+ }
+ break;
+
+ case 6:
+ term_message("** Ambience: Gerbils are firing at grasshoppers! 100 **");
+ _val1 = 0;
+ break;
+
+ case 7:
+ term_message("** Ambience: Gerbils are fried! 25 **");
+ _val1 = 0;
+ break;
+
+ case 8:
+ term_message("** Ambience: Gerbils are fried! 50 **");
+ _val1 = 0;
+ break;
+
+ case 9:
+ if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1) {
+ term_message("** Ambience: Gerbils are fried and wheel running! 100 **");
+ _val1 = 0;
+ } else {
+ term_message("** Ambience: Gerbils are fried! 100 **");
+ _val1 = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 6000:
+ player_set_commands_allowed(false);
+ series_load("602hop_1");
+ series_load("602hop_2");
+ series_load("602hop_3");
+
+ if (_G(flags)[V243] == 6006)
+ digi_preload("600_007");
+
+ if (_G(flags)[V243] == 6000) {
+ if (_G(game).room_id == 602)
+ digi_preload("602_003");
+ if (_G(game).room_id == 603)
+ digi_preload("603_003");
+ if (_G(game).room_id == 604)
+ digi_preload("604_003");
+ }
+
+ _G(wilbur_should) = 6001;
+ ws_walk(352, 276, 0, gCHANGE_WILBUR_ANIMATION, 9);
+ break;
+
+ case 6001:
+ switch (_G(game).room_id) {
+ case 602:
+ ws_hide_walker();
+ _state1 = 6001;
+ _G(wilbur_should) = 6002;
+ _G(flags)[V244] = 10028;
+ series_play_with_breaks(PLAY1, "602melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 603:
+ ws_hide_walker();
+ _state1 = 6001;
+ _G(wilbur_should) = 6002;
+ _G(flags)[V244] = 10029;
+ series_play_with_breaks(PLAY1, "603melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 604:
+ if (_G(flags)[V243] == 6006) {
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ } else {
+ _G(flags)[V244] = 10030;
+ ws_hide_walker();
+ _state1 = 6001;
+ _G(wilbur_should) = 6002;
+ series_play_with_breaks(PLAY1, "604melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6002:
+ kernel_trigger_dispatch_now(6013);
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+
+ if (_G(flags)[V251] == 0) {
+ _G(flags)[V251] = 1;
+ wilbur_speech("600w008");
+ }
+ break;
+
+ case 6003:
+ _G(flags)[V266] = 0;
+ kernel_trigger_dispatch_now(6006);
+ break;
+
+ case 10015:
+ _G(game).new_room = 608;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Section6::parser() {
@@ -111,6 +419,52 @@ void Section6::parser() {
_G(player).command_ready = false;
}
+void Section6::freeDigi(int state) {
+ switch (state) {
+ case 6000:
+ digi_unload("600_003");
+ break;
+ case 6001:
+ digi_unload("604_003");
+ break;
+ case 6002:
+ digi_unload("603_003");
+ break;
+ case 6003:
+ digi_unload("602_003");
+ break;
+ case 6004:
+ digi_unload("604_004");
+ break;
+ case 6005:
+ digi_unload("604_005");
+ break;
+ case 6006:
+ digi_unload("600_004");
+ break;
+ case 6007:
+ digi_unload("600_005");
+ break;
+ case 6008:
+ digi_unload("600_006");
+ break;
+ case 6009:
+ digi_unload("600_007");
+ break;
+ case 6010:
+ digi_unload("600xxxxx");
+ break;
+ case 6011:
+ digi_unload("600_010");
+ break;
+ case 6012:
+ digi_unload("600xxxxx");
+ break;
+ default:
+ break;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index db7cf1fd23d..3a14009db92 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -50,8 +50,19 @@ private:
Room609 _room609;
Room610 _room610;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
int _val1 = 0;
+ void freeDigi(int state);
+
+public:
+ static int _state1;
+ static int _state2;
+ static int _state3;
+ static int _state4;
+
public:
Section6();
virtual ~Section6() {}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8b0bdc982e5..8e9c21bd8c5 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -109,10 +109,7 @@ public:
int _roomVal2 = 0;
int _roomVal3 = 0;
int _roomVal4 = 0;
- int _roomVal5 = 6000;
- int _roomVal6 = 0;
int _roomVal7 = 3;
- int _roomVal8 = 0;
int _walkTrigger = 0;
machine *_npcSpeech1 = nullptr;
machine *_npcSpeech2 = nullptr;
Commit: 63337f7be3de1ec9578c217ddf405a0649b16d21
https://github.com/scummvm/scummvm/commit/63337f7be3de1ec9578c217ddf405a0649b16d21
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Properly implement room 602's gerbil point table
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/section6_room.h
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 7367834b599..cda696d9e60 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -27,6 +27,29 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const Room602::GerbilPoint Room602::GERBIL[] = {
+ { -99, -99 }, { -99, -99 }, { -99, -99 }, { -99, -99 }, { -99, -99 }, { -99, -99 },
+ { 344, 186 }, { 344, 186 }, { 344, 186 }, { 344, 186 }, { 376, 223 }, { 376, 223 },
+ { 342, 201 }, { 392, 228 }, { 392, 228 }, { 349, 231 }, { 392, 228 }, { 392, 228 },
+ { 349, 231 }, { 349, 231 }, { 349, 231 }, { 349, 231 }, { 349, 231 }, { 349, 231 },
+ { 422, 227 }, { 322, 226 }, { 322, 220 }, { 228, 216 }, { 430, 232 }, { 430, 232 },
+ { 183, 230 }, { 430, 232 }, { 430, 232 }, { 179, 233 }, { 426, 231 }, { 426, 231 },
+ { 176, 237 }, { 426, 231 }, { 329, 169 }, { 176, 237 }, { 426, 231 }, { 343, 193 },
+ { 176, 237 }, { 426, 231 }, { 344, 212 }, { 176, 237 }, { 426, 231 }, { 350, 225 },
+ { 176, 237 }, { 426, 231 }, { 350, 225 }, { 176, 237 }, { 426, 231 }, { 344, 227 },
+ { 176, 237 }, { 426, 231 }, { 337, 226 }, { 176, 237 }, { 426, 231 }, { 337, 226 },
+ { 176, 237 }, { 426, 231 }, { 334, 222 }, { 176, 237 }, { 426, 231 }, { 329, 221 },
+ { 176, 237 }, { 426, 231 }, { 324, 219 }, { 176, 237 }, { 426, 231 }, { 320, 218 },
+ { 176, 237 }, { 426, 231 }, { 316, 217 }, { 176, 237 }, { 426, 231 }, { 316, 217 },
+ { 176, 237 }, { 426, 231 }, { 316, 217 }, { 176, 237 }, { 426, 231 }, { 316, 217 },
+ { 176, 237 }, { 426, 231 }, { 316, 217 }, { 176, 237 }, { 426, 231 }, { 316, 217 },
+ { 176, 237 }, { 426, 231 }, { 316, 217 }, { 176, 237 }, { 426, 231 }, { 316, 217 }
+};
+
+Room602::Room602() : Section6Room() {
+ _gerbilTable = GERBIL;
+}
+
void Room602::init() {
player_set_commands_allowed(false);
_G(flags)[V256] = 0;
@@ -129,9 +152,6 @@ void Room602::init() {
kernel_trigger_dispatch_now(6013);
}
- // TODO: Set table used for custom hotspot handling
- error("TODO: Ptr1");
-
if (_G(flags)[V243] == 6006) {
_series4 = series_load("602mg01");
_series5 = series_load("602mg01s");
@@ -211,7 +231,19 @@ void Room602::daemon() {
}
void Room602::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(flags)[V263] == 1) {
+ _G(wilbur_should) = 13;
+ _G(player).command_ready = false;
+ player_set_commands_allowed(false);
+ g_vars->getInterface()->cancel_sentence();
+ hotspot_set_active("DOOR", true);
+ hotspot_set_active("EXIT", false);
+ } else if (_G(flags)[V243] == 6006) {
+
+ }
}
void Room602::parser() {
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index 2d7021cd491..06f7def70bc 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -29,6 +29,7 @@ namespace Burger {
namespace Rooms {
class Room602 : public Section6Room {
+ static const GerbilPoint GERBIL[];
private:
noWalkRect *_walk1 = nullptr;
int _series1 = 0;
@@ -44,7 +45,7 @@ private:
int _val3 = 0;
public:
- Room602() : Section6Room() {}
+ Room602();
~Room602() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index 32ae6509efb..d450cd49075 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -37,7 +37,6 @@ protected:
int16 _x;
int16 _y;
};
-
const GerbilPoint *_gerbilTable = nullptr;
HotSpotRec _gerbilHotspot;
machine *_sectionMachine = nullptr;
Commit: cc5c4005008d1114c813c88687f21d6016ebbd65
https://github.com/scummvm/scummvm/commit/cc5c4005008d1114c813c88687f21d6016ebbd65
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 602 methods
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room602.cpp
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index dc2cfeed90f..e71a50ad987 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -314,7 +314,7 @@ enum {
V277 = 277,
V278 = 278,
V279 = 279,
- ROOM101_FLAG23 = 280,
+ V280 = 280,
V281 = 281,
V282 = 282,
V283 = 283,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index ba0fc299ffa..a8140d0e4d2 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -347,7 +347,7 @@ void Room101::daemon() {
daemon9();
if (_G(flags)[ROOM101_FLAG4] || _G(flags)[V250] ||
- _G(flags)[ROOM101_FLAG23] || _G(flags)[V002]) {
+ _G(flags)[V280] || _G(flags)[V002]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_trigger_dispatch_now(10);
@@ -747,7 +747,7 @@ void Room101::daemon12() {
if (_G(flags)[V250] || _G(flags)[ROOM101_FLAG4])
inv_give_to_player("BLOCK OF ICE");
- if (_G(flags)[ROOM101_FLAG23] || _G(flags)[ROOM101_FLAG4])
+ if (_G(flags)[V280] || _G(flags)[ROOM101_FLAG4])
inv_give_to_player("PANTYHOSE");
if (_G(flags)[V002]) {
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index cda696d9e60..68f0e0238e5 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -46,6 +46,29 @@ const Room602::GerbilPoint Room602::GERBIL[] = {
{ 176, 237 }, { 426, 231 }, { 316, 217 }, { 176, 237 }, { 426, 231 }, { 316, 217 }
};
+static const char *SAID[][4] = {
+ { "KIBBLE TRAY", "602w006", "602w007", "602w008" },
+ { "KIBBLE ", "602w009", nullptr, nullptr },
+ { "EXERCISE WHEEL", nullptr, "602w014", nullptr },
+ { "GENERATOR", nullptr, "602w023", "602w023" },
+ { "MAGNET", nullptr, "602w023", "602w023" },
+ { "DOOR", nullptr, "602w008", nullptr },
+ { "PEANUT", "602w034", "602w035", "602w036" },
+ { "TUBE", "602w037", "602w008", nullptr },
+ { "TUBE ", "602w038", "602w008", "602w039" },
+ { "BARS", "602w040", "602w008", "602w008" },
+ { "FLOOR", nullptr, "602w008", "602w008" },
+ { "FLOOR ", nullptr, "602w008", "602w008" },
+ { "GERBIL HEAD", "612w043", "612w044", "602w023" },
+ { "GERBIL HEAD ", "612w045", "612w046", "612w047" },
+ { "GERBIL PIECES", nullptr, "612w050", "612w050" },
+ { "MOTOR", "612w051", "612w052", nullptr },
+ { "MOTOR ", "612w051", "612w052", nullptr },
+ { "PAW", nullptr, "612w060", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
Room602::Room602() : Section6Room() {
_gerbilTable = GERBIL;
}
@@ -228,6 +251,7 @@ void Room602::init() {
}
void Room602::daemon() {
+
}
void Room602::pre_parser() {
@@ -237,17 +261,172 @@ void Room602::pre_parser() {
_G(wilbur_should) = 13;
_G(player).command_ready = false;
player_set_commands_allowed(false);
- g_vars->getInterface()->cancel_sentence();
+ intr_cancel_sentence();
hotspot_set_active("DOOR", true);
hotspot_set_active("EXIT", false);
- } else if (_G(flags)[V243] == 6006) {
+ } else if (_G(flags)[V243] == 6006 && (player_said("GEAR", "TUBE") || player_said("CLIMB IN"))) {
+ wilbur_speech("600w003");
+ intr_cancel_sentence();
+ } else if (player_said("KIBBLE") && (player_said("FLOOR ") || player_said("FLOOR ") || player_said("FLOOR"))) {
+ if (_G(flags)[V278] == 0) {
+ if (_G(flags)[V255] == 0) {
+ _G(wilbur_should) = 22;
+ player_hotspot_walk_override(423, 303, 9, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ wilbur_speech("600w008z");
+ }
+ }
+ } else if (player_said("RAY GUN", "KIBBLE TRAY")) {
+ _G(wilbur_should) = 6;
+ if (_G(game).room_id == 602) {
+ player_hotspot_walk_override(172, 325, 9, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ player_hotspot_walk_override(151, 315, 9, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("RAY GUN", "KIBBLE ")) {
+ _G(wilbur_should) = 7;
+ player_hotspot_walk_override(151, 315, 9, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "EXERCISE WHEEL") && !_G(flags)[V278]) {
+ _G(wilbur_should) = 8;
+ player_hotspot_walk_override(409, 359, 2, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "DOOR")) {
+ _G(wilbur_should) = 9;
+ player_hotspot_walk_override(331, 303, 10, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "GERBILS")) {
+ _G(wilbur_should) = 10;
+ player_hotspot_walk_override(315, 317, 10, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "DOOR")) {
+ _G(wilbur_should) = 47;
+ player_hotspot_walk_override(257, 290, 10, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "MOTOR") || player_said("GEAR", "MOTOR ")) {
+ if (_G(flags)[V278] == 0) {
+ if (_G(flags)[V277] == 6001) {
+ _G(wilbur_should) = 25;
+ player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ }
+ if (_G(flags)[V277] == 6002 || _G(flags)[V277] == 6003) {
+ if (_G(flags)[V255] == 1) {
+ _G(wilbur_should) = 39;
+ player_hotspot_walk_override(200, 21, 3, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 26;
+ player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ }
+ }
+ } else {
+ _G(wilbur_should) = 26;
+ player_hotspot_walk_override(314, 319, 3, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if ((player_said("GEAR", "MOTOR ") || player_said("PANTYHOSE", "MOTOR ")) &&
+ _G(flags)[V277] != 6002) {
+ _G(wilbur_should) = 37;
+ if (_G(flags)[V278]) {
+ player_hotspot_walk_override(313, 319, 3, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else {
+ return;
}
}
void Room602::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("RAY GUN") && (player_said("MOTOR") ||
+ player_said("MOTOR ") || player_said("PAW") || player_said("GENERATOR") ||
+ player_said("MAGNET"))) {
+ _G(wilbur_should) = 43;
+ intr_cancel_sentence();
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "PEANUT")) {
+ wilbur_speech("602w047");
+ intr_cancel_sentence();
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
+ _G(flags)[V246] = 1;
+ Section6::_state2 = 2;
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("EXIT")) {
+ _G(wilbur_should) = 42;
+ ws_turn_to_face(5, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("PANTYHOSE", "MOTOR") || player_said("PANTYHOSE", "MOTOR ")) {
+ if (_G(flags)[V277] == 6001) {
+ _G(wilbur_should) = 25;
+ if (_G(flags)[V278]) {
+ player_hotspot_walk_override(314, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ }
+ }
+
+ if (_G(flags)[V280]) {
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ wilbur_speech("612w064", gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("GEAR", "EXERCISE WHEEL")) {
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "DOOR")) {
+ _G(wilbur_should) = 47;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("KIBBLE ", "TAKE")) {
+ _G(wilbur_should) = 18;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("LOOK AT", "EXERCISE WHEEL")) {
+ if (_G(flags)[V278] == 1 && _G(flags)[V277] == 6003) {
+ wilbur_speech("612w062");
+ } else {
+ wilbur_speech("602w013");
+ }
+ } else if (player_said("LOOK AT", "MAGNET")) {
+ wilbur_speech(_G(flags)[V260] ? "602w025" : "602w024");
+
+ } else if (player_said("LOOK AT", "FLOOR") || player_said("LOOK AT", "FLOOR ")) {
+ wilbur_speech(_G(game).room_id == 612 ? "602w042" : "602w041");
+
+ } else if (player_said("LOOK AT", "GENERATOR")) {
+ wilbur_speech(_G(flags)[V260] ? "602w022" : "602w021");
+
+ } else if (player_said("LOOK AT", "GERBIL PIECES") || player_said("LOOK AT", "GERBIL HAND")) {
+ wilbur_speech(_G(flags)[V281] ? "612w049" : "612w048");
+
+ } else if (player_said("LOOK AT", "DOOR")) {
+ if (_G(flags)[V261]) {
+ wilbur_speech(_G(flags)[V260] ? "602w029" : "602w028");
+ } else {
+ wilbur_speech(_G(flags)[V260] ? "602w027" : "602w026");
+ }
+ } else if (player_said("LOOK AT", "PAW")) {
+ wilbur_speech(_G(flags)[V277] == 6003 ? "612w059" : "612w058");
+
+ } else if (player_said("PAW", "GEAR") && _G(flags)[V277] != 6003) {
+ wilbur_speech("612w061");
+
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
} // namespace Rooms
Commit: ad9b132abfa825ea7b5c2bf322cfd414f8ed194c
https://github.com/scummvm/scummvm/commit/ad9b132abfa825ea7b5c2bf322cfd414f8ed194c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Play/series arrays for room 602
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index e71a50ad987..3cb42da0181 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -283,7 +283,7 @@ enum {
V246 = 246,
V247 = 247,
ROOM101_FLAG8 = 248,
- ROOM101_FLAG6 = 249,
+ V249 = 249,
V250 = 250,
V251 = 251,
V252 = 252,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index a8140d0e4d2..b09ad84de6b 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -261,7 +261,7 @@ void Room101::daemon() {
if (_G(flags)[ROOM101_FLAG5] <= 1) {
_G(walker).wilbur_speech("101w520", 7);
- } else if (_G(flags)[ROOM101_FLAG6] && !_G(flags)[ROOM101_FLAG7]) {
+ } else if (_G(flags)[V249] && !_G(flags)[ROOM101_FLAG7]) {
_G(walker).wilbur_speech("101w522", 7);
_G(flags)[ROOM101_FLAG7] = 1;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 68f0e0238e5..7a59ee88d26 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -68,9 +68,191 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesStreamBreak SERIES1[] = {
+ { 0, nullptr, 1, 0, -1, 2048, nullptr, 0 },
+ { 13, nullptr, 0, 0, 2, 0, nullptr, 0 },
+ { 16, nullptr, 0, 0, 14, 0, &Flags::_flags[260], 0 },
+ { 16, nullptr, 0, 0, 10016, 0, &Flags::_flags[260], 1 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 0, nullptr, 1, 0, -1, 2048, nullptr, 0 },
+ { 35, nullptr, 0, 0, 11, 0, nullptr, 0 },
+ { 46, "602w018", 1, 255, -1, 0, nullptr, 0 },
+ { 49, nullptr, 0, 0, 10016, 0, nullptr, 0 },
+ { 55, "602w019", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY1[] = {
+ { 0, 0, "602_002", 2, 255, -1, 2048, 0, nullptr, 0 },
+ { 1, -1, "602w001", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY2[] = {
+ { 0, 10, "602_001", 2, 255, -1, 2048, 0, nullptr, 0 },
+ { 11, -1, "602w002", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY3[] = {
+ { 0, 3, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 4, 5, "600w015", 2, 100, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY4[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, -1, "600_013", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY5[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, -1, "600_013", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY6[] = {
+ { 0, 19, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 20, -1, "600_013", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY7[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, -1, "602_010", 2, 255, -1, 0, 0, nullptr, 0 },
+};
+
+const seriesPlayBreak Room602::PLAY8[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, -1, "600_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY9[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY10[] = {
+ { 0, 67, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY11[] = {
+ { 68, 72, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY12[] = {
+ { 0, 3, "600_013", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 4, 8, "600_013", 2, 205, -1, 0, 0, nullptr, 0 },
+ { 9, 11, "600_013", 2, 175, -1, 0, 0, nullptr, 0 },
+ { 0, 4, "600_013", 2, 215, -1, 0, 0, nullptr, 0 },
+ { 5, 9, "600_013", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 10, 11, "600_013", 2, 175, -1, 0, 0, nullptr, 0 },
+ { 0, 1, "600_013", 2, 225, -1, 0, 0, nullptr, 0 },
+ { 2, 7, "600_013", 2, 245, -1, 0, 0, nullptr, 0 },
+ { 8, 11, "600_013", 2, 205, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY13[] = {
+ { 0, 12, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 13, 15, "602w030", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 15, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ { 16, 21, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 22, -1, "602_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY14[] = {
+ { 0, 12, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 13, 15, "602w032", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 15, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ { 16, 21, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 22, -1, "602_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY15[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 1 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 2 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 3 },
+ { 7, -1, "602_009", 2, 255, -1, 0, 0, &Flags::_flags[V256], 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY16[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_test1, 0 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_test1, 1 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_test1, 2 },
+ { 7, -1, "600w011a", 1, 255, -1, 0, 0, &_test1, 0 },
+ { 7, -1, "600w011b", 1, 255, -1, 0, 0, &_test1, 1 },
+ { 7, -1, "600w011c", 1, 255, -1, 0, 0, &_test1, 2 },
+ { 0, -1, "600w011d", 1, 255, -1, 0, 0, &_test1, 3 },
+ { 0, -1, "600w011e", 1, 255, -1, 0, 0, &_test1, 4 },
+ { 0, -1, "600w011f", 1, 255, -1, 0, 0, &_test1, 5 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY17[] = {
+ { 0, 7, "600w011a", 1, 255, -1, 0, 0, &_test1, 0 },
+ { 0, 7, "600w011b", 1, 255, -1, 0, 0, &_test1, 1 },
+ { 0, 7, "600w011c", 1, 255, -1, 0, 0, &_test1, 2 },
+ { 0, 7, "600w011d", 1, 255, -1, 0, 0, &_test1, 3 },
+ { 0, 7, "600w011e", 1, 255, -1, 0, 0, &_test1, 4 },
+ { 0, 7, "600w011f", 1, 255, -1, 0, 0, &_test1, 5 },
+ { 6, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY18[] = {
+ { 0, 13, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 14, -1, "600_012", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY19[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 7, 24, "612w053", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY20[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 7, -1, "612w054a", 1, 255, -1, 0, 0, &_test2, 0 },
+ { 7, -1, "612w054b", 1, 255, -1, 0, 0, &_test2, 1 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY21[] = {
+ { 0, 6, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 7, 27, "612w054y", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room602::PLAY22[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 18, "612w054y", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 19, -1, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room602::_test1;
+long Room602::_test2;
Room602::Room602() : Section6Room() {
_gerbilTable = GERBIL;
+ _test1 = _test2 = 0;
}
void Room602::init() {
@@ -251,7 +433,162 @@ void Room602::init() {
}
void Room602::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val1) {
+ case 53:
+ player_set_commands_allowed(false);
+ digi_preload("612_001b");
+ _series1 = series_load("612mot01");
+ series_load("612mot02");
+ series_play("602mg03", 1);
+ wilbur_speech("602w004");
+ terminateMachineAndNull(_series8);
+ _val1 = 54;
+ _series8 = series_play("612mot01", 0x600, 0, 1, 0, 8, 100, 0, 0, 0, 7);
+ break;
+
+ case 54:
+ _G(flags)[V249] = 1;
+ digi_play("612_001b", 3, 255, 12, 612);
+ _val1 = 55;
+ wilbur_speech("602w005");
+ _series8 = series_play("612mot01", 0x400, 0, 1, 0, 0, 100, 0, 0, 8, 18);
+ _G(wilbur_should) = 10001;
+ kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 55:
+ _G(flags)[V278] = 0;
+ if (_series1)
+ series_unload(_series1);
+
+ _series8 = series_play("612mot02", 0x600, 0, -1, 0);
+ hotspot_set_active("PAW", true);
+ hotspot_set_active("MOTOR", true);
+ hotspot_set_active("MOTOR ", false);
+ hotspot_set_active("FOOR ", true);
+ break;
+
+ case 56:
+ _G(flags)[V279] = 2;
+ terminateMachineAndNull(_series8);
+ _G(flags)[V278] = 1;
+ _series8 = series_play("612mot02", 0x700, 0, -1, 0, -1, 100, 114, -2);
+
+ hotspot_set_active("PAW", false);
+ hotspot_set_active("MOTOR", false);
+ hotspot_set_active("MOTOR ", true);
+ hotspot_set_active("FLOOR ", false);
+ break;
+
+ case 57:
+ _G(flags)[V279] = 2;
+ _series8 = series_play("612mot03", 0x600, 0, -1, 0);
+ inv_move_object("PANTYHOSE", NOWHERE);
+ _G(flags)[V278] = 0;
+
+ hotspot_set_active("PAW", true);
+ hotspot_set_active("MOTOR", true);
+ hotspot_set_active("MOTOR ", false);
+ hotspot_set_active("FLOOR ", true);
+ break;
+
+ case 58:
+ digi_play_loop("602_004", 3, 255, 6, 602);
+ term_message("*** Play wheel... 1");
+ _G(flags)[V279] = 2;
+ term_message("Run with push.");
+
+ _series8 = series_play("612mot03", 0x600, 0, -1, 0, -1, 100, 114, -2);
+ inv_move_object("PANTYHOSE", 999);
+ _G(flags)[V278] = 1;
+
+ hotspot_set_active("PAW", false);
+ hotspot_set_active("MOTOR", false);
+ hotspot_set_active("MOTOR ", true);
+ hotspot_set_active("FLOOR ", false);
+ break;
+
+ case 59:
+ _G(flags)[V260] = 1;
+ _G(flags)[V279] = 2;
+ _val1 = 60;
+ // TODO
+ if (_G(flags)[V278]) {
+// series_play_with_breaks(PLAY, "612wil7", 0x700, 1, 3, 6, 100, 114, -2);
+
+ } else {
+
+ }
+ break;
+ }
+ break;
+
+ case 3:
+ _G(flags)[V258] = 40;
+ _G(flags)[V256] = 1;
+ _val3 = 63;
+ kernel_trigger_dispatch_now(2);
+ terminateMachineAndNull(_series2);
+
+ _series2 = series_play(_G(game).room_id == 602 ? "602wheel" : "612wheel",
+ 0x5ff, 0, -1, 0);
+ hotspot_set_active("DOOR", false);
+ hotspot_set_active("EXIT", true);
+ break;
+
+ case 5:
+ disable_player_commands_and_fade_init(6009);
+ break;
+
+ case 6:
+ digi_play_loop("602_005", 2, 255, -1, 602);
+ digi_unload("602_004");
+ break;
+
+ case 7:
+ inv_give_to_player("KIBBLE");
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 8:
+ inv_move_object("KIBBLE", NOWHERE);
+ break;
+ case 9:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(10);
+ break;
+
+ case 10:
+ series_show("602spill", 0xf00);
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ case 11:
+ _val3 = 64;
+ _G(flags)[V256] = 3;
+ kernel_timing_trigger(1, 2);
+ break;
+
+ case 12:
+ digi_play_loop("612_001a", 3, 255, -1, 612);
+ break;
+
+ case 13:
+ _G(flags)[V263] = 1;
+ _series2 = series_play(_G(game).room_id == 602 ? "602wi07b" : "612wi07b", 0x6ff);
+ player_set_commands_allowed(true);
+ term_message("Ready to keep running...");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room602::pre_parser() {
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index 06f7def70bc..95534ad4015 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -30,6 +30,29 @@ namespace Rooms {
class Room602 : public Section6Room {
static const GerbilPoint GERBIL[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static const seriesPlayBreak PLAY19[];
+ static const seriesPlayBreak PLAY20[];
+ static const seriesPlayBreak PLAY21[];
+ static const seriesPlayBreak PLAY22[];
+
private:
noWalkRect *_walk1 = nullptr;
int _series1 = 0;
@@ -43,6 +66,8 @@ private:
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
+ static long _test1;
+ static long _test2;
public:
Room602();
Commit: e6f9a45c7f88e62d70b8cfc3d541ef5d4e491ccc
https://github.com/scummvm/scummvm/commit/e6f9a45c7f88e62d70b8cfc3d541ef5d4e491ccc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 602 daemon
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/rooms/section6/section6_room.h
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 7a59ee88d26..c7b580cef4a 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -514,14 +514,33 @@ void Room602::daemon() {
_G(flags)[V260] = 1;
_G(flags)[V279] = 2;
_val1 = 60;
- // TODO
+
if (_G(flags)[V278]) {
-// series_play_with_breaks(PLAY, "612wil7", 0x700, 1, 3, 6, 100, 114, -2);
-
+ series_play_with_breaks(PLAY11, "612wil7", 0x700, 1, 3, 6, 100, 114, -2);
} else {
-
+ series_play_with_breaks(PLAY11, "612wi17", 0x6ff, 1, 3, 6, 100, 0, 0);
}
break;
+
+ case 60:
+ _G(flags)[V280] = 1;
+ kernel_trigger_dispatch_now(3);
+ _val1 = 58;
+ kernel_trigger_dispatch_now(1);
+
+ _G(wilbur_should) = (_G(flags)[V280] == 1) ? 10001 : 35;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 61:
+ _G(flags)[V260] = 1;
+ _G(flags)[V279] = 2;
+ _G(wilbur_should) = 10001;
+ _val1 = 58;
+ break;
+
+ default:
+ break;
}
break;
@@ -585,6 +604,289 @@ void Room602::daemon() {
term_message("Ready to keep running...");
break;
+ case 14:
+ digi_play("602w015", 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ break;
+
+ case 6011:
+ switch (Section6::_state3) {
+ case 49:
+ series_unload(_series4);
+ series_unload(_series5);
+ _G(flags)[V266] = 1;
+ Section6::_state4 = 6;
+ kernel_trigger_dispatch_now(6014);
+ Section6::_state3 = 50;
+ series_play_with_breaks(PLAY12, "602mg02", 0xc00, 6011, 3, 6, 100, 0, 0);
+ break;
+
+ case 50:
+ if (_G(my_walker)) {
+ player_update_info();
+ term_message("Wilbur's position: (%d, %d)", _G(player_info).x, _G(player_info).y);
+
+ if (_G(player_info).x < 511 || _G(player_info).y < 322) {
+ term_message("Wilbur is gonna die");
+ Section6::_state3 = 6005;
+ } else {
+ term_message("Wilbur is safe");
+ Section6::_state3 = 51;
+ }
+ }
+ break;
+
+ case 51:
+ _G(flags)[V266] = 0;
+ _G(flags)[V243] = 6007;
+ _G(flags)[V277] = 6001;
+ _G(flags)[V244] = 6004;
+ _G(flags)[V245] = 10031;
+ player_set_commands_allowed(false);
+ _val1 = 53;
+ kernel_trigger_dispatch_now(6008);
+ break;
+
+
+ case 6002:
+ Section6::_state4 = 4;
+ kernel_trigger_dispatch_now(6014);
+ _sectionMachine1 = series_play("602mg01", 0xc00, 0, 6011, 8, 0, 100, 0, 0, 68, -1);
+ _sectionMachine2 = series_play("602mg01s", 0xc01, 0, -1, 8, 0, 100, 0, 0, 68, -1);
+
+ Section6::_state3 = (_G(flags)[V245] == 10028) ? 49 : 6004;
+ break;
+
+ case 6004:
+ series_unload(_series4);
+ series_unload(_series5);
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(6005);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+ ws_demand_location(-66, 240, 11);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY3, "602wi03", 0xc00, 6003, 3);
+ break;
+
+ case 6:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 30;
+
+ if (_G(game).room_id == 602) {
+ series_play_with_breaks(PLAY4, "602wi05", 0x500, gCHANGE_WILBUR_ANIMATION, 3);
+ } else {
+ series_play_with_breaks(PLAY5, "602wi19", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 7:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 31;
+ series_play_with_breaks(PLAY5, "602wi19", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 8:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 32;
+ series_play_with_breaks(PLAY6, "602wi18", 0x300, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 9:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 33;
+ series_play_with_breaks(PLAY7, "602wi21", 0x900, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 10:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY8, "602wi40", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 12:
+ if (_G(flags)[V262] == 4) {
+ digi_play(Common::String::format("602w017%c", 'a' + imath_ranged_rand(0, 6)).c_str(),
+ 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ } else {
+ digi_play(Common::String::format("602w016%c", 'a' + imath_ranged_rand(0, 3)).c_str(),
+ 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ }
+ break;
+
+ case 13:
+ digi_play("602_006", 2, 255, -1, 602);
+ digi_unload("602_005");
+ player_set_commands_allowed(false);
+ _G(flags)[V263] = 0;
+
+ terminateMachineAndNull(_series2);
+ _G(wilbur_should) = 14;
+
+ if (_G(game).room_id == 602) {
+ series_stream_with_breaks(SERIES2, "602wi07c", 6, 0x380, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ series_stream_with_breaks(SERIES2, "612wi07c", 6, 0x380, gCHANGE_WILBUR_ANIMATION);
+ }
+
+ if (_G(flags)[V262] >= 4)
+ _G(flags)[V262] = 0;
+ else
+ ++_G(flags)[V262];
+ break;
+
+ case 14:
+ digi_unload("602_006");
+ _G(wilbur_should) = 15;
+ _series9 = series_play("602wi7bs", 0x700);
+ break;
+
+ case 15:
+ digi_unload_stream_breaks(SERIES1);
+ digi_unload_stream_breaks(SERIES2);
+ {
+ static const char *NAMES[10] = {
+ "602w017a", "602w017b", "602w017c", "602w017d", "602w017e", "602w017f",
+ "602w016a", "602w016b", "602w016c", "602w016d"
+ };
+ for (int i = 0; i < 10; ++i)
+ digi_unload(NAMES[i]);
+ }
+
+ series_unload(_sectionSeries1);
+ series_unload(_sectionSeries2);
+ series_unload(_sectionSeries3);
+
+ if (_G(game).room_id == 602) {
+ _series2 = series_show("602wheel", 0x6ff, 0, -1, -1, 0);
+ } else {
+ _series2 = series_show("612wheel", 0x6ff, 0, -1, -1, 0);
+ }
+
+ _G(flags)[V260] = 1;
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("602w020");
+ player_set_commands_allowed(true);
+ break;
+
+ case 20:
+ term_message("Slip on kibble!");
+ player_set_commands_allowed(false);
+ player_update_info();
+ _G(wilbur_should) = 21;
+ ws_walk(_G(player_info).x + 1, 304, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 27:
+ player_set_commands_allowed(false);
+ ws_demand_location(314, 319, 3);
+ ws_hide_walker();
+ _G(flags)[V264] = 0;
+
+ intr_remove_no_walk_rect(_walk1);
+ _walk1 = intr_add_no_walk_rect(322, 304, 472, 329, 312, 320);
+ terminateMachineAndNull(_series8);
+
+ if (_G(flags)[V277] == 6003) {
+ digi_preload("602_004");
+ digi_preload("602_005");
+ _val1 = 58;
+ _G(wilbur_should) = 29;
+ series_play_with_breaks(PLAY22, "612wi18", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ } else {
+ _G(wilbur_should) = 28;
+ series_play_with_breaks(PLAY21, "612wi16", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 28:
+ _G(wilbur_should) = 41;
+ _val1 = 56;
+ kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 29:
+ _G(wilbur_should) = 41;
+ _val1 = 58;
+ kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 30:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("602w043");
+ break;
+
+ case 44:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ if (_G(flags)[V279] > 4)
+ wilbur_speech("612w066");
+ break;
+
+ case 6001:
+ Section6::_state3 = 6002;
+ series_play("602mg01", 0xc00, 0, 6011, 8, 0, 100, 0, 0, 0, 67);
+ _sectionMachine2 = series_play("602mg01s", 0xc01, 0, -1, 8, 0, 100, 0, 0, 0, 67);
+ break;
+
+ case 10001:
+ if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1 && _G(flags)[V256] == 0)
+ kernel_trigger_dispatch_now(3);
+
+ _G(kernel).continue_handling_trigger = true;
+ break;
+
+ default:
+ break;
+ }
+
+ case gCALLED_EACH_LOOP:
+ if (_G(player).walker_in_this_scene) {
+ player_update_info();
+
+ if (_G(player_info).x >= (_val2 + 330) &&
+ _G(player_info).y > 289 && _G(player_info).y < 305) {
+ if (_G(flags)[V255] == 1 && _G(flags)[V278] == 0 &&
+ _G(walkTrigger) > 2 && _G(walkTrigger) < 7) {
+ if (_G(flags)[V264]) {
+ _G(flags)[V264] = 1;
+ } else {
+ _G(flags)[V264] = 1;
+ term_message("Wilbur now slips on kibble!");
+ intr_cancel_sentence();
+ _G(wilbur_should) = 20;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ }
+ }
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index 95534ad4015..9f79b20956f 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -63,6 +63,7 @@ private:
int _series6 = 0;
int _series7 = 0;
machine *_series8 = nullptr;
+ machine *_series9 = nullptr;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index 5f92fdcbc9e..b1523064946 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -45,7 +45,7 @@ HotSpotRec *Section6Room::custom_hotspot_which(int32 x, int32 y) {
return &_wilburHotspot;
if (_G(flags)[V243] != 6006 || !_gerbilTable ||
- !verifyMachineExists(_sectionMachine) ||
+ !verifyMachineExists(_sectionMachine1) ||
(_G(game).room_id != 602 && _G(game).room_id != 603 &&
_G(game).room_id != 604))
return nullptr;
@@ -62,7 +62,7 @@ HotSpotRec *Section6Room::custom_hotspot_which(int32 x, int32 y) {
x3 = 439;
y3 = 232;
} else {
- int index = _sectionMachine->myAnim8->myRegs[IDX_CELS_INDEX];
+ int index = _sectionMachine1->myAnim8->myRegs[IDX_CELS_INDEX];
const GerbilPoint *points = _gerbilTable + index;
// TODO: Double check the modulus/divisions are correct
diff --git a/engines/m4/burger/rooms/section6/section6_room.h b/engines/m4/burger/rooms/section6/section6_room.h
index d450cd49075..8047e49e0b3 100644
--- a/engines/m4/burger/rooms/section6/section6_room.h
+++ b/engines/m4/burger/rooms/section6/section6_room.h
@@ -39,7 +39,11 @@ protected:
};
const GerbilPoint *_gerbilTable = nullptr;
HotSpotRec _gerbilHotspot;
- machine *_sectionMachine = nullptr;
+ machine *_sectionMachine1 = nullptr;
+ machine *_sectionMachine2 = nullptr;
+ int32 _sectionSeries1 = 0;
+ int32 _sectionSeries2 = 0;
+ int32 _sectionSeries3 = 0;
public:
Section6Room();
Commit: df258b669e7ece98f7602d450c87910982ec78cd
https://github.com/scummvm/scummvm/commit/df258b669e7ece98f7602d450c87910982ec78cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Move SERIES4 in room 141 back to a static array
Changed paths:
engines/m4/burger/core/stream_break.h
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/core/stream_break.h b/engines/m4/burger/core/stream_break.h
index 0d4d00f11f3..5d3db27b425 100644
--- a/engines/m4/burger/core/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -36,15 +36,8 @@ struct seriesStreamBreak {
int32 volume;
int32 trigger;
uint32 flags;
- const int32 *variable;
+ const long *variable;
int32 value;
-
- seriesStreamBreak() = default;
- seriesStreamBreak(int32 frame_, const char *sound_, int32 channel_,
- int32 volume_, int32 trigger_, uint32 flags_, const int32 *variable_,
- int32 value_) :
- frame(frame_), sound(sound_), channel(channel_), volume(volume_),
- trigger(trigger_), flags(flags_), variable(variable_), value(value_) {}
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 081269faf89..631f319558c 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -121,14 +121,16 @@ static const seriesStreamBreak SERIES3[] = {
STREAM_BREAK_END
};
+static const seriesStreamBreak SERIES4[] = {
+ { 0, "140_002", 2, 255, -1, 0, nullptr, 0 },
+ { 10, nullptr, 2, 255, 13, 0, &Flags::_flags[V112], 0 },
+ { 25, "140_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room141::preload() {
_G(player).walker_in_this_scene = false;
-
- SERIES4.clear();
- SERIES4.push_back(seriesStreamBreak(0, "140_002", 2, 255, -1, 0, 0, 0));
- SERIES4.push_back(seriesStreamBreak(10, nullptr, 2, 255, 13, 0, &_G(flags)[V112], 0));
- SERIES4.push_back(seriesStreamBreak(25, "140_002", 2, 255, -1, 0, 0, 0));
- SERIES4.push_back(seriesStreamBreak(-1, 0, 0, 0, -1, 0, 0, 0));
}
void Room141::init() {
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 203a3de8c3e..9c7d402ee75 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -30,7 +30,6 @@ namespace Rooms {
class Room141 : public Room {
private:
- Common::Array<seriesStreamBreak> SERIES4;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
int _val1 = 0;
Commit: 5ae90e3e081aafb1c8ca0b4c327895b9ab084808
https://github.com/scummvm/scummvm/commit/5ae90e3e081aafb1c8ca0b4c327895b9ab084808
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Put an assert guard on facing array accesses
Changed paths:
engines/m4/adv_r/adv_walk.cpp
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 7ef1ef4e110..eab58ef6208 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -388,7 +388,7 @@ void ws_walk(int32 x, int32 y, GrBuff **buffer, int16 trigger, int32 finalFacing
void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *layer, int32 *facing) {
Anim8 *myAnim8;
- int8 facings[10] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
+ const int8 facings[10] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
if (!myWalker || !myWalker->myAnim8 || !_G(globals)) {
error_show(FL, 'W:-(');
@@ -410,11 +410,17 @@ void ws_get_walker_info(machine *myWalker, int32 *x, int32 *y, int32 *s, int32 *
*layer = myAnim8->myRegs[IDX_LAYER] >> 16;
}
if (facing) {
+ int index;
if (myAnim8->myRegs[IDX_W] < 0) {
- *facing = facings[9 - (myAnim8->myRegs[IDX_CELS_HASH] >> 24)]; // currently walker final facing can be found in 55
+ // Currently walker final facing can be found in 55
+ index = 9 - (myAnim8->myRegs[IDX_CELS_HASH] >> 24);
} else {
- *facing = facings[(myAnim8->myRegs[IDX_CELS_HASH] >> 24)]; // currently walker final facing can be found in 55
+ // Currently walker final facing can be found in 55
+ index = myAnim8->myRegs[IDX_CELS_HASH] >> 24;
}
+
+ assert(index >= 0 && index < 10);
+ *facing = facings[index];
}
}
Commit: 6aec9ee6f312f4ddffedd751fbd08b2c499f0357
https://github.com/scummvm/scummvm/commit/6aec9ee6f312f4ddffedd751fbd08b2c499f0357
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix some gcc warnings
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
engines/m4/burger/gui/gui_cheapo.h
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room103.h
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index fddd4f3d591..3ecaa3b0d90 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -622,7 +622,7 @@ bool Inventory::remove(const Common::String &name) {
return false;
}
-int16 Inventory::inside(int16 x, int16 y) {
+int16 Inventory::inside(int16 x, int16 y) const {
if ((x < _x1) || (x >= (_x2 - 1)) || (y < _y1 + 2) ||
(y > _y1 + _cells_v * _cell_h - 2))
return -1;
diff --git a/engines/m4/burger/gui/gui_cheapo.h b/engines/m4/burger/gui/gui_cheapo.h
index b83568c20ea..f4935940425 100644
--- a/engines/m4/burger/gui/gui_cheapo.h
+++ b/engines/m4/burger/gui/gui_cheapo.h
@@ -206,7 +206,7 @@ public:
void draw(GrBuff *interface_buffer);
- int16 inside(int16 x, int16 y);
+ int16 inside(int16 x, int16 y) const override;
ControlStatus track(int32 eventType, int16 x, int16 y);
bool add(const Common::String &name, const Common::String &verb, int32 cel, int32 cursor);
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 75315a93202..cab618efcfa 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -109,7 +109,7 @@ static const seriesPlayBreak PLAY4[] = {
PLAY_BREAK_END
};
-int32 Room103::_val0 = 0;
+long Room103::_val0 = 0;
void Room103::init() {
_flag1 = false;
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
index dc3010545d0..d4c32ac0edd 100644
--- a/engines/m4/burger/rooms/section1/room103.h
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -34,7 +34,7 @@ class Room103 : public Room {
static const seriesStreamBreak SERIES3[];
static const seriesStreamBreak SERIES4[];
private:
- static int32 _val0;
+ static long _val0;
bool _flag1 = false;
int _val2 = 0;
int _val3 = 0;
Commit: 232ccb6448dfb41816f3ce7e7974aac48bdc996f
https://github.com/scummvm/scummvm/commit/232ccb6448dfb41816f3ce7e7974aac48bdc996f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 602 daemon
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index c7b580cef4a..a11649926d8 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -544,6 +544,80 @@ void Room602::daemon() {
}
break;
+ case 2:
+ switch (_val3) {
+ case 48:
+ _val4 = 17;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 62:
+ _G(flags)[V256] = 1;
+ _G(flags)[V258] = 55;
+ _G(flags)[V257] = 0;
+ _val3 = 63;
+ digi_play("602_004", 2, 255, 6, 602);
+ kernel_timing_trigger(1, 2);
+ _val4 = 16;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 63:
+ if (_G(flags)[V258]) {
+ terminateMachineAndNull(_series3);
+ _series3 = series_show("602door", 0xf00, 0, 2, 6, 0, 100,
+ -_G(flags)[V257] / 21, _G(flags)[V257]);
+ _G(flags)[V257] -= _G(flags)[V258] >> 5;
+ _G(flags)[V256] = 1;
+
+ if (_G(flags)[V257] + 140 >= 20) {
+ _G(flags)[V258] += 3;
+ } else {
+ _G(flags)[V258] -= 32;
+ if (_G(flags)[V258] < 15)
+ _G(flags)[V258] = 0;
+ }
+ } else {
+ _G(flags)[V256] = 2;
+ _val3 = 48;
+ terminateMachineAndNull(_series3);
+ _series3 = series_show("602door", 0xf00, 0, -1, -1, 0, 100,
+ -_G(flags)[V257] / 21, _G(flags)[V257]);
+ }
+
+ _val4 = 16;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 64:
+ if (_G(flags)[V257] > 0) {
+ digi_play("602_007", 2);
+ _G(flags)[V256] = 0;
+ _G(flags)[V257] = 0;
+ _val3 = 48;
+
+ terminateMachineAndNull(_series3);
+ _series3 = series_show("602door", 0xf00, 1);
+
+ } else {
+ _G(flags)[V257] -= _G(flags)[V258] >> 5;
+ _G(flags)[V256] = 3;
+ _G(flags)[V258] -= 40;
+ terminateMachineAndNull(_series3);
+
+ _series3 = series_show("602door", 0xf00, 1, 2, 6, 0, 100,
+ -_G(flags)[V257] / 21, _G(flags)[V257]);
+ }
+
+ _val4 = 17;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case 3:
_G(flags)[V258] = 40;
_G(flags)[V256] = 1;
@@ -557,6 +631,30 @@ void Room602::daemon() {
hotspot_set_active("EXIT", true);
break;
+ case 4:
+ switch (_val4) {
+ case 16:
+ if (!_G(flags)[V265]) {
+ if (_G(game).room_id == 602) {
+ _series10 = series_play("602magnt", 0x600, 1, -1, 1);
+ } else {
+ _series10 = series_play("612magnt", 0x600, 1, -1, 1);
+ }
+ }
+
+ _G(flags)[V265] = 1;
+ break;
+
+ case 17:
+ if (_G(flags)[V265])
+ terminateMachineAndNull(_series10);
+ _G(flags)[V265] = 0;
+ break;
+ default:
+ break;
+ }
+ break;
+
case 5:
disable_player_commands_and_fade_init(6009);
break;
@@ -664,6 +762,7 @@ void Room602::daemon() {
break;
default:
+ _G(kernel).continue_handling_trigger = true;
break;
}
break;
@@ -678,6 +777,35 @@ void Room602::daemon() {
series_play_with_breaks(PLAY3, "602wi03", 0xc00, 6003, 3);
break;
+ case 2:
+ ws_demand_location(283, 338, 7);
+ ws_hide_walker();
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY2, "602wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ _G(flags)[V264] = 0;
+ ws_demand_location(367, 280, 5);
+ ws_hide_walker();
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY1, "602wi02", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+
+ if (_G(visited_room)) {
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 45;
+ ws_turn_to_face(10, gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
case 6:
_G(flags)[V247] = 1;
player_set_commands_allowed(false);
@@ -723,6 +851,57 @@ void Room602::daemon() {
series_play_with_breaks(PLAY8, "602wi40", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
break;
+ case 11:
+ if (_G(flags)[V278] == 0 || _G(flags)[V277] != 6003) {
+ player_set_commands_allowed(false);
+ digi_stop(1);
+
+ if (_G(flags)[V243] == 6006) {
+ Walker::unloadSprites();
+
+ } else {
+ ws_demand_location(431, 343, 10);
+ ws_hide_walker();
+ }
+
+ static const char *NAMES[14] = {
+ "602_004", "602_005", "602_006", "602w015", "602w017a",
+ "602w017b", "602w017c", "602w017d", "602w017e", "602w017f",
+ "602w016a", "602w016b", "602w016c", "602w016d"
+ };
+ for (int i = 0; i < 14; ++i)
+ digi_preload(NAMES[i]);
+
+ _G(flags)[V262] = 0;
+ hotspot_set_active("DOOR", false);
+ hotspot_set_active("EXIT", true);
+
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ terminateMachineAndNull(_series2);
+
+ _sectionSeries2 = series_load("602wi7as");
+ _sectionSeries3 = series_load("602wi7bs");
+ _sectionSeries1 = series_load((_G(game).room_id == 612) ? "612wi07b" : "602wi07b");
+ _G(wilbur_should) = 12;
+
+ if (_G(flags)[V263]) {
+ kernel_trigger_dispatch_now(13);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else {
+ // TODO: This seems like it's incorrect in the original
+ _series9 = series_play("602wi7as", 6, 0x700, -1);
+ _val3 = 62;
+ series_stream_with_breaks(SERIES1,
+ (_G(game).room_id == 602) ? "602wi07a" : "612wi07a",
+ 6, 0x6ff, 13);
+ }
+ } else {
+ wilbur_speech("612w063");
+ }
+ break;
+
case 12:
if (_G(flags)[V262] == 4) {
digi_play(Common::String::format("602w017%c", 'a' + imath_ranged_rand(0, 6)).c_str(),
@@ -789,6 +968,16 @@ void Room602::daemon() {
player_set_commands_allowed(true);
break;
+ case 18:
+ if (inv_player_has("KIBBLE")) {
+ wilbur_speech("602w010");
+ } else {
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY15, "602wi10", 0x500, 7, 3);
+ }
+ break;
+
case 20:
term_message("Slip on kibble!");
player_set_commands_allowed(false);
@@ -797,6 +986,92 @@ void Room602::daemon() {
ws_walk(_G(player_info).x + 1, 304, 0, gCHANGE_WILBUR_ANIMATION, 3);
break;
+ case 21:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ Section6::_savedX = _G(player_info).x - 343;
+
+ _G(wilbur_should) = 46;
+ _test1 = imath_ranged_rand(0, 5);
+ series_play_with_breaks((_G(game).room_id == 602) ? PLAY16 : PLAY17,
+ "602wi13", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX, 0);
+ break;
+
+ case 22:
+ ws_demand_location(423, 303, 9);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ _G(flags)[V255] = 1;
+ _G(kernel).call_daemon_every_loop = true;
+ _G(wilbur_should) = 10001;
+
+ series_play_with_breaks(PLAY18, "602wi20", 0x700, 9, 3);
+ break;
+
+ case 23:
+ _G(flags)[V277] = 6003;
+
+ if (_G(flags)[V278] == 1) {
+ ws_demand_location(339, 348);
+ } else {
+ ws_demand_location(225, 350);
+ }
+
+ ws_demand_facing(2);
+ ws_hide_walker();
+ terminateMachineAndNull(_series8);
+
+ if (_G(flags)[V278]) {
+ _val1 = 59;
+ series_play_with_breaks(PLAY10, "612wi17", 0x700, 1, 3, 6, 100, 114, -2);
+ } else {
+ _G(wilbur_should) = 24;
+ series_play_with_breaks(PLAY9, "612wi17", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 24:
+ _val1 = 57;
+ kernel_trigger_dispatch_now(1);
+
+ if (_G(flags)[V280] == 1) {
+ _G(wilbur_should) = 10001;
+ } else {
+ _G(flags)[V280] = 1;
+ _G(wilbur_should) = 34;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 25:
+ player_set_commands_allowed(false);
+ ++_G(flags)[V279];
+
+ ws_demand_location(200, 321, 3);
+ ws_hide_walker();
+ _G(wilbur_should) = 44;
+
+ series_play_with_breaks(PLAY19, "612wi14", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 26:
+ player_set_commands_allowed(false);
+ ws_demand_facing(3);
+ ws_hide_walker();
+
+ if (_G(flags)[V278]) {
+ _G(wilbur_should) = 10001;
+ _test2 = imath_ranged_rand(0, 1);
+ series_play_with_breaks(PLAY20, "612wi15", 0x600, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 114, 0);
+ } else {
+ _G(wilbur_should) = 40;
+ _test2 = imath_ranged_rand(0, 1);
+ series_play_with_breaks(PLAY20, "612wi15", 0x600, gCHANGE_WILBUR_ANIMATION, 3, 6);
+ }
+ break;
+
case 27:
player_set_commands_allowed(false);
ws_demand_location(314, 319, 3);
@@ -840,6 +1115,88 @@ void Room602::daemon() {
wilbur_speech("602w043");
break;
+ case 31:
+ player_set_commands_allowed(false);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("602w044");
+ break;
+
+ case 32:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("602w045");
+ break;
+
+ case 33:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("602w046");
+ break;
+
+ case 34:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("612w065");
+ break;
+
+ case 35:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("612w065");
+ break;
+
+ case 37:
+ _G(wilbur_should) = 23;
+ player_set_commands_allowed(true);
+ wilbur_speech("612w064");
+ break;
+
+ case 38:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+
+ if (!_G(flags)[V261]) {
+ _G(flags)[V261] = 1;
+ wilbur_speech("602w031", gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 39:
+ _G(wilbur_should) = 27;
+ player_set_commands_allowed(false);
+ wilbur_speech("612w056", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 40:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("612w055");
+ break;
+
+ case 41:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("612w057");
+ break;
+
+ case 42:
+ player_set_commands_allowed(false);
+ ws_unhide_walker();
+ wilbur_speech("602w033");
+ break;
+
+ case 43:
+ wilbur_speech("600w003");
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
case 44:
_G(wilbur_should) = 10001;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
@@ -848,6 +1205,30 @@ void Room602::daemon() {
wilbur_speech("612w066");
break;
+ case 45:
+ _G(wilbur_should) = 10001;
+ wilbur_speech("602w003");
+ break;
+
+ case 46:
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("600w012");
+ break;
+
+ case 47:
+ if (!_G(flags)[V256]) {
+ player_set_commands_allowed(false);
+ ws_demand_location(191, 277, 3);
+ ws_hide_walker();
+ _G(wilbur_should) = 38;
+
+ series_play_with_breaks(_G(flags)[V261] ? PLAY14 : PLAY13,
+ "602wi09", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
case 6001:
Section6::_state3 = 6002;
series_play("602mg01", 0xc00, 0, 6011, 8, 0, 100, 0, 0, 0, 67);
@@ -862,6 +1243,7 @@ void Room602::daemon() {
break;
default:
+ _G(kernel).continue_handling_trigger = true;
break;
}
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index 9f79b20956f..f253e26179f 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -64,9 +64,11 @@ private:
int _series7 = 0;
machine *_series8 = nullptr;
machine *_series9 = nullptr;
+ machine *_series10 = nullptr;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
+ int _val4 = 0;
static long _test1;
static long _test2;
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index a3351ab6e1a..9f61e931b4d 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -38,6 +38,7 @@ int Section6::_state1;
int Section6::_state2;
int Section6::_state3;
int Section6::_state4;
+int Section6::_savedX;
Section6::Section6() : Rooms::Section() {
add(601, &_room601);
@@ -55,6 +56,7 @@ Section6::Section6() : Rooms::Section() {
_state2 = 3;
_state3 = 0;
_state4 = 0;
+ _savedX = 0;
}
void Section6::daemon() {
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index 3a14009db92..28a080415f6 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -62,6 +62,7 @@ public:
static int _state2;
static int _state3;
static int _state4;
+ static int _savedX;
public:
Section6();
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index c5c0ac20c41..a1e756281cf 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -192,6 +192,23 @@ void Walker::reset_walker_sprites() {
kernel_timing_trigger(1, 1026);
}
+void Walker::unloadSprites() {
+ if (_G(player).walker_in_this_scene) {
+ term_message("Unloading Wilbur walker...");
+ player_update_info();
+
+ // Send message for the unload
+ sendWSMessage(0x60000, 0, _G(my_walker), 0, nullptr, 1);
+ _G(player).walker_in_this_scene = false;
+
+ for (int i = 0; i < 7; ++i)
+ series_unload(i);
+
+ // TODO: This seems like it would leak memory
+ _G(my_walker) = nullptr;
+ }
+}
+
void Walker::wilbur_speech(const char *name, int trigger, int room, byte flags, int vol, int channel) {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_name = name;
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index edaf3ea7daf..77551a26b5d 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -72,6 +72,8 @@ public:
machine *walk_initialize_walker() override;
void reset_walker_sprites();
+ static void unloadSprites();
+
void wilbur_speech(const char *name, int trigger = -1, int room = -1, byte flags = 0,
int vol = 256, int channel = 1);
void wilbur_say();
Commit: 720469f7b01dbe28386e1b86e91fb40404c76cf5
https://github.com/scummvm/scummvm/commit/720469f7b01dbe28386e1b86e91fb40404c76cf5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 603 arrays and init
Changed paths:
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room603.h
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 97cc3b1d4da..90166e4f733 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -27,16 +27,233 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room603::preload() {
- _G(player).walker_in_this_scene = false;
+const Section6Room::GerbilPoint Room603::GERBIL[] = {
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 429, 183 },
+ { 429, 185 }, { 429, 185 }, { 436, 200 }, { 436, 200 },
+ { 436, 200 }, { 422, 188 }, { 422, 188 }, { 422, 188 },
+ { 417, 192 }, { 417, 192 }, { 417, 192 }, { 411, 190 },
+ { 411, 190 }, { 411, 190 }, { 411, 190 }, { 411, 190 },
+ { 411, 190 }, { 403, 182 }, { 403, 182 }, { 403, 182 },
+ { 339, 177 }, { 339, 177 }, { 339, 177 }, { 301, 195 },
+ { 301, 195 }, { 301, 195 }, { 295, 199 }, { 439, 189 },
+ { 439, 189 }, { 295, 199 }, { 431, 190 }, { 431, 190 },
+ { 295, 199 }, { 413, 193 }, { 413, 193 }, { 290, 196 },
+ { 403, 202 }, { 403, 202 }, { 293, 195 }, { 392, 203 },
+ { 392, 203 }, { 293, 195 }, { 389, 222 }, { 389, 222 },
+ { 295, 193 }, { 415, 230 }, { 423, 185 }, { 293, 196 },
+ { 428, 235 }, { 415, 185 }, { 293, 196 }, { 430, 233 },
+ { 420, 204 }, { 293, 196 }, { 430, 233 }, { 420, 204 },
+ { 293, 196 }, { 430, 232 }, { 420, 204 }, { 293, 196 },
+ { 438, 233 }, { 411, 199 }, { 293, 196 }, { 441, 235 },
+ { 408, 198 }, { 293, 196 }, { 444, 235 }, { 403, 197 },
+ { 293, 196 }, { 447, 237 }, { 402, 195 }, { 293, 196 },
+ { 450, 238 }, { 399, 194 }, { 293, 196 }, { 452, 237 },
+ { 397, 194 }, { 293, 196 }, { 455, 235 }, { 395, 194 },
+ { 293, 196 }, { 458, 233 }, { 393, 195 }, { 293, 196 },
+ { 461, 233 }, { 392, 195 }, { 293, 196 }, { 461, 233 },
+ { 392, 195 }, { 293, 196 }, { 461, 233 }, { 392, 195 }
+};
+
+static const char *SAID[][4] = {
+ { "WATER DISH", nullptr, "603w004", "603w005" },
+ { "WATER", "603w006", nullptr, nullptr },
+ { "CARROT", "603w008", "603w009", "603w010" },
+ { "TUBE", "603w011", "603w005", nullptr },
+ { "TUBE ", "603w011", "603w005", nullptr },
+ { "TUBE ", "603w012", "603w005", nullptr },
+ { "TUBE ", "603w012", "603w005", nullptr },
+ { "BARS", "603w013", "603w005", "603w005" },
+ { "FLOOR", "603w014", "603w005", "603w005" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room603::PLAY1[] = {
+ { 0, 0, "603_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 1, -1, "603w001", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY2[] = {
+ { 0, 22, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 23, 24, "600_015", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 25, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY3[] = {
+ { 0, 3, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 4, 5, "600w016", 2, 100, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY4[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY5[] = {
+ { 0, 2, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 3, 4, "600w015", 2, 100, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY6[] = {
+ { 0, 2, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 3, 4, "600w015", 2, 100, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY7[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, -1, "603_004", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY8[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, -1, "603_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY9[] = {
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, -1, "600_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
+const seriesPlayBreak Room603::PLAY10[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 7, -1, nullptr, 1, 0, 0, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY11[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 0 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 1 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 2 },
+ { 7, -1, "600w011a", 1, 255, -1, 0, 0, &_state1, 0 },
+ { 7, -1, "600w011b", 1, 255, -1, 0, 0, &_state1, 1 },
+ { 7, -1, "600w011c", 1, 255, -1, 0, 0, &_state1, 2 },
+ { 0, -1, "600w011d", 1, 255, -1, 0, 0, &_state1, 3 },
+ { 0, -1, "600w011e", 1, 255, -1, 0, 0, &_state1, 4 },
+ { 0, -1, "600w011f", 1, 255, -1, 0, 0, &_state1, 5 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY12[] = {
+ { 0, 13, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 14, -1, "600_012", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY13[] = {
+ { 0, 5, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 6, 6, "603w007", 1, 255, -1, 0, 10, nullptr, 0 },
+ { 5, -1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY14[] = {
+ { 0, 24, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 25, -1, nullptr, 1, 255, 0, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room603::PLAY15[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room603::_state1;
+
+Room603::Room603() : Section6Room() {
+ _gerbilTable = GERBIL;
+ _state1 = 0;
}
void Room603::init() {
+ player_set_commands_allowed(false);
+ _G(flags)[V246] = 0;
+ _G(flags)[V264] = 0;
+
+ if (_G(flags)[V269] == 1)
+ series_show("602spill", 0x900, 0, -1, -1, 0, 100, 80, 0);
+ _G(kernel).continue_handling_trigger = _G(flags)[V269] == 1 ? 1 : 0;
+
+ if (_G(flags)[V270] == 6000) {
+ hotspot_set_active("WATER", true);
+ _val1 = 22;
+ _series1 = series_show("603hole", 0xfff);
+ } else {
+ hotspot_set_active("WATER", false);
+ _val1 = 27;
+ kernel_trigger_dispatch_now(0);
+ }
+
+ if (_G(flags)[V245] == 10029) {
+ Section6::_state1 = 6002;
+ kernel_trigger_dispatch_now(6013);
+ }
+
+ if (_G(flags)[V243] == 6000) {
+ Section6::_state4 = 1;
+ kernel_trigger_dispatch_now(6014);
+ }
+ if (_G(flags)[V243] == 6006) {
+ _series2 = series_load("603mg01");
+ Section6::_state3 = 6002;
+ Section6::_state3 = 6001;
+ kernel_timing_trigger(60, 6011);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 602:
+ case 612:
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 604:
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(203, 333);
+ break;
+ }
+
+ if (_G(flags)[V243] == 6006)
+ Section6::_state4 = 5;
+
+ if (_G(flags)[V243] == 6007)
+ Section6::_state4 = 8;
+ else if (_G(flags)[V243] == 6000)
+ Section6::_state4 = 1;
+
+ kernel_trigger_dispatch_now(6014);
}
void Room603::daemon() {
}
+void Room603::pre_parser() {
+
+}
+
+void Room603::parser() {
+
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
index 9611caaf28d..414861a36cf 100644
--- a/engines/m4/burger/rooms/section6/room603.h
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -29,13 +29,38 @@ namespace Burger {
namespace Rooms {
class Room603 : public Section6Room {
+private:
+ static const Section6Room::GerbilPoint GERBIL[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+
+ static long _state1;
+private:
+ machine *_series1 = nullptr;
+ int _series2 = 0;
+ int _val1 = 0;
+
public:
- Room603() : Section6Room() {}
+ Room603();
~Room603() override {}
- void preload() override;
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: 274682a9d515fb47cfc2b03abaa5d76e7c24512e
https://github.com/scummvm/scummvm/commit/274682a9d515fb47cfc2b03abaa5d76e7c24512e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding methods for room 603
Changed paths:
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room603.h
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 90166e4f733..a9b0e21cebc 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -247,11 +247,95 @@ void Room603::daemon() {
}
void Room603::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(flags)[V243] == 6000 && (player_said("TUBE ") || player_said("TUBE "))) {
+ term_message("Can't leave through back tube as gerbils are in the way.");
+ wilbur_speech("600w003");
+ intr_cancel_sentence();
+
+ } else if (player_said("GEAR", "WATER") || player_said("TAKE", "WATER")) {
+ _G(wilbur_should) = 15;
+ player_hotspot_walk_override(272, 271, 2, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("KIBBLE", "FLOOR")) {
+ if (_G(flags)[V269]) {
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = false;
+ wilbur_speech("600w008z");
+ } else {
+ _sectionSeries1 = series_load("602wi20");
+ _series3 = series_load("602wi20s");
+ _G(wilbur_should) = 14;
+ player_hotspot_walk_override(502, 301, 9, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("RAY GUN", "GERBILS")) {
+ _G(wilbur_should) = 10;
+ player_hotspot_walk_override(226, 301, 2, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("WATER DISH") || player_said("WATER")) {
+ if (_G(flags)[V243] == 6006) {
+ wilbur_speech("600w003");
+ intr_cancel_sentence();
+ } else if (player_said("KIBBLE")) {
+ _G(wilbur_should) = 11;
+ player_hotspot_walk_override(261, 274, 2, gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("RAY GUN", "WATER DISH")) {
+ if (_G(flags)[V277] == 6001 && _G(flags)[V270] == 6000)
+ _series4 = series_load("603motor");
+
+ _G(wilbur_should) = 8;
+ player_hotspot_walk_override(180, 329, 2, gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("RAY GUN", "WATER") && _G(flags)[V270] == 6000) {
+ _G(wilbur_should) = 9;
+ player_hotspot_walk_override(350, 282, 10, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
void Room603::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if ((player_said("WATER DISH") || player_said("WATER")) &&
+ player_said("LOOK AT")) {
+ wilbur_speech(_G(flags)[V270] == 6000 ? "603w002" : "603w003");
+
+ } else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
+ _G(flags)[V246] = 1;
+ _G(wilbur_should) = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
+ _G(flags)[V246] = 1;
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
+ _G(flags)[V246] = 1;
+ _G(wilbur_should) = 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
+ _G(flags)[V246] = 1;
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "CARROT")) {
+ wilbur_speech("603w019");
+
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
index 414861a36cf..14ca32284a0 100644
--- a/engines/m4/burger/rooms/section6/room603.h
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -51,6 +51,8 @@ private:
private:
machine *_series1 = nullptr;
int _series2 = 0;
+ int _series3 = 0;
+ int _series4 = 0;
int _val1 = 0;
public:
Commit: 33f00324be18c88e0f922adca0df4db1920fecdf
https://github.com/scummvm/scummvm/commit/33f00324be18c88e0f922adca0df4db1920fecdf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 603 daemon
Changed paths:
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section6/room603.cpp
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 194a0f6450d..d46830bd8dd 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -42,6 +42,7 @@ private:
protected:
static HotSpotRec _wilburHotspot;
+ Series _roomSeries1;
public:
static void setWilburHotspot();
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index a9b0e21cebc..8d8dc655f81 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -244,6 +244,343 @@ void Room603::init() {
}
void Room603::daemon() {
+ switch (_G(kernel).trigger) {
+ case 0:
+ switch (_val1) {
+ case 22:
+ _series1 = series_show("603hole", 0xfff);
+ break;
+
+ case 23:
+ hotspot_set_active("WATER", false);
+ terminateMachineAndNull(_series1);
+ _G(flags)[V270] = 6001;
+
+ if (_G(flags)[V277] == 6001) {
+ _G(wilbur_should) = 20;
+ _val1 = 24;
+ series_play_with_breaks(PLAY14, "603hole", 0xfff, -1, 6);
+ } else {
+ series_play_with_breaks(PLAY15, "603hole", 0xfff, gCHANGE_WILBUR_ANIMATION, 2);
+ }
+
+ _roomSeries1.play("603wi20", 0x400, 2, gCHANGE_WILBUR_ANIMATION, 0, 0, 100, 0, 0, 0, 17);
+ digi_play("603_005", 2, 255, -1, 603);
+ break;
+
+ case 24:
+ _val1 = 27;
+ digi_play("603_007", 2);
+ series_play("603motor", 0xbff, 0, gCHANGE_WILBUR_ANIMATION);
+ series_show("603hole", 0xfff, 0, -1, -1, 41);
+ _G(flags)[V277] = 6002;
+ break;
+
+ case 25:
+ inv_put_thing_in("KIBBLE", 602);
+
+ if (_G(flags)[V270] == 6001) {
+ digi_play("603_009", 2, 255, -1, 603);
+ } else {
+ digi_play("603_008", 2, 255, -1, 603);
+ series_play("603full", 0xc00, 0, -1);
+ }
+ break;
+
+ case 27:
+ _series1 = series_show("603hole", 0xfff, 0, -1, -1, 41);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 1:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(2);
+
+ term_message("Kibble is now being removed.");
+ inv_move_object("KIBBLE", NOWHERE);
+ break;
+
+ case 2:
+ _G(kernel).call_daemon_every_loop = true;
+ series_show("602spill", 0x900, 0, -1, -1, 0, 100, 80, 0);
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 3:
+ term_message("Kibble is now being removed.");
+ inv_move_object("KIBBLE", NOWHERE);
+ break;
+
+ case 6002:
+ _G(game).new_room = 602;
+ break;
+
+ case 6004:
+ _G(game).new_room = 604;
+ break;
+
+ case 6005:
+ _G(game).new_room = 605;
+ break;
+
+ case 6010:
+ _G(game).new_room = 612;
+ break;
+
+ case 6011:
+ switch (Section6::_state3) {
+ case 6001:
+ Section6::_state3 = 6002;
+ _sectionMachine1 = series_play("603mg01", 0xdff, 0, 6011, 8, 0, 100, 0, 0, 0, 84);
+ _sectionMachine2 = series_play("603mg01s", 0xe00, 0, -1, 8, 0, 100, 0, 0, 0, 84);
+ break;
+
+ case 6002:
+ Section6::_state4 = 4;
+ kernel_trigger_dispatch_now(6014);
+ Section6::_state3 = 6003;
+
+ _sectionMachine1 = series_play("603mg01", 0xdff, 0, 6011, 8, 0, 100, 0, 0, 85, -1);
+ _sectionMachine2 = series_play("603mg01s", 0xe00, 0, -1, 8, 0, 100, 0, 0, 85, -1);
+ break;
+
+ case 6003:
+ Section6::_state3 = (_G(flags)[V245] == 10029) ? 6005 : 6004;
+ series_play("603mg01", 0xdff, 0, -1, -1, 95);
+ _sectionMachine2 = series_play("603mg01s", 0xe00, 0, -1, -1, 95);
+ kernel_trigger_dispatch_now(6011);
+ break;
+
+ case 6004:
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V246] == 0)
+ kernel_trigger_dispatch_now(6005);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 2:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_demand_location(215, 311, 3);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY1, "603wi02", 0x7ff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_demand_location(400, 280, 7);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY2, "603wi06", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ term_message("Climbing up to 604...");
+ ws_demand_facing(10);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ Section6::_state2 = 0;
+
+ series_play_with_breaks(PLAY3, "603wi03", 0xdff, 6004, 3);
+ break;
+
+ case 5:
+ term_message("Climbing down to 602...");
+ player_set_commands_allowed(false);
+ ws_demand_facing(8);
+ ws_hide_walker();
+ Section6::_state2 = 1;
+
+ if (_G(flags)[V243] == 6007) {
+ series_play_with_breaks(PLAY4, "603wi01", 0xdff, 6010, 3);
+ } else {
+ series_play_with_breaks(PLAY4, "603wi01", 0xdff, 6002, 3);
+ }
+ break;
+
+ case 6:
+ term_message("Climbing up to 604...");
+ ws_demand_facing(1);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ Section6::_state2 = 2;
+
+ series_play_with_breaks(PLAY5, "603wi04", 0xdff, 6004, 3);
+ break;
+
+ case 7:
+ ws_demand_facing(1);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ Section6::_state2 = 2;
+ if (_G(flags)[V243] == 6007) {
+ series_play_with_breaks(PLAY6, "603wi05", 0xdff, 6010, 3);
+ } else {
+ series_play_with_breaks(PLAY6, "603wi05", 0xdff, 6002, 3);
+ }
+ break;
+
+ case 8:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V270] == 6000) {
+ _val1 = 23;
+ ws_hide_walker();
+ series_play_with_breaks(PLAY7, "603wi20", 0x400, 0, 3);
+ } else {
+ wilbur_speech("603w017");
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 9:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 17;
+ series_play_with_breaks(PLAY8, "603wi10", 0x900, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 10:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY9, "603wi40", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 11:
+ player_set_commands_allowed(false);
+ ws_demand_facing(2);
+ ws_hide_walker();
+ _G(wilbur_should) = 19;
+ _val1 = 25;
+ series_play_with_breaks(PLAY10, "603wi08", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 12:
+ term_message("Skip on kibble!");
+ player_set_commands_allowed(false);
+ player_update_info();
+ _G(wilbur_should) = 13;
+
+ ws_walk(_G(player_info).x + 1, 305, nullptr, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 13:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 18;
+ Section6::_savedX = _G(player_info).x - 425;
+ _state1 = imath_ranged_rand(0, 5);
+
+ series_play_with_breaks(PLAY11, "602wi13", _G(player_info).depth,
+ gCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX + 80, 0);
+ break;
+
+ case 14:
+ ws_demand_location(502, 301, 9);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(flags)[V269] = 1;
+
+ series_play_with_breaks(PLAY12, "602wi20", 0x901, 1, 3, 6, 100, 80, 0);
+ break;
+
+ case 15:
+ if (_G(flags)[V243] != 6006) {
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_demand_facing(2);
+ ws_hide_walker();
+
+ series_play_with_breaks(PLAY13, "603wi07", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 16:
+ _G(wilbur_should) = 10001;
+
+ if (_G(flags)[V243] == 6007) {
+ wilbur_speech(_G(flags)[V279] ? "603w016" : "603w015");
+ } else {
+ kernel_trigger_dispatch_now(0);
+ wilbur_speech("603w021");
+ }
+ break;
+
+ case 17:
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("603w018");
+ break;
+
+ case 18:
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("600w012");
+ break;
+
+ case 19:
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+
+ if (_G(flags)[V270] == 6000)
+ wilbur_speech("603w020");
+ break;
+
+ case 20:
+ ws_unhide_walker();
+ _G(wilbur_should) = 16;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case gCALLED_EACH_LOOP:
+ player_update_info();
+
+ if (_G(player_info).x > 420 && _G(player_info).x < 490 &&
+ _G(player_info).y > 284 && _G(player_info).y < 305 &&
+ _G(walkTrigger) > 2 && _G(walkTrigger) < 7 &&
+ _G(flags)[V269] == 1) {
+ if (_G(flags)[V264]) {
+ _G(flags)[V264] = 1;
+ } else {
+ term_message("Wilbur now slips on kibble!");
+ intr_cancel_sentence();
+ _G(wilbur_should) = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else {
+ _G(flags)[V264] = 0;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room603::pre_parser() {
Commit: 9a8c59e4c8c3c161e1cb0179d49804389e66325a
https://github.com/scummvm/scummvm/commit/9a8c59e4c8c3c161e1cb0179d49804389e66325a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 605
Changed paths:
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room605.cpp
engines/m4/burger/rooms/section6/room605.h
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 8d8dc655f81..548b78474f5 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -367,6 +367,7 @@ void Room603::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
case gCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
diff --git a/engines/m4/burger/rooms/section6/room605.cpp b/engines/m4/burger/rooms/section6/room605.cpp
index 9a78d4b78e7..b7463343f3e 100644
--- a/engines/m4/burger/rooms/section6/room605.cpp
+++ b/engines/m4/burger/rooms/section6/room605.cpp
@@ -27,14 +27,50 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesStreamBreak SERIES1[] = {
+ { 0, "605x001", 1, 255, -1, 0, nullptr, 0 },
+ { 1, "605_002", 3, 155, -1, 0, nullptr, 0 },
+ { 31, "605_001", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+static const seriesStreamBreak SERIES2[] = {
+ { 0, "605x001", 1, 255, -1, 0, nullptr, 0 },
+ { 1, "605_002", 3, 155, -1, 0, nullptr, 0 },
+ { 31, "605_001", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room605::preload() {
_G(player).walker_in_this_scene = false;
}
void Room605::init() {
+ kernel_trigger_dispatch_now(1);
}
void Room605::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ if (player_been_here(605)) {
+ digi_preload_stream_breaks(SERIES2);
+ _val1 = imath_ranged_rand(0, 4);
+ series_stream_with_breaks(SERIES2, "605radar", 6, 1, 6007);
+ } else {
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "605radar", 6, 1, 6007);
+ }
+ break;
+
+ case 6007:
+ _G(game).new_room = 608;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room605.h b/engines/m4/burger/rooms/section6/room605.h
index f817dc7569a..0ef2d4162af 100644
--- a/engines/m4/burger/rooms/section6/room605.h
+++ b/engines/m4/burger/rooms/section6/room605.h
@@ -29,6 +29,9 @@ namespace Burger {
namespace Rooms {
class Room605 : public Section6Room {
+private:
+ int _val1 = 0;
+
public:
Room605() : Section6Room() {}
~Room605() override {}
Commit: 10df93ab8082f949a312a941e210e1d3e09a2cf9
https://github.com/scummvm/scummvm/commit/10df93ab8082f949a312a941e210e1d3e09a2cf9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 604 methods
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room603.h
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room604.h
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section6/section6.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 3cb42da0181..03629d40e8c 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -276,7 +276,7 @@ enum {
V239 = 239,
V240 = 240,
ROOM101_FLAG4 = 241,
- ROOM101_FLAG5 = 242,
+ V242 = 242,
V243 = 243,
V244 = 244,
V245 = 245,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index b09ad84de6b..decf2262b32 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -258,7 +258,7 @@ void Room101::daemon() {
_G(walker).wilbur_speech(NAMES[idx], 23);
} else if (!_G(flags)[ROOM101_FLAG4]) {
- if (_G(flags)[ROOM101_FLAG5] <= 1) {
+ if (_G(flags)[V242] <= 1) {
_G(walker).wilbur_speech("101w520", 7);
} else if (_G(flags)[V249] && !_G(flags)[ROOM101_FLAG7]) {
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 548b78474f5..b25a95b5d7b 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -603,7 +603,7 @@ void Room603::pre_parser() {
wilbur_speech("600w008z");
} else {
_sectionSeries1 = series_load("602wi20");
- _series3 = series_load("602wi20s");
+ Section6::_series603 = series_load("602wi20s");
_G(wilbur_should) = 14;
player_hotspot_walk_override(502, 301, 9, gCHANGE_WILBUR_ANIMATION);
}
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
index 14ca32284a0..8e686c45ef6 100644
--- a/engines/m4/burger/rooms/section6/room603.h
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -51,7 +51,6 @@ private:
private:
machine *_series1 = nullptr;
int _series2 = 0;
- int _series3 = 0;
int _series4 = 0;
int _val1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 86e60d039ae..b55018e2088 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -27,16 +27,168 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room604::preload() {
- _G(player).walker_in_this_scene = false;
-}
+static const char *SAID[][4] = {
+ { "WOOD SHAVINGS", nullptr, "604w010", nullptr },
+ { "ASHES", "604w015", "604w016", "604w016" },
+ { "APPLE CORE", "604w017", "604w018", "604w019" },
+ { "BOTTLE CAP", "604w020", "604w021", "604w010" },
+ { "TUBE", "604w022", "604w023", nullptr },
+ { "TUBE ", "604w024", "604w023", nullptr },
+ { "BARS", "604w025", "604w023", "604w023" },
+ { "FLOOR", "604w026", "604w023", "604w023" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
void Room604::init() {
+ player_set_commands_allowed(false);
+ _G(flags)[V246] = 0;
+
+ if (_G(flags)[V274]) {
+ hotspot_set_active("WOOD SHAVINGS", false);
+ hotspot_set_active("ASHES", true);
+ _val1 = 27;
+ kernel_trigger_dispatch_now(6012);
+
+ } else {
+ hotspot_set_active("WOOD SHAVINGS", true);
+ hotspot_set_active("ASHES", false);
+
+ if (_G(game).previous_room != 601) {
+ _val1 = 25;
+ kernel_trigger_dispatch_now(6012);
+ }
+ }
+
+ _G(flags)[V264] = 0;
+
+ if (_G(flags)[V273] == 1) {
+ series_show("602spill", 0x900);
+ _G(kernel).call_daemon_every_loop = true;
+ }
+
+ if (_G(flags)[V245] == 10030) {
+ Section6::_state1 = 6002;
+ kernel_trigger_dispatch_now(6013);
+ }
+
+ if (_G(flags)[V243] == 6006) {
+ _G(wilbur_should) = 18;
+ Section6::_state3 = 6004;
+ series_stream("604mg06", 4, 0xc00, 6011);
+ series_play("604mg06s", 4, 0xc80);
+ player_set_commands_allowed(false);
+ }
+
+ switch (_G(flags)[V243]) {
+ case 6000:
+ Section6::_state4 = 0;
+ break;
+ case 6006:
+ Section6::_state4 = 5;
+ break;
+ case 6007:
+ Section6::_state4 = 7;
+ break;
+ default:
+ break;
+ }
+
+ kernel_trigger_dispatch_now(6014);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 601:
+ _sectionSeries1 = series_load("604wi04");
+ Section6::_series603 = series_load("604wi04s");
+ _G(wilbur_should) = 1;
+
+ ws_demand_location(328, 317, 2);
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V242]) {
+ _roomSeries1.show("604wi04", 1);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ kernel_trigger_dispatch_now(0);
+ }
+ break;
+
+ case 602:
+ case 603:
+ case 612:
+ if (Section6::_state2) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ default:
+ _sectionSeries1 = series_load("604wi04");
+ Section6::_series603 = series_load("604wi04s");
+
+ ws_demand_location(328, 317, 2);
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ _roomSeries1.show("604wi04", 1);
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
}
void Room604::daemon() {
}
+void Room604::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(flags)[V243] == 6006 && player_said("TUBE ")) {
+ intr_cancel_sentence();
+ wilbur_speech("600w003");
+
+ } else if (player_said("RAY GUN", "WOOD SHAVINGS")) {
+ _G(player).command_ready = false;
+
+ if (_G(flags)[V274] == 0) {
+ _G(wilbur_should) = 17;
+ player_hotspot_walk_override(353, 313, 10, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("WOOD SHAVINGS", "KIBBLE")) {
+ _G(wilbur_should) = 10;
+ player_hotspot_walk_override(308, 301, 10, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("RAY GUN", "GERBILS")) {
+ _G(wilbur_should) = 8;
+ player_hotspot_walk_override(286, 297, 10, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("KIBBLE", "FLOOR")) {
+ if (_G(flags)[V273]) {
+ _G(player).need_to_walk = false;
+ _G(player).need_to_walk = false;
+ wilbur_speech("600w008z");
+ } else {
+ _G(wilbur_should) = 16;
+ player_hotspot_walk_override(425, 303, 9, gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ }
+
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room604::parser() {
+
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
index cd44e6c7f63..9f8849b70ee 100644
--- a/engines/m4/burger/rooms/section6/room604.h
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -29,13 +29,17 @@ namespace Burger {
namespace Rooms {
class Room604 : public Section6Room {
+private:
+ int _val1 = 0;
+
public:
Room604() : Section6Room() {}
~Room604() override {}
- void preload() override;
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 9f61e931b4d..528c24586f8 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -39,6 +39,7 @@ int Section6::_state2;
int Section6::_state3;
int Section6::_state4;
int Section6::_savedX;
+int Section6::_series603;
Section6::Section6() : Rooms::Section() {
add(601, &_room601);
@@ -57,6 +58,7 @@ Section6::Section6() : Rooms::Section() {
_state3 = 0;
_state4 = 0;
_savedX = 0;
+ _series603 = 0;
}
void Section6::daemon() {
diff --git a/engines/m4/burger/rooms/section6/section6.h b/engines/m4/burger/rooms/section6/section6.h
index 28a080415f6..1d285e4da85 100644
--- a/engines/m4/burger/rooms/section6/section6.h
+++ b/engines/m4/burger/rooms/section6/section6.h
@@ -63,6 +63,7 @@ public:
static int _state3;
static int _state4;
static int _savedX;
+ static int _series603;
public:
Section6();
Commit: 6224e061aca2b1c1b256df0f3c5e9c2e7bf20d4c
https://github.com/scummvm/scummvm/commit/6224e061aca2b1c1b256df0f3c5e9c2e7bf20d4c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 604 parser and arrays
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room604.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 03629d40e8c..2d45d8e5e92 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -282,7 +282,7 @@ enum {
V245 = 245,
V246 = 246,
V247 = 247,
- ROOM101_FLAG8 = 248,
+ V248 = 248,
V249 = 249,
V250 = 250,
V251 = 251,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index decf2262b32..a6aab77aa7a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -265,7 +265,7 @@ void Room101::daemon() {
_G(walker).wilbur_speech("101w522", 7);
_G(flags)[ROOM101_FLAG7] = 1;
- } else if (_G(flags)[ROOM101_FLAG8] && !_G(flags)[ROOM101_FLAG9]) {
+ } else if (_G(flags)[V248] && !_G(flags)[ROOM101_FLAG9]) {
_G(walker).wilbur_speech("101w521", 7);
_G(flags)[ROOM101_FLAG9] = 1;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index a11649926d8..a4c5d5833cf 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -415,7 +415,7 @@ void Room602::init() {
_G(flags)[V243] = 6007;
_G(flags)[V244] = 6004;
_G(flags)[V245] = 10031;
- _G(flags)[ROOM101_FLAG8] = 1;
+ _G(flags)[V248] = 1;
_val1 = 53;
kernel_trigger_dispatch_now(1);
}
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index b55018e2088..cecb1f1a471 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -39,6 +39,119 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+static const seriesStreamBreak SERIES1[] = {
+ { 4, "604I001", 1, 255, -1, 0, nullptr, 0 },
+ { 29, "604Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 36, "604I002", 1, 255, -1, 0, nullptr, 0 },
+ { 45, "604Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 70, "604Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 106, "604I003", 1, 255, -1, 0, nullptr, 0 },
+ { 132, "604Z004A", 1, 255, -1, 0, nullptr, 0 },
+ { 208, "604Z004B", 1, 255, -1, 0, nullptr, 0 },
+ { 245, "604Z004C", 1, 255, -1, 0, nullptr, 0 },
+ { 324, "604I004", 1, 255, -1, 0, nullptr, 0 },
+ { 344, "604Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 374, "604Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 409, "604I005", 1, 255, -1, 0, nullptr, 0 },
+ { 459, "604Z007", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY1[] = {
+ { 0, -1, "604_007", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY2[] = {
+ { 0, 2, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 3, 4, "600w016", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY3[] = {
+ { 0, 2, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 3, 4, "600w015", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY4[] = {
+ { 0, 19, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 20, 21, "600_015", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 22, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY5[] = {
+ { 0, 22, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 23, -1, "600_015", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY6[] = {
+ { 0, 5, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 6, -1, "604_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY7[] = {
+ { 0, 5, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 6, -1, "604_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY8[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 0 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 1 },
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, &_state1, 2 },
+ { 7, -1, "600w011a", 1, 255, -1, 0, 0, &_state1, 0 },
+ { 7, -1, "600w011b", 1, 255, -1, 0, 0, &_state1, 1 },
+ { 7, -1, "600w011c", 1, 255, -1, 0, 0, &_state1, 2 },
+ { 0, -1, "600w011d", 1, 255, -1, 0, 0, &_state1, 3 },
+ { 0, -1, "600w011e", 1, 255, -1, 0, 0, &_state1, 4 },
+ { 0, -1, "600w011f", 1, 255, -1, 0, 0, &_state1, 5 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY9[] = {
+ { 0, 13, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 14, -1, "600_012", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY10[] = {
+ { 0, 3, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 4, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 23, "604_008", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 4, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 23, "604_008", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 4, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 23, "604_008", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 24, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY11[] = {
+ { 0, 7, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 8, 17, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ { 18, -1, nullptr, 1, 0, 10016, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room604::PLAY12[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, -1, "600_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room604::_state1;
+
+Room604::Room604() : Section6Room() {
+ _state1 = 0;
+}
+
void Room604::init() {
player_set_commands_allowed(false);
_G(flags)[V246] = 0;
@@ -186,7 +299,22 @@ void Room604::pre_parser() {
}
void Room604::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("GEAR", "WOOD SHAVINGS")) {
+ player_set_commands_allowed(false);
+ if (_G(flags)[V243] == 6000) {
+ _G(wilbur_should) = 9;
+ wilbur_speech(_G(flags)[V248] ? "604w013" : "604w011");
+
+ } else {
+ _G(wilbur_should) = 13;
+ wilbur_speech("604w005");
+ }
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
index 9f8849b70ee..bf3fa121f33 100644
--- a/engines/m4/burger/rooms/section6/room604.h
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -30,10 +30,24 @@ namespace Rooms {
class Room604 : public Section6Room {
private:
- int _val1 = 0;
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static long _state1;
+private:
+ int _val1 = 0;
public:
- Room604() : Section6Room() {}
+ Room604();
~Room604() override {}
void init() override;
Commit: 410093543d53161a3f43ad7a8dc58ee499bb8188
https://github.com/scummvm/scummvm/commit/410093543d53161a3f43ad7a8dc58ee499bb8188
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 604 daemon
Changed paths:
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room604.h
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index cecb1f1a471..66c54a4e214 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -257,6 +257,408 @@ void Room604::init() {
}
void Room604::daemon() {
+ switch (_G(kernel).trigger) {
+ case 0:
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "604intro", 6, 1, 1);
+ break;
+
+ case 1:
+ digi_unload_stream_breaks(SERIES1);
+ _roomSeries1.show("604wi04", 1);
+ _val1 = 25;
+ kernel_trigger_dispatch_now(6012);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 2:
+ term_message("Kibble is now being removed.");
+ inv_move_object("KIBBLE", NOWHERE);
+ break;
+
+ case 3:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 4:
+ series_show("602spill", 0x900);
+ _G(kernel).call_daemon_every_loop = true;
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 6:
+ _G(game).new_room = 603;
+ break;
+
+ case 7:
+ _G(game).new_room = 602;
+ break;
+
+ case 9:
+ _G(game).new_room = 612;
+ break;
+
+ case 6002:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 7);
+ break;
+
+ case 6003:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 8);
+ break;
+
+ case 6010:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 9);
+ break;
+
+ case 6011:
+ switch (Section6::_state3) {
+ case 22:
+ break;
+
+ case 23:
+ _G(flags)[V243] = 6006;
+ _sectionMachine1 = series_play("604mg04", 0xcff, 0, 6011, 8, 0, 100, 0, 0, 0, 50);
+ _sectionMachine2 = series_play("604mg04s", 0xd00, 0, -1, 8, 0, 100, 0, 0, 0, 50);
+ Section6::_state4 = 3;
+ kernel_trigger_dispatch_now(6014);
+ Section6::_state3 = 24;
+ break;
+
+ case 24:
+ Section6::_state3 = 6003;
+ Section6::_state4 = 4;
+ kernel_trigger_dispatch_now(6014);
+ _sectionMachine1 = series_play("604mg04", 0xcff, 0, 6011, 8, 0, 100, 0, 0, 51, -1);
+ _sectionMachine2 = series_play("604mg04s", 0xd00, 0, -1, 8, 0, 100, 0, 0, 51, -1);
+ break;
+
+ case 6003:
+ Section6::_state3 = _G(flags)[V245] == 10030 ? 6005 : 6004;
+ _sectionMachine1 = series_show("604mg04", 0xcff, 0, -1, -1, 83, 100, 0, 0);
+ _sectionMachine2 = series_show("604mg04s", 0xd00, 0, -1, -1, 83, 100, 0, 0);
+ break;
+
+ case 6004:
+ if (!_G(flags)[V246])
+ _G(game).new_room = 605;
+ break;
+
+ case 6005:
+ kernel_trigger_dispatch_now(6006);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 6012:
+ switch (_val1) {
+ case 25:
+ _series1 = series_show("604chips", 0xcc0);
+ break;
+
+ case 26:
+ _val1 = 28;
+ hotspot_set_active("WOOD SHAVINGS", false);
+ hotspot_set_active("ASHES", true);
+
+ terminateMachineAndNull(_series1);
+ _series1 = series_play("604chips", 0xb00, 0, 6012);
+ break;
+
+ case 27:
+ _series1 = series_show("604chips", 0xcc0);
+ break;
+
+ case 28:
+ _val1 = 27;
+ series_unload(_series2);
+ kernel_trigger_dispatch_now(6012);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10008:
+ if (_G(flags)[V243] == 6000) {
+ _G(flags)[V002] = 1;
+ _G(flags)[V243] = 6006;
+ _G(flags)[V248] = 1;
+ Section6::_state3 = 23;
+ kernel_trigger_dispatch_now(6011);
+ _G(wilbur_should) = 10001;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _G(wilbur_should) = 2;
+ digi_play("604_006", 2, 155, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 2:
+ _roomSeries1.terminate();
+ inv_give_to_player("RAY GUN");
+ series_play_with_breaks(PLAY1, "604wi04", 1, gCHANGE_WILBUR_ANIMATION, 3);
+ _G(wilbur_should) = 3;
+ break;
+
+ case 3:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+
+ switch (_G(flags)[V242]) {
+ case 0:
+ wilbur_speech("604w001");
+ break;
+ case 1:
+ wilbur_speech("604w002");
+ break;
+ case 2:
+ wilbur_speech("604w003");
+ break;
+ case 3:
+ wilbur_speech("604w004");
+ break;
+ default:
+ wilbur_speech("604w005");
+ break;
+ }
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ ws_demand_facing(3);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY2, "604wi06", 0x4ff, 6003, 3);
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ ws_demand_facing(7);
+ ws_hide_walker();
+
+ if (_G(flags)[V243] == 6007) {
+ series_play_with_breaks(PLAY3, "604wi07", 0xc80, 6010, 3);
+ } else {
+ series_play_with_breaks(PLAY3, "604wi07", 0xc80, 6002, 3);
+ }
+
+ _G(flags)[V246] = 1;
+ break;
+
+ case 6:
+ ws_demand_location(171, 310, 3);
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V243] == 6006) {
+ Section6::_state4 = 5;
+ kernel_trigger_dispatch_now(6014);
+ Section6::_state3 = 6004;
+ series_stream("604mg06", 4, 0xc80, 6011);
+ series_play("604mg06s", 4, 0xc80, 0, -1);
+ series_play_with_breaks(PLAY4, "604wi08", 0x4ff, gCHANGE_WILBUR_ANIMATION, 3);
+ } else {
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY4, "604wi08", 0x4ff, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 7:
+ _G(wilbur_should) = 10001;
+ ws_demand_location(337, 279, 7);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY5, "604wi09", 0xc80, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 8:
+ _G(flags)[V247] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY12, "604wi40", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 9:
+ ws_hide_walker();
+ _G(wilbur_should) = 20;
+ series_play_with_breaks(PLAY6, "604wi10", 0xcc0, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 10:
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY10, "604wi11", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+
+ if (_G(flags)[V274] == 0 && _G(flags)[V243] == 600) {
+ _G(flags)[V243] = 6006;
+ _G(flags)[V248] = 1;
+ term_message("The gerbils awaken");
+ Section6::_state3 = 23;
+ kernel_trigger_dispatch_now(6011);
+ }
+ break;
+
+ case 11:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ _G(flags)[V247] = 1;
+ _G(flags)[V274] = 1;
+ _series2 = series_load("604chips");
+ _G(wilbur_should) = 12;
+
+ series_play_with_breaks(PLAY11, "604wi12", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 12:
+ if (_G(flags)[V243] == 6000) {
+ _G(flags)[V243] = 6006;
+ Section6::_state3 = 23;
+ kernel_trigger_dispatch_now(6011);
+ }
+
+ _G(wilbur_should) = 10001;
+ _val1 = 26;
+ kernel_trigger_dispatch_now(6012);
+ break;
+
+ case 13:
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY7, "604wi10", 0xcc0, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 14:
+ term_message("Slip on kibble!");
+ player_set_commands_allowed(false);
+ player_update_info();
+ _G(wilbur_should) = 15;
+
+ ws_walk(_G(player_info).x + 1, 316, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 15:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 19;
+ Section6::_savedX = _G(player_info).x - 358;
+ Section6::_state1 = imath_ranged_rand(0, 5);
+
+ series_play_with_breaks(PLAY8, "604wi31", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION,
+ 3, 6, 100, Section6::_savedX, 0);
+ break;
+
+ case 16:
+ ws_demand_location(425, 303, 9);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(flags)[V273] = 1;
+ _G(kernel).call_daemon_every_loop = true;
+
+ series_play_with_breaks(PLAY9, "604wi30", 0x901, 3, 3);
+ break;
+
+ case 17:
+ if (_G(flags)[V243] == 6000) {
+ if (_G(flags)[V248]) {
+ _G(wilbur_should) = 11;
+ player_set_commands_allowed(false);
+ wilbur_speech("604w028");
+ } else {
+ _G(wilbur_should) = 10001;
+ wilbur_speech("604w027");
+ }
+ } else {
+ _G(wilbur_should) = 11;
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 18:
+ ws_unhide_walker();
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 21;
+ wilbur_speech("604w006");
+ break;
+
+ case 19:
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ wilbur_speech("600w012");
+ break;
+
+ case 20:
+ Section6::_state3 = 23;
+ kernel_trigger_dispatch_now(6011);
+ ws_unhide_walker();
+
+ if (_G(flags)[V248]) {
+ digi_preload("604w014");
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+ wilbur_speech("604w014", gCHANGE_WILBUR_ANIMATION);
+ } else {
+ digi_preload("604w012");
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 10001;
+ _G(flags)[V248] = 1;
+ wilbur_speech("604w012", gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 21:
+ player_set_commands_allowed(false);
+ ws_unhide_walker();
+ break;
+
+ case 10003:
+ if (_G(flags)[V243] == 6000) {
+ series_load("604mg04");
+ series_load("604mg04s");
+ }
+
+ _G(kernel).continue_handling_trigger = true;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ case gCALLED_EACH_LOOP:
+ player_update_info();
+ if (_G(player_info).x > 319 && _G(player_info).x < 413 &&
+ _G(player_info).y > 280 && _G(player_info).y < 305 &&
+ _G(walkTrigger) > 2 && _G(walkTrigger) < 7 &&
+ _G(flags)[V273] == 1) {
+ if (_G(flags)[V264]) {
+ _G(flags)[V264] = 1;
+ } else {
+ _G(flags)[V264] = 1;
+ intr_cancel_sentence();
+ _G(wilbur_should) = 14;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else {
+ _G(flags)[V264] = 0;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room604::pre_parser() {
@@ -300,6 +702,7 @@ void Room604::pre_parser() {
void Room604::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
+ bool rayGun = player_said("RAY GUN");
if (_G(walker).wilbur_said(SAID)) {
// Already handled
@@ -314,7 +717,37 @@ void Room604::parser() {
_G(wilbur_should) = 13;
wilbur_speech("604w005");
}
+ } else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
+ _G(flags)[V246] = 1;
+ Section6::_state2 = 2;
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
+ _G(flags)[V246] = 1;
+ Section6::_state2 = 0;
+ _G(wilbur_should) = 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+
+ } else if (rayGun && player_said("APPLE CORE")) {
+ wilbur_speech("604w029");
+ } else if (rayGun && player_said("ASHES")) {
+ wilbur_speech("600w004");
+ } else if (rayGun && player_said("BOTTLE CAP")) {
+ wilbur_speech("600w004");
+ } else if (player_said("LOOK AT", "WOOD SHAVINGS")) {
+ if (_G(flags)[V248] == 0) {
+ wilbur_speech("604w007");
+ } else if (_G(flags)[V243] == 6000) {
+ wilbur_speech("604w008");
+ } else {
+ wilbur_speech("604w005");
+ }
+ } else {
+ return;
}
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
index bf3fa121f33..c0d939ec795 100644
--- a/engines/m4/burger/rooms/section6/room604.h
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -45,6 +45,8 @@ private:
static long _state1;
private:
+ machine *_series1 = nullptr;
+ int32 _series2 = 0;
int _val1 = 0;
public:
Room604();
Commit: b033e117f8b936c85f7c90c866b27af2c4cf4f05
https://github.com/scummvm/scummvm/commit/b033e117f8b936c85f7c90c866b27af2c4cf4f05
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added remaining rooms of section 6
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section6/room606.cpp
engines/m4/burger/rooms/section6/room606.h
engines/m4/burger/rooms/section6/room608.cpp
engines/m4/burger/rooms/section6/room608.h
engines/m4/burger/rooms/section6/room609.cpp
engines/m4/burger/rooms/section6/room609.h
engines/m4/burger/rooms/section6/room610.cpp
engines/m4/burger/rooms/section6/room610.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 2d45d8e5e92..57184557b54 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -275,7 +275,7 @@ enum {
V238 = 238,
V239 = 239,
V240 = 240,
- ROOM101_FLAG4 = 241,
+ V241 = 241,
V242 = 242,
V243 = 243,
V244 = 244,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index a6aab77aa7a..9de01a84287 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -257,7 +257,7 @@ void Room101::daemon() {
_G(walker).wilbur_speech(NAMES[idx], 23);
- } else if (!_G(flags)[ROOM101_FLAG4]) {
+ } else if (!_G(flags)[V241]) {
if (_G(flags)[V242] <= 1) {
_G(walker).wilbur_speech("101w520", 7);
@@ -328,7 +328,7 @@ void Room101::daemon() {
loadSounds();
ws_hide_walker(_G(my_walker));
- if (_G(flags)[ROOM101_FLAG4] || _G(flags)[ROOM101_FLAG16])
+ if (_G(flags)[V241] || _G(flags)[ROOM101_FLAG16])
series_load("101wi13s", -1, nullptr);
if (_G(flags)[ROOM101_FLAG10])
series_load("101wi12s", -1, nullptr);
@@ -346,7 +346,7 @@ void Room101::daemon() {
case 9:
daemon9();
- if (_G(flags)[ROOM101_FLAG4] || _G(flags)[V250] ||
+ if (_G(flags)[V241] || _G(flags)[V250] ||
_G(flags)[V280] || _G(flags)[V002]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -366,7 +366,7 @@ void Room101::daemon() {
case 12:
daemon12();
- if (_G(flags)[ROOM101_FLAG4]) {
+ if (_G(flags)[V241]) {
if (_G(flags)[ROOM101_FLAG10] || _G(flags)[V112] ||
_G(flags)[V080] || _G(flags)[V126]) {
terminateMachineAndNull(_machine1);
@@ -744,10 +744,10 @@ void Room101::daemon9() {
}
void Room101::daemon12() {
- if (_G(flags)[V250] || _G(flags)[ROOM101_FLAG4])
+ if (_G(flags)[V250] || _G(flags)[V241])
inv_give_to_player("BLOCK OF ICE");
- if (_G(flags)[V280] || _G(flags)[ROOM101_FLAG4])
+ if (_G(flags)[V280] || _G(flags)[V241])
inv_give_to_player("PANTYHOSE");
if (_G(flags)[V002]) {
diff --git a/engines/m4/burger/rooms/section6/room606.cpp b/engines/m4/burger/rooms/section6/room606.cpp
index 89eb9ff3cda..d847e825460 100644
--- a/engines/m4/burger/rooms/section6/room606.cpp
+++ b/engines/m4/burger/rooms/section6/room606.cpp
@@ -27,14 +27,49 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room606::SERIES1[] = {
+ { 0, "606x001", 2, 100, -1, 0, nullptr, 0 },
+ { 15, "606w003a", 1, 255, -1, 0, &_state1, 0 },
+ { 15, "606w003b", 1, 255, -1, 0, &_state1, 1 },
+ { 15, "606w003c", 1, 255, -1, 0, &_state1, 2 },
+ { 15, "606w003d", 1, 255, -1, 0, &_state1, 3 },
+ STREAM_BREAK_END
+};
+
+long Room606::_state1;
+
+Room606::Room606() : Section6Room() {
+ _state1 = 0;
+}
+
void Room606::preload() {
_G(player).walker_in_this_scene = false;
}
void Room606::init() {
+ kernel_trigger_dispatch_now(1);
}
void Room606::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload("606x001", 606);
+ digi_preload("606w003a", 606);
+ digi_preload("606x003b", 606);
+ digi_preload("606x003c", 606);
+ digi_preload("606x003d", 606);
+ _state1 = imath_ranged_rand(0, 3);
+ series_stream_with_breaks(SERIES1, "606laser", 8, 1, 6007);
+ break;
+
+ case 6007:
+ _G(game).new_room = 608;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room606.h b/engines/m4/burger/rooms/section6/room606.h
index a481c902a96..822beeaf588 100644
--- a/engines/m4/burger/rooms/section6/room606.h
+++ b/engines/m4/burger/rooms/section6/room606.h
@@ -29,8 +29,11 @@ namespace Burger {
namespace Rooms {
class Room606 : public Section6Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static long _state1;
public:
- Room606() : Section6Room() {}
+ Room606();
~Room606() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room608.cpp b/engines/m4/burger/rooms/section6/room608.cpp
index 659d75254f2..10571c72276 100644
--- a/engines/m4/burger/rooms/section6/room608.cpp
+++ b/engines/m4/burger/rooms/section6/room608.cpp
@@ -27,14 +27,78 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room608::SERIES1[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 4, "608f004a", 1, 255, -1, 0, &_state1, 0 },
+ { 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room608::SERIES2[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 4, "608f003a", 1, 255, -1, 0, &_state1, 0 },
+ { 4, "608f001", 1, 255, -1, 0, &_state1, 1 },
+ { 4, "608f002a", 1, 255, -1, 0, &_state1, 2 },
+ { 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+long Room608::_state1;
+
+Room608::Room608() : Section6Room() {
+ _state1 = 0;
+}
+
void Room608::preload() {
_G(player).walker_in_this_scene = false;
}
void Room608::init() {
+ pal_cycle_init(101, 110, 6, -1, -1);
+ _G(wilbur_should) = (_G(game).previous_room == 605 ||
+ _G(game).previous_room == 606) ? 10016 : 10015;
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
void Room608::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ release_trigger_on_digi_state(10027, 1);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 10015:
+ term_message("failed normally");
+ _state1 = 0;
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "608fail", 6, 1, 1);
+ break;
+
+ case 10016:
+ if (_G(game).previous_room == 606) {
+ _state1 = 0;
+ } else if (player_been_here(608)) {
+ _state1 = 1;
+ } else {
+ _state1 = 2;
+ }
+
+ term_message("failed burnt");
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "608burnt", 6, 1, 1);
+ break;
+
+ }
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room608.h b/engines/m4/burger/rooms/section6/room608.h
index f0fa4485287..2471285287c 100644
--- a/engines/m4/burger/rooms/section6/room608.h
+++ b/engines/m4/burger/rooms/section6/room608.h
@@ -29,8 +29,12 @@ namespace Burger {
namespace Rooms {
class Room608 : public Section6Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static long _state1;
public:
- Room608() : Section6Room() {}
+ Room608();
~Room608() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room609.cpp b/engines/m4/burger/rooms/section6/room609.cpp
index b948910acf9..feb637da0c0 100644
--- a/engines/m4/burger/rooms/section6/room609.cpp
+++ b/engines/m4/burger/rooms/section6/room609.cpp
@@ -27,14 +27,47 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room609::SERIES1[] = {
+ { 0, "609_001", 3, 125, -1, 0, nullptr, 0 },
+ { 20, "609w001", 1, 255, -1, 0, &_state1, 1 },
+ { 30, "609w002a", 1, 255, -1, 0, &_state1, 2 },
+ { 30, "609w002b", 1, 255, -1, 0, &_state1, 3 },
+ { 70, "609_002", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+long Room609::_state1;
+
+Room609::Room609() : Section6Room() {
+ _state1 = 0;
+}
+
void Room609::preload() {
_G(player).walker_in_this_scene = false;
}
void Room609::init() {
+ _G(flags)[V277] = 6001;
+ _G(flags)[V243] = 6007;
+ kernel_trigger_dispatch_now(1);
}
void Room609::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ _state1 = _G(visited_room) ? 1 : imath_ranged_rand(2, 3);
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "609wi01", 6, 1, 6010);
+ break;
+
+ case 6010:
+ _G(game).new_room = 612;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room609.h b/engines/m4/burger/rooms/section6/room609.h
index 69e192596dd..6d82f59def0 100644
--- a/engines/m4/burger/rooms/section6/room609.h
+++ b/engines/m4/burger/rooms/section6/room609.h
@@ -29,8 +29,11 @@ namespace Burger {
namespace Rooms {
class Room609 : public Section6Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static long _state1;
public:
- Room609() : Section6Room() {}
+ Room609();
~Room609() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section6/room610.cpp b/engines/m4/burger/rooms/section6/room610.cpp
index b023c0e99ab..4863203a58e 100644
--- a/engines/m4/burger/rooms/section6/room610.cpp
+++ b/engines/m4/burger/rooms/section6/room610.cpp
@@ -27,14 +27,71 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room610::SERIES1[] = {
+ { 1, "610_001", 3, 40, -1, 1024, nullptr, 0 },
+ { 7, "610_002", 2, 175, -1, 0, nullptr, 0 },
+ { 9, "610Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 10, nullptr, 2, 0, -1, 0, nullptr, 0 },
+ { 11, "610_003", 2, 175, -1, 0, nullptr, 0 },
+ { 14, nullptr, 2, 0, -1, 0, nullptr, 0 },
+ { 62, "610Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 139, "610Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 145, "610_002", 2, 175, -1, 0, nullptr, 0 },
+ { 148, nullptr, 2, 0, -1, 0, nullptr, 0 },
+ { 149, "610_004", 2, 175, -1, 0, nullptr, 0 },
+ { 152, nullptr, 2, 0, -1, 0, nullptr, 0 },
+ { 166, "610_005", 2, 125, -1, 0, nullptr, 0 },
+ { 174, "610_006", 2, 70, -1, 0, nullptr, 0 },
+ { 176, "610Z004", 1, 255, -1, 0, nullptr, 0 },
+ { 202, "610Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 238, "610F001", 1, 255, -1, 0, nullptr, 0 },
+ { 277, "610Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 285, "610F002", 1, 255, -1, 0, nullptr, 0 },
+ { 292, "610_006", 2, 70, -1, 0, nullptr, 0 },
+ { 336, "610Z007", 1, 255, -1, 0, nullptr, 0 },
+ { 387, "610F003", 1, 255, -1, 0, nullptr, 0 },
+ { 400, "610_006", 2, 70, -1, 0, nullptr, 0 },
+ { 414, "610Z008", 1, 255, -1, 0, nullptr, 0 },
+ { 447, "610F004", 1, 255, -1, 0, nullptr, 0 },
+ { 452, "610_007", 2, 75, -1, 0, nullptr, 0 },
+ { 458, "610Z009", 1, 255, -1, 0, nullptr, 0 },
+ { 562, nullptr, 0, 0, 2, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+long Room610::_state1;
+
+Room610::Room610() : Section6Room() {
+ _state1 = 0;
+}
+
void Room610::preload() {
_G(player).walker_in_this_scene = false;
}
void Room610::init() {
+ _G(flags)[V241] = 1;
+ _G(kernel).suppress_fadeup = 1;
+ kernel_trigger_dispatch_now(1);
}
void Room610::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload_stream_breaks(SERIES1);
+ pal_fade_set_start(0);
+ series_stream_with_breaks(SERIES1, "610A", 6, 1, 10027);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 60, -1);
+ break;
+
+ case 2:
+ pal_fade_init(0, 255, 0, 30, -1);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section6/room610.h b/engines/m4/burger/rooms/section6/room610.h
index 995f2f56ccb..307602c9f70 100644
--- a/engines/m4/burger/rooms/section6/room610.h
+++ b/engines/m4/burger/rooms/section6/room610.h
@@ -29,8 +29,11 @@ namespace Burger {
namespace Rooms {
class Room610 : public Section6Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static long _state1;
public:
- Room610() : Section6Room() {}
+ Room610();
~Room610() override {}
void preload() override;
Commit: f6d478c6fc9c0dcf0d00c7460c7ff07b900acbf4
https://github.com/scummvm/scummvm/commit/f6d478c6fc9c0dcf0d00c7460c7ff07b900acbf4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton rooms for section 5
Changed paths:
A engines/m4/burger/rooms/section5/room501.cpp
A engines/m4/burger/rooms/section5/room501.h
A engines/m4/burger/rooms/section5/room502.cpp
A engines/m4/burger/rooms/section5/room502.h
A engines/m4/burger/rooms/section5/room503.cpp
A engines/m4/burger/rooms/section5/room503.h
A engines/m4/burger/rooms/section5/room504.cpp
A engines/m4/burger/rooms/section5/room504.h
A engines/m4/burger/rooms/section5/room505.cpp
A engines/m4/burger/rooms/section5/room505.h
A engines/m4/burger/rooms/section5/room506.cpp
A engines/m4/burger/rooms/section5/room506.h
A engines/m4/burger/rooms/section5/room507.cpp
A engines/m4/burger/rooms/section5/room507.h
A engines/m4/burger/rooms/section5/room508.cpp
A engines/m4/burger/rooms/section5/room508.h
A engines/m4/burger/rooms/section5/room509.cpp
A engines/m4/burger/rooms/section5/room509.h
A engines/m4/burger/rooms/section5/room510.cpp
A engines/m4/burger/rooms/section5/room510.h
A engines/m4/burger/rooms/section5/room511.cpp
A engines/m4/burger/rooms/section5/room511.h
A engines/m4/burger/rooms/section5/room512.cpp
A engines/m4/burger/rooms/section5/room512.h
A engines/m4/burger/rooms/section5/room513.cpp
A engines/m4/burger/rooms/section5/room513.h
A engines/m4/burger/rooms/section5/section5.cpp
A engines/m4/burger/rooms/section5/section5.h
A engines/m4/burger/rooms/section5/section5_room.cpp
A engines/m4/burger/rooms/section5/section5_room.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 316afec86b6..8a285ddb452 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -249,7 +249,7 @@ BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
- _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section5);
_sections.push_back(&_section6);
_sections.push_back(&_section7);
_sections.push_back(&_section8);
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index ee45e353e48..ae7988327e3 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -24,6 +24,7 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/rooms/section6/section6.h"
#include "m4/burger/rooms/section7/section7.h"
#include "m4/burger/rooms/section8/section8.h"
@@ -38,7 +39,7 @@ private:
Rooms::Section1 _section2;
Rooms::Section1 _section3;
Rooms::Section1 _section4;
- Rooms::Section1 _section5;
+ Rooms::Section5 _section5;
Rooms::Section6 _section6;
Rooms::Section7 _section7;
Rooms::Section8 _section8;
diff --git a/engines/m4/burger/rooms/section5/room501.cpp b/engines/m4/burger/rooms/section5/room501.cpp
new file mode 100644
index 00000000000..7ef050a472b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room501.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room501.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room501::init() {
+}
+
+void Room501::daemon() {
+}
+
+void Room501::pre_parser() {
+
+}
+
+void Room501::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room501.h b/engines/m4/burger/rooms/section5/room501.h
new file mode 100644
index 00000000000..f260e201fdc
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room501.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM501_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM501_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room501 : public Section5Room {
+public:
+ Room501() : Section5Room() {}
+ ~Room501() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
new file mode 100644
index 00000000000..dd24ef818ef
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room502.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room502::init() {
+}
+
+void Room502::daemon() {
+}
+
+void Room502::pre_parser() {
+
+}
+
+void Room502::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
new file mode 100644
index 00000000000..769e622b2a8
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM502_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM502_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room502 : public Section5Room {
+public:
+ Room502() : Section5Room() {}
+ ~Room502() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
new file mode 100644
index 00000000000..1c540c52c20
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room503.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room503::init() {
+}
+
+void Room503::daemon() {
+}
+
+void Room503::pre_parser() {
+
+}
+
+void Room503::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
new file mode 100644
index 00000000000..f91f47163fa
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM503_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM503_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room503 : public Section5Room {
+public:
+ Room503() : Section5Room() {}
+ ~Room503() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
new file mode 100644
index 00000000000..f5335bb0eff
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room504.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room504::init() {
+}
+
+void Room504::daemon() {
+}
+
+void Room504::pre_parser() {
+
+}
+
+void Room504::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
new file mode 100644
index 00000000000..c2fe30375c5
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM504_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM504_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room504 : public Section5Room {
+public:
+ Room504() : Section5Room() {}
+ ~Room504() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
new file mode 100644
index 00000000000..91a7d92f2dc
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room505.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room505::init() {
+}
+
+void Room505::daemon() {
+}
+
+void Room505::pre_parser() {
+
+}
+
+void Room505::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
new file mode 100644
index 00000000000..8cb86759824
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM505_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM505_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room505 : public Section5Room {
+public:
+ Room505() : Section5Room() {}
+ ~Room505() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
new file mode 100644
index 00000000000..20814d9768b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room506.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room506::init() {
+}
+
+void Room506::daemon() {
+}
+
+void Room506::pre_parser() {
+
+}
+
+void Room506::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
new file mode 100644
index 00000000000..56ac562688d
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM506_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM506_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room506 : public Section5Room {
+public:
+ Room506() : Section5Room() {}
+ ~Room506() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
new file mode 100644
index 00000000000..7e83f214d79
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room507.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room507::init() {
+}
+
+void Room507::daemon() {
+}
+
+void Room507::pre_parser() {
+
+}
+
+void Room507::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
new file mode 100644
index 00000000000..07d58ff4955
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM507_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM507_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room507 : public Section5Room {
+public:
+ Room507() : Section5Room() {}
+ ~Room507() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
new file mode 100644
index 00000000000..5fda2bc5140
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room508.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room508::init() {
+}
+
+void Room508::daemon() {
+}
+
+void Room508::pre_parser() {
+
+}
+
+void Room508::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room508.h b/engines/m4/burger/rooms/section5/room508.h
new file mode 100644
index 00000000000..ac8aab9df4a
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room508.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM508_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM508_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room508 : public Section5Room {
+public:
+ Room508() : Section5Room() {}
+ ~Room508() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
new file mode 100644
index 00000000000..76ddd813a57
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room509.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room509::init() {
+}
+
+void Room509::daemon() {
+}
+
+void Room509::pre_parser() {
+
+}
+
+void Room509::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
new file mode 100644
index 00000000000..aa45d052042
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM509_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM509_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room509 : public Section5Room {
+public:
+ Room509() : Section5Room() {}
+ ~Room509() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
new file mode 100644
index 00000000000..ce948d31e66
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room510.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room510::init() {
+}
+
+void Room510::daemon() {
+}
+
+void Room510::pre_parser() {
+
+}
+
+void Room510::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room510.h b/engines/m4/burger/rooms/section5/room510.h
new file mode 100644
index 00000000000..0650c6e471b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room510.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM510_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM510_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room510 : public Section5Room {
+public:
+ Room510() : Section5Room() {}
+ ~Room510() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room511.cpp b/engines/m4/burger/rooms/section5/room511.cpp
new file mode 100644
index 00000000000..91d6c645559
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room511.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room511.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room511::init() {
+}
+
+void Room511::daemon() {
+}
+
+void Room511::pre_parser() {
+
+}
+
+void Room511::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room511.h b/engines/m4/burger/rooms/section5/room511.h
new file mode 100644
index 00000000000..62454d1a66d
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room511.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM511_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM511_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room511 : public Section5Room {
+public:
+ Room511() : Section5Room() {}
+ ~Room511() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room512.cpp b/engines/m4/burger/rooms/section5/room512.cpp
new file mode 100644
index 00000000000..f19bce10184
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room512.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room512.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room512::init() {
+}
+
+void Room512::daemon() {
+}
+
+void Room512::pre_parser() {
+
+}
+
+void Room512::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room512.h b/engines/m4/burger/rooms/section5/room512.h
new file mode 100644
index 00000000000..3c7f550a78b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room512.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM512_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM512_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room512 : public Section5Room {
+public:
+ Room512() : Section5Room() {}
+ ~Room512() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/room513.cpp b/engines/m4/burger/rooms/section5/room513.cpp
new file mode 100644
index 00000000000..ebab73cea1b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room513.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/room513.h"
+#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room513::init() {
+}
+
+void Room513::daemon() {
+}
+
+void Room513::pre_parser() {
+
+}
+
+void Room513::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room513.h b/engines/m4/burger/rooms/section5/room513.h
new file mode 100644
index 00000000000..3391053e345
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/room513.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM513_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM513_H
+
+#include "m4/burger/rooms/section5/section5_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room513 : public Section5Room {
+public:
+ Room513() : Section5Room() {}
+ ~Room513() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
new file mode 100644
index 00000000000..42e5a1c958b
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section5::Section5() : Rooms::Section() {
+ add(501, &_room501);
+ add(502, &_room502);
+ add(503, &_room503);
+ add(504, &_room504);
+ add(505, &_room505);
+ add(506, &_room506);
+ add(507, &_room507);
+ add(508, &_room508);
+ add(509, &_room509);
+ add(510, &_room510);
+ add(511, &_room511);
+ add(512, &_room512);
+ add(513, &_room513);
+}
+
+void Section5::daemon() {
+ // TODO: daemon method
+ _G(kernel).continue_handling_trigger = true;
+}
+
+void Section5::parser() {
+ _G(player).command_ready = false;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
new file mode 100644
index 00000000000..de0ce7c705c
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_H
+#define M4_BURGER_ROOMS_SECTION5_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section5/room501.h"
+#include "m4/burger/rooms/section5/room502.h"
+#include "m4/burger/rooms/section5/room503.h"
+#include "m4/burger/rooms/section5/room504.h"
+#include "m4/burger/rooms/section5/room505.h"
+#include "m4/burger/rooms/section5/room505.h"
+#include "m4/burger/rooms/section5/room506.h"
+#include "m4/burger/rooms/section5/room507.h"
+#include "m4/burger/rooms/section5/room508.h"
+#include "m4/burger/rooms/section5/room509.h"
+#include "m4/burger/rooms/section5/room510.h"
+#include "m4/burger/rooms/section5/room511.h"
+#include "m4/burger/rooms/section5/room512.h"
+#include "m4/burger/rooms/section5/room513.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section5 : public Rooms::Section {
+private:
+ Room501 _room501;
+ Room502 _room502;
+ Room503 _room503;
+ Room504 _room504;
+ Room505 _room505;
+ Room506 _room506;
+ Room507 _room507;
+ Room508 _room508;
+ Room509 _room509;
+ Room510 _room510;
+ Room511 _room513;
+ Room512 _room512;
+ Room513 _room511;
+
+public:
+ Section5();
+ virtual ~Section5() {}
+
+ void daemon() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
new file mode 100644
index 00000000000..40480ed0276
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section5/section5_room.h"
+#include "m4/burger/vars.h"
+#include "m4/wscript/wst_regs.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Section5Room::preload() {
+ Rooms::Room::preload();
+ _G(flags)[V186] = 0;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
new file mode 100644
index 00000000000..bf1e35bf707
--- /dev/null
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION5_ROOM_H
+#define M4_BURGER_ROOMS_SECTION5_ROOM_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section5Room : public Rooms::Room {
+public:
+ Section5Room() : Rooms::Room() {
+ }
+ ~Section5Room() override {}
+
+ void preload() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index ea8e0d7e704..d93d1eabd20 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -110,6 +110,21 @@ MODULE_OBJS = \
burger/rooms/section1/room174.o \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
+ burger/rooms/section5/section5.o \
+ burger/rooms/section5/section5_room.o \
+ burger/rooms/section5/room501.o \
+ burger/rooms/section5/room502.o \
+ burger/rooms/section5/room503.o \
+ burger/rooms/section5/room504.o \
+ burger/rooms/section5/room505.o \
+ burger/rooms/section5/room506.o \
+ burger/rooms/section5/room507.o \
+ burger/rooms/section5/room508.o \
+ burger/rooms/section5/room509.o \
+ burger/rooms/section5/room510.o \
+ burger/rooms/section5/room511.o \
+ burger/rooms/section5/room512.o \
+ burger/rooms/section5/room513.o \
burger/rooms/section6/section6.o \
burger/rooms/section6/section6_room.o \
burger/rooms/section6/room601.o \
Commit: bf2325bd9a69c93663f55fe08f96e5a531a24c11
https://github.com/scummvm/scummvm/commit/bf2325bd9a69c93663f55fe08f96e5a531a24c11
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding section 5 custom hotspot code
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
engines/m4/burger/rooms/section5/section5_room.cpp
engines/m4/burger/rooms/section5/section5_room.h
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index dd24ef818ef..300c01e924e 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -27,6 +27,18 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const Section5Room::BorkPoint Room502::BORK_TABLE[] = {
+ { 386, 44 }, { 368, 62 }, { 343, 80 }, { 314, 109 }, { 298, 123 },
+ { 279, 143 }, { 255, 166 }, { 255, 166 }, { 252, 166 }, { 249, 168 },
+ { 252, 168 }, { 256, 168 }, { 254, 168 }, { 250, 167 }, { 248, 164 },
+ { 254, 160 }, { 252, 158 }, { 252, 158 }, { 252, 158 }, { 252, 158 },
+ { 252, 158 }, { 256, 160 }, { 256, 160 }, { 252, 160 }, { 232, 163 },
+ { 232, 169 }, { 218, 169 }, { 206, 172 }, { 201, 184 }, { 198, 212 },
+ { 194, 231 }, { 194, 231 }, { 194, 217 }, { 200, 201 }, { 228, 183 },
+ { 244, 181 }, { 258, 176 }, { 276, 173 }, { 295, 141 }, { 309, 136 },
+ { 328, 113 }, { 346, 103 }, { 353, 80 }, { 354, 58 }, { 364, 53 }
+};
+
void Room502::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index 769e622b2a8..dce9c4b2dfe 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -29,6 +29,9 @@ namespace Burger {
namespace Rooms {
class Room502 : public Section5Room {
+private:
+ static const BorkPoint BORK_TABLE[];
+
public:
Room502() : Section5Room() {}
~Room502() override {}
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 91a7d92f2dc..4886c55ae48 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -27,6 +27,16 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const Section5Room::BorkPoint Room505::BORK[] = {
+ { -1, -1 }, { 257, 255 }, { 266, 257 }, { 271, 250 }, { 292, 246 },
+ { 317, 251 }, { 323, 256 }, { 338, 237 }, { 370, 227 }, { 348, 187 },
+ { 332, 165 }, { 308, 161 }, { 282, 161 }, { 303, 175 }, { 325, 179 },
+ { 374, 174 }, { 350, 172 }, { 327, 168 }, { 302, 167 }, { 282, 161 },
+ { 303, 175 }, { 325, 179 }, { 374, 174 }, { 354, 175 }, { 330, 183 },
+ { 317, 204 }, { 305, 217 }, { 284, 210 }, { 270, 227 }, { 255, 236 },
+ { -1, -1 }, { -1, -1 }
+};
+
void Room505::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index 8cb86759824..c21011d6f34 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -29,6 +29,9 @@ namespace Burger {
namespace Rooms {
class Room505 : public Section5Room {
+private:
+ static const BorkPoint BORK[];
+
public:
Room505() : Section5Room() {}
~Room505() override {}
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 42e5a1c958b..b1d8e34c44c 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -26,7 +26,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+machine *Section5::_bork;
+
Section5::Section5() : Rooms::Section() {
+ _bork = nullptr;
+
add(501, &_room501);
add(502, &_room502);
add(503, &_room503);
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index de0ce7c705c..d76474bb9d5 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -59,6 +59,9 @@ private:
Room512 _room512;
Room513 _room511;
+public:
+ static machine *_bork;
+
public:
Section5();
virtual ~Section5() {}
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index 40480ed0276..2553efc4b3a 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -32,6 +32,21 @@ void Section5Room::preload() {
_G(flags)[V186] = 0;
}
+HotSpotRec *Section5Room::custom_hotspot_which(int32 x, int32 y) {
+ HotSpotRec *hotspot = Rooms::Room::custom_hotspot_which(x, y);
+ if (hotspot != nullptr || _G(flags)[V186] == 0 || !verifyMachineExists(_walker1) ||
+ (_G(game).room_id != 502 && _G(game).room_id != 505))
+ return hotspot;
+
+ assert(_borkTable);
+ int index = _walker1->myAnim8->myRegs[IDX_CELS_INDEX];
+ int x1 = _borkTable[index]._x;
+ int y1 = _borkTable[index]._y;
+ int total = (x - x1) * (x - x1) + (y - y1) * (y - y1);
+
+ return (total < _borkThreshold) ? &_borkHotspot : nullptr;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
index bf1e35bf707..73babf90a52 100644
--- a/engines/m4/burger/rooms/section5/section5_room.h
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -29,12 +29,27 @@ namespace Burger {
namespace Rooms {
class Section5Room : public Rooms::Room {
+protected:
+ struct BorkPoint {
+ int16 _x;
+ int16 _y;
+ };
+ const BorkPoint *_borkTable = nullptr;
+ machine *_walker1 = nullptr;
+ HotSpotRec _borkHotspot;
+ int _borkThreshold = 0;
+
public:
Section5Room() : Rooms::Room() {
}
~Section5Room() override {}
void preload() override;
+
+ /**
+ * Used to tell if x,y is over the walker hotspot
+ */
+ HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
};
} // namespace Rooms
Commit: d354d78f80ff56459c02d9e87829b055908c3b0a
https://github.com/scummvm/scummvm/commit/d354d78f80ff56459c02d9e87829b055908c3b0a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 501
Changed paths:
engines/m4/burger/rooms/section5/room501.cpp
engines/m4/burger/rooms/section5/room501.h
diff --git a/engines/m4/burger/rooms/section5/room501.cpp b/engines/m4/burger/rooms/section5/room501.cpp
index 7ef050a472b..6cb7b60ac0f 100644
--- a/engines/m4/burger/rooms/section5/room501.cpp
+++ b/engines/m4/burger/rooms/section5/room501.cpp
@@ -27,18 +27,65 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room501::init() {
-}
+static const seriesStreamBreak SERIES1[] = {
+ { 0, "501_013", 3, 60, -1, -1, 0, 0 },
+ { 5, "501_010", 2, 255, -1, 0, 0, 0 },
+ { 15, "501_011", 2, 255, -1, 0, 0, 0 },
+ { 38, "501z001", 1, 255, -1, 0, 0, 0 },
+ { 61, "501z002", 1, 255, -1, 0, 0, 0 },
+ { 109, "501_001", 2, 255, -1, 0, 0, 0 },
+ { 127, "501_002", 2, 255, -1, 0, 0, 0 },
+ { 135, "501_003", 2, 255, -1, 0, 0, 0 },
+ { 142, "501_004", 2, 255, -1, 0, 0, 0 },
+ { 153, "501_005", 2, 255, -1, 0, 0, 0 },
+ { 175, "501z003", 1, 255, -1, 0, 0, 0 },
+ { 195, "501w001", 1, 255, -1, 0, 0, 0 },
+ { 229, "501z004", 1, 255, -1, 0, 0, 0 },
+ { 278, "501_006", 2, 255, -1, 0, 0, 0 },
+ { 286, "501_007", 2, 255, -1, 0, 0, 0 },
+ { 305, "501_008", 2, 255, -1, 0, 0, 0 },
+ { 336, "501p001", 1, 255, -1, 0, 0, 0 },
+ { 340, "501z005", 2, 255, -1, 0, 0, 0 },
+ { 387, "501_014", 2, 125, -1, 0, 0, 0 },
+ { 391, "501p002", 1, 255, -1, 0, 0, 0 },
+ { 409, "501z006", 1, 255, -1, 0, 0, 0 },
+ { 424, "501p003", 1, 255, -1, 0, 0, 0 },
+ { 452, "501_009", 2, 255, -1, 0, 0, 0 },
+ { 465, "501p004", 1, 255, -1, 0, 0, 0 },
+ { 506, "501w002", 1, 255, -1, 0, 0, 0 },
+ { 530, "501p005", 1, 255, -1, 0, 0, 0 },
+ { 541, "501p006", 1, 255, -1, 0, 0, 0 },
+ { 584, "501z007", 1, 255, -1, 0, 0, 0 },
+ { 656, "501p007", 1, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
-void Room501::daemon() {
+void Room501::preload() {
+ _G(player).walker_in_this_scene = false;
}
-void Room501::pre_parser() {
-
+void Room501::init() {
+ g_vars->_flags.reset4();
+ kernel_trigger_dispatch_now(1);
}
-void Room501::parser() {
+void Room501::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload_stream_breaks(SERIES1);
+ pal_mirror_colours(118, 122);
+ pal_cycle_init(118, 127, 6, -1, -1);
+ series_stream_with_breaks(SERIES1, "501intro", 6, 0x100, 5006);
+ break;
+
+ case 5006:
+ _G(game).new_room = 502;
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room501.h b/engines/m4/burger/rooms/section5/room501.h
index f260e201fdc..addf393a767 100644
--- a/engines/m4/burger/rooms/section5/room501.h
+++ b/engines/m4/burger/rooms/section5/room501.h
@@ -33,10 +33,9 @@ public:
Room501() : Section5Room() {}
~Room501() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
- void parser() override;
};
} // namespace Rooms
Commit: 67c76f5dd6125c927ea872c235dfd5644a0358b5
https://github.com/scummvm/scummvm/commit/67c76f5dd6125c927ea872c235dfd5644a0358b5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Start implementing section 5 gizmo
Changed paths:
engines/m4/burger/rooms/section5/room501.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
diff --git a/engines/m4/burger/rooms/section5/room501.cpp b/engines/m4/burger/rooms/section5/room501.cpp
index 6cb7b60ac0f..5eae2cfa553 100644
--- a/engines/m4/burger/rooms/section5/room501.cpp
+++ b/engines/m4/burger/rooms/section5/room501.cpp
@@ -28,35 +28,35 @@ namespace Burger {
namespace Rooms {
static const seriesStreamBreak SERIES1[] = {
- { 0, "501_013", 3, 60, -1, -1, 0, 0 },
- { 5, "501_010", 2, 255, -1, 0, 0, 0 },
- { 15, "501_011", 2, 255, -1, 0, 0, 0 },
- { 38, "501z001", 1, 255, -1, 0, 0, 0 },
- { 61, "501z002", 1, 255, -1, 0, 0, 0 },
- { 109, "501_001", 2, 255, -1, 0, 0, 0 },
- { 127, "501_002", 2, 255, -1, 0, 0, 0 },
- { 135, "501_003", 2, 255, -1, 0, 0, 0 },
- { 142, "501_004", 2, 255, -1, 0, 0, 0 },
- { 153, "501_005", 2, 255, -1, 0, 0, 0 },
- { 175, "501z003", 1, 255, -1, 0, 0, 0 },
- { 195, "501w001", 1, 255, -1, 0, 0, 0 },
- { 229, "501z004", 1, 255, -1, 0, 0, 0 },
- { 278, "501_006", 2, 255, -1, 0, 0, 0 },
- { 286, "501_007", 2, 255, -1, 0, 0, 0 },
- { 305, "501_008", 2, 255, -1, 0, 0, 0 },
- { 336, "501p001", 1, 255, -1, 0, 0, 0 },
- { 340, "501z005", 2, 255, -1, 0, 0, 0 },
- { 387, "501_014", 2, 125, -1, 0, 0, 0 },
- { 391, "501p002", 1, 255, -1, 0, 0, 0 },
- { 409, "501z006", 1, 255, -1, 0, 0, 0 },
- { 424, "501p003", 1, 255, -1, 0, 0, 0 },
- { 452, "501_009", 2, 255, -1, 0, 0, 0 },
- { 465, "501p004", 1, 255, -1, 0, 0, 0 },
- { 506, "501w002", 1, 255, -1, 0, 0, 0 },
- { 530, "501p005", 1, 255, -1, 0, 0, 0 },
- { 541, "501p006", 1, 255, -1, 0, 0, 0 },
- { 584, "501z007", 1, 255, -1, 0, 0, 0 },
- { 656, "501p007", 1, 255, -1, 0, 0, 0 },
+ { 0, "501_013", 3, 60, -1, (uint32)-1, nullptr, 0 },
+ { 5, "501_010", 2, 255, -1, 0, nullptr, 0 },
+ { 15, "501_011", 2, 255, -1, 0, nullptr, 0 },
+ { 38, "501z001", 1, 255, -1, 0, nullptr, 0 },
+ { 61, "501z002", 1, 255, -1, 0, nullptr, 0 },
+ { 109, "501_001", 2, 255, -1, 0, nullptr, 0 },
+ { 127, "501_002", 2, 255, -1, 0, nullptr, 0 },
+ { 135, "501_003", 2, 255, -1, 0, nullptr, 0 },
+ { 142, "501_004", 2, 255, -1, 0, nullptr, 0 },
+ { 153, "501_005", 2, 255, -1, 0, nullptr, 0 },
+ { 175, "501z003", 1, 255, -1, 0, nullptr, 0 },
+ { 195, "501w001", 1, 255, -1, 0, nullptr, 0 },
+ { 229, "501z004", 1, 255, -1, 0, nullptr, 0 },
+ { 278, "501_006", 2, 255, -1, 0, nullptr, 0 },
+ { 286, "501_007", 2, 255, -1, 0, nullptr, 0 },
+ { 305, "501_008", 2, 255, -1, 0, nullptr, 0 },
+ { 336, "501p001", 1, 255, -1, 0, nullptr, 0 },
+ { 340, "501z005", 2, 255, -1, 0, nullptr, 0 },
+ { 387, "501_014", 2, 125, -1, 0, nullptr, 0 },
+ { 391, "501p002", 1, 255, -1, 0, nullptr, 0 },
+ { 409, "501z006", 1, 255, -1, 0, nullptr, 0 },
+ { 424, "501p003", 1, 255, -1, 0, nullptr, 0 },
+ { 452, "501_009", 2, 255, -1, 0, nullptr, 0 },
+ { 465, "501p004", 1, 255, -1, 0, nullptr, 0 },
+ { 506, "501w002", 1, 255, -1, 0, nullptr, 0 },
+ { 530, "501p005", 1, 255, -1, 0, nullptr, 0 },
+ { 541, "501p006", 1, 255, -1, 0, nullptr, 0 },
+ { 584, "501z007", 1, 255, -1, 0, nullptr, 0 },
+ { 656, "501p007", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index b1d8e34c44c..446b2a36fa0 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -21,15 +21,300 @@
#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/vars.h"
+#include "m4/burger/burger.h"
+#include "m4/gui/gui_sys.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *PARSER[] = {
+ "GIZMO",
+ "LOOK AT",
+ "500w006",
+ "TAKE",
+ nullptr,
+ "BORK",
+ "500w007",
+ "BORK ",
+ "500w007",
+ "BORK ",
+ "500w007",
+ "MICROWAVE",
+ "500w008",
+ "OVEN",
+ "500w008",
+ "OUTLET",
+ "500w009",
+ "TOASTER",
+ "500w010",
+ "WASHING MACHINE",
+ "500w011",
+ "TELEVISION",
+ "500w012",
+ "VIDEO GAME",
+ "500w012",
+ "TOILET",
+ "500w011",
+ "TUB",
+ "500w011",
+ "CHRISTMAS LIGHTS ",
+ "500w012",
+ "CHRISTMAS LIGHTS ",
+ "500w012",
+ "TELEPHONE",
+ "500w012",
+ "AMPLIFIER",
+ nullptr,
+ nullptr,
+ "500w013",
+ "Th-th-th-that's all folks...",
+ "ROLLING PIN",
+ "LOOK AT",
+ "500w014",
+ "TAKE",
+ nullptr,
+ "BORK",
+ "500w015",
+ "BORK ",
+ "500w015",
+ "BORK ",
+ "500w015",
+ "RUBBER DUCKY",
+ "500w032",
+ "RUBBER DUCKY ",
+ "500w032",
+ "RUBBER DUCKY ",
+ "500w032",
+ "FIREPLACE",
+ "500w016",
+ "PRUNES",
+ "500w018",
+ "WILBUR",
+ "500w019",
+ nullptr,
+ "500w020",
+ "Th-th-th-that's all folks...",
+ "DIRTY SOCK",
+ "LOOK AT",
+ "500w021",
+ "TAKE",
+ nullptr,
+ "BORK",
+ "500w022",
+ "BORK ",
+ "500w022",
+ "BORK ",
+ "500w022",
+ "FIREPLACE",
+ "500w023",
+ "MICROWAVE",
+ "500w023",
+ "FRIDGE",
+ "500w024",
+ "OVEN",
+ "500w024",
+ "SINK",
+ "500w025",
+ "WASHING MACHINE",
+ "500w025",
+ "LAUNDRY HAMPER",
+ "500w023",
+ "WARDROBE",
+ "500w023",
+ "TOILET",
+ "500w023",
+ "TUB",
+ "500w025",
+ "SINK",
+ "500w025",
+ "SOAPY WATER",
+ "500w052",
+ "SOAPY WATER ",
+ "500w052",
+ "HOLE",
+ "500w026",
+ "WILBUR",
+ "500w027",
+ nullptr,
+ "500w028",
+ "Th-th-th-that's all folks...",
+ "RUBBER DUCKY",
+ "LOOK AT",
+ "500w029",
+ "TAKE",
+ nullptr,
+ "GEAR",
+ nullptr,
+ "ROLLING PIN ",
+ "500w032",
+ "MICROWAVE",
+ "500w032",
+ "FRIDGE",
+ "500w033",
+ "OVEN",
+ "500w032",
+ "OUTLET",
+ "500w035",
+ "WRINGER",
+ "500w032",
+ "WASHING MACHINE",
+ "500w037",
+ "FIRE",
+ "500w030",
+ nullptr,
+ "500w043",
+ "Th-th-th-that's all folks...",
+ "SOAPY WATER",
+ "LOOK AT",
+ "500w044",
+ "TAKE",
+ nullptr,
+ "BORK",
+ "500w045",
+ "BORK ",
+ "500w045",
+ "BORK ",
+ "500w045",
+ "STAIRS",
+ "500w046",
+ "KINDLING ",
+ "500w048",
+ "FIREPLACE",
+ "500w048",
+ "DIRTY SOCK ",
+ "500w052",
+ "WASHING MACHINE",
+ "500w053",
+ "TELEVISION",
+ "500w055",
+ "VIDEO GAME",
+ "500w056",
+ "FIRE",
+ "500w055",
+ "TOILET",
+ "500w057",
+ "TUB",
+ "500w058",
+ "WILBUR",
+ "500w059",
+ nullptr,
+ "500w060",
+ "Th-th-th-that's all folks...",
+ "KINDLING",
+ "LOOK AT",
+ "500w061",
+ "TAKE",
+ nullptr,
+ "KINDLING ",
+ "500w064",
+ "BREAKER BOX",
+ "500w066",
+ "TOILET",
+ "500w068",
+ "TUB",
+ "500w068",
+ "CHIMNEY",
+ "500w070",
+ "CHIMNEY POTS",
+ "500w070",
+ "WILBUR",
+ "500w071",
+ nullptr,
+ "500w072",
+ "Th-th-th-that's all folks...",
+ "RUBBER GLOVES",
+ "LOOK AT",
+ "500w073",
+ "TAKE",
+ nullptr,
+ "BORK",
+ "500w074",
+ "BORK ",
+ "500w074",
+ "BORK ",
+ "500w074",
+ "WRINGER",
+ "500w075",
+ "WASHING MACHINE",
+ "500w076",
+ nullptr,
+ "500w078"
+ "Th-th-th-that's all folks...",
+ "CHRISTMAS LIGHTS",
+ "LOOK AT",
+ "500w080",
+ "TAKE",
+ nullptr,
+ "GEAR",
+ "500w019",
+ "WILBUR'S ROOM",
+ "500w081",
+ "BATHROOM",
+ "500w082",
+ "CHIMNEY",
+ "500w083",
+ "CHIMNEY POTS",
+ "500w083",
+ "WILBUR",
+ "500w090",
+ nullptr,
+ "500w091",
+ "Th-th-th-that's all folks...",
+ "CHRISTMAS LIGHTS ",
+ "LOOK AT",
+ "500w079",
+ "TAKE",
+ nullptr,
+ "WILBUR'S ROOM",
+ "500w081",
+ "BATHROOM",
+ "500w082",
+ "CHIMNEY",
+ "500w083",
+ "CHIMNEY POTS",
+ "500w083",
+ "WILBUR",
+ "500w090",
+ nullptr,
+ "500w091",
+ "Th-th-th-that's all folks...",
+ "BOTTLE",
+ "TAKE",
+ nullptr,
+ "SINK",
+ "503w047",
+ "WASHING MACHINE",
+ "504w033",
+ "TOILET",
+ "507w037",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ "AMPLIFIER",
+ "TAKE",
+ nullptr,
+ "PIANO",
+ "502w056",
+ "OUTLET",
+ "503w048",
+ "VIDEO GAME",
+ "506w039",
+ "PHONE CORD",
+ "509w028",
+ "GIZMO",
+ "999w028",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ nullptr
+};
+
machine *Section5::_bork;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
+ Common::fill(_gizmoRoomNums, _gizmoRoomNums + 15, 0);
add(501, &_room501);
add(502, &_room502);
@@ -52,9 +337,63 @@ void Section5::daemon() {
}
void Section5::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if ((player_said("GEAR", "RUBBER GLOVES") || player_said("RUBBER GLOVES", "WILBUR")) &&
+ _G(flags)[V234] == 0 && _G(game).previous_room != 508) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 5001;
+ ws_turn_to_face(4, gCHANGE_WILBUR_ANIMATION);
+
+ } else if (player_said("GIZMO") && player_said_any("WILBUR", "GEAR", "TAKE")) {
+ takeGizmo(_G(master_palette));
+
+ } else if (_G(walker).wilbur_parser(PARSER)) {
+ // Already handled
+ } else {
+ return;
+ }
+
_G(player).command_ready = false;
}
+void Section5::takeGizmo(RGB8 *pal) {
+ if (player_commands_allowed() && INTERFACE_VISIBLE &&
+ !_G(pal_fade_in_progress) && !_flag1) {
+ gizmoAnim(pal);
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V238] == 0) {
+ gizmoDigiPlay("510w001", 255, _gizmoRoomNums[0]);
+ ++_G(flags)[V238];
+ } else if (_G(flags)[V238] == 1) {
+ gizmoDigiPlay("510w002", 255, _gizmoRoomNums[1]);
+ ++_G(flags)[V238];
+ }
+ }
+}
+
+void Section5::gizmoAnim(RGB8 *pal) {
+ // TODO
+}
+
+void Section5::gizmoDigiPlay(const char *name, int vol, bool &done) {
+ if (!done) {
+ done = true;
+ digi_play(name, 2, vol);
+ digi_read_another_chunk();
+ player_set_commands_allowed(false);
+
+ while (!g_engine->shouldQuit() && digi_play_state(2)) {
+ digi_read_another_chunk();
+ midi_loop();
+ gui_system_event_handler();
+ }
+
+ player_set_commands_allowed(true);
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index d76474bb9d5..3b102a6ebdb 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -58,6 +58,12 @@ private:
Room511 _room513;
Room512 _room512;
Room513 _room511;
+ bool _flag1 = false;
+ bool _gizmoRoomNums[15];
+
+ void takeGizmo(RGB8 *pal);
+ void gizmoAnim(RGB8 *pal);
+ void gizmoDigiPlay(const char *name, int vol, bool &done);
public:
static machine *_bork;
Commit: 16979a4c0808a0f6a392b17d8dbb8ff0e64eeefe
https://github.com/scummvm/scummvm/commit/16979a4c0808a0f6a392b17d8dbb8ff0e64eeefe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginning of gui_gizmo module
Changed paths:
A engines/m4/burger/gui/gui_gizmo.cpp
A engines/m4/burger/gui/gui_gizmo.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
new file mode 100644
index 00000000000..ad39df3faa1
--- /dev/null
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/gui/gui_gizmo.h"
+#include "m4/burger/vars.h"
+#include "m4/core/errors.h"
+#include "m4/adv_r/adv_background.h"
+#include "m4/adv_r/adv_control.h"
+
+namespace M4 {
+namespace Burger {
+namespace GUI {
+
+void gizmo_initialize(RGB8 *pal) {
+ if (!_GIZMO(initialized)) {
+ _GIZMO(initialized) = true;
+
+ // Remember whether interface was visible when gizmo was initialized
+ if (INTERFACE_VISIBLE) {
+ _GIZMO(interface_visible) = true;
+ interface_hide();
+ } else {
+ _GIZMO(interface_visible) = false;
+ }
+
+ _GIZMO(palette) = pal;
+ krn_fade_to_grey(pal, 5, 1);
+
+ }
+}
+
+void gizmo_shutdown(bool fade) {
+ if (_GIZMO(initialized)) {
+ _GIZMO(val1) = 0;
+
+ if (_GIZMO(lowMemory2)) {
+ if (!adv_restoreBackground())
+ error_show(FL, 0, "unable to restore background");
+ }
+
+ if (_GIZMO(lowMemory1)) {
+ if (!adv_restoreCodes())
+ error_show(FL, 0, "unable to restore screen codes");
+ }
+
+ krn_fade_from_grey(_GIZMO(palette), 5, 1, fade ? 1 : 2);
+
+ if (_GIZMO(interface_visible))
+ interface_show();
+
+ mouse_unlock_sprite();
+ game_pause(false);
+ _GIZMO(initialized) = false;
+ }
+}
+
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
new file mode 100644
index 00000000000..01ad6e4270f
--- /dev/null
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -0,0 +1,50 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_GUI_GIZMO_H
+#define M4_BURGER_GUI_GIZMO_H
+
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Burger {
+namespace GUI {
+
+#define _GIZMO(X) g_vars->_gizmo._##X
+
+struct Gizmo_Globals {
+ bool _initialized = false;
+ bool _interface_visible = false;
+ RGB8 *_palette = nullptr;
+ bool _lowMemory1 = false;
+ bool _lowMemory2 = false;
+ int _val1 = 0;
+};
+
+extern void gizmo_initialize(RGB8 *pal);
+extern void gizmo_shutdown(bool fade);
+
+} // namespace GUI
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 446b2a36fa0..59c316a6427 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section5/section5.h"
+#include "m4/burger/gui/gui_gizmo.h"
#include "m4/burger/vars.h"
#include "m4/burger/burger.h"
#include "m4/gui/gui_sys.h"
@@ -314,7 +315,7 @@ machine *Section5::_bork;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
- Common::fill(_gizmoRoomNums, _gizmoRoomNums + 15, 0);
+ Common::fill(_gizmoRoomNums, _gizmoRoomNums + 15, false);
add(501, &_room501);
add(502, &_room502);
@@ -359,7 +360,7 @@ void Section5::parser() {
void Section5::takeGizmo(RGB8 *pal) {
if (player_commands_allowed() && INTERFACE_VISIBLE &&
- !_G(pal_fade_in_progress) && !_flag1) {
+ !_G(pal_fade_in_progress) && !_GIZMO(initialized)) {
gizmoAnim(pal);
player_set_commands_allowed(false);
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 3b102a6ebdb..0ddf7a6a98a 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -58,7 +58,6 @@ private:
Room511 _room513;
Room512 _room512;
Room513 _room511;
- bool _flag1 = false;
bool _gizmoRoomNums[15];
void takeGizmo(RGB8 *pal);
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8e9c21bd8c5..bddf4220a29 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -27,6 +27,7 @@
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
#include "m4/burger/gui/gui.h"
+#include "m4/burger/gui/gui_gizmo.h"
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/flags.h"
#include "m4/burger/hotkeys.h"
@@ -94,6 +95,7 @@ public:
Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
GUI::GUI_Globals _gui;
+ GUI::Gizmo_Globals _gizmo;
GUI::Interface _interface;
Burger::Hotkeys _hotkeys;
GUI::MenuGlobals _menu;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index d93d1eabd20..8822b17bc2e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -85,6 +85,7 @@ MODULE_OBJS = \
burger/core/stream_break.o \
burger/gui/game_menu.o \
burger/gui/gui_cheapo.o \
+ burger/gui/gui_gizmo.o \
burger/gui/interface.o \
burger/rooms/room.o \
burger/rooms/section.o \
Commit: 93d3dda712724e630c942b83e1b5d6b0a56cf2e4
https://github.com/scummvm/scummvm/commit/93d3dda712724e630c942b83e1b5d6b0a56cf2e4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Gizmo loading sprites
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index ad39df3faa1..aff92734850 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -24,11 +24,27 @@
#include "m4/core/errors.h"
#include "m4/adv_r/adv_background.h"
#include "m4/adv_r/adv_control.h"
+#include "m4/mem/mem.h"
namespace M4 {
namespace Burger {
namespace GUI {
+static void gizmo_dispose_gui();
+static void gizmo_restore_interface(bool fade);
+static void gizmo_free_gui(ScreenContext *screenContext);
+static bool gizmo_load_sprites(const char *name, size_t count);
+static void gizmo_free_sprites();
+
+void gizmo_anim(RGB8 *pal) {
+ if (!_GIZMO(initialized))
+ gizmo_initialize(pal);
+
+ gizmo_load_sprites("500gizmo", 58);
+
+ // TODO
+}
+
void gizmo_initialize(RGB8 *pal) {
if (!_GIZMO(initialized)) {
_GIZMO(initialized) = true;
@@ -47,7 +63,12 @@ void gizmo_initialize(RGB8 *pal) {
}
}
-void gizmo_shutdown(bool fade) {
+void gizmo_shutdown(void *, void *) {
+ gizmo_dispose_gui();
+ gizmo_restore_interface(true);
+}
+
+static void gizmo_restore_interface(bool fade) {
if (_GIZMO(initialized)) {
_GIZMO(val1) = 0;
@@ -72,6 +93,60 @@ void gizmo_shutdown(bool fade) {
}
}
+static void gizmo_dispose_gui() {
+ if (_GIZMO(gui)) {
+ vmng_screen_dispose(_GIZMO(gui));
+ gizmo_free_gui(_GIZMO(gui));
+ gizmo_free_sprites();
+ _GIZMO(gui) = 0;
+ }
+}
+
+static void gizmo_free_gui(ScreenContext *screenContext) {
+ // TODO
+}
+
+static bool gizmo_load_sprites(const char *name, size_t count) {
+ if (LoadSpriteSeries(name, &_GIZMO(seriesHandle), &_GIZMO(celsOffset),
+ &_GIZMO(palOffset), _GIZMO(palette)) > 0) {
+ gr_pal_set_range(_GIZMO(palette), 64, 192);
+ _GIZMO(assetName) = mem_strdup(name);
+
+ _GIZMO(spriteCount) = count;
+ _GIZMO(sprites) = (M4sprite **)mem_alloc(count * sizeof(M4sprite *), "*sprites array");
+
+ for (size_t idx = 0; idx < count; ++idx) {
+ _GIZMO(sprites)[idx] = CreateSprite(_GIZMO(seriesHandle), _GIZMO(celsOffset),
+ idx, nullptr, nullptr);
+ if (!_GIZMO(sprites)[idx])
+ return false;
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static void gizmo_free_sprites() {
+ if (_GIZMO(assetName)) {
+ rtoss(_GIZMO(assetName));
+ mem_free(_GIZMO(assetName));
+
+ _GIZMO(assetName) = nullptr;
+ _GIZMO(seriesHandle) = 0;
+ _GIZMO(celsOffset) = -1;
+ _GIZMO(palOffset) = -1;
+
+ for (int idx = 0; idx < _GIZMO(spriteCount); ++idx)
+ mem_free(_GIZMO(sprites)[idx]);
+
+ mem_free(_GIZMO(sprites));
+ _GIZMO(sprites) = nullptr;
+ _GIZMO(spriteCount) = 0;
+ }
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 01ad6e4270f..57c3e8c3d5f 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -24,6 +24,7 @@
#define M4_BURGER_GUI_GIZMO_H
#include "m4/m4_types.h"
+#include "m4/gui/gui_vmng_core.h"
namespace M4 {
namespace Burger {
@@ -38,10 +39,18 @@ struct Gizmo_Globals {
bool _lowMemory1 = false;
bool _lowMemory2 = false;
int _val1 = 0;
+ ScreenContext *_gui = nullptr;
+ MemHandle _seriesHandle = nullptr;
+ int32 _celsOffset = 0;
+ int32 _palOffset = 0;
+ char *_assetName = nullptr;
+ int _spriteCount = 0;
+ M4sprite **_sprites = nullptr;
};
+extern void gizmo_anim(RGB8 *pal);
extern void gizmo_initialize(RGB8 *pal);
-extern void gizmo_shutdown(bool fade);
+extern void gizmo_shutdown(void *, void *);
} // namespace GUI
} // namespace Burger
Commit: 3590d782e8f91ce372d9e8937ebf092701ad75f6
https://github.com/scummvm/scummvm/commit/3590d782e8f91ce372d9e8937ebf092701ad75f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of Gizmo gui creation
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index aff92734850..3ddce52363f 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -35,14 +35,19 @@ static void gizmo_restore_interface(bool fade);
static void gizmo_free_gui(ScreenContext *screenContext);
static bool gizmo_load_sprites(const char *name, size_t count);
static void gizmo_free_sprites();
+static ScreenContext *gui_create_gizmo(M4sprite *sprite, int zero1, int zero2, int v505);
void gizmo_anim(RGB8 *pal) {
if (!_GIZMO(initialized))
gizmo_initialize(pal);
- gizmo_load_sprites("500gizmo", 58);
+ if (gizmo_load_sprites("500gizmo", 58)) {
+ _GIZMO(gui) = gui_create_gizmo(_GIZMO(sprites)[0], 0, 0, 505);
- // TODO
+ if (_GIZMO(gui)) {
+ // TODO
+ }
+ }
}
void gizmo_initialize(RGB8 *pal) {
@@ -59,7 +64,6 @@ void gizmo_initialize(RGB8 *pal) {
_GIZMO(palette) = pal;
krn_fade_to_grey(pal, 5, 1);
-
}
}
@@ -147,6 +151,22 @@ static void gizmo_free_sprites() {
}
}
+static ScreenContext *gui_create_gizmo(M4sprite *sprite, int zero1, int zero2, int v505) {
+ if (!sprite)
+ return nullptr;
+
+ Gizmo *gui = (Gizmo *)mem_alloc(sizeof(Gizmo), "*gui gizmo");
+ if (!gui)
+ return nullptr;
+
+ GrBuff *grBuff = new GrBuff(sprite->w, sprite->h);
+ gui->_grBuff = grBuff;
+
+
+ // TODO: More stuff
+ return nullptr;
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 57c3e8c3d5f..0deaa1a0c40 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -25,6 +25,7 @@
#include "m4/m4_types.h"
#include "m4/gui/gui_vmng_core.h"
+#include "m4/graphics/gr_buff.h"
namespace M4 {
namespace Burger {
@@ -48,6 +49,22 @@ struct Gizmo_Globals {
M4sprite **_sprites = nullptr;
};
+struct Gizmo {
+ GrBuff *_grBuff = nullptr;
+ int _field4 = 0;
+ int _field8 = 0;
+ int _fieldC = 0;
+ EventHandler _eventHandler = nullptr;
+};
+
+struct GizmoItem {
+ // TODO
+};
+
+struct GizmoButton {
+ // TODO
+};
+
extern void gizmo_anim(RGB8 *pal);
extern void gizmo_initialize(RGB8 *pal);
extern void gizmo_shutdown(void *, void *);
Commit: 2a82eef94a685f94db2a8f9462984c34a5c76570
https://github.com/scummvm/scummvm/commit/2a82eef94a685f94db2a8f9462984c34a5c76570
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 502 init and setup methods
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
engines/m4/burger/rooms/section5/section5_room.cpp
engines/m4/burger/rooms/section5/section5_room.h
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 57184557b54..ee31c6e6ffb 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -227,7 +227,7 @@ enum {
V191 = 191,
V192 = 192,
V193 = 193,
- ROOM101_FLAG18 = 194,
+ V194 = 194,
V195 = 195,
V196 = 196,
V197 = 197,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 9de01a84287..e5ab805406c 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -298,7 +298,7 @@ void Room101::daemon() {
_G(walker).wilbur_speech("101w552", 7);
break;
default:
- if (_G(flags)[ROOM101_FLAG18] && !_G(flags)[ROOM101_FLAG19]) {
+ if (_G(flags)[V194] && !_G(flags)[ROOM101_FLAG19]) {
_G(walker).wilbur_speech("101w551", 7);
_G(flags)[ROOM101_FLAG19] = 1;
} else {
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 300c01e924e..21f9a77f5f7 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -40,6 +40,63 @@ const Section5Room::BorkPoint Room502::BORK_TABLE[] = {
};
void Room502::init() {
+ _G(flags)[V194] = 0;
+ Section5Room::init();
+
+ pal_cycle_init(124, 127, 12);
+ loadSeries1();
+ player_set_commands_allowed(false);
+ _G(flags)[V246] = 0;
+
+ bool skip = false;
+ switch (_G(game).previous_room) {
+ case 503:
+ ws_demand_location(620, 311, 9);
+ ws_walk(304, 308, 0, -1, -1);
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(24);
+ break;
+
+ case 505:
+ ws_demand_location(237, 235, 9);
+ ws_hide_walker();
+ _val1 = _G(flags)[V196] ? 6 : 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 506:
+ ws_demand_location(402, 272, 1);
+ _val1 = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ _val1 = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ ws_demand_location(304, 308, 9);
+ ws_hide_walker();
+ kernel_trigger_dispatch_now(5);
+ skip = true;
+ break;
+ }
+
+ if (!skip) {
+ setup1();
+ setup2();
+ setup3();
+ }
+
+ series_show("502logs", 0xc00);
+
+ if (_G(flags)[V198])
+ kernel_trigger_dispatch_now(19);
+
+ _flag1 = true;
+ Section5Room::init();
}
void Room502::daemon() {
@@ -53,6 +110,84 @@ void Room502::parser() {
}
+void Room502::loadSeries1() {
+ static const char *NAMES[6] = {
+ "500_008", "500_009", "500_010", "500_011", "500_012", "500_013"
+ };
+ for (int i = 0; i < 6; ++i)
+ digi_preload(NAMES[i]);
+ series_load("502spark");
+}
+
+void Room502::loadSeries2() {
+ static const char *NAMES[15] = {
+ "502bk01", "502bk01s", "502bk02", "502bk02s", "502bk03",
+ "502bk03s", "502bk04", "502bk04s", "502bk05", "502bk06",
+ "502bk06s", "502bk07", "502bk07s", "502bk08", "502bk08s"
+ };
+ for (int i = 0; i < 15; ++i)
+ series_load(NAMES[i]);
+}
+
+void Room502::loadSeries3() {
+ series_load("502bk09");
+ series_load("502bk09s");
+ series_load("502bkst");
+ series_load("502bksts");
+ digi_preload("502b001a");
+ digi_preload("502b001b");
+ digi_preload("502b003a");
+ digi_preload("502b003b");
+ digi_preload("502b004");
+}
+
+void Room502::setup1() {
+ if (_G(flags)[V197]) {
+ series_show("502bk05", 0xd00);
+ series_show("502phone", 0x800);
+ hotspot_set_active("BORK ", false);
+ hotspot_set_active("CHARRED OUTLINE", true);
+
+ } else {
+ loadSeries2();
+ hotspot_set_active("BORK ", true);
+ hotspot_set_active("CHARRED OUTLINE", false);
+
+ _walk1 = intr_add_no_walk_rect(370, 281, 500, 310, 328, 318);
+
+ if (_G(game).previous_room == 503) {
+ series_show("502bk01", 0x400);
+ _series1.show("502bk01", 0x400);
+ _flag1 = true;
+ _val3 = 25;
+ kernel_timing_trigger(120, 10);
+
+ } else {
+ _val3 = 20;
+ kernel_trigger_dispatch_now(10);
+ }
+ }
+}
+
+void Room502::setup2() {
+ if (_G(flags)[V200] == 5003) {
+ _val5 = 36;
+ kernel_trigger_dispatch_now(17);
+ kernel_trigger_dispatch_now(18);
+ } else {
+ loadSeries3();
+ _val4 = _G(game).previous_room == 505 ? 33 : 27;
+ kernel_trigger_dispatch_now(13);
+ }
+}
+
+void Room502::setup3() {
+ if (_G(flags)[V211] == 5000) {
+ _series2 = series_show("502spark", 0xc00);
+ kernel_trigger_dispatch_now(21);
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index dce9c4b2dfe..2b91734d68f 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -31,6 +31,22 @@ namespace Rooms {
class Room502 : public Section5Room {
private:
static const BorkPoint BORK_TABLE[];
+ noWalkRect *_walk1 = nullptr;
+ Series _series1;
+ machine *_series2 = nullptr;
+ bool _flag1 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+
+ void loadSeries1();
+ void loadSeries2();
+ void loadSeries3();
+ void setup1();
+ void setup2();
+ void setup3();
public:
Room502() : Section5Room() {}
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 59c316a6427..efb1a4f56b1 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -312,9 +312,11 @@ static const char *PARSER[] = {
};
machine *Section5::_bork;
+const char *Section5::_digiName;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
+ _digiName = nullptr;
Common::fill(_gizmoRoomNums, _gizmoRoomNums + 15, false);
add(501, &_room501);
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 0ddf7a6a98a..ee1a2d49c38 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -66,6 +66,7 @@ private:
public:
static machine *_bork;
+ static const char *_digiName;
public:
Section5();
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index 2553efc4b3a..84accd6ab35 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section5/section5_room.h"
+#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/vars.h"
#include "m4/wscript/wst_regs.h"
@@ -30,6 +31,49 @@ namespace Rooms {
void Section5Room::preload() {
Rooms::Room::preload();
_G(flags)[V186] = 0;
+ _flag1 = false;
+}
+
+void Section5Room::init() {
+ if (_flag1) {
+ _flag1 = false;
+ kernel_timing_trigger(120, 5004);
+ }
+
+ if (Section5::_digiName != 0) {
+ digi_stop(3);
+ digi_unload(Section5::_digiName);
+ }
+ Section5::_digiName = nullptr;
+
+ int vol = 125;
+
+ switch (_G(game).room_id) {
+ case 502:
+ if (_G(flags)[V198])
+ Section5::_digiName = "500_002";
+ break;
+
+ case 505:
+ Section5::_digiName = "505_002";
+ break;
+
+ case 506:
+ Section5::_digiName = _G(flags)[V218] == 5003 ? "500_002" : "506_005";
+ break;
+
+ case 508:
+ Section5::_digiName = "500_029";
+ break;
+
+ default:
+ break;
+ }
+
+ if (Section5::_digiName) {
+ digi_preload(Section5::_digiName);
+ digi_play_loop(Section5::_digiName, 3, vol);
+ }
}
HotSpotRec *Section5Room::custom_hotspot_which(int32 x, int32 y) {
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
index 73babf90a52..1a49455cec1 100644
--- a/engines/m4/burger/rooms/section5/section5_room.h
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -38,6 +38,7 @@ protected:
machine *_walker1 = nullptr;
HotSpotRec _borkHotspot;
int _borkThreshold = 0;
+ bool _flag1 = false;
public:
Section5Room() : Rooms::Room() {
@@ -45,6 +46,7 @@ public:
~Section5Room() override {}
void preload() override;
+ void init() override;
/**
* Used to tell if x,y is over the walker hotspot
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 34eb7c97cc7..4cf989d41b9 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -90,7 +90,8 @@ extern void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetP
extern void pal_fade_init(int32 triggerNum);
extern void disable_player_commands_and_fade_init(int trigger);
-extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks, int32 totalTicks, int32 triggerNum);
+extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks,
+ int32 totalTicks = -1, int32 triggerNum = -1);
/**
* Returns true if color cycling is on
Commit: 914965c6b30ae20d7bb1c0f037cc2738c6dbb50c
https://github.com/scummvm/scummvm/commit/914965c6b30ae20d7bb1c0f037cc2738c6dbb50c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 502 preparser/parser
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 21f9a77f5f7..e2785bc3b06 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -39,6 +39,35 @@ const Section5Room::BorkPoint Room502::BORK_TABLE[] = {
{ 328, 113 }, { 346, 103 }, { 353, 80 }, { 354, 58 }, { 364, 53 }
};
+static const char *SAID[][4] = {
+ { "FRONT DOOR", "502w003", "500w001", "502w057" },
+ { "KITCHEN", nullptr, "500w001", nullptr },
+ { "STAIRS", "502w007", "500w001", nullptr },
+ { "BORK", "502w009", "500w002", "500w002" },
+ { "BORK ", "502w011", "500w002", "500w002" },
+ { "CHARRED OUTLINE", "502w012", "502w013", "500w001" },
+ { "RAILING", "502w014", nullptr, "502w016" },
+ { "KINDLING ", "502w018", nullptr, "502w021" },
+ { "FIREPLACE", "502w023", "500w001", "502w022" },
+ { "WINDOW", "500w003", "500w001", "500w004" },
+ { "CHANDELIER", "502w027", "502w028", "502w028" },
+ { "WIRES", "502w029", "502w030", "502w030" },
+ { "WIRES ", "502w031", "502w030", "502w030" },
+ { "PHONE JACK", "502w032", nullptr, "502w032" },
+ { "ARMCHAIR", "502w034", nullptr, "502w035" },
+ { "ROCKER", "502w036", nullptr, "502w035" },
+ { "LAMP", "502w038", "502w039", "502w039" },
+ { "PIANO", "502w040", "502w041", "502w042" },
+ { "SHEET MUSIC", "502w043", "502w044", "502w045" },
+ { "BOOKS", "502w046", "502w047", "502w047" },
+ { "BOOK", "502w048", "502w049", "502w047" },
+ { "PICTURE", "502w050", "500w005", "502w051" },
+ { "PICTURE ", "502w052", "500w005", "502w051" },
+ { "PAINTING", "502w053", "502w054", "502w051" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
void Room502::init() {
_G(flags)[V194] = 0;
Section5Room::init();
@@ -103,13 +132,87 @@ void Room502::daemon() {
}
void Room502::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR"))
+ player_set_facing_hotspot();
}
void Room502::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ bool railing = player_said("RAILING") && _G(flags)[V200] == 5003;
+ bool takeKindling = player_said("KINDLING ") && player_said("TAKE");
+ bool gearKindling = player_said("KINDLING ") && player_said("GEAR");
+ bool fireplace = player_said("FIREPLACE") && _G(flags)[V198] != 0;
-}
+ if (player_said("LOOK AT", "FRONT DOOR") && _G(flags)[V195]) {
+ wilbur_speech("502w004");
+ } else if (player_said("LOOK AT STAIRS") && _G(flags)[V200] == 5003) {
+ wilbur_speech("502w008");
+ } else if (railing && player_said("LOOK AT")) {
+ wilbur_speech("502w015");
+ } else if (railing && player_said("GEAR")) {
+ wilbur_speech("502w017");
+ } else if (takeKindling && inv_player_has("kindling")) {
+ wilbur_speech("502w019");
+ } else if (takeKindling && _G(flags)[V198]) {
+ wilbur_speech("502w020");
+ } else if (gearKindling && inv_player_has("KINDLING")) {
+ wilbur_speech("502w022");
+ } else if (gearKindling && _G(flags)[V198]) {
+ wilbur_speech("502w020");
+ } else if (player_said("KINDLING") && player_said("FIREPLACE")) {
+ wilbur_speech(_G(flags)[V198] ? "500w063" : "500w062");
+ } else if (player_said("KINDLING") && player_said("WIRES")) {
+ wilbur_speech("500w065");
+ } else if (fireplace && player_said("LOOK AT")) {
+ wilbur_speech("502w024");
+ } else if (fireplace && player_said("GEAR")) {
+ wilbur_speech("502w025");
+ } else if (fireplace && player_said("RUBBER DUCK")) {
+ wilbur_speech("502w030");
+ } else if (player_said("GEAR", "WINDOW") && _G(flags)[V200] == 5003) {
+ wilbur_speech("502w026");
+ } else if ((player_said("LOOK AT") || player_said("GEAR")) &&
+ player_said("PHONE JACK") && _G(flags)[V197] != 0) {
+ wilbur_speech("502w033");
+ } else if (player_said("LOOK AT", "ROCKER") && _G(flags)[V197] != 0) {
+ wilbur_speech("502w037");
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("GEAR", "FRONT DOOR")) {
+ _val1 = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR")) {
+ _val6 = 5007;
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("GEAR", "STAIRS")) {
+ _val1 = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BORK ") && player_said("LOOK AT") &&
+ !player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
+ !player_said("LAXATIVE")) {
+ player_set_commands_allowed(false);
+ _val3 = 26;
+ ++_val2;
+ } else if (player_said("TAKE", "KINDLING ")) {
+ if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
+ _val1 = 10;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("SOAPY WATER", "RAILING")) {
+ _val1 = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BURNING KINDLING", "FIREPLACE")) {
+ _val1 = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ inv_move_object("BURNING KINDLING", NOWHERE);
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
+}
void Room502::loadSeries1() {
static const char *NAMES[6] = {
"500_008", "500_009", "500_010", "500_011", "500_012", "500_013"
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index 2b91734d68f..f6af9d9c42c 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -40,6 +40,7 @@ private:
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
+ int _val6 = 0;
void loadSeries1();
void loadSeries2();
Commit: 77ce392c9e4acd03384f7de5925b9ffc8f3558e2
https://github.com/scummvm/scummvm/commit/77ce392c9e4acd03384f7de5925b9ffc8f3558e2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 502 arrays
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index e2785bc3b06..3f7432cd34e 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -67,6 +67,200 @@ static const char *SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const seriesStreamBreak Room502::SERIES1[] = {
+ { 14, "502Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 71, "502Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 92, "502Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 124, "502Z004", 1, 255, -1, 0, nullptr, 0 },
+ { 155, "502f001", 1, 255, -1, 0, nullptr, 0 },
+ { 162, "502f002", 1, 255, -1, 0, nullptr, 0 },
+ { 201, nullptr, 0, 0, 20, 0, nullptr, 0 },
+ { 210, "502i001", 1, 255, -1, 0, nullptr, 0 },
+ { 243, "502i002", 1, 255, -1, 0, nullptr, 0 },
+ { 258, "502Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 289, "502i003", 1, 255, -1, 0, nullptr, 0 },
+ { 310, "502Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 334, "502Z007", 1, 255, -1, 0, nullptr, 0 },
+ { 407, "502_005", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room502::SERIES2[] = {
+ { 44, "502_005", 2, 255, -1, 0, nullptr, 0 },
+ { -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY1[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 6, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 7, 12, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 13, 18, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 19, 22, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 23, 27, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 28, 32, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 33, 39, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 40, -1, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY2[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 1, 6, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 7, 12, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 13, 17, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 18, 22, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 24, 29, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 30, 35, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 36, 40, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 41, -1, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY3[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 6, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 7, 12, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 13, 16, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY4[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 1, 6, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 7, 12, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 13, 17, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 18, 22, "502_008b", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 24, 27, "502_008a", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY5[] = {
+ { 48, 42, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY6[] = {
+ { 0, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 15, "502_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 16, -1, nullptr, 0, 0, 17, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY7[] = {
+ { 5, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 15, "502_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 16, -1, nullptr, 0, 0, 17, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY8[] = {
+ { 28, 29, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 30, 35, "502_008b", 1, 100, -1, 0, 0, 0, 0 },
+ { 36, 40, "502_008a", 1, 100, -1, 0, 0, 0, 0 },
+ { 41, -1, "502_008b", 1, 100, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY9[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, -1, "502_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY10[] = {
+ { 0, 21, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 22, -1, nullptr, 0, 0, 19, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY11[] = {
+ { 0, 15, "502b005a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 15, "502b005b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 15, "502b005c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 0, 15, "502b005d", 2, 255, -1, 0, 0, &_state1, 4 },
+ { 0, 15, "502b005e", 2, 255, -1, 0, 0, &_state1, 5 },
+ { 0, 15, "502b005f", 2, 255, -1, 0, 0, &_state1, 6 },
+ { 0, 15, "502b005g", 2, 255, -1, 0, 0, &_state1, 7 },
+ { 0, 15, "502b005h", 2, 255, -1, 0, 0, &_state1, 8 },
+ { 0, 15, "502b005i", 2, 255, -1, 0, 0, &_state1, 9 },
+ { 16, -1, "502b005a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 16, -1, "502b005b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 16, -1, "502b005c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 16, -1, "502b005d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 16, -1, "502b005e", 2, 255, -1, 0, 0, &_state2, 5 },
+ { 16, -1, "502b005f", 2, 255, -1, 0, 0, &_state2, 6 },
+ { 16, -1, "502b005g", 2, 255, -1, 0, 0, &_state2, 7 },
+ { 16, -1, "502b005h", 2, 255, -1, 0, 0, &_state2, 8 },
+ { 16, -1, "502b005i", 2, 255, -1, 0, 0, &_state2, 9 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY12[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 4, "502_002", 2, 255, -1, 0, 3, nullptr, 0 },
+ { 5, 9, "502b008a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 5, 9, "502b008b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 5, 9, "502b008c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 5, 9, "502b008d", 2, 255, -1, 0, 0, &_state1, 4 },
+ { 5, 9, "502b008e", 2, 255, -1, 0, 0, &_state1, 5 },
+ { 9, 9, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY13[] = {
+ { 0, 9, "502b007a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 9, "502b007b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 3, 0, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY14[] = {
+ { 0, 13, "502b006a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 13, "502b006b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 13, "502b006c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 14, 14, nullptr, 0, 0, 16, 0, 0, &_state4, 3 },
+ { 14, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 18, -1, nullptr, 0, 0, 7, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY15[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 1, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY16[] = {
+ { 0, 10, "502_007", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 11, 11, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 12, -1, "500_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room502::PLAY17[] = {
+ { 1, -1, "500_008", 2, 255, -1, 4, 0, &_state3, 1 },
+ { 1, -1, "500_009", 2, 255, -1, 4, 0, &_state3, 2 },
+ { 1, -1, "500_010", 2, 255, -1, 4, 0, &_state3, 3 },
+ { 1, -1, "500_011", 2, 255, -1, 4, 0, &_state3, 4 },
+ { 1, -1, "500_012", 2, 255, -1, 4, 0, &_state3, 5 },
+ { 1, -1, "500_013", 2, 255, -1, 4, 0, &_state3, 6 },
+ PLAY_BREAK_END
+};
+
+long Room502::_state1;
+long Room502::_state2;
+long Room502::_state3;
+long Room502::_state4;
+
+
+Room502::Room502() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+}
void Room502::init() {
_G(flags)[V194] = 0;
@@ -129,6 +323,15 @@ void Room502::init() {
}
void Room502::daemon() {
+ switch (_G(kernel).trigger) {
+ case 5002:
+ enable_player();
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room502::pre_parser() {
@@ -194,7 +397,7 @@ void Room502::parser() {
!player_said("LAXATIVE")) {
player_set_commands_allowed(false);
_val3 = 26;
- ++_val2;
+ ++_state4;
} else if (player_said("TAKE", "KINDLING ")) {
if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
_val1 = 10;
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index f6af9d9c42c..69aa0f860a7 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -29,6 +29,31 @@ namespace Burger {
namespace Rooms {
class Room502 : public Section5Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+
private:
static const BorkPoint BORK_TABLE[];
noWalkRect *_walk1 = nullptr;
@@ -36,7 +61,6 @@ private:
machine *_series2 = nullptr;
bool _flag1 = false;
int _val1 = 0;
- int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
@@ -50,7 +74,7 @@ private:
void setup3();
public:
- Room502() : Section5Room() {}
+ Room502();
~Room502() override {}
void init() override;
Commit: d0592ab9257a1e14a3ae18e3e1d41eedcf00b5fd
https://github.com/scummvm/scummvm/commit/d0592ab9257a1e14a3ae18e3e1d41eedcf00b5fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Section 5 rooms static arrays
Changed paths:
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room504.h
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room506.h
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room507.h
engines/m4/burger/rooms/section5/room508.cpp
engines/m4/burger/rooms/section5/room508.h
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room509.h
engines/m4/burger/rooms/section5/room511.cpp
engines/m4/burger/rooms/section5/room511.h
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 1c540c52c20..a9fee893eec 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -27,6 +27,271 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room503::SAID1[][4] = {
+ { "PARLOUR", nullptr, "500w001", nullptr },
+ { "BASEMENT", nullptr, "500w001", nullptr },
+ { "BORK", "503w004", "500w002", "500w002" },
+ { "ROLLING PIN ", "503w007", nullptr, "503w008" },
+ { "MICROWAVE", "503w009", nullptr, nullptr },
+ { "RUBBER GLOVES ", "503w014", nullptr, nullptr },
+ { "HUTCH", "503w016", nullptr, "500w001" },
+ { "DISHES", "503w017", "503w018", "503w018" },
+ { "FRIDGE", "503w019", nullptr, "500w001" },
+ { "OVEN", "503w020", nullptr, nullptr },
+ { "MOP", "503w024", "503w025", "503w025" },
+ { "CUPBOARD ", "503w026", nullptr, nullptr },
+ { "CUPBOARD", "503w028", nullptr, nullptr },
+ { "PRUNES", "503w029", "503w031", "503w031" },
+ { "WINDOW", "500w003", nullptr, "500w004" },
+ { "SINK", "503w034", "503w035", nullptr },
+ { "OUTLET", "503w036", "500w001", "503w037" },
+ { "CALENDAR", "503w038", "500w005", "503w038" },
+ { "TOASTER", "503w039", "503w040", "503w040" },
+ { "COOKIES", "503w041", "503w042", "503w043" },
+ { "WIRES", "503w044", "503w045", "503w045" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const char *Room503::SAID2[][4] = {
+ { "STAIRS", "504w002", "500w001", nullptr },
+ { "BORK", "504w007", "500w002", "500w002" },
+ { "BORK GUTS", "504w009", "504w010", "504w010" },
+ { "DIRTY SOCK ", "504w011", nullptr, nullptr },
+ { "WRINGER", "504w013", "504w015", "504w016" },
+ { "BREAKER BOX", "504w017", nullptr, "504w019" },
+ { "INSIDE BREAKER", "504w020", "504w021", nullptr },
+ { "OUTSIDE BREAKER","504w024", "504w021", nullptr },
+ { "WASHING MACHINE","504w026", nullptr, "504w027" },
+ { "PAINT CAN", "504w028", "504w029", "504w030" },
+ { "HOLE", nullptr, "500w001", "500w001" },
+ { "LAUNDRY HAMPER", "504w030", "504w016", "504w016" },
+ { "LAUNDRY HAMPER ","504w030", "504w016", "504w016" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room503::PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY2[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 18, "503b001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 19, -1, "503_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY3[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 9, "503_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 10, 14, "503_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 15, 18, "503_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 19, -1, "503_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY4[] = {
+ { 0, 4, "503b004a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 4, "503b004b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 4, "503b004c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 5, 9, nullptr, 0, 0, 13, 0, 0, nullptr, 0 },
+ { 10, 10, nullptr, 0, 0, 18, 0, 0, &_state2, 3 },
+ { 10, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY5[] = {
+ { 0, -1, "503b005a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, -1, "503b005b", 2, 255, -1, 0, 0, &_state1, 2 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY6[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 7, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
+ { 8, 10, "503_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 11, 13, "503b006a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 11, 13, "503b006b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 14, 20, "503b007a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 14, 20, "503b007b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 14, 20, "503b007c", 2, 255, -1, 0, 0, &_state3, 3 },
+ { 14, 20, "503b007d", 2, 255, -1, 0, 0, &_state3, 4 },
+ { 21, 21, "503b008a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 21, 21, "503b008b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 22, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 25, 25, nullptr, 0, 0, 18, 0, 0, &_state5, 1 },
+ { 26, 26, "503_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 27, -1, nullptr, 0, 0, 11, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY7[] = {
+ { 4, 7, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
+ { 8, 10, "503_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 11, 13, "503b006a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 11, 13, "503b006b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 14, 20, "503b007a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 14, 20, "503b007b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 14, 20, "503b007c", 2, 255, -1, 0, 0, &_state3, 3 },
+ { 14, 20, "503b007d", 2, 255, -1, 0, 0, &_state3, 4 },
+ { 21, 21, "503b008a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 21, 21, "503b008b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 22, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY8[] = {
+ { 0, 3, "503_007", 3, 255, -1, 0, 0, nullptr, 0 },
+ { 4, 7, "503b002a", 2, 255, -1, 4, 3, &_state1, 1 },
+ { 4, 7, "503b002b", 2, 255, -1, 4, 3, &_state1, 2 },
+ { 4, 7, "503b002c", 2, 255, -1, 4, 3, &_state1, 3 },
+ { 8, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY9[] = {
+ { 0, -1, "503b003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY10[] = {
+ { 0, 10, "503_010", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 11, 14, "503b007a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 11, 14, "503b007b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 11, 14, "503b007c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 11, 14, "503b007d", 2, 255, -1, 0, 0, &_state1, 4 },
+ { 15, 21, "503b010a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 15, 21, "503b010b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 15, 21, "503b010c", 2, 255, -1, 0, 0, &_state3, 3 },
+ { 22, 23, "500_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 29, "503b011a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 24, 29, "503b011b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 30, 34, "503b012a", 2, 255, -1, 0, 0, &_state6, 1 },
+ { 30, 34, "503b012b", 2, 255, -1, 0, 0, &_state6, 2 },
+ { 35, 35, nullptr, 0, 0, -1, 0, 0, &_state5, 0 },
+ { 35, 35, nullptr, 0, 0, 18, 0, 0, &_state5, 1 },
+ { 36, 40, nullptr, 0, 0, 11, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY11[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 11, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
+ { 12, 15, "503_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 16, -1, "503b013a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 16, -1, "503b013b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 16, -1, "503b013c", 2, 255, -1, 0, 0, &_state1, 3 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY12[] = {
+ { 0, -1, "503b014a", 2, 255, -1, 0, 3, &_state1, 1 },
+ { 0, -1, "503b014b", 2, 255, -1, 0, 3, &_state1, 2 },
+ { 0, -1, "503b014c", 2, 255, -1, 0, 3, &_state1, 3 },
+ { 0, -1, "503b014d", 2, 255, -1, 0, 3, &_state1, 4 },
+ { 0, -1, "503b014e", 2, 255, -1, 0, 3, &_state1, 5 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY13[] = {
+ { 0, -1, "503_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY14[] = {
+ { 0, -1, "503_003", 2, 255, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY15[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 8, 10, "503_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 11, 15, "503_004", 3, 255, -1, 0, 0, nullptr, 0 },
+ { 16, 17, "503b015", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 18, -1, nullptr, 0, 0, 22, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY16[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY17[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 6, &_state1, 1 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 6, &_state1, 2 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 6, &_state1, 3 },
+ { 0, 2, "503b017a", 2, 255, -1, 1, -1, &_state1, 4 },
+ { 0, 2, "503b017b", 2, 255, -1, 1, -1, &_state1, 5 },
+ { 0, 2, "503b017c", 2, 255, -1, 1, -1, &_state1, 6 },
+ { 0, 2, "503b017d", 2, 255, -1, 1, -1, &_state1, 7 },
+ { 0, 2, "503b017e", 2, 255, -1, 1, -1, &_state1, 8 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY18[] = {
+ { 0, 4, "503b018a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 4, "503b018b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 4, "503b018c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 0, 4, "503b018d", 2, 255, -1, 0, 0, &_state1, 4 },
+ { 5, 5, "500_001", 3, 255, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 2, 0, 12, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY19[] = {
+ { 0, 1, "503_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 2, 8, "503_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 9, -1, "503b016a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 9, -1, "503b016b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 9, -1, "503b016c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 0, 0, 8, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY20[] = {
+ { 0, 23, "503_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 35, "503_012", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 36, -1, "503_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY21[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 7, "503_004", 3, 255, -1, 2, 0, nullptr, 0 },
+ { 0, 1, nullptr, 0, 0, 22, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY22[] = {
+ { 0, 10, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 11, -1, nullptr, 0, 0, 9, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY23[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+long Room503::_state1;
+long Room503::_state2;
+long Room503::_state3;
+long Room503::_state4;
+long Room503::_state5;
+long Room503::_state6;
+
+Room503::Room503() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+ _state5 = 0;
+ _state6 = 0;
+}
+
void Room503::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index f91f47163fa..536218e766e 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -29,8 +29,41 @@ namespace Burger {
namespace Rooms {
class Room503 : public Section5Room {
+private:
+ static const char *SAID1[][4];
+ static const char *SAID2[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static const seriesPlayBreak PLAY19[];
+ static const seriesPlayBreak PLAY20[];
+ static const seriesPlayBreak PLAY21[];
+ static const seriesPlayBreak PLAY22[];
+ static const seriesPlayBreak PLAY23[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+ static long _state5;
+ static long _state6;
+
public:
- Room503() : Section5Room() {}
+ Room503();
~Room503() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index f5335bb0eff..0089ab225a1 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -27,6 +27,171 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room504::SAID[][4] = {
+ { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
+ { "BATHROOM", nullptr, "500w001", nullptr },
+ { "AUNT POLLY'S ROOM", nullptr, "500w001", nullptr },
+ { "STAIRS", nullptr, "505w001", "500w001" },
+ { "STAIRWAY BORK", "505w003", "500w002", "500w002" },
+ { "RAILING", "505w004", nullptr, "505w006" },
+ { "WINDOW", "500w003", nullptr, "500w004" },
+ { "CEILING FAN", "505w008", nullptr, nullptr },
+ { "CHANDELIER", "505w009", nullptr, nullptr },
+ { "VASE", "505w010", "505w011", "505w012" },
+ { "PICTURE", "505w013", "500w005", "505w014" },
+ { "PICTURE ", "505w015", "500w005", "505w014" },
+ { "PICTURE ", "505w016", "500w005", "505w014" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room504::PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY2[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY3[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 8, 8, "504_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, -1, nullptr, 0, 0, 8, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY4[] = {
+ { 0, 8, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 9, 9, "504_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 0, 0, 8, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY5[] = {
+ { 0, 5, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
+ { 6, -1, nullptr, 0, 0, 10016, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY6[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 5, "504_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 0, 0, 9, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY7[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 7, "504_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 9, -1, nullptr, 0, 0, 9, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY8[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, -1, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY9[] = {
+ { 0, 30, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 31, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY10[] = {
+ { 0, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, "504w004", 1, 255, -1, 0, 0, &_state1, 1 },
+ { 13, 13, "504w018a", 1, 255, -1, 0, 0, &_state1, 2 },
+ { 13, 13, "504w018b", 1, 255, -1, 0, 0, &_state1, 3 },
+ { 13, 13, "504w018c", 1, 255, -1, 0, 0, &_state1, 4 },
+ { 13, 13, "504w018d", 1, 255, -1, 0, 0, &_state1, 5 },
+ { 13, 13, "504w018e", 1, 255, -1, 0, 0, &_state1, 6 },
+ { 14, 14, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 15, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY11[] = {
+ { 0, 3, nullptr, 0, 0, 6, 0, 0, nullptr, 0 },
+ { 6, 15, "504b002a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 6, 15, "504b002b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 6, 15, "504b002c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 16, 17, "504_005", 3, 125, -1, 0, 0, nullptr, 0 },
+ { 18, 27, "504b003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 28, 30, "504_006", 3, 125, -1, 0, 0, nullptr, 0 },
+ { 31, 41, "504b013a", 2, 255, -1, 1, -1, nullptr, 0 },
+ { 29, 33, "504b013c", 2, 255, -1, 1, -1, nullptr, 0 },
+ { 42, 47, "504_004", 3, 125, -1, 0, 0, nullptr, 0 },
+ { 49, 55, "504b005a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 49, 55, "504b005b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 56, 75, "504b006a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 56, 75, "504b006b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 76, 81, "500_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 82, 82, nullptr, 0, 0, 6, 0, 7, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY12[] = {
+ { 0, -1, "504b001a", 2, 255, -1, 1, 0, &_state2, 1 },
+ { 0, -1, "504b001b", 2, 255, -1, 1, 0, &_state2, 2 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY13[] = {
+ { 0, 8, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 9, 9, "504_005", 1, 125, -1, 0, 0, nullptr, 0 },
+ { 10, 19, "504b008a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 10, 19, "504b008b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 10, 19, "504b008c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 20, 20, "504_007", 3, 255, -1, 0, 0, nullptr, 0 },
+ { 21, 24, "504_006", 1, 125, -1, 0, 0, nullptr, 0 },
+ { 25, 27, "504b012a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 25, 27, "504b012b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 28, 29, "504_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 30, -1, "504_004", 1, 125, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY14[] = {
+ { 0, -1, "504b008a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "504b008b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "504b008c", 2, 255, -1, 0, 0, &_state2, 3 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY15[] = {
+ { 0, -1, "504_005", 3, 125, -1, 0, 2, nullptr, 0 },
+ { 0, -1, "504_006", 3, 125, -1, 0, 0, nullptr, 0 },
+ { 0, -1, "504_004", 3, 125, -1, 0, 4, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room504::PLAY16[] = {
+ { 0, -1, "500_008", 2, 255, -1, 0, 0, &_state5, 1 },
+ { 0, -1, "500_009", 2, 255, -1, 0, 0, &_state5, 2 },
+ { 0, -1, "500_010", 2, 255, -1, 0, 0, &_state5, 3 },
+ { 0, -1, "500_011", 2, 255, -1, 0, 0, &_state5, 4 },
+ { 0, -1, "500_012", 2, 255, -1, 0, 0, &_state5, 5 },
+ { 0, -1, "500_013", 2, 255, -1, 0, 0, &_state5, 6 },
+ PLAY_BREAK_END
+};
+
+long Room504::_state1;
+long Room504::_state2;
+long Room504::_state3;
+long Room504::_state4;
+long Room504::_state5;
+
+Room504::Room504() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+ _state5 = 0;
+}
+
void Room504::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
index c2fe30375c5..2327bbb873f 100644
--- a/engines/m4/burger/rooms/section5/room504.h
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -29,8 +29,32 @@ namespace Burger {
namespace Rooms {
class Room504 : public Section5Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+ static long _state5;
+
public:
- Room504() : Section5Room() {}
+ Room504();
~Room504() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 4886c55ae48..721c0062855 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -37,6 +37,19 @@ const Section5Room::BorkPoint Room505::BORK[] = {
{ -1, -1 }, { -1, -1 }
};
+const seriesPlayBreak Room505::PLAY1[] = {
+ { 0, 3, "505_003a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 4, -1, "505_003b", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room505::PLAY2[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, -1, "505_003a", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room505::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index c21011d6f34..54358614ff3 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -31,6 +31,8 @@ namespace Rooms {
class Room505 : public Section5Room {
private:
static const BorkPoint BORK[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
public:
Room505() : Section5Room() {}
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index 20814d9768b..dccfb4f1573 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -27,6 +27,99 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room506::SERIES1[] = {
+ { 0, "506_003", 2, 100, -1, 0, nullptr, 0 },
+ { 13, "506_003", 2, 100, -1, 0, nullptr, 0 },
+ { 20, "506_006", 1, 255, -1, 0, nullptr, 0 },
+ { 45, "506_003", 2, 100, -1, 0, nullptr, 0 },
+ { 67, "506_003", 2, 100, -1, 0, nullptr, 0 },
+ { 77, "506_003", 2, 255, -1, 0, nullptr, 0 },
+ { 91, "506_007", 2, 255, -1, 0, nullptr, 0 },
+ { 100, "506b005a", 1, 255, -1, 0, &_state1, 1 },
+ { 100, "506b005b", 1, 255, -1, 0, &_state1, 2 },
+ { 100, "506b005c", 1, 255, -1, 0, &_state1, 3 },
+ { 113, "506_007", 2, 255, -1, 0, nullptr, 0 },
+ { 135, "506_007", 2, 255, -1, 0, nullptr, 0 },
+ { 155, "506_001", 2, 255, -1, 0, nullptr, 0 },
+ { 165, nullptr, 0, 0, 11, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const char *Room506::SAID[][4] = {
+ { "HALLWAY", nullptr, "500w001", nullptr },
+ { "WINDOW", "500w003", "500w001", nullptr },
+ { "ROOF", "500w003", "500w001", nullptr },
+ { "BORK", "506w004", "500w002", "500w002" },
+ { "TELEVISION", "506w005", nullptr, "506w007" },
+ { "FIRE", "506w009", "506w010", "506w011" },
+ { "VIDEO GAME", "506w012", "506w013", "506w015" },
+ { "BED", "506w017", nullptr, "506w018" },
+ { "MATTRESS", "506w017", nullptr, "506w018" },
+ { "READING LAMP", "506w019", "506w020", "506w021" },
+ { "NIGHT TABLE", "506w022", "500w005", "500w005" },
+ { "PILLOW", "506w023", "506w024", "506w025" },
+ { "LAMP", "506w026", "506w020", "506w021" },
+ { "BOOK", "506w027", "506w028", "506w028" },
+ { "WARDROBE", "506w029", nullptr, nullptr },
+ { "CLOTHES", "506w030", "506w031", "506w032" },
+ { "DRESSER", "506w033", nullptr, nullptr },
+ { "MODEL ROCKET ", "506w034", "500w005", "500w005" },
+ { "MODEL ROCKET", "506w035", "506w036", "500w005" },
+ { "MODEL ROCKET ", "506w037", "500w005", "500w005" },
+ { "POSTER ", "506w038", "500w005", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room506::PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room506::PLAY2[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room506::PLAY3[] = {
+ { 0, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 26, 40, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ { 41, 46, "500w067", 1, 255, -1, 4, -1, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room506::PLAY4[] = {
+ { 9, 22, "506_003", 2, 50, -1, 0, 0, nullptr, 0 },
+ { 23, 28, "506b003a", 2, 255, -1, 4, 2, &_state1, 1 },
+ { 23, 28, "506b003b", 2, 255, -1, 4, 2, &_state1, 2 },
+ { 29, 37, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room506::PLAY5[] = {
+ { 38, 38, "506_003", 2, 120, -1, 0, 12, nullptr, 0 },
+ { 39, 73, "506b004a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 39, 73, "506b004b", 2, 255, -1, 0, 0, &_state1, 2 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room506::PLAY6[] = {
+ { 0, 12, "506b002a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 12, "506b002b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 13, 13, nullptr, 0, 0, 9, 0, 0, &_state2, 3 },
+ { 13, 30, nullptr, 0, 0, 6, 0, 0, nullptr, 0 },
+ { 31, -1, nullptr, 0, 0, 2, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
+long Room506::_state1;
+long Room506::_state2;
+
+Room506::Room506() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+}
+
void Room506::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
index 56ac562688d..e70421ae703 100644
--- a/engines/m4/burger/rooms/section5/room506.h
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -29,8 +29,20 @@ namespace Burger {
namespace Rooms {
class Room506 : public Section5Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static long _state1;
+ static long _state2;
+
public:
- Room506() : Section5Room() {}
+ Room506();
~Room506() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index 7e83f214d79..da9767f690a 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -27,6 +27,206 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room507::SAID[][4] = {
+ { "HALLWAY", nullptr, "500w001", nullptr },
+ { "BORK", "507w001", "500w002", "500w002" },
+ { "RUBBER DUCKY ", "507w004", nullptr, "507w006" },
+ { "RUBBER DUCKY ", "507w004", "507w005", "507w006" },
+ { "TOILET", "507w007", "500w001", nullptr },
+ { "FLUSH CHAIN", "507w007", "500w001", nullptr },
+ { "TUB", "507w001", "500w001", "500w002" },
+ { "WINDOW", "500w003", "500w001", "500w004" },
+ { "TOILET SEAT", "507w012", "500w005", "500w005" },
+ { "SHOWER CURTAIN", nullptr, "500w005", nullptr },
+ { "SHOWERHEAD", "507w013", "507w014", nullptr },
+ { "CLOSET", "507w015", "500w001", "500w001" },
+ { "TOILET PAPER", "507w016", "500w005", "500w005" },
+ { "TOWELS", "507w017", "507w018", "507w018" },
+ { "DRAIN CLEANER", "507w019", "507w020", "507w020" },
+ { "MIRROR", "507w021", nullptr, "507w022" },
+ { "SINK", "507w023", nullptr, nullptr },
+ { "BOARD", "507w024", "500w005", nullptr },
+ { "LIVER SPOT CREAM", "507w025", "507w026", "507w026" },
+ { "FACIAL HAIR BLEACH", "507w027", "507w028", "507w029" },
+ { "WRINKLE CREAM", "507w030", "507w031", "507w031" },
+ { "FACE CREAM", "507w032", "507w020", "507w033" },
+ { "WIRES", "507w034", "507w035", "507w035" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room507::PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY2[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 0, 0, 11, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY3[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 5, "500_004", 1, 255, -1, 0, 3, nullptr, 0 },
+ { 0, 3, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY4[] = {
+ { 11, 16, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 17, 19, "507_006", 1, 255, 11, 0, 0, nullptr, 0 },
+ { 20, 23, nullptr, 0, 0, 10016, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY5[] = {
+ { 0, 10, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY6[] = {
+ { 0, 10, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY7[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, 9, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY8[] = {
+ { 0, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 14, "507_004", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 15, 15, nullptr, 0, 0, -1, 0, 8, nullptr, 0 },
+ { 16, 27, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 28, -1, nullptr, 0, 0, 11, 0, 0, nullptr, -1 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY9[] = {
+ { 0, 6, "507b001a", 3, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 6, "507b001b", 3, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 6, "507b001c", 3, 255, -1, 0, 0, &_state1, 3 },
+ { 0, 6, "507b001d", 3, 255, -1, 0, 0, &_state1, 4 },
+ { 7, 11, "507_002a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 7, 11, "507_002b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 7, 11, "507_002c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 7, 11, "507_002d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 7, 11, "507_002e", 2, 255, -1, 0, 0, &_state2, 5 },
+ { 7, 11, "507_002f", 2, 255, -1, 0, 0, &_state2, 6 },
+ { 12, 21, "507_002a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 12, 21, "507_002b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 12, 21, "507_002c", 2, 255, -1, 0, 0, &_state3, 3 },
+ { 12, 21, "507_002d", 2, 255, -1, 0, 0, &_state3, 4 },
+ { 12, 21, "507_002e", 2, 255, -1, 0, 0, &_state3, 5 },
+ { 12, 21, "507_002f", 2, 255, -1, 0, 0, &_state3, 6 },
+ { 22, -1, "507_002a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 22, -1, "507_002b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 22, -1, "507_002c", 2, 255, -1, 0, 0, &_state4, 3 },
+ { 22, -1, "507_002d", 2, 255, -1, 0, 0, &_state4, 4 },
+ { 22, -1, "507_002e", 2, 255, -1, 0, 0, &_state4, 5 },
+ { 22, -1, "507_002f", 2, 255, -1, 0, 0, &_state4, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY10[] = {
+ { 0, -1, "507_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY11[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 9, "507b003a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 2, 9, "507b003b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 2, 9, "507b003c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 10, 15, "507b004a", 2, 255, -1, 4, 2, &_state2, 1 },
+ { 10, 15, "507b004b", 2, 255, -1, 4, 2, &_state2, 2 },
+ { 10, 15, "507b004c", 2, 255, -1, 4, 2, &_state2, 3 },
+ { 16, 20, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 21, 21, nullptr, 0, 0, -1, 0, 8, nullptr, 0 },
+ { 22, -1, "507b005", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY12[] = {
+ { 0, 11, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 12, 15, "507b006a", 2, 255, -1, 4, 2, &_state1, 1 },
+ { 12, 15, "507b006b", 2, 255, -1, 4, 2, &_state1, 2 },
+ { 16, 16, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 17, 18, "500_004", 2, 255, -1, 0, 3, nullptr, 0 },
+ { 19, 28, "507b007a", 2, 255, -1, 4, 2, &_state2, 1 },
+ { 19, 28, "507b007b", 2, 255, -1, 4, 2, &_state2, 2 },
+ { 29, 32, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 33, -1, "507b008a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 33, -1, "507b008b", 2, 255, -1, 0, 0, &_state3, 2 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY13[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 8, "507b003a", 2, 255, -1, 4, 0, &_state1, 1 },
+ { 4, 8, "507b003b", 2, 255, -1, 4, 0, &_state1, 2 },
+ { 4, 8, "507b003c", 2, 255, -1, 4, 0, &_state1, 3 },
+ { 20, 37, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 38, 46, "507b010a", 2, 255, -1, 1, 0, &_state2, 1 },
+ { 38, 46, "507b010b", 2, 255, -1, 1, 0, &_state2, 2 },
+ { 47, 59, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 60, 78, "500_014", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 79, -1, "507_007", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY14[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 8, 13, "507b011", 2, 255, -1, 4, 0, nullptr, 0 },
+ { 14, 29, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 30, -1, "507_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY15[] = {
+ { 0, -1, "507b013", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY16[] = {
+ { 0, 6, "507b002a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 6, "507b002b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 6, "507b002c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 7, 7, nullptr, 0, 0, 8, 0, 0, &_state5, 3 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY17[] = {
+ { 0, 3, "507_003", 1, 255, -1, 1, 5, nullptr, 0 },
+ { 4, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room507::PLAY18[] = {
+ { 6, 6, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 5, 5, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room507::_state1;
+long Room507::_state2;
+long Room507::_state3;
+long Room507::_state4;
+long Room507::_state5;
+
+
+Room507::Room507() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+ _state5 = 0;
+}
+
void Room507::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
index 07d58ff4955..7dc44f4cbee 100644
--- a/engines/m4/burger/rooms/section5/room507.h
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -29,8 +29,34 @@ namespace Burger {
namespace Rooms {
class Room507 : public Section5Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+ static long _state5;
+
public:
- Room507() : Section5Room() {}
+ Room507();
~Room507() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
index 5fda2bc5140..57f47ba302b 100644
--- a/engines/m4/burger/rooms/section5/room508.cpp
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -27,6 +27,132 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room508::SAID[][4] = {
+ { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
+ { "BORK", "508w003", "500w002", "500w002" },
+ { "CHRISTMAS LIGHTS ", "508w004", nullptr, "508w007" },
+ { "CHRISTMAS LIGHTS ","508w005", "508w006", "508w007" },
+ { "HOLE", "508w008", "500w001", "508w009" },
+ { "BATHROOM", "508w010", nullptr, "508w011" },
+ { "CHIMNEY", "508w012", "500w001", "508w014" },
+ { "CHIMNEY POTS", "508w012", "500w001", "508w014" },
+ { "ROOF", "508w015", "500w001", "508w016" },
+ { "FORCE FIELD", "508w017", "500w001", "500w001" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room508::PLAY1[] = {
+ { 0, 4, "508_001", 1, 255, -1, 1, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY2[] = {
+ { 0, 4, "508_001", 1, 255, -1, 1024, 0, nullptr, 0 },
+ { 5, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY3[] = {
+ { 0, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 24, 28, "508_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 29, -1, nullptr, 1, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY4[] = {
+ { 0, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 24, 27, "508_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 28, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY5[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY6[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY7[] = {
+ { 0, -1, "508b001a", 2, 255, -1, 1025, 0, &_state1, 1 },
+ { 0, -1, "508b001b", 2, 255, -1, 1025, 0, &_state1, 2 },
+ { 0, -1, "508b001c", 2, 255, -1, 1025, 0, &_state1, 3 },
+ { 0, -1, "508b001d", 2, 255, -1, 1025, 0, &_state1, 4 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY8[] = {
+ { 0, 5, "508b003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 6, 16, "500_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 17, -1, "508b001a", 2, 255, -1, 1024, 0, &_state1, 1 },
+ { 17, -1, "508b001b", 2, 255, -1, 1024, 0, &_state1, 2 },
+ { 17, -1, "508b001c", 2, 255, -1, 1024, 0, &_state1, 3 },
+ { 17, -1, "508b001d", 2, 255, -1, 1024, 0, &_state1, 4 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY9[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 12, "500_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 18, "508b005a", 2, 255, -1, 4, 6, &_state1, 1 },
+ { 13, 18, "508b005b", 2, 255, -1, 4, 6, &_state1, 2 },
+ { 19, -1, "508b001a", 2, 255, -1, 1024, 0, &_state2, 1 },
+ { 19, -1, "508b001b", 2, 255, -1, 1024, 0, &_state2, 2 },
+ { 19, -1, "508b001c", 2, 255, -1, 1024, 0, &_state2, 3 },
+ { 19, -1, "508b001d", 2, 255, -1, 1024, 0, &_state2, 4 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY10[] = {
+ { 0, 20, "508b002a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 0, 20, "508b002b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 0, 20, "508b002c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 21, -1, nullptr, 0, 0, 1, 0, 0, &_state3, 1 },
+ { 21, -1, nullptr, 0, 0, 1, 0, 0, &_state3, 2 },
+ { 21, -1, nullptr, 0, 0, 2, 0, 0, &_state3, 3 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY11[] = {
+ { 0, 10, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 11, 17, "508b006a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 11, 17, "508b006b", 2, 255, -1, 0, 0, &_state1, 2 },
+ { 11, 17, "508b006c", 2, 255, -1, 0, 0, &_state1, 3 },
+ { 11, 17, "508b006d", 2, 255, -1, 0, 0, &_state1, 4 },
+ { 18, 18, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 19, 28, "508b007a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 19, 28, "508b007b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 19, 28, "508b007c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 29, 42, "508b008a", 2, 255, -1, 0, 0, &_state4, 1 },
+ { 29, 42, "508b008b", 2, 255, -1, 0, 0, &_state4, 2 },
+ { 29, 42, "508b008c", 2, 255, -1, 0, 0, &_state4, 3 },
+ { 43, -1, "508b009", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room508::PLAY12[] = {
+ { 0, 12, "500_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 13, -1, "508b010a", 2, 255, -1, 0, 0, &_state1, 1 },
+ { 13, -1, "508b010b", 2, 255, -1, 0, 0, &_state1, 2 },
+ PLAY_BREAK_END
+};
+
+long Room508::_state1;
+long Room508::_state2;
+long Room508::_state3;
+long Room508::_state4;
+
+
+Room508::Room508() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+}
+
void Room508::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room508.h b/engines/m4/burger/rooms/section5/room508.h
index ac8aab9df4a..f764f1ec220 100644
--- a/engines/m4/burger/rooms/section5/room508.h
+++ b/engines/m4/burger/rooms/section5/room508.h
@@ -29,8 +29,27 @@ namespace Burger {
namespace Rooms {
class Room508 : public Section5Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+
public:
- Room508() : Section5Room() {}
+ Room508();
~Room508() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index 76ddd813a57..4f390756e4b 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -27,6 +27,87 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room509::SAID[][4] = {
+ { "HALLWAY", nullptr, "500w001", nullptr },
+ { "CHRISTMAS LIGHTS ", "509w002", nullptr, nullptr },
+ { "PHONE CORD", "509w005", "509w006", "509w007" },
+ { "HOLE", "509w008", "500w001", "509w009" },
+ { "ROOF BORK", nullptr, nullptr, nullptr },
+ { "BED", "509w010", nullptr, "509w011" },
+ { "MATTRESS", "509w010", nullptr, "509w011" },
+ { "PILLOW", "509w012", "509w013", "509w013" },
+ { "LAMP", "509w014", "509w015", "509w014" },
+ { "WINDOW", "500w003", nullptr, "500w004" },
+ { "CHAIR", "509w016", nullptr, "509w017" },
+ { "TELEPHONE", "509w018", "509w019", "509w020" },
+ { "BOOK", "509w021", "509w022", "509w023" },
+ { "PICTURE", "509w024", "500w005", nullptr },
+ { "PICTURE ", "509w025", "500w005", "509w026" },
+ { "PICTURE ", "509w027", "500w005", "509w026" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room509::PLAY1[] = {
+ { 0, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 18, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY2[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY3[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 15, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 16, -1, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
+ { 16, -1, "500w086", 1, 255, -1, 4, -1, &_state1, 1 },
+ { 16, -1, nullptr, 0, 0, -1, 4, 2, &_state1, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY4[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 15, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 16, -1, "509_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY5[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY6[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY7[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, -1, "509_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room509::PLAY8[] = {
+ { 0, 4, "508b003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 5, -1, "500_005", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 5, -1, "500_006", 2, 255, -1, 0, 0, &_state2, 2 },
+ PLAY_BREAK_END
+};
+
+long Room509::_state1;
+long Room509::_state2;
+
+
+Room509::Room509() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+}
+
void Room509::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
index aa45d052042..fbc5430cc60 100644
--- a/engines/m4/burger/rooms/section5/room509.h
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -29,8 +29,21 @@ namespace Burger {
namespace Rooms {
class Room509 : public Section5Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static long _state1;
+ static long _state2;
+
public:
- Room509() : Section5Room() {}
+ Room509();
~Room509() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section5/room511.cpp b/engines/m4/burger/rooms/section5/room511.cpp
index 91d6c645559..4bf2809343b 100644
--- a/engines/m4/burger/rooms/section5/room511.cpp
+++ b/engines/m4/burger/rooms/section5/room511.cpp
@@ -27,6 +27,58 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room511::SERIES1[] = {
+ { 0, "511b001a", 2, 255, -1, 0, &_state1, 1 },
+ { 0, "511b001b", 2, 255, -1, 0, &_state1, 2 },
+ { 0, "511b001c", 2, 255, -1, 0, &_state1, 3 },
+ { 0, "511b001d", 2, 255, -1, 0, &_state1, 4 },
+ { 0, "511b001e", 2, 255, -1, 0, &_state1, 5 },
+ { 0, "511b001f", 2, 255, -1, 0, &_state1, 6 },
+ { 0, "511b001g", 2, 255, -1, 0, &_state1, 7 },
+ { 0, "511b001h", 2, 255, -1, 0, &_state1, 8 },
+ { 0, "511b001e", 2, 255, -1, 0, &_state1, 9 },
+ { 0, "511b001j", 2, 255, -1, 0, &_state1, 10 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room511::SERIES2[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 1, "512f003a", 1, 255, -1, 0, &_state2, 11 },
+ { 1, "512f003b", 1, 255, -1, 0, &_state2, 12 },
+ { 1, "512f001a", 1, 255, -1, 0, &_state2, 21 },
+ { 1, "512f001b", 1, 255, -1, 0, &_state2, 22 },
+ { 1, "512f001c", 1, 255, -1, 0, &_state2, 23 },
+ { 1, "512f002a", 1, 255, -1, 0, &_state2, 31 },
+ { 33, "608_001", 2, 200, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 200, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room511::SERIES3[] = {
+ { 0, "513_001", 3, 40, -1, (uint)-1, nullptr, 0 },
+ { 0, "513w001", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "513w002", 1, 255, -1, 0, nullptr, 0 },
+ { 44, "513z001", 1, 255, -1, 0, nullptr, 0 },
+ { 51, "513w003", 1, 255, -1, 0, nullptr, 0 },
+ { 67, "513z002", 1, 255, -1, 0, nullptr, 0 },
+ { 117, "513z003", 1, 255, -1, 0, nullptr, 0 },
+ { 196, "513w005", 1, 255, -1, 0, nullptr, 0 },
+ { 209, "513z004", 1, 255, -1, 0, nullptr, 0 },
+ { 244, "513w006", 1, 255, -1, 0, nullptr, 0 },
+ { 292, "513z005", 1, 255, -1, 0, nullptr, 0 },
+ { 310, "513z006", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+long Room511::_state1;
+long Room511::_state2;
+
+
+Room511::Room511() : Section5Room() {
+ _state1 = 0;
+ _state2 = 0;
+}
+
void Room511::init() {
}
diff --git a/engines/m4/burger/rooms/section5/room511.h b/engines/m4/burger/rooms/section5/room511.h
index 62454d1a66d..9cf05071fbf 100644
--- a/engines/m4/burger/rooms/section5/room511.h
+++ b/engines/m4/burger/rooms/section5/room511.h
@@ -29,8 +29,15 @@ namespace Burger {
namespace Rooms {
class Room511 : public Section5Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+ static long _state1;
+ static long _state2;
+
public:
- Room511() : Section5Room() {}
+ Room511();
~Room511() override {}
void init() override;
Commit: 8d7bd01fc12e9d083f0660a6e0a6862bd31f6e2a
https://github.com/scummvm/scummvm/commit/8d7bd01fc12e9d083f0660a6e0a6862bd31f6e2a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 502 daemon
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index ee31c6e6ffb..d87fc383ef0 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -218,7 +218,7 @@ enum {
V182 = 182,
V183 = 183,
ROOM101_FLAG16 = 184,
- ROOM101_FLAG17 = 185,
+ V185 = 185,
V186 = 186,
V187 = 187,
V188 = 188,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index e5ab805406c..2c1ef784bd7 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -289,7 +289,7 @@ void Room101::daemon() {
_G(walker).wilbur_speech("101w532", 7);
}
} else if (!_G(flags)[ROOM101_FLAG16]) {
- switch (_G(flags)[ROOM101_FLAG17]) {
+ switch (_G(flags)[V185]) {
case 0:
case 1:
_G(walker).wilbur_speech("101w550", 7);
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 3f7432cd34e..d4f8dd95844 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -283,19 +283,19 @@ void Room502::init() {
case 505:
ws_demand_location(237, 235, 9);
ws_hide_walker();
- _val1 = _G(flags)[V196] ? 6 : 4;
+ _should = _G(flags)[V196] ? 6 : 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 506:
ws_demand_location(402, 272, 1);
- _val1 = 12;
+ _should = 12;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
- _val1 = 10001;
+ _should = 10001;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -324,10 +324,203 @@ void Room502::init() {
void Room502::daemon() {
switch (_G(kernel).trigger) {
+ case 5:
+ loadSeries3();
+ loadSeries2();
+ _series1.show("502bk01", 0x400);
+ _series2 = series_show("502spark", 0xc00);
+
+ if (_G(flags)[V185]) {
+ kernel_trigger_dispatch_now(20);
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "502end", 6, 0x100, 6);
+ } else {
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "502intro", 6, 0x100, 6);
+ }
+ break;
+
+ case 6:
+ _series1.terminate();
+ terminateMachineAndNull(_series2);
+ setup1();
+ setup2();
+ setup3();
+
+ if (_G(flags)[V185]) {
+ digi_unload_stream_breaks(SERIES2);
+ _should = 10001;
+ } else {
+ digi_unload_stream_breaks(SERIES1);
+ ws_unhide_walker();
+ _val2 = 13;
+ _should = 1;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 7:
+ ws_unhide_walker();
+
+ switch (_val2) {
+ case 13:
+ player_set_commands_allowed(true);
+ wilbur_speech("502w001");
+ break;
+
+ case 14:
+ player_set_commands_allowed(true);
+ wilbur_speech("502w002");
+ break;
+
+ case 15:
+ player_set_commands_allowed(true);
+ wilbur_speech("502w005");
+ break;
+
+ case 16:
+ player_set_commands_allowed(true);
+ wilbur_speech("502w006");
+ break;
+
+ case 17:
+ player_set_commands_allowed(true);
+ _should = 10001;
+ wilbur_speech("502w010");
+ break;
+
+ case 18:
+ player_set_commands_allowed(true);
+ wilbur_speech("502w025z");
+ break;
+
+ case 19:
+ _val4 = 34;
+ wilbur_speech("500w047");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 8:
+ if (_G(flags)[V200] == 5001) {
+ player_update_info();
+
+ if (_G(player_info).x < 242 && _G(player_info).y < 265) {
+ ws_walk(_G(player_info).x, _G(player_info).y, nullptr, -1);
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(15);
+ } else {
+ kernel_timing_trigger(15, 8);
+ }
+ }
+ break;
+
case 5002:
enable_player();
break;
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_should) {
+ case 1:
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ case 2:
+ _G(flags)[V195] = 1;
+ break;
+
+ case 3:
+ ws_demand_location(237, 235);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val6 = 5009;
+ series_play_with_breaks(PLAY1, "502wi02", 0xc01, 1, 3, 5);
+ break;
+
+ case 4:
+ _should = 10001;
+ series_play_with_breaks(PLAY2, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ series_load("502wi02");
+ series_load("502wi03");
+ series_load("502wi05");
+ series_load("502bk09");
+ ws_demand_location(237, 235, 9);
+ ws_hide_walker();
+ _should = 8;
+ series_play_with_breaks(PLAY3, "502wi02", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ break;
+
+ case 6:
+ _should = 7;
+ series_play_with_breaks(PLAY4, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ break;
+
+ case 7:
+ _should = 8;
+ series_play_with_breaks(PLAY5, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2, 5);
+ break;
+
+ case 8:
+ _val5 = 37;
+ _should = 9;
+
+ if (_G(flags)[V196]) {
+ series_play_with_breaks(PLAY7, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2);
+ } else {
+ series_play_with_breaks(PLAY6, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2);
+ }
+
+ _G(flags)[V196] = 0;
+ break;
+
+ case 9:
+ if (_G(flags)[V200] == 5003) {
+ _should = 10001;
+ } else {
+ _G(flags)[V200] = 5003;
+ _val2 = 19;
+ _should = 1;
+ }
+
+ inv_move_object("SOAPY WATER", NOWHERE);
+ inv_give_to_player("BOTTLE");
+ series_play_with_breaks(PLAY8, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 10:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _should = 11;
+ series_play_with_breaks(PLAY9, "502wi06", 0x801, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 11:
+ inv_give_to_player("KINDLING");
+ _should = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 12:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val2 = 18;
+ _should = 1;
+ series_play_with_breaks(PLAY10, "502wi07", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -384,13 +577,13 @@ void Room502::parser() {
} else if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("GEAR", "FRONT DOOR")) {
- _val1 = 2;
+ _should = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR")) {
_val6 = 5007;
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
- _val1 = 3;
+ _should = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK ") && player_said("LOOK AT") &&
!player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
@@ -400,14 +593,14 @@ void Room502::parser() {
++_state4;
} else if (player_said("TAKE", "KINDLING ")) {
if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
- _val1 = 10;
+ _should = 10;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("SOAPY WATER", "RAILING")) {
- _val1 = 5;
+ _should = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BURNING KINDLING", "FIREPLACE")) {
- _val1 = 12;
+ _should = 12;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
inv_move_object("BURNING KINDLING", NOWHERE);
} else {
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index 69aa0f860a7..b947454852c 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -60,7 +60,8 @@ private:
Series _series1;
machine *_series2 = nullptr;
bool _flag1 = false;
- int _val1 = 0;
+ int _should = 0;
+ int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
Commit: 557c77b2c638b74c11f5f4517ed9d6a3b41643e3
https://github.com/scummvm/scummvm/commit/557c77b2c638b74c11f5f4517ed9d6a3b41643e3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 502 daemon
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
engines/m4/burger/rooms/section5/section5_room.cpp
engines/m4/burger/rooms/section5/section5_room.h
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index d4f8dd95844..6cce7275c29 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -283,19 +283,19 @@ void Room502::init() {
case 505:
ws_demand_location(237, 235, 9);
ws_hide_walker();
- _should = _G(flags)[V196] ? 6 : 4;
+ _G(wilbur_should) = _G(flags)[V196] ? 6 : 4;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 506:
ws_demand_location(402, 272, 1);
- _should = 12;
+ _G(wilbur_should) = 12;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
- _should = 10001;
+ _G(wilbur_should) = 10001;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -324,6 +324,10 @@ void Room502::init() {
void Room502::daemon() {
switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val6);
+ break;
+
case 5:
loadSeries3();
loadSeries2();
@@ -349,12 +353,12 @@ void Room502::daemon() {
if (_G(flags)[V185]) {
digi_unload_stream_breaks(SERIES2);
- _should = 10001;
+ _G(wilbur_should) = 10001;
} else {
digi_unload_stream_breaks(SERIES1);
ws_unhide_walker();
_val2 = 13;
- _should = 1;
+ _G(wilbur_should) = 1;
}
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
@@ -386,7 +390,7 @@ void Room502::daemon() {
case 17:
player_set_commands_allowed(true);
- _should = 10001;
+ _G(wilbur_should) = 10001;
wilbur_speech("502w010");
break;
@@ -419,12 +423,273 @@ void Room502::daemon() {
}
break;
+ case 9:
+ if (!_flag1 && !digi_play_state(1)) {
+ _flag1 = true;
+ _series1.terminate();
+ kernel_trigger_dispatch_now(10);
+ } else {
+ kernel_timing_trigger(15, 9);
+ }
+ break;
+
+ case 10:
+ switch (_val3) {
+ case 20:
+ _flag1 = false;
+ _val3 = 21;
+ kernel_trigger_dispatch_now(10);
+ break;
+
+ case 21:
+ _val3 = imath_ranged_rand(22, 24);
+ kernel_timing_trigger(240, 360);
+ _series1.show("502bk01", 0x400);
+ break;
+
+ case 22:
+ _state1 = imath_ranged_rand(1, 9);
+ _state2 = imath_ranged_rand(1, 9);
+ _val3 = 20;
+ series_play_with_breaks(PLAY11, "502bk01", 0x400, 10, 3);
+ break;
+
+ case 23:
+ _state1 = imath_ranged_rand(1, 5);
+ _val3 = 20;
+ series_play_with_breaks(PLAY12, "502bk02", 0x400, 10, 3);
+ break;
+
+ case 24:
+ _val3 = 20;
+ series_play_with_breaks(PLAY15, "502bk01", 0x400, 10, 3);
+ break;
+
+ case 25:
+ _series1.terminate();
+ _state1 = imath_ranged_rand(1, 2);
+ _val3 = 20;
+ series_play_with_breaks(PLAY13, "502bk03", 0x400, 10, 3);
+ break;
+
+ case 26:
+ _val2 = 17;
+ _state1 = imath_ranged_rand(1, 3);
+ _val3 = 20;
+ series_play_with_breaks(PLAY14, "502bk04", 0x400, 10, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 11:
+ if (_G(flags)[V200] != 5003) {
+ player_update_info();
+
+ if ((_G(player_info).x < 242 || _G(player_info).y > 265) &&
+ !_flag1 && !digi_play_state(1)) {
+ _flag1 = true;
+ loadSeries3();
+ _val4 = _val7;
+ kernel_trigger_dispatch_now(13);
+ } else {
+ kernel_timing_trigger(15, 11);
+ }
+ }
+ break;
+
+ case 13:
+ switch (_val4) {
+ case 20:
+ digi_stop(2);
+ digi_unload("502_006");
+ _flag1 = false;
+ _val4 = 27;
+ kernel_trigger_dispatch_now(13);
+ break;
+
+ case 27:
+ _G(flags)[V200] = 5000;
+ _G(flags)[V186] = 0;
+ _walker1.terminate();
+ _val7 = imath_rand_bool(3) ? 29 : 28;
+
+ kernel_timing_trigger(imath_ranged_rand(240, 360), 11);
+ break;
+
+ case 28:
+ _val8 = 0;
+ kernel_trigger_dispatch_now(14);
+ _G(flags)[V200] = 5001;
+ _G(flags)[V186] = 1;
+ kernel_trigger_dispatch_now(8);
+ _val4 = 32;
+ _walker1.play("502bkst", 0xc00, 16, 13, 6, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 29:
+ _val8 = 0;
+ kernel_trigger_dispatch_now(14);
+ _G(flags)[V200] = 5001;
+ _G(flags)[V186] = 1;
+ kernel_trigger_dispatch_now(8);
+ _val4 = 30;
+ _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 30:
+ kernel_trigger_dispatch_now(22);
+ _val4 = 31;
+ _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 9, 18);
+ break;
+
+ case 31:
+ _val8 = 1;
+ kernel_trigger_dispatch_now(14);
+ _val4 = 32;
+ _walker1.play("502bkst", 0xc00, 0, 13, 6, 2, 100, 0, 0, 19, 22);
+ break;
+
+ case 32:
+ digi_stop(2);
+ digi_unload("502_007");
+ _walker1.terminate();
+ _val4 = 33;
+ _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 23, 32);
+ break;
+
+ case 33:
+ _G(flags)[V200] = 5002;
+ _val4 = 20;
+ _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 33, 44);
+ digi_preload("502_006");
+ digi_play("502_006", 2);
+ break;
+
+ case 34:
+ if (_flag1) {
+ kernel_timing_trigger(30, 13);
+ } else {
+ _flag1 = true;
+ _val8 = 2;
+ kernel_trigger_dispatch_now(14);
+ _val4 = 35;
+ series_play_with_breaks(PLAY16, "502bk09", 0xc00, 13, 3);
+ }
+ break;
+
+ case 35:
+ Section5::flagsTrigger();
+ _flag1 = false;
+ kernel_trigger_dispatch_now(18);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 14:
+ switch (_val8) {
+ case 0:
+ digi_play((imath_ranged_rand(1, 2) == 1) ? "502b001a" : "502b001b", 2);
+ break;
+
+ case 1:
+ digi_play((imath_ranged_rand(1, 2) == 1) ? "502b003a" : "502b003b", 2);
+ break;
+
+ case 2:
+ digi_play("502b004", 2);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 15:
+ _G(flags)[V206] = 5005;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case 16:
+ _G(flags)[V206] = 5006;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case 17:
+ switch (_val5) {
+ case 36:
+ series_show("502soap2", 0xaff);
+ break;
+
+ case 37:
+ _val5 = 38;
+ series_play("502soap1", 0xaff, 0, 17);
+ break;
+
+ case 38:
+ _val5 = 36;
+ series_play("502soap", 0xaff, 0, 17, 6, 4);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 18:
+ series_show("502windo", 0xf00);
+ break;
+
+ case 19:
+ _G(flags)[V198] = 1;
+ digi_play_loop("500_002", 3, 125);
+ series_play("502fire", 0xc00, 4);
+ break;
+
+ case 20:
+ inv_give_to_player("GIZMO");
+ break;
+
+ case 21:
+ if ((_G(flags)[V200] == 5000 || _G(flags)[V200] == 5003) &&
+ !_flag1 && !digi_play_state(1)) {
+ _flag1 = true;
+ kernel_trigger_dispatch_now(22);
+ }
+
+ kernel_timing_trigger(imath_ranged_rand(240, 360), 21);
+ break;
+
+ case 22:
+ terminateMachineAndNull(_series2);
+ _state3 = imath_ranged_rand(1, 6);
+ series_play_with_breaks(PLAY17, "502spark", 0xc00, 23, 2);
+ break;
+
+ case 23:
+ if (_G(flags)[V200] == 5000 || _G(flags)[V200] == 5003)
+ _flag1 = false;
+
+ _series2 = series_show("502spark", 0xc00);
+ break;
+
+ case 24:
+ series_play("502smoke", 0x500);
+ break;
+
case 5002:
enable_player();
break;
case gCHANGE_WILBUR_ANIMATION:
- switch (_should) {
+ switch (_G(wilbur_should)) {
case 1:
kernel_trigger_dispatch_now(7);
break;
@@ -442,7 +707,7 @@ void Room502::daemon() {
break;
case 4:
- _should = 10001;
+ _G(wilbur_should) = 10001;
series_play_with_breaks(PLAY2, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
break;
@@ -454,23 +719,23 @@ void Room502::daemon() {
series_load("502bk09");
ws_demand_location(237, 235, 9);
ws_hide_walker();
- _should = 8;
+ _G(wilbur_should) = 8;
series_play_with_breaks(PLAY3, "502wi02", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
break;
case 6:
- _should = 7;
+ _G(wilbur_should) = 7;
series_play_with_breaks(PLAY4, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
break;
case 7:
- _should = 8;
+ _G(wilbur_should) = 8;
series_play_with_breaks(PLAY5, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2, 5);
break;
case 8:
_val5 = 37;
- _should = 9;
+ _G(wilbur_should) = 9;
if (_G(flags)[V196]) {
series_play_with_breaks(PLAY7, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2);
@@ -483,11 +748,11 @@ void Room502::daemon() {
case 9:
if (_G(flags)[V200] == 5003) {
- _should = 10001;
+ _G(wilbur_should) = 10001;
} else {
_G(flags)[V200] = 5003;
_val2 = 19;
- _should = 1;
+ _G(wilbur_should) = 1;
}
inv_move_object("SOAPY WATER", NOWHERE);
@@ -498,13 +763,13 @@ void Room502::daemon() {
case 10:
player_set_commands_allowed(false);
ws_hide_walker();
- _should = 11;
+ _G(wilbur_should) = 11;
series_play_with_breaks(PLAY9, "502wi06", 0x801, gCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
inv_give_to_player("KINDLING");
- _should = 10001;
+ _G(wilbur_should) = 10001;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
break;
@@ -512,7 +777,7 @@ void Room502::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_val2 = 18;
- _should = 1;
+ _G(wilbur_should) = 1;
series_play_with_breaks(PLAY10, "502wi07", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -577,13 +842,13 @@ void Room502::parser() {
} else if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("GEAR", "FRONT DOOR")) {
- _should = 2;
+ _G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR")) {
_val6 = 5007;
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
- _should = 3;
+ _G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK ") && player_said("LOOK AT") &&
!player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
@@ -593,14 +858,14 @@ void Room502::parser() {
++_state4;
} else if (player_said("TAKE", "KINDLING ")) {
if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
- _should = 10;
+ _G(wilbur_should) = 10;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("SOAPY WATER", "RAILING")) {
- _should = 5;
+ _G(wilbur_should) = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BURNING KINDLING", "FIREPLACE")) {
- _should = 12;
+ _G(wilbur_should) = 12;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
inv_move_object("BURNING KINDLING", NOWHERE);
} else {
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index b947454852c..9d0baa01512 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -60,12 +60,13 @@ private:
Series _series1;
machine *_series2 = nullptr;
bool _flag1 = false;
- int _should = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
void loadSeries1();
void loadSeries2();
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index efb1a4f56b1..8be461e5ebe 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -397,6 +397,23 @@ void Section5::gizmoDigiPlay(const char *name, int vol, bool &done) {
}
}
+bool Section5::checkFlags() {
+ return _G(flags)[V197] && _G(flags)[V200] == 5003 &&
+ _G(flags)[V210] == 5002 && _G(flags)[V218] == 5003 &&
+ _G(flags)[V223] == 2 && _G(flags)[V227] != 0;
+}
+
+void Section5::flagsTrigger() {
+ player_set_commands_allowed(false);
+
+ if (checkFlags()) {
+ _G(wilbur_should) = 5003;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ kernel_trigger_dispatch_now(5002);
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index ee1a2d49c38..3f685f7725a 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -68,6 +68,9 @@ public:
static machine *_bork;
static const char *_digiName;
+ static bool checkFlags();
+ static void flagsTrigger();
+
public:
Section5();
virtual ~Section5() {}
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index 84accd6ab35..b857851ea15 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -78,12 +78,12 @@ void Section5Room::init() {
HotSpotRec *Section5Room::custom_hotspot_which(int32 x, int32 y) {
HotSpotRec *hotspot = Rooms::Room::custom_hotspot_which(x, y);
- if (hotspot != nullptr || _G(flags)[V186] == 0 || !verifyMachineExists(_walker1) ||
+ if (hotspot != nullptr || _G(flags)[V186] == 0 || !_walker1 ||
(_G(game).room_id != 502 && _G(game).room_id != 505))
return hotspot;
assert(_borkTable);
- int index = _walker1->myAnim8->myRegs[IDX_CELS_INDEX];
+ int index = _walker1.regs()[IDX_CELS_INDEX];
int x1 = _borkTable[index]._x;
int y1 = _borkTable[index]._y;
int total = (x - x1) * (x - x1) + (y - y1) * (y - y1);
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
index 1a49455cec1..5a95c1ae578 100644
--- a/engines/m4/burger/rooms/section5/section5_room.h
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -35,7 +35,7 @@ protected:
int16 _y;
};
const BorkPoint *_borkTable = nullptr;
- machine *_walker1 = nullptr;
+ Series _walker1;
HotSpotRec _borkHotspot;
int _borkThreshold = 0;
bool _flag1 = false;
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 51c356f9e36..9369d5c4a13 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -72,6 +72,10 @@ struct Series {
return _series != nullptr;
}
+ frac16 *regs() const {
+ return _series->myAnim8->myRegs;
+ }
+
static void series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
Commit: 7d6330a864d98fef958556c398c7e55738f8b476
https://github.com/scummvm/scummvm/commit/7d6330a864d98fef958556c398c7e55738f8b476
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 503 init
Changed paths:
engines/m4/adv_r/adv_hotspot.cpp
engines/m4/adv_r/adv_hotspot.h
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
diff --git a/engines/m4/adv_r/adv_hotspot.cpp b/engines/m4/adv_r/adv_hotspot.cpp
index ae2f7fc7257..97a9b7fc4a3 100644
--- a/engines/m4/adv_r/adv_hotspot.cpp
+++ b/engines/m4/adv_r/adv_hotspot.cpp
@@ -282,6 +282,9 @@ void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y,
i->active = active_or_not;
}
+void hotspot_set_active_xy(const char *name, int32 x, int32 y, bool active_or_not) {
+ hotspot_set_active_xy(_G(currentSceneDef).hotspots, name, x, y, active_or_not);
+}
//-----------------------------------------------------------------------
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
index ed0ebbe77ef..261ffe5e770 100644
--- a/engines/m4/adv_r/adv_hotspot.h
+++ b/engines/m4/adv_r/adv_hotspot.h
@@ -83,6 +83,7 @@ extern void hotspot_delete_all(HotSpotRec *head);
extern void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not);
extern void hotspot_set_active(const char *name, bool active_or_not);
extern void hotspot_set_active_xy(HotSpotRec *head, const char *name, int32 x, int32 y, bool active_or_not);
+extern void hotspot_set_active_xy(const char *name, int32 x, int32 y, bool active_or_not);
#define kernel_flip_hotspot(aa,bb) (hotspot_set_active(currentSceneDef.hotspots,aa,bb))
#define kernel_flip_hotspot_xy(aa,bb,xx,yy) (hotspot_set_active_xy(currentSceneDef.hotspots,aa,xx,yy,bb))
#define kernel_flip_hotspot_loc(aa,bb,xx,yy) (hotspot_set_active_xy(currentSceneDef.hotspots,aa,xx,yy,bb))
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index a9fee893eec..7cd281961c3 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -293,6 +293,88 @@ Room503::Room503() : Section5Room() {
}
void Room503::init() {
+ Section5Room::init();
+ _val1 = 0;
+
+ for (_val2 = 0; _val2 < 5; ++_val2)
+ _array1[_val2] = _array2[_val2] = -1;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 502:
+ ws_demand_location(33, 294, 3);
+
+ if (player_been_here(503)) {
+ ws_walk(195, 294, nullptr, -1);
+ } else {
+ _val4 = 9;
+ ws_walk(195, 294, nullptr, 13);
+ }
+ break;
+
+ case 504:
+ ws_demand_location(170, 253, 3);
+ ws_walk(230, 253, nullptr, -1, 3);
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ ws_demand_location(263, 333, 3);
+ break;
+ }
+
+ _state2 = 0;
+ _val5 = 0;
+ hotspot_set_active("BORK", false);
+
+ if (_G(flags)[V203] == 13) {
+ _val6 = 28;
+ kernel_trigger_dispatch_now(14);
+ kernel_trigger_dispatch_now(15);
+ } else if (inv_player_has("ROLLING PIN") && _G(flags)[V203] != 16) {
+ _val6 = 27;
+ kernel_trigger_dispatch_now(14);
+ } else if (_G(flags)[V203] != 16) {
+ loadSeries1();
+ _val5 = 1;
+ _walk1 = intr_add_no_walk_rect(272, 250, 414, 300, 260, 300);
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 340, 250, true);
+ _val6 = 14;
+ kernel_trigger_dispatch_now(14);
+ }
+
+ _state5 = inv_player_has("ROLLING PIN") ? 1 : 0;
+ hotspot_set_active("ROLLING PIN", false);
+ _val7 = 0;
+
+ if (inv_where_is("RUBBER GLOVES") == 503) {
+ hotspot_set_active("RUBBER GLOVES ", true);
+ _series1 = series_show("503glove", 0xb00);
+ } else {
+ hotspot_set_active("RUBBER GLOVES ", false);
+ }
+
+ _val8 = 0;
+ if (_G(flags)[V203] == 16) {
+ _val9 = 34;
+ } else if (_G(flags)[V203] != 13) {
+ _val9 = 33;
+ }
+
+ kernel_trigger_dispatch_now(23);
+ if (_G(flags)[V207])
+ kernel_trigger_dispatch_now(20);
+
+ _flag1 = true;
+ Section5Room::init();
}
void Room503::daemon() {
@@ -306,6 +388,23 @@ void Room503::parser() {
}
+void Room503::loadSeries1() {
+ static const char *NAMES[] = {
+ "503bk01", "503bk01s", "503bk02", "503bk02s", "503bk17",
+ "503bk17s", "503bk06", "503bk06s", "503bk07", "503bk07s",
+ "503bk06", "503bk06s", "503bk09", "503bk09s", "503bk10",
+ "503bk11", "503bk11s", "503bk12", "503bk13", "503bk13s"
+ };
+ for (int i = 0; i < 20; ++i)
+ series_load(NAMES[i]);
+
+ if (!_G(flags)[V207]) {
+ series_load("503bk08");
+ series_load("503bk08s");
+ series_load("503windo");
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index 536218e766e..f2ee270d018 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -61,6 +61,21 @@ private:
static long _state4;
static long _state5;
static long _state6;
+ int16 _array1[5];
+ int16 _array2[5];
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
+ noWalkRect *_walk1 = nullptr;
+ machine *_series1 = nullptr;
+
+ void loadSeries1();
public:
Room503();
Commit: 527db0bd5d76b038434d9a96a6f4aa2660852a56
https://github.com/scummvm/scummvm/commit/527db0bd5d76b038434d9a96a6f4aa2660852a56
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 503 pre-parser
Changed paths:
engines/m4/adv_r/adv_hotspot.cpp
engines/m4/adv_r/adv_hotspot.h
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
diff --git a/engines/m4/adv_r/adv_hotspot.cpp b/engines/m4/adv_r/adv_hotspot.cpp
index 97a9b7fc4a3..3b4565fbc8c 100644
--- a/engines/m4/adv_r/adv_hotspot.cpp
+++ b/engines/m4/adv_r/adv_hotspot.cpp
@@ -246,6 +246,10 @@ HotSpotRec *hotspot_which(HotSpotRec *head, int x, int y) {
return nullptr;
}
+HotSpotRec *hotspot_which(int x, int y) {
+ return hotspot_which(_G(currentSceneDef).hotspots, x, y);
+}
+
void hotspot_set_active(HotSpotRec *head, const char *name, bool active_or_not) {
char name_str[MAX_FILENAME_SIZE];
HotSpotRec *i;
diff --git a/engines/m4/adv_r/adv_hotspot.h b/engines/m4/adv_r/adv_hotspot.h
index 261ffe5e770..829d6648a7d 100644
--- a/engines/m4/adv_r/adv_hotspot.h
+++ b/engines/m4/adv_r/adv_hotspot.h
@@ -98,6 +98,7 @@ extern void hotspot_newPrep(HotSpotRec *h, const char *prep);
* @returns A pointer to the hotspot we're inside, or nullptr if there's nothing.
*/
extern HotSpotRec *hotspot_which(HotSpotRec *head, int x, int y);
+extern HotSpotRec *hotspot_which(int x, int y);
extern void kill_hotspot_node(HotSpotRec *h);
extern void hotspot_restore_all();
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 7cd281961c3..afed27e250d 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/rooms/section5/room503.h"
#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/vars.h"
+#include "m4/adv_r/adv_hotspot.h"
namespace M4 {
namespace Burger {
@@ -331,7 +332,7 @@ void Room503::init() {
}
_state2 = 0;
- _val5 = 0;
+ _flag1 = 0;
hotspot_set_active("BORK", false);
if (_G(flags)[V203] == 13) {
@@ -343,7 +344,7 @@ void Room503::init() {
kernel_trigger_dispatch_now(14);
} else if (_G(flags)[V203] != 16) {
loadSeries1();
- _val5 = 1;
+ _flag1 = 1;
_walk1 = intr_add_no_walk_rect(272, 250, 414, 300, 260, 300);
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 340, 250, true);
@@ -381,7 +382,50 @@ void Room503::daemon() {
}
void Room503::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if ((player_said("GEAR", "MICROWAVE") || player_said("TAKE", "MICROWAVE")) &&
+ !_val8 && _G(flags)[V203] != 13 && _G(flags)[V203] != 16) {
+ _val8 = 1;
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 2;
+ player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "RUBBER GLOVES ") && !_val7 &&
+ _G(flags)[V203] == 13 && _G(flags)[V203] != 16) {
+ _val7 = 1;
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 2;
+ player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BORK", "ROLLING PIN") &&
+ (_G(flags)[V203] == 12 || _G(flags)[V203] == 11)) {
+ _flag1 = 0;
+ intr_remove_no_walk_rect(_walk1);
+ _val6 = 26;
+ _val4 = 11;
+ _G(wilbur_should) = 1;
+ player_set_commands_allowed(false);
+ player_hotspot_walk_override(346, 283, 2, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ if (_flag1) {
+ player_update_info();
+ HotSpotRec *hotspot = hotspot_which(_G(hotspot_x), _G(hotspot_y));
+
+ if (_G(hotspot_x) > 272 && _G(hotspot_y) < 300 && player_said("FLOOR")) {
+ ws_walk(_G(hotspot_x), 301, nullptr, -1, 1);
+ } else if (hotspot->feet_x > 272 && hotspot->feet_y < 300) {
+ player_hotspot_walk_override(hotspot->feet_x, 301, 1);
+ }
+ }
+
+ if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR"))
+ player_set_facing_hotspot();
+
+ if (player_said("BASEMENT") && player_said_any("ENTER", "LOOK AT", "GEAR"))
+ player_set_facing_hotspot();
+ return;
+ }
+ _G(player).command_ready = false;
}
void Room503::parser() {
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index f2ee270d018..2300537396e 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -67,11 +67,11 @@ private:
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
- int _val5 = 0;
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
int _val9 = 0;
+ bool _flag1 = false;
noWalkRect *_walk1 = nullptr;
machine *_series1 = nullptr;
Commit: 9f316f2a28687a552a53edf7a98c1d07ed1d4490
https://github.com/scummvm/scummvm/commit/9f316f2a28687a552a53edf7a98c1d07ed1d4490
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 503 parser
Changed paths:
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index afed27e250d..11a7c378ad6 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -354,7 +354,7 @@ void Room503::init() {
_state5 = inv_player_has("ROLLING PIN") ? 1 : 0;
hotspot_set_active("ROLLING PIN", false);
- _val7 = 0;
+ _flag3 = 0;
if (inv_where_is("RUBBER GLOVES") == 503) {
hotspot_set_active("RUBBER GLOVES ", true);
@@ -363,7 +363,7 @@ void Room503::init() {
hotspot_set_active("RUBBER GLOVES ", false);
}
- _val8 = 0;
+ _flag2 = 0;
if (_G(flags)[V203] == 16) {
_val9 = 34;
} else if (_G(flags)[V203] != 13) {
@@ -385,14 +385,14 @@ void Room503::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if ((player_said("GEAR", "MICROWAVE") || player_said("TAKE", "MICROWAVE")) &&
- !_val8 && _G(flags)[V203] != 13 && _G(flags)[V203] != 16) {
- _val8 = 1;
+ !_flag2 && _G(flags)[V203] != 13 && _G(flags)[V203] != 16) {
+ _flag2 = 1;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
- } else if (player_said("TAKE", "RUBBER GLOVES ") && !_val7 &&
+ } else if (player_said("TAKE", "RUBBER GLOVES ") && !_flag3 &&
_G(flags)[V203] == 13 && _G(flags)[V203] != 16) {
- _val7 = 1;
+ _flag3 = 1;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
@@ -429,7 +429,89 @@ void Room503::pre_parser() {
}
void Room503::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ bool borkFlag = player_said("BORK") && _G(flags)[V203] == 12;
+ bool microwaveFlag = player_said("MICROWAVE");
+ bool ovenFlag = player_said("OVEN") && _G(flags)[V203] == 16;
+ bool prunesFlag = player_said("PRUNES") && _G(flags)[V203] == 16;
+
+ if (borkFlag && player_said("LOOK AT")) {
+ wilbur_speech("503w005");
+ } else if (borkFlag && player_said("GEAR")) {
+ wilbur_speech("503w006");
+ } else if (player_said("RUBBER DUCKY") && player_said("BORK")) {
+ wilbur_speech("500w031");
+ } else if (player_said("RUBBER DUCKY") && player_said("SINK")) {
+ wilbur_speech("500w034");
+ } else if (player_said("SOAPY WATER", "SINK")) {
+ wilbur_speech("500w049");
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[V203] == 16) {
+ wilbur_speech("503w011");
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[V203] == 13) {
+ wilbur_speech("503w010");
+ } else if (microwaveFlag && player_said("TAKE") && _G(flags)[V203] == 16) {
+ wilbur_speech("503w013");
+ } else if (microwaveFlag && player_said("TAKE") && _flag2) {
+ wilbur_speech("503w013");
+ } else if (microwaveFlag && player_said("GEAR") && _G(flags)[V203] == 16) {
+ wilbur_speech("503w013");
+ } else if (microwaveFlag && player_said("GEAR") && _flag2 && _G(flags)[V203] != 13) {
+ wilbur_speech("503w012");
+ } else if (player_said("RUBBER GLOVES ") && player_said("TAKE") &&
+ _G(flags)[V203] != 16 && _G(flags)[V203] != 13 && _flag3) {
+ wilbur_speech("503w012");
+ } else if (player_said("RUBBER GLOVES ") && player_said("GEAR")) {
+ wilbur_speech("503w015");
+ } else if (ovenFlag && player_said("LOOK AT")) {
+ wilbur_speech("503w021");
+ } else if (ovenFlag && player_said("GEAR")) {
+ wilbur_speech("503w023");
+ } else if (player_said("GEAR", "OVEN") && _G(flags)[V203] == 16 &&
+ _G(flags)[V203] != 13) {
+ wilbur_speech("503w022");
+ } else if (player_said("LOOK AT", "CUPBOARD ") && inv_player_has("RUBBER GLOVES")) {
+ wilbur_speech("503w027");
+ } else if (prunesFlag && player_said("LOOK AT")) {
+ wilbur_speech("503w030");
+ } else if (prunesFlag && (player_said("TAKE") || player_said("GEAR"))) {
+ wilbur_speech("503w032");
+ } else if (player_said("GEAR", "WINDOW") && _G(flags)[V207] != 0) {
+ wilbur_speech("503w033");
+ } else if (_G(walker).wilbur_said(SAID1)) {
+ // Already handled
+ } else if (player_said("TAKE", "ROLLING PIN ")) {
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "RUBBER GLOVES ") &&
+ (_G(flags)[V203] == 16 || _G(flags)[V203] == 13)) {
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BORK") && player_said("LOOK AT") &&
+ (_G(flags)[V203] == 0 || _G(flags)[V203] == 1) &&
+ !player_said_any("GIZMO", "ROLLING PIN", "SOCK", "SOAPY WATER", "RUBBER_GLOVES") &&
+ !player_said("LAXATIVE")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("GEAR", "MICROWAVE") && _G(flags)[V203] == 13) {
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("GEAR", "OVEN") && (_G(flags)[V203] == 16 || _G(flags)[V203] == 13)) {
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR")) {
+ term_message("Going into 502!");
+ _val5 = 5006;
+ kernel_trigger_dispatch_now(4);
+ } else if (player_said("BASEMENT") && player_said_any("ENTER", "LOOK AT", "GEAR")) {
+ term_message("Going into 504!");
+ _val5 = 5008;
+ kernel_trigger_dispatch_now(4);
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
void Room503::loadSeries1() {
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index 2300537396e..949da6de802 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -67,9 +67,10 @@ private:
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
+ int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
- int _val8 = 0;
+ int _flag3 = 0;
+ int _flag2 = 0;
int _val9 = 0;
bool _flag1 = false;
noWalkRect *_walk1 = nullptr;
Commit: 9e001a3eecb0a6dd3dce6e59649dbe409bbf58bf
https://github.com/scummvm/scummvm/commit/9e001a3eecb0a6dd3dce6e59649dbe409bbf58bf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 503 daemon
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index df8d5b4f14b..7830532e75d 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -268,7 +268,7 @@ void Flags::reset4() {
inv_move_object("BURNING KINDLING", 502);
inv_move_object("GIZMO", 502);
- (*this)[V203] = 0;
+ (*this)[gBORK_STATE] = 0;
(*this)[V204] = 5000;
(*this)[V205] = 0;
(*this)[V207] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index d87fc383ef0..b211076cf74 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -237,7 +237,7 @@ enum {
V200 = 200,
V201 = 201,
V202 = 202,
- V203 = 203,
+ gBORK_STATE = 203,
V204 = 204,
V205 = 205,
V206 = 206,
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 11a7c378ad6..5f8d8bf8bb1 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -246,33 +246,36 @@ const seriesPlayBreak Room503::PLAY19[] = {
{ 9, -1, "503b016a", 2, 255, -1, 0, 0, &_state1, 1 },
{ 9, -1, "503b016b", 2, 255, -1, 0, 0, &_state1, 2 },
{ 9, -1, "503b016c", 2, 255, -1, 0, 0, &_state1, 3 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room503::PLAY20[] = {
{ 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 10, -1, nullptr, 0, 0, 8, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
-const seriesPlayBreak Room503::PLAY20[] = {
+const seriesPlayBreak Room503::PLAY21[] = {
{ 0, 23, "503_003", 2, 255, -1, 0, 0, nullptr, 0 },
{ 24, 35, "503_012", 2, 255, -1, 0, 0, nullptr, 0 },
{ 36, -1, "503_005", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
-const seriesPlayBreak Room503::PLAY21[] = {
+const seriesPlayBreak Room503::PLAY22[] = {
{ 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 2, 7, "503_004", 3, 255, -1, 2, 0, nullptr, 0 },
{ 0, 1, nullptr, 0, 0, 22, 2, 0, nullptr, 0 },
PLAY_BREAK_END
};
-const seriesPlayBreak Room503::PLAY22[] = {
+const seriesPlayBreak Room503::PLAY23[] = {
{ 0, 10, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 11, -1, nullptr, 0, 0, 9, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
-const seriesPlayBreak Room503::PLAY23[] = {
+const seriesPlayBreak Room503::PLAY24[] = {
{ 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
PLAY_BREAK_END
};
@@ -295,7 +298,7 @@ Room503::Room503() : Section5Room() {
void Room503::init() {
Section5Room::init();
- _val1 = 0;
+ _flag5 = false;
for (_val2 = 0; _val2 < 5; ++_val2)
_array1[_val2] = _array2[_val2] = -1;
@@ -332,19 +335,19 @@ void Room503::init() {
}
_state2 = 0;
- _flag1 = 0;
+ _flag1 = false;
hotspot_set_active("BORK", false);
- if (_G(flags)[V203] == 13) {
+ if (_G(flags)[gBORK_STATE] == 13) {
_val6 = 28;
kernel_trigger_dispatch_now(14);
kernel_trigger_dispatch_now(15);
- } else if (inv_player_has("ROLLING PIN") && _G(flags)[V203] != 16) {
+ } else if (inv_player_has("ROLLING PIN") && _G(flags)[gBORK_STATE] != 16) {
_val6 = 27;
kernel_trigger_dispatch_now(14);
- } else if (_G(flags)[V203] != 16) {
+ } else if (_G(flags)[gBORK_STATE] != 16) {
loadSeries1();
- _flag1 = 1;
+ _flag1 = true;
_walk1 = intr_add_no_walk_rect(272, 250, 414, 300, 260, 300);
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 340, 250, true);
@@ -354,7 +357,7 @@ void Room503::init() {
_state5 = inv_player_has("ROLLING PIN") ? 1 : 0;
hotspot_set_active("ROLLING PIN", false);
- _flag3 = 0;
+ _flag3 = false;
if (inv_where_is("RUBBER GLOVES") == 503) {
hotspot_set_active("RUBBER GLOVES ", true);
@@ -363,10 +366,10 @@ void Room503::init() {
hotspot_set_active("RUBBER GLOVES ", false);
}
- _flag2 = 0;
- if (_G(flags)[V203] == 16) {
+ _flag2 = false;
+ if (_G(flags)[gBORK_STATE] == 16) {
_val9 = 34;
- } else if (_G(flags)[V203] != 13) {
+ } else if (_G(flags)[gBORK_STATE] != 13) {
_val9 = 33;
}
@@ -379,26 +382,514 @@ void Room503::init() {
}
void Room503::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ if (_flag5) {
+ kernel_trigger_dispatch_now(1);
+ } else {
+ for (_val2 = 0; _val2 < 5; ++_val2) {
+ _array1[_val2] = _array2[_val2];
+ }
+
+ kernel_trigger_dispatch_now(2);
+ }
+ break;
+
+ case 2:
+ _flag5 = true;
+
+ for (_val2 = 0; _val2 < 5; ++_val2) {
+ if (_array1[_val2] != -1) {
+ kernel_trigger_dispatch_now(_array1[_val2]);
+ _array1[_val2] = -1;
+ }
+ }
+
+ _flag5 = false;
+ break;
+
+ case 3:
+ player_set_commands_allowed(true);
+ break;
+
+ case 4:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val5);
+ break;
+
+ case 5:
+ _val7 = 31;
+ kernel_trigger_dispatch_now(24);
+ _val7 = 32;
+ _array1[0] = 24;
+ _val6 = 16;
+ _array1[1] = 14;
+ _G(flags)[V204] = 5000;
+ _state1 = imath_ranged_rand(1, 3);
+ series_play_with_breaks(PLAY8, "503bk03", 0x900, 2, 3, 8);
+ break;
+
+ case 6:
+ _val7 = 31;
+ kernel_trigger_dispatch_now(24);
+ _val9 = 35;
+ kernel_trigger_dispatch_now(23);
+ _val7 = 32;
+ _array1[0] = 24;
+ _val6 = 16;
+ _array1[1] = 14;
+
+ series_play_with_breaks(PLAY9, "503bk04", 0x900, 2, 3, 8);
+ break;
+
+ case 8:
+ if (_series4) {
+ inv_give_to_player("ROLLING PIN");
+ kernel_trigger_dispatch_now(11);
+ } else {
+ kernel_trigger_dispatch_now(18);
+ }
+ break;
+
+ case 9:
+ inv_give_to_player("RUBBER GLOVES");
+ hotspot_set_active("RUBBER GLOVES ", false);
+ break;
+
+ case 10:
+ _series4 = series_show("503rollp", 0x8ff);
+ hotspot_set_active("ROLLING PIN ", true);
+ break;
+
+ case 11:
+ terminateMachineAndNull(_series4);
+ hotspot_set_active("ROLLING PIN ", false);
+ break;
+
+ case 13:
+ ws_unhide_walker();
+
+ switch (_val4) {
+ case 9:
+ wilbur_speech("503w001");
+ break;
+ case 10:
+ wilbur_speech("503w002");
+ break;
+ case 11:
+ _val6 = 26;
+ _G(wilbur_should) = 4;
+ wilbur_speech("500w017", gCHANGE_WILBUR_ANIMATION);
+ break;
+ case 12:
+ player_set_commands_allowed(false);
+ wilbur_speech("503w003", 5001);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 14:
+ switch (_val6) {
+ case 13:
+ _G(flags)[gBORK_STATE] = 0;
+ _val8 = 1;
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 340, 250, true);
+ _val6 = 14;
+ series_play_with_breaks(PLAY1, "503bk01", 0x900, 14, 3, 8);
+ break;
+
+ case 14:
+ _val8 = 2;
+ _G(flags)[gBORK_STATE] = 1;
+ _val6 = 15;
+ series_play_with_breaks(PLAY2, "503bk02", 0x900, 14, 3, 8);
+ break;
+
+ case 15:
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ if (_G(flags)[V204] == 5001) {
+ _G(flags)[V204] = 5000;
+ kernel_trigger_dispatch_now(5);
+ } else if (_G(flags)[V204] == 5002) {
+ _G(flags)[V204] = 5001;
+ kernel_trigger_dispatch_now(6);
+ } else {
+ _val8 = 0;
+ _val6 = 18;
+ kernel_trigger_dispatch_now(14);
+ }
+ } else {
+ _val6 = 16;
+ kernel_trigger_dispatch_now(14);
+ }
+ break;
+
+ case 16:
+ _val6 = 15;
+ series_play_with_breaks(PLAY3, "503bk17", 0x900, 14, 3, 8);
+ _G(flags)[gBORK_STATE] = 1;
+ break;
+
+ case 17:
+ ++_state2;
+ _val7 = 31;
+ kernel_trigger_dispatch_now(24);
+ _val7 = 32;
+
+ switch (_G(flags)[gBORK_STATE]) {
+ case 0:
+ _val6 = 14;
+ break;
+ case 1:
+ _val6 = 16;
+ break;
+ case 4:
+ case 6:
+ case 10:
+ _val6 = 13;
+ break;
+ default:
+ term_message("bork state should not be %d in SNARL_AT_WILBUR!", _G(flags)[gBORK_STATE]);
+ break;
+ }
+
+ _array2[0] = 14;
+ _array2[1] = 24;
+ _array2[2] = 3;
+ _G(flags)[gBORK_STATE] = 2;
+ _state1 = imath_ranged_rand(1, 3);
+ _val4 = 10;
+ series_play_with_breaks(PLAY4, "503bk05", 0x900, 1, 3, 8);
+ break;
+
+ case 18:
+ _G(flags)[gBORK_STATE] = 3;
+ _val10 = imath_ranged_rand(0, 1);
+ _val6 = _val10 ? 21 : 19;
+ _state1 = imath_ranged_rand(1, 2);
+ series_play_with_breaks(PLAY5, "503bk06", 0x900, 14, 3);
+ break;
+
+ case 19:
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 290, 240, true);
+ hotspot_set_active_xy("BORK", 290, 260, true);
+ _state1 = imath_ranged_rand(1, 2);
+ _state3 = imath_ranged_rand(1, 4);
+ _state4 = imath_ranged_rand(1, 2);
+
+ if (_G(flags)[V205]) {
+ _G(flags)[gBORK_STATE] = 4;
+ _val6 = 13;
+ series_play_with_breaks(PLAY6, "503bk07", 0x900, 14, 3, 8);
+ } else {
+ _G(flags)[gBORK_STATE] = 5;
+ _G(flags)[V205] = 1;
+ _val6 = 20;
+ series_play_with_breaks(PLAY7, "503bk07", 0x900, 14, 3, 8);
+ }
+ break;
+
+ case 20:
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 430, 209, true);
+ hotspot_set_active_xy("BORK", 445, 200, true);
+ _G(flags)[gBORK_STATE] = 6;
+ _G(flags)[V207] = 1;
+ _val6 = 13;
+ _array1[0] = 14;
+ _array1[1] = 20;
+ _state1 = imath_ranged_rand(1, 4);
+ _state3 = imath_ranged_rand(1, 3);
+ _state4 = imath_ranged_rand(1, 2);
+ _state6 = imath_ranged_rand(1, 2);
+ series_play_with_breaks(PLAY10, "503bk08", 0x8fe, 2, 3, 8, 100, 0, -2);
+ break;
+
+ case 21:
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 415, 155, true);
+ _G(flags)[gBORK_STATE] = 7;
+ _state1 = imath_ranged_rand(1, 3);
+ _val6 = 22;
+ series_play_with_breaks(PLAY11, "503bk09", 0x900, 14, 3, 6, 100, 0, -2);
+ break;
+
+ case 22:
+ _G(flags)[gBORK_STATE] = 8;
+ _state1 = imath_ranged_rand(1, 5);
+ _val6 = 25;
+ series_play_with_breaks(PLAY12, "503bk10", 0x900, 14, 2, 6, 100, 0, -2);
+ break;
+
+ case 23:
+ _G(flags)[gBORK_STATE] = 9;
+ _G(flags)[V204] = 5002;
+ _val6 = 24;
+ series_play_with_breaks(PLAY15, "503bk11", 0x900, 14, 3, 6, 100, 0, -2);
+ break;
+
+ case 24:
+ kernel_trigger_dispatch_now(11);
+
+ if (_state5) {
+ kernel_trigger_dispatch_now(18);
+ } else {
+ _G(flags)[gBORK_STATE] = 10;
+ _val6 = 13;
+ series_play_with_breaks(PLAY16, "503bk12", 0x900, 14, 3, 8, 100, 0, -2);
+ }
+ break;
+
+ case 25:
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 397, 197, true);
+ _G(flags)[gBORK_STATE] = 11;
+ _val6 = 26;
+ series_play_with_breaks(PLAY13, "503bk13", 0x900, 14, 3, 6, 100, 0, -2);
+ break;
+
+ case 26:
+ _G(flags)[gBORK_STATE] = 12;
+ digi_play("503_003", 2);
+ _val6 = 27;
+ _series2.play("503bk13", 0x900, 1, 14, 6, 6, 100, 0, -2, 15, 17);
+ break;
+
+ case 27:
+ _G(flags)[gBORK_STATE] = 14;
+ _val6 = 23;
+ series_play_with_breaks(PLAY14, "503bk13", 0x900, 14, 1, 6, 100, 0, -2);
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 415, 155, true);
+ break;
+
+ case 28:
+ hotspot_set_active("BORK", false);
+ _state1 = imath_ranged_rand(1, 8);
+ series_play_with_breaks(PLAY17, "503bk15", 0x900, 14, 7, 6, 100, 0, -2);
+ break;
+
+ case 29:
+ _G(flags)[gBORK_STATE] = 15;
+ _state1 = imath_ranged_rand(1, 3);
+ series_play_with_breaks(PLAY19, "503bk14", 0x900, 18, 3, 6, 100, 0, -2);
+ break;
+
+ case 30:
+ terminateMachineAndNull(_series3);
+ _G(flags)[gBORK_STATE] = 16;
+ _state1 = imath_ranged_rand(1, 4);
+ _val4 = 12;
+ _G(wilbur_should) = 1;
+ _array1[0] = 10016;
+ _val9 = 34;
+ _array1[1] = 23;
+ _G(flags)[V204] = 5000;
+ series_play_with_breaks(PLAY18, "503bk15", 0x900, 2, 7, 6, 100, 0, -2);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 15:
+ kernel_timing_trigger(420, 16);
+ break;
+
+ case 16:
+ if (!_flag4) {
+ if (_G(roomVal2) && player_commands_allowed()) {
+ intr_cancel_sentence();
+ player_set_commands_allowed(false);
+ ws_walk(260, 300, 0, 17, 2, true);
+ } else {
+ kernel_timing_trigger(15, 16);
+ }
+ }
+ break;
+
+ case 17:
+ _val6 = 29;
+ break;
+
+ case 18:
+ _G(flags)[V206] = 5000;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case 19:
+ _val6 = 30;
+ break;
+
+ case 20:
+ series_show("503windo", 0xf00, 0, -1, -1, 0, 100, 0, -2);
+ break;
+
+ case 21:
+ series_play("503sm03", 0xf00);
+ break;
+
+ case 22:
+ digi_play_loop("503_013", 3, 125);
+ break;
+
+ case 23:
+ switch (_val9) {
+ case 33:
+ _series3 = series_show("503micro", 0xa00);
+ break;
+
+ case 34:
+ series_show("503bk15", 0xa00, 0, -1, -1, 24, 100, 0, -2);
+ break;
+
+ case 35:
+ terminateMachineAndNull(_series3);
+ _val9 = 33;
+ _series3 = series_play("503bk15", 0xa00, 1, 23, 6, 0, 100, 0, -2, 0, 2);
+ break;
+ }
+ break;
+
+ case 24:
+ switch (_val7) {
+ case 31:
+ switch (_val8) {
+ case 1:
+ _series5 = series_show("503prune", 0x900);
+ break;
+ case 2:
+ _series5 = series_show("503smhpr", 0x900);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 32:
+ terminateMachineAndNull(_series5);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 5002:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(13);
+ break;
+
+ case 2:
+ switch (_G(flags)[gBORK_STATE]) {
+ case 0:
+ case 1:
+ case 4:
+ case 6:
+ case 10:
+ _val6 = 17;
+ break;
+ case 2:
+ term_message("Wilbur waiting for bork to snarl at him but bork snarling already");
+ break;
+ default:
+ kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+ break;
+
+ case 3:
+ _state5 = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY20, "503wi01", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _series2.terminate();
+ terminateMachineAndNull(_series3);
+ _G(wilbur_should) = 10001;
+ _array1[0] = 10016;
+ _val6 = 28;
+ _array1[1] = 14;
+ _array1[2] = 15;
+ _state1 = imath_ranged_rand(1, 5);
+ series_play_with_breaks(PLAY21, "503wi02", 0x800, 2, 3);
+ _G(flags)[gBORK_STATE] = 13;
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ _flag4 = true;
+ ws_hide_walker();
+ _G(wilbur_should) = 6;
+ _G(flags)[V204] = 5003;
+ series_play_with_breaks(PLAY22, "503wi03", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 6:
+ ws_unhide_walker();
+ ws_walk(260, 300, 0, -1, 2);
+ kernel_timing_trigger(imath_ranged_rand(180, 360), 19);
+ break;
+
+ case 7:
+ terminateMachineAndNull(_series1);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY23, "503wi06", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 8:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY24, "503wi05", 0x800, gCHANGE_WILBUR_ANIMATION, 3, 6);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room503::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if ((player_said("GEAR", "MICROWAVE") || player_said("TAKE", "MICROWAVE")) &&
- !_flag2 && _G(flags)[V203] != 13 && _G(flags)[V203] != 16) {
- _flag2 = 1;
+ !_flag2 && _G(flags)[gBORK_STATE] != 13 && _G(flags)[gBORK_STATE] != 16) {
+ _flag2 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") && !_flag3 &&
- _G(flags)[V203] == 13 && _G(flags)[V203] != 16) {
- _flag3 = 1;
+ _G(flags)[gBORK_STATE] == 13 && _G(flags)[gBORK_STATE] != 16) {
+ _flag3 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK", "ROLLING PIN") &&
- (_G(flags)[V203] == 12 || _G(flags)[V203] == 11)) {
- _flag1 = 0;
+ (_G(flags)[gBORK_STATE] == 12 || _G(flags)[gBORK_STATE] == 11)) {
+ _flag1 = false;
intr_remove_no_walk_rect(_walk1);
_val6 = 26;
_val4 = 11;
@@ -430,10 +921,10 @@ void Room503::pre_parser() {
void Room503::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- bool borkFlag = player_said("BORK") && _G(flags)[V203] == 12;
+ bool borkFlag = player_said("BORK") && _G(flags)[gBORK_STATE] == 12;
bool microwaveFlag = player_said("MICROWAVE");
- bool ovenFlag = player_said("OVEN") && _G(flags)[V203] == 16;
- bool prunesFlag = player_said("PRUNES") && _G(flags)[V203] == 16;
+ bool ovenFlag = player_said("OVEN") && _G(flags)[gBORK_STATE] == 16;
+ bool prunesFlag = player_said("PRUNES") && _G(flags)[gBORK_STATE] == 16;
if (borkFlag && player_said("LOOK AT")) {
wilbur_speech("503w005");
@@ -445,20 +936,20 @@ void Room503::parser() {
wilbur_speech("500w034");
} else if (player_said("SOAPY WATER", "SINK")) {
wilbur_speech("500w049");
- } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[V203] == 16) {
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[gBORK_STATE] == 16) {
wilbur_speech("503w011");
- } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[V203] == 13) {
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[gBORK_STATE] == 13) {
wilbur_speech("503w010");
- } else if (microwaveFlag && player_said("TAKE") && _G(flags)[V203] == 16) {
+ } else if (microwaveFlag && player_said("TAKE") && _G(flags)[gBORK_STATE] == 16) {
wilbur_speech("503w013");
} else if (microwaveFlag && player_said("TAKE") && _flag2) {
wilbur_speech("503w013");
- } else if (microwaveFlag && player_said("GEAR") && _G(flags)[V203] == 16) {
+ } else if (microwaveFlag && player_said("GEAR") && _G(flags)[gBORK_STATE] == 16) {
wilbur_speech("503w013");
- } else if (microwaveFlag && player_said("GEAR") && _flag2 && _G(flags)[V203] != 13) {
+ } else if (microwaveFlag && player_said("GEAR") && _flag2 && _G(flags)[gBORK_STATE] != 13) {
wilbur_speech("503w012");
} else if (player_said("RUBBER GLOVES ") && player_said("TAKE") &&
- _G(flags)[V203] != 16 && _G(flags)[V203] != 13 && _flag3) {
+ _G(flags)[gBORK_STATE] != 16 && _G(flags)[gBORK_STATE] != 13 && _flag3) {
wilbur_speech("503w012");
} else if (player_said("RUBBER GLOVES ") && player_said("GEAR")) {
wilbur_speech("503w015");
@@ -466,8 +957,8 @@ void Room503::parser() {
wilbur_speech("503w021");
} else if (ovenFlag && player_said("GEAR")) {
wilbur_speech("503w023");
- } else if (player_said("GEAR", "OVEN") && _G(flags)[V203] == 16 &&
- _G(flags)[V203] != 13) {
+ } else if (player_said("GEAR", "OVEN") && _G(flags)[gBORK_STATE] == 16 &&
+ _G(flags)[gBORK_STATE] != 13) {
wilbur_speech("503w022");
} else if (player_said("LOOK AT", "CUPBOARD ") && inv_player_has("RUBBER GLOVES")) {
wilbur_speech("503w027");
@@ -483,20 +974,20 @@ void Room503::parser() {
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") &&
- (_G(flags)[V203] == 16 || _G(flags)[V203] == 13)) {
+ (_G(flags)[gBORK_STATE] == 16 || _G(flags)[gBORK_STATE] == 13)) {
_G(wilbur_should) = 7;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK") && player_said("LOOK AT") &&
- (_G(flags)[V203] == 0 || _G(flags)[V203] == 1) &&
+ (_G(flags)[gBORK_STATE] == 0 || _G(flags)[gBORK_STATE] == 1) &&
!player_said_any("GIZMO", "ROLLING PIN", "SOCK", "SOAPY WATER", "RUBBER_GLOVES") &&
!player_said("LAXATIVE")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
- } else if (player_said("GEAR", "MICROWAVE") && _G(flags)[V203] == 13) {
+ } else if (player_said("GEAR", "MICROWAVE") && _G(flags)[gBORK_STATE] == 13) {
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
- } else if (player_said("GEAR", "OVEN") && (_G(flags)[V203] == 16 || _G(flags)[V203] == 13)) {
+ } else if (player_said("GEAR", "OVEN") && (_G(flags)[gBORK_STATE] == 16 || _G(flags)[gBORK_STATE] == 13)) {
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR")) {
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index 949da6de802..dcccc651ba5 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -55,6 +55,7 @@ private:
static const seriesPlayBreak PLAY21[];
static const seriesPlayBreak PLAY22[];
static const seriesPlayBreak PLAY23[];
+ static const seriesPlayBreak PLAY24[];
static long _state1;
static long _state2;
static long _state3;
@@ -63,19 +64,25 @@ private:
static long _state6;
int16 _array1[5];
int16 _array2[5];
- int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
- int _flag3 = 0;
- int _flag2 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
int _val9 = 0;
+ int _val10 = 0;
bool _flag1 = false;
+ bool _flag2 = false;
+ bool _flag3 = false;
+ bool _flag4 = false;
+ bool _flag5 = false;
noWalkRect *_walk1 = nullptr;
machine *_series1 = nullptr;
-
+ Series _series2;
+ machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
void loadSeries1();
public:
Commit: c36c3d1274af50f19d8e862366bc78b7dacd309d
https://github.com/scummvm/scummvm/commit/c36c3d1274af50f19d8e862366bc78b7dacd309d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 504 methods
Changed paths:
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room504.h
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
engines/m4/burger/rooms/section5/section5_room.cpp
engines/m4/burger/rooms/section5/section5_room.h
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 5f8d8bf8bb1..5f751d3379b 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -28,7 +28,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-const char *Room503::SAID1[][4] = {
+const char *Room503::SAID[][4] = {
{ "PARLOUR", nullptr, "500w001", nullptr },
{ "BASEMENT", nullptr, "500w001", nullptr },
{ "BORK", "503w004", "500w002", "500w002" },
@@ -53,23 +53,6 @@ const char *Room503::SAID1[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
-const char *Room503::SAID2[][4] = {
- { "STAIRS", "504w002", "500w001", nullptr },
- { "BORK", "504w007", "500w002", "500w002" },
- { "BORK GUTS", "504w009", "504w010", "504w010" },
- { "DIRTY SOCK ", "504w011", nullptr, nullptr },
- { "WRINGER", "504w013", "504w015", "504w016" },
- { "BREAKER BOX", "504w017", nullptr, "504w019" },
- { "INSIDE BREAKER", "504w020", "504w021", nullptr },
- { "OUTSIDE BREAKER","504w024", "504w021", nullptr },
- { "WASHING MACHINE","504w026", nullptr, "504w027" },
- { "PAINT CAN", "504w028", "504w029", "504w030" },
- { "HOLE", nullptr, "500w001", "500w001" },
- { "LAUNDRY HAMPER", "504w030", "504w016", "504w016" },
- { "LAUNDRY HAMPER ","504w030", "504w016", "504w016" },
- { nullptr, nullptr, nullptr, nullptr }
-};
-
const seriesPlayBreak Room503::PLAY1[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
@@ -377,7 +360,7 @@ void Room503::init() {
if (_G(flags)[V207])
kernel_trigger_dispatch_now(20);
- _flag1 = true;
+ _initFlag = true;
Section5Room::init();
}
@@ -968,7 +951,7 @@ void Room503::parser() {
wilbur_speech("503w032");
} else if (player_said("GEAR", "WINDOW") && _G(flags)[V207] != 0) {
wilbur_speech("503w033");
- } else if (_G(walker).wilbur_said(SAID1)) {
+ } else if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("TAKE", "ROLLING PIN ")) {
_G(wilbur_should) = 3;
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index dcccc651ba5..ce061abf463 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -30,8 +30,7 @@ namespace Rooms {
class Room503 : public Section5Room {
private:
- static const char *SAID1[][4];
- static const char *SAID2[][4];
+ static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 0089ab225a1..0c2d07e1d50 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -28,19 +28,19 @@ namespace Burger {
namespace Rooms {
const char *Room504::SAID[][4] = {
- { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
- { "BATHROOM", nullptr, "500w001", nullptr },
- { "AUNT POLLY'S ROOM", nullptr, "500w001", nullptr },
- { "STAIRS", nullptr, "505w001", "500w001" },
- { "STAIRWAY BORK", "505w003", "500w002", "500w002" },
- { "RAILING", "505w004", nullptr, "505w006" },
- { "WINDOW", "500w003", nullptr, "500w004" },
- { "CEILING FAN", "505w008", nullptr, nullptr },
- { "CHANDELIER", "505w009", nullptr, nullptr },
- { "VASE", "505w010", "505w011", "505w012" },
- { "PICTURE", "505w013", "500w005", "505w014" },
- { "PICTURE ", "505w015", "500w005", "505w014" },
- { "PICTURE ", "505w016", "500w005", "505w014" },
+ { "STAIRS", "504w002", "500w001", nullptr },
+ { "BORK", "504w007", "500w002", "500w002" },
+ { "BORK GUTS", "504w009", "504w010", "504w010" },
+ { "DIRTY SOCK ", "504w011", nullptr, nullptr },
+ { "WRINGER", "504w013", "504w015", "504w016" },
+ { "BREAKER BOX", "504w017", nullptr, "504w019" },
+ { "INSIDE BREAKER", "504w020", "504w021", nullptr },
+ { "OUTSIDE BREAKER","504w024", "504w021", nullptr },
+ { "WASHING MACHINE","504w026", nullptr, "504w027" },
+ { "PAINT CAN", "504w028", "504w029", "504w030" },
+ { "HOLE", nullptr, "500w001", "500w001" },
+ { "LAUNDRY HAMPER", "504w030", "504w016", "504w016" },
+ { "LAUNDRY HAMPER ","504w030", "504w016", "504w016" },
{ nullptr, nullptr, nullptr, nullptr }
};
@@ -193,17 +193,150 @@ Room504::Room504() : Section5Room() {
}
void Room504::init() {
+ Section5Room::init();
+ _initFlag = false;
+
+ if (_G(flags)[V210] == 5002) {
+ series_show("504bk10", 0x910);
+ series_show("504bk10s", 0x910);
+ hotspot_set_active("BORK", false);
+ hotspot_set_active("BORK GUTS", true);
+ } else {
+ _val1 = 25;
+ kernel_trigger_dispatch_now(25);
+ _G(kernel).call_daemon_every_loop = true;
+ hotspot_set_active("BORK GUTS", false);
+ hotspot_set_active("BORK", true);
+ }
+
+ if (!_G(flags)[V213]) {
+ _val2 = 31;
+ kernel_trigger_dispatch_now(7);
+ } else if (_G(flags)[V210] == 5002) {
+ _G(flags)[V213] = 2;
+ _val2 = 32;
+ kernel_trigger_dispatch_now(7);
+ }
+
+ _val3 = (_G(flags)[V211] == 5001) ? 35 : 34;
+ kernel_trigger_dispatch_now(8);
+ _val4 = (_G(flags)[V212] == 5001) ? 35 : 34;
+ kernel_trigger_dispatch_now(9);
+
+ if (inv_object_is_here("DIRTY SOCK") && _G(flags)[V210] != 5002) {
+ _series1 = series_show("504SOCK", 0xf00);
+ } else {
+ hotspot_set_active("DIRTY SOCK ", false);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 501:
+ player_set_commands_allowed(true);
+ ws_demand_location(133, 320);
+ break;
+
+ case 503:
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(133, 320);
+ break;
+ }
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room504::daemon() {
}
void Room504::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ if (player_said("STAIRS") && player_said_any("CLIMB", "GEAR"))
+ player_set_facing_hotspot();
}
void Room504::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT", "BORK")) {
+ switch (_G(flags)[V210]) {
+ case 5000:
+ wilbur_speech("504w003");
+ break;
+ case 5001:
+ wilbur_speech("504w008");
+ break;
+ default:
+ break;
+ }
+ } else if (player_said("RUBBER DUCKY", "BORK")) {
+ wilbur_speech("500w036");
+ } else if (player_said("SOAPY WATER", "BORK")) {
+ wilbur_speech("500w050");
+ } else if (player_said("GEAR", "DIRTY SOCK ")) {
+ wilbur_speech("500w012");
+ } else if (player_said("LOOK AT", "WRINGER") && _G(flags)[V210] == 5002) {
+ wilbur_speech("504w014");
+ } else if (player_said("LOOK AT", "OUTSIDE BREAKER") && _G(flags)[V212] == 5000) {
+ wilbur_speech("504w025");
+ } else if (player_said("GEAR", "WASHING MACHINE") && _G(flags)[V210] == 5002) {
+ wilbur_speech("504w016");
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("CLIMB", "STAIRS") || player_said("GEAR", "STAIRS")) {
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_DAEMON;
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "DIRTY SOCK ")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("DIRTY SOCK", "WRINGER")) {
+ player_set_commands_allowed(false);
+ _flag1 = true;
+ } else if (player_said("GEAR", "INSIDE BREAKER")) {
+ if (_G(flags)[V211] == 5000) {
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 7;
+ _G(flags)[V211] = 5000;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("GEAR", "OUTSIDE BREAKER")) {
+ if (_G(flags)[V212] == 5000) {
+ _G(wilbur_should) = 11;
+ _G(flags)[V212] = 5001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 10;
+ _G(flags)[V212] = 5000;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("LOOK AT", "HOLE")) {
+ _val5 = 19;
+ kernel_trigger_dispatch_now(4);
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
index 2327bbb873f..f8f9a7fb666 100644
--- a/engines/m4/burger/rooms/section5/room504.h
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -52,6 +52,13 @@ private:
static long _state3;
static long _state4;
static long _state5;
+ bool _flag1 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ machine *_series1 = nullptr;
public:
Room504();
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 721c0062855..258be81b571 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -27,6 +27,23 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room505::SAID[][4] = {
+ { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
+ { "BATHROOM", nullptr, "500w001", nullptr },
+ { "AUNT POLLY'S ROOM", nullptr, "500w001", nullptr },
+ { "STAIRS", nullptr, "505w001", "500w001" },
+ { "STAIRWAY BORK", "505w003", "500w002", "500w002" },
+ { "RAILING", "505w004", nullptr, "505w006" },
+ { "WINDOW", "500w003", nullptr, "500w004" },
+ { "CEILING FAN", "505w008", nullptr, nullptr },
+ { "CHANDELIER", "505w009", nullptr, nullptr },
+ { "VASE", "505w010", "505w011", "505w012" },
+ { "PICTURE", "505w013", "500w005", "505w014" },
+ { "PICTURE ", "505w015", "500w005", "505w014" },
+ { "PICTURE ", "505w016", "500w005", "505w014" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
const Section5Room::BorkPoint Room505::BORK[] = {
{ -1, -1 }, { 257, 255 }, { 266, 257 }, { 271, 250 }, { 292, 246 },
{ 317, 251 }, { 323, 256 }, { 338, 237 }, { 370, 227 }, { 348, 187 },
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index 54358614ff3..84acf3a83df 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -30,6 +30,7 @@ namespace Rooms {
class Room505 : public Section5Room {
private:
+ static const char *SAID[][4];
static const BorkPoint BORK[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index b857851ea15..f81ddc6e24d 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -31,12 +31,12 @@ namespace Rooms {
void Section5Room::preload() {
Rooms::Room::preload();
_G(flags)[V186] = 0;
- _flag1 = false;
+ _initFlag = false;
}
void Section5Room::init() {
- if (_flag1) {
- _flag1 = false;
+ if (_initFlag) {
+ _initFlag = false;
kernel_timing_trigger(120, 5004);
}
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
index 5a95c1ae578..8599b821361 100644
--- a/engines/m4/burger/rooms/section5/section5_room.h
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -38,7 +38,7 @@ protected:
Series _walker1;
HotSpotRec _borkHotspot;
int _borkThreshold = 0;
- bool _flag1 = false;
+ bool _initFlag = false;
public:
Section5Room() : Rooms::Room() {
Commit: 11554f5e772f13ea8f58d364fef9266121524852
https://github.com/scummvm/scummvm/commit/11554f5e772f13ea8f58d364fef9266121524852
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 504 daemon
Changed paths:
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room504.h
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 0c2d07e1d50..672fdf609a0 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -261,6 +261,369 @@ void Room504::init() {
}
void Room504::daemon() {
+ switch (_G(kernel).trigger) {
+ case 4:
+ ws_unhide_walker();
+
+ switch (_val5) {
+ case 13:
+ wilbur_speech("504w001");
+ break;
+ case 15:
+ wilbur_speech("504w005");
+ break;
+ case 16:
+ wilbur_speech("504w006", 5001);
+ break;
+ case 18:
+ wilbur_speech("504w023");
+ break;
+ case 19:
+ _val5 = 20;
+ wilbur_speech("504w031");
+ break;
+ case 20:
+ wilbur_speech("504w032");
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ switch (_val1) {
+ case 21:
+ if (_flag1) {
+ _val1 = 26;
+ kernel_trigger_dispatch_now(5);
+ _G(wilbur_should) = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _val1 = imath_ranged_rand(0, 100) >= 75 ? 25 : 22;
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
+ case 22:
+ _G(flags)[V210] = 5000;
+ _state2 = imath_ranged_rand(1, 2);
+ _val1 = 21;
+ series_play_with_breaks(PLAY12, "504bk01", 0x850, 5, 2, 12, 100);
+ break;
+
+ case 23:
+ _state2 = imath_ranged_rand(1, 3);
+ _G(wilbur_should) = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _val1 = 21;
+ series_play_with_breaks(PLAY14, "504BK09", 0x850, 5, 2, 12);
+ break;
+
+ case 24:
+ _G(flags)[V206] = 5002;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, 5015);
+ break;
+
+ case 25:
+ _G(flags)[V210] = 5001;
+ _state2 = imath_ranged_rand(1, 3);
+ _state3 = imath_ranged_rand(1, 2);
+ _state4 = imath_ranged_rand(1, 2);
+ _val1 = 21;
+
+ series_play_with_breaks(PLAY11, "504WBORK", 0x850, 5, 2, 12, 100);
+ break;
+
+ case 26:
+ _G(flags)[V210] = 5002;
+ _G(kernel).call_daemon_every_loop = false;
+ _series3 = series_show("504bk01", 0x850);
+ break;
+
+ case 27:
+ terminateMachineAndNull(_series3);
+ _state2 = imath_ranged_rand(1, 3);
+ _state3 = imath_ranged_rand(1, 2);
+ _val1 = 28;
+ series_play_with_breaks(PLAY13, "504BK08", 0x850, 5, 3);
+ break;
+
+ case 28:
+ _val2 = 32;
+ kernel_trigger_dispatch_now(7);
+
+ _series3 = series_show("504bk10", 0x910);
+ _series3s = series_show("504bk10s", 0x911);
+
+ hotspot_set_active("BORK GUTS", true);
+ hotspot_set_active("BORK", false);
+
+ _val5 = 16;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6: {
+ static const char *NAMES[5] = {
+ "504SPRK1", "504SPRK2", "504SPRK3", "504SPRK4", "504SPRK5" };
+ _sparkName = NAMES[imath_ranged_rand(0, 4)];
+ _state5 = imath_ranged_rand(1, 6);
+ series_play_with_breaks(PLAY16, _sparkName, 0x910, -1, 2, 6, 100);
+ break;
+ }
+
+ case 7:
+ switch (_val2) {
+ case 29:
+ switch (imath_ranged_rand(0, 6)) {
+ case 0:
+ case 1:
+ case 2:
+ _val2 = 32;
+ break;
+ case 3:
+ case 4:
+ _val2 = 31;
+ break;
+ default:
+ _val2 = 30;
+ break;
+ }
+
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ case 30:
+ if (_G(flags)[V213] != 1) {
+ _G(flags)[V213] = 1;
+ kernel_trigger_dispatch_now(6);
+ }
+
+ _val2 = 29;
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ case 31:
+ _G(flags)[V213] = 0;
+ _val2 = 32;
+ _val8 = imath_ranged_rand(0, 10);
+ series_play_with_breaks(PLAY15, "504WASH", 0x900, 7, 2, 6, 100);
+ break;
+
+ case 32:
+ _G(flags)[V213] = 2;
+ _val2 = 29;
+ _series4 = series_show("504wash", 0x900, 0, 7, 300);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 8:
+ switch (_val3) {
+ case 34:
+ terminateMachineAndNull(_series2);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 0);
+ break;
+
+ case 35:
+ _series2 = series_show("504IBOFF", 0x900);
+ pal_fade_init(_G(kernel).first_fade, 255, 1, 10, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ switch (_val4) {
+ case 34:
+ terminateMachineAndNull(_series5);
+ break;
+ case 35:
+ _series5 = series_show("504OBOFF", 0x900);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 10:
+ switch (_val7) {
+ case 36:
+ terminateMachineAndNull(_series1);
+ hotspot_set_active("DIRTY SOCK ", false);
+ inv_give_to_player("DIRTY SOCK");
+ break;
+
+ case 37:
+ _series1 = series_show("504SOCK", 0xf00);
+ hotspot_set_active("DIRTY SOCK ", true);
+ inv_move_object("DIRTY SOCK", NOWHERE);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5002:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 2:
+ ws_demand_location(133, 320, 5);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ if (player_been_here(504)) {
+ _G(wilbur_should) = 10001;
+ } else {
+ _val5 = 13;
+ _G(wilbur_should) = 1;
+ }
+
+ series_play_with_breaks(PLAY1, "504wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY2, "504wi02", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 60, 5007);
+ break;
+
+ case 5:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY8, "504wi06", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 6:
+ ws_demand_facing(4);
+ ws_hide_walker();
+ _val1 = 27;
+ _G(wilbur_should) = 39;
+
+ series_play_with_breaks(PLAY9, "504Wi07", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ inv_move_object("DIRTY SOCK", NOWHERE);
+ break;
+
+ case 7:
+ _val5 = 18;
+ _G(wilbur_should) = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val3 = 34;
+
+ series_play_with_breaks(PLAY3, "504wi3b", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ _G(flags)[V211] = 5000;
+ break;
+
+ case 8:
+ _G(wilbur_should) = 9;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val3 = 35;
+ series_play_with_breaks(PLAY4, "504Wi3A", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ _G(flags)[V211] = 5001;
+ break;
+
+ case 9:
+ digi_play("504w022", 1);
+ _G(wilbur_should) = 7;
+ series_play_with_breaks(PLAY5, "504wi10", 0x200, -1, 2, 12);
+ break;
+
+ case 10:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val4 = 34;
+ series_play_with_breaks(PLAY6, "504Wi4B", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 11:
+ _G(wilbur_should) = 10001;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val4 = 35;
+ series_play_with_breaks(PLAY7, "504Wi4A", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 12: {
+ _val5 = 15;
+ _G(wilbur_should) = 1;
+ _state1 = imath_ranged_rand(1, 6);
+ int x = (double)(_state1 * _G(player_info).scale * 42) * 0.01 - _G(player_info).x;
+
+ ws_demand_location(x, _G(player_info).y);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY10, "504Wi08", 0x200, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ break;
+ }
+
+ case 39:
+ ws_unhide_walker();
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ case gCALLED_EACH_LOOP:
+ player_update_info();
+
+ if (_G(player_info).x > 300 && _G(player_info).y > 307) {
+ if (!_G(flags)[V214]) {
+ _G(flags)[V214] = 1;
+
+ if (_G(flags)[V210] != 5002) {
+ if (_val6 >= 3) {
+ _G(kernel).call_daemon_every_loop = false;
+ _val1 = 24;
+ kernel_trigger_dispatch_now(5);
+ } else {
+ ++_val6;
+ _val1 = 23;
+ player_set_commands_allowed(false);
+ intr_cancel_sentence();
+ _G(player).command_ready = false;
+
+ player_update_info();
+ ws_demand_location(_G(player_info).x, _G(player_info).y, 3);
+ }
+ }
+ }
+ } else {
+ _G(flags)[V214] = 0;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room504::pre_parser() {
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
index f8f9a7fb666..76741c0f674 100644
--- a/engines/m4/burger/rooms/section5/room504.h
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -58,7 +58,16 @@ private:
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_series3s = nullptr;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
+ const char *_sparkName = nullptr;
public:
Room504();
Commit: aaea20603c02e9d2f251fb6eef1bbdf818b85563
https://github.com/scummvm/scummvm/commit/aaea20603c02e9d2f251fb6eef1bbdf818b85563
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented room 505
Changed paths:
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 258be81b571..7f0c132129a 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -66,19 +66,266 @@ const seriesPlayBreak Room505::PLAY2[] = {
PLAY_BREAK_END
};
+Room505::Room505() : Section5Room() {
+ Common::strcpy_s(_bork, "BORK");
+ Common::strcpy_s(_lookAt, "LOOK AT");
+ _borkHotspot.vocab = _bork;
+ _borkHotspot.verb = _lookAt;
+ _borkHotspot.prep = _bork;
+ _borkHotspot.feet_x = 339;
+ _borkHotspot.feet_y = 305;
+ _borkHotspot.facing = 11;
+ _borkHotspot.cursor_number = kArrowCursor;
+ _borkThreshold = 1600;
+}
void Room505::init() {
+ Section5Room::init();
+ pal_cycle_init(112, 127, 6);
+ player_set_commands_allowed(false);
+ _G(flags)[V246] = 0;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 502:
+ ws_demand_location(333, 271, 3);
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 506:
+ ws_demand_location(52, 349, 3);
+ ws_walk(328, 323, nullptr, -1, -1);
+ player_set_commands_allowed(true);
+ break;
+
+ case 507:
+ ws_demand_location(84, 308, 3);
+ ws_walk(328, 323, nullptr, -1, -1);
+ player_set_commands_allowed(true);
+ break;
+
+ case 509:
+ ws_demand_location(497, 311, 9);
+ ws_walk(328, 323, nullptr, -1, -1);
+ player_set_commands_allowed(true);
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(328, 323);
+ break;
+ }
+
+ if (_G(flags)[V200] == 5003) {
+ kernel_trigger_dispatch_now(7);
+ } else {
+ series_load("505bk01");
+ series_load("505bk01s");
+ _borkTable = BORK;
+ _val1 = 7;
+ _G(flags)[V186] = 1;
+ kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(2);
+ }
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room505::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val2);
+ break;
+
+ case 2:
+ if (_G(flags)[V200] == 5000) {
+ player_update_info();
+
+ if (_G(player_info).y > 280 && _G(player_info).y < 300) {
+ ws_walk(_G(player_info).x, _G(player_info).y, nullptr, -1, -1);
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(6);
+ } else {
+ kernel_timing_trigger(15, 2);
+ }
+ }
+ break;
+
+ case 3:
+ player_update_info();
+
+ if (_G(player_info).y > 300) {
+ _val1 = _val3;
+ kernel_trigger_dispatch_now(4);
+ } else {
+ kernel_timing_trigger(15, 3);
+ }
+ break;
+
+ case 4:
+ switch (_val1) {
+ case 4:
+ _G(flags)[186] = 0;
+ _walker1.terminate();
+ _val3 = 5;
+ kernel_timing_trigger(imath_ranged_rand(240, 360), 3);
+ break;
+
+ case 5:
+ _G(flags)[V186] = 1;
+ _G(flags)[V200] = 5000;
+ _val1 = 6;
+ _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 6:
+ _val4 = 0;
+ kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(2);
+ _val1 = 7;
+ _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 3, 9);
+ break;
+
+ case 7:
+ terminateMachineAndNull(_series1);
+ _val1 = 8;
+ _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 10, 24);
+ _val4 = 1;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 8:
+ _val1 = 9;
+ _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 25, 24);
+ _val4 = 2;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 9:
+ _G(flags)[V200] = 5001;
+ _val1 = 4;
+ _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 27, 31);
+ _val4 = 3;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 5:
+ switch (_val4) {
+ case 0:
+ digi_play((imath_ranged_rand(1, 2) == 1) ? "505b001a" : "505b001b", 2);
+ break;
+
+ case 1:
+ digi_play("505b002", 2);
+ break;
+
+ case 2:
+ digi_play("505b003", 2);
+ break;
+
+ case 3:
+ digi_play((imath_ranged_rand(1, 2) == 1) ? "505b004a" : "505b004b", 2);
+ break;
+ }
+ break;
+
+ case 6:
+ _G(flags)[V206] = 5005;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+ ws_demand_location(333, 271, 3);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY1, "505wi01", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val2 = 5006;
+ kernel_timing_trigger(30, 1);
+ series_play_with_breaks(PLAY2, "505wi02", 0xc00, -1, 3);
+ break;
+
+ case 3:
+ _G(wilbur_should) = 2;
+ wilbur_speech("500w054", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room505::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ if ((player_said("WILBUR'S ROOM") || player_said("BATHROOM") || player_said("AUNT POLLY'S ROOM")) &&
+ player_said_any("ENTER", "LOOK AT", "GEAR"))
+ player_set_facing_hotspot();
}
void Room505::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ bool railingFlag = player_said("RAILING") && _G(flags)[V200] == 5003;
+ if (player_said("LOOK AT", "STAIRS") && _G(flags)[V200] == 5003) {
+ wilbur_speech("505w002");
+ } else if (railingFlag && player_said("LOOK AT")) {
+ wilbur_speech("505w005");
+ } else if (railingFlag && player_said("GEAR")) {
+ wilbur_speech("505w007");
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("WILBUR'S ROOM") && player_said_any("GEAR", "ENTER", "LOOK AT")) {
+ _val2 = 5010;
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("LOOK AT", "BATHROOM") && player_said("GEAR", "BATHROOM")) {
+ _val2 = 5011;
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("LOOK AT", "AUNT POLLY'S ROOM") || player_said("GEAR", "AUNT POLLY'S ROOM")) {
+ _val2 = 5013;
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("GEAR", "STAIRS")) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("SOAPY WATER", "RAILING")) {
+ _G(flags)[V196] = 1;
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index 84acf3a83df..49bd2a9d3ad 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -34,9 +34,15 @@ private:
static const BorkPoint BORK[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
+ char _bork[8], _lookAt[8];
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ machine *_series1 = nullptr;
public:
- Room505() : Section5Room() {}
+ Room505();
~Room505() override {}
void init() override;
Commit: c4008fb1d5de28043b6524a8cf5b71120043be8c
https://github.com/scummvm/scummvm/commit/c4008fb1d5de28043b6524a8cf5b71120043be8c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 506 methods
Changed paths:
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room506.h
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 7f0c132129a..832aea38cf8 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -251,6 +251,10 @@ void Room505::daemon() {
kernel_trigger_dispatch_now(5015);
break;
+ case 7:
+ _series1 = series_play("505fan", 0xbff);
+ break;
+
case gCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index dccfb4f1573..e27e35b7549 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -121,17 +121,143 @@ Room506::Room506() : Section5Room() {
}
void Room506::init() {
+ Section5Room::init();
+ pal_cycle_init(112, 127, 6);
+
+ for (_ctr = 0; _ctr < 5; ++_ctr)
+ _array1[_ctr] = -1;
+
+ if (_G(flags)[V219]) {
+ kernel_trigger_dispatch_now(12);
+ } else {
+ hotspot_set_active("FIRE", false);
+ }
+
+ if (_G(flags)[V219] == 0) {
+ _val1 = 19;
+ kernel_trigger_dispatch_now(10);
+ }
+
+ if (_G(flags)[V219]) {
+ series_show("506windo", 0xf00);
+ } else {
+ hotspot_set_active("ROOF", false);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 505:
+ if (_G(flags)[V218] != 5003)
+ _G(flags)[V218] = 5000;
+
+ player_set_commands_allowed(true);
+ ws_demand_location(543, 252, 9);
+
+ if (player_been_here(506)) {
+ ws_walk(434, 254, nullptr, -1, 9);
+ } else {
+ ws_walk(434, 254, nullptr, 6, 9);
+ }
+ break;
+
+ case 508:
+ if (_G(flags)[V218] != 5003)
+ _G(flags)[V218] = 5000;
+
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(434, 254, 9);
+ break;
+ }
+
+ _state2 = 0;
+
+ if (_G(flags)[V218] == 5003) {
+ hotspot_set_active("BORK", false);
+ } else {
+ loadSeries();
+ _val2 = 12;
+ kernel_trigger_dispatch_now(7);
+ _walk1 = intr_add_no_walk_rect(308, 278, 430, 314, 303, 328);
+ }
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room506::daemon() {
+ // TODO
}
void Room506::pre_parser() {
-
+ if (player_said("AMPLIFIER", "TELEVISION") && _G(flags)[V218] != 5003) {
+ _G(wilbur_should) = 4;
+ player_hotspot_walk_override(456, 245, 8, gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ } else if (player_said("FIRE", "KINDLING")) {
+ _G(wilbur_should) = 7;
+ player_hotspot_walk_override(409, 311, 4, gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ } else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
+ player_set_facing_hotspot();
+ }
}
void Room506::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("GEAR") && player_said_any("WINDOW", "ROOF") && !_G(flags)[V219]) {
+ wilbur_speech("500w004");
+ } else if (player_said("TELEVISION") && player_said("LOOK AT")) {
+ wilbur_speech("506w006");
+ } else if (player_said("TELEVISION") && player_said("GEAR")) {
+ wilbur_speech("506w008");
+ } else if (_G(flags)[V219] != 0 && player_said("VIDEO GAME") &&
+ player_said_any("TAKE", "GEAR")) {
+ // No implementation
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // No implementation
+ } else if (player_said("BORK") && player_said("LOOK AT") &&
+ !player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
+ !player_said("LAXATIVE")) {
+ player_set_commands_allowed(false);
+ _val2 = 15;
+ ++_state2;
+ } else if (player_said_any("ROOF", "WINDOW") && !player_said_any("ENTER", "GEAR") &&
+ _G(flags)[V219]) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
+ _val3 = 5009;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+void Room506::loadSeries() {
+ series_load("506bk01");
+ series_load("506bk01s");
+ series_load("506bk02");
+ series_load("506bk02s");
+ series_load("506bk03");
+ series_load("506bk03s");
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
index e70421ae703..8ca4a84511b 100644
--- a/engines/m4/burger/rooms/section5/room506.h
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -40,6 +40,14 @@ private:
static const seriesPlayBreak PLAY6[];
static long _state1;
static long _state2;
+ noWalkRect *_walk1 = nullptr;
+ int _array1[5];
+ int _ctr = 0;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+
+ void loadSeries();
public:
Room506();
Commit: 03ee36e5d08c17b3585efb4147839b28f14a908b
https://github.com/scummvm/scummvm/commit/03ee36e5d08c17b3585efb4147839b28f14a908b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 506 daemon
Changed paths:
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room506.h
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index e27e35b7549..9ad70861389 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -125,7 +125,7 @@ void Room506::init() {
pal_cycle_init(112, 127, 6);
for (_ctr = 0; _ctr < 5; ++_ctr)
- _array1[_ctr] = -1;
+ _triggers[_ctr] = -1;
if (_G(flags)[V219]) {
kernel_trigger_dispatch_now(12);
@@ -200,7 +200,254 @@ void Room506::init() {
}
void Room506::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ ws_walk(434, 254, nullptr, 2, 9);
+ break;
+
+ case 2:
+ player_set_commands_allowed(true);
+ break;
+
+ case 3:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val3);
+ break;
+
+ case 4:
+ for (_ctr = 0; _ctr < 5; ++_ctr) {
+ if (_triggers[_ctr] != -1) {
+ kernel_trigger_dispatch_now(_triggers[_ctr]);
+ _triggers[_ctr] = -1;
+ }
+ }
+ break;
+
+ case 5:
+ inv_put_thing_in("KINDLING", NOWHERE);
+ break;
+
+ case 6:
+ ws_unhide_walker();
+
+ switch (_val4) {
+ case 9:
+ wilbur_speech("506w001");
+ break;
+
+ case 10:
+ wilbur_speech("506w002");
+ break;
+
+ case 11:
+ wilbur_speech("506w003", 5001);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ switch (_val2) {
+ case 12:
+ kernel_trigger_dispatch_now(8);
+ _G(flags)[V218] = 5000;
+ _val2 = imath_ranged_rand(0, 2) == 0 ? 14 : 13;
+ _loopCount = imath_ranged_rand(2, 4);
+
+ series_play("506bk01", 0x3ff, 0, 7, 6, _loopCount, 100, 6, 10, 0, 8);
+ series_play("506bk01s", 0x400, 0, -1, 6, _loopCount, 100, 6, 10, 0, 8);
+ break;
+
+ case 13:
+ _G(flags)[V218] = 5001;
+ _val1 = 20;
+ kernel_trigger_dispatch_now(10);
+
+ _state1 = imath_ranged_rand(1, 2);
+ _val2 = 12;
+ series_play_with_breaks(PLAY4, "506bk01", 0x3ff, 7, 3, 6, 100, 6, 10);
+ break;
+
+ case 14:
+ _G(flags)[V218] = 5002;
+ _val1 = 22;
+ kernel_trigger_dispatch_now(10);
+
+ _state1 = imath_ranged_rand(1, 2);
+ _val2 = 12;
+ series_play_with_breaks(PLAY5, "506bk01", 0x3ff, 7, 3, 6, 100, 6, 10);
+ break;
+
+ case 15:
+ _state1 = imath_ranged_rand(1, 2);
+ _val4 = 10;
+ _val2 = 16;
+ series_play_with_breaks(PLAY6, "506bk02", 0x3ff, 7, 3, 6, 100, 6, 10);
+ break;
+
+ case 16:
+ _val2 = 12;
+ kernel_trigger_dispatch_now(7);
+ player_set_commands_allowed(true);
+ break;
+
+ case 17:
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 18:
+ intr_remove_no_walk_rect(_walk1);
+ hotspot_set_active("BORK", false);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 8:
+ digi_play(Common::String::format("506b001%c", 'a' + imath_ranged_rand(0, 5)).c_str(), 2);
+ break;
+
+ case 9:
+ _G(flags)[V206] = 5004;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case 10:
+ switch (_val1) {
+ case 19:
+ term_message("The game is Defender!");
+ _series1 = series_play("506game", 0x2fe, 2, -1, 10, -1, 100, 0, 0, 5, 21);
+ break;
+
+ case 20:
+ term_message("There is an explosion on the screen!");
+ terminateMachineAndNull(_series1);
+
+ _val1 = 19;
+ _series1 = series_play("506game", 0x2fe, 1, 10, 10, 3, 100, 0, 0, 2, 3);
+ break;
+
+ case 21:
+ term_message("There is a really big explosion on the screen!");
+ _series1 = series_play("506game", 0x2fe, 1, 10, 10, 3, 100, 0, 0, 2, 4);
+ break;
+
+ case 22:
+ terminateMachineAndNull(_series1);
+ _val1 = 21;
+ _series1 = series_play("506game", 0x2fe, 1, 10, 10, 1, 100, 0, 0, 0, 1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 11:
+ digi_play_loop("500_002", 3, 125);
+ break;
+
+ case 12:
+ _G(flags)[V219] = 1;
+ terminateMachineAndNull(_series1);
+ hotspot_set_active("JOYSTICK", false);
+ hotspot_set_active("FIRE", true);
+ _series2 = series_play("506fire", 0x2fe, 4, -1, 6, -1);
+ break;
+
+ case 13:
+ series_show("506windo", 0xf00);
+ _G(flags)[V219] = 1;
+ hotspot_set_active("ROOF", true);
+ break;
+
+ case 5002:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(6);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ _val3 = 5012;
+ kernel_timing_trigger(180, 3);
+ series_play_with_breaks(PLAY1, "506wi01", 0x800, -1, 3);
+ break;
+
+ case 3:
+ player_demand_location(157, 313, 3);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY2, "506wi02", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ _val2 = 17;
+ break;
+
+ case 5:
+ terminateMachineAndNull(_series1);
+ ws_hide_walker();
+
+ _G(flags)[V218] = 5003;
+ _G(flags)[V220] = 1;
+ _state1 = imath_ranged_rand(1, 3);
+ _G(wilbur_should) = 6;
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "506wi03", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 6:
+ digi_unload_stream_breaks(SERIES1);
+ _val2 = 18;
+ kernel_trigger_dispatch_now(7);
+ kernel_trigger_dispatch_now(12);
+ kernel_trigger_dispatch_now(13);
+ _val4 = 11;
+ kernel_trigger_dispatch_now(6);
+ break;
+
+ case 7:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ _val3 = 5006;
+ _triggers[0] = 3;
+ _triggers[1] = gCHANGE_WILBUR_ANIMATION;
+ _G(wilbur_should) = 8;
+ series_play_with_breaks(PLAY3, "506wi05", 0x2fe, 4, 3);
+ break;
+
+ case 8:
+ series_show("506wi05", 0x2fe, 0, -1, -1, 46);
+ series_show("506wi05s", 0x2ff, 0, -1, -1, 46);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room506::pre_parser() {
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
index 8ca4a84511b..76a93b0d9ef 100644
--- a/engines/m4/burger/rooms/section5/room506.h
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -41,11 +41,15 @@ private:
static long _state1;
static long _state2;
noWalkRect *_walk1 = nullptr;
- int _array1[5];
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ int _triggers[5];
int _ctr = 0;
+ int _loopCount = 0;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
+ int _val4 = 0;
void loadSeries();
Commit: c12279394aad759d4efd47947da0321979ee26f3
https://github.com/scummvm/scummvm/commit/c12279394aad759d4efd47947da0321979ee26f3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 507 methods
Changed paths:
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room507.h
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index da9767f690a..65b92d98376 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -228,17 +228,194 @@ Room507::Room507() : Section5Room() {
}
void Room507::init() {
+ Section5Room::init();
+ pal_cycle_init(112, 127, 6);
+
+ for (_ctr = 0; _ctr < 5; ++_ctr)
+ _triggers[_ctr] = -1;
+
+ player_set_commands_allowed(false);
+ _G(flags)[V246] = 0;
+ _flag1 = _flag2 = false;
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 505:
+ ws_demand_location(610, 280, 1);
+
+ if (player_been_here(507)) {
+ ws_walk(343, 323, nullptr, -1);
+ } else {
+ _val1 = 12;
+ ws_walk(343, 323, nullptr, 3);
+ }
+ break;
+
+ case 510:
+ ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(343, 323);
+ break;
+ }
+
+ _state5 = 0;
+ hotspot_set_active("BORK", false);
+
+ if (_G(flags)[V223] != 2) {
+ loadSeries();
+
+ if (_G(flags)[V223] == 1) {
+ hotspot_set_active_xy("BORK", 123, 218, true);
+ _val2 = 22;
+ } else {
+ hotspot_set_active_xy("BORK", 320, 220, true);
+ _val2 = 15;
+ kernel_trigger_dispatch_now(5);
+ }
+
+ kernel_trigger_dispatch_now(6);
+ }
+
+ switch (inv_where_is("RUBBER DUCKY")) {
+ case 500:
+ hotspot_set_active("RUBBER DUCKY ", false);
+ hotspot_set_active("RUBBER DUCKY ", true);
+ break;
+
+ case 507:
+ _series1 = series_show("507duck", 0xa00);
+ hotspot_set_active("RUBBER DUCKY ", true);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ break;
+
+ default:
+ hotspot_set_active("RUBBER DUCKY ", false);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ break;
+ }
+
+ if (_G(flags)[V223] != 1) {
+ _val3 = inv_where_is("RUBBER DUCKY") == 500 ? 27 : 26;
+ kernel_trigger_dispatch_now(9);
+ }
+
+ kernel_trigger_dispatch_now(10);
+ series_show("507tub", 0xf00);
+
+ if (_G(flags)[V228])
+ series_show("507windo", 0xf00);
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room507::daemon() {
}
void Room507::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT", "ENTER"))
+ player_set_facing_hotspot();
}
void Room507::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ bool tubFlag = player_said("TUB") && _G(flags)[V223] != 0;
+
+ if (player_said("LOOK AT", "BORK") && _G(flags)[V223] == 1) {
+ wilbur_speech("507w003");
+ } else if (player_said("RUBBER DUCKY") && player_said("TUB")) {
+ wilbur_speech(_G(flags)[223] ? "500w040" : "500w039");
+ } else if (player_said("RUBBER DUCKY") && player_said("SINK")) {
+ wilbur_speech("500w041");
+ } else if (player_said("SOAPY WATER", "SINK")) {
+ wilbur_speech("500w057");
+ } else if (player_said("LOOK AT") && player_said_any("TOILET", "FLUSH CHAIN") &&
+ _G(flags)[V223] == 1) {
+ wilbur_speech("507w008");
+ } else if (tubFlag && player_said("LOOK AT")) {
+ wilbur_speech("507w009");
+ } else if (tubFlag && player_said("GEAR")) {
+ wilbur_speech("507w010");
+ } else if (player_said("GEAR", "WINDOW") && _G(flags)[V228]) {
+ wilbur_speech("507w011");
+ } else if (player_said("GEAR") && (player_said("SHOWER CURTAIN") || player_said("SHOWERHEAD")) &&
+ _G(flags)[V223] == 2) {
+ // No implementation
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // No implementation
+ } else if (player_said("LOOK AT", "HALLWAY") || player_said("GEAR", "HALLWAY")) {
+ _val4 = 5009;
+ kernel_trigger_dispatch_now(2);
+ } else if (_G(flags)[V223] != 1 && player_said("RUBBER DUCKY", "BORK")) {
+ player_set_commands_allowed(false);
+ _val5 = 6;
+ _val6 = 19;
+ kernel_trigger_dispatch_now(4);
+ } else if (_G(flags)[V223] != 1 && player_said("BORK") && !player_said("LOOK AT") &&
+ !player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
+ !player_said("LAXATIVE")) {
+ player_set_commands_allowed(false);
+ _val2 = 23;
+ } else if (player_said("TAKE", "RUBBER DUCKY ")) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("RUBBER DUCKY") && player_said_any("GEAR", "WILBUR")) {
+ _G(wilbur_should) = 3;
+ ws_walk(197, 274, nullptr, gCHANGE_WILBUR_ANIMATION, 9);
+ } else if (player_said("RUBBER DUCKY", "TOILET")) {
+ _flag2 = true;
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("GEAR") && player_said_any("TOILET", "FLUSH CHAIN")) {
+ if (_G(flags)[V223] == 1 || _G(flags)[V223] == 2) {
+ _G(wilbur_should) = 9;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (inv_where_is("RUBBER DUCKY") == 500) {
+ _val5 = 9;
+ _val6 = 21;
+ kernel_trigger_dispatch_now(4);
+ } else {
+ _val5 = 9;
+ _val6 = 20;
+ kernel_trigger_dispatch_now(4);
+ }
+ } else if (player_said("BOTTLE") && player_said_any("SOAPY WATER ", "TUB ")) {
+ if (_G(flags)[V223] == 1 || _G(flags)[V223] == 2) {
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ wilbur_speech("507w038");
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room507::loadSeries() {
+ digi_preload("507b012a");
+ digi_preload("507b012b");
+ digi_preload("507b012c");
+ digi_preload("507b012d");
+ digi_preload("507b012e");
+ if (_G(flags)[V223] != 1) {
+ series_load("507bk01");
+ series_load("507bk03");
+ series_load("507bk04");
+ series_load("507bk08");
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
index 7dc44f4cbee..c8f0fee46d4 100644
--- a/engines/m4/burger/rooms/section5/room507.h
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -54,6 +54,19 @@ private:
static long _state3;
static long _state4;
static long _state5;
+ machine *_series1 = nullptr;
+ int _ctr = 0;
+ int _triggers[5];
+ bool _flag1 = false;
+ bool _flag2 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+
+ void loadSeries();
public:
Room507();
Commit: c486405a7f54f12106f37c230c5101be3438c07c
https://github.com/scummvm/scummvm/commit/c486405a7f54f12106f37c230c5101be3438c07c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 507 daemon
Changed paths:
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room507.h
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index 9ad70861389..2516a169be5 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -387,7 +387,7 @@ void Room506::daemon() {
break;
case 3:
- player_demand_location(157, 313, 3);
+ ws_demand_location(157, 313, 3);
player_set_commands_allowed(false);
ws_hide_walker();
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index 65b92d98376..8afb1c3f39f 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -318,6 +318,359 @@ void Room507::init() {
}
void Room507::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ for (_ctr = 0; _ctr < 5; ++_ctr) {
+ if (_triggers[_ctr] != -1) {
+ kernel_trigger_dispatch_now(_triggers[_ctr]);
+ term_message("Multiple Trigger Dispatch: %d", _triggers[_ctr]);
+ _triggers[_ctr] = -1;
+ }
+ }
+ break;
+
+ case 2:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val4);
+ break;
+
+ case 3:
+ ws_unhide_walker();
+
+ switch (_val1) {
+ case 12:
+ wilbur_speech("507w001");
+ break;
+
+ case 13:
+ player_set_commands_allowed(false);
+ _val1 = 14;
+ kernel_timing_trigger(120, 3);
+ break;
+
+ case 14:
+ player_set_commands_allowed(false);
+ wilbur_speech("507w002", 5001);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ _val2 = 25;
+ break;
+
+ case 5:
+ if (!_G(flags)[V223]) {
+ player_update_info();
+
+ if (_G(player_info).x > 270 && _G(player_info).x < 350 &&
+ _G(player_info).y < 280 && !_flag1) {
+ _flag1 = true;
+ player_set_commands_allowed(false);
+ intr_cancel_sentence();
+ _val2 = 23;
+ ws_walk(250, 275, nullptr, -1, 2);
+ }
+ }
+
+ if (_G(flags)[V223] != 1 && _G(flags)[V223] != 2)
+ kernel_timing_trigger(15, 5);
+ break;
+
+ case 6:
+ switch (_val2) {
+ case 15:
+ _val2 = imath_ranged_rand(1, 2) == 1 ? 16 : 17;
+ kernel_trigger_dispatch_now(6);
+ break;
+
+ case 16:
+ _G(flags)[V223] = 0;
+ _state1 = imath_ranged_rand(1, 4);
+ _state2 = imath_ranged_rand(1, 6);
+ _state3 = imath_ranged_rand(1, 6);
+ _state4 = imath_ranged_rand(1, 6);
+ _val2 = 15;
+ series_play_with_breaks(PLAY9, "507bk01", 0xb00, 6, 2);
+ break;
+
+ case 17:
+ _G(flags)[V223] = 0;
+ _val2 = 15;
+ series_play_with_breaks(PLAY10, "507bk04", 0xb00, 6, 2);
+ break;
+
+ case 18:
+ _state1 = imath_ranged_rand(1, 3);
+ _state2 = imath_ranged_rand(1, 3);
+ _val2 = 15;
+ series_play_with_breaks(PLAY11, "507bk02", 0xb00, 6, 2);
+ break;
+
+ case 19:
+ _val2 = 24;
+ _triggers[0] = 6;
+ _val7 = 1;
+ _val8 = 11;
+ _state1 = imath_ranged_rand(1, 2);
+ _state2 = imath_ranged_rand(1, 2);
+ _state3 = imath_ranged_rand(1, 2);
+ series_play_with_breaks(PLAY12, "507bk03", 0xb00, 1, 2);
+ break;
+
+ case 20:
+ _state1 = imath_ranged_rand(1, 3);
+ _state2 = imath_ranged_rand(1, 2);
+ _val2 = 24;
+ series_play_with_breaks(PLAY13, "507bk05", 0x8fe, 6, 3);
+ break;
+
+ case 21:
+ _G(flags)[V223] = 1;
+ hotspot_set_active("BORK", false);
+ hotspot_set_active_xy("BORK", 123, 218, true);
+ _val2 = 22;
+ series_play_with_breaks(PLAY14, "507bk06", 0x8fe, 6, 3);
+ break;
+
+ case 22:
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(7);
+ _series3 = series_play("507bk07", 0x8fe, 4, -1, 6, -1);
+ break;
+
+ case 23:
+ player_set_commands_allowed(true);
+ ++_state5;
+ _state1 = imath_ranged_rand(1, 3);
+ _val2 = 24;
+ series_play_with_breaks(PLAY16, "507bk08", 0xb00, 6, 2);
+ break;
+
+ case 24:
+ _flag1 = false;
+ player_set_commands_allowed(true);
+ _val2 = 15;
+ kernel_trigger_dispatch_now(6);
+ break;
+
+ case 25:
+ _G(wilbur_should) = _val5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _val2 = _val6;
+ kernel_trigger_dispatch_now(6);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ if (_G(flags)[V223] != 2) {
+ digi_play(Common::String::format("507b012%c", 'a' + imath_ranged_rand(0, 4)).c_str(),
+ 2, 255, 7);
+ }
+ break;
+
+ case 8:
+ _G(flags)[V206] = 5001;
+ kernel_trigger_dispatch_now(5015);
+ break;
+
+ case 9:
+ switch (_val3) {
+ case 26:
+ if (_G(flags)[V223] == 2 && !Section5::checkFlags())
+ player_set_commands_allowed(true);
+
+ terminateMachineAndNull(_series4);
+ _series4 = series_show("507tlt01", 0x8ff);
+ break;
+
+ case 27:
+ terminateMachineAndNull(_series4);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ hotspot_set_active("RUBBER DUCKY ", true);
+ _series4 = series_play("507wi04", 0x8ff, 16, -1, 6, 0, 100, 0, 0, 24, 24);
+ break;
+
+ case 28:
+ terminateMachineAndNull(_series4);
+ _val3 = 31;
+ series_play_with_breaks(PLAY17, "507tlt01", 0x8ff, 9, 2);
+ break;
+
+ case 29:
+ digi_play("507_003", 1, 255, -1, 507);
+ terminateMachineAndNull(_series4);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ inv_move_object("RUBBER DUCKY", NOWHERE);
+ _val3 = 31;
+ series_play("507tlt02", 0x8ff, 0, 9);
+ break;
+
+ case 30:
+ digi_play("507_003", 1, 255, -1, 507);
+ hotspot_set_active("BORK", false);
+ _G(flags)[V223] = 2;
+ player_set_commands_allowed(false);
+
+ _val1 = 13;
+ _triggers[0] = 3;
+ _val3 = 31;
+ _val8 = 9;
+ _val9 = 10;
+ terminateMachineAndNull(_series3);
+ series_play_with_breaks(PLAY15, "507bk09", 0x8ff, 1, 2);
+ break;
+
+ case 31:
+ _val3 = 26;
+ series_play_with_breaks(PLAY18, "507tlt01", 0x8ff, 9, 2);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10:
+ _series2 = series_show("5070flush", 0xf00);
+ break;
+
+ case 11:
+ switch (_val7) {
+ case 0:
+ inv_give_to_player("RUBBER DUCKY");
+ terminateMachineAndNull(_series1);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ break;
+
+ case 1:
+ inv_move_object("RUBBER DUCKY", 507);
+ hotspot_set_active("RUBBER DUCKY ", true);
+ hotspot_set_active("RUBBER DUCKY ", false);
+ _series1 = series_show("507duck", 0xa00);
+ break;
+
+ case 2:
+ inv_move_object("RUBBER DUCKY", 500);
+ _val3 = 27;
+ kernel_trigger_dispatch_now(9);
+ break;
+
+ case 3:
+ inv_give_to_player("SOAPY WATER");
+ inv_move_object("BOTTLE", NOWHERE);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5002:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(true);
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _val7 = 0;
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY2, "507wi01", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 4;
+ _val2 = 18;
+ series_play_with_breaks(PLAY5, "507wi04", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ ws_hide_walker();
+ player_update_info();
+ _G(wilbur_should) = _flag2 ? 8 : 5;
+ series_play_with_breaks(PLAY3, "507wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY6, "507wi04", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 6:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 7;
+ series_play_with_breaks(PLAY1, "507wi03", 0xaff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 7:
+ ws_unhide_walker();
+ break;
+
+ case 8:
+ _G(flags)[V224] = 1;
+ _val7 = 2;
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY4, "507wi04", 0x8ff, 11, 3);
+ break;
+
+ case 9:
+ terminateMachineAndNull(_series2);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 7;
+
+ if (_G(flags)[V223] == 1) {
+ _val3 = 30;
+ } else if (inv_where_is("RUBBER DUCKY") == 500) {
+ _val3 = 29;
+ } else {
+ _val3 = 28;
+ }
+
+ _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _val8 = 10;
+ series_play_with_breaks(PLAY7, "507wi05", 0x8ff, 1, 3);
+ break;
+
+ case 11:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY8, "507wi06", 0xd00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room507::pre_parser() {
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
index c8f0fee46d4..35cd5cc8ddc 100644
--- a/engines/m4/burger/rooms/section5/room507.h
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -55,6 +55,9 @@ private:
static long _state4;
static long _state5;
machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
int _ctr = 0;
int _triggers[5];
bool _flag1 = false;
@@ -65,6 +68,9 @@ private:
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
void loadSeries();
Commit: cb8cfdffd2e8a147c680fde2028fe3073482c556
https://github.com/scummvm/scummvm/commit/cb8cfdffd2e8a147c680fde2028fe3073482c556
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 508
Changed paths:
engines/m4/burger/rooms/section5/room508.cpp
engines/m4/burger/rooms/section5/room508.h
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
index 57f47ba302b..f19395a4928 100644
--- a/engines/m4/burger/rooms/section5/room508.cpp
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -153,18 +153,599 @@ Room508::Room508() : Section5Room() {
_state4 = 0;
}
+void Room508::preload() {
+ Section5Room::preload();
+ _G(player).walker_in_this_scene = false;
+}
+
void Room508::init() {
+ Section5Room::init();
+ player_set_commands_allowed(true);
+ _flag1 = true;
+
+ pal_cycle_init(112, 127, 6);
+ _val1 = 3;
+ _flag1 = false;
+ _state3 = 0;
+ _val2 = 0;
+
+ if (_G(flags)[V198] == 1) {
+ _series1 = series_play("508SMOKE", 0x500, 0, -1, 6, -1);
+ hotspot_set_active("BORK", false);
+
+ if (!_G(flags)[V227]) {
+ _val3 = 18;
+ kernel_trigger_dispatch_now(2);
+ }
+ } else {
+ loadSeries();
+ setup();
+ kernel_trigger_dispatch_now(2);
+ }
+
+ if (inv_player_has("CHRISTMAS LIGHTS") || inv_player_has("CHRISTMAS LIGHTS ")) {
+ _val4 = 24;
+ kernel_trigger_dispatch_now(5);
+ } else if (_G(flags)[V229] == 1) {
+ _val4 = 21;
+ kernel_trigger_dispatch_now(5);
+ } else {
+ _val4 = 22;
+ kernel_trigger_dispatch_now(22);
+ }
+
+ if (_G(flags)[V228] == 1) {
+ _val5 = 20;
+ kernel_trigger_dispatch_now(6);
+ }
+
+ switch (_G(game).previous_room) {
+ case 506:
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 1;
+
+ if (!player_been_here(508) && !_G(flags)[V198]) {
+ _flag2 = true;
+ _val6 = 10;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ _flag1 = false;
+ _val1 = 3;
+
+ if (inv_player_has("CHRISTMAS LIGHTS")) {
+ _G(wilbur_should) = 5;
+ } else if (inv_player_has("CHRISTMAS LIGHTS ")) {
+ _G(wilbur_should) = 6;
+ } else {
+ _G(wilbur_should) = 4;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room508::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val6) {
+ case 10:
+ wilbur_speech("508w001");
+ break;
+ case 11:
+ wilbur_speech("508w001z");
+ break;
+ case 12:
+ wilbur_speech("508w002");
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_val3) {
+ case 14:
+ setup();
+ _state1 = imath_ranged_rand(1, 4);
+ series_play_with_breaks(PLAY7, "508BK01", 0x200, 2, 3);
+
+ if (_G(flags)[V228] == 0 && _G(flags)[V223] == 0 && _val2 > 3) {
+ kernel_trigger_dispatch_now(3);
+ } else {
+ ++_val2;
+ }
+ break;
+
+ case 15:
+ setup();
+ _state1 = imath_ranged_rand(1, 4);
+ series_play_with_breaks(PLAY8, "508BK02", 0x200, 2, 3);
+ break;
+
+ case 16:
+ setup();
+ _state1 = imath_ranged_rand(1, 2);
+ _state2 = imath_ranged_rand(1, 4);
+ series_play_with_breaks(PLAY9, "508BK03", 0x200, 2, 3);
+ break;
+
+ case 17:
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ ++_state3;
+ _val6 = 11;
+ setup();
+
+ if (_state3 == 3)
+ _val3 = 19;
+
+ _state1 = imath_ranged_rand(1, 3);
+ series_play_with_breaks(PLAY10, "508BK04", 0x200, 2, 3, 6);
+ break;
+
+ case 18:
+ _val6 = 12;
+ _G(flags)[V227] = 1;
+ hotspot_set_active("BORK", false);
+
+ _state1 = imath_ranged_rand(1, 4);
+ _state2 = imath_ranged_rand(1, 3);
+ _state4 = imath_ranged_rand(1, 3);
+ series_play_with_breaks(PLAY11, "508BK05", 0x200, 1, 3, 6);
+ break;
+
+ case 19:
+ _G(flags)[V206] = 5003;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, 5015);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ _G(flags)[V228] = 1;
+ _state1 = imath_ranged_rand(1, 2);
+ _val5 = 20;
+ series_play_with_breaks(PLAY12, "508BK06", 0x200, 6, 3);
+ break;
+
+ case 5:
+ switch (_val4) {
+ case 21:
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ _G(flags)[V229] = 1;
+ _series3 = series_show(_G(flags)[V212] == 5000 ? "508LGT03" : "508LGT01", 0x300);
+ break;
+
+ case 22:
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+ _G(flags)[V229] = 0;
+ _series3 = series_show(_G(flags)[V212] == 5000 ? "508LGT04" : "508LGT02", 0x400);
+ break;
+
+ case 23:
+ _G(flags)[V229] = 0;
+ terminateMachineAndNull(_series3);
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6:
+ switch (_val5) {
+ case 20:
+ _series2 = series_show("508WINDO", 0x200);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ _G(kernel).trigger_mode = KT_DAEMON;
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, 5010);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _val1 = 3;
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY6, "508Wi01", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ terminateMachineAndNull(_series4);
+ _val1 = 1;
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY1, "508Wi06", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 3:
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ _val4 = 23;
+ terminateMachineAndNull(_series4);
+ _val1 = 1;
+
+ if (_G(flags)[V212] == 5000) {
+ _G(wilbur_should) = 6;
+ series_play_with_breaks(PLAY2, "508Wi06", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ } else {
+ _G(wilbur_should) = 5;
+ series_play_with_breaks(PLAY2, "508Wi03", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ }
+ break;
+
+ case 4:
+ if (_flag2) {
+ _flag2 = false;
+ kernel_trigger_dispatch_now(1);
+ }
+
+ _G(wilbur_should) = 4;
+ if (!_flag1) {
+ kernel_trigger_dispatch_now(1);
+ _flag1 = true;
+ }
+
+ if (_flag3) {
+ _G(wilbur_should) = 9;
+ _flag3 = false;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+
+ if (_val1 == 1) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _val1 = 1;
+ _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
-void Room508::pre_parser() {
+ default:
+ break;
+ }
+ } else if (_val1 == 2) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+ case 1:
+ _val1 = 2;
+ _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_val1 == 3) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 5:
+ if (!_flag1) {
+ player_set_commands_allowed(true);
+ _flag1 = true;
+ }
+
+ inv_give_to_player("CHRISTMAS LIGHTS");
+
+ if (_val1 == 1) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_val1 == 2) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508wi10", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_val1 == 3) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508wi10", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 6:
+ if (!_flag1) {
+ player_set_commands_allowed(true);
+ _flag1 = true;
+ }
+
+ inv_give_to_player("CHRISTMAS LIGHTS ");
+
+ if (_val1 == 1) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_val1 == 2) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ default:
+ break;
+ }
+ } else if (_val1 == 3) {
+ switch (imath_ranged_rand(0, 2)) {
+ case 0:
+ _val1 = 1;
+ _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 1:
+ _val1 = 2;
+ _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ break;
+
+ case 2:
+ _val1 = 3;
+ _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 7:
+ _G(wilbur_should) = 4;
+ _val4 = 22;
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ terminateMachineAndNull(_series4);
+ _val1 = 1;
+
+ if (_G(flags)[V212] == 5000) {
+ series_play_with_breaks(PLAY3, "508Wi07", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ inv_move_object("CHRISTMAS LIGHTS ", 508);
+ } else {
+ series_play_with_breaks(PLAY3, "508Wi04", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ inv_move_object("CHRISTMAS LIGHTS", 508);
+ }
+ break;
+
+ case 8:
+ _G(wilbur_should) = 4;
+ _val4 = 21;
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ terminateMachineAndNull(_series4);
+ _val1 = 1;
+
+ if (_G(flags)[V212] == 5000) {
+ series_play_with_breaks(PLAY4, "508Wi08", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ inv_move_object("CHRISTMAS LIGHTS ", 508);
+ } else {
+ series_play_with_breaks(PLAY4, "508Wi05", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ inv_move_object("CHRISTMAS LIGHTS", 508);
+ }
+ break;
+
+ case 9:
+ player_set_commands_allowed(false);
+ _flag1 = false;
+ _val1 = 1;
+ _flag3 = false;
+
+ if (inv_player_has("CHRISTMAS LIGHTS") || player_said("CHRISTMAS LIGHTS ")) {
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _G(kernel).continue_handling_trigger = true;
+ } else {
+ terminateMachineAndNull(_series4);
+ _G(wilbur_should) = 10002;
+ series_play_with_breaks(PLAY5, "508Wi02", 0x300, 7, 2);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room508::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT") && player_said_any("CHIMNEY", "CHIMNEY POTS") &&
+ _G(flags)[V198]) {
+ wilbur_speech("508w013");
+ } else if (player_said("RUBBER DUCKY", "BORK")) {
+ wilbur_speech("500w042");
+ } else if (player_said("BORK", "KINDLING")) {
+ wilbur_speech("500w069");
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("HOLE") && player_said_any("CHRISTMAS LIGHTS ", "CHRISTMAS LIGHTS")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("ROOF") && player_said_any("CHRISTMAS LIGHTS ", "CHRISTMAS LIGHTS")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("WILBUR'S ROOM") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
+ player_set_commands_allowed(false);
+ _flag3 = true;
+ _G(wilbur_should) = 9;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room508::loadSeries() {
+ static const char *NAMES[8] = {
+ "508bk01", "508bk01s", "508bk02", "508bk02s", "508bk03",
+ "508bk03s", "508bk04", "508bk04s"
+ };
+ for (int i = 0; i < 8; ++i)
+ series_load(NAMES[i]);
+
+ if (!_G(flags)[V228]) {
+ series_load("508bk06");
+ series_load("508bk06s");
+ }
+}
+void Room508::setup() {
+ switch (imath_ranged_rand(0, 3)) {
+ case 0:
+ case 1:
+ _val3 = 14;
+ break;
+ case 2:
+ _val3 = 15;
+ break;
+ case 3:
+ _val3 = 16;
+ break;
+ default:
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room508.h b/engines/m4/burger/rooms/section5/room508.h
index f764f1ec220..ea498cc8143 100644
--- a/engines/m4/burger/rooms/section5/room508.h
+++ b/engines/m4/burger/rooms/section5/room508.h
@@ -47,14 +47,30 @@ private:
static long _state2;
static long _state3;
static long _state4;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ machine *_series3 = nullptr;
+ machine *_series4 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ bool _flag1 = false;
+ bool _flag2 = false;
+ bool _flag3 = false;
+
+ void loadSeries();
+ void setup();
public:
Room508();
~Room508() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: 70b78ca4b7a39c41cadee0983669598b4432ceb3
https://github.com/scummvm/scummvm/commit/70b78ca4b7a39c41cadee0983669598b4432ceb3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 511
Changed paths:
engines/m4/burger/rooms/section5/room511.cpp
engines/m4/burger/rooms/section5/room511.h
engines/m4/burger/rooms/section5/section5.h
diff --git a/engines/m4/burger/rooms/section5/room511.cpp b/engines/m4/burger/rooms/section5/room511.cpp
index 4bf2809343b..2399ee66e0d 100644
--- a/engines/m4/burger/rooms/section5/room511.cpp
+++ b/engines/m4/burger/rooms/section5/room511.cpp
@@ -79,18 +79,52 @@ Room511::Room511() : Section5Room() {
_state2 = 0;
}
+void Room511::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room511::init() {
+ _G(flags)[V194] = 1;
+ kernel_trigger_dispatch_now(1);
}
void Room511::daemon() {
-}
+ if (_G(kernel).trigger == 1) {
+ _state1 = imath_ranged_rand(1, 10);
+ _val1 = imath_ranged_rand(1, 5);
-void Room511::pre_parser() {
+ switch (_G(flags)[V206]) {
+ case 5000:
+ series_stream_with_breaks(SERIES1, "511bk03", 8, 1, 5016);
+ break;
-}
+ case 5001:
+ series_stream_with_breaks(SERIES1, "511bk07", 8, 1, 5016);
+ break;
+
+ case 5002:
+ series_stream_with_breaks(SERIES1, "511bk04", 8, 1, 5016);
+ break;
+
+ case 5003:
+ series_stream_with_breaks(SERIES1, "511bk08", 8, 1, 5016);
+ break;
+
+ case 5004:
+ series_stream_with_breaks(SERIES1, "511bk06", 8, 1, 5016);
+ break;
-void Room511::parser() {
+ case 5005:
+ series_stream_with_breaks(SERIES1, "511bk05", 8, 1, 5016);
+ break;
+ default:
+ series_stream_with_breaks(SERIES1, "511bk02", 8, 1, 5016);
+ break;
+ }
+ } else {
+ _G(kernel).continue_handling_trigger = true;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room511.h b/engines/m4/burger/rooms/section5/room511.h
index 9cf05071fbf..9020dcf94e9 100644
--- a/engines/m4/burger/rooms/section5/room511.h
+++ b/engines/m4/burger/rooms/section5/room511.h
@@ -35,15 +35,15 @@ private:
static const seriesStreamBreak SERIES3[];
static long _state1;
static long _state2;
+ int _val1 = 0;
public:
Room511();
~Room511() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
- void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 3f685f7725a..5f650e1b33b 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -55,9 +55,9 @@ private:
Room508 _room508;
Room509 _room509;
Room510 _room510;
- Room511 _room513;
+ Room511 _room511;
Room512 _room512;
- Room513 _room511;
+ Room513 _room513;
bool _gizmoRoomNums[15];
void takeGizmo(RGB8 *pal);
Commit: ffa501f746ee50d20dd52d17b3cb8700f6ab3644
https://github.com/scummvm/scummvm/commit/ffa501f746ee50d20dd52d17b3cb8700f6ab3644
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 509 methods
Changed paths:
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room509.h
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index d46830bd8dd..0870f812916 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -43,6 +43,8 @@ private:
protected:
static HotSpotRec _wilburHotspot;
Series _roomSeries1;
+ machine *_general1 = nullptr;
+ machine *_general2 = nullptr;
public:
static void setWilburHotspot();
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index 4f390756e4b..451ddbc461a 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -109,17 +109,132 @@ Room509::Room509() : Section5Room() {
}
void Room509::init() {
+ Section5Room::init();
+ pal_cycle_init(109, 124, 6);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ if (inv_player_has("CHRISTMAS LIGHTS") || inv_player_has("CHRISTMAS LIGHTS ")) {
+ disable_player();
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 505:
+ ws_demand_location(4, 286, 3);
+ ws_unhide_walker();
+
+ if (player_been_here(509)) {
+ ws_walk(272, 325, nullptr, -1);
+ } else {
+ ws_walk(272, 325, nullptr, 1);
+ }
+ break;
+
+ default:
+ ws_demand_location(272, 325);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+ }
+
+ _state1 = 0;
+
+ if (_G(flags)[V227]) {
+ _val1 = 17;
+ } else {
+ digi_preload("508b001a");
+ digi_preload("508b001b");
+ digi_preload("508b001c");
+ digi_preload("508b001d");
+ _val1 = 15;
+ }
+
+ kernel_trigger_dispatch_now(2);
+
+ if (_G(flags)[V229] == 0 && !inv_player_has("CHRISTMAS LIGHTS") &&
+ !inv_player_has("CHRISTMAS LIGHTS ")) {
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ series_load("509wi05");
+ series_load("509wi06");
+ series_load("509wi07");
+ series_load("509wi08");
+
+ series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
+ } else {
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+ }
+
+ _series2 = series_show("509wire", 0x900);
+
+ _initFlag = true;
+ Section5Room::init();
}
void Room509::daemon() {
+ // TODO
}
void Room509::pre_parser() {
-
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!inv_player_has("CHRISTMAS LIGHTS") && !inv_player_has("CHRISTMAS LIGHTS ")) {
+ if (player_said("HALLWAY") && !player_said_any("LEAVE", "LOOK AT", "GEAR"))
+ player_set_facing_hotspot();
+ } else {
+ _G(wilbur_should) = 12;
+
+ if (player_said("CHRISTMAS LIGHTS ", "PHONE CORD")) {
+ _val2 = _G(flags)[V234] ? 6 : 5;
+ } else if (player_said("CHRISTMAS LIGHTS", "PHONE CORD")) {
+ _G(wilbur_should) = 5;
+ } else if (player_said("LOOK AT") && player_said_any("CHRISTMAS LIGHTS", "CHRISTMAS LIGHTS ")) {
+ _val2 = player_said("CHRISTMAS LIGHTS") ? 1 : 0;
+ } else if (player_said("HOLE") && player_said_any("CHRISTMAS LIGHTS", "CHRISTMAS LIGHTS ")) {
+ _val2 = 2;
+ } else if (player_said("CHRISTMAS LIGHTS") || player_said("CHRISTMAS LIGHTS ")) {
+ _val2 = 4;
+ intr_cancel_sentence();
+ _G(player).need_to_walk = false;
+ } else {
+ _G(wilbur_should) = 3;
+ }
+
+ _G(player).ready_to_walk = false;
+ terminateMachineAndNull(_general1);
+ terminateMachineAndNull(_general2);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ }
}
void Room509::parser() {
-
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT", "CHRISTMAS LIGHTS ") && _G(flags)[V212] == 5001) {
+ wilbur_speech("509w003");
+ } else if (player_said("GEAR", "CHRISTMAS LIGHTS ")) {
+ wilbur_speech("509w004");
+ } else if (player_said_any("CHRISTMAS LIGHTS", "CHRISTMAS LIGHTS ") && player_said("HOLE")) {
+ _val2 = 2;
+ kernel_trigger_dispatch_now(12);
+ } else if (player_said("LOOK AT", "HOLE") && _G(flags)[V227] != 0) {
+ wilbur_speech("500w003");
+ } else if (player_said("TAKE", "TELEPHONE") && _G(flags)[V197]) {
+ wilbur_speech("500w005");
+ } else if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 5009);
+ } else if (player_said("TAKE", "CHRISTMAS LIGHTS ")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
index fbc5430cc60..ba3b45c5745 100644
--- a/engines/m4/burger/rooms/section5/room509.h
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -41,6 +41,10 @@ private:
static const seriesPlayBreak PLAY8[];
static long _state1;
static long _state2;
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
public:
Room509();
Commit: f36d6f55d92e6e6d7192aeef1d8ccd12185a6567
https://github.com/scummvm/scummvm/commit/f36d6f55d92e6e6d7192aeef1d8ccd12185a6567
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 509 daemon
Changed paths:
engines/m4/burger/rooms/room.h
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room509.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index 0870f812916..dc1f24ce5fb 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -43,8 +43,7 @@ private:
protected:
static HotSpotRec _wilburHotspot;
Series _roomSeries1;
- machine *_general1 = nullptr;
- machine *_general2 = nullptr;
+ Series _general;
public:
static void setWilburHotspot();
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index 451ddbc461a..3db52488dbe 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -99,6 +99,8 @@ const seriesPlayBreak Room509::PLAY8[] = {
PLAY_BREAK_END
};
+static const RGB8 PALETTE[1] = { { 0x6E, 0x46, 0x1E } };
+
long Room509::_state1;
long Room509::_state2;
@@ -173,7 +175,263 @@ void Room509::init() {
}
void Room509::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ wilbur_speech("509w001");
+ break;
+
+ case 2:
+ switch (_val1) {
+ case 15:
+ _state2 = imath_ranged_rand(1, 2);
+ _val1 = 16;
+ series_play_with_breaks(PLAY8, "509bk01", 0xf00, 2, 2, 6);
+ break;
+
+ case 16:
+ _val1 = 15;
+ series_show("509bk01", 0xf00, 0, 2, imath_ranged_rand(120, 240));
+ digi_play_loop(Common::String::format("508b001%c",
+ 'a' + imath_ranged_rand(0, 3)).c_str(), 2, 255);
+ break;
+
+ case 17:
+ series_show("509bk01", 0xF00);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ if (!_G(flags)[V197] && !_flag1) {
+ _state1 = 1;
+ digi_play("509_001", 2);
+ _flag1 = true;
+ } else if (!_flag1) {
+ digi_play("509_003", 2, 255, -1, 509);
+ _flag1 = true;
+ }
+
+ _G(flags)[V197] = 1;
+ DAC_tint_range(PALETTE, _val4, 32, 255, true);
+ _val3 = imath_ranged_rand(0, 1);
+
+ if (_val3)
+ _val4 += 7;
+ else
+ _val4 -= 7;
+ _val4 = CLIP(_val4, 0, 70);
+
+ kernel_timing_trigger(6, (_val5 == 1) ? 3 : 4);
+ break;
+
+ case 4:
+ _flag1 = false;
+ _val4 -= 7;
+ if (_val4 < 0) {
+ _val4 = _val5 = 0;
+ }
+
+ DAC_tint_range(PALETTE, _val4, 32, 255, true);
+
+ if (_val5 == 2)
+ kernel_timing_trigger(6, 4);
+ break;
+
+
+
+ case 5002:
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 2;
+
+ terminateMachineAndNull(_series1);
+ series_play_with_breaks(PLAY1, (_G(flags)[V212] == 5000) ? "509wi03" : "509wi01");
+ break;
+
+ case 2:
+ hotspot_set_active("CHRISTMAS LIGHTS ", false);
+
+ if (_G(flags)[V212] == 5000) {
+ _general.show("509wi03", 0xc00, 0, -1, -1, 31);
+ inv_give_to_player("CHRISTMAS LIGHTS ");
+ } else {
+ _general.show("509wi01", 0xc00, 0, -1, -1, 31);
+ inv_give_to_player("CHRISTMAS LIGHTS");
+ }
+
+ player_set_commands_allowed(true);
+ break;
+
+ case 3:
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ player_set_commands_allowed(false);
+ inv_move_object("CHRISTMAS LIGHTS", NOWHERE);
+ inv_move_object("CHRISTMAS LIGHTS ", NOWHERE);
+ _G(wilbur_should) = 14;
+
+ series_play_with_breaks(PLAY2, (_G(flags)[V212] == 5000) ? "509wi04" : "509wi02",
+ 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ _general.terminate();
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 5:
+ player_set_commands_allowed(false);
+ terminateMachineAndNull(_series2);
+
+ if (_G(flags)[V212] == 5000) {
+ if (_G(flags)[V234]) {
+ _G(wilbur_should) = 6;
+ _val5 = 1;
+ series_play_with_breaks(PLAY3, "509wi05", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ } else {
+ _G(wilbur_should) = 7;
+ series_play_with_breaks(PLAY4, "509wi05", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ } else {
+ _G(wilbur_should) = 8;
+ series_play_with_breaks(PLAY5, "509wi07", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 6:
+ _val5 = 2;
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ _G(wilbur_should) = 8;
+ series_play_with_breaks(PLAY6, "609wi08", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 7:
+ _G(wilbur_should) = 5004;
+ series_play_with_breaks(PLAY7, "509wi06", 0xc00, 5016, 3);
+ break;
+
+ case 8:
+ if (_state1) {
+ _G(wilbur_should) = 10;
+ } else if (_G(flags)[V212] == 5001) {
+ _G(wilbur_should) = 11;
+ } else {
+ _G(wilbur_should) = 10001;
+ }
+
+ inv_move_object("CHRISTMAS LIGHTS", NOWHERE);
+ inv_move_object("CHRISTMAS LIGHTS ", NOWHERE);
+ hotspot_set_active("CHRISTMAS LIGHTS ", true);
+ _series2 = series_show("509wire", 0x900);
+ _series1 = series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 9:
+ _G(wilbur_should) = 6;
+ break;
+
+ case 10:
+ _state1 = 0;
+ ws_unhide_walker();
+ wilbur_speech("500w087", 5001);
+ break;
+
+ case 11:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ wilbur_speech("500w088");
+ break;
+
+ case 12:
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 13;
+
+ switch (_val2) {
+ case 0:
+ digi_play("500w079", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 1:
+ digi_play("500w080", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 2:
+ digi_play("500w089", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 3:
+ digi_play("500w090", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 4:
+ digi_play("500w091", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 5:
+ _G(wilbur_should) = 4;
+ digi_play("500w084", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 6:
+ _G(wilbur_should) = 4;
+ digi_play("500w085", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ break;
+ }
+
+ if (_G(flags)[V212] == 5000) {
+ _general.play("509wi03", 0xc00, 4, -1, 0, -1, 100, 0, 0, 16, 18);
+ } else {
+ _general.play("509wi01", 0xc00, 4, -1, 0, -1, 100, 0, 0, 16, 18);
+ }
+ break;
+
+ case 13:
+ _general.terminate();
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 14:
+ _G(kernel).trigger_mode = KT_PARSE;
+
+ if (_G(flags)[V212] == 5000) {
+ _series1 = series_show("509lgt02", 0xc00);
+ } else {
+ _series1 = series_show("509lgt01", 0xc00);
+ }
+
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+ _G(player).command_ready = true;
+ _G(player).need_to_walk = true;
+ _G(player).ready_to_walk = true;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room509::pre_parser() {
@@ -202,8 +460,7 @@ void Room509::pre_parser() {
}
_G(player).ready_to_walk = false;
- terminateMachineAndNull(_general1);
- terminateMachineAndNull(_general2);
+ _general.terminate();
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
}
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
index ba3b45c5745..4b1b70f829b 100644
--- a/engines/m4/burger/rooms/section5/room509.h
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -45,6 +45,10 @@ private:
machine *_series2 = nullptr;
int _val1 = 0;
int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ bool _flag1 = false;
public:
Room509();
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 4e3326e0501..937dfb5fa4a 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -44,7 +44,7 @@ void Series::show(const char *seriesName, frac16 layer, uint32 flags,
_series = M4::series_show(seriesName, layer, flags, triggerNum, duration,
index, s, x, y);
_seriesS = M4::series_show(seriesName, layer + 1, flags, -1, duration,
- index, s, x, y);
+ index ? index + 1 : index, s, x, y);
}
void Series::show(const char *series1, const char *series2, int layer) {
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 44820b9eea2..e8f96359346 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -781,7 +781,7 @@ void pal_fx_update() {
}
}
-void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent) {
+void DAC_tint_range(const RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent) {
int32 i;
int32 r, g, b, dr, dg, db;
RGB8 color, targetColor;
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index 4cf989d41b9..e058cf8eb98 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -117,7 +117,7 @@ extern void pal_fx_update();
* This is used to effect the screen colours (not the master palette) temporarily
* until something else updates the DAC e.g. refresh_DAC()
*/
-extern void DAC_tint_range(RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
+extern void DAC_tint_range(const RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
extern void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay);
Commit: aa045841e078f2e4ae3cf77a1be108b8fa3d1088
https://github.com/scummvm/scummvm/commit/aa045841e078f2e4ae3cf77a1be108b8fa3d1088
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 510 methods
Changed paths:
engines/m4/burger/rooms/section5/room510.cpp
engines/m4/burger/rooms/section5/room510.h
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index ce948d31e66..c453e36b228 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -27,18 +27,186 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+#define BUTTON_COUNT 7
+
+const Room510::ButtonDef Room510::_BUTTONS[7] = {
+ { 250, 159, 406, 189, 0, 1, 2, 3, 1, 4 },
+ { 250, 190, 406, 216, 4, 5, 6, 7, 1, 5 },
+ { 250, 217, 406, 244, 8, 9, 10, 11, 1, 6 },
+ { 250, 245, 406, 265, 12, 13, 14, 15, 1, 7 },
+ { 250, 266, 406, 291, 16, 17, 18, 19, 1, 8 },
+ { 250, 292, 406, 316, 20, 21, 22, 23, 1, 9 },
+ { 250, 317, 406, 343, 24, 25, 26, 27, 1, 10 }
+};
+
+Room510::Room510() : Section5Room() {
+ Common::copy(_BUTTONS, _BUTTONS + BUTTON_COUNT, _buttons);
+}
+
+void Room510::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room510::init() {
+ series_load("510butts");
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(0);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 60, 2);
+
+ for (int i = 0; i < 7; ++i) {
+ _buttons[i]._state = 1;
+ setupButton(i);
+ }
+
+ _val2 = -1;
+ _val3 = -1;
+ _val4 = -1;
+
+ if (!player_been_here(510)) {
+ wilbur_speech("510w001");
+ } else if (!_G(flags)[V237]) {
+ wilbur_speech("510w002");
+ _G(flags)[V237] = 1;
+ }
}
void Room510::daemon() {
+ // TODO
}
-void Room510::pre_parser() {
+void Room510::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT")) {
+ bool doneFlag = true;
+ if (player_said("RED BUTTON")) {
+ if (!player_been_here(503)) {
+ wilbur_speech("510w003");
+ } else if (_G(flags)[gBORK_STATE] != 16) {
+ wilbur_speech("510w004");
+ } else {
+ wilbur_speech("510w005");
+ }
+ } else if (player_said("ORANGE BUTTON")) {
+ if (!player_been_here(507)) {
+ wilbur_speech("510w006");
+ } else if (_G(flags)[V223] != 2) {
+ wilbur_speech("510w007");
+ } else {
+ wilbur_speech("510w008");
+ }
+ } else if (player_said("YELLOW BUTTON")) {
+ if (!player_been_here(504)) {
+ wilbur_speech("510w009");
+ } else if (_G(flags)[V210] != 5002) {
+ wilbur_speech("510w010");
+ } else {
+ wilbur_speech("510w011");
+ }
+ } else if (player_said("GREEN BUTTON")) {
+ if (!player_been_here(508)) {
+ wilbur_speech("510w012");
+ } else if (_G(flags)[V227] == 0) {
+ wilbur_speech("510w013");
+ } else {
+ wilbur_speech("510w014");
+ }
+ } else if (player_said("BLUE BUTTON")) {
+ if (!player_been_here(506)) {
+ wilbur_speech("510w015");
+ } else if (_G(flags)[V218] != 5003) {
+ wilbur_speech("510w016");
+ } else {
+ wilbur_speech("510w017");
+ }
+ } else if (player_said("PURPLE BUTTON")) {
+ wilbur_speech(_G(flags)[V200] != 5003 ? "510w018" : "510w019");
+ } else if (player_said("PINK BUTTON")) {
+ wilbur_speech("510w020");
+ } else {
+ doneFlag = false;
+ }
+
+ if (doneFlag) {
+ goto done;
+ }
+ }
+ if (player_said("TAKE")) {
+ wilbur_speech("500w001");
+ } else if (player_said("EXIT")) {
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("GEAR")) {
+ if (player_said("RED BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(0, 3);
+ kernel_trigger_dispatch_now(4);
+ } else if (player_said("ORANGE BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(1, 3);
+ kernel_trigger_dispatch_now(5);
+ } else if (player_said("YELLOW BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(2, 3);
+ kernel_trigger_dispatch_now(6);
+ } else if (player_said("GREEN BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(3, 3);
+ kernel_trigger_dispatch_now(7);
+ } else if (player_said("BLUE BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(4, 3);
+ kernel_trigger_dispatch_now(8);
+ } else if (player_said("PURPLE BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(5, 3);
+ kernel_trigger_dispatch_now(9);
+ } else if (player_said("PINK BUTTON")) {
+ _G(kernel).call_daemon_every_loop = false;
+ setButtonState(6, 3);
+ kernel_trigger_dispatch_now(10);
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+
+done:
+ _G(player).command_ready = false;
}
-void Room510::parser() {
+void Room510::setupButton(int index) {
+ Button &btn = _buttons[index];
+
+ switch (btn._state) {
+ case 0:
+ btn._series = series_show("510butts", 0, 0, -1, -1, btn._index0);
+ break;
+ case 1:
+ btn._series = series_show("510butts", 0, 0, -1, -1, btn._index1);
+ break;
+ case 2:
+ btn._series = series_show("510butts", 0, 0, -1, -1, btn._index2);
+ break;
+ case 3:
+ btn._series = series_show("510butts", 0, 0, -1, -1, btn._index3);
+ break;
+ default:
+ break;
+ }
+}
+
+void Room510::setButtonState(int index, int state) {
+ if (index >= 0) {
+ Button &btn = _buttons[index];
+ if (btn._state != 0 && btn._state != state) {
+ terminateMachineAndNull(btn._series);
+ btn._state = state;
+ setupButton(index);
+ }
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room510.h b/engines/m4/burger/rooms/section5/room510.h
index 0650c6e471b..0443dbff389 100644
--- a/engines/m4/burger/rooms/section5/room510.h
+++ b/engines/m4/burger/rooms/section5/room510.h
@@ -28,14 +28,44 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+#define BUTTON_COUNT 7
+
class Room510 : public Section5Room {
+private:
+ struct ButtonDef {
+ int _val1;
+ int _val2;
+ int _val3;
+ int _val4;
+ int _index0;
+ int _index1;
+ int _index2;
+ int _index3;
+ int _state;
+ int _val10;
+ };
+ struct Button : public ButtonDef {
+ machine *_series = nullptr;
+ Button() : ButtonDef() {}
+ Button(const ButtonDef &src) : ButtonDef(src) {}
+ };
+ static const ButtonDef _BUTTONS[BUTTON_COUNT];
+ Button _buttons[BUTTON_COUNT];
+ machine *_buttonSeries[BUTTON_COUNT];
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+
+ void setupButton(int index);
+ void setButtonState(int index, int state);
+
public:
- Room510() : Section5Room() {}
+ Room510();
~Room510() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: 925b83fc0842e5a9a616015439974d8ff3837f74
https://github.com/scummvm/scummvm/commit/925b83fc0842e5a9a616015439974d8ff3837f74
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 510 daemon
Changed paths:
engines/m4/burger/rooms/section5/room510.cpp
engines/m4/burger/rooms/section5/room510.h
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index c453e36b228..549bb978ca5 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -71,7 +71,59 @@ void Room510::init() {
}
void Room510::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ _G(game).new_room = _G(game).previous_room;
+ break;
+
+ case 2:
+ case 3:
+ _val4 = -1;
+ player_set_commands_allowed(true);
+
+ for (int i = 0; i < BUTTON_COUNT; ++i) {
+ if (_buttons[i]._state != GUI::NOTHING)
+ setButtonState(i, GUI::IN_CONTROL);
+ }
+ break;
+
+ case 4:
+ buttonAction(1, 0, 4);
+ break;
+
+ case 5:
+ buttonAction(2, 5, 9);
+ break;
+
+ case 6:
+ buttonAction(3, 10, 15);
+ break;
+
+ case 7:
+ buttonAction(4, 16, 19);
+ break;
+
+ case 8:
+ buttonAction(5, 20, 24);
+ break;
+
+ case 9:
+ buttonAction(6, 25, 29);
+ break;
+
+ case 10:
+ buttonAction(7, 30, 34);
+ break;
+
+ case gCALLED_EACH_LOOP:
+ if (player_commands_allowed())
+ updateButtons();
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room510::parser() {
@@ -139,31 +191,31 @@ void Room510::parser() {
} else if (player_said("GEAR")) {
if (player_said("RED BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(0, 3);
+ setButtonState(0, GUI::SELECTED);
kernel_trigger_dispatch_now(4);
} else if (player_said("ORANGE BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(1, 3);
+ setButtonState(1, GUI::SELECTED);
kernel_trigger_dispatch_now(5);
} else if (player_said("YELLOW BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(2, 3);
+ setButtonState(2, GUI::SELECTED);
kernel_trigger_dispatch_now(6);
} else if (player_said("GREEN BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(3, 3);
+ setButtonState(3, GUI::SELECTED);
kernel_trigger_dispatch_now(7);
} else if (player_said("BLUE BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(4, 3);
+ setButtonState(4, GUI::SELECTED);
kernel_trigger_dispatch_now(8);
} else if (player_said("PURPLE BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(5, 3);
+ setButtonState(5, GUI::SELECTED);
kernel_trigger_dispatch_now(9);
} else if (player_said("PINK BUTTON")) {
_G(kernel).call_daemon_every_loop = false;
- setButtonState(6, 3);
+ setButtonState(6, GUI::SELECTED);
kernel_trigger_dispatch_now(10);
} else {
return;
@@ -197,11 +249,11 @@ void Room510::setupButton(int index) {
}
}
-void Room510::setButtonState(int index, int state) {
+void Room510::setButtonState(int index, GUI::ControlStatus state) {
if (index >= 0) {
Button &btn = _buttons[index];
- if (btn._state != 0 && btn._state != state) {
+ if (btn._state != GUI::NOTHING && btn._state != state) {
terminateMachineAndNull(btn._series);
btn._state = state;
setupButton(index);
@@ -209,6 +261,37 @@ void Room510::setButtonState(int index, int state) {
}
}
+void Room510::buttonAction(int index, int firstFrame, int lastFrame) {
+ digi_play(Common::String::format("510b00%d%c", index, 'a' + imath_ranged_rand(0, 2)).c_str(), 2);
+ series_play("510waves", 0, 0, 2, 6, 2, 100, 0, 0, firstFrame, lastFrame);
+}
+
+void Room510::updateButtons() {
+ _val3 = getHighlightedButton();
+
+ if (_val2 != -1) {
+ setButtonState(_val2, (_val2 == _val3) ? GUI::SELECTED : GUI::IN_CONTROL);
+ } else if (_val3 == -1) {
+ setButtonState(_val4, GUI::IN_CONTROL);
+ } else if (_val3 != _val4) {
+ setButtonState(_val4, GUI::IN_CONTROL);
+ setButtonState(_val3, GUI::OVER_CONTROL);
+ }
+}
+
+int Room510::getHighlightedButton() const {
+ for (int i = 0; i < BUTTON_COUNT; ++i) {
+ const Button &btn = _buttons[i];
+ if (_G(MouseState).CursorColumn >= btn._x1 &&
+ _G(MouseState).CursorColumn <= btn._x2 &&
+ _G(MouseState).CursorRow >= btn._y1 &&
+ _G(MouseState).CursorRow <= btn._y2)
+ return i;
+ }
+
+ return -1;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section5/room510.h b/engines/m4/burger/rooms/section5/room510.h
index 0443dbff389..644948b0150 100644
--- a/engines/m4/burger/rooms/section5/room510.h
+++ b/engines/m4/burger/rooms/section5/room510.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION5_ROOM510_H
#include "m4/burger/rooms/section5/section5_room.h"
+#include "m4/burger/gui/gui_cheapo.h"
namespace M4 {
namespace Burger {
@@ -33,10 +34,10 @@ namespace Rooms {
class Room510 : public Section5Room {
private:
struct ButtonDef {
- int _val1;
- int _val2;
- int _val3;
- int _val4;
+ int _x1;
+ int _y1;
+ int _x2;
+ int _y2;
int _index0;
int _index1;
int _index2;
@@ -57,7 +58,10 @@ private:
int _val4 = 0;
void setupButton(int index);
- void setButtonState(int index, int state);
+ void setButtonState(int index, GUI::ControlStatus state);
+ void buttonAction(int index, int firstFrame, int lastFrame);
+ void updateButtons();
+ int getHighlightedButton() const;
public:
Room510();
Commit: 06079874b1c8191c4e539c9477535b4f1c108767
https://github.com/scummvm/scummvm/commit/06079874b1c8191c4e539c9477535b4f1c108767
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 512
Changed paths:
engines/m4/burger/rooms/section5/room511.cpp
engines/m4/burger/rooms/section5/room511.h
engines/m4/burger/rooms/section5/room512.cpp
engines/m4/burger/rooms/section5/room512.h
diff --git a/engines/m4/burger/rooms/section5/room511.cpp b/engines/m4/burger/rooms/section5/room511.cpp
index 2399ee66e0d..a78ca66fa84 100644
--- a/engines/m4/burger/rooms/section5/room511.cpp
+++ b/engines/m4/burger/rooms/section5/room511.cpp
@@ -41,42 +41,11 @@ const seriesStreamBreak Room511::SERIES1[] = {
STREAM_BREAK_END
};
-const seriesStreamBreak Room511::SERIES2[] = {
- { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
- { 1, "512f003a", 1, 255, -1, 0, &_state2, 11 },
- { 1, "512f003b", 1, 255, -1, 0, &_state2, 12 },
- { 1, "512f001a", 1, 255, -1, 0, &_state2, 21 },
- { 1, "512f001b", 1, 255, -1, 0, &_state2, 22 },
- { 1, "512f001c", 1, 255, -1, 0, &_state2, 23 },
- { 1, "512f002a", 1, 255, -1, 0, &_state2, 31 },
- { 33, "608_001", 2, 200, -1, 0, nullptr, 0 },
- { 48, "608_002", 2, 200, -1, 0, nullptr, 0 },
- STREAM_BREAK_END
-};
-
-const seriesStreamBreak Room511::SERIES3[] = {
- { 0, "513_001", 3, 40, -1, (uint)-1, nullptr, 0 },
- { 0, "513w001", 1, 255, -1, 0, nullptr, 0 },
- { 33, "513w002", 1, 255, -1, 0, nullptr, 0 },
- { 44, "513z001", 1, 255, -1, 0, nullptr, 0 },
- { 51, "513w003", 1, 255, -1, 0, nullptr, 0 },
- { 67, "513z002", 1, 255, -1, 0, nullptr, 0 },
- { 117, "513z003", 1, 255, -1, 0, nullptr, 0 },
- { 196, "513w005", 1, 255, -1, 0, nullptr, 0 },
- { 209, "513z004", 1, 255, -1, 0, nullptr, 0 },
- { 244, "513w006", 1, 255, -1, 0, nullptr, 0 },
- { 292, "513z005", 1, 255, -1, 0, nullptr, 0 },
- { 310, "513z006", 1, 255, -1, 0, nullptr, 0 },
- STREAM_BREAK_END
-};
-
long Room511::_state1;
-long Room511::_state2;
Room511::Room511() : Section5Room() {
_state1 = 0;
- _state2 = 0;
}
void Room511::preload() {
diff --git a/engines/m4/burger/rooms/section5/room511.h b/engines/m4/burger/rooms/section5/room511.h
index 9020dcf94e9..4d0bc6f91f8 100644
--- a/engines/m4/burger/rooms/section5/room511.h
+++ b/engines/m4/burger/rooms/section5/room511.h
@@ -31,10 +31,7 @@ namespace Rooms {
class Room511 : public Section5Room {
private:
static const seriesStreamBreak SERIES1[];
- static const seriesStreamBreak SERIES2[];
- static const seriesStreamBreak SERIES3[];
static long _state1;
- static long _state2;
int _val1 = 0;
public:
diff --git a/engines/m4/burger/rooms/section5/room512.cpp b/engines/m4/burger/rooms/section5/room512.cpp
index f19bce10184..ae212c42f71 100644
--- a/engines/m4/burger/rooms/section5/room512.cpp
+++ b/engines/m4/burger/rooms/section5/room512.cpp
@@ -27,18 +27,68 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room512::SERIES1[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 1, "512f003a", 1, 255, -1, 0, &_state1, 11 },
+ { 1, "512f003b", 1, 255, -1, 0, &_state1, 12 },
+ { 1, "512f001a", 1, 255, -1, 0, &_state1, 21 },
+ { 1, "512f001b", 1, 255, -1, 0, &_state1, 22 },
+ { 1, "512f001c", 1, 255, -1, 0, &_state1, 23 },
+ { 1, "512f002a", 1, 255, -1, 0, &_state1, 31 },
+ { 33, "608_001", 2, 200, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 200, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+long Room512::_state1;
+
+
+Room512::Room512() : Section5Room() {
+ _state1 = 0;
+}
+
+void Room512::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room512::init() {
+ pal_cycle_init(101, 110, 6);
+ kernel_trigger_dispatch_now(1);
}
void Room512::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_G(wilbur_should)) {
+ case gCHANGE_WILBUR_ANIMATION:
+ _state1 = imath_ranged_rand(11, 12);
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "512burnt", 6, 1, 2);
+ break;
-void Room512::pre_parser() {
+ case 5004:
+ _state1 = 31;
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "512burnt", 6, 1, 2);
+ break;
-}
+ default:
+ _state1 = imath_ranged_rand(21, 23);
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "512burnt", 6, 1, 2);
+ break;
+ }
+ break;
-void Room512::parser() {
+ case 2:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ release_trigger_on_digi_state(g10027, 1);
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room512.h b/engines/m4/burger/rooms/section5/room512.h
index 3c7f550a78b..528f93c4194 100644
--- a/engines/m4/burger/rooms/section5/room512.h
+++ b/engines/m4/burger/rooms/section5/room512.h
@@ -29,14 +29,17 @@ namespace Burger {
namespace Rooms {
class Room512 : public Section5Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static long _state1;
+
public:
- Room512() : Section5Room() {}
+ Room512();
~Room512() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
- void parser() override;
};
} // namespace Rooms
Commit: 0000635c3eefc11427221c7b68251ab2082241cc
https://github.com/scummvm/scummvm/commit/0000635c3eefc11427221c7b68251ab2082241cc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 513
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section5/room513.cpp
engines/m4/burger/rooms/section5/room513.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index b211076cf74..5f08ab0207c 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -217,7 +217,7 @@ enum {
V181 = 181,
V182 = 182,
V183 = 183,
- ROOM101_FLAG16 = 184,
+ V184 = 184,
V185 = 185,
V186 = 186,
V187 = 187,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 2c1ef784bd7..485bd624f0f 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -288,7 +288,7 @@ void Room101::daemon() {
} else {
_G(walker).wilbur_speech("101w532", 7);
}
- } else if (!_G(flags)[ROOM101_FLAG16]) {
+ } else if (!_G(flags)[V184]) {
switch (_G(flags)[V185]) {
case 0:
case 1:
@@ -328,7 +328,7 @@ void Room101::daemon() {
loadSounds();
ws_hide_walker(_G(my_walker));
- if (_G(flags)[V241] || _G(flags)[ROOM101_FLAG16])
+ if (_G(flags)[V241] || _G(flags)[V184])
series_load("101wi13s", -1, nullptr);
if (_G(flags)[ROOM101_FLAG10])
series_load("101wi12s", -1, nullptr);
@@ -388,7 +388,7 @@ void Room101::daemon() {
case 15:
daemon15();
- if (_G(flags)[ROOM101_FLAG10] && (_G(flags)[ROOM101_FLAG16] || _G(flags)[V220])) {
+ if (_G(flags)[ROOM101_FLAG10] && (_G(flags)[V184] || _G(flags)[V220])) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 16);
@@ -407,7 +407,7 @@ void Room101::daemon() {
case 18:
daemon18();
- if (_G(flags)[ROOM101_FLAG16]) {
+ if (_G(flags)[V184]) {
if (_G(flags)[ROOM101_FLAG20] || _G(flags)[V220]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -807,7 +807,7 @@ void Room101::daemon15() {
}
void Room101::daemon18() {
- if (_G(flags)[V220] || _G(flags)[ROOM101_FLAG16]) {
+ if (_G(flags)[V220] || _G(flags)[V184]) {
inv_give_to_player("laxative");
inv_give_to_player("amplifier");
_G(flags)[V067] = 1;
diff --git a/engines/m4/burger/rooms/section5/room513.cpp b/engines/m4/burger/rooms/section5/room513.cpp
index ebab73cea1b..e0b00a8d369 100644
--- a/engines/m4/burger/rooms/section5/room513.cpp
+++ b/engines/m4/burger/rooms/section5/room513.cpp
@@ -27,18 +27,43 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Room513::init() {
-}
+const seriesStreamBreak Room513::SERIES1[] = {
+ { 0, "513_001", 3, 40, -1, (uint)-1, nullptr, 0 },
+ { 0, "513w001", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "513w002", 1, 255, -1, 0, nullptr, 0 },
+ { 44, "513z001", 1, 255, -1, 0, nullptr, 0 },
+ { 51, "513w003", 1, 255, -1, 0, nullptr, 0 },
+ { 67, "513z002", 1, 255, -1, 0, nullptr, 0 },
+ { 117, "513z003", 1, 255, -1, 0, nullptr, 0 },
+ { 196, "513w005", 1, 255, -1, 0, nullptr, 0 },
+ { 209, "513z004", 1, 255, -1, 0, nullptr, 0 },
+ { 244, "513w006", 1, 255, -1, 0, nullptr, 0 },
+ { 292, "513z005", 1, 255, -1, 0, nullptr, 0 },
+ { 310, "513z006", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
-void Room513::daemon() {
-}
-void Room513::pre_parser() {
+void Room513::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+void Room513::init() {
+ _G(flags)[V184] = 1;
+ kernel_trigger_dispatch_now(1);
}
-void Room513::parser() {
+void Room513::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "513OUTRO", 6, 1, g10027);
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room513.h b/engines/m4/burger/rooms/section5/room513.h
index 3391053e345..6bdfd6950ac 100644
--- a/engines/m4/burger/rooms/section5/room513.h
+++ b/engines/m4/burger/rooms/section5/room513.h
@@ -29,14 +29,16 @@ namespace Burger {
namespace Rooms {
class Room513 : public Section5Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+
public:
Room513() : Section5Room() {}
~Room513() override {}
+ void preload() override;
void init() override;
void daemon() override;
- void pre_parser() override;
- void parser() override;
};
} // namespace Rooms
Commit: ef575b28af6d9419de8a49863ceb136e4d4bf5cd
https://github.com/scummvm/scummvm/commit/ef575b28af6d9419de8a49863ceb136e4d4bf5cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 204
Changed paths:
A engines/m4/burger/rooms/section2/room204.cpp
A engines/m4/burger/rooms/section2/room204.h
A engines/m4/burger/rooms/section2/room207.cpp
A engines/m4/burger/rooms/section2/room207.h
A engines/m4/burger/rooms/section2/section2.cpp
A engines/m4/burger/rooms/section2/section2.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 8a285ddb452..c0c2a7f286e 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -246,7 +246,7 @@ static const char *GLOBAL_PARSER_LIST[] = {
BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
- _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section2);
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section1); // TODO: Replace me
_sections.push_back(&_section5);
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index ae7988327e3..ba5f0f540ae 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -24,6 +24,7 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/rooms/section2/section2.h"
#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/rooms/section6/section6.h"
#include "m4/burger/rooms/section7/section7.h"
@@ -36,7 +37,7 @@ namespace Burger {
class BurgerEngine : public M4Engine {
private:
Rooms::Section1 _section1;
- Rooms::Section1 _section2;
+ Rooms::Section2 _section2;
Rooms::Section1 _section3;
Rooms::Section1 _section4;
Rooms::Section5 _section5;
diff --git a/engines/m4/burger/rooms/section2/room204.cpp b/engines/m4/burger/rooms/section2/room204.cpp
new file mode 100644
index 00000000000..15ffc1f6ec8
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/room204.cpp
@@ -0,0 +1,122 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section2/room204.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+const seriesPlayBreak Room204::PLAY1[] = {
+ { 0, 2, 0, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room204::PLAY2[] = {
+ { 2, 8, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 9, 14, "204_001", 2, 63, -1, 0, 0, nullptr, 0 },
+ { 14, 9, "204_001", 2, 63, -1, 1, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room204::PLAY3[] = {
+ { 15, 18, "204w001", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room204::PLAY4[] = {
+ { 18, -1, nullptr, 0, 0, -1, 16, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
+void Room204::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room204::init() {
+ digi_preload("200_001");
+ digi_play_loop("200_001", 3, 85, -1, 200);
+ series_load("204as01");
+ series_load("204as01s");
+ digi_preload("204_001");
+ digi_preload("204w001");
+
+ kernel_trigger_dispatch_now(1);
+}
+
+void Room204::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ series_show("204as01", 0x100, 0, 2, 120, 0);
+ series_show("204as01s", 0x101, 0, 2, 120, 0);
+ break;
+
+ case 2:
+ series_play_with_breaks(PLAY1, "204as01", 0x100, 3, 1);
+ break;
+
+ case 3:
+ series_show("204as01", 0x100, 0, 4, 60, 2);
+ series_show("204as01s", 0x101, 0, -1, 60, 2);
+ break;
+
+ case 4:
+ series_play_with_breaks(PLAY2, "204as01", 0x100, 5, 1, 6);
+ break;
+
+ case 5:
+ series_show("204as01", 0x100, 0, 6, 60, 14);
+ series_show("204as01s", 0x101, 0, -1, 60, 14);
+ break;
+
+ case 6:
+ series_play_with_breaks(PLAY3, "204as01", 0x100, 7, 1, 6);
+ break;
+
+ case 7:
+ series_show("204as01", 0x100, 0, 8, 15, 18);
+ series_show("204as01s", 0x101, 0, -1, 15, 18);
+ break;
+
+ case 8:
+ series_play_with_breaks(PLAY4, "204as01", 0x100, 9, 1, 6);
+ break;
+
+ case 9:
+ kernel_timing_trigger(60, 10);
+ break;
+
+ case 10:
+ disable_player_commands_and_fade_init(2002);
+ break;
+
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section2/room204.h b/engines/m4/burger/rooms/section2/room204.h
new file mode 100644
index 00000000000..0ec2b18f9ec
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/room204.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION2_ROOM204_H
+#define M4_BURGER_ROOMS_SECTION2_ROOM204_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room204 : public Room {
+private:
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+
+public:
+ Room204() : Room() {}
+ ~Room204() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
new file mode 100644
index 00000000000..7255d7c21ec
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -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/ },.
+ *
+ */
+
+#include "m4/burger/rooms/section2/room207.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room207::init() {
+}
+
+void Room207::daemon() {
+}
+
+void Room207::parser() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section2/room207.h b/engines/m4/burger/rooms/section2/room207.h
new file mode 100644
index 00000000000..a256c349f29
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/room207.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_BURGER_ROOMS_SECTION2_ROOM207_H
+#define M4_BURGER_ROOMS_SECTION2_ROOM207_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room207 : public Room {
+public:
+ Room207() : Room() {}
+ ~Room207() override {}
+
+ void init() override;
+ void daemon() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section2/section2.cpp b/engines/m4/burger/rooms/section2/section2.cpp
new file mode 100644
index 00000000000..29a13fbd4d6
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/section2.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section2/section2.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section2::Section2() : Rooms::Section() {
+ add(204, &_room204);
+ add(207, &_room207);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section2/section2.h b/engines/m4/burger/rooms/section2/section2.h
new file mode 100644
index 00000000000..fc1204771c8
--- /dev/null
+++ b/engines/m4/burger/rooms/section2/section2.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION2_H
+#define M4_BURGER_ROOMS_SECTION2_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section2/room204.h"
+#include "m4/burger/rooms/section2/room207.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section2 : public Rooms::Section {
+private:
+ Room204 _room204;
+ Room207 _room207;
+
+public:
+ Section2();
+ virtual ~Section2() {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8822b17bc2e..373f581061a 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -111,6 +111,10 @@ MODULE_OBJS = \
burger/rooms/section1/room174.o \
burger/rooms/section1/room175.o \
burger/rooms/section1/room176.o \
+ burger/rooms/section2/section2.o \
+ burger/rooms/section2/room204.o \
+ burger/rooms/section2/room207.o \
+ burger/rooms/section1/section2.o \
burger/rooms/section5/section5.o \
burger/rooms/section5/section5_room.o \
burger/rooms/section5/room501.o \
Commit: 3c3b2e0bc8d47cee66cb8e97cedaa426877d6ce8
https://github.com/scummvm/scummvm/commit/3c3b2e0bc8d47cee66cb8e97cedaa426877d6ce8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 207 methods
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section2/room207.cpp
engines/m4/burger/rooms/section2/room207.h
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 5f08ab0207c..954b9efed16 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -131,9 +131,9 @@ enum {
V096 = 96,
V097 = 97,
V098 = 98,
- ROOM101_FLAG10 = 99,
+ V099 = 99,
- ROOM101_FLAG11 = 100,
+ V100 = 100,
V101 = 101,
ROOM101_FLAG13 = 102,
ROOM101_FLAG14 = 103,
@@ -186,7 +186,7 @@ enum {
V150 = 150,
V151 = 151,
ROOM101_FLAG20 = 152,
- ROOM101_FLAG21 = 153,
+ V153 = 153,
V154 = 154,
V155 = 155,
V156 = 156,
@@ -321,7 +321,7 @@ enum {
V284 = 284,
V285 = 285,
V286 = 286,
- ROOM101_FLAG2 = 287,
+ V287 = 287,
NEURO_TEST_COUNTER = 288,
ROOM101_FLAG9 = 289,
ROOM101_FLAG7 = 290,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 485bd624f0f..6674e90f0f8 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -187,7 +187,7 @@ void Room101::init() {
ws_demand_facing(_G(my_walker), 5);
if (_G(game).previous_section > 1) {
- if (_G(flags)[ROOM101_FLAG2]) {
+ if (_G(flags)[V287]) {
ws_demand_location(_G(my_walker), 280, 309);
ws_demand_facing(_G(my_walker), 8);
player_set_commands_allowed(false);
@@ -246,7 +246,7 @@ void Room101::daemon() {
break;
case 6:
- if (!_G(flags)[ROOM101_FLAG2]) {
+ if (!_G(flags)[V287]) {
uint idx = _G(flags)[NEURO_TEST_COUNTER];
assert(idx < 8);
@@ -272,8 +272,8 @@ void Room101::daemon() {
} else {
_G(walker).wilbur_speech("101w524", 7);
}
- } else if (!_G(flags)[ROOM101_FLAG10]) {
- if (_G(flags)[ROOM101_FLAG11] <= 1) {
+ } else if (!_G(flags)[V099]) {
+ if (_G(flags)[V100] <= 1) {
_G(walker).wilbur_speech("101w530", 7);
} else if (!_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG13]) {
_G(walker).wilbur_speech("101w531", 7);
@@ -281,7 +281,7 @@ void Room101::daemon() {
} else if (_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG14]) {
_G(walker).wilbur_speech("101w533", 7);
_G(flags)[ROOM101_FLAG14] = 1;
- } else if (_G(flags)[ROOM101_FLAG12] && _G(flags)[ROOM101_FLAG11] >= 5 &&
+ } else if (_G(flags)[ROOM101_FLAG12] && _G(flags)[V100] >= 5 &&
!_G(flags)[ROOM101_FLAG15]) {
_G(walker).wilbur_speech("101w534", 7);
_G(flags)[ROOM101_FLAG15] = 1;
@@ -307,7 +307,7 @@ void Room101::daemon() {
break;
}
} else if (!_G(flags)[ROOM101_FLAG20]) {
- switch (_G(flags)[ROOM101_FLAG21]) {
+ switch (_G(flags)[V153]) {
case 0:
case 1:
_G(walker).wilbur_speech("101w570", 7);
@@ -330,7 +330,7 @@ void Room101::daemon() {
if (_G(flags)[V241] || _G(flags)[V184])
series_load("101wi13s", -1, nullptr);
- if (_G(flags)[ROOM101_FLAG10])
+ if (_G(flags)[V099])
series_load("101wi12s", -1, nullptr);
if (_G(flags)[ROOM101_FLAG20])
series_load("101wi11s", -1, nullptr);
@@ -367,7 +367,7 @@ void Room101::daemon() {
daemon12();
if (_G(flags)[V241]) {
- if (_G(flags)[ROOM101_FLAG10] || _G(flags)[V112] ||
+ if (_G(flags)[V099] || _G(flags)[V112] ||
_G(flags)[V080] || _G(flags)[V126]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -388,7 +388,7 @@ void Room101::daemon() {
case 15:
daemon15();
- if (_G(flags)[ROOM101_FLAG10] && (_G(flags)[V184] || _G(flags)[V220])) {
+ if (_G(flags)[V099] && (_G(flags)[V184] || _G(flags)[V220])) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 16);
@@ -761,7 +761,7 @@ void Room101::daemon12() {
}
void Room101::daemon15() {
- if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[ROOM101_FLAG10]) {
+ if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[V099]) {
inv_give_to_player("PHONE BILL");
inv_give_to_player("WHISTLE");
_G(flags)[V079] = 0;
@@ -771,7 +771,7 @@ void Room101::daemon15() {
_G(flags)[V080] = 0;
}
- if (_G(flags)[V126] || _G(flags)[ROOM101_FLAG10]) {
+ if (_G(flags)[V126] || _G(flags)[V099]) {
inv_give_to_player("CARROT JUICE");
_G(flags)[V088] = 1;
_G(flags)[V091] = 1;
@@ -780,7 +780,7 @@ void Room101::daemon15() {
_G(flags)[V091] = 0;
}
- if (_G(flags)[ROOM101_FLAG12] || _G(flags)[ROOM101_FLAG10]) {
+ if (_G(flags)[ROOM101_FLAG12] || _G(flags)[V099]) {
_G(flags).set_boonsville_time(6001);
_G(flags)[V000] = 1002;
_G(flags)[V001] = 0;
@@ -802,7 +802,7 @@ void Room101::daemon15() {
_G(flags)[V063] = 0;
_G(flags)[V092] = 0;
- if (_G(flags)[ROOM101_FLAG10])
+ if (_G(flags)[V099])
_G(flags).set_boonsville_time(6600);
}
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
index 7255d7c21ec..37fe6174384 100644
--- a/engines/m4/burger/rooms/section2/room207.cpp
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -26,13 +26,108 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+void Room207::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room207::init() {
+ player_set_commands_allowed(false);
+ digi_preload("207_001");
+ digi_play_loop("207_001", 3, 60);
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ series_load("207WI01");
+ series_load("207AS01");
+ series_load("207AS01S");
+ series_load("207AS03");
+ series_load("207AS03S");
+ series_load("207AS04");
+ series_load("207AS04S");
+
+ _conv1 = getConvName();
+ if (!_conv1)
+ _conv1 = "conv51";
+
+ interface_hide();
+
+ if (!strcmp(_conv1, "conv53")) {
+ _G(kernel).suppress_fadeup = true;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ kernel_trigger_dispatch_now(2);
+ }
}
void Room207::daemon() {
+ // TODO
}
void Room207::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!player_said(_conv1)) {
+ handleConv();
+ _G(player).command_ready = false;
+ }
+}
+
+const char *Room207::getConvName() {
+ _conv2 = nullptr;
+ if (_G(flags)[V287] && !_G(flags)[V242])
+ _conv2 = "conv51";
+
+ if (_G(flags)[V242] == 5 && _G(flags)[V241] == 0 && !player_been_here(612)) {
+ if (_G(flags)[V248])
+ _conv2 = "conv52";
+ else
+ --_G(flags)[V242];
+ }
+
+ if (_G(flags)[V241] && !_G(flags)[V100])
+ _conv2 = "conv53";
+
+ if (_G(flags)[V100] == 5 && !_G(flags)[V099] && !player_been_here(310) &&
+ !player_been_here(311) && !player_been_here(312) && !player_been_here(313) &&
+ !player_been_here(314) && !player_been_here(315) && !player_been_here(316) &&
+ !player_been_here(317) && !player_been_here(318) && !player_been_here(319))
+ _conv2 = "conv54";
+
+ if (_G(flags)[V099] && !_G(flags)[V185])
+ _conv2 = "conv55";
+
+ if (_G(flags)[V185] == 5 && !_G(flags)[V184])
+ _conv2 = "conv56";
+
+ if (_G(flags)[V184] && !_G(flags)[V153])
+ _conv2 = "conv57";
+
+ if (_G(flags)[V153] == 5)
+ _conv2 = "conv58";
+
+ return _conv2;
+}
+
+void Room207::handleConv() {
+ int who = conv_whos_talking();
+ const char *sound = conv_sound_to_play();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (!sound) {
+ if (who == 1) {
+ _G(wilbur_should) = 1;
+
+ if (player_said("conv56") && node == 4)
+ _val1 = 8;
+
+ if (node == 0 && entry == 1)
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, -1);
+ } else if (player_said("conv51") && node == 8) {
+ _val1 = 13;
+ } else {
+ _val1 = 1;
+ }
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section2/room207.h b/engines/m4/burger/rooms/section2/room207.h
index a256c349f29..77ce6d0ea2b 100644
--- a/engines/m4/burger/rooms/section2/room207.h
+++ b/engines/m4/burger/rooms/section2/room207.h
@@ -29,10 +29,19 @@ namespace Burger {
namespace Rooms {
class Room207 : public Room {
+private:
+ const char *_conv1 = nullptr;
+ const char *_conv2 = nullptr;
+ int _val1 = 0;
+
+ const char *getConvName();
+ void handleConv();
+
public:
Room207() : Room() {}
~Room207() override {}
+ void preload() override;
void init() override;
void daemon() override;
void parser() override;
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 6feddac02df..c6457931cc1 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -506,7 +506,7 @@ void Room801::daemon() {
break;
case 36:
- _G(flags)[ROOM101_FLAG2] = 1;
+ _G(flags)[V287] = 1;
adv_kill_digi_between_rooms(1);
kernel_trigger_dispatch_now(g10027);
break;
Commit: 3e02e370b936977a087707fe2fb0fa18504a1f7c
https://github.com/scummvm/scummvm/commit/3e02e370b936977a087707fe2fb0fa18504a1f7c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 207 daemon
Changed paths:
engines/m4/burger/rooms/section2/room207.cpp
engines/m4/burger/rooms/section2/room207.h
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
index 37fe6174384..1ac7d7ea5ba 100644
--- a/engines/m4/burger/rooms/section2/room207.cpp
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -26,6 +26,84 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesPlayBreak Room207::PLAY1[] = {
+ { 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY2[] = {
+ { 22, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 18, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 31, 33, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 34, 31, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY3[] = {
+ { 0, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 25, 29, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY4[] = {
+ { 29, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY5[] = {
+ { 35, 37, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 37, 35, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY6[] = {
+ { 0, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY7[] = {
+ { 29, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY8[] = {
+ { 5, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY9[] = {
+ { 23, 5, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY10[] = {
+ { 31, 24, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY11[] = {
+ { 24, 31, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room207::PLAY12[] = {
+ { 18, 22, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesStreamBreak Room207::SERIES1[] = {
+ { 0, 0, 0, 0, -1, 0, 0, 0 },
+ { 18, "207w001", 1, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room207::SERIES2[] = {
+ { 0, 0, 0, 0, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room207::preload() {
_G(player).walker_in_this_scene = false;
}
@@ -59,7 +137,248 @@ void Room207::init() {
}
void Room207::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val2) {
+ case 15:
+ switch (_val1) {
+ case 1:
+ _val1 = 7;
+ _series1.play("207as03", 0x200, 4, -1, 6, -1, 100, 0, 0, 31, 34);
+ digi_play(conv_sound_to_play(), 1, 255, 1);
+ break;
+
+ case 7:
+ _series1.terminate();
+ _val1 = 10;
+ conv_resume_curr();
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 8:
+ _val2 = 16;
+ _val1 = 8;
+ series_play_with_breaks(PLAY4, "207as03", 0x200, 5, 1);
+ break;
+
+ case 10:
+ _val1 = getVal();
+ series_show("207as03", 0x200, 0, 1, 30, 30);
+ series_show("207as03s", 0x201, 0, -1, 30, 30);
+ break;
+
+ case 11:
+ _val1 = 10;
+ series_play_with_breaks(PLAY5, "207as03", 0x200, 1, 1);
+ break;
+
+ case 12:
+ _val2 = 17;
+ _val1 = 12;
+ series_play_with_breaks(PLAY10, "207as04", 0x200, 1, 1);
+ break;
+
+ case 13:
+ _val2 = 0;
+ series_play_with_breaks(PLAY7, "207as03", 0x200, 1, 1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 16:
+ switch (_val1) {
+ case 1:
+ _val1 = 7;
+ _series1.play("207as01", 0x200, 4, -1, 6, -1, 100, 0, 0, 26, 30);
+ digi_play(conv_sound_to_play(), 1, 255, 1);
+ break;
+
+ case 7:
+ _series1.terminate();
+ _val1 = 8;
+ conv_resume_curr();
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 8:
+ _val1 = getVal();
+ _series1.show("207as01", 0x200, 0, 1, 30, 23);
+ break;
+
+ case 9:
+ _val1 = 8;
+ series_play_with_breaks(PLAY2, "207as01", 0x200, 1, 1);
+ break;
+
+ case 10:
+ _val2 = 15;
+ _val1 = 10;
+ series_play_with_breaks(PLAY3, "207as03", 0x200, 1, 1);
+ break;
+
+ case 12:
+ _val2 = 17;
+ _val1 = 12;
+ series_play_with_breaks(PLAY8, "207as04", 0x200, 1, 1);
+ break;
+
+ case 13:
+ _val2 = 0;
+ series_play_with_breaks(PLAY6, "207as03", 0x200, 1, 1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 17:
+ switch (_val1) {
+ case 1:
+ _val1 = 7;
+ _series1.play("207as04", 0x200, 4, -1, 6, -1, 100, 0, 0, 0, 4);
+ digi_play(conv_sound_to_play(), 1, 255, 1);
+ break;
+
+ case 7:
+ _series1.terminate();
+ _val1 = 12;
+ conv_resume_curr();
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 8:
+ _val2 = 16;
+ _val1 = 8;
+ series_play_with_breaks(PLAY9, "207as04", 0x200, 5, 1);
+ break;
+
+ case 10:
+ _val2 = 15;
+ _val1 = 10;
+ series_play_with_breaks(PLAY11, "207as04", 0x200, 1, 1);
+ break;
+
+ case 12:
+ _val1 = getVal();
+ series_show("207as04", 0x200, 0, 1, 30, 0);
+ series_show("207as04s", 0x201, 0, -1, 30, 0);
+ break;
+
+ case 13:
+ _val2 = 15;
+ series_play_with_breaks(PLAY11, "207as03", 0x200, 1, 1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ switch (_val1) {
+ case 5:
+ _val2 = 16;
+ _val1 = 8;
+ series_play_with_breaks(PLAY1, "207as01", 0x200, 1, 1);
+ break;
+
+ case 13:
+ digi_play(conv_sound_to_play(), 1, 255, 6);
+ _series1.play("207as03", 0x200, 1, -1, 6, -1, 100, 0, 0, 18, 22);
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+ break;
+
+ case 2:
+ conv_load_and_prepare(_conv1, 7);
+ conv_play_curr();
+
+ _G(wilbur_should) = 4;
+ _val2 = 0;
+ _val1 = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 3:
+ gr_backup_palette();
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "207a", 6, 0x100, 4);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 0, -1);
+ break;
+
+ case 4:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ series_stream_with_breaks(SERIES2, "207b", 6, 0xf00, -1);
+ gr_restore_palette();
+ release_trigger_on_digi_state(2, 1);
+ break;
+
+ case 5:
+ series_play_with_breaks(PLAY12, "207as01", 0x200, 1, 1);
+ break;
+
+ case 6:
+ _series1.terminate();
+ series_show("207as03", 0x200, 0, -1, -1, 22);
+ series_show("207as03s", 0x201, 0, -1, -1, 22);
+ conv_resume_curr();
+ break;
+
+ case 7:
+ player_set_commands_allowed(false);
+ disable_player_commands_and_fade_init(8);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ if (!strcmp(conv_sound_to_play(), "53p0101")) {
+ _G(wilbur_should) = 3;
+ conv_resume_curr();
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(wilbur_should) = 2;
+ digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ _general1 = series_play("207wi01", 0x400, 4);
+ }
+ break;
+
+ case 2:
+ terminateMachineAndNull(_general1);
+ _G(wilbur_should) = 3;
+ conv_resume_curr();
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 3:
+ _G(wilbur_should) = getShould();
+ series_show("207wi01", 0x400, 0, gCHANGE_WILBUR_ANIMATION, 30, 0);
+ break;
+
+ case 4:
+ _G(wilbur_should) = getShould();
+ series_play("207wi01", 0x400, 1, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room207::parser() {
@@ -130,6 +449,59 @@ void Room207::handleConv() {
}
}
+int Room207::getVal() const {
+ int rand = imath_ranged_rand(1, 24);
+
+ switch (_val2) {
+ case 15:
+ switch (rand) {
+ case 1:
+ return 8;
+ case 2:
+ return 11;
+ case 3:
+ return 12;
+ default:
+ return 10;
+ }
+ break;
+
+ case 16:
+ switch (rand) {
+ case 1:
+ return 10;
+ case 2:
+ case 3:
+ return 9;
+ case 4:
+ return 12;
+
+ default:
+ return 8;
+ }
+ break;
+
+ case 17:
+ switch (rand) {
+ case 1:
+ return 8;
+ case 2:
+ return 10;
+ default:
+ return 12;
+ }
+ break;
+
+ default:
+ return _val1;
+ }
+}
+
+int Room207::getShould() const {
+ int rand = imath_ranged_rand(1, 8);
+ return (rand == 1) ? 4 : 3;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section2/room207.h b/engines/m4/burger/rooms/section2/room207.h
index 77ce6d0ea2b..657216a43c3 100644
--- a/engines/m4/burger/rooms/section2/room207.h
+++ b/engines/m4/burger/rooms/section2/room207.h
@@ -30,12 +30,31 @@ namespace Rooms {
class Room207 : public Room {
private:
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
const char *_conv1 = nullptr;
const char *_conv2 = nullptr;
+ Series _series1;
+ machine *_general1 = nullptr;
int _val1 = 0;
+ int _val2 = 0;
const char *getConvName();
void handleConv();
+ int getVal() const;
+ int getShould() const;
public:
Room207() : Room() {}
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index 937dfb5fa4a..e3d421da7b0 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -44,7 +44,7 @@ void Series::show(const char *seriesName, frac16 layer, uint32 flags,
_series = M4::series_show(seriesName, layer, flags, triggerNum, duration,
index, s, x, y);
_seriesS = M4::series_show(seriesName, layer + 1, flags, -1, duration,
- index ? index + 1 : index, s, x, y);
+ index, s, x, y);
}
void Series::show(const char *series1, const char *series2, int layer) {
@@ -52,6 +52,11 @@ void Series::show(const char *series1, const char *series2, int layer) {
_seriesS = M4::series_show(series2, layer + 1);
}
+void Series::show_index2(const char *series1, const char *series2, int layer, int index1, int index2) {
+ _series = M4::series_show(series1, layer, 0, -1, -1, index1);
+ _seriesS = M4::series_show(series2, layer + 1, 0, -1, -1, index1 + 1);
+}
+
void Series::series_play(const char *seriesName, frac16 layer, uint32 flags,
int16 triggerNum, int32 frameRate, int32 loopCount, int32 s,
int32 x, int32 y, int32 firstFrame, int32 lastFrame) {
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 9369d5c4a13..731b41a155e 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -66,6 +66,7 @@ struct Series {
int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
int32 x = 0, int32 y = 0);
void show(const char *series1, const char *series2, int layer);
+ void show_index2(const char *series1, const char *series2, int layer, int index1, int index2);
void terminate();
operator bool() const {
Commit: 158f340d00c37ed4aaddab5979cba97b7a21f230
https://github.com/scummvm/scummvm/commit/158f340d00c37ed4aaddab5979cba97b7a21f230
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 2 daemon
Changed paths:
engines/m4/burger/rooms/section2/section2.cpp
engines/m4/burger/rooms/section2/section2.h
diff --git a/engines/m4/burger/rooms/section2/section2.cpp b/engines/m4/burger/rooms/section2/section2.cpp
index 29a13fbd4d6..b7f066f5948 100644
--- a/engines/m4/burger/rooms/section2/section2.cpp
+++ b/engines/m4/burger/rooms/section2/section2.cpp
@@ -31,6 +31,23 @@ Section2::Section2() : Rooms::Section() {
add(207, &_room207);
}
+void Section2::daemon() {
+ switch (_G(kernel).trigger) {
+ case 2001:
+ _G(game).new_room = 204;
+ break;
+
+ case 2002:
+ _G(game).new_room = 207;
+ break;
+
+ default:
+ break;
+ }
+
+ _G(kernel).continue_handling_trigger = true;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section2/section2.h b/engines/m4/burger/rooms/section2/section2.h
index fc1204771c8..a855f1827bf 100644
--- a/engines/m4/burger/rooms/section2/section2.h
+++ b/engines/m4/burger/rooms/section2/section2.h
@@ -39,6 +39,8 @@ private:
public:
Section2();
virtual ~Section2() {}
+
+ void daemon() override;
};
} // namespace Rooms
Commit: 88fae69c98cf1ac450366924fdf863abfd7b84dc
https://github.com/scummvm/scummvm/commit/88fae69c98cf1ac450366924fdf863abfd7b84dc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Skeleton room classes for section 3 and 4
Changed paths:
A engines/m4/burger/rooms/section3/room301.cpp
A engines/m4/burger/rooms/section3/room301.h
A engines/m4/burger/rooms/section3/room302.cpp
A engines/m4/burger/rooms/section3/room302.h
A engines/m4/burger/rooms/section3/room303.cpp
A engines/m4/burger/rooms/section3/room303.h
A engines/m4/burger/rooms/section3/room304.cpp
A engines/m4/burger/rooms/section3/room304.h
A engines/m4/burger/rooms/section3/room305.cpp
A engines/m4/burger/rooms/section3/room305.h
A engines/m4/burger/rooms/section3/room306.cpp
A engines/m4/burger/rooms/section3/room306.h
A engines/m4/burger/rooms/section3/room307.cpp
A engines/m4/burger/rooms/section3/room307.h
A engines/m4/burger/rooms/section3/room310.cpp
A engines/m4/burger/rooms/section3/room310.h
A engines/m4/burger/rooms/section3/room319.cpp
A engines/m4/burger/rooms/section3/room319.h
A engines/m4/burger/rooms/section3/section3.cpp
A engines/m4/burger/rooms/section3/section3.h
A engines/m4/burger/rooms/section4/room401.cpp
A engines/m4/burger/rooms/section4/room401.h
A engines/m4/burger/rooms/section4/room402.cpp
A engines/m4/burger/rooms/section4/room402.h
A engines/m4/burger/rooms/section4/room404.cpp
A engines/m4/burger/rooms/section4/room404.h
A engines/m4/burger/rooms/section4/room405.cpp
A engines/m4/burger/rooms/section4/room405.h
A engines/m4/burger/rooms/section4/room406.cpp
A engines/m4/burger/rooms/section4/room406.h
A engines/m4/burger/rooms/section4/room407.cpp
A engines/m4/burger/rooms/section4/room407.h
A engines/m4/burger/rooms/section4/section4.cpp
A engines/m4/burger/rooms/section4/section4.h
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index c0c2a7f286e..88f916b6c6e 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -247,8 +247,8 @@ BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
_sections.push_back(&_section2);
- _sections.push_back(&_section1); // TODO: Replace me
- _sections.push_back(&_section1); // TODO: Replace me
+ _sections.push_back(&_section3);
+ _sections.push_back(&_section4);
_sections.push_back(&_section5);
_sections.push_back(&_section6);
_sections.push_back(&_section7);
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index ba5f0f540ae..3ed8c2f94b4 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -25,6 +25,8 @@
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/rooms/section2/section2.h"
+#include "m4/burger/rooms/section3/section3.h"
+#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/rooms/section6/section6.h"
#include "m4/burger/rooms/section7/section7.h"
@@ -38,8 +40,8 @@ class BurgerEngine : public M4Engine {
private:
Rooms::Section1 _section1;
Rooms::Section2 _section2;
- Rooms::Section1 _section3;
- Rooms::Section1 _section4;
+ Rooms::Section3 _section3;
+ Rooms::Section4 _section4;
Rooms::Section5 _section5;
Rooms::Section6 _section6;
Rooms::Section7 _section7;
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
new file mode 100644
index 00000000000..8bef84e1fe4
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room301.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room301::init() {
+}
+
+void Room301::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room301.h b/engines/m4/burger/rooms/section3/room301.h
new file mode 100644
index 00000000000..5f6728ab088
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room301.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM301_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM301_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room301 : public Room {
+public:
+ Room301() : Room() {}
+ ~Room301() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
new file mode 100644
index 00000000000..63978889847
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room302.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room302::init() {
+}
+
+void Room302::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
new file mode 100644
index 00000000000..0395119effa
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM302_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM302_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room302 : public Room {
+public:
+ Room302() : Room() {}
+ ~Room302() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
new file mode 100644
index 00000000000..8ec1da3ac66
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room303.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room303::init() {
+}
+
+void Room303::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
new file mode 100644
index 00000000000..ee6a3e19344
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM303_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM303_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room303 : public Room {
+public:
+ Room303() : Room() {}
+ ~Room303() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
new file mode 100644
index 00000000000..9b31781ecce
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room304.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room304::init() {
+}
+
+void Room304::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room304.h b/engines/m4/burger/rooms/section3/room304.h
new file mode 100644
index 00000000000..c02a3428f63
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room304.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM304_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM304_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room304 : public Room {
+public:
+ Room304() : Room() {}
+ ~Room304() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
new file mode 100644
index 00000000000..4b41c04a616
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room305.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room305::init() {
+}
+
+void Room305::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
new file mode 100644
index 00000000000..d077cbfe77f
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM305_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM305_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room305 : public Room {
+public:
+ Room305() : Room() {}
+ ~Room305() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room306.cpp b/engines/m4/burger/rooms/section3/room306.cpp
new file mode 100644
index 00000000000..b6d3c19b888
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room306.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room306.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room306::init() {
+}
+
+void Room306::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room306.h b/engines/m4/burger/rooms/section3/room306.h
new file mode 100644
index 00000000000..3c51efb7d1b
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room306.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM306_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM306_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room306 : public Room {
+public:
+ Room306() : Room() {}
+ ~Room306() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room307.cpp b/engines/m4/burger/rooms/section3/room307.cpp
new file mode 100644
index 00000000000..f19a66d10bf
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room307.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room307.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room307::init() {
+}
+
+void Room307::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room307.h b/engines/m4/burger/rooms/section3/room307.h
new file mode 100644
index 00000000000..6b00563b72c
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room307.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM307_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM307_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room307 : public Room {
+public:
+ Room307() : Room() {}
+ ~Room307() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
new file mode 100644
index 00000000000..47ccf702ce0
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room310.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room310::init() {
+}
+
+void Room310::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
new file mode 100644
index 00000000000..0088d0146f0
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM310_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM310_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room310 : public Room {
+public:
+ Room310() : Room() {}
+ ~Room310() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room319.cpp b/engines/m4/burger/rooms/section3/room319.cpp
new file mode 100644
index 00000000000..d4e2e799ecd
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room319.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/room319.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room319::init() {
+}
+
+void Room319::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room319.h b/engines/m4/burger/rooms/section3/room319.h
new file mode 100644
index 00000000000..e9fabcce197
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/room319.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM319_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM319_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room319 : public Room {
+public:
+ Room319() : Room() {}
+ ~Room319() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
new file mode 100644
index 00000000000..79ae1929aeb
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/section3.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section3::Section3() : Rooms::Section() {
+ add(301, &_room301);
+ add(302, &_room302);
+ add(303, &_room303);
+ add(304, &_room304);
+ add(305, &_room305);
+ add(306, &_room306);
+ add(307, &_room307);
+ add(310, &_room310);
+ add(319, &_room319);
+}
+
+void Section3::daemon() {
+ // TODO
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/section3.h b/engines/m4/burger/rooms/section3/section3.h
new file mode 100644
index 00000000000..a09454b4880
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/section3.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_H
+#define M4_BURGER_ROOMS_SECTION3_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section3/room301.h"
+#include "m4/burger/rooms/section3/room302.h"
+#include "m4/burger/rooms/section3/room303.h"
+#include "m4/burger/rooms/section3/room304.h"
+#include "m4/burger/rooms/section3/room305.h"
+#include "m4/burger/rooms/section3/room306.h"
+#include "m4/burger/rooms/section3/room307.h"
+#include "m4/burger/rooms/section3/room310.h"
+#include "m4/burger/rooms/section3/room319.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section3 : public Rooms::Section {
+private:
+ Room301 _room301;
+ Room302 _room302;
+ Room303 _room303;
+ Room304 _room304;
+ Room305 _room305;
+ Room306 _room306;
+ Room307 _room307;
+ Room310 _room310;
+ Room319 _room319;
+
+public:
+ Section3();
+ virtual ~Section3() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room401.cpp b/engines/m4/burger/rooms/section4/room401.cpp
new file mode 100644
index 00000000000..4dc27662dcf
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room401.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room401.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room401::init() {
+}
+
+void Room401::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room401.h b/engines/m4/burger/rooms/section4/room401.h
new file mode 100644
index 00000000000..29b588da54d
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room401.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM401_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM401_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room401 : public Room {
+public:
+ Room401() : Room() {}
+ ~Room401() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
new file mode 100644
index 00000000000..49085ab5be2
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room402.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room402::init() {
+}
+
+void Room402::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
new file mode 100644
index 00000000000..b319ef61f33
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM402_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM402_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room402 : public Room {
+public:
+ Room402() : Room() {}
+ ~Room402() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
new file mode 100644
index 00000000000..fe6748c74f6
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room404.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room404::init() {
+}
+
+void Room404::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room404.h b/engines/m4/burger/rooms/section4/room404.h
new file mode 100644
index 00000000000..37931f7782a
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room404.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM404_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM404_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room404 : public Room {
+public:
+ Room404() : Room() {}
+ ~Room404() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
new file mode 100644
index 00000000000..a231ee85ba9
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room405.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room405::init() {
+}
+
+void Room405::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room405.h b/engines/m4/burger/rooms/section4/room405.h
new file mode 100644
index 00000000000..c1d76a05a8e
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room405.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM405_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM405_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room405 : public Room {
+public:
+ Room405() : Room() {}
+ ~Room405() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
new file mode 100644
index 00000000000..e0e9b8a38de
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room406.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room406::init() {
+}
+
+void Room406::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
new file mode 100644
index 00000000000..22a8c802531
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM406_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM406_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room406 : public Room {
+public:
+ Room406() : Room() {}
+ ~Room406() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
new file mode 100644
index 00000000000..0774ba9eb2d
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section4/room407.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room407::init() {
+}
+
+void Room407::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
new file mode 100644
index 00000000000..57a9465b2cc
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM407_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM407_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room407 : public Room {
+public:
+ Room407() : Room() {}
+ ~Room407() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
new file mode 100644
index 00000000000..212770a6284
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/section4.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 "m4/burger/rooms/section4/section4.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+Section4::Section4() : Rooms::Section() {
+ add(401, &_room401);
+ add(402, &_room402);
+ add(404, &_room404);
+ add(405, &_room405);
+ add(406, &_room406);
+ add(407, &_room407);
+}
+
+void Section4::daemon() {
+ // TODO
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4.h b/engines/m4/burger/rooms/section4/section4.h
new file mode 100644
index 00000000000..0b3f28b8c0b
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/section4.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_H
+#define M4_BURGER_ROOMS_SECTION4_H
+
+#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section.h"
+#include "m4/burger/rooms/section4/room401.h"
+#include "m4/burger/rooms/section4/room402.h"
+#include "m4/burger/rooms/section4/room404.h"
+#include "m4/burger/rooms/section4/room405.h"
+#include "m4/burger/rooms/section4/room406.h"
+#include "m4/burger/rooms/section4/room407.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section4 : public Rooms::Section {
+private:
+ Room401 _room401;
+ Room402 _room402;
+ Room404 _room404;
+ Room405 _room405;
+ Room406 _room406;
+ Room407 _room407;
+
+public:
+ Section4();
+ virtual ~Section4() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 373f581061a..fca3ed6da20 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -114,7 +114,23 @@ MODULE_OBJS = \
burger/rooms/section2/section2.o \
burger/rooms/section2/room204.o \
burger/rooms/section2/room207.o \
- burger/rooms/section1/section2.o \
+ burger/rooms/section3/section3.o \
+ burger/rooms/section3/room301.o \
+ burger/rooms/section3/room302.o \
+ burger/rooms/section3/room303.o \
+ burger/rooms/section3/room304.o \
+ burger/rooms/section3/room305.o \
+ burger/rooms/section3/room306.o \
+ burger/rooms/section3/room307.o \
+ burger/rooms/section3/room310.o \
+ burger/rooms/section3/room319.o \
+ burger/rooms/section4/section4.o \
+ burger/rooms/section4/room401.o \
+ burger/rooms/section4/room402.o \
+ burger/rooms/section4/room404.o \
+ burger/rooms/section4/room405.o \
+ burger/rooms/section4/room406.o \
+ burger/rooms/section4/room407.o \
burger/rooms/section5/section5.o \
burger/rooms/section5/section5_room.o \
burger/rooms/section5/room501.o \
Commit: 20d3665d1693a4a6d1fc72c49824d253bed55804
https://github.com/scummvm/scummvm/commit/20d3665d1693a4a6d1fc72c49824d253bed55804
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 172 methods
Changed paths:
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room172.h
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index b7703c9d2a1..f4c3c4bc438 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -29,15 +29,83 @@ namespace Burger {
namespace Rooms {
void Room172::init() {
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 171:
+ if (!_G(flags)[V092] && !_G(flags)[V091]) {
+ player_set_commands_allowed(false);
+ series_load("172aplt");
+ series_load("172aplts");
+ series_load("172ap02t");
+ digi_preload("172p906");
+
+ _val1 = 4;
+ kernel_trigger_dispatch_now(1);
+ ws_demand_location(300, 325, 3);
+ ws_walk(368, 359, 0, -1, 2);
+
+ } else {
+ ws_demand_location(11, 296, 3);
+ ws_walk(156, 297, 0, -1, -1);
+ }
+ break;
+
+ case 173:
+ ws_demand_location(171, 254, 3);
+ ws_walk(250, 270, 0, -1, -1);
+ break;
+
+ default:
+ ws_demand_location(312, 292, 5);
+ break;
+ }
+
+ hotspot_set_active("AUNT POLLY", false);
+
+ if (_G(flags)[V092]) {
+ _val1 = 15;
+ kernel_trigger_dispatch_now(1);
+ _walk1 = intr_add_no_walk_rect(357, 311, 639, 353, 356, 354);
+ hotspot_set_active("AUNT POLLY", true);
+ } else {
+ _series1 = series_show(_G(flags)[V091] ? "172fud2" : "172fud", 0x700);
+ series_show("172fuds", 0x701);
+ }
+
+ if (inv_player_has("CARROT JUICE") || inv_player_has("BOTTLE") ||
+ inv_player_has("SOAPY WATER")) {
+ hotspot_set_active("CARROT JUICE ", false);
+ } else {
+ _series3.show("172jug", 0x700);
+ }
}
void Room172::daemon() {
+ // TODO
}
void Room172::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(flags)[V092] && _G(player).walk_x >= 357 && _G(player).walk_x <= 639 &&
+ _G(player).walk_y >= 311 && _G(player).walk_y <= 353)
+ player_hotspot_walk_override(356, 332, 3);
+
+ if (player_said_any("GEAR", "LOOK AT")) {
+ if (player_said("PARLOUR"))
+ player_set_facing_at(84, 300);
+
+ if (player_said("BASEMENT"))
+ player_set_facing_at(171, 254);
+ }
}
void Room172::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ // TODO
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room172.h b/engines/m4/burger/rooms/section1/room172.h
index ca076736857..6271538be9b 100644
--- a/engines/m4/burger/rooms/section1/room172.h
+++ b/engines/m4/burger/rooms/section1/room172.h
@@ -29,6 +29,17 @@ namespace Burger {
namespace Rooms {
class Room172 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ Series _series3;
+ machine *_series4 = nullptr;
+ machine *_series5 = nullptr;
+ machine *_series6 = nullptr;
+ machine *_series7 = nullptr;
+ noWalkRect *_walk1 = nullptr;
+ int _val1 = 0;
+
public:
Room172() : Room() {}
~Room172() override {}
Commit: ebf36f6b42197e6df33213fbe39b666a7b8b5d1f
https://github.com/scummvm/scummvm/commit/ebf36f6b42197e6df33213fbe39b666a7b8b5d1f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Arrays for remaining section 1 rooms
Changed paths:
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room173.cpp
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index f4c3c4bc438..00df029f077 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -28,6 +28,69 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "AUNT POLLY", "172w001", "172w002", "172w002" },
+ { "PARLOUR", "172w002", nullptr, nullptr },
+ { "BASEMENT", nullptr, "172w002", nullptr },
+ { "MICROWAVE", "172w003", nullptr, nullptr },
+ { "REFRIGERATOR", "172w005", "172w002", nullptr },
+ { "OVEN", nullptr, "172w002", nullptr },
+ { "SINK", "172w008", "172w009", nullptr },
+ { "HUTCH", "172w011", "172w012", "172w002" },
+ { "BROOM", "172w013", "172w014", "172w015" },
+ { "WINDOW", "172w016", "172w002", "172w017" },
+ { "CALENDAR", "172w018", "172w019", "172w018" },
+ { "CUPBOARD ", "172w021", "172w002", nullptr },
+ { "CUPBOARD", "172w022", "172w002", nullptr },
+ { "POTS AND PANS", "172w023", "172w024", "172w024" },
+ { "COOKIES", "172w025", "172w026", "172w027" },
+ { "PRESERVES", "172w028", "172w029", "172w029" },
+ { "CARROT JUICE ", "172w030", nullptr, "172w031" },
+ { "JUICER", "172w032", nullptr, "172w033" },
+ { "VEGGIES", "172w034", "172w035", "172w035" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 0, 0, 2, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 8, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 27, "172_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 28, 30, "172_005", 3, 125, -1, 0, -1, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY4[] = {
+ { 44, 45, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 45, 45, nullptr, 0, 0, -1, 0, 3, nullptr, 0 },
+ { 45, 44, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY5[] = {
+ { 36, 43, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 36, 36, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY6[] = {
+ { 46, 48, "172_004", 3, 125, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY7[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
void Room172::init() {
switch (_G(game).previous_room) {
case RESTORING_GAME:
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
index 168aae781b0..f9b9ff2b27c 100644
--- a/engines/m4/burger/rooms/section1/room173.cpp
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -28,6 +28,31 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "STAIRS", "173w002", "173w003", nullptr },
+ { "WRINGER", "173w009", "173w010", "173w008" },
+ { "BREAKER BOX", "504w017", nullptr, nullptr },
+ { "WASHING MACHINE", "173w007", nullptr, "173w008" },
+ { "SHORTS", "173w004", "173w005", "173w005" },
+ { "FAN BOY TOWEL", "173w004", "173w005", "173w005" },
+ { "SOCK", "173w004", "173w005", "173w005" },
+ { "T-SHIRT", "173w004", "173w005", "173w005" },
+ { "LAUNDRY", "173w004", "173w006", "173w006" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 0, 0, 1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room173::init() {
}
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 77262f906d7..82145aa6533 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -28,6 +28,43 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "HALLWAY", nullptr, "174w001", nullptr },
+ { "TOILET", "174w002", "174w001", nullptr },
+ { "TOILET LID", "174w002", "174w001", nullptr },
+ { "TOILET TANK", "174w002", "174w001", nullptr },
+ { "FLUSH CHAIN", "174w002", "174w001", nullptr },
+ { "TUB", "174w004", "174w001", "174w005" },
+ { "WINDOW", nullptr, "174w001", "174w006" },
+ { "SHOWERHEAD", "174w007", "174w008", nullptr },
+ { "CLOSET", "174w009", "174w010", "174w010" },
+ { "MIRROR", "174w011", nullptr, "174w011" },
+ { "LAXATIVE ", "174w012", nullptr, "174w014" },
+ { "MEDICATIONS", "174w015", "174w016", "174w017" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, 1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 18, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, 3, "507_003", 2, 255, -1, 1, 5, nullptr, 0 },
+ { 4, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 5, 5, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room174::init() {
}
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index 59ac93245aa..67f5645b68b 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section1/room175.h"
#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/core/play_break.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
@@ -28,6 +29,38 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "WILBUR'S ROOM", nullptr, "175w001", nullptr },
+ { "BATHROOM", nullptr, "175w001", nullptr },
+ { "AUNT POLLY'S ROOM", "175w002", "175w001", "175w003" },
+ { "STAIRS", "175w004", "175w001", nullptr },
+ { "WINDOW", nullptr, nullptr, "175w005" },
+ { "VASE", "175w006", "175w007", "175w008" },
+ { "PICTURE", "175w012", "175w010", "175w011" },
+ { "PICTURE ", "175w013", "175w010", "175w011" },
+ { "PICTURE ", "175w014", "175w010", "175w011" },
+ { "PICTURE ", "175w009", "176w010", "175w011" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 3, "175_002a", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 4, -1, "175_002b", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY2[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, -1, "175_002a", 1, 100, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+static const seriesPlayBreak PLAY3[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room175::init() {
}
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index c8d9edaa3a4..d55f817e6c6 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -28,6 +28,32 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const char *SAID[][4] = {
+ { "HALLWAY", nullptr, "176w001", nullptr },
+ { "PUZ DISPENSER ", "176w002", nullptr, "176w003" },
+ { "ROBOT", "176w004", "176w005", "176w006" },
+ { "WINDOW", nullptr, "176w001", "176w010" },
+ { "BED", nullptr, nullptr, "176w016" },
+ { "COMIC BOOK", "176w007", "176w008", "176w008" },
+ { "COMIC BOOK ", nullptr, "176w008", "176w008" },
+ { "GERBIL CAGE", "176w009", "176w005", "176w005" },
+ { "TELEVISION", "176w011", "176w015", "176w015" },
+ { "WARDROBE", "176w017", nullptr, "176w001" },
+ { "DRESSER", "176w018", nullptr, "176w001" },
+ { "BOOKS", nullptr, "176w008", "176w008" },
+ { "MODEL ROCKET", "176w006", "176w005", "176w006" },
+ { "MODEL ROCKET ", "176w019", "176w005", "176w006" },
+ { "MODEL ROCKET ", "176w020", "176w005", "176w006" },
+ { "POSTER", "176w021", "176w005", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room176::init() {
}
Commit: 699f1f526a2c64507e90cce751e6e49f1a75bda5
https://github.com/scummvm/scummvm/commit/699f1f526a2c64507e90cce751e6e49f1a75bda5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Static arrays for section 3 rooms
Changed paths:
engines/m4/burger/rooms/section3/room301.cpp
engines/m4/burger/rooms/section3/room301.h
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room302.h
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room303.h
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room304.h
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room305.h
engines/m4/burger/rooms/section3/room306.cpp
engines/m4/burger/rooms/section3/room306.h
engines/m4/burger/rooms/section3/room307.cpp
engines/m4/burger/rooms/section3/room307.h
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/burger/rooms/section3/section3.cpp
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index 8bef84e1fe4..fa08acd08ed 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -26,6 +26,87 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room301::SERIES1[] = {
+ { 0, nullptr, 0, 0, 16, 0, nullptr, 0 },
+ { 1, "301_010", 3, 60, -1, (uint)-1, nullptr, 0 },
+ { 9, "301W001", 1, 255, -1, 0, nullptr, 0 },
+ { 39, "301F001", 1, 255, -1, 0, nullptr, 0 },
+ { 42, "301_007", 2, 255, -1, 0, nullptr, 0 },
+ { 63, "301_003", 1, 255, -1, 0, nullptr, 0 },
+ { 65, "301_019", 2, 275, -1, 0, nullptr, 0 },
+ { 75, nullptr, 1, 0, -1, 0, nullptr, 0 },
+ { 77, "301F001A", 1, 255, -1, 0, nullptr, 0 },
+ { 110, "301Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 129, nullptr, 0, 0, 15, 0, nullptr, 0 },
+ { 132, nullptr, 0, 0, 20, 0, nullptr, 0 },
+ { 133, nullptr, 3, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room301::SERIES2[] = {
+ { 0, nullptr, 0, 0, 17, 0, nullptr, 0 },
+ { 1, "301_010", 3, 60, -1, (uint)-1, nullptr, 0 },
+ { 12, "301Z002x", 1, 255, -1, 0, nullptr, 0 },
+ { 17, "301_002", 2, 125, -1, 0, nullptr, 0 },
+ { 31, "301Z002y", 1, 255, -1, 0, nullptr, 0 },
+ { 105, "301Z002z", 1, 255, -1, 0, nullptr, 0 },
+ { 136, "301W003", 1, 255, -1, 0, nullptr, 0 },
+ { 161, "301Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 301, "301F003", 1, 255, -1, 0, nullptr, 0 },
+ { 335, "301Z005x", 1, 255, -1, 0, nullptr, 0 },
+ { 372, "301Z005y", 1, 255, -1, 0, nullptr, 0 },
+ { 385, "301Z005z", 1, 255, -1, 0, nullptr, 0 },
+ { 434, "301_017", 2, 150, -1, 0, nullptr, 0 },
+ { 438, "301Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 456, "301Z011y", 1, 255, -1, 0, nullptr, 0 },
+ { 488, "301Z011z", 1, 255, -1, 0, nullptr, 0 },
+ { 526, "301_021", 2, 200, -1, 0, nullptr, 0 },
+ { 542, "301Z007", 1, 150, -1, 0, nullptr, 0 },
+ { 549, "301w999", 2, 150, -1, 0, nullptr, 0 },
+ { 564, "301Z008", 1, 255, -1, 0, nullptr, 0 },
+ { 591, "301W004", 1, 255, -1, 0, nullptr, 0 },
+ { 620, "301Z009y", 1, 255, -1, 0, nullptr, 0 },
+ { 631, "301Z009z", 1, 255, -1, 0, nullptr, 0 },
+ { 688, "301Z010x", 1, 255, -1, 0, nullptr, 0 },
+ { 700, "301Z010y", 1, 255, -1, 0, nullptr, 0 },
+ { 747, "301Z010z", 1, 255, -1, 0, nullptr, 0 },
+ { 792, "301_009", 2, 255, -1, 0, nullptr, 0 },
+ { 795, "301_003", 1, 255, -1, 0, nullptr, 0 },
+ { 803, "301_002", 2, 255, -1, 0, nullptr, 0 },
+ { 812, "301_011", 2, 255, -1, 0, nullptr, 0 },
+ { 821, "301_005", 1, 255, -1, 0, nullptr, 0 },
+ { 826, "301_018", 2, 175, -1, 0, nullptr, 0 },
+ { 835, nullptr, 1, 0, -1, 0, nullptr, 0 },
+ { 836, nullptr, 0, 0, 15, 0, nullptr, 0 },
+ { 837, nullptr, 0, 0, 20, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room301::SERIES3[] = {
+ { 0, "301_004", 3, 100, -1, (uint)-1, nullptr, 0 },
+ { 0, "301_010", 2, 30, -1, (uint)-1, nullptr, 0 },
+ { 0, nullptr, 0, 0, 18, 0, nullptr, 0 },
+ { 1, "301Z101", 1, 255, -1, 0, nullptr, 0 },
+ { 30, "301W101", 1, 255, -1, 0, nullptr, 0 },
+ { 49, "301Z102", 1, 255, -1, 0, nullptr, 0 },
+ { 96, "301W102", 1, 255, -1, 0, nullptr, 0 },
+ { 127, nullptr, 0, 0, 15, 0, nullptr, 0 },
+ { 130, nullptr, 3, 0, -1, 0, nullptr, 0 },
+ { 131, nullptr, 0, 0, 20, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room301::SERIES4[] = {
+ { 0, "301_010", 2, 30, -1, (uint)-1, nullptr, 0 },
+ { 0, nullptr, 0, 0, 18, 0, nullptr, 0 },
+ { 1, "301_004", 3, 255, -1, (uint)-1, nullptr, 0 },
+ { 37, nullptr, 0, 0, 15, 0, nullptr, 0 },
+ { 38, nullptr, 0, 0, 20, 0, nullptr, 0 },
+ { -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room301::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room301.h b/engines/m4/burger/rooms/section3/room301.h
index 5f6728ab088..fb20b95b83a 100644
--- a/engines/m4/burger/rooms/section3/room301.h
+++ b/engines/m4/burger/rooms/section3/room301.h
@@ -29,6 +29,12 @@ namespace Burger {
namespace Rooms {
class Room301 : public Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+ static const seriesStreamBreak SERIES4[];
+
public:
Room301() : Room() {}
~Room301() override {}
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index 63978889847..d7275bbe35d 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -26,6 +26,147 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room302::SAID[][4] = {
+ { "DOOR", nullptr, "300w001", nullptr },
+ { "STORM CELLAR", nullptr, "300w002", nullptr },
+ { "BACK YARD", "302w002", "302w002", nullptr },
+ { "BURGER MORSEL ", nullptr, nullptr, "302w010" },
+ { "TRUFFLES", nullptr, "302w013", "302w014" },
+ { "TROUGH", "302w015", "300w003", "302w016" },
+ { "SIGN", "302w017", "300w004", "300w005" },
+ { "CABIN", "302w018", "300w002", "300w002" },
+ { "WINDOW", "302w021", "300w002", "302w022" },
+ { "ROCKING CHAIR", "302w019", "302w020", "302w020" },
+ { "CRASHED ROCKET", "302w023", "300w003", "302w024" },
+ { "DOCK", "302w025", "300w002", "302w026" },
+ { "FORCE FIELD", "302w027", "300w002", "300w002" },
+ { "ROCK", "302w028", "300w002", "300w002" },
+ { "TREES", "302w029", "300w002", "300w002" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room302::SERIES1[] = {
+ { 0, "302p004", 1, 255, -1, 0, nullptr, 0 },
+ { 19, "302_008", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room302::SERIES2[] = {
+ { 7, "302_002", 1, 255, -1, 0, nullptr, 0 },
+ { 9, "302w001a", 2, 255, -1, 0, &_state1, 0 },
+ { 9, "302w001b", 2, 255, -1, 0, &_state1, 1 },
+ { 9, "302w001c", 2, 255, -1, 0, &_state1, 2 },
+ { 34, "302_005", 2, 125, -1, 0, nullptr, 0 },
+ { 48, "302_006", 2, 125, -1, 1024, nullptr, 0 },
+ { 138, "302_007", 1, 255, -1, 0, nullptr, 0 },
+ { 138, "302_003", 1, 255, -1, 0, nullptr, 0 },
+ { 152, "302_007", 1, 255, -1, 0, nullptr, 0 },
+ { 152, "302_003", 1, 255, -1, 0, nullptr, 0 },
+ { 165, nullptr, 2, 0, 4, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room302::SERIES3[] = {
+ { 7, "302_002", 2, 255, -1, 0, nullptr, 0 },
+ { 9, "302w001a", 1, 255, -1, 0, &_state1, 0 },
+ { 9, "302w001b", 1, 255, -1, 0, &_state1, 1 },
+ { 9, "302w001c", 1, 255, -1, 0, &_state1, 2 },
+ { 24, "302p001", 2, 255, -1, 0, nullptr, 0 },
+ { 35, "302_005", 2, 125, -1, 0, nullptr, 0 },
+ { 48, "302_006", 2, 125, -1, 1024, nullptr, 0 },
+ { 52, "302p003", 1, 255, -1, 0, nullptr, 0 },
+ { 71, "302_008", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY1[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY2[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY3[] = {
+ { 0, -1, "304_001", 2, 255, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY4[] = {
+ { 0, 1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ { 2, -1, "302w002", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY5[] = {
+ { 0, 22, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ { 23, -1, "302_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY6[] = {
+ { 0, 7, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 8, -1, nullptr, 1, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY7[] = {
+ { 0, 29, "302t004", 2, 155, -1, 2048, 0, nullptr, 0 },
+ { 26, 29, "302t005", 2, 155, -1, 0, 12, &Flags::_flags[V110], 0 },
+ { 26, 29, "302t005", 2, 155, -1, 0, 3, &Flags::_flags[V110], 1 },
+ { 30, 61, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY8[] = {
+ { 62, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY9[] = {
+ { 0, 28, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ { 29, -1, nullptr, 1, 0, 6, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY10[] = {
+ { 0, 4, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY11[] = {
+ { 5, 13, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY12[] = {
+ { 6, 16, "302t002", 2, 155, -1, 0, 0, nullptr, 0 },
+ { 11, 17, nullptr, 2, 0, -1, 3, 2, nullptr, 0 },
+ { 12, 6, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room302::PLAY13[] = {
+ { 0, 4, "302t003", 2, 155, -1, 0, 0, nullptr, 0 },
+ { 5, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 5, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 5, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 4, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 0, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room302::_state1;
+
+
+Room302::Room302() : Room() {
+ _state1 = 0;
+}
+
void Room302::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
index 0395119effa..d16297b049b 100644
--- a/engines/m4/burger/rooms/section3/room302.h
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -29,8 +29,28 @@ namespace Burger {
namespace Rooms {
class Room302 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static long _state1;
+
public:
- Room302() : Room() {}
+ Room302();
~Room302() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 8ec1da3ac66..958df344d89 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -26,6 +26,93 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room303::SAID[][4] = {
+ { "JUG ", "303w022", nullptr, "303w022z" },
+ { "JUG ", "303w022", nullptr, "303w022z" },
+ { "FUEL TANK", "303w003", "303w004", nullptr },
+ { "BURNER", nullptr, "303w010", nullptr },
+ { "BOILER", "303w014", "303w015", nullptr },
+ { "STOOL", "303w019", "300w004", "303w020" },
+ { "DISTILLED CARROT JUICE ", "303w021", nullptr, nullptr },
+ { "DISTILLED CARROT JUICE ", "303w021", nullptr, nullptr },
+ { "CONDENSER", "303w023", "303w024", "303w025" },
+ { "KEG", nullptr, "303w024", "303w025" },
+ { "CABIN", "303w028", "300w002", "300w002" },
+ { "WINDOW", "303w029", "300w002", "303w030" },
+ { "WOOD", "303w031", "303w032", "303w033" },
+ { "ROCK", "303w034", "300w002", "300w002" },
+ { "TREES", "303w035", "300w002", "300w002" },
+ { "FORCE FIELD", "303w036", "300w002", "300w002" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room303::SERIES1[] = {
+ { 0, "303_001", 2, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY1[] = {
+ { 0, 7, 0, 1, 0, -1, 2048, 0, 0, 0 },
+ { 8, -1, 0, 1, 0, 9, 2048, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY2[] = {
+ { 0, 5, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 6, 7, "300w048", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, "303_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY3[] = {
+ { 9, 14, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
+ { 0, 8, nullptr, 1, 0, 9, 2050, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY4[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY5[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY6[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY7[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY8[] = {
+ { 0, 31, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 32, -1, "303_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY9[] = {
+ { 0, 28, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 29, 36, "300_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 37, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room303::PLAY10[] = {
+ { 0, 6, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 7, 6, "303_007", 1, 100, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ { 6, 7, nullptr, 0, 0, -1, 1, 1, nullptr, 0 },
+ { 8, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room303::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
index ee6a3e19344..49d3677e13a 100644
--- a/engines/m4/burger/rooms/section3/room303.h
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -29,6 +29,20 @@ namespace Burger {
namespace Rooms {
class Room303 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+
public:
Room303() : Room() {}
~Room303() override {}
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index 9b31781ecce..6499016bca6 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -26,6 +26,68 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+
+const char *Room304::SAID[][4] = {
+ { "DOOR", "304w002", "300w002", nullptr },
+ { "BED", "304w007", "300w003", "304w008" },
+ { "PICTURE", "304w009", "304w010", "300w005" },
+ { "MATCHES ", "304w003", nullptr, "304w004" },
+ { "MAP", nullptr, "304w013", "304w014" },
+ { "CRATE", "304w015", "300w004", "300w004" },
+ { "STOVE", "304w016", "304w017", "304w018" },
+ { "KETTLE", "304w019", "304w018", "304w018" },
+ { "MUG", "304w019", nullptr, nullptr },
+ { "RECIPE BOOK", nullptr, "304w021", "304w022" },
+ { "WASHTUB", "304w023", "304w024", "304w024" },
+ { "POT", "304w025", "304w018", "304w018" },
+ { "FRYING PAN", "304w026", "304w027", "304w018" },
+ { "WINDOW", "304w028", "300w002", "304w029" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room304::PLAY1[] = {
+ { 0, 3, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 4, 16, "304_001", 2, 255, -1, 2048, 0, nullptr, 0 },
+ { 17, -1, "304_002", 2, 255, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room304::PLAY2[] = {
+ { 0, 3, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
+ { 0, 0, "304w020", 1, 255, -1, 0, 10, nullptr, 0 },
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 8, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, -1, "304_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 3, nullptr, 0 },
+ { 8, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, -1, "304_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 7, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room304::PLAY3[] = {
+ { 0, 3, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 5, nullptr, 0, 0, 6, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room304::PLAY4[] = {
+ { 0, 24, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 25, 36, "300_003", 2, 255, -1, 2048, 0, nullptr, 0 },
+ { 37, -1, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room304::PLAY5[] = {
+ { 17, 17, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 17, 21, "304_002", 2, 255, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room304::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room304.h b/engines/m4/burger/rooms/section3/room304.h
index c02a3428f63..60626f60080 100644
--- a/engines/m4/burger/rooms/section3/room304.h
+++ b/engines/m4/burger/rooms/section3/room304.h
@@ -29,6 +29,14 @@ namespace Burger {
namespace Rooms {
class Room304 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+
public:
Room304() : Room() {}
~Room304() override {}
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index 4b41c04a616..cff3e946c76 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -26,6 +26,46 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room305::SAID[][4] = {
+ { "STAIRS", "305w002", "300w002", nullptr },
+ { "DARKNESS", "305w004", "300w002", "300w002" },
+ { "MINE", "305w003", "300w002", "300w002" },
+ { "GENERATOR", nullptr, "305w008", nullptr },
+ { "PICK AXE", "305w015", "305w016", "305w017" },
+ { "BOX", "305w018", "300w003", "300w005" },
+ { "DEBRIS", nullptr, "305w021", "300w005" },
+ { "GROUND", "305w022", "300w002", "300w002" },
+ { "WALL", "305w022", "300w002", "300w002" },
+ { "CEILING", "305w022", "300w002", "300w002" },
+ { "FORCE FIELD", "302w027", "300w002", "300w002" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room305::SERIES1[] = {
+ { 6, "305_003", 2, 255, -1, 0, nullptr, 0 },
+ { 11, "305w009", 1, 255, -1, 0, nullptr, 0 },
+ { 12, "305_005", 2, 255, -1, 0, nullptr, 0 },
+ { 20, "305w010", 1, 255, -1, 0, &Flags::_flags[V135], 0 },
+ { 30, "305_006", 2, 255, -1, (uint)-1, nullptr, 0 },
+ { 72, "305_001", 1, 255, -1, 0, nullptr, 0 },
+ { 72, nullptr, 2, 0, -1, 2048, nullptr, 0 },
+ { 79, "305_004", 2, 255, -1, 0, nullptr, 0 },
+ { 94, "305_002", 2, 255, -1, 0, nullptr, 0 },
+ { -1, 0, 0, 0, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room305::PLAY1[] = {
+ { 0, -1, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room305::PLAY2[] = {
+ { 0, -1, 0, 1, 0, -1, 2048, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room305::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
index d077cbfe77f..65fcde61c69 100644
--- a/engines/m4/burger/rooms/section3/room305.h
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -29,6 +29,12 @@ namespace Burger {
namespace Rooms {
class Room305 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+
public:
Room305() : Room() {}
~Room305() override {}
diff --git a/engines/m4/burger/rooms/section3/room306.cpp b/engines/m4/burger/rooms/section3/room306.cpp
index b6d3c19b888..d321e97b982 100644
--- a/engines/m4/burger/rooms/section3/room306.cpp
+++ b/engines/m4/burger/rooms/section3/room306.cpp
@@ -26,6 +26,31 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room306::SERIES1[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 2, "306f003a", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room306::SERIES2[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 2, "306f001a", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room306::SERIES3[] = {
+ { 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
+ { 1, "306f002a", 1, 255, -1, 0, nullptr, 0 },
+ { 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
+ { 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+
void Room306::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room306.h b/engines/m4/burger/rooms/section3/room306.h
index 3c51efb7d1b..e24188e649b 100644
--- a/engines/m4/burger/rooms/section3/room306.h
+++ b/engines/m4/burger/rooms/section3/room306.h
@@ -29,6 +29,11 @@ namespace Burger {
namespace Rooms {
class Room306 : public Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+
public:
Room306() : Room() {}
~Room306() override {}
diff --git a/engines/m4/burger/rooms/section3/room307.cpp b/engines/m4/burger/rooms/section3/room307.cpp
index f19a66d10bf..b22e82d2003 100644
--- a/engines/m4/burger/rooms/section3/room307.cpp
+++ b/engines/m4/burger/rooms/section3/room307.cpp
@@ -26,6 +26,24 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room307::SERIES1[] = {
+ { 0, "307z001", 1, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room307::PLAY1[] = {
+ { 0, 5, "307z002w", 1, 255, -1, 2052, -1, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ { 0, 5, "307z002x", 1, 255, -1, 2052, -1, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ { 0, 5, "307z002y", 1, 255, -1, 2052, -1, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 5, "307z002z", 1, 255, -1, 2052, -1, nullptr, 0 },
+ { 6, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room307::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room307.h b/engines/m4/burger/rooms/section3/room307.h
index 6b00563b72c..78688777662 100644
--- a/engines/m4/burger/rooms/section3/room307.h
+++ b/engines/m4/burger/rooms/section3/room307.h
@@ -29,6 +29,10 @@ namespace Burger {
namespace Rooms {
class Room307 : public Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+
public:
Room307() : Room() {}
~Room307() override {}
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 47ccf702ce0..65cda948a1d 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -26,6 +26,61 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room310::SAID[][4] = {
+ { "TUNNEL", "310w002", "310w003", nullptr },
+ { "PROBE", "310w004", nullptr, nullptr },
+ { "TRUFFLES", nullptr, "310w011", "310w012" },
+ { "GROUND", "310w017", "310w003", "310w003" },
+ { "WALL", "310w017", "310w003", "310w003" },
+ { "CEILING", "310w017", "310w003", "310w003" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room310::PLAY1[] = {
+ { 1, 2, "300t004a", 2, 165, -1, 0, 0, &_state1, 1 },
+ { 1, 2, "300t004b", 2, 165, -1, 0, 0, &_state1, 2 },
+ { 1, 2, "300t004c", 2, 165, -1, 0, 0, &_state1, 3 },
+ { 1, 2, "300t004d", 2, 165, -1, 0, 0, &_state1, 4 },
+ { 3, 4, nullptr, 2, 0, 1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room310::PLAY2[] = {
+ { 0, 9, "300t003a", 2, 165, -1, 0, 0, &_state1, 1 },
+ { 0, 9, "300t003b", 2, 165, -1, 0, 0, &_state1, 2 },
+ { 0, 9, "300t003c", 2, 165, -1, 0, 0, &_state1, 3 },
+ { 0, 9, "300t003d", 2, 165, -1, 0, 0, &_state1, 4 },
+ { 10, 16, nullptr, 2, 0, 10016, 1, 0, nullptr, 0 },
+ { 10, 16, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 17, 21, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 2, 0, -1, 2048, 0, nullptr, 0 },
+};
+
+const seriesPlayBreak Room310::PLAY3[] = {
+ { 15, 29, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+};
+
+const seriesPlayBreak Room310::PLAY4[] = {
+ { 6, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+};
+
+const seriesPlayBreak Room310::PLAY5[] = {
+ { 30, 36, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ { 37, 51, "300_002", 2, 255, -1, 0, 0, nullptr, 0 },
+};
+
+const seriesPlayBreak Room310::PLAY6[] = {
+ { 52, 56, "300_001", 2, 255, -1, 0, 0, nullptr, 0 },
+};
+
+long Room310::_state1;
+
+
+Room310::Room310() : Room() {
+ _state1 = 0;
+}
+
void Room310::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index 0088d0146f0..b766fac0056 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -29,8 +29,18 @@ namespace Burger {
namespace Rooms {
class Room310 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static long _state1;
+
public:
- Room310() : Room() {}
+ Room310();
~Room310() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index 79ae1929aeb..a2de784fa9f 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -26,6 +26,16 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+static const seriesPlayBreak PLAY1[] = {
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, 46, "300w039", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 47, 60, "300_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 60, 60, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 60, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
Section3::Section3() : Rooms::Section() {
add(301, &_room301);
add(302, &_room302);
Commit: b2e5cc1b5bb11d15ba97b19d189ede395aebe823
https://github.com/scummvm/scummvm/commit/b2e5cc1b5bb11d15ba97b19d189ede395aebe823
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Static arrays for section 4
Changed paths:
engines/m4/burger/rooms/section4/room401.cpp
engines/m4/burger/rooms/section4/room401.h
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
engines/m4/burger/rooms/section4/room404.cpp
engines/m4/burger/rooms/section4/room404.h
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room405.h
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section4/section4.h
diff --git a/engines/m4/burger/rooms/section4/room401.cpp b/engines/m4/burger/rooms/section4/room401.cpp
index 4dc27662dcf..2988e34b20e 100644
--- a/engines/m4/burger/rooms/section4/room401.cpp
+++ b/engines/m4/burger/rooms/section4/room401.cpp
@@ -26,6 +26,42 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room401::SERIES1[] = {
+ { 7, "401v001", 1, 255, -1, 0, 0, 0 },
+ { 36, "401A_002", 2, 200, -1, 0, 0, 0 },
+ { 89, nullptr, 0, 0, 9, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room401::SERIES2[] = {
+ { 0, "401B_003", 2, 200, -1, 0, nullptr, 0 },
+ { 41, "401Z001", 1, 255, -1, 0, nullptr, 0 },
+ { 69, "401Z002", 1, 255, -1, 0, nullptr, 0 },
+ { 99, "401V002", 1, 255, -1, 0, nullptr, 0 },
+ { 162, "401Z003", 1, 255, -1, 0, nullptr, 0 },
+ { 228, "401V003", 1, 255, -1, 0, nullptr, 0 },
+ { 319, "401Z004", 1, 255, -1, 0, nullptr, 0 },
+ { 386, "401V004", 1, 255, -1, 0, nullptr, 0 },
+ { 417, "401V005", 1, 255, -1, 0, nullptr, 0 },
+ { 461, "401Z005", 1, 255, -1, 0, nullptr, 0 },
+ { 567, "401V006", 1, 255, -1, 0, nullptr, 0 },
+ { 582, "401Z006", 1, 255, -1, 0, nullptr, 0 },
+ { 661, "401V007", 1, 255, -1, 0, nullptr, 0 },
+ { 758, nullptr, 0, 0, 9, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room401::SERIES3[] = {
+ { 0, "401C_001", 3, 150, -1, (uint)-1, nullptr, 0 },
+ { 19, "401z007", 1, 255, -1, 0, nullptr, 0 },
+ { 45, "401f001", 1, 255, -1, 0, nullptr, 0 },
+ { 63, "401z008", 1, 255, -1, 0, nullptr, 0 },
+ { 100, nullptr, 0, 0, 8, 0, nullptr, 0 },
+ { 102, "401f002", 1, 255, -1, 0, nullptr, 0 },
+ { 104, nullptr, 0, 0, 9, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
void Room401::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room401.h b/engines/m4/burger/rooms/section4/room401.h
index 29b588da54d..9efe1e6da0f 100644
--- a/engines/m4/burger/rooms/section4/room401.h
+++ b/engines/m4/burger/rooms/section4/room401.h
@@ -29,6 +29,11 @@ namespace Burger {
namespace Rooms {
class Room401 : public Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+
public:
Room401() : Room() {}
~Room401() override {}
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 49085ab5be2..55063d4649e 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -26,6 +26,153 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room402::SAID[][4] = {
+ { "bench", "402w006", nullptr, "402w007" },
+ { "force field", "400w005", nullptr, "400w001" },
+ { "sidewalk", nullptr, nullptr, nullptr },
+ { "steps", nullptr, nullptr, nullptr },
+ { "road", nullptr, nullptr, nullptr },
+ { "townhall", nullptr, nullptr, nullptr },
+ { "sky", nullptr, nullptr, nullptr },
+ { "bush", nullptr, nullptr, nullptr },
+ { "steps", nullptr, nullptr, nullptr },
+ { "pillar", nullptr, nullptr, nullptr },
+ { "window", nullptr, nullptr, nullptr },
+ { "bushes", nullptr, nullptr, nullptr },
+ { "stolie", nullptr, "400w001", "400w001" },
+ { "elmo", "402w003", "400w001", "400w001" },
+ { "disc", nullptr, "400w003", nullptr },
+ { "disc ", nullptr, "400w003", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room402::SERIES1[] = {
+ { 0, "402s001", 1, 255, -1, 0, nullptr, 0 },
+ { 21, nullptr, 1, 255, 7, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room402::SERIES2[] = {
+ { 0, "402s003", 1, 255, -1, 0, nullptr, 0 },
+ { 4, "402_002", 2, 255, -1, 0, nullptr, 0 },
+ { 11, nullptr, 1, 255, 9, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY1[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY2[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 9, "402s002", 1, 255, -1, 4, -1, nullptr, 0 },
+ { 10, 11, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY3[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY4[] = {
+ { 2, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY5[] = {
+ { 0, 4, "402p901", 1, 255, -1, 4, -1, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY6[] = {
+ { 10, 16, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY7[] = {
+ { 18, 21, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY8[] = {
+ { 2, 10, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY9[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 5, "402s004", 1, 255, -1, 4, -1, nullptr, 0 },
+ { 6, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY10[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 9, nullptr, 0, 0, 38, 0, 0, nullptr, 0 },
+ { 10, 11, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 12, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 12, 12, "402_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 14, 16, nullptr, 2, 0, -1, 2048, 0, nullptr, 0 },
+ { 3, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY11[] = {
+ { 19, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 16, 16, nullptr, 0, 0, 33, 0, 0, nullptr, 0 },
+ { 15, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 22, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY12[] = {
+ { 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY13[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 6, "402S005", 1, 255, -1, 4, -1, nullptr, 0 },
+ { 7, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY14[] = {
+ { 0, 1, "999_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 2, 2, nullptr, 0, 0, 4, 0, 0, nullptr, 0 },
+ { 3, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 10, 11, "999_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 12, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY15[] = {
+ { 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room402::PLAY16[] = {
+ { 0, 16, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 17, 20, "402_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 20, 20, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 20, 20, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 20, 20, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 21, 23, nullptr, 0, 0, 2048, 0, 0, nullptr, 0 },
+ { 24, 36, "402p903a", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 64, 66, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room402::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index b319ef61f33..6dadb68aa9e 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -29,6 +29,27 @@ namespace Burger {
namespace Rooms {
class Room402 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+
public:
Room402() : Room() {}
~Room402() override {}
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
index fe6748c74f6..cafb17020e8 100644
--- a/engines/m4/burger/rooms/section4/room404.cpp
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -26,6 +26,25 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room404::SAID[][4] = {
+ { "QUARTER ", "404w001", nullptr, "404w002" },
+ { "IMPOUND YARD", nullptr, "400w001", nullptr },
+ { "TOILET", "404w003", "400w001", "404w004" },
+ { "SINK", "404w005", "400w001", "404w006" },
+ { "COT", "404w007", nullptr, "404w008" },
+ { "MARKS", "404w103", nullptr, nullptr },
+ { "NEWSPAPER", "404w009", "404w010", "404w011" },
+ { "BARS", "404w012", "400w001", "400w001" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room404::PLAY1[] = {
+ { 1, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 10, 17, nullptr, 0, 0, 10016, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room404::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room404.h b/engines/m4/burger/rooms/section4/room404.h
index 37931f7782a..c14979ac013 100644
--- a/engines/m4/burger/rooms/section4/room404.h
+++ b/engines/m4/burger/rooms/section4/room404.h
@@ -29,6 +29,10 @@ namespace Burger {
namespace Rooms {
class Room404 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+
public:
Room404() : Room() {}
~Room404() override {}
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index a231ee85ba9..c3d014e43b5 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -26,6 +26,95 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room405::SAID[][4] = {
+ { "VIPE", nullptr, "400W001", "400W001" },
+ { "GUITAR", "405w003", nullptr, nullptr },
+ { "RECORDS", "405w004", nullptr, nullptr },
+ { "VERA", "405w006", "400w001", "400w001" },
+ { "JUKEBOX", "405w007", nullptr, nullptr },
+ { "DISC", "400w002", "400w003", nullptr },
+ { "DISC ", "400w002", "400w003", nullptr },
+ { "SWINGING DOOR", "405w009", "400w001", nullptr },
+ { "ORDER WINDOW", "405w009", "400w001", "400w001" },
+ { "MUFFIN", "405w010", nullptr, nullptr },
+ { "FOUNTAIN", "405W011", nullptr, nullptr },
+ { "MOOSEHEAD", "405W012", nullptr, nullptr },
+ { "MENU", "405W013", nullptr, nullptr },
+ { "STOOL", nullptr, nullptr, "405W019" },
+ { "BOOTH", nullptr, nullptr, "405W019" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesStreamBreak Room405::SERIES1[] = {
+ { 8, nullptr, 0, 0, 22, 0, nullptr, 0 },
+ { 15, "405v512", 1, 255, -1, 0, nullptr, 0 },
+ { 115, "405_008", 2, 255, -1, 0, nullptr, 0 },
+ { 123, "405e503", 1, 255, 13, 0, nullptr, 0 },
+ { 210, "999_003", 2, 255, -1, 0, nullptr, 0 },
+ { 221, "999_003", 2, 255, -1, 0, nullptr, 0 },
+ { 235, nullptr, 2, 255, 7, 0, nullptr, 0 },
+ { 250, nullptr, 0, 0, 29, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY1[] = {
+ { 0, 3, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY2[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 9, nullptr, 0, 0, 11, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 0, 0, 9, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY3[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY4[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY5[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 42, "405_006", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 43, 51, "405_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 52, 60, "405_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 61, 69, "405_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 70, 78, "405_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 79, 85, "405_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 86, -1, "405_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY6[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room405::PLAY7[] = {
+ { 0, -1, "405_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room405::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room405.h b/engines/m4/burger/rooms/section4/room405.h
index c1d76a05a8e..1a17ccd8421 100644
--- a/engines/m4/burger/rooms/section4/room405.h
+++ b/engines/m4/burger/rooms/section4/room405.h
@@ -29,6 +29,17 @@ namespace Burger {
namespace Rooms {
class Room405 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+
public:
Room405() : Room() {}
~Room405() override {}
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index e0e9b8a38de..f18dacba68b 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -26,6 +26,403 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room406::SAID[][4] = {
+ { "PEGLEG", "406w003", "406w005", "406w005" },
+ { "PEGLEG ", "406w003", "406w005", "406w005" },
+ { "PEGLEG ", "406w004", "406w005", "406w005" },
+ { "TIRE", "406w007", "406w008", "406w009" },
+ { "TIRE ", "406w028", nullptr, nullptr },
+ { "DOG COLLAR ", "406w010", nullptr, "406w011" },
+ { "DOG COLLAR ", "406w010", nullptr, "406w011" },
+ { "DOG COLLAR ", "406w010", nullptr, "406w011" },
+ { "DOG COLLAR ", "406w012", nullptr, "406w011" },
+ { "GATE", "406w013", "400w001", nullptr },
+ { "WINCH", "406w016", "400w001", nullptr },
+ { "HOOK ", nullptr, nullptr, "400w001" },
+ { "HOOK ", nullptr, nullptr, "400w001" },
+ { "HOOK ", nullptr, nullptr, "400w001" },
+ { "HOOK ", nullptr, nullptr, "400w001" },
+ { "BARRED WINDOW ", "406w024", "400w001", nullptr },
+ { "JAIL CELL", nullptr, "400w001", "400w001" },
+ { "TOW TRUCK", "406w025", "400w001", nullptr },
+ { "FENCE", nullptr, "400w001", nullptr },
+ { "RAZOR WIRE", nullptr, "406w033", "406w033" },
+ { "RAZOR WIRE ", nullptr, "406w033", "406w033" },
+ { "SIGN", "406w034", nullptr, nullptr },
+ { "RUBBLE", "406w035", nullptr, nullptr },
+ { "GARBAGE CANS", "406w036", "406w037", nullptr },
+ { "FORCE FIELD", "400w005", nullptr, "400w001" },
+ { "FORCE FIELD ", "400w005", nullptr, "400w001" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const WilburMatch Room406::MATCH[] = {
+ { "FISH", "PEGLEG", 8, 0, 0, &_state4, 48 },
+ { "FISH", "PEGLEG ", 8, 0, 0, &_state4, 48 },
+ { "FISH", "TIRE", 10016, 0, 0, &Vars::_wilbur_should, 2 },
+ { "GEAR", "GATE", 8, &Flags::_flags[V172], 10025, &_state4, 25 },
+ { "GEAR", "GATE", 8, 0, 0, &_state4, 26 },
+ { "JAWZ O' LIFE", "GATE", 10016, &Flags::_flags[V172], 10025, &Vars::_wilbur_should, 16 },
+ { "JAWZ O' LIFE", "GATE", 8, 0, 0, &_state4, 27 },
+ { "JAWZ O' LIFE", "LOCK", 10016, &Flags::_flags[V172], 10025, &Vars::_wilbur_should, 16 },
+ { "JAWZ O' LIFE", "LOCK", 8, 0, 0, &_state4, 27 },
+ { "JAWZ O' LIFE", "CHAIN", 10016, &Flags::_flags[V172], 10025, &Vars::_wilbur_should, 16 },
+ { "JAWZ O' LIFE", "CHAIN", 8, 0, 0, &_state4, 27 },
+ { "TAKE", "DOG COLLAR ", 10016, 0, 0, &Vars::_wilbur_should, 20 },
+ { "TAKE", "DOG COLLAR ", 10016, 0, 0, &Vars::_wilbur_should, 18 },
+ { "GEAR", "WINCH", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "GEAR", "WINCH", 10016, &Flags::_flags[V174], 4000, &Vars::_wilbur_should, 3 },
+ { "GEAR", "WINCH", 10016, &Flags::_flags[V174], 4001, &Vars::_wilbur_should, 4 },
+ { "GEAR", "WINCH", 8, &Flags::_flags[V174], 4002, &_state4, 34 },
+ { "GEAR", "WINCH", 8, &Flags::_flags[V174], 4004, &_state4, 35 },
+ { "GEAR", "LEVER", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "GEAR", "LEVER", 10016, &Flags::_flags[V174], 4000, &Vars::_wilbur_should, 3 },
+ { "GEAR", "LEVER ", 10016, &Flags::_flags[V174], 4001, &Vars::_wilbur_should, 4 },
+ { "GEAR", "LEVER ", 8, &Flags::_flags[V174], 4002, &_state4, 34 },
+ { "GEAR", "LEVER", 8, &Flags::_flags[V174], 4004, &_state4, 35 },
+ { "LOOK AT", "HOOK ", 8, 0, 0, &_state4, 29 },
+ { "LOOK AT", "HOOK ", 8, 0, 0, &_state4, 29 },
+ { "LOOK AT", "HOOK ", 8, 0, 0, &_state4, 30 },
+ { "LOOK AT", "HOOK ", 8, 0, 0, &_state4, 29 },
+ { "TAKE", "HOOK ", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "TAKE", "HOOK ", 8, 0, 0, &_state4, 31 },
+ { "TAKE", "HOOK ", 10016, 0, 0, &Vars::_wilbur_should, 6 },
+ { "TAKE", "HOOK ", 8, 0, 0, &_state4, 32 },
+ { "LOOK AT", "JAIL CELL", 8, 0, 0, &_state4, 33 },
+ { "GEAR", "TOW TRUCK", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "GEAR", "TOW TRUCK", 8, &Flags::_flags[V175], 1, &_state4, 39 },
+ { "TAKE", "TIRE ", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "TAKE", "TIRE ", 8, &Flags::_flags[V175], 1, &_state4, 37 },
+ { "GEAR", "TIRE ", 8, &Flags::_flags[V175], 0, &_state4, 36 },
+ { "GEAR", "TIRE ", 8, &Flags::_flags[V175], 1, &_state4, 38 },
+ { "LOOK AT", "FENCE", 8, &Flags::_flags[V175], 0, &_state4, 40 },
+ { "LOOK AT", "FENCE", 8, &Flags::_flags[V175], 1, &_state4, 41 },
+ { "GEAR", "FENCE", 8, &Flags::_flags[V175], 0, &_state4, 42 },
+ { "GEAR", "FENCE", 8, &Flags::_flags[V175], 1, &_state4, 24 },
+ { "LOOK AT", "RAZOR WIRE", 8, &Flags::_flags[V175], 0, &_state4, 43 },
+ { "LOOK AT", "RAZOR WIRE", 8, &Flags::_flags[V175], 1, &_state4, 44 },
+ { "LOOK AT", "RAZOR WIRE ", 8, &Flags::_flags[V175], 0, &_state4, 43 },
+ { "LOOK AT", "RAZOR WIRE ", 8, &Flags::_flags[V175], 1, &_state4, 44 },
+ { nullptr, nullptr, -1, nullptr, 0, nullptr, 0 }
+};
+
+const seriesStreamBreak Room406::SERIES1[] = {
+ { 6, "406_103", 1, 255, -1, 0, nullptr, 0 },
+ { 9, "406_106", 1, 255, -1, 0, nullptr, 0 },
+ { 33, nullptr, 0, 0, 16, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY1[] = {
+ { 0, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 24, 32, "406_112", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 33, -1, "406_110", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY2[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 9, "406_102", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 0, 0, 15, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY3[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY4[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 9, "406_103", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY5[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 9, "406_103", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 10, -1, "406_107", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY6[] = {
+ { 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY7[] = {
+ { 9, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, "406_108", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY8[] = {
+ { 10, 41, "406_105", 1, 255, -1, 1024, 0, nullptr, 0 },
+ { 42, -1, "406_109", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY9[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY10[] = {
+ { 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, -1, "406_107", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY11[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY12[] = {
+ { 0, 1, "406_115", 1, 55, -1, 0, 0, nullptr, 0 },
+ { 2, 5, "406_115", 1, 55, -1, 0, 0, nullptr, 0 },
+ { 6, 8, "406_115", 1, 55, -1, 0, 0, nullptr, 0 },
+ { 9, -1, "406_115", 1, 55, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY13[] = {
+ { 0, -1, "406g003", 1, 255, -1, 4, -1, &_state1, 79 },
+ { 0, -1, "406g004", 1, 255, -1, 4, -1, &_state1, 80 },
+ { 0, -1, "406g005", 1, 255, -1, 4, -1, &_state1, 81 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY14[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 8, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY15[] = {
+ { 0, 19, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY16[] = {
+ { 20, 20, "406_102", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 21, 23, "406g006", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 24, nullptr, 0, 0, 15, 0, 0, nullptr, 0 },
+ { 25, 25, nullptr, 0, 0, 17, 0, 0, nullptr, 0 },
+ { 26, 26, "406_114", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 27, 31, "406g007", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 32, -1, "406g008", 1, 255, 13, 32, -1, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY17[] = {
+ { 20, 20, "406_102", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 21, 23, "406g006", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 24, 24, nullptr, 0, 0, 15, 0, 0, nullptr, 0 },
+ { 25, 25, "406_114", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 26, 31, "406g007", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 32, -1, "406g008", 1, 255, 13, 32, -1, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY18[] = {
+ { 0, -1, "999_003", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY19[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY20[] = {
+ { 0, -1, "406d003a", 1, 255, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "406d003b", 1, 255, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "406d003c", 1, 255, -1, 0, 0, &_state2, 3 },
+ { 0, -1, "406d003d", 1, 255, -1, 0, 0, &_state2, 4 },
+ { 0, -1, "406d003e", 1, 255, -1, 0, 0, &_state2, 5 },
+ { 0, -1, "406d003f", 1, 255, -1, 0, 0, &_state2, 6 },
+ { 0, -1, "406d003g", 1, 255, -1, 0, 0, &_state2, 7 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY21[] = {
+ { 13, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY22[] = {
+ { 0, -1, "406d001a", 2, 255, -1, 0, -1, &_state2, 1 },
+ { 0, -1, "406d001b", 2, 255, -1, 0, -1, &_state2, 2 },
+ { 0, -1, "406d001c", 2, 255, -1, 0, -1, &_state2, 3 },
+ { 0, -1, "406d001d", 2, 255, -1, 0, -1, &_state2, 4 },
+ { 0, -1, "406d001e", 2, 255, -1, 0, -1, &_state2, 5 },
+ { 0, -1, "406d001f", 2, 255, -1, 0, -1, &_state2, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY23[] = {
+ { 0, -1, "406d002a", 2, 255, -1, 0, -1, &_state2, 1 },
+ { 0, -1, "406d002b", 2, 255, -1, 0, -1, &_state2, 2 },
+ { 0, -1, "406d002c", 2, 255, -1, 0, -1, &_state2, 3 },
+ { 0, -1, "406d002d", 2, 255, -1, 0, -1, &_state2, 4 },
+ { 0, -1, "406d002e", 2, 255, -1, 0, -1, &_state2, 5 },
+ { 0, -1, "406d002f", 2, 255, -1, 0, -1, &_state2, 6 },
+ { 0, -1, "406d002g", 2, 255, -1, 0, -1, &_state2, 7 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY24[] = {
+ { 0, 4, "406d006a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, 4, "406d006b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, 4, "406d006c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 5, -1, "406_005", 2, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY25[] = {
+ { 0, 4, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 5, -1, "406d007a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 5, -1, "406d007b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 5, -1, "406d007c", 2, 255, -1, 0, 0, &_state2, 3 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY26[] = {
+ { 0, -1, "406d005", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "406d005b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "406d005c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 0, -1, "406d005d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 0, -1, "406d005e", 2, 255, -1, 0, 0, &_state2, 5 },
+ { 0, -1, "406d005f", 2, 255, -1, 0, 0, &_state2, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY27[] = {
+ { 0, -1, "406d005", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "406d005b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "406d005c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 0, -1, "406d005d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 0, -1, "406d005e", 2, 255, -1, 0, 0, &_state2, 5 },
+ { 0, -1, "406d005f", 2, 255, -1, 0, 0, &_state2, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY28[] = {
+ { 0, -1, "406d005", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "406d005b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "406d005c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 0, -1, "406d005d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 0, -1, "406d005e", 2, 255, -1, 0, 0, &_state2, 5 },
+ { 0, -1, "406d005f", 2, 255, -1, 0, 0, &_state2, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY29[] = {
+ { 0, 20, "406d008a", 2, 255, -1, 0, 0, &_state2, 1 },
+ { 0, 20, "406d008b", 2, 255, -1, 0, 0, &_state2, 2 },
+ { 0, 20, "406d008c", 2, 255, -1, 0, 0, &_state2, 3 },
+ { 0, 20, "406d008d", 2, 255, -1, 0, 0, &_state2, 4 },
+ { 21, -1, "406d009a", 2, 255, -1, 0, 0, &_state3, 1 },
+ { 21, -1, "406d009b", 2, 255, -1, 0, 0, &_state3, 2 },
+ { 21, -1, "406d009c", 2, 255, -1, 0, 0, &_state3, 3 },
+ { 21, -1, "406d009d", 2, 255, -1, 0, 0, &_state3, 4 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY30[] = {
+ { 0, 1, nullptr, 2, 255, -1, 0, 10, &_state2, 0 },
+ { 0, 1, "406d011a", 2, 255, -1, 0, -1, &_state2, 1 },
+ { 0, 1, "406d011b", 2, 255, -1, 0, -1, &_state2, 2 },
+ { 0, 1, "406d011c", 2, 255, -1, 0, -1, &_state2, 3 },
+ { 0, 1, "406d011d", 2, 255, -1, 0, -1, &_state2, 4 },
+ { 0, 1, "406d011e", 2, 255, -1, 0, -1, &_state2, 5 },
+ { 0, 1, "406d011f", 2, 255, -1, 0, -1, &_state2, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY31[] = {
+ { 0, 3, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, 3, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, 3, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, 3, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, 3, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 0, 3, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY32[] = {
+ { 0, 5, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, 5, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, 5, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, 5, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, 5, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 0, 5, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY33[] = {
+ { 0, -1, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, -1, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, -1, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, -1, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, -1, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY34[] = {
+ { 0, 3, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, 3, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, 3, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, 3, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, 3, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 2, 3, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 5, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 0, 5, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY35[] = {
+ { 0, 14, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, 14, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, 14, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, 14, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, 14, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ { 15, 16, nullptr, 0, 0, -1, 1, 3, nullptr, 0 },
+ { 15, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room406::PLAY36[] = {
+ { 0, 2, "406d010a", 2, 175, -1, 0, 0, &_state2, 1 },
+ { 0, 2, "406d010b", 2, 175, -1, 0, 0, &_state2, 2 },
+ { 0, 2, "406d010c", 2, 175, -1, 0, 0, &_state2, 3 },
+ { 0, 2, "406d010d", 2, 175, -1, 0, 0, &_state2, 4 },
+ { 0, 2, "406d010e", 2, 175, -1, 0, 0, &_state2, 5 },
+ { 1, 0, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
+ { 2, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 5, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+};
+
+long Room406::_state1;
+long Room406::_state2;
+long Room406::_state3;
+long Room406::_state4;
+
+
+Room406::Room406() : Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+ _state4 = 0;
+}
+
void Room406::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index 22a8c802531..7a91023d40e 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -23,14 +23,60 @@
#define M4_BURGER_ROOMS_SECTION4_ROOM406_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room406 : public Room {
+private:
+ static const char *SAID[][4];
+ static const WilburMatch MATCH[];
+ static const seriesStreamBreak SERIES1[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static const seriesPlayBreak PLAY19[];
+ static const seriesPlayBreak PLAY20[];
+ static const seriesPlayBreak PLAY21[];
+ static const seriesPlayBreak PLAY22[];
+ static const seriesPlayBreak PLAY23[];
+ static const seriesPlayBreak PLAY24[];
+ static const seriesPlayBreak PLAY25[];
+ static const seriesPlayBreak PLAY26[];
+ static const seriesPlayBreak PLAY27[];
+ static const seriesPlayBreak PLAY28[];
+ static const seriesPlayBreak PLAY29[];
+ static const seriesPlayBreak PLAY30[];
+ static const seriesPlayBreak PLAY31[];
+ static const seriesPlayBreak PLAY32[];
+ static const seriesPlayBreak PLAY33[];
+ static const seriesPlayBreak PLAY34[];
+ static const seriesPlayBreak PLAY35[];
+ static const seriesPlayBreak PLAY36[];
+ static long _state1;
+ static long _state2;
+ static long _state3;
+ static long _state4;
+
public:
- Room406() : Room() {}
+ Room406();
~Room406() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 0774ba9eb2d..5ec1e1aa727 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -26,6 +26,16 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room407::SAID[][4] = {
+ { "TOUR BUS", "407w001", "407w002", "407w003" },
+ { "ROXY", nullptr, "400w001", "400w001" },
+ { "DRUMZ", "407w007", "400w001", "400w001" },
+ { "INSTRUMENTS", "407w009", "407w010", "407w010" },
+ { "FORCE FIELD", "400w005", nullptr, "400w001" },
+ { "FORCE FIELD ", "400w005", nullptr, "400w001" }
+};
+
+
void Room407::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index 57a9465b2cc..e24dbe1f49f 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -29,6 +29,9 @@ namespace Burger {
namespace Rooms {
class Room407 : public Room {
+private:
+ static const char *SAID[][4];
+
public:
Room407() : Room() {}
~Room407() override {}
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 212770a6284..569c2a1b214 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -26,6 +26,101 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Section4::PARSER[] = {
+ "DEED",
+ "TAKE",
+ nullptr,
+ "WILBUR",
+ "400w001",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ "JAWZ O' LIFE",
+ "TAKE",
+ nullptr,
+ "BARRED WINDOW",
+ "404w102",
+ "BARRED WINDOW ",
+ "404w102",
+ "WILBUR",
+ "400w001",
+ nullptr,
+ nullptr,
+ "Th-th-th-that's all folks...",
+ "FISH",
+ "LOOK AT",
+ "400w100",
+ "TAKE",
+ nullptr,
+ "MUFFIN",
+ "405w101",
+ "WILBUR",
+ "400w101",
+ nullptr,
+ "400w102",
+ "Th-th-th-that's all folks...",
+ "DOG COLLAR",
+ "LOOK AT",
+ "400w103",
+ "TAKE",
+ nullptr,
+ "PEGLEG ",
+ "406w101",
+ "WILBUR",
+ "400w104",
+ nullptr,
+ "400W105",
+ "Th-th-th-that's all folks...",
+ "HOOK",
+ "LOOK AT",
+ "400w106",
+ "TAKE",
+ nullptr,
+ "WILBUR",
+ "400w001",
+ nullptr,
+ "400w107",
+ "Th-th-th-that's all folks...",
+ "RECORDS",
+ "LOOK AT",
+ "400w108",
+ "TAKE",
+ nullptr,
+ "WILBUR",
+ "400w001",
+ nullptr,
+ "400w109",
+ "Th-th-th-that's all folks...",
+ "QUARTER",
+ "LOOK AT",
+ "400w110",
+ "TAKE",
+ nullptr,
+ "WILBUR",
+ "400w001",
+ nullptr,
+ "400w111",
+ "Th-th-th-that's all folks...",
+ "DISC",
+ "LOOK AT",
+ "400w002",
+ "TAKE",
+ "400w003",
+ nullptr,
+ "400w004",
+ "Th-th-th-that's all folks...",
+ "DISC ",
+ "LOOK AT",
+ "400w002",
+ "TAKE",
+ "400w003",
+ nullptr,
+ "400w004",
+ "Th-th-th-that's all folks...",
+ nullptr
+};
+
+
Section4::Section4() : Rooms::Section() {
add(401, &_room401);
add(402, &_room402);
diff --git a/engines/m4/burger/rooms/section4/section4.h b/engines/m4/burger/rooms/section4/section4.h
index 0b3f28b8c0b..c98744e6956 100644
--- a/engines/m4/burger/rooms/section4/section4.h
+++ b/engines/m4/burger/rooms/section4/section4.h
@@ -36,6 +36,9 @@ namespace Burger {
namespace Rooms {
class Section4 : public Rooms::Section {
+private:
+ static const char *PARSER[];
+
private:
Room401 _room401;
Room402 _room402;
Commit: 3ad7a5f3484ffd50a4ff4f271a96d63c617b45ba
https://github.com/scummvm/scummvm/commit/3ad7a5f3484ffd50a4ff4f271a96d63c617b45ba
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further section 4 static arrays
Changed paths:
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 5ec1e1aa727..818b679599d 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -35,6 +35,130 @@ const char *Room407::SAID[][4] = {
{ "FORCE FIELD ", "400w005", nullptr, "400w001" }
};
+const WilburMatch Room407::MATCH[] = {
+ { "TALK", "DRUMZ", 11, 0, 0, nullptr, 0 },
+ { "AMPLIFIER", "DRUMZ", 4, 0, 0, &_state1, 4 },
+ { nullptr, "DRUMZ", 4, 0, 0, &_state1, 7 },
+ { "LOOK AT", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 1 },
+ { "TALK", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 2 },
+ { "AMPLIFIER", "ROXY", 4, 0, 0, &_state1, 4 },
+ { "DOG COLLAR", "ROXY", 4, 0, 0, &_state1, 5 },
+ { nullptr, "ROXY", 4, 0, 0, &_state1, 6 },
+ { "AMPLIFIER", "INSTRUMENTS", 4, 0, 0, &_state1, 8 },
+ { nullptr, "INSTRUMENTS", 4, 0, 0, &_state1, 9 },
+ { nullptr, "TOUR BUS", 4, 0, 0, &_state1, 3 },
+ { nullptr, nullptr, -1, 0, 0, nullptr, 0 }
+};
+
+const seriesPlayBreak Room407::PLAY1[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY2[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY3[] = {
+ { 0, 1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 2, -1, 0, 0, 0, -1, 0, 4, 0, 0 },
+ { 0, 1, 0, 0, 0, -1, 2, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY4[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY5[] = {
+ { 0, -1, "145_004", 2, 255, -1, 1, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY6[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY7[] = {
+ { 0, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY8[] = {
+ { 0, -1, "407r901", 1, 255, -1, 4, -1, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY9[] = {
+ { 0, -1, "407r903", 1, 255, -1, 4, -1, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY10[] = {
+ { 0, -1, 0, 0, 0, -1, 2, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY11[] = {
+ { 0, 2, 0, 0, 0, -1, 0, 0, 0, 0 },
+ { 3, -1, "407r904x", 1, 255, -1, 4, -1, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY12[] = {
+ { 0, 6, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY13[] = {
+ { 7, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY14[] = {
+ { 0, -1, "407r904y", 1, 255, -1, 4, -1, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY15[] = {
+ { 0, 3, "407v901", 1, 255, -1, 4, -1, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY16[] = {
+ { 5, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY17[] = {
+ { 1, -1, 0, 0, 0, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY18[] = {
+ { 0, 1, "999_003", 1, 255, -1, 0, 0, 0, 0 },
+ { 2, 9, 0, 0, 0, 7, 0, 0, 0, 0 },
+ { 10, 11, "999_003", 1, 255, -1, 0, 0, 0, 0 },
+ { 12, -1, 0, 0, 0, 9, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room407::PLAY19[] = {
+ { 0, 25, 0, 1, 0, -1, 2048, 0, 0, 0 },
+ { 26, 42, "500_030", 1, 255, -1, 0, 0, 0, 0 },
+ { 43, -1, "500_030", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
+long Room407::_state1;
+
+
+Room407::Room407() : Room() {
+ _state1 = 0;
+}
void Room407::init() {
}
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index e24dbe1f49f..c1ceec063b9 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -23,6 +23,7 @@
#define M4_BURGER_ROOMS_SECTION4_ROOM407_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
@@ -31,9 +32,30 @@ namespace Rooms {
class Room407 : public Room {
private:
static const char *SAID[][4];
+ static const WilburMatch MATCH[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static const seriesPlayBreak PLAY19[];
+ static long _state1;
public:
- Room407() : Room() {}
+ Room407();
~Room407() override {}
void init() override;
Commit: 9bb72fa2534836b915715c8319c48f53e18594aa
https://github.com/scummvm/scummvm/commit/9bb72fa2534836b915715c8319c48f53e18594aa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 172
Changed paths:
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room172.h
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index 00df029f077..daca6893538 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -146,7 +146,174 @@ void Room172::init() {
}
void Room172::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val1) {
+ case 4:
+ _val1 = 5;
+ series_play_with_breaks(PLAY2, "172ap01", 0x600, 1, 3, 8);
+ digi_play("172p906", 2, 255, 1);
+ break;
+
+ case 5:
+ _G(flags)[V092] = 1;
+ hotspot_set_active("AUNT POLLY", true);
+ _val1 = 7;
+ _series5.play("172ap1t", 0x400, 4, -1, 6);
+ break;
+
+ case 6:
+ freeSeries5();
+ _val1 = 8;
+ npc_say("172p907", 1, "172ap1t", 0x400, true);
+ break;
+
+ case 7:
+ digi_unload("172p906");
+ freeSeries5();
+ _series5.show("172ap1t", 0x400);
+ wilbur_speech("172w902", 1);
+ break;
+
+ case 8:
+ _G(flags)[V091] = true;
+ terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_series1s);
+ _val1 = 9;
+ series_play_with_breaks(PLAY3, "172ap02", 0x400, 1, 3, 8);
+ break;
+
+ case 9:
+ _series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
+ kernel_trigger_dispatch_now(3);
+ playDigi3();
+ break;
+
+ case 10:
+ freeSeries7();
+ _val1 = 11;
+ series_play_with_breaks(PLAY4, "172ap02", 0x400, 1, 3, 8);
+ break;
+
+ case 11:
+ freeSeries7();
+ _val1 = 14;
+ npc_say(conv_sound_to_play(), 1, "172ap02", 0x400, 1, 31, 35);
+ break;
+
+ case 12:
+ player_set_commands_allowed(false);
+ _G(flags)[V298] = 1;
+ freeSeries7();
+ _series5.terminate();
+ _val1 = 15;
+ npc_say(conv_sound_to_play(), 1, "172ap02", 0x400, 1, 31, 35);
+ break;
+
+ case 13:
+ freeSeries7();
+ series_play_with_breaks(PLAY5, "172ap02", 0x400, 10001, 3, 8);
+ break;
+
+ case 14:
+ _series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
+ playDigi3();
+ conv_resume_curr();
+ break;
+
+ case 15:
+ _G(flags)[V298] = 0;
+ player_set_commands_allowed(true);
+ _series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
+ playDigi3();
+ break;
+
+ case 16:
+ freeSeries7();
+ _val1 = 17;
+ series_play_with_breaks(PLAY6, "172ap02", 0x400, 1, 3, 8);
+ break;
+
+ case 17:
+ freeSeries5();
+ hotspot_set_active("AUNT POLLY", false);
+ _series1 = series_show("172fud2", 0x700);
+ _series1s = series_show("172fuds", 0x701);
+ intr_remove_no_walk_rect(_walk1);
+ _val1 = 18;
+ series_play_with_breaks(PLAY7, "172ap03", 0x600, 1, 3, 8);
+ break;
+
+ case 18:
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ term_message("ERROR!!!! polly_should not set!");
+ break;
+ }
+ break;
+
+ case 2:
+ _series3.terminate();
+ break;
+
+ case 3:
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ conv_load_and_prepare("conv41", 4);
+ conv_export_value_curr(_G(flags)[V088], 0);
+ conv_export_value_curr(inv_player_has("WHISTLE") ? 1 : 0, 1);
+ conv_export_pointer_curr(&_G(flags)[V093], 2);
+ conv_play_curr();
+ break;
+
+ case 4:
+ freeSeries5();
+
+ if (_G(flags)[V092]) {
+ freeSeries7();
+ _val1 = 15;
+ } else {
+ _G(flags)[V088] = 1;
+ _val1 = 16;
+ }
+
+ kernel_trigger_dispatch_now(1);
+ _G(flags)[V298] = 0;
+ _G(flags)[V299] = 0;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _convName = _G(flags)[V087] ? "172p903" : "172p902";
+ _val1 = 12;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 2:
+ disable_player();
+ _G(wilbur_should) = 3;
+ series_play_with_breaks(PLAY1, "172wi01", 0x700, gCHANGE_WILBUR_ANIMATION, 3, 8);
+ break;
+
+ case 3:
+ enable_player();
+ hotspot_set_active("CARROT JUICE ", false);
+ inv_give_to_player("CARROT JUICE");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room172::pre_parser() {
@@ -168,7 +335,136 @@ void Room172::pre_parser() {
void Room172::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- // TODO
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("conv41")) {
+ conv41();
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("PARLOUR")) {
+ disable_player_commands_and_fade_init(1018);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("BASEMENT")) {
+ disable_player_commands_and_fade_init(1020);
+ } else if (player_said("TAKE", "CARROT JUICE ")) {
+ if (_G(flags)[V092]) {
+ _convName = "172p950";
+ _val1 = 12;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("WHISTLE", "AUNT POLLY")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 1;
+ wilbur_speech("172w901", gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TALK", "AUNT POLLY")) {
+ kernel_trigger_dispatch_now(3);
+ } else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
+ _convName = imath_rand_bool(2) ? "172p901" : "172904";
+ _val1 = 12;
+ kernel_trigger_dispatch_now(1);
+ } else if (player_said("MICROWAVE")) {
+ parserAction("172w004");
+ } else if (player_said("GEAR", "REFRIGERATOR")) {
+ parserAction("172w005");
+ } else if (player_said("GEAR", "OVEN")) {
+ parserAction("172w007");
+ } else if (player_said("SINK")) {
+ parserAction("172w010");
+ } else if (player_said("GEAR") && player_said_any("CUPBOARD", "CUPBOARD ")) {
+ parserAction("172w036");
+ } else if (player_said("TAKE", "JUICER")) {
+ if (_G(flags)[V092]) {
+ _convName = imath_rand_bool(2) ? "172p905a" : "172p905b";
+ _val1 = 12;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ wilbur_speech("172w033");
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room172::parserAction(const char *name) {
+ if (_G(flags)[V092]) {
+ _convName = "172p950";
+ _val1 = 12;
+ kernel_trigger_dispatch_now(1);
+ } else {
+ wilbur_speech(name);
+ }
+}
+
+void Room172::freeSeries7() {
+ digi_stop(2);
+ terminateMachineAndNull(_series7);
+}
+
+void Room172::playDigi3() {
+ loadSeries7();
+ digi_preload("172_003");
+ digi_play_loop("172_003", 3, 125);
+}
+
+void Room172::loadSeries7() {
+ digi_preload("172p909");
+ digi_play_loop("172p909", 2, 255);
+ _series7 = series_play("172ap02t", 0x3ff, 4, -1, 4);
+}
+
+void Room172::conv41() {
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (sound) {
+ if (who == 1) {
+ wilbur_speech(sound, 10001);
+ } else {
+ freeSeries5();
+
+ switch (node) {
+ case 0:
+ _val1 = 4;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 2:
+ switch (entry) {
+ case 0:
+ _val1 = 10;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 1:
+ freeSeries7();
+ _G(flags)[V092] = 0;
+ _val1 = 14;
+ npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ freeSeries7();
+ _val1 = 13;
+ npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ break;
+
+ default:
+ freeSeries7();
+ _val1 = 14;
+ npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ break;
+ }
+ }
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room172.h b/engines/m4/burger/rooms/section1/room172.h
index 6271538be9b..8304834083d 100644
--- a/engines/m4/burger/rooms/section1/room172.h
+++ b/engines/m4/burger/rooms/section1/room172.h
@@ -31,15 +31,24 @@ namespace Rooms {
class Room172 : public Room {
private:
machine *_series1 = nullptr;
- machine *_series2 = nullptr;
+ machine *_series1s = nullptr;
Series _series3;
machine *_series4 = nullptr;
- machine *_series5 = nullptr;
- machine *_series6 = nullptr;
+ Series _series5;
machine *_series7 = nullptr;
noWalkRect *_walk1 = nullptr;
+ const char *_convName = nullptr;
int _val1 = 0;
+ void loadSeries7();
+ void freeSeries5() {
+ _series5.terminate();
+ }
+ void freeSeries7();
+ void playDigi3();
+ void conv41();
+ void parserAction(const char *name);
+
public:
Room172() : Room() {}
~Room172() override {}
Commit: 2f8d047e84a350f8d9520b58adfb8c19ffb72eab
https://github.com/scummvm/scummvm/commit/2f8d047e84a350f8d9520b58adfb8c19ffb72eab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 173
Changed paths:
engines/m4/burger/rooms/section1/room173.cpp
engines/m4/burger/rooms/section1/room173.h
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
index f9b9ff2b27c..2e8b156eb38 100644
--- a/engines/m4/burger/rooms/section1/room173.cpp
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -54,15 +54,77 @@ static const seriesPlayBreak PLAY2[] = {
void Room173::init() {
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 172:
+ ws_demand_location(136, 318, 5);
+ _G(wilbur_should) = player_been_here(173) ? 1 : 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ ws_demand_location(332, 333, 5);
+ break;
+ }
}
void Room173::daemon() {
-}
+ switch (_G(kernel).trigger) {
+ case 1:
+ disable_player_commands_and_fade_init(1019);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY1, "173wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 2:
+ disable_player();
+ _G(wilbur_should) = 3;
+ series_play_with_breaks(PLAY1, "173wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
-void Room173::pre_parser() {
+ case 3:
+ enable_player();
+ wilbur_speech("173w001");
+ break;
+
+ case 4:
+ disable_player();
+ series_play_with_breaks(PLAY2, "173wi02", 0x200, -1, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room173::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("GEAR", "STAIRS")) {
+ _G(wilbur_should) = 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room173.h b/engines/m4/burger/rooms/section1/room173.h
index 5a64ae24eff..07f9c8763c5 100644
--- a/engines/m4/burger/rooms/section1/room173.h
+++ b/engines/m4/burger/rooms/section1/room173.h
@@ -35,7 +35,6 @@ public:
void init() override;
void daemon() override;
- void pre_parser() override;
void parser() override;
};
Commit: 7feb015f872afefe592078b557817e7b88c81b76
https://github.com/scummvm/scummvm/commit/7feb015f872afefe592078b557817e7b88c81b76
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 174
Changed paths:
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room174.h
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 82145aa6533..01cfac474b1 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -66,15 +66,118 @@ static const seriesPlayBreak PLAY3[] = {
void Room174::init() {
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 175:
+ ws_demand_location(639, 299, 9);
+ ws_walk(472, 297, nullptr, -1);
+ break;
+
+ default:
+ ws_demand_location(252, 304, 5);
+ break;
+ }
+
+ _series1 = series_show("174tlt01", 0x8ff);
+ _series2 = series_show("174flush", 0xf00);
+
+ if (inv_player_has("LAXATIVE")) {
+ hotspot_set_active("LAXATIVE ", false);
+ } else {
+ _laxative.show("174wi01", 0x400, 0, -1, -1, 19);
+ }
}
void Room174::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_action) {
+ case 5:
+ terminateMachineAndNull(_series1);
+ _action = 6;
+ series_play_with_breaks(PLAY3, "174tlt01", 0x8ff, 1, 2);
+ break;
+
+ case 6:
+ player_set_commands_allowed(true);
+ _series1 = series_show("174tlt01", 0x8ff);
+ break;
+
+ default:
+ term_message("ERROR!!!!! toilet_should not set!");
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ terminateMachineAndNull(_series2);
+ _action = 5;
+ _G(wilbur_should) = 2;
+ series_play_with_breaks(PLAY1, "174wi03", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 2:
+ ws_unhide_walker();
+ wilbur_speech("174w003");
+ _series2 = series_show("174flush", 0xf00);
+ break;
+
+ case 3:
+ _laxative.terminate();
+ ws_hide_walker();
+ _G(wilbur_should) = 4;
+ series_play_with_breaks(PLAY2, "174wi01", 0x400, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ disable_player();
+ inv_give_to_player("LAXATIVE");
+ hotspot_set_active("LAXATIVE ", false);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room174::pre_parser() {
+ if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT"))
+ player_set_facing_at(522, 287);
}
void Room174::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT")) {
+ disable_player_commands_and_fade_init(1022);
+ } else if (player_said("GEAR") && player_said_any("TOILET", "FLUSH CHAIN")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "LAXATIVE ")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ wilbur_speech("174w013", gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "MIRROR")) {
+ wilbur_speech("174w001");
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room174.h b/engines/m4/burger/rooms/section1/room174.h
index 713564a619c..5b85d442efc 100644
--- a/engines/m4/burger/rooms/section1/room174.h
+++ b/engines/m4/burger/rooms/section1/room174.h
@@ -29,6 +29,12 @@ namespace Burger {
namespace Rooms {
class Room174 : public Room {
+private:
+ machine *_series1 = nullptr;
+ machine *_series2 = nullptr;
+ Series _laxative;
+ int _action = 0;
+
public:
Room174() : Room() {}
~Room174() override {}
Commit: e923ac429538f229f65feb1eb4a2b139763f3ba5
https://github.com/scummvm/scummvm/commit/e923ac429538f229f65feb1eb4a2b139763f3ba5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 175 and 176
Changed paths:
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section1/room176.h
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index 67f5645b68b..94a45fe88b7 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -62,15 +62,95 @@ static const seriesPlayBreak PLAY3[] = {
void Room175::init() {
+ switch (_G(game).previous_room) {
+ case 171:
+ ws_demand_location(331, 272, 3);
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 174:
+ ws_demand_location(150, 307, 3);
+ ws_walk(222, 307, nullptr, -1);
+ break;
+
+ case 176:
+ ws_demand_location(72, 348, 3);
+ ws_walk(170, 349, nullptr, -1);
+ break;
+
+ default:
+ ws_demand_location(327, 340, 5);
+ break;
+ }
+
+ digi_preload("175_001");
+ digi_play_loop("175_001", 2, 125);
+ series_play("175fan", 0xf00);
}
void Room175::daemon() {
+ switch (_G(kernel).trigger) {
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY1, "175wi01", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 2:
+ disable_player();
+ series_play_with_breaks(PLAY2, "175wi02", 0xc00, -1, 3);
+ disable_player_commands_and_fade_init(1018);
+ break;
+
+ case 3:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY3, "175wi03", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room175::pre_parser() {
+ if (player_said_any("GEAR", "LOOK AT")) {
+ if (player_said("BATHROOM"))
+ player_set_facing_at(194, 301);
+
+ if (player_said("WILBUR'S ROOM"))
+ player_set_facing_at(126, 343);
+ }
+
+
}
void Room175::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("GEAR", "STAIRS")) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("BATHROOM")) {
+ disable_player_commands_and_fade_init(1021);
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("WILBUR'S ROOM")) {
+ disable_player_commands_and_fade_init(1023);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index d55f817e6c6..42dbb7c63a4 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -55,15 +55,75 @@ static const seriesPlayBreak PLAY1[] = {
void Room176::init() {
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 175:
+ ws_demand_location(546, 239, 9);
+ ws_walk(447, 251, nullptr, -1);
+ break;
+
+ default:
+ ws_demand_location(340, 279, 5);
+ break;
+ }
+
+ if (inv_player_has("PUZ DISPENSER") || inv_player_has("BROKEN PUZ DISPENSER")) {
+ hotspot_set_active("PUZ DISPENSER ", false);
+ } else {
+ _puzDispenser = series_show("176pez", 0x500);
+ }
}
void Room176::daemon() {
+ switch (_G(kernel).trigger) {
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ disable_player();
+ terminateMachineAndNull(_puzDispenser);
+ _G(wilbur_should) = 2;
+ series_play_with_breaks(PLAY1, "176wi01", 0x500, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 2:
+ enable_player();
+ inv_give_to_player("BROKEN PUZ DISPENSER");
+ hotspot_set_active("PUZ DISPENSER ", false);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room176::pre_parser() {
+ if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT"))
+ player_set_facing_at(487, 238);
}
void Room176::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("HALLWAY")) {
+ disable_player_commands_and_fade_init(1022);
+ } else if (player_said("TAKE", "PUZ DISPENSER ")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room176.h b/engines/m4/burger/rooms/section1/room176.h
index 28c66fcfc99..9cf5522b831 100644
--- a/engines/m4/burger/rooms/section1/room176.h
+++ b/engines/m4/burger/rooms/section1/room176.h
@@ -29,6 +29,9 @@ namespace Burger {
namespace Rooms {
class Room176 : public Room {
+private:
+ machine *_puzDispenser = nullptr;
+
public:
Room176() : Room() {}
~Room176() override {}
Commit: 76ec4683201e692fa9c7871baf79261937d29c67
https://github.com/scummvm/scummvm/commit/76ec4683201e692fa9c7871baf79261937d29c67
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remaining global_daemon code/methods
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/inventory.cpp
engines/m4/burger/inventory.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section2/room207.cpp
engines/m4/burger/rooms/section2/room207.h
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room510.cpp
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room802.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 88f916b6c6e..bd45c60b89e 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -470,11 +470,11 @@ void BurgerEngine::global_daemon() {
break;
case gTELEPROTED2:
-
+ testDone();
break;
case 10027:
- error("TODO: global_daemon 10027");
+ wilburTeleported();
break;
case 10033:
@@ -623,5 +623,273 @@ bool BurgerEngine::saidofInterest() const {
player_said_any("LAXATIVE", "money", "crow bar", "Wilbur");
}
+void BurgerEngine::testDone() {
+ player_set_commands_allowed(false);
+ if (_G(flags).getConvName())
+ _G(game).setRoom(207);
+ else
+ handleTestDone();
+}
+
+void BurgerEngine::handleTestDone() {
+ if (_G(flags)[V287]) {
+ testDone1();
+
+ if (_G(flags)[V241]) {
+ testDone2();
+
+ if (_G(flags)[V099]) {
+ testDone3();
+
+ if (_G(flags)[V184]) {
+ testDone4();
+
+ if (_G(flags)[V152]) {
+ testDone5();
+
+ _G(game).setRoom(701);
+ _G(flags).set_boonsville_time(505200);
+ } else {
+ _G(game).setRoom(_G(flags)[V153] ? 402 : 401);
+ _G(flags).set_boonsville_time(393600);
+ }
+ } else {
+ _G(game).setRoom(_G(flags)[V185] ? 502 : 501);
+ _G(flags).set_boonsville_time(282000);
+ }
+ } else {
+ _G(game).setRoom(_G(flags)[V100] ? 302 : 301);
+ _G(flags).set_boonsville_time(170400);
+ }
+ } else {
+ _G(game).setRoom(_G(flags)[V242] ? 604 : 601);
+ _G(flags).set_boonsville_time(58800);
+ }
+ } else {
+ _G(game).setRoom(801);
+ _G(flags).set_boonsville_time(37200);
+ }
+}
+
+void BurgerEngine::testDone1() {
+ _G(flags)[V287] = 1;
+ if (!_G(flags)[kNEURO_TEST_COUNTER])
+ _G(flags)[kNEURO_TEST_COUNTER]++;
+}
+
+void BurgerEngine::testDone2() {
+ if (!_G(flags)[V242])
+ _G(flags)[V242]++;
+
+ _G(flags)[V241] = 1;
+ _G(flags)[V243] = 6007;
+ _G(flags)[V244] = 6004;
+ _G(flags)[V245] = 10031;
+ _G(flags)[V246] = 0;
+ _G(flags)[V247] = 1;
+ _G(flags)[V248] = 1;
+ _G(flags)[V249] = 1;
+ _G(flags)[V250] = 1;
+ _G(flags)[V251] = 1;
+ _G(flags)[V255] = 1;
+ _G(flags)[V256] = 2;
+ _G(flags)[V257] = -140;
+ _G(flags)[V258] = 0;
+ _G(flags)[V259] = 1;
+ _G(flags)[V260] = 1;
+ _G(flags)[V261] = 1;
+ _G(flags)[V263] = 0;
+ _G(flags)[V265] = 1;
+ _G(flags)[V266] = 0;
+ _G(flags)[V269] = 1;
+ _G(flags)[V270] = 6001;
+ _G(flags)[V273] = 1;
+ _G(flags)[V274] = 1;
+ _G(flags)[V277] = 6003;
+ _G(flags)[V278] = 1;
+
+ inv_move_object("ray gun", NOWHERE);
+ inv_move_object("kibble", NOWHERE);
+ inv_move_object("block of ice", NOWHERE);
+ inv_move_object("pantyhose", NOWHERE);
+}
+
+void BurgerEngine::testDone3() {
+ if (!_G(flags)[V100])
+ _G(flags)[V100]++;
+
+ inv_move_object("BURGER MORSEL", NOWHERE);
+ inv_move_object("MATCHES", NOWHERE);
+ inv_move_object("JUG", NOWHERE);
+ inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
+ inv_move_object("CARROT JUICE", NOWHERE);
+ inv_give_to_player("BOTTLE");
+
+ _G(flags)[V099] = 1;
+ _G(flags)[V101] = 1;
+ _G(flags)[V107] = 1;
+ _G(flags)[V108] = 1;
+ _G(flags)[V109] = 1;
+ _G(flags)[V110] = 1;
+ _G(flags)[V111] = 1;
+ _G(flags)[V112] = 1;
+ _G(flags)[V115] = 5;
+ _G(flags)[V116] = 1;
+ _G(flags)[V117] = 1;
+ _G(flags)[V118] = 3002;
+ _G(flags)[V119] = 0;
+ _G(flags)[V120] = 1;
+ _G(flags)[V121] = 3003;
+ _G(flags)[V122] = 1;
+ _G(flags)[V123] = 1;
+ _G(flags)[V124] = 1;
+ _G(flags)[V129] = 1;
+ _G(flags)[V130] = 1;
+ _G(flags)[V134] = 1;
+ _G(flags)[V140] = 1;
+ _G(flags)[V144] = 1;
+ _G(flags)[V145] = 1;
+}
+
+void BurgerEngine::testDone4() {
+ if (!_G(flags)[V185])
+ _G(flags)[V185]++;
+
+ inv_move_object("GIZMO", NOWHERE);
+ inv_move_object("CHRISTMAS LIGHTS", NOWHERE);
+ inv_move_object("CHRISTMAS LIGHTS ", NOWHERE);
+ inv_move_object("RUBBER DUCKY", NOWHERE);
+ inv_move_object("SOAPY WATER", NOWHERE);
+ inv_move_object("DIRTY SOCK", NOWHERE);
+ inv_move_object("ROLLING PIN", NOWHERE);
+ inv_move_object("RUBBER GLOVES", NOWHERE);
+ inv_move_object("KINDLING", NOWHERE);
+ inv_move_object("BURNING KINDLING", NOWHERE);
+ inv_move_object("GIZMO", NOWHERE);
+ inv_move_object("GIZMO", NOWHERE);
+ inv_give_to_player("BOTTLE");
+
+ _G(flags)[V184] = 1;
+ _G(flags)[V186] = 0;
+ _G(flags)[V195] = 1;
+ _G(flags)[V196] = 0;
+ _G(flags)[V197] = 1;
+ _G(flags)[V198] = 1;
+ _G(flags)[V199] = 1;
+ _G(flags)[V200] = 5003;
+ _G(flags)[kBORK_STATE] = 16;
+ _G(flags)[V204] = 5003;
+ _G(flags)[V205] = 1;
+ _G(flags)[V206] = 0;
+ _G(flags)[V207] = 1;
+ _G(flags)[V210] = 5002;
+ _G(flags)[V211] = 5000;
+ _G(flags)[V212] = 5000;
+ _G(flags)[V213] = 2;
+ _G(flags)[V214] = 0;
+ _G(flags)[V218] = 5003;
+ _G(flags)[V219] = 1;
+ _G(flags)[V223] = 2;
+ _G(flags)[V224] = 0;
+ _G(flags)[V227] = 1;
+ _G(flags)[V228] = 1;
+ _G(flags)[V229] = 0;
+ _G(flags)[V234] = 1;
+}
+
+void BurgerEngine::testDone5() {
+ if (!_G(flags)[V153])
+ _G(flags)[V153]++;
+
+ _G(flags)[V152] = 1;
+ _G(flags)[V157] = 1;
+ _G(flags)[V158] = 1;
+ _G(flags)[V159] = 1;
+ _G(flags)[V162] = 1;
+ _G(flags)[V165] = 1;
+ _G(flags)[V166] = 1;
+ _G(flags)[V167] = 1;
+ _G(flags)[V175] = 1;
+ _G(flags)[V171] = 4003;
+ _G(flags)[V172] = 10026;
+ _G(flags)[V173] = 0;
+ _G(flags)[V174] = 4004;
+ _G(flags)[V176] = 1;
+ _G(flags)[V181] = 1;
+
+ inv_move_object("QUARTER", NOWHERE);
+ inv_move_object("FISH", NOWHERE);
+ inv_move_object("RECORDS", NOWHERE);
+ inv_move_object("DOG COLLAR", NOWHERE);
+}
+
+#define MAX_INT 0x7FFFFFFF
+
+void BurgerEngine::wilburTeleported() {
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ int oldSection = _G(game).section_id;
+
+ switch (oldSection) {
+ case 3:
+ if (_G(flags)[V100] < MAX_INT)
+ _G(flags)[V100]++;
+ break;
+
+ case 4:
+ if (_G(flags)[V153] < MAX_INT)
+ _G(flags)[V153]++;
+ break;
+
+ case 5:
+ if (_G(flags)[V185] < MAX_INT)
+ _G(flags)[V100]++;
+ break;
+
+ case 6:
+ if (_G(flags)[V242] < MAX_INT)
+ _G(flags)[V242]++;
+ break;
+
+ case 8:
+ if (_G(flags)[kNEURO_TEST_COUNTER] < MAX_INT)
+ _G(flags)[kNEURO_TEST_COUNTER]++;
+ break;
+
+ default:
+ break;
+ }
+
+ if (_G(executing) != WHOLE_GAME) {
+ _G(game).setRoom(604);
+ } else {
+ if (_G(flags)[V152]) {
+ testDone5();
+ kernel_trigger_dispatch_now(10033);
+ } else if (_G(flags)[V184] && !_G(flags)[V153]) {
+ testDone4();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[V099] && !_G(flags)[V185]) {
+ testDone3();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[V241] && !_G(flags)[V100]) {
+ testDone2();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[V287] && !_G(flags)[V242]) {
+ testDone1();
+ _G(game).setRoom(204);
+ } else {
+ static_cast<Inventory *>(_G(inventory))->reset();
+ _G(flags).reset5();
+ _G(flags).reset4();
+ _G(flags).reset3();
+ _G(flags).reset2();
+ _G(flags).reset1();
+ _G(game).setRoom(101);
+ }
+ }
+
+ _G(kernel).trigger_mode = oldMode;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 3ed8c2f94b4..9cfa202d8a9 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -53,6 +53,15 @@ private:
*/
bool saidofInterest() const;
+ void testDone();
+ void handleTestDone();
+ void testDone1();
+ void testDone2();
+ void testDone3();
+ void testDone4();
+ void testDone5();
+ void wilburTeleported();
+
protected:
/**
* Creates the structure that holds all the global variables
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 7830532e75d..800df352ca2 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -268,7 +268,7 @@ void Flags::reset4() {
inv_move_object("BURNING KINDLING", 502);
inv_move_object("GIZMO", 502);
- (*this)[gBORK_STATE] = 0;
+ (*this)[kBORK_STATE] = 0;
(*this)[V204] = 5000;
(*this)[V205] = 0;
(*this)[V207] = 0;
@@ -342,5 +342,41 @@ void Flags::conv_reset_all() {
_GC(convSave).clear();
}
+const char *Flags::getConvName() {
+ const char *conv = nullptr;
+ if (_G(flags)[V287] && !_G(flags)[V242])
+ conv = "conv51";
+
+ if (_G(flags)[V242] == 5 && _G(flags)[V241] == 0 && !player_been_here(612)) {
+ if (_G(flags)[V248])
+ conv = "conv52";
+ else
+ --_G(flags)[V242];
+ }
+
+ if (_G(flags)[V241] && !_G(flags)[V100])
+ conv = "conv53";
+
+ if (_G(flags)[V100] == 5 && !_G(flags)[V099] && !player_been_here(310) &&
+ !player_been_here(311) && !player_been_here(312) && !player_been_here(313) &&
+ !player_been_here(314) && !player_been_here(315) && !player_been_here(316) &&
+ !player_been_here(317) && !player_been_here(318) && !player_been_here(319))
+ conv = "conv54";
+
+ if (_G(flags)[V099] && !_G(flags)[V185])
+ conv = "conv55";
+
+ if (_G(flags)[V185] == 5 && !_G(flags)[V184])
+ conv = "conv56";
+
+ if (_G(flags)[V184] && !_G(flags)[V153])
+ conv = "conv57";
+
+ if (_G(flags)[V153] == 5)
+ conv = "conv58";
+
+ return conv;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 954b9efed16..90732c67fea 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -185,7 +185,7 @@ enum {
V149 = 149,
V150 = 150,
V151 = 151,
- ROOM101_FLAG20 = 152,
+ V152 = 152,
V153 = 153,
V154 = 154,
V155 = 155,
@@ -237,7 +237,7 @@ enum {
V200 = 200,
V201 = 201,
V202 = 202,
- gBORK_STATE = 203,
+ kBORK_STATE = 203,
V204 = 204,
V205 = 205,
V206 = 206,
@@ -322,7 +322,7 @@ enum {
V285 = 285,
V286 = 286,
V287 = 287,
- NEURO_TEST_COUNTER = 288,
+ kNEURO_TEST_COUNTER = 288,
ROOM101_FLAG9 = 289,
ROOM101_FLAG7 = 290,
V291 = 291,
@@ -588,6 +588,8 @@ public:
assert(idx < FLAGS_COUNT);
return _flags[idx];
}
+
+ const char *getConvName();
};
} // namespace Burger
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
index 519700a7762..22514db8bb6 100644
--- a/engines/m4/burger/inventory.cpp
+++ b/engines/m4/burger/inventory.cpp
@@ -96,5 +96,10 @@ void Inventory::remove(const Common::String &name) {
_GI(inventory)->_must_redraw_all = true;
}
+void Inventory::reset() {
+ for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item)
+ inv_move_object(item->_name, item->_scene);
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/inventory.h b/engines/m4/burger/inventory.h
index f2a192b2b65..d566220d5da 100644
--- a/engines/m4/burger/inventory.h
+++ b/engines/m4/burger/inventory.h
@@ -48,6 +48,7 @@ public:
void add(const Common::String &name, const Common::String &verbs, int32 sprite, int32 cursor) override;
void set_scroll(int32 scroll) override;
void remove(const Common::String &name) override;
+ void reset();
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 6674e90f0f8..1e199b491a4 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -247,7 +247,7 @@ void Room101::daemon() {
case 6:
if (!_G(flags)[V287]) {
- uint idx = _G(flags)[NEURO_TEST_COUNTER];
+ uint idx = _G(flags)[kNEURO_TEST_COUNTER];
assert(idx < 8);
static const char *const NAMES[8] = {
@@ -306,7 +306,7 @@ void Room101::daemon() {
}
break;
}
- } else if (!_G(flags)[ROOM101_FLAG20]) {
+ } else if (!_G(flags)[V152]) {
switch (_G(flags)[V153]) {
case 0:
case 1:
@@ -332,7 +332,7 @@ void Room101::daemon() {
series_load("101wi13s", -1, nullptr);
if (_G(flags)[V099])
series_load("101wi12s", -1, nullptr);
- if (_G(flags)[ROOM101_FLAG20])
+ if (_G(flags)[V152])
series_load("101wi11s", -1, nullptr);
_machine1 = series_play("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
@@ -408,7 +408,7 @@ void Room101::daemon() {
daemon18();
if (_G(flags)[V184]) {
- if (_G(flags)[ROOM101_FLAG20] || _G(flags)[V220]) {
+ if (_G(flags)[V152] || _G(flags)[V220]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 19);
@@ -817,7 +817,7 @@ void Room101::daemon18() {
}
void Room101::daemon20() {
- if (_G(flags)[V177] || _G(flags)[ROOM101_FLAG20]) {
+ if (_G(flags)[V177] || _G(flags)[V152]) {
inv_move_object("KEYS", 138);
inv_give_to_player("JAWZ O' LIFE");
_G(flags)[V046] = 0;
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
index 1ac7d7ea5ba..fdc59139f0d 100644
--- a/engines/m4/burger/rooms/section2/room207.cpp
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -122,7 +122,7 @@ void Room207::init() {
series_load("207AS04");
series_load("207AS04S");
- _conv1 = getConvName();
+ _conv1 = _G(flags).getConvName();
if (!_conv1)
_conv1 = "conv51";
@@ -390,42 +390,6 @@ void Room207::parser() {
}
}
-const char *Room207::getConvName() {
- _conv2 = nullptr;
- if (_G(flags)[V287] && !_G(flags)[V242])
- _conv2 = "conv51";
-
- if (_G(flags)[V242] == 5 && _G(flags)[V241] == 0 && !player_been_here(612)) {
- if (_G(flags)[V248])
- _conv2 = "conv52";
- else
- --_G(flags)[V242];
- }
-
- if (_G(flags)[V241] && !_G(flags)[V100])
- _conv2 = "conv53";
-
- if (_G(flags)[V100] == 5 && !_G(flags)[V099] && !player_been_here(310) &&
- !player_been_here(311) && !player_been_here(312) && !player_been_here(313) &&
- !player_been_here(314) && !player_been_here(315) && !player_been_here(316) &&
- !player_been_here(317) && !player_been_here(318) && !player_been_here(319))
- _conv2 = "conv54";
-
- if (_G(flags)[V099] && !_G(flags)[V185])
- _conv2 = "conv55";
-
- if (_G(flags)[V185] == 5 && !_G(flags)[V184])
- _conv2 = "conv56";
-
- if (_G(flags)[V184] && !_G(flags)[V153])
- _conv2 = "conv57";
-
- if (_G(flags)[V153] == 5)
- _conv2 = "conv58";
-
- return _conv2;
-}
-
void Room207::handleConv() {
int who = conv_whos_talking();
const char *sound = conv_sound_to_play();
diff --git a/engines/m4/burger/rooms/section2/room207.h b/engines/m4/burger/rooms/section2/room207.h
index 657216a43c3..75df01263f6 100644
--- a/engines/m4/burger/rooms/section2/room207.h
+++ b/engines/m4/burger/rooms/section2/room207.h
@@ -45,13 +45,11 @@ private:
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
const char *_conv1 = nullptr;
- const char *_conv2 = nullptr;
Series _series1;
machine *_general1 = nullptr;
int _val1 = 0;
int _val2 = 0;
- const char *getConvName();
void handleConv();
int getVal() const;
int getShould() const;
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 5f751d3379b..0cd47087f30 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -321,14 +321,14 @@ void Room503::init() {
_flag1 = false;
hotspot_set_active("BORK", false);
- if (_G(flags)[gBORK_STATE] == 13) {
+ if (_G(flags)[kBORK_STATE] == 13) {
_val6 = 28;
kernel_trigger_dispatch_now(14);
kernel_trigger_dispatch_now(15);
- } else if (inv_player_has("ROLLING PIN") && _G(flags)[gBORK_STATE] != 16) {
+ } else if (inv_player_has("ROLLING PIN") && _G(flags)[kBORK_STATE] != 16) {
_val6 = 27;
kernel_trigger_dispatch_now(14);
- } else if (_G(flags)[gBORK_STATE] != 16) {
+ } else if (_G(flags)[kBORK_STATE] != 16) {
loadSeries1();
_flag1 = true;
_walk1 = intr_add_no_walk_rect(272, 250, 414, 300, 260, 300);
@@ -350,9 +350,9 @@ void Room503::init() {
}
_flag2 = false;
- if (_G(flags)[gBORK_STATE] == 16) {
+ if (_G(flags)[kBORK_STATE] == 16) {
_val9 = 34;
- } else if (_G(flags)[gBORK_STATE] != 13) {
+ } else if (_G(flags)[kBORK_STATE] != 13) {
_val9 = 33;
}
@@ -475,7 +475,7 @@ void Room503::daemon() {
case 14:
switch (_val6) {
case 13:
- _G(flags)[gBORK_STATE] = 0;
+ _G(flags)[kBORK_STATE] = 0;
_val8 = 1;
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 340, 250, true);
@@ -485,7 +485,7 @@ void Room503::daemon() {
case 14:
_val8 = 2;
- _G(flags)[gBORK_STATE] = 1;
+ _G(flags)[kBORK_STATE] = 1;
_val6 = 15;
series_play_with_breaks(PLAY2, "503bk02", 0x900, 14, 3, 8);
break;
@@ -512,7 +512,7 @@ void Room503::daemon() {
case 16:
_val6 = 15;
series_play_with_breaks(PLAY3, "503bk17", 0x900, 14, 3, 8);
- _G(flags)[gBORK_STATE] = 1;
+ _G(flags)[kBORK_STATE] = 1;
break;
case 17:
@@ -521,7 +521,7 @@ void Room503::daemon() {
kernel_trigger_dispatch_now(24);
_val7 = 32;
- switch (_G(flags)[gBORK_STATE]) {
+ switch (_G(flags)[kBORK_STATE]) {
case 0:
_val6 = 14;
break;
@@ -534,21 +534,21 @@ void Room503::daemon() {
_val6 = 13;
break;
default:
- term_message("bork state should not be %d in SNARL_AT_WILBUR!", _G(flags)[gBORK_STATE]);
+ term_message("bork state should not be %d in SNARL_AT_WILBUR!", _G(flags)[kBORK_STATE]);
break;
}
_array2[0] = 14;
_array2[1] = 24;
_array2[2] = 3;
- _G(flags)[gBORK_STATE] = 2;
+ _G(flags)[kBORK_STATE] = 2;
_state1 = imath_ranged_rand(1, 3);
_val4 = 10;
series_play_with_breaks(PLAY4, "503bk05", 0x900, 1, 3, 8);
break;
case 18:
- _G(flags)[gBORK_STATE] = 3;
+ _G(flags)[kBORK_STATE] = 3;
_val10 = imath_ranged_rand(0, 1);
_val6 = _val10 ? 21 : 19;
_state1 = imath_ranged_rand(1, 2);
@@ -564,11 +564,11 @@ void Room503::daemon() {
_state4 = imath_ranged_rand(1, 2);
if (_G(flags)[V205]) {
- _G(flags)[gBORK_STATE] = 4;
+ _G(flags)[kBORK_STATE] = 4;
_val6 = 13;
series_play_with_breaks(PLAY6, "503bk07", 0x900, 14, 3, 8);
} else {
- _G(flags)[gBORK_STATE] = 5;
+ _G(flags)[kBORK_STATE] = 5;
_G(flags)[V205] = 1;
_val6 = 20;
series_play_with_breaks(PLAY7, "503bk07", 0x900, 14, 3, 8);
@@ -579,7 +579,7 @@ void Room503::daemon() {
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 430, 209, true);
hotspot_set_active_xy("BORK", 445, 200, true);
- _G(flags)[gBORK_STATE] = 6;
+ _G(flags)[kBORK_STATE] = 6;
_G(flags)[V207] = 1;
_val6 = 13;
_array1[0] = 14;
@@ -594,21 +594,21 @@ void Room503::daemon() {
case 21:
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 415, 155, true);
- _G(flags)[gBORK_STATE] = 7;
+ _G(flags)[kBORK_STATE] = 7;
_state1 = imath_ranged_rand(1, 3);
_val6 = 22;
series_play_with_breaks(PLAY11, "503bk09", 0x900, 14, 3, 6, 100, 0, -2);
break;
case 22:
- _G(flags)[gBORK_STATE] = 8;
+ _G(flags)[kBORK_STATE] = 8;
_state1 = imath_ranged_rand(1, 5);
_val6 = 25;
series_play_with_breaks(PLAY12, "503bk10", 0x900, 14, 2, 6, 100, 0, -2);
break;
case 23:
- _G(flags)[gBORK_STATE] = 9;
+ _G(flags)[kBORK_STATE] = 9;
_G(flags)[V204] = 5002;
_val6 = 24;
series_play_with_breaks(PLAY15, "503bk11", 0x900, 14, 3, 6, 100, 0, -2);
@@ -620,7 +620,7 @@ void Room503::daemon() {
if (_state5) {
kernel_trigger_dispatch_now(18);
} else {
- _G(flags)[gBORK_STATE] = 10;
+ _G(flags)[kBORK_STATE] = 10;
_val6 = 13;
series_play_with_breaks(PLAY16, "503bk12", 0x900, 14, 3, 8, 100, 0, -2);
}
@@ -629,20 +629,20 @@ void Room503::daemon() {
case 25:
hotspot_set_active("BORK", false);
hotspot_set_active_xy("BORK", 397, 197, true);
- _G(flags)[gBORK_STATE] = 11;
+ _G(flags)[kBORK_STATE] = 11;
_val6 = 26;
series_play_with_breaks(PLAY13, "503bk13", 0x900, 14, 3, 6, 100, 0, -2);
break;
case 26:
- _G(flags)[gBORK_STATE] = 12;
+ _G(flags)[kBORK_STATE] = 12;
digi_play("503_003", 2);
_val6 = 27;
_series2.play("503bk13", 0x900, 1, 14, 6, 6, 100, 0, -2, 15, 17);
break;
case 27:
- _G(flags)[gBORK_STATE] = 14;
+ _G(flags)[kBORK_STATE] = 14;
_val6 = 23;
series_play_with_breaks(PLAY14, "503bk13", 0x900, 14, 1, 6, 100, 0, -2);
hotspot_set_active("BORK", false);
@@ -656,14 +656,14 @@ void Room503::daemon() {
break;
case 29:
- _G(flags)[gBORK_STATE] = 15;
+ _G(flags)[kBORK_STATE] = 15;
_state1 = imath_ranged_rand(1, 3);
series_play_with_breaks(PLAY19, "503bk14", 0x900, 18, 3, 6, 100, 0, -2);
break;
case 30:
terminateMachineAndNull(_series3);
- _G(flags)[gBORK_STATE] = 16;
+ _G(flags)[kBORK_STATE] = 16;
_state1 = imath_ranged_rand(1, 4);
_val4 = 12;
_G(wilbur_should) = 1;
@@ -773,7 +773,7 @@ void Room503::daemon() {
break;
case 2:
- switch (_G(flags)[gBORK_STATE]) {
+ switch (_G(flags)[kBORK_STATE]) {
case 0:
case 1:
case 4:
@@ -810,7 +810,7 @@ void Room503::daemon() {
_array1[2] = 15;
_state1 = imath_ranged_rand(1, 5);
series_play_with_breaks(PLAY21, "503wi02", 0x800, 2, 3);
- _G(flags)[gBORK_STATE] = 13;
+ _G(flags)[kBORK_STATE] = 13;
break;
case 5:
@@ -859,19 +859,19 @@ void Room503::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if ((player_said("GEAR", "MICROWAVE") || player_said("TAKE", "MICROWAVE")) &&
- !_flag2 && _G(flags)[gBORK_STATE] != 13 && _G(flags)[gBORK_STATE] != 16) {
+ !_flag2 && _G(flags)[kBORK_STATE] != 13 && _G(flags)[kBORK_STATE] != 16) {
_flag2 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") && !_flag3 &&
- _G(flags)[gBORK_STATE] == 13 && _G(flags)[gBORK_STATE] != 16) {
+ _G(flags)[kBORK_STATE] == 13 && _G(flags)[kBORK_STATE] != 16) {
_flag3 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK", "ROLLING PIN") &&
- (_G(flags)[gBORK_STATE] == 12 || _G(flags)[gBORK_STATE] == 11)) {
+ (_G(flags)[kBORK_STATE] == 12 || _G(flags)[kBORK_STATE] == 11)) {
_flag1 = false;
intr_remove_no_walk_rect(_walk1);
_val6 = 26;
@@ -904,10 +904,10 @@ void Room503::pre_parser() {
void Room503::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- bool borkFlag = player_said("BORK") && _G(flags)[gBORK_STATE] == 12;
+ bool borkFlag = player_said("BORK") && _G(flags)[kBORK_STATE] == 12;
bool microwaveFlag = player_said("MICROWAVE");
- bool ovenFlag = player_said("OVEN") && _G(flags)[gBORK_STATE] == 16;
- bool prunesFlag = player_said("PRUNES") && _G(flags)[gBORK_STATE] == 16;
+ bool ovenFlag = player_said("OVEN") && _G(flags)[kBORK_STATE] == 16;
+ bool prunesFlag = player_said("PRUNES") && _G(flags)[kBORK_STATE] == 16;
if (borkFlag && player_said("LOOK AT")) {
wilbur_speech("503w005");
@@ -919,20 +919,20 @@ void Room503::parser() {
wilbur_speech("500w034");
} else if (player_said("SOAPY WATER", "SINK")) {
wilbur_speech("500w049");
- } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[gBORK_STATE] == 16) {
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[kBORK_STATE] == 16) {
wilbur_speech("503w011");
- } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[gBORK_STATE] == 13) {
+ } else if (microwaveFlag && player_said("LOOK AT") && _G(flags)[kBORK_STATE] == 13) {
wilbur_speech("503w010");
- } else if (microwaveFlag && player_said("TAKE") && _G(flags)[gBORK_STATE] == 16) {
+ } else if (microwaveFlag && player_said("TAKE") && _G(flags)[kBORK_STATE] == 16) {
wilbur_speech("503w013");
} else if (microwaveFlag && player_said("TAKE") && _flag2) {
wilbur_speech("503w013");
- } else if (microwaveFlag && player_said("GEAR") && _G(flags)[gBORK_STATE] == 16) {
+ } else if (microwaveFlag && player_said("GEAR") && _G(flags)[kBORK_STATE] == 16) {
wilbur_speech("503w013");
- } else if (microwaveFlag && player_said("GEAR") && _flag2 && _G(flags)[gBORK_STATE] != 13) {
+ } else if (microwaveFlag && player_said("GEAR") && _flag2 && _G(flags)[kBORK_STATE] != 13) {
wilbur_speech("503w012");
} else if (player_said("RUBBER GLOVES ") && player_said("TAKE") &&
- _G(flags)[gBORK_STATE] != 16 && _G(flags)[gBORK_STATE] != 13 && _flag3) {
+ _G(flags)[kBORK_STATE] != 16 && _G(flags)[kBORK_STATE] != 13 && _flag3) {
wilbur_speech("503w012");
} else if (player_said("RUBBER GLOVES ") && player_said("GEAR")) {
wilbur_speech("503w015");
@@ -940,8 +940,8 @@ void Room503::parser() {
wilbur_speech("503w021");
} else if (ovenFlag && player_said("GEAR")) {
wilbur_speech("503w023");
- } else if (player_said("GEAR", "OVEN") && _G(flags)[gBORK_STATE] == 16 &&
- _G(flags)[gBORK_STATE] != 13) {
+ } else if (player_said("GEAR", "OVEN") && _G(flags)[kBORK_STATE] == 16 &&
+ _G(flags)[kBORK_STATE] != 13) {
wilbur_speech("503w022");
} else if (player_said("LOOK AT", "CUPBOARD ") && inv_player_has("RUBBER GLOVES")) {
wilbur_speech("503w027");
@@ -957,20 +957,20 @@ void Room503::parser() {
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") &&
- (_G(flags)[gBORK_STATE] == 16 || _G(flags)[gBORK_STATE] == 13)) {
+ (_G(flags)[kBORK_STATE] == 16 || _G(flags)[kBORK_STATE] == 13)) {
_G(wilbur_should) = 7;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK") && player_said("LOOK AT") &&
- (_G(flags)[gBORK_STATE] == 0 || _G(flags)[gBORK_STATE] == 1) &&
+ (_G(flags)[kBORK_STATE] == 0 || _G(flags)[kBORK_STATE] == 1) &&
!player_said_any("GIZMO", "ROLLING PIN", "SOCK", "SOAPY WATER", "RUBBER_GLOVES") &&
!player_said("LAXATIVE")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
- } else if (player_said("GEAR", "MICROWAVE") && _G(flags)[gBORK_STATE] == 13) {
+ } else if (player_said("GEAR", "MICROWAVE") && _G(flags)[kBORK_STATE] == 13) {
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
- } else if (player_said("GEAR", "OVEN") && (_G(flags)[gBORK_STATE] == 16 || _G(flags)[gBORK_STATE] == 13)) {
+ } else if (player_said("GEAR", "OVEN") && (_G(flags)[kBORK_STATE] == 16 || _G(flags)[kBORK_STATE] == 13)) {
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR")) {
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index 549bb978ca5..8cfc01e2584 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -134,7 +134,7 @@ void Room510::parser() {
if (player_said("RED BUTTON")) {
if (!player_been_here(503)) {
wilbur_speech("510w003");
- } else if (_G(flags)[gBORK_STATE] != 16) {
+ } else if (_G(flags)[kBORK_STATE] != 16) {
wilbur_speech("510w004");
} else {
wilbur_speech("510w005");
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index c6457931cc1..b9388818dc8 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -146,7 +146,7 @@ void Room801::init() {
kernel_trigger_dispatch_now(20);
} else {
- switch (_G(flags)[NEURO_TEST_COUNTER]) {
+ switch (_G(flags)[kNEURO_TEST_COUNTER]) {
case 0:
term_message(HEADER);
term_message("FIRST ATTEMPT AT NEURO TEST");
@@ -216,7 +216,7 @@ void Room801::daemon() {
case 6:
compact_mem_and_report();
- if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ if (_G(flags)[kNEURO_TEST_COUNTER] == 0) {
release_trigger_on_digi_state(7, 3);
} else {
release_trigger_on_digi_state(10, 3);
@@ -239,7 +239,7 @@ void Room801::daemon() {
pal_cycle_stop();
compact_mem_and_report();
- if (_G(flags)[NEURO_TEST_COUNTER] == 2) {
+ if (_G(flags)[kNEURO_TEST_COUNTER] == 2) {
release_trigger_on_digi_state(20, 1);
} else {
release_trigger_on_digi_state(10, 1);
@@ -261,7 +261,7 @@ void Room801::daemon() {
digi_unload_stream_breaks(SERIES8);
compact_mem_and_report();
- if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ if (_G(flags)[kNEURO_TEST_COUNTER] == 0) {
kernel_trigger_dispatch_now(13);
} else {
_G(wilbur_should) = getWilburShould();
@@ -424,7 +424,7 @@ void Room801::daemon() {
case 23:
if (_G(flags)[GLB_TEMP_5] == 1) {
kernel_trigger_dispatch_now(24);
- } else if (_G(flags)[NEURO_TEST_COUNTER] <= 2) {
+ } else if (_G(flags)[kNEURO_TEST_COUNTER] <= 2) {
digi_unload("804_003");
digi_unload("807_002");
adv_kill_digi_between_rooms(false);
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index 1e21eb3ca02..a2b223b1f38 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -137,7 +137,7 @@ void Room802::init() {
_flag1 = false;
_flag2 = false;
- if (_G(flags)[NEURO_TEST_COUNTER] > 1) {
+ if (_G(flags)[kNEURO_TEST_COUNTER] > 1) {
kernel_trigger_dispatch_now(24);
digi_preload_stream_breaks(SERIES1);
kernel_trigger_dispatch_now(14);
@@ -172,7 +172,7 @@ void Room802::daemon() {
break;
case 3:
- switch (_G(flags)[NEURO_TEST_COUNTER]) {
+ switch (_G(flags)[kNEURO_TEST_COUNTER]) {
case 0:
release_trigger_on_digi_state(4, 1);
break;
@@ -225,7 +225,7 @@ void Room802::daemon() {
digi_preload("802_019");
digi_play_loop("802_019", 3, 128);
- if (_G(flags)[NEURO_TEST_COUNTER] == 0) {
+ if (_G(flags)[kNEURO_TEST_COUNTER] == 0) {
player_set_commands_allowed(true);
digi_unload_stream_breaks(SERIES3);
Commit: aaeff9505e8c5d05cb5fa1f635475c6e83eab630
https://github.com/scummvm/scummvm/commit/aaeff9505e8c5d05cb5fa1f635475c6e83eab630
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added Section3Room base class
Changed paths:
A engines/m4/burger/rooms/section3/section3_room.cpp
A engines/m4/burger/rooms/section3/section3_room.h
engines/m4/burger/rooms/section2/room204.cpp
engines/m4/burger/rooms/section3/room301.cpp
engines/m4/burger/rooms/section3/room301.h
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room302.h
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room303.h
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room304.h
engines/m4/burger/rooms/section3/room305.h
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/burger/rooms/section3/room319.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section2/room204.cpp b/engines/m4/burger/rooms/section2/room204.cpp
index 15ffc1f6ec8..7a9ae5d253c 100644
--- a/engines/m4/burger/rooms/section2/room204.cpp
+++ b/engines/m4/burger/rooms/section2/room204.cpp
@@ -110,7 +110,6 @@ void Room204::daemon() {
disable_player_commands_and_fade_init(2002);
break;
-
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index fa08acd08ed..d02da59f7a9 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -106,8 +106,12 @@ const seriesStreamBreak Room301::SERIES4[] = {
STREAM_BREAK_END
};
+void Room301::preload() {
+ _G(player).walker_in_this_scene = false;
+}
void Room301::init() {
+
}
void Room301::daemon() {
diff --git a/engines/m4/burger/rooms/section3/room301.h b/engines/m4/burger/rooms/section3/room301.h
index fb20b95b83a..742d316b76a 100644
--- a/engines/m4/burger/rooms/section3/room301.h
+++ b/engines/m4/burger/rooms/section3/room301.h
@@ -39,6 +39,7 @@ public:
Room301() : Room() {}
~Room301() override {}
+ void preload() override;
void init() override;
void daemon() override;
};
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index d7275bbe35d..18cfdd0c49e 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -163,7 +163,7 @@ const seriesPlayBreak Room302::PLAY13[] = {
long Room302::_state1;
-Room302::Room302() : Room() {
+Room302::Room302() : Section3Room() {
_state1 = 0;
}
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
index d16297b049b..94c1b890a26 100644
--- a/engines/m4/burger/rooms/section3/room302.h
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM302_H
#define M4_BURGER_ROOMS_SECTION3_ROOM302_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room302 : public Room {
+class Room302 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -49,6 +49,11 @@ private:
static const seriesPlayBreak PLAY13[];
static long _state1;
+protected:
+ const char *getDigi() override {
+ return "300_005";
+ }
+
public:
Room302();
~Room302() override {}
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 958df344d89..fbc9c447c1c 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -112,6 +112,16 @@ const seriesPlayBreak Room303::PLAY10[] = {
PLAY_BREAK_END
};
+const char *Room303::getDigi() {
+ if (_G(flags)[V118] == 3002) {
+ _digiVolume = 125;
+ return "303_005";
+ } else if (_G(flags)[V117]) {
+ return "303_006";
+ } else {
+ return "300_005";
+ }
+}
void Room303::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
index 49d3677e13a..a91ca9b1f0e 100644
--- a/engines/m4/burger/rooms/section3/room303.h
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM303_H
#define M4_BURGER_ROOMS_SECTION3_ROOM303_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room303 : public Room {
+class Room303 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -43,8 +43,11 @@ private:
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
+protected:
+ const char *getDigi() override;
+
public:
- Room303() : Room() {}
+ Room303() : Section3Room() {}
~Room303() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index 6499016bca6..0667464bcab 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -87,6 +87,9 @@ const seriesPlayBreak Room304::PLAY5[] = {
PLAY_BREAK_END
};
+const char *Room304::getDigi() {
+ return _G(flags)[130] ? "304_003" : "300_005";
+}
void Room304::init() {
}
diff --git a/engines/m4/burger/rooms/section3/room304.h b/engines/m4/burger/rooms/section3/room304.h
index 60626f60080..e85d04e2383 100644
--- a/engines/m4/burger/rooms/section3/room304.h
+++ b/engines/m4/burger/rooms/section3/room304.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM304_H
#define M4_BURGER_ROOMS_SECTION3_ROOM304_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room304 : public Room {
+class Room304 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
@@ -37,8 +37,11 @@ private:
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
+protected:
+ const char *getDigi() override;
+
public:
- Room304() : Room() {}
+ Room304() : Section3Room() {}
~Room304() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
index 65fcde61c69..827ffba4fe6 100644
--- a/engines/m4/burger/rooms/section3/room305.h
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -22,21 +22,26 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM305_H
#define M4_BURGER_ROOMS_SECTION3_ROOM305_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room305 : public Room {
+class Room305 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
+protected:
+ const char *getDigi() override {
+ return "305_007";
+ }
+
public:
- Room305() : Room() {}
+ Room305() : Section3Room() {}
~Room305() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 65cda948a1d..6a12f539c2f 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -77,7 +77,7 @@ const seriesPlayBreak Room310::PLAY6[] = {
long Room310::_state1;
-Room310::Room310() : Room() {
+Room310::Room310() : Section3Room() {
_state1 = 0;
}
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index b766fac0056..7c44acde634 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM310_H
#define M4_BURGER_ROOMS_SECTION3_ROOM310_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room310 : public Room {
+class Room310 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
@@ -39,6 +39,11 @@ private:
static const seriesPlayBreak PLAY6[];
static long _state1;
+protected:
+ const char *getDigi() override {
+ return "310_001";
+ }
+
public:
Room310();
~Room310() override {}
diff --git a/engines/m4/burger/rooms/section3/room319.h b/engines/m4/burger/rooms/section3/room319.h
index e9fabcce197..88e1fbf005b 100644
--- a/engines/m4/burger/rooms/section3/room319.h
+++ b/engines/m4/burger/rooms/section3/room319.h
@@ -22,15 +22,20 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM319_H
#define M4_BURGER_ROOMS_SECTION3_ROOM319_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room319 : public Room {
+class Room319 : public Section3Room {
+protected:
+ const char *getDigi() override {
+ return "300_004";
+ }
+
public:
- Room319() : Room() {}
+ Room319() : Section3Room() {}
~Room319() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/section3_room.cpp b/engines/m4/burger/rooms/section3/section3_room.cpp
new file mode 100644
index 00000000000..26d5548585a
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/section3_room.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/section3_room.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Section3Room::preload() {
+ Rooms::Room::preload();
+ _digiName = nullptr;
+}
+
+void Section3Room::setup() {
+ if (_digiName) {
+ digi_stop(3);
+ digi_unload(_digiName);
+ }
+
+ _digiVolume = 75;
+ _digiName = getDigi();
+
+ if (_digiName) {
+ digi_preload(_digiName);
+ digi_play_loop(_digiName, 3, _digiVolume);
+ }
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/section3_room.h b/engines/m4/burger/rooms/section3/section3_room.h
new file mode 100644
index 00000000000..8bd8e12349b
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/section3_room.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_ROOM_H
+#define M4_BURGER_ROOMS_SECTION3_ROOM_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section3Room : public Rooms::Room {
+private:
+ const char *_digiName = nullptr;
+
+protected:
+ int _digiVolume = 0;
+
+ virtual const char *getDigi() = 0;
+
+public:
+ Section3Room() {}
+ virtual ~Section3Room() {}
+
+ void preload() override;
+ void setup();
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index fca3ed6da20..446765b068f 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -115,6 +115,7 @@ MODULE_OBJS = \
burger/rooms/section2/room204.o \
burger/rooms/section2/room207.o \
burger/rooms/section3/section3.o \
+ burger/rooms/section3/section3_room.o \
burger/rooms/section3/room301.o \
burger/rooms/section3/room302.o \
burger/rooms/section3/room303.o \
Commit: 8548e85c03718aed971c565e5d9f74063c06fd44
https://github.com/scummvm/scummvm/commit/8548e85c03718aed971c565e5d9f74063c06fd44
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 301
Changed paths:
engines/m4/burger/rooms/section3/room301.cpp
engines/m4/burger/rooms/section3/room301.h
engines/m4/burger/rooms/section3/section3_room.h
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index d02da59f7a9..542031333fe 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -111,10 +111,151 @@ void Room301::preload() {
}
void Room301::init() {
-
+ setup();
+ _G(flags).reset3();
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+
+ if (_G(executing) != WHOLE_GAME) {
+ inv_give_to_player("JUG");
+ inv_give_to_player("CARROT JUICE");
+ inv_give_to_player("WHISTLE");
+ }
+
+ _G(kernel).suppress_fadeup = true;
+ kernel_trigger_dispatch_now(1);
}
void Room301::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_set_start(0);
+ series_stream_with_breaks(SERIES1, "301lab01", 6, 1, 2);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ break;
+
+ case 2:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 4);
+ break;
+
+ case 4:
+ pal_fade_set_start(0);
+ series_stream_with_breaks(SERIES3, "301orb01", 6, 1, 5);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ break;
+
+ case 5:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 8);
+ break;
+
+ case 6:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 7);
+ break;
+
+ case 7:
+ digi_unload_stream_breaks(SERIES1);
+ pal_fade_set_start(0);
+ series_stream_with_breaks(SERIES2, "301lab02", 6, 1, 9);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ break;
+
+ case 8:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 9);
+ break;
+
+ case 9:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 10);
+ break;
+
+ case 10:
+ pal_fade_set_start(0);
+ digi_unload_stream_breaks(SERIES3);
+ series_stream_with_breaks(SERIES4, "301orb02", 6, 1, 11);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ break;
+
+ case 11:
+ pal_fade_set_start(0);
+ pal_cycle_stop();
+ kernel_timing_trigger(6, 12);
+ digi_unload_stream_breaks(SERIES2);
+ break;
+
+ case 12:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 3001);
+ break;
+
+ case 13:
+ gr_pal_set_range(120, 8);
+ pal_cycle_init(118, 127, 6, -1, -1);
+ break;
+
+ case 14:
+ break;
+
+ case 15:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, -1);
+ break;
+
+ case 16:
+ pal_fade_set_start(0);
+ digi_unload_stream_breaks(SERIES3);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 13);
+ break;
+
+ case 17:
+ pal_fade_set_start(0);
+ pal_mirror_colours(120, 122);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 14);
+ break;
+
+ case 18:
+ pal_fade_set_start(0);
+ pal_mirror_colours(32, 39);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 19);
+ break;
+
+ case 19:
+ gr_pal_set_range(32, 16);
+ pal_cycle_init(32, 47, 6, -1);
+ break;
+
+ case 20:
+ pal_cycle_stop();
+ break;
+
+ case 3001:
+ _G(kernel).suppress_fadeup = false;
+ digi_unload_stream_breaks(SERIES1);
+ digi_unload_stream_breaks(SERIES1);
+ digi_unload_stream_breaks(SERIES3);
+ digi_unload_stream_breaks(SERIES4);
+ digi_preload("301_016");
+ digi_play("301_016", 1, 255);
+ adv_kill_digi_between_rooms(false);
+ _G(game).setRoom(302);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room301.h b/engines/m4/burger/rooms/section3/room301.h
index 742d316b76a..683d52643be 100644
--- a/engines/m4/burger/rooms/section3/room301.h
+++ b/engines/m4/burger/rooms/section3/room301.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM301_H
#define M4_BURGER_ROOMS_SECTION3_ROOM301_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room301 : public Room {
+class Room301 : public Section3Room {
private:
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
@@ -36,7 +36,7 @@ private:
static const seriesStreamBreak SERIES4[];
public:
- Room301() : Room() {}
+ Room301() : Section3Room() {}
~Room301() override {}
void preload() override;
diff --git a/engines/m4/burger/rooms/section3/section3_room.h b/engines/m4/burger/rooms/section3/section3_room.h
index 8bd8e12349b..7e4daf9dc37 100644
--- a/engines/m4/burger/rooms/section3/section3_room.h
+++ b/engines/m4/burger/rooms/section3/section3_room.h
@@ -35,7 +35,9 @@ private:
protected:
int _digiVolume = 0;
- virtual const char *getDigi() = 0;
+ virtual const char *getDigi() {
+ return nullptr;
+ }
public:
Section3Room() {}
Commit: dac18f609947257226fe7d121af24387066d82a8
https://github.com/scummvm/scummvm/commit/dac18f609947257226fe7d121af24387066d82a8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 302 methods
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section3/room301.cpp
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room302.h
engines/m4/burger/rooms/section3/section3_room.cpp
engines/m4/burger/rooms/section3/section3_room.h
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 90732c67fea..bfe759fa24e 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -146,7 +146,7 @@ enum {
V110 = 110,
V111 = 111,
V112 = 112,
- ROOM101_FLAG12 = 113,
+ V113 = 113,
V114 = 114,
V115 = 115,
V116 = 116,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 1e199b491a4..0cf93d6add7 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -275,13 +275,13 @@ void Room101::daemon() {
} else if (!_G(flags)[V099]) {
if (_G(flags)[V100] <= 1) {
_G(walker).wilbur_speech("101w530", 7);
- } else if (!_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG13]) {
+ } else if (!_G(flags)[V113] && !_G(flags)[ROOM101_FLAG13]) {
_G(walker).wilbur_speech("101w531", 7);
_G(flags)[ROOM101_FLAG13] = 1;
- } else if (_G(flags)[ROOM101_FLAG12] && !_G(flags)[ROOM101_FLAG14]) {
+ } else if (_G(flags)[V113] && !_G(flags)[ROOM101_FLAG14]) {
_G(walker).wilbur_speech("101w533", 7);
_G(flags)[ROOM101_FLAG14] = 1;
- } else if (_G(flags)[ROOM101_FLAG12] && _G(flags)[V100] >= 5 &&
+ } else if (_G(flags)[V113] && _G(flags)[V100] >= 5 &&
!_G(flags)[ROOM101_FLAG15]) {
_G(walker).wilbur_speech("101w534", 7);
_G(flags)[ROOM101_FLAG15] = 1;
@@ -780,7 +780,7 @@ void Room101::daemon15() {
_G(flags)[V091] = 0;
}
- if (_G(flags)[ROOM101_FLAG12] || _G(flags)[V099]) {
+ if (_G(flags)[V113] || _G(flags)[V099]) {
_G(flags).set_boonsville_time(6001);
_G(flags)[V000] = 1002;
_G(flags)[V001] = 0;
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index 542031333fe..ef482725bf3 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -111,7 +111,7 @@ void Room301::preload() {
}
void Room301::init() {
- setup();
+ setupDigi();
_G(flags).reset3();
digi_preload_stream_breaks(SERIES1);
digi_preload_stream_breaks(SERIES2);
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index 18cfdd0c49e..cedd8875c82 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -168,11 +168,170 @@ Room302::Room302() : Section3Room() {
}
void Room302::init() {
+ setupDigi();
+
+ if (!_G(flags)[V111]) {
+ static const char *NAMES[12] = {
+ "302t001a", "302t001b", "302t001c", "302t001d", "302t001e",
+ "302t001f", "302t001g", "302t001h", "302t002", "302t003",
+ "302t004", "302t005"
+ };
+ for (int i = 0; i < 12; ++i)
+ digi_preload(NAMES[i], 302);
+ }
+
+ player_set_commands_allowed(false);
+ pal_cycle_init(112, 127, 6, -1, -1);
+
+ if (_G(flags)[V111]) {
+ hotspot_set_active("TRUFFLES", false);
+ } else if (_G(flags)[V112]) {
+ series_load("302tr01");
+ series_load("302tr01s");
+ series_load("302tr02");
+ series_load("302tr02s");
+ series_load("302tr03");
+ series_load("302tr03s");
+ _val1 = 24;
+ kernel_trigger_dispatch_now(9);
+ } else {
+ _val1 = 21;
+ kernel_trigger_dispatch_now(9);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 303:
+ _G(wilbur_should) = _G(flags)[V125] ? 6 : 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 304:
+ _G(wilbur_should) = 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 305:
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ ws_demand_location(341, 287, 9);
+ ws_hide_walker();
+ _state1 = imath_ranged_rand(0, 2);
+
+ if (_G(flags)[V112]) {
+ _G(flags)[V113] = 1;
+ _val3 = 125;
+ _val4 = 29;
+ } else {
+ _val4 = 30;
+ }
+
+ kernel_trigger_dispatch_now(10);
+ _G(flags)[V107] = 1;
+ break;
+ }
+
+ if (_G(flags)[V107]) {
+ hotspot_set_active("BURGER MORSEL ", false);
+ } else {
+ _series1 = series_show("302BURG", 0x200);
+ hotspot_set_active("BURGER MORSEL ", true);
+ }
}
void Room302::daemon() {
}
+void Room302::pre_parser() {
+ if (player_said_any("BACKYARD", "BACKYARD ") && player_said_any("LOOK AT", "GEAR", "ENTER"))
+ player_set_facing_hotspot();
+}
+
+void Room302::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("LOOK AT", "BURGER MORSEL ")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 13;
+ wilbur_speech("302w009y", gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("LOOK AT", "DOOR")) {
+ wilbur_speech(player_been_here(304) ? "302w006" : "302w005");
+ } else if (player_said("DISTILLED CARROT JUICE", "CRASHED ROCKET")) {
+ wilbur_speech("300w032");
+ } else if (player_said("CARROT JUICE", "CRASHED ROCKET")) {
+ wilbur_speech("300w045");
+ } else if (player_said("MATCHES", "CRASHED ROCKET")) {
+ wilbur_speech("300w018");
+ } else if (player_said("TAKE", "BURGER MORSEL ")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 10;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("ENTER", "DOOR") || player_said("GEAR", "DOOR")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("MATCHES", "PROBE")) {
+ wilbur_speech("300w023");
+ } else if (player_said("BOTTLE", "TROUGH")) {
+ wilbur_speech("300w073");
+ } else if (player_said("LOOK AT", "STORM CELLAR")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 1;
+ wilbur_speech("302w007", gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said_any("GEAR", "ENTER") && player_said("STORM CELLAR")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 1;
+
+ if (_G(flags)[V133]) {
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ term_message("Wilbur: Here we go...!");
+ wilbur_speech("302w008", gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("CARROT JUICE", "TROUGH")) {
+ wilbur_speech("300w044");
+ } else if (player_said("BACKYARD") && player_said_any("LOOK AT", "GEAR", "ENTER")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3002);
+ _G(flags)[V125] = 0;
+ } else if (player_said("BACKYARD ") && player_said_any("LOOK AT", "GEAR", "ENTER")) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3002);
+ _G(flags)[V125] = 1;
+ } else if (player_said("TRUFFLES")) {
+ if (player_said("BURGER MORSEL")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 16;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("LOOK AT")) {
+ wilbur_speech(_G(flags)[V109] ? "302w012" : "302w011");
+ } else if (player_said("MATCHES")) {
+ wilbur_speech("300w016");
+ } else if (player_said("DISTILLED CARROT JUICE")) {
+ wilbur_speech("300w031");
+ } else if (player_said("CARROT JUICE")) {
+ wilbur_speech("300w044");
+ } else if (player_said("BOTTLE")) {
+ wilbur_speech("300w072");
+ } else {
+ _val1 = 25;
+ return;
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
index 94c1b890a26..91afd0fd8dc 100644
--- a/engines/m4/burger/rooms/section3/room302.h
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -48,6 +48,15 @@ private:
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
static long _state1;
+ machine *_series1 = nullptr;
+ Series _series2;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
protected:
const char *getDigi() override {
@@ -60,6 +69,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/section3_room.cpp b/engines/m4/burger/rooms/section3/section3_room.cpp
index 26d5548585a..6ef5f803fb9 100644
--- a/engines/m4/burger/rooms/section3/section3_room.cpp
+++ b/engines/m4/burger/rooms/section3/section3_room.cpp
@@ -31,7 +31,7 @@ void Section3Room::preload() {
_digiName = nullptr;
}
-void Section3Room::setup() {
+void Section3Room::setupDigi() {
if (_digiName) {
digi_stop(3);
digi_unload(_digiName);
diff --git a/engines/m4/burger/rooms/section3/section3_room.h b/engines/m4/burger/rooms/section3/section3_room.h
index 7e4daf9dc37..3e57c0087ba 100644
--- a/engines/m4/burger/rooms/section3/section3_room.h
+++ b/engines/m4/burger/rooms/section3/section3_room.h
@@ -44,7 +44,7 @@ public:
virtual ~Section3Room() {}
void preload() override;
- void setup();
+ void setupDigi();
};
} // namespace Rooms
Commit: 261f8003c94d720b9e8549578497e373deac2dfa
https://github.com/scummvm/scummvm/commit/261f8003c94d720b9e8549578497e373deac2dfa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finished room 302
Changed paths:
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room302.h
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index cedd8875c82..670fa451346 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -226,7 +226,7 @@ void Room302::init() {
if (_G(flags)[V112]) {
_G(flags)[V113] = 1;
- _val3 = 125;
+ _volume = 125;
_val4 = 29;
} else {
_val4 = 30;
@@ -246,6 +246,283 @@ void Room302::init() {
}
void Room302::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ wilbur_speech("302w009z");
+ break;
+
+ case 2:
+ ws_unhide_walker();
+ ws_walk(500, 250, nullptr, 3, 8, 1);
+ break;
+
+ case 3:
+ player_set_commands_allowed(true);
+ break;
+
+ case 4:
+ _volume -= 20;
+ if (_volume > 0) {
+ term_message("fading propellor, current volume = %d", _volume);
+ digi_change_volume(2, _volume);
+ kernel_timing_trigger(10, 4);
+ } else {
+ digi_stop(2);
+ }
+ break;
+
+ case 5:
+ terminateMachineAndNull(_series1);
+ inv_give_to_player("BURGER MORSEL");
+ hotspot_set_active("BURGER MORSEL ", false);
+ _G(flags)[V107] = 1;
+ break;
+
+ case 6:
+ inv_put_thing_in("BURGER MORSEL", NOWHERE);
+ break;
+
+ case 7:
+ if (!digi_play_state(2)) {
+ _val7 = imath_ranged_rand(0, 6);
+ digi_play(Common::String::format("302t001%c", 'a' + _val7).c_str(), 2, 55, -1, 302);
+ }
+ break;
+
+ case 8:
+ if (_val2 == 19) {
+ digi_unload_stream_breaks(SERIES3);
+ _series2.terminate();
+ pal_fade_set_start(0);
+ _series3 = series_stream_with_breaks(SERIES1, "302pe02", 6, 1, 3007);
+ pal_fade_init(0, 255, 100, 15, -1);
+ }
+ break;
+
+ case 9:
+ switch (_val1) {
+ case 20:
+ series_show("302tr02", 0x900, 0, 9, 30, 13);
+ series_show("302tr02s", 0x901, 0, -1, 30, 13);
+ _val1 = 22;
+ break;
+
+ case 21:
+ _series2.show("302tr02", 0x900);
+ _val1 = 22;
+ break;
+
+ case 22:
+ _val6 = imath_ranged_rand(0, 1);
+ _val1 = _val6 ? 24 : 23;
+ kernel_trigger_dispatch_now(9);
+ break;
+
+ case 23:
+ kernel_trigger_dispatch_now(7);
+ _val1 = 20;
+ series_play_with_breaks(PLAY10, "302tr02", 0x900, 9, 3);
+ break;
+
+ case 24:
+ kernel_trigger_dispatch_now(7);
+ _val1 = 20;
+ series_play_with_breaks(PLAY11, "302tr02", 0x900, 9, 3);
+ break;
+
+ case 25:
+ _val1 = 20;
+ series_play_with_breaks(PLAY12, "302tr03", 0x900, 9, 3);
+ break;
+
+ case 26:
+ _val1 = 20;
+ series_play_with_breaks(PLAY13, "302tr03", 0x900, 9, 3);
+ break;
+
+ case 27:
+ ws_hide_walker();
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _val1 = 28;
+ series_play_with_breaks(PLAY7, "302tr01", 0x700, 9, 3);
+ break;
+
+ case 28:
+ hotspot_set_active("truffles", false);
+ _G(flags)[V111] = 1;
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ series_play_with_breaks(PLAY8, "302tr01", 0x900, -1, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10:
+ switch (_val4) {
+ case 29:
+ digi_preload_stream_breaks(SERIES2);
+ _G(wilbur_should) = 9;
+ series_stream_with_breaks(SERIES2, "302pr01", 6, 1, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 30:
+ digi_preload_stream_breaks(SERIES3);
+ _val2 = 19;
+ series_stream_with_breaks(SERIES3, "302pr02", 6, 1, 8);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10008:
+ _val1 = 26;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY1, "302wi03", 0x500, 3004, 3);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 120, 3004);
+ break;
+
+ case 2:
+ ws_demand_location(427, 228, 4);
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY2, "302wi04", 0x500, 2, 3);
+ break;
+
+ case 3:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY3, "302wi01", 0x500, 3003, 3);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 120, 3003);
+ break;
+
+ case 4:
+ player_first_walk(233, 222, 7, 180, 270, 7, true);
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ break;
+
+ case 5:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+ player_first_walk(483, 210, 5, 490, 245, 7, true);
+ break;
+
+ case 6:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+ player_first_walk(184, 189, 8, 78, 225, 8, true);
+ break;
+
+ case 7:
+ _val1 = 27;
+ break;
+
+ case 8:
+ ws_unhide_walker();
+ _G(wilbur_should) = _G(flags)[V110] ? 10001 : 18;
+ ws_turn_to_face(3, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 9:
+ digi_unload_stream_breaks(SERIES2);
+ _G(wilbur_should) = 12;
+ hotspot_set_active("BURGER MORSEL ", true);
+ series_play_with_breaks(PLAY4, "302wi10", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 10:
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY6, "302wi06", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 11:
+ _G(wilbur_should) = 17;
+ series_play_with_breaks(PLAY9, "302wi07", 0x200, gCHANGE_WILBUR_ANIMATION, 3, 4);
+ break;
+
+ case 12:
+ _series1 = series_show("302BURG", 0x200);
+ _G(flags)[V107] = 0;
+ _G(wilbur_should) = 15;
+ series_play_with_breaks(PLAY5, "302wi09", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 13:
+ _G(wilbur_should) = 14;
+ kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 14:
+ player_set_commands_allowed(true);
+ wilbur_speech("302w009z");
+ break;
+
+ case 15:
+ ws_unhide_walker();
+ _G(wilbur_should) = 10001;
+
+ if (_G(flags)[V108]) {
+ _val5 = imath_ranged_rand(0, 9);
+ wilbur_speech(Common::String::format("302w004%c", 'a' + _val5).c_str(), gCHANGE_WILBUR_ANIMATION);
+ } else {
+ wilbur_speech("302w003", gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 16:
+ _G(wilbur_should) = 7;
+ player_set_commands_allowed(false);
+ wilbur_speech(_G(flags)[V110] ? "300w010" : "300w007", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 17:
+ ws_unhide_walker();
+ if (!_G(flags)[V110])
+ wilbur_speech("300w008");
+ break;
+
+ case 18:
+ _G(flags)[V110] = 1;
+ _G(wilbur_should) = 10001;
+ wilbur_speech("300w009");
+ break;
+
+ case 10013:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+
+ if (_G(flags)[V111]) {
+ _G(flags)[V002] = 1;
+ wilbur_speech("300w059");
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room302::pre_parser() {
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
index 91afd0fd8dc..1d431a598a1 100644
--- a/engines/m4/burger/rooms/section3/room302.h
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -50,9 +50,10 @@ private:
static long _state1;
machine *_series1 = nullptr;
Series _series2;
+ machine *_series3 = nullptr;
int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
+ int _volume = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
Commit: b4b84c43da292341b49d79f8772088cc4ca54275
https://github.com/scummvm/scummvm/commit/b4b84c43da292341b49d79f8772088cc4ca54275
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 303 methods
Changed paths:
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room303.h
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index fbc9c447c1c..653db976482 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -112,6 +112,10 @@ const seriesPlayBreak Room303::PLAY10[] = {
PLAY_BREAK_END
};
+Room303::Room303() : Section3Room() {
+ Common::fill(_triggers, _triggers + 5, -1);
+}
+
const char *Room303::getDigi() {
if (_G(flags)[V118] == 3002) {
_digiVolume = 125;
@@ -124,11 +128,198 @@ const char *Room303::getDigi() {
}
void Room303::init() {
+ setupDigi();
+ pal_cycle_init(112, 127, 0, -1, -1);
+
+ _val1 = _val2 = 0;
+ _series1 = nullptr;
+ series_load("303ft");
+ series_load("303burnr");
+ series_load("303stil");
+ series_load("303stilb");
+ Common::fill(_triggers, _triggers + 5, -1);
+
+ if (_G(flags)[V117]) {
+ _series2 = series_load("303ft_on");
+ _series3 = series_play("303ft_on", 0xd00);
+ _val3 = 2;
+ } else {
+ _series2 = series_load("303ft");
+ _series3 = series_show("303ft", 0xd00);
+ _val3 = 4;
+ }
+
+ if (_G(flags)[V118] == 3002) {
+ _series4 = series_load("303burn");
+ _series5 = series_play("303burn", 0xd14, 0, -1, 0, -1);
+ _val4 = 7;
+ } else {
+ _series4 = series_load("303burnr");
+ _series5 = series_show("303burnr", 0xd14);
+ _val4 = 9;
+ }
+
+ _series6 = series_load("303stil");
+ _series7 = series_show("303stil", 0xd10);
+ series_show("303stilb", 0xd15);
+
+ _val5 = 0;
+ kernel_trigger_dispatch_now(11);
+
+ switch (_G(flags)[V121]) {
+ case 3001:
+ _val6 = _G(flags)[V122] ? 32 : 30;
+ kernel_trigger_dispatch_now(10);
+ break;
+
+ case 3002:
+ _val6 = _G(flags)[V122] ? 33 : 31;
+ kernel_trigger_dispatch_now(10);
+ break;
+
+ default:
+ break;
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ if (_G(flags)[V117])
+ _timer = timer_read_60();
+ break;
+
+ case 302:
+ if (_G(flags)[V125]) {
+ ws_demand_location(51, 276, 3);
+ kernel_trigger_dispatch_now(3);
+ } else {
+ ws_demand_location(245, 373, 1);
+ kernel_trigger_dispatch_now(2);
+ }
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ if (_G(flags)[V117])
+ _timer = timer_read_60();
+
+ ws_demand_location(290, 325, 1);
+ break;
+ }
}
void Room303::daemon() {
}
+void Room303::pre_parser() {
+ if (player_said("GEAR", "BOILER") && !_G(flags)[V119]) {
+ _G(wilbur_should) = 15;
+ player_hotspot_walk_override(409, 312, 3, gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ } else {
+ if (player_said("FRONT YARD") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
+ player_set_facing_hotspot();
+
+ if (player_said("FRONT YARD ") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
+ player_set_facing_hotspot();
+ }
+}
+
+void Room303::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("FRONT YARD") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER")) {
+ frontYard();
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3001);
+ _G(flags)[V125] = 0;
+ } else if (player_said("FRONT YARD ") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER")) {
+ frontYard();
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3001);
+ _G(flags)[V125] = 1;
+ } else if (player_said("DISTILLED CARROT JUICE", "BURNER")) {
+ wilbur_speech("300w033");
+ } else if (player_said("DISTILLED CARROT JUICE", "BOILER")) {
+ wilbur_speech("300w034");
+ } else if (player_said("JUG", "BOILER")) {
+ wilbur_speech("300w027");
+ } else if (player_said("JUG", "STOOL") || player_said("DISTILLED CARROT JUICE", "STOOL")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("JUG", "JUG ", "JUG ") && player_said("CARROT JUICE")) {
+ wilbur_speech("300w046");
+ } else if (player_said("JUG", "STUMP") || player_said("DISTILLED CARROT JUICE", "STUMP")) {
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 14;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BOTTLE", "BOILER")) {
+ wilbur_speech("300w074");
+ } else if (player_said("BOTTLE", "STOOL")) {
+ wilbur_speech("300w075");
+ } else if (player_said("CARROT JUICE", "BURNER")) {
+ wilbur_speech("300w047");
+ } else if (player_said("CARROT JUICE", "STOOL")) {
+ wilbur_speech("300w049");
+ } else if (player_said("MATCHES", "STUMP") || player_said("MATCHES", "WOOD")) {
+ wilbur_speech("300w019");
+ } else if (player_said("GEAR", "FUEL TANK")) {
+ player_set_commands_allowed(false);
+ _val3 = _G(flags)[V117] ? 3 : 1;
+ kernel_trigger_dispatch_now(7);
+ } else if (player_said("LOOK AT", "BURNER")) {
+ _G(wilbur_should) = 21;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("GEAR", "BURNER")) {
+ _G(wilbur_should) = 22;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("MATCHES", "BURNER")) {
+ if (_G(flags)[V118] == 3001) {
+ player_set_commands_allowed(false);
+ _val4 = _G(flags)[V117] ? 5 : 6;
+ kernel_trigger_dispatch_now(8);
+ }
+ } else if (player_said("GEAR", "BOILER")) {
+ if (_G(flags)[V119])
+ _G(wilbur_should) = 24;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BOILER", "CARROT JUICE")) {
+ _G(wilbur_should) = 16;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
+ _G(wilbur_should) = 12;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
+ _G(wilbur_should) = 13;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("LOOK AT", "KEG")) {
+ wilbur_speech(_G(flags)[V120] ? "303w027" : "303w026");
+ } else if (player_said("BURNER")) {
+ wilbur_speech("303w013");
+ } else if (player_said("BOILER")) {
+ wilbur_speech("303w018");
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room303::frontYard() {
+ term_message("------- %ld %ld %ld", _G(flags)[V119], _G(flags)[V118], _G(flags)[V121]);
+
+ if (_G(flags)[V119] && _G(flags)[V118] == 3002 && _G(flags)[V121] == 3002) {
+ term_message("jug filled with distilled juice!!");
+ _G(flags)[V122] = 1;
+ _G(flags)[V120] = 1;
+ _G(flags)[V119] = 0;
+ }
+}
+
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
index a91ca9b1f0e..e74c674a48a 100644
--- a/engines/m4/burger/rooms/section3/room303.h
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -42,16 +42,36 @@ private:
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
+ machine *_series1 = nullptr;
+ int _series2 = -1;
+ machine *_series3 = nullptr;
+ int _series4 = -1;
+ machine *_series5 = nullptr;
+ int _series6 = -1;
+ machine *_series7 = nullptr;
+ int _triggers[5];
+ int _ctr = 0;
+ int _timer = 0;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+
+ void frontYard();
protected:
const char *getDigi() override;
public:
- Room303() : Section3Room() {}
+ Room303();
~Room303() override {}
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: 66619a3987eaf9a9a17defc250801acd68730d38
https://github.com/scummvm/scummvm/commit/66619a3987eaf9a9a17defc250801acd68730d38
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 303
Changed paths:
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room303.h
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 653db976482..72d7f0279c0 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -209,6 +209,432 @@ void Room303::init() {
}
void Room303::daemon() {
+ doDaemon(_G(kernel).trigger);
+}
+
+void Room303::doDaemon(int trigger) {
+ switch (trigger) {
+ case 1:
+ for (_ctr = 0; _ctr < 5; ++_ctr) {
+ if (_triggers[_ctr] != -1) {
+ kernel_trigger_dispatch_now(_triggers[_ctr]);
+ _triggers[_ctr] = -1;
+ }
+ }
+ break;
+
+ case 2:
+ if (_G(flags)[V115] > 1) {
+ player_set_commands_allowed(true);
+ ws_walk(290, 325, 0, 4, 1);
+ } else {
+ _G(wilbur_should) = 18;
+ player_set_commands_allowed(false);
+ ws_walk(290, 325, 0, gCHANGE_WILBUR_ANIMATION, 1);
+ }
+ break;
+
+ case 3:
+ if (_G(flags)[V115] > 1) {
+ player_set_commands_allowed(true);
+ ws_walk(261, 276, 0, 4, 3);
+ } else {
+ _G(wilbur_should) = 18;
+ player_set_commands_allowed(false);
+ ws_walk(261, 276, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 4:
+ player_set_commands_allowed(true);
+ break;
+
+ case 5:
+ setupDigi();
+ break;
+
+ case 6:
+ switch (_val7) {
+ case 25:
+ if (_G(flags)[V119] && _G(flags)[V118] == 3002) {
+ terminateMachineAndNull(_series7);
+ series_unload(_series6);
+
+ _G(flags)[V120] = 1;
+ _val7 = 26;
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "303dist", 6, 0xc10, 6);
+ player_set_commands_allowed(false);
+ intr_cancel_sentence();
+ ws_walk(330, 350, nullptr, -1, 2);
+ }
+ break;
+
+ case 26:
+ digi_unload_stream_breaks(SERIES1);
+ player_set_commands_allowed(true);
+
+ _G(flags)[V119] = 0;
+ _series6 = series_load("303stil");
+ _series7 = series_show("303stil", 0xd10);
+
+ if (_G(flags)[V121] == 3002) {
+ _val8 = 27;
+ _G(flags)[V122] = 1;
+ terminateMachineAndNull(_series8);
+ _val6 = 33;
+ kernel_trigger_dispatch_now(10);
+ } else {
+ _val8 = 28;
+ }
+
+ kernel_trigger_dispatch_now(9);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 7:
+ switch (_val3) {
+ case 1:
+ freeSeries1();
+ series_play_with_breaks(PLAY6, "303wi07", 0xd00, 7, 3);
+
+ _val3 = 2;
+ _G(flags)[V117] = 1;
+ setupDigi();
+ ws_hide_walker();
+
+ _G(wilbur_should) = 19;
+ _timer = timer_read_60();
+ break;
+
+ case 2:
+ _series2 = series_load("303ft_on");
+ _series3 = series_play("303ft_on", 0xd00, 0, -1, 0, -1);
+
+ if (_G(wilbur_should) == 19)
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 3:
+ freeSeries1();
+ series_play_with_breaks(PLAY7, "303wi08", 0xd00, 7, 3);
+ _val3 = 4;
+ ws_hide_walker();
+ _G(wilbur_should) = 20;
+ break;
+
+ case 4:
+ _series2 = series_load("303ft");
+ _series3 = series_show("303ft", 0xd00);
+ _G(flags)[V117] = 0;
+ setupDigi();
+
+ if (_G(flags)[V118] == 3002) {
+ _val4 = 8;
+ doDaemon(8);
+ }
+ if (_G(wilbur_should) == 20)
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 8:
+ switch (_val4) {
+ case 5:
+ freeSeries2();
+ player_update_info();
+
+ if (timer_read_60() - _timer > 900) {
+ _G(flags)[V118] = 3003;
+ series_play_with_breaks(PLAY8, "303wi10", 0xd01, 3007, 1);
+ } else {
+ _G(flags)[V118] = 3002;
+ series_play_with_breaks(PLAY9, "303wi02", 0xd01, 8, 3);
+ }
+
+ _val4 = 7;
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ break;
+
+ case 6:
+ freeSeries2();
+ series_play_with_breaks(PLAY9, "303wi09", 0xd01, 8, 3);
+ _val4 = 9;
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ break;
+
+ case 7:
+ setupDigi();
+ _series4 = series_load("303burn");
+ _series5 = series_play("303burn", 0xd14, 0, -1, 0, -1);
+
+ if (_G(wilbur_should) == 10001) {
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ }
+
+ _val7 = 25;
+ kernel_timing_trigger(180, 6);
+ break;
+
+ case 8:
+ freeSeries2();
+ _series4 = series_load("303burnr");
+ _series5 = series_show("303burnr", 0xd14);
+ _G(flags)[V118] = 3001;
+ setupDigi();
+ break;
+
+ case 9:
+ _series4 = series_load("303burnr");
+ _series5 = series_show("303burnr", 0xd14);
+ _G(flags)[V118] = 3001;
+
+ if (_G(wilbur_should) == 10001) {
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ player_set_commands_allowed(true);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ switch (_val8) {
+ case 27:
+ if (_val5 < 15) {
+ ++_val5;
+ _val8 = 27;
+ terminateMachineAndNull(_series9);
+ _series9 = series_play("303cj01", 0xd15, 0, 9, 8);
+ }
+ break;
+ case 28:
+ if (_val5 < 15) {
+ ++_val5;
+ _val8 = 28;
+ terminateMachineAndNull(_series9);
+ _series9 = series_play("303cj02", 0xd15, 0, 9, 6);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10:
+ switch (_val6) {
+ case 30:
+ inv_move_object("JUG", 303);
+ inv_move_object("DISTILLED CARROT JUICE", 303);
+
+ _G(flags)[V121] = 3001;
+ _series8 = series_show("303juga", 0xbff);
+ hotspot_set_active("JUG ", true);
+ break;
+
+ case 31:
+ inv_move_object("JUG", 303);
+ inv_move_object("DISTILLED CARROT JUICE", 303);
+
+ _G(flags)[V121] = 3002;
+ _series8 = series_show("303JUG", 0xd14);
+ hotspot_set_active("JUG ", true);
+ break;
+
+ case 32:
+ inv_move_object("JUG", 303);
+ inv_move_object("DISTILLED CARROT JUICE", 303);
+ _G(flags)[V122] = 1;
+ _G(flags)[V121] = 3001;
+
+ _series8 = series_show("303juga", 0xbff);
+ hotspot_set_active("DISTILLED CARROT JUICE ", true);
+ break;
+
+ case 33:
+ inv_move_object("JUG", 303);
+ inv_move_object("DISTILLED CARROT JUICE", 303);
+ _G(flags)[V122] = 1;
+ _G(flags)[V121] = 3002;
+
+ _series8 = series_show("303JUG", 0xd14);
+ hotspot_set_active("DISTILLED CARROT JUICE ", true);
+ hotspot_set_active("JUG ", true);
+ break;
+
+ case 34:
+ _G(flags)[V121] = 3003;
+ inv_give_to_player(_G(flags)[V122] ? "DISTILLED CARROT JUICE" : "JUG");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 11:
+ terminateMachineAndNull(_series8);
+ hotspot_set_active("DISTILLED CARROT JUICE ", false);
+ hotspot_set_active("DISTILLED CARROT JUICE ", false);
+ hotspot_set_active("JUG ", false);
+ hotspot_set_active("JUG ", false);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 11:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+
+ if (_val5 > 0 && _val5 < 15) {
+ _val8 = 27;
+ _G(flags)[V122] = 1;
+ } else {
+ _val8 = 29;
+ }
+
+ _val6 = _G(flags)[V122] ? 33 : 31;
+ _val9 = 10;
+ series_play_with_breaks(PLAY1, "303wi4b", 0x100, 1, 3);
+ break;
+
+ case 12:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ kernel_trigger_dispatch_now(11);
+
+ _val6 = 34;
+ _val9 = 10;
+ _val8 = (_val5 > 0 && _val5 < 15) ? 28 : 29;
+ series_play_with_breaks(PLAY3, "303wi4b", 0x100, 1, 3);
+ break;
+
+ case 13:
+ ws_hide_walker();
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(11);
+ _G(wilbur_should) = 10001;
+ _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _val6 = 34;
+ _val9 = 10;
+ series_play_with_breaks(PLAY4, "303wi4a", 0x100, 1, 3);
+ break;
+
+ case 14:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ _G(wilbur_should) = 10001;
+ _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _val6 = _G(flags)[V122] ? 32 : 30;
+ _val9 = 10;
+ series_play_with_breaks(PLAY5, "303wi4a", 0x100, 1, 3);
+ break;
+
+ case 15:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 23;
+ series_play_with_breaks(PLAY10, "303wi15", 0x100, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 16:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 17;
+ series_play_with_breaks(PLAY2, "303wi03", 0x100, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 17:
+ _G(flags)[V119] = 1;
+ _G(flags)[V126] = 1;
+ inv_put_thing_in("CARROT JUICE", NOWHERE);
+ inv_give_to_player("BOTTLE");
+ _val7 = 25;
+ kernel_trigger_dispatch_now(6);
+ enable_player();
+ break;
+
+ case 18:
+ _G(wilbur_should) = 10001;
+ wilbur_speech(_G(flags)[V115] ? "303w002" : "303w001");
+ _G(flags)[V115]++;
+ break;
+
+ case 19:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+
+ if (_G(flags)[V116]) {
+ wilbur_speech("303w006");
+ } else {
+ wilbur_speech("303w005");
+ _G(flags)[V116] = 1;
+ }
+ break;
+
+ case 20:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("303w007");
+ break;
+
+ case 21:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech(_G(flags)[V118] == 3001 ? "303w008" : "303w009");
+ break;
+
+ case 22:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech(_G(flags)[V118] == 3001 ? "303w011" : "303w012");
+ break;
+
+ case 23:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("303w016");
+ break;
+
+ case 24:
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ wilbur_speech("303w017");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room303::pre_parser() {
@@ -319,6 +745,19 @@ void Room303::frontYard() {
}
}
+void Room303::freeSeries1() {
+ if (_series3)
+ terminateMachineAndNull(_series3);
+ if (_series2)
+ series_unload(_series2);
+}
+
+void Room303::freeSeries2() {
+ if (_series5)
+ terminateMachineAndNull(_series5);
+ if (_series4)
+ series_unload(_series4);
+}
} // namespace Rooms
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
index e74c674a48a..fc797e3f717 100644
--- a/engines/m4/burger/rooms/section3/room303.h
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -49,6 +49,8 @@ private:
machine *_series5 = nullptr;
int _series6 = -1;
machine *_series7 = nullptr;
+ machine *_series8 = nullptr;
+ machine *_series9 = nullptr;
int _triggers[5];
int _ctr = 0;
int _timer = 0;
@@ -58,8 +60,14 @@ private:
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+ int _val9 = 0;
void frontYard();
+ void doDaemon(int trigger);
+ void freeSeries1();
+ void freeSeries2();
protected:
const char *getDigi() override;
Commit: 45b9d5eff53d3beefcbbc8db7a0231c6663d9a75
https://github.com/scummvm/scummvm/commit/45b9d5eff53d3beefcbbc8db7a0231c6663d9a75
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added set_palette_brightness to Section3Room
Changed paths:
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room304.h
engines/m4/burger/rooms/section3/section3_room.cpp
engines/m4/burger/rooms/section3/section3_room.h
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index 0667464bcab..ad0afdd5329 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -92,11 +92,30 @@ const char *Room304::getDigi() {
}
void Room304::init() {
+ setupDigi();
+ // TODO: set_palette_brightness(70);
+
+ if (inv_player_has("MATCHES")) {
+ hotspot_set_active("MATCHES ", false);
+ } else {
+ _matches = series_show("304match", 0xa00);
+ hotspot_set_active("MATCHES ", true);
+ }
+
+ // TODO
}
void Room304::daemon() {
}
+void Room304::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+}
+
+void Room304::parser() {
+
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room304.h b/engines/m4/burger/rooms/section3/room304.h
index e85d04e2383..db1bcdd7c4c 100644
--- a/engines/m4/burger/rooms/section3/room304.h
+++ b/engines/m4/burger/rooms/section3/room304.h
@@ -36,6 +36,7 @@ private:
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
+ machine *_matches = nullptr;
protected:
const char *getDigi() override;
@@ -46,6 +47,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/section3_room.cpp b/engines/m4/burger/rooms/section3/section3_room.cpp
index 6ef5f803fb9..bfab4c4802e 100644
--- a/engines/m4/burger/rooms/section3/section3_room.cpp
+++ b/engines/m4/burger/rooms/section3/section3_room.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section3/section3_room.h"
#include "m4/burger/vars.h"
+#include "m4/core/errors.h"
namespace M4 {
namespace Burger {
@@ -46,6 +47,26 @@ void Section3Room::setupDigi() {
}
}
+void Section3Room::set_palette_brightness(int start, int finish, int percent) {
+ if (finish < start || finish > 255 || start < 0)
+ error_show(FL, 'Burg', "set_palette_brightness index error");
+
+ RGB8 *pal = &_G(master_palette)[start];
+ for (int index = start; index < finish; ++index, ++pal) {
+ int r = (double)pal->r * (double)percent / (double)100;
+ int g = (double)pal->g * (double)percent / (double)100;
+ int b = (double)pal->b * (double)percent / (double)100;
+
+ pal->r = CLIP(r, 0, 255);
+ pal->g = CLIP(g, 0, 255);
+ pal->b = CLIP(b, 0, 255);
+ }
+}
+
+void Section3Room::set_palette_brightness(int percent) {
+ set_palette_brightness(32, 95, percent);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/section3_room.h b/engines/m4/burger/rooms/section3/section3_room.h
index 3e57c0087ba..92d6d72fb59 100644
--- a/engines/m4/burger/rooms/section3/section3_room.h
+++ b/engines/m4/burger/rooms/section3/section3_room.h
@@ -39,6 +39,9 @@ protected:
return nullptr;
}
+ void set_palette_brightness(int start, int finish, int percent);
+ void set_palette_brightness(int percent);
+
public:
Section3Room() {}
virtual ~Section3Room() {}
Commit: b20661bff426d326f5dc6eb2bd46ac29ef5f6ed4
https://github.com/scummvm/scummvm/commit/b20661bff426d326f5dc6eb2bd46ac29ef5f6ed4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 304
Changed paths:
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room304.h
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index ad0afdd5329..4c4fe996b42 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -93,7 +93,7 @@ const char *Room304::getDigi() {
void Room304::init() {
setupDigi();
- // TODO: set_palette_brightness(70);
+ set_palette_brightness(70);
if (inv_player_has("MATCHES")) {
hotspot_set_active("MATCHES ", false);
@@ -102,10 +102,114 @@ void Room304::init() {
hotspot_set_active("MATCHES ", true);
}
- // TODO
+ if (_G(flags)[V130]) {
+ _fire = series_play("304firel", 0xa00, 4, -1, 6, -1);
+ } else {
+ _fire = series_show("304firel", 0xa00);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 302:
+ ws_demand_location(150, 306, 3);
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(300, 306, 4);
+ break;
+ }
}
void Room304::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ term_message("Walking into scene....!");
+
+ if (_G(flags)[V129]) {
+ ws_walk(300, 306, nullptr, 2, 4);
+ } else {
+ _G(flags)[V129] = 1;
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 5;
+ ws_walk(300, 306, nullptr, gCHANGE_WILBUR_ANIMATION, 4);
+ }
+ break;
+
+ case 2:
+ player_set_commands_allowed(true);
+ break;
+
+ case 3:
+ setupDigi();
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ series_play_with_breaks(PLAY5, "304wi01", 0x600, -1, 2, 6);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 5:
+ _fire = series_play("304fire1", 0xa00, 0, -1, 6, -1);
+ _G(wilbur_should) = 10001;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 6:
+ inv_give_to_player("MATCHES");
+ hotspot_set_active("MATCHES ", false);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10002;
+ series_play_with_breaks(PLAY1, "304wi01", 0x600, 3001, 3, 8);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ terminateMachineAndNull(_fire);
+ series_play_with_breaks(PLAY4, "304wi05", 0xa00, 5, 3);
+ break;
+
+ case 3:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ terminateMachineAndNull(_matches);
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY3, "304wb01", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY2, "304wi03", 0x101, gCHANGE_WILBUR_ANIMATION, 2);
+ break;
+
+ case 5:
+ _G(wilbur_should) = 10001;
+ _G(flags)[V129] = 1;
+ wilbur_speech("304w001");
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room304::pre_parser() {
@@ -113,7 +217,39 @@ void Room304::pre_parser() {
}
void Room304::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("OPEN", "DOOR") || player_said("GEAR", "DOOR")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("LOOK AT", "MAP")) {
+ wilbur_speech(_G(flags)[V135] ? "304w012" : "304w011");
+ } else if (player_said("DISTILLED CARROT JUICE") &&
+ player_said_any("STOVE", "KETTLE", "FRYING PAN", "POT")) {
+ wilbur_speech("300w035");
+ } else if (player_said("CARROT JUICE") &&
+ player_said_any("STOVE", "KETTLE", "FRYING PAN", "POT")) {
+ wilbur_speech("300w051");
+ } else if (player_said("CARROT JUICE", "WASHTUB")) {
+ wilbur_speech("300w052");
+ } else if (player_said("DISTILLED CARROT JUICE", "WASHTUB")) {
+ wilbur_speech("300w035z");
+ } else if (player_said("MATCHES", "STOVE") && !_G(flags)[V130]) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TAKE", "MATCHES ")) {
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("READ", "RECIPE BOOK") || player_said("LOOK AT", "RECIPE BOOK")) {
+ _G(wilbur_should) = 4;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room304.h b/engines/m4/burger/rooms/section3/room304.h
index db1bcdd7c4c..2098c71f2da 100644
--- a/engines/m4/burger/rooms/section3/room304.h
+++ b/engines/m4/burger/rooms/section3/room304.h
@@ -37,6 +37,7 @@ private:
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
machine *_matches = nullptr;
+ machine *_fire = nullptr;
protected:
const char *getDigi() override;
Commit: 220ff5993a30e7aa60df8f2a9653d8f65ee4ebda
https://github.com/scummvm/scummvm/commit/220ff5993a30e7aa60df8f2a9653d8f65ee4ebda
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Init for room 305
Changed paths:
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room305.h
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index cff3e946c76..cb449a64fa8 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -67,6 +67,42 @@ const seriesPlayBreak Room305::PLAY2[] = {
void Room305::init() {
+ setupDigi();
+ set_palette_brightness(60);
+ pal_cycle_init(96, 111, 6, -1, -1);
+ _G(flags)[V149] = 0;
+
+ if (_G(flags)[V134] && !_G(flags)[V135] && !_G(flags)[V137]) {
+ hotspot_set_active("DARKNESS", true);
+ hotspot_set_active("MINE", false);
+ } else {
+ hotspot_set_active("DARKNESS", false);
+ hotspot_set_active("MINE", true);
+ }
+
+ _series1 = series_show(_G(flags)[V134] ? "305genx" : "305gen", 0x200);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 302:
+ _G(wilbur_should) = 101;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 319:
+ player_set_commands_allowed(true);
+ ws_demand_location(-50, 200);
+ kernel_trigger_dispatch_now(301);
+ break;
+
+ default:
+ player_set_commands_allowed(true);
+ ws_demand_location(320, 290, 7);
+ break;
+ }
}
void Room305::daemon() {
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
index 827ffba4fe6..14c9a624927 100644
--- a/engines/m4/burger/rooms/section3/room305.h
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -34,6 +34,7 @@ private:
static const seriesStreamBreak SERIES1[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
+ machine *_series1 = nullptr;
protected:
const char *getDigi() override {
Commit: 877c1becb96c7d0c1bb7dc4c4a245185ba5043a9
https://github.com/scummvm/scummvm/commit/877c1becb96c7d0c1bb7dc4c4a245185ba5043a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Skeleton engine
Changed paths:
A engines/m4/riddle/riddle.cpp
A engines/m4/riddle/riddle.h
A engines/m4/riddle/vars.cpp
A engines/m4/riddle/vars.h
engines/m4/burger/vars.h
engines/m4/metaengine.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index bddf4220a29..8d0fc4dd4a3 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_BURGER_BURGER_VARS_H
-#define M4_BURGER_BURGER_VARS_H
+#ifndef M4_BURGER_VARS_H
+#define M4_BURGER_VARS_H
#include "common/textconsole.h"
#include "m4/vars.h"
diff --git a/engines/m4/metaengine.cpp b/engines/m4/metaengine.cpp
index 776fc4be9b7..0e78bba0996 100644
--- a/engines/m4/metaengine.cpp
+++ b/engines/m4/metaengine.cpp
@@ -24,6 +24,7 @@
#include "m4/metaengine.h"
#include "m4/detection.h"
#include "m4/burger/burger.h"
+#include "m4/riddle/riddle.h"
namespace M4 {
@@ -59,6 +60,9 @@ Common::Error M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const
case M4::GType_Burger:
*engine = new M4::Burger::BurgerEngine(syst, desc);
break;
+ case M4::GType_Riddle:
+ *engine = new M4::Riddle::RiddleEngine(syst, desc);
+ break;
default:
return Common::kUnsupportedGameidError;
}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 446765b068f..897ae7742e4 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -180,7 +180,9 @@ MODULE_OBJS = \
burger/other.o \
burger/series_player.o \
burger/vars.o \
- burger/walker.o
+ burger/walker.o \
+ riddle/riddle.o \
+ ridle/vars.o
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
new file mode 100644
index 00000000000..486154e8c8d
--- /dev/null
+++ b/engines/m4/riddle/riddle.cpp
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/debug.h"
+#include "m4/riddle/riddle.h"
+#include "m4/riddle/vars.h"
+#include "m4/core/errors.h"
+
+namespace M4 {
+namespace Riddle {
+
+RiddleEngine::RiddleEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+ M4Engine(syst, gameDesc) {
+}
+
+M4::Vars *RiddleEngine::createVars() {
+ return new Riddle::Vars();
+}
+
+void RiddleEngine::showEngineInfo() {
+ debug("The Riddle of Master Lu\n");
+ debug("Game Version %s -- %s\n", "2.05", "Dec 14, 1995");
+ debug("%s\n", "M4 Runtime by Nick, Tinman, Mike, Xi, Andras, Paul (the fifth Beatle)");
+ debug("M4 Library Version %s -- %s\n", "v1.213", "September 8, 1995");
+ debug("%s.\n\n", "Copyright (c) 1995 by Sanctuary Woods Multimedia Corporation");
+}
+
+void RiddleEngine::syncFlags(Common::Serializer &s) {
+ //g_vars->_flags.sync(s);
+}
+
+void RiddleEngine::global_daemon() {
+ // TODO
+}
+
+void RiddleEngine::global_pre_parser() {
+ // TODO
+}
+
+void RiddleEngine::global_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ // TODO
+}
+
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/riddle.h b/engines/m4/riddle/riddle.h
new file mode 100644
index 00000000000..64b72f600fa
--- /dev/null
+++ b/engines/m4/riddle/riddle.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_RIDDLE_H
+#define M4_RIDDLE_RIDDLE_H
+
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Riddle {
+
+class RiddleEngine : public M4Engine {
+protected:
+ /**
+ * Creates the structure that holds all the global variables
+ */
+ M4::Vars *createVars() override;
+
+public:
+ RiddleEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ ~RiddleEngine() override {}
+
+ /**
+ * Show the engine information
+ */
+ void showEngineInfo() override;
+
+ void syncFlags(Common::Serializer &s) override;
+
+ void global_daemon() override;
+ void global_pre_parser() override;
+ void global_parser() override;
+};
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
new file mode 100644
index 00000000000..c8d919511ad
--- /dev/null
+++ b/engines/m4/riddle/vars.cpp
@@ -0,0 +1,140 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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/debug.h"
+#include "common/events.h"
+#include "m4/riddle/vars.h"
+#include "m4/gui/gui_vmng.h"
+
+namespace M4 {
+namespace Riddle {
+
+Vars *g_vars;
+
+Vars::Vars() {
+ g_vars = this;
+}
+
+Vars::~Vars() {
+ g_vars = nullptr;
+ delete _inventory;
+}
+
+void Vars::main_cold_data_init() {
+ // TODO
+ initMouseSeries("cursor", nullptr);
+
+ _kernel.first_fade = 32;
+ _G(custom_ascii_converter) = custom_ascii_converter_proc;
+
+ _game.setRoom(101); /*****DEBUG*****/
+
+ font_set_colors(2, 1, 3);
+}
+
+void Vars::global_menu_system_init() {
+/*
+ AddSystemHotkey(Common::KEYCODE_ESCAPE, escape_key_pressed);
+ AddSystemHotkey(Common::KEYCODE_F2, cb_F2);
+ AddSystemHotkey(Common::KEYCODE_F3, cb_F3);
+
+ if (_interface.init(0, 5, 6, 8, 9))
+ static_cast<Inventory *>(_inventory)->init();
+ */
+}
+
+void Vars::initialize_game() {
+/*
+ // Put all the inventory items back in their original scenes
+ for (const auto &item : _inventory->_objects)
+ inv_put_thing_in(item->name, item->scene);
+ inv_give_to_player("MONEY");
+
+ // Reset the global variables
+ _flags.reset();
+ _flags.reset1();
+ _flags.reset2();
+ _flags.reset3();
+ _flags.reset4();
+ _flags.reset5();
+ _flags.conv_reset_all();
+
+ Rooms::Room::setWilburHotspot();
+ */
+}
+
+void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
+ int32 maxW, maxH;
+
+ _mouseSeriesHandle = nullptr;
+ _mouseSeriesOffset = 0;
+ _mouseSeriesPalOffset = 0;
+
+ if (_mouseSprite)
+ _mouseSprite->data = nullptr;
+ if (_mouseBuffer.data)
+ mem_free(_mouseBuffer.data);
+
+ if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
+ _mouseSeriesResource = assetName;
+
+ if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
+ if (maxW && maxH) {
+ _mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
+ _mouseBuffer.w = maxW;
+ _mouseBuffer.h = maxH;
+ _mouseBuffer.stride = maxW;
+
+ vmng_screen_show(_mouseScreenSource);
+ ResizeScreen(_mouseScreenSource, maxW, maxH);
+
+ _currMouseNum = -1;
+ _mouseIsLocked = false;
+ mouse_set_sprite(kArrowCursor);
+ }
+ }
+ }
+}
+
+void Vars::custom_ascii_converter_proc(char *string) {
+ char *str;
+/*
+ for (const auto *entry = ASCII_CONVERTERS; entry->_find; entry++) {
+ while ((str = strstr(string, entry->_find)) != nullptr)
+ *str = entry->_replace;
+ }
+ */
+}
+
+void Vars::escape_key_pressed(void *, void *) {
+
+}
+
+void Vars::cb_F2(void *, void *) {
+
+}
+
+void Vars::cb_F3(void *, void *) {
+
+}
+
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
new file mode 100644
index 00000000000..7daaec3e205
--- /dev/null
+++ b/engines/m4/riddle/vars.h
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_VARS_H
+#define M4_RIDDLE_VARS_H
+
+#include "common/textconsole.h"
+#include "m4/vars.h"
+
+namespace M4 {
+namespace Riddle {
+
+enum global_triggers {
+ gFIRST_GLOBAL_TRIGGER = 10000,
+};
+
+class Vars : public M4::Vars {
+private:
+ void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
+ static void custom_ascii_converter_proc(char *string);
+ static void escape_key_pressed(void *, void *);
+ static void cb_F2(void *, void *);
+ static void cb_F3(void *, void *);
+
+protected:
+ void main_cold_data_init() override;
+
+public:
+ // Globals go here
+public:
+ Vars();
+ virtual ~Vars();
+
+ M4::Interface *getInterface() override {
+ return nullptr;
+ }
+ Hotkeys *getHotkeys() override {
+ return nullptr;
+ }
+ M4::Walker *getWalker() override {
+ return nullptr;
+ }
+ void initialize_game() override;
+
+ void global_menu_system_init() override;
+};
+
+extern Vars *g_vars;
+
+#undef _G
+#undef _GI
+#define _G(X) (::M4::Riddle::g_vars->_##X)
+#define _GI(X) _G(interface)._##X
+#define _GINT() _G(interface)
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
Commit: 6ada1733a823f68aad853d41e761e6cc7afe9189
https://github.com/scummvm/scummvm/commit/6ada1733a823f68aad853d41e761e6cc7afe9189
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Skeleton room classes for section 9
Changed paths:
A engines/m4/riddle/rooms/room.cpp
A engines/m4/riddle/rooms/room.h
A engines/m4/riddle/rooms/section.cpp
A engines/m4/riddle/rooms/section.h
A engines/m4/riddle/rooms/section9/room901.cpp
A engines/m4/riddle/rooms/section9/room901.h
A engines/m4/riddle/rooms/section9/room902.cpp
A engines/m4/riddle/rooms/section9/room902.h
A engines/m4/riddle/rooms/section9/room903.cpp
A engines/m4/riddle/rooms/section9/room903.h
A engines/m4/riddle/rooms/section9/room905.cpp
A engines/m4/riddle/rooms/section9/room905.h
A engines/m4/riddle/rooms/section9/room907.cpp
A engines/m4/riddle/rooms/section9/room907.h
A engines/m4/riddle/rooms/section9/room908.cpp
A engines/m4/riddle/rooms/section9/room908.h
A engines/m4/riddle/rooms/section9/room917.cpp
A engines/m4/riddle/rooms/section9/room917.h
A engines/m4/riddle/rooms/section9/room918.cpp
A engines/m4/riddle/rooms/section9/room918.h
A engines/m4/riddle/rooms/section9/room996.cpp
A engines/m4/riddle/rooms/section9/room996.h
A engines/m4/riddle/rooms/section9/section9.cpp
A engines/m4/riddle/rooms/section9/section9.h
engines/m4/module.mk
engines/m4/riddle/vars.cpp
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 897ae7742e4..3392eda5d1e 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -181,9 +181,19 @@ MODULE_OBJS = \
burger/series_player.o \
burger/vars.o \
burger/walker.o \
+ riddle/rooms/section9/room901.o \
+ riddle/rooms/section9/room902.o \
+ riddle/rooms/section9/room903.o \
+ riddle/rooms/section9/room905.o \
+ riddle/rooms/section9/room907.o \
+ riddle/rooms/section9/room908.o \
+ riddle/rooms/section9/room917.o \
+ riddle/rooms/section9/room918.o \
+ riddle/rooms/section9/room996.o \
riddle/riddle.o \
ridle/vars.o
+
# This module can be built as a plugin
ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
PLUGIN := 1
diff --git a/engines/m4/riddle/rooms/room.cpp b/engines/m4/riddle/rooms/room.cpp
new file mode 100644
index 00000000000..291ae48fb72
--- /dev/null
+++ b/engines/m4/riddle/rooms/room.cpp
@@ -0,0 +1,102 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/room.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+HotSpotRec Room::_wilburHotspot;
+char Room::_wilburName[16];
+char Room::_wilburVerb = 0;
+
+void Room::setWilburHotspot() {
+ Common::strcpy_s(_wilburName, "Wilbur");
+
+ _wilburHotspot.clear();
+ _wilburHotspot.vocab = _wilburName;
+ _wilburHotspot.verb = &_wilburVerb;
+ _wilburHotspot.feet_x = 0x7fff;
+ _wilburHotspot.feet_y = 0x7fff;
+ _wilburHotspot.cursor_number = kArrowCursor;
+}
+
+
+void Room::shutdown() {
+}
+
+void Room::parser_code() {
+ warning("TODO: global_parser_code");
+}
+
+HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
+ if (!_G(player).walker_in_this_scene || !_G(roomVal2))
+ return nullptr;
+
+ player_update_info();
+ int y2 = _G(player_info).y - (_G(player_info).scale * 75 / 100);
+ int y1 = _G(player_info).y - (_G(player_info).scale * 150 / 100);
+ int xSize = _G(player_info).scale * 22 / 100;
+
+ if (y > y2 || y <= y1 || imath_abs(x - _G(player_info).x) >= xSize)
+ return nullptr;
+
+ return &_wilburHotspot;
+}
+
+void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
+ int layer, bool shadow, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
+ term_message("npc_say: %s npc_series: %s npc_trigger: %d",
+ digiName, seriesName, trigger);
+
+ _G(npcTrigger) = trigger;
+
+ if (seriesName) {
+ _G(npcSpeech1) = series_play(seriesName, layer, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
+
+ if (shadow) {
+ char temp[20];
+ Common::strcpy_s(temp, 20, seriesName);
+ Common::strcat_s(temp, 20, "s");
+ _G(npcSpeech2) = series_play(temp, layer + 1, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
+ }
+ }
+
+ kernel_trigger_dispatch_now(gNPC_SPEECH_STARTED);
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ digi_play(digiName, digiSlot, digiVol, gNPC_SPEECH_FINISHED);
+
+ _G(kernel).trigger_mode = oldMode;
+}
+
+void Room::npc_say(int trigger, const char *seriesName, int layer, bool shadow,
+ int firstFrame, int lastFrame, int digiSlot, int digiVol) {
+ npc_say(conv_sound_to_play(), trigger, seriesName, layer, shadow,
+ firstFrame, lastFrame, digiSlot, digiVol);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/room.h b/engines/m4/riddle/rooms/room.h
new file mode 100644
index 00000000000..dc1f24ce5fb
--- /dev/null
+++ b/engines/m4/riddle/rooms/room.h
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_ROOM_H
+#define M4_BURGER_ROOMS_ROOM_H
+
+#include "m4/core/rooms.h"
+#include "m4/burger/core/play_break.h"
+#include "m4/burger/core/stream_break.h"
+#include "m4/burger/core/conv.h"
+#include "m4/adv_r/conv_io.h"
+#include "m4/core/imath.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/adv_r/adv_hotspot.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room : public M4::Room {
+private:
+ static char _wilburName[16];
+ static char _wilburVerb;
+
+protected:
+ static HotSpotRec _wilburHotspot;
+ Series _roomSeries1;
+ Series _general;
+
+public:
+ static void setWilburHotspot();
+
+public:
+ Room() : M4::Room() {}
+ ~Room() override {}
+
+ void shutdown() override;
+ void parser_code() override;
+
+ /**
+ * Used to tell if x,y is over the walker hotspot
+ */
+ HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
+
+ void compact_mem_and_report() {}
+
+ void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
+ int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
+ int digiSlot = 1, int digiVol = 255);
+ void npc_say(int trigger = -1, const char *seriesName = nullptr,
+ int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
+ int digiSlot = 1, int digiVol = 255);
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section.cpp b/engines/m4/riddle/rooms/section.cpp
new file mode 100644
index 00000000000..c5b4b506ee8
--- /dev/null
+++ b/engines/m4/riddle/rooms/section.cpp
@@ -0,0 +1,148 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/riddle/vars.h"
+#include "m4/m4.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Section::global_room_init() {
+#ifdef TODO
+ int roomId = _G(game).room_id;
+
+ if (roomId <= 800)
+ _GINT().show();
+ else
+ _GINT().hide();
+
+ // Disable commands for certain rooms
+ if (roomId == 201 || roomId == 301 || roomId == 306 || roomId == 307 ||
+ roomId == 401 || roomId == 501 || roomId == 511 || roomId == 512 ||
+ roomId == 513 || roomId == 601 || roomId == 605 || roomId == 606 ||
+ roomId == 608 || roomId == 609 || roomId == 610 || roomId == 801 ||
+ roomId == 902) {
+ player_set_commands_allowed(false);
+ }
+
+ if (roomId >= 950 || roomId == 902)
+ mouse_hide();
+ else
+ mouse_show();
+
+ // Do stuff that needs to be done each time a scene is started
+ init_series_players();
+
+ // Preload digi sounds
+ if (_G(player).walker_in_this_scene) {
+ switch (roomId) {
+ case 102:
+ case 103:
+ case 105:
+ case 134:
+ case 135:
+ case 143:
+ case 174:
+ case 175:
+ case 176:
+ case 304:
+ case 505:
+ case 506:
+ case 507:
+ case 509:
+ case 602:
+ case 603:
+ case 604:
+ case 612: {
+ static const char *NAMES[] = {
+ "fs_wood1", "fs_wood2", "fs_wood3", "fs_wood4", "fs_wood5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 106:
+ case 139:
+ case 144:
+ case 145:
+ case 302:
+ case 303:
+ case 305: {
+ static const char *NAMES[] = {
+ "fs_dirt1", "fs_dirt2", "fs_dirt3", "fs_dirt4", "fs_dirt5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ case 314:
+ case 315:
+ case 316:
+ case 317:
+ case 318:
+ case 319: {
+ static const char *NAMES[] = {
+ "fs_mine1", "fs_mine2", "fs_mine3", "fs_mine4", "fs_mine5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+
+ default: {
+ static const char *NAMES[] = {
+ "fs_hard1", "fs_hard2", "fs_hard3", "fs_hard4", "fs_hard5", nullptr
+ };
+ _G(digi).preload_sounds(NAMES);
+ break;
+ }
+ }
+ }
+
+ kernel_timing_trigger(900, 10017, nullptr);
+ kernel_timing_trigger(300, 10017, nullptr);
+#endif
+}
+
+void Section::init_series_players() {
+ _G(seriesPlayers).clear();
+}
+
+void Section::tick() {
+ int oldTrigger = _G(kernel).trigger;
+ _G(kernel).trigger = gCALLED_EACH_LOOP;
+ g_engine->game_daemon_code();
+ _G(kernel).trigger = oldTrigger;
+}
+
+void Section::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section.h b/engines/m4/riddle/rooms/section.h
new file mode 100644
index 00000000000..e1a27ef514b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION_H
+#define M4_RIDDLE_ROOMS_SECTION_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section : public M4::Section {
+private:
+ void init_series_players();
+
+public:
+ Section() : M4::Section() {}
+ ~Section() override {}
+
+ void global_room_init() override;
+ void tick() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room901.cpp b/engines/m4/riddle/rooms/section9/room901.cpp
new file mode 100644
index 00000000000..2f9e8e797ee
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room901.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room901.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room901::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room901::init() {
+}
+
+void Room901::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room901.h b/engines/m4/riddle/rooms/section9/room901.h
new file mode 100644
index 00000000000..6a8c452f623
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room901.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM901_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM901_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room901 : public Room {
+public:
+ Room901() : Room() {}
+ ~Room901() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room902.cpp b/engines/m4/riddle/rooms/section9/room902.cpp
new file mode 100644
index 00000000000..11ec8413611
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room902.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room902.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room902::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room902::init() {
+}
+
+void Room902::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room902.h b/engines/m4/riddle/rooms/section9/room902.h
new file mode 100644
index 00000000000..9a9955f5918
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room902.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM902_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM902_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room902 : public Room {
+public:
+ Room902() : Room() {}
+ ~Room902() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room903.cpp b/engines/m4/riddle/rooms/section9/room903.cpp
new file mode 100644
index 00000000000..51d3f62e6cb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room903.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room903.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room903::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room903::init() {
+}
+
+void Room903::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room903.h b/engines/m4/riddle/rooms/section9/room903.h
new file mode 100644
index 00000000000..8c330c30086
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room903.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM903_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM903_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room903 : public Room {
+public:
+ Room903() : Room() {}
+ ~Room903() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room905.cpp b/engines/m4/riddle/rooms/section9/room905.cpp
new file mode 100644
index 00000000000..64c078ca7e0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room905.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room905.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room905::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room905::init() {
+}
+
+void Room905::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room905.h b/engines/m4/riddle/rooms/section9/room905.h
new file mode 100644
index 00000000000..86150c5f35d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room905.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM905_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM905_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room905 : public Room {
+public:
+ Room905() : Room() {}
+ ~Room905() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room907.cpp b/engines/m4/riddle/rooms/section9/room907.cpp
new file mode 100644
index 00000000000..a15fa811475
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room907.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room907.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room907::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room907::init() {
+}
+
+void Room907::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room907.h b/engines/m4/riddle/rooms/section9/room907.h
new file mode 100644
index 00000000000..ba1bc4a0c6f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room907.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM907_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM907_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room907 : public Room {
+public:
+ Room907() : Room() {}
+ ~Room907() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room908.cpp b/engines/m4/riddle/rooms/section9/room908.cpp
new file mode 100644
index 00000000000..d0702902634
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room908.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room908.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room908::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room908::init() {
+}
+
+void Room908::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room908.h b/engines/m4/riddle/rooms/section9/room908.h
new file mode 100644
index 00000000000..cfdeb0d82b3
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room908.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM908_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM908_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room908 : public Room {
+public:
+ Room908() : Room() {}
+ ~Room908() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room917.cpp b/engines/m4/riddle/rooms/section9/room917.cpp
new file mode 100644
index 00000000000..d10592ac6bf
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room917.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room917.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room917::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room917::init() {
+}
+
+void Room917::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room917.h b/engines/m4/riddle/rooms/section9/room917.h
new file mode 100644
index 00000000000..5c7e96115ad
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room917.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM917_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM917_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room917 : public Room {
+public:
+ Room917() : Room() {}
+ ~Room917() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room918.cpp b/engines/m4/riddle/rooms/section9/room918.cpp
new file mode 100644
index 00000000000..0be4f577d09
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room918.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room918.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room918::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room918::init() {
+}
+
+void Room918::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room918.h b/engines/m4/riddle/rooms/section9/room918.h
new file mode 100644
index 00000000000..4ab02e14391
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room918.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM918_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM918_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room918 : public Room {
+public:
+ Room918() : Room() {}
+ ~Room918() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room996.cpp b/engines/m4/riddle/rooms/section9/room996.cpp
new file mode 100644
index 00000000000..6f2388373a1
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room996.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/room996.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room996::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
+void Room996::init() {
+}
+
+void Room996::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room996.h b/engines/m4/riddle/rooms/section9/room996.h
new file mode 100644
index 00000000000..df15a6b0dcb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/room996.h
@@ -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/>.
+ *
+ */
+
+#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM996_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM996_H
+
+#include "m4/core/rooms.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room996 : public Room {
+public:
+ Room996() : Room() {}
+ ~Room996() override {}
+
+ void preload() override;
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/section9.cpp b/engines/m4/riddle/rooms/section9/section9.cpp
new file mode 100644
index 00000000000..fe2c8adb6c5
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/section9.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/section9.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section9::Section9() : Rooms::Section() {
+ add(901, &_room901);
+ add(902, &_room902);
+ add(903, &_room903);
+ add(905, &_room905);
+ add(907, &_room907);
+ add(908, &_room908);
+ add(917, &_room917);
+ add(918, &_room918);
+ add(996, &_room996);
+}
+
+void Section9::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/section9.h b/engines/m4/riddle/rooms/section9/section9.h
new file mode 100644
index 00000000000..fec6af04163
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/section9.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION9_H
+#define M4_RIDDLE_ROOMS_SECTION9_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section9/room901.h"
+#include "m4/riddle/rooms/section9/room902.h"
+#include "m4/riddle/rooms/section9/room903.h"
+#include "m4/riddle/rooms/section9/room905.h"
+#include "m4/riddle/rooms/section9/room907.h"
+#include "m4/riddle/rooms/section9/room908.h"
+#include "m4/riddle/rooms/section9/room917.h"
+#include "m4/riddle/rooms/section9/room918.h"
+#include "m4/riddle/rooms/section9/room996.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section9 : public Section {
+private:
+ Room901 _room901;
+ Room902 _room902;
+ Room903 _room903;
+ Room905 _room905;
+ Room907 _room907;
+ Room908 _room908;
+ Room917 _room917;
+ Room918 _room918;
+ Room996 _room996;
+public:
+ Section9();
+ virtual ~Section9() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
index c8d919511ad..41449c085eb 100644
--- a/engines/m4/riddle/vars.cpp
+++ b/engines/m4/riddle/vars.cpp
@@ -39,15 +39,26 @@ Vars::~Vars() {
}
void Vars::main_cold_data_init() {
- // TODO
- initMouseSeries("cursor", nullptr);
-
- _kernel.first_fade = 32;
- _G(custom_ascii_converter) = custom_ascii_converter_proc;
+ _player.walker_loads_first = false;
+ _player.walker_visible = true;
+ _global_sound_room = 997;
+ _kernel.letter_box_y = 30;
+ _kernel.first_fade = 0;
+ _kernel.first_non_walker_cel_hash = 32;
+ _i_just_hyperwalked = false;
+ // val1 = 15;
+
+ conv_set_default_hv(6, 4);
+ // val2 = 1
+ _game.previous_room = 0;
+ _game.room_id = 0;
+
+ if (_game.new_room == 0)
+ _game.setRoom(901);
- _game.setRoom(101); /*****DEBUG*****/
-
- font_set_colors(2, 1, 3);
+ initMouseSeries("cursor", nullptr);
+ conv_set_default_text_colour(7, 8);
+ //exit_button_code
}
void Vars::global_menu_system_init() {
Commit: e32869893ea03cfe7bcbadb5f44c2f01ab247fa4
https://github.com/scummvm/scummvm/commit/e32869893ea03cfe7bcbadb5f44c2f01ab247fa4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added more initialization
Changed paths:
A engines/m4/riddle/hotkeys.cpp
A engines/m4/riddle/hotkeys.h
A engines/m4/riddle/inventory.cpp
A engines/m4/riddle/inventory.h
engines/m4/module.mk
engines/m4/riddle/vars.cpp
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 3392eda5d1e..876c732a556 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -191,6 +191,8 @@ MODULE_OBJS = \
riddle/rooms/section9/room918.o \
riddle/rooms/section9/room996.o \
riddle/riddle.o \
+ riddle/hotkeys.o \
+ riddle/inventory.o \
ridle/vars.o
diff --git a/engines/m4/riddle/hotkeys.cpp b/engines/m4/riddle/hotkeys.cpp
new file mode 100644
index 00000000000..894a47f7c51
--- /dev/null
+++ b/engines/m4/riddle/hotkeys.cpp
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/hotkeys.h"
+#include "m4/riddle/vars.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/adv_r/other.h"
+
+namespace M4 {
+namespace Riddle {
+
+void Hotkeys::add_hot_keys() {
+ M4::Hotkeys::add_hot_keys();
+
+ AddSystemHotkey('t', t_cb);
+ AddSystemHotkey('u', u_cb);
+ AddSystemHotkey('l', l_cb);
+ AddSystemHotkey('T', t_cb);
+ AddSystemHotkey('U', u_cb);
+ AddSystemHotkey('L', l_cb);
+
+ AddSystemHotkey('A', l_cb);
+ AddSystemHotkey('S', t_cb);
+ AddSystemHotkey('D', u_cb);
+ AddSystemHotkey('a', l_cb);
+ AddSystemHotkey('s', t_cb);
+ AddSystemHotkey('d', u_cb);
+
+ AddSystemHotkey('F', a_cb);
+ AddSystemHotkey('f', a_cb);
+}
+
+void Hotkeys::toggle_through_cursors() {
+ switch (_G(cursor_state)) {
+ case kARROW:
+ Hotkeys::l_cb(nullptr, nullptr);
+ break;
+ case kLOOK:
+ Hotkeys::t_cb(nullptr, nullptr);
+ break;
+ case kTAKE:
+ Hotkeys::u_cb(nullptr, nullptr);
+ break;
+ case kUSE:
+ Hotkeys::a_cb(nullptr, nullptr);
+ break;
+ default:
+ break;
+ }
+}
+
+void Hotkeys::escape_key_pressed(void *, void *) {
+}
+
+
+void Hotkeys::t_cb(void *, void *) {
+// g_vars->_interface.t_cb();
+}
+
+void Hotkeys::u_cb(void *, void *) {
+// g_vars->_interface.u_cb();
+}
+
+void Hotkeys::l_cb(void *, void *) {
+// g_vars->_interface.l_cb();
+}
+
+void Hotkeys::a_cb(void *, void *) {
+// g_vars->_interface.a_cb();
+}
+
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/hotkeys.h b/engines/m4/riddle/hotkeys.h
new file mode 100644
index 00000000000..ba8906d236e
--- /dev/null
+++ b/engines/m4/riddle/hotkeys.h
@@ -0,0 +1,53 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_HOTKEYS_H
+#define M4_RIDDLE_HOTKEYS_H
+
+#include "m4/m4_types.h"
+#include "m4/gui/hotkeys.h"
+
+namespace M4 {
+namespace Riddle {
+
+struct Hotkeys : public M4::Hotkeys {
+ static void t_cb(void *, void *);
+ static void u_cb(void *, void *);
+ static void l_cb(void *, void *);
+ static void a_cb(void *, void *);
+
+ /**
+ * Called when the Escape key is pressed
+ */
+ static void escape_key_pressed(void *, void *);
+
+ virtual ~Hotkeys() {}
+
+ void add_hot_keys() override;
+
+ void toggle_through_cursors() override;
+};
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/inventory.cpp b/engines/m4/riddle/inventory.cpp
new file mode 100644
index 00000000000..ce74f700355
--- /dev/null
+++ b/engines/m4/riddle/inventory.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/adv_r/adv_inv.h"
+#include "m4/riddle/inventory.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+
+struct InvObject {
+ const char *_name;
+ const char *_verbs;
+ int32 _scene, _cel, _cursor;
+};
+
+static const InvObject INVENTORY_ITEMS[] = {
+// { "mirror", "SPIEGEL", 999, 48, 48 },
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void Inventory::init() {
+ for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item) {
+ inv_register_thing(item->_name, item->_verbs, item->_scene, item->_cel, item->_cursor);
+
+ _items.push_back(InventoryItem(item->_name, item->_scene));
+ }
+}
+
+void Inventory::add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) {
+#ifdef TODO
+ _GI(inventory)->add(name, verb, sprite, cursor);
+ _GI(inventory)->_must_redraw_all = true;
+#endif
+}
+
+void Inventory::set_scroll(int32 scroll) {
+#ifdef TODO
+ _GI(inventory)->set_scroll(scroll);
+#endif
+}
+
+void Inventory::remove(const Common::String &name) {
+#ifdef TODO
+ _GI(inventory)->remove(name);
+ _GI(inventory)->_must_redraw_all = true;
+#endif
+}
+
+void Inventory::reset() {
+ for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item)
+ inv_move_object(item->_name, item->_scene);
+}
+
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/inventory.h b/engines/m4/riddle/inventory.h
new file mode 100644
index 00000000000..ab7129d55da
--- /dev/null
+++ b/engines/m4/riddle/inventory.h
@@ -0,0 +1,57 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_INVENTORY_H
+#define M4_RIDDLE_INVENTORY_H
+
+#include "common/array.h"
+#include "m4/m4_types.h"
+#include "m4/adv_r/adv_inv.h"
+
+namespace M4 {
+namespace Riddle {
+
+struct InventoryItem {
+ const char *_asset = nullptr;
+ const char *_name = nullptr;
+ int _scene = 0;
+
+ InventoryItem() {}
+ InventoryItem(const char *name, int scene) : _asset(name), _name(name), _scene(scene) {}
+};
+
+struct Inventory : public InventoryBase {
+public:
+ Common::Array<InventoryItem> _items;
+public:
+ void init();
+
+ void add(const Common::String &name, const Common::String &verbs, int32 sprite, int32 cursor) override;
+ void set_scroll(int32 scroll) override;
+ void remove(const Common::String &name) override;
+ void reset();
+};
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
index 41449c085eb..6275feee535 100644
--- a/engines/m4/riddle/vars.cpp
+++ b/engines/m4/riddle/vars.cpp
@@ -22,6 +22,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "m4/riddle/vars.h"
+#include "m4/riddle/inventory.h"
#include "m4/gui/gui_vmng.h"
namespace M4 {
@@ -31,6 +32,9 @@ Vars *g_vars;
Vars::Vars() {
g_vars = this;
+
+ Inventory *inv = new Inventory();
+ _inventory = inv;
}
Vars::~Vars() {
@@ -126,8 +130,9 @@ void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
}
void Vars::custom_ascii_converter_proc(char *string) {
+ /*
char *str;
-/*
+
for (const auto *entry = ASCII_CONVERTERS; entry->_find; entry++) {
while ((str = strstr(string, entry->_find)) != nullptr)
*str = entry->_replace;
Commit: df55d6d69ec20d9aa3fdd564d0962ccb608daf18
https://github.com/scummvm/scummvm/commit/df55d6d69ec20d9aa3fdd564d0962ccb608daf18
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of MineRoom base class
Changed paths:
A engines/m4/burger/rooms/section3/mine.cpp
A engines/m4/burger/rooms/section3/mine.h
A engines/m4/burger/rooms/section3/mine_room.cpp
A engines/m4/burger/rooms/section3/mine_room.h
R engines/m4/burger/rooms/section3/room319.cpp
R engines/m4/burger/rooms/section3/room319.h
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room305.h
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/burger/rooms/section3/section3.cpp
engines/m4/burger/rooms/section3/section3.h
engines/m4/burger/rooms/section3/section3_room.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section3/room319.cpp b/engines/m4/burger/rooms/section3/mine.cpp
similarity index 91%
rename from engines/m4/burger/rooms/section3/room319.cpp
rename to engines/m4/burger/rooms/section3/mine.cpp
index d4e2e799ecd..9a6594bf4d2 100644
--- a/engines/m4/burger/rooms/section3/room319.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -19,17 +19,17 @@
*
*/
-#include "m4/burger/rooms/section3/room319.h"
+#include "m4/burger/rooms/section3/mine.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-void Room319::init() {
+void Mine::init() {
}
-void Room319::daemon() {
+void Mine::daemon() {
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room319.h b/engines/m4/burger/rooms/section3/mine.h
similarity index 83%
rename from engines/m4/burger/rooms/section3/room319.h
rename to engines/m4/burger/rooms/section3/mine.h
index 88e1fbf005b..3bca03a4c6d 100644
--- a/engines/m4/burger/rooms/section3/room319.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -19,24 +19,24 @@
*
*/
-#ifndef M4_BURGER_ROOMS_SECTION3_ROOM319_H
-#define M4_BURGER_ROOMS_SECTION3_ROOM319_H
+#ifndef M4_BURGER_ROOMS_SECTION3_MINE_H
+#define M4_BURGER_ROOMS_SECTION3_MINE_H
-#include "m4/burger/rooms/section3/section3_room.h"
+#include "m4/burger/rooms/section3/mine_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room319 : public Section3Room {
+class Mine : public MineRoom {
protected:
const char *getDigi() override {
return "300_004";
}
public:
- Room319() : Section3Room() {}
- ~Room319() override {}
+ Mine() : MineRoom() {}
+ ~Mine() override {}
void init() override;
void daemon() override;
diff --git a/engines/m4/burger/rooms/section3/mine_room.cpp b/engines/m4/burger/rooms/section3/mine_room.cpp
new file mode 100644
index 00000000000..461d7e836fa
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/mine_room.cpp
@@ -0,0 +1,106 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section3/mine_room.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+#define MINE_END 39
+
+const MineEntry MineRoom::MINE_DATA[] = {
+ { 0, 0 }
+};
+
+const char *MineRoom::SAID[][4] = {
+ { "TUNNEL", "311w007", "311w007z", nullptr },
+ { "DEBRIS", nullptr, "311w010", "311w011" },
+ { "GROUND", "311w012", "311w007z", "311w007z" },
+ { "WALL", "311w012", "311w007z", "311w007z" },
+ { "CEILING", "311w012", "311w007z", "311w007z" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
+void MineRoom::preload() {
+ Section3Room::preload();
+ _mineCtr = 0;
+}
+
+void MineRoom::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
+ term_message("Room #: %d", _G(flags)[V149]);
+ term_message("Distance from pig: %d", getPigDistance());
+
+ _mineCtr = (_mineCtr + 1) % 5;
+
+ if (_mineCtr == 0) {
+ wilbur_speech("311w012");
+ _G(player).command_ready = false;
+ return;
+ }
+ }
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
+ pal_fade_set_start(0);
+
+ if (_G(hotspot_y) > 300)
+ changeRoom(DIR_SOUTH);
+ else if (_G(hotspot_x) < 200)
+ changeRoom(DIR_WEST);
+ else if (_G(hotspot_x) > 400)
+ changeRoom(DIR_EAST);
+ else
+ changeRoom(DIR_NORTH);
+ } else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
+ _G(wilbur_should) = 407;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+int MineRoom::getPigDistance() const {
+ int distance = 0;
+
+ for (int index = _G(flags)[V149]; index != MINE_END; ++distance) {
+ const MineEntry &me = MINE_DATA[index];
+ index = me._indexes[me._offset];
+ }
+
+ return distance;
+}
+
+void MineRoom::changeRoom(MineDirection dir) {
+ error("TODO: MineRoom::changeRoom");
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/mine_room.h b/engines/m4/burger/rooms/section3/mine_room.h
new file mode 100644
index 00000000000..e96e1e6a0d0
--- /dev/null
+++ b/engines/m4/burger/rooms/section3/mine_room.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
+#define M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
+
+#include "m4/burger/rooms/section3/section3_room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+enum MineDirection {
+ DIR_NORTH = 0, DIR_SOUTH = 1, DIR_WEST = 2, DIR_EAST = 3
+};
+
+struct MineEntry {
+ int32 _unknown;
+ int16 _indexes[7];
+ int32 _offset;
+ int16 _field16;
+};
+
+class MineRoom : public Section3Room {
+private:
+ static const MineEntry MINE_DATA[];
+ static const char *SAID[][4];
+ int _mineCtr = 0;
+
+ int getPigDistance() const;
+ void changeRoom(MineDirection dir);
+
+public:
+ MineRoom() : Section3Room() {}
+ virtual ~MineRoom() {}
+
+ void preload() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index cb449a64fa8..72521b702a2 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -108,6 +108,11 @@ void Room305::init() {
void Room305::daemon() {
}
+void Room305::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
index 14c9a624927..da0552f6afe 100644
--- a/engines/m4/burger/rooms/section3/room305.h
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM305_H
#define M4_BURGER_ROOMS_SECTION3_ROOM305_H
-#include "m4/burger/rooms/section3/section3_room.h"
+#include "m4/burger/rooms/section3/mine_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room305 : public Section3Room {
+class Room305 : public MineRoom {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -42,11 +42,12 @@ protected:
}
public:
- Room305() : Section3Room() {}
+ Room305() : MineRoom() {}
~Room305() override {}
void init() override;
void daemon() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 6a12f539c2f..99d92a31b1e 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -77,7 +77,7 @@ const seriesPlayBreak Room310::PLAY6[] = {
long Room310::_state1;
-Room310::Room310() : Section3Room() {
+Room310::Room310() : MineRoom() {
_state1 = 0;
}
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index 7c44acde634..7572e537fcd 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM310_H
#define M4_BURGER_ROOMS_SECTION3_ROOM310_H
-#include "m4/burger/rooms/section3/section3_room.h"
+#include "m4/burger/rooms/section3/mine_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room310 : public Section3Room {
+class Room310 : public MineRoom {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index a2de784fa9f..72e16335db5 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -45,7 +45,15 @@ Section3::Section3() : Rooms::Section() {
add(306, &_room306);
add(307, &_room307);
add(310, &_room310);
- add(319, &_room319);
+ add(311, &_mine);
+ add(312, &_mine);
+ add(313, &_mine);
+ add(314, &_mine);
+ add(315, &_mine);
+ add(316, &_mine);
+ add(317, &_mine);
+ add(318, &_mine);
+ add(319, &_mine);
}
void Section3::daemon() {
diff --git a/engines/m4/burger/rooms/section3/section3.h b/engines/m4/burger/rooms/section3/section3.h
index a09454b4880..e506c1a6630 100644
--- a/engines/m4/burger/rooms/section3/section3.h
+++ b/engines/m4/burger/rooms/section3/section3.h
@@ -32,7 +32,7 @@
#include "m4/burger/rooms/section3/room306.h"
#include "m4/burger/rooms/section3/room307.h"
#include "m4/burger/rooms/section3/room310.h"
-#include "m4/burger/rooms/section3/room319.h"
+#include "m4/burger/rooms/section3/mine.h"
namespace M4 {
namespace Burger {
@@ -48,7 +48,7 @@ private:
Room306 _room306;
Room307 _room307;
Room310 _room310;
- Room319 _room319;
+ Mine _mine;
public:
Section3();
diff --git a/engines/m4/burger/rooms/section3/section3_room.h b/engines/m4/burger/rooms/section3/section3_room.h
index 92d6d72fb59..a33140c3427 100644
--- a/engines/m4/burger/rooms/section3/section3_room.h
+++ b/engines/m4/burger/rooms/section3/section3_room.h
@@ -43,7 +43,7 @@ protected:
void set_palette_brightness(int percent);
public:
- Section3Room() {}
+ Section3Room() : Rooms::Room() {}
virtual ~Section3Room() {}
void preload() override;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 876c732a556..276cec7ccdf 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -116,6 +116,7 @@ MODULE_OBJS = \
burger/rooms/section2/room207.o \
burger/rooms/section3/section3.o \
burger/rooms/section3/section3_room.o \
+ burger/rooms/section3/mine_room.o \
burger/rooms/section3/room301.o \
burger/rooms/section3/room302.o \
burger/rooms/section3/room303.o \
@@ -124,7 +125,7 @@ MODULE_OBJS = \
burger/rooms/section3/room306.o \
burger/rooms/section3/room307.o \
burger/rooms/section3/room310.o \
- burger/rooms/section3/room319.o \
+ burger/rooms/section3/mine.o \
burger/rooms/section4/section4.o \
burger/rooms/section4/room401.o \
burger/rooms/section4/room402.o \
Commit: 6509f6aed19e0f72146e310fa91a5c204eb323a0
https://github.com/scummvm/scummvm/commit/6509f6aed19e0f72146e310fa91a5c204eb323a0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 305
Changed paths:
engines/m4/burger/rooms/section3/mine_room.h
engines/m4/burger/rooms/section3/room305.cpp
diff --git a/engines/m4/burger/rooms/section3/mine_room.h b/engines/m4/burger/rooms/section3/mine_room.h
index e96e1e6a0d0..389fb53d129 100644
--- a/engines/m4/burger/rooms/section3/mine_room.h
+++ b/engines/m4/burger/rooms/section3/mine_room.h
@@ -46,6 +46,8 @@ private:
int _mineCtr = 0;
int getPigDistance() const;
+
+protected:
void changeRoom(MineDirection dir);
public:
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index 72521b702a2..dd6b01ec496 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -106,11 +106,163 @@ void Room305::init() {
}
void Room305::daemon() {
+ MineRoom::daemon();
+ if (!_G(kernel).continue_handling_trigger)
+ return;
+ _G(kernel).continue_handling_trigger = false;
+
+ switch (_G(kernel).trigger) {
+ case 100:
+ _series1 = series_show("305genx", 0x200);
+ _G(flags)[V134] = 1;
+ _G(wilbur_should) = 105;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 3001:
+ _G(game).new_room = 302;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 101:
+ ws_demand_location(372, 267, 9);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+
+ if (_G(flags)[V133]) {
+ _G(wilbur_should) = 10001;
+ } else {
+ _G(flags)[V133] = 1;
+ _G(wilbur_should) = 104;
+ }
+
+ series_play_with_breaks(PLAY1, "305wi01", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 102:
+ player_set_commands_allowed(false);
+ ws_demand_location(375, 280, 2);
+ ws_hide_walker();
+ series_play_with_breaks(PLAY2, "305wi02", 0x700, -1, 3);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 60, 3001);
+ break;
+
+ case 103:
+ hotspot_set_active("DARKNESS", false);
+ hotspot_set_active("MINE", true);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ terminateMachineAndNull(_series1);
+ series_stream_with_breaks(SERIES1, "305wi04", 6, 0x200, 100);
+ break;
+
+ case 104:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ wilbur_speech("305w001");
+ break;
+
+ case 105:
+ ws_unhide_walker();
+
+ if (_G(flags)[V135]) {
+ _G(wilbur_should) = 106;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _G(flags)[V135] = 1;
+ _G(wilbur_should) = 106;
+ wilbur_speech("305w011", gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 106:
+ _G(wilbur_should) = 10001;
+ wilbur_speech(_G(flags)[V137] ? "305w013" : "305w012", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 107:
+ _G(wilbur_should) = 10001;
+ wilbur_speech("305w012", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 108:
+ changeRoom(DIR_NORTH);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room305::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
+ // Handle any generic mine stuff
+ MineRoom::parser();
+ if (!_G(player).command_ready)
+ // Already handled
+ return;
+
+ // Check for standard actions
+ if (_G(walker).wilbur_said(SAID)) {
+ // Handled
+ } else if (player_said("climb", "stairs") || player_said("GEAR", "STAIRS")) {
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(102);
+ } else if (player_said("ENTER", "MINE") || player_said("ENTER", "DARKNESS")) {
+ player_set_commands_allowed(false);
+
+ if (!_G(flags)[V124]) {
+ player_set_commands_allowed(true);
+ wilbur_speech("305w004");
+ } else {
+ _G(wilbur_should) = 108;
+
+ if (_G(flags)[V137]) {
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ wilbur_speech("305w005");
+ }
+ }
+ } else if (player_said("DISTILLED CARROT JUICE", "GENERATOR")) {
+ wilbur_speech(_G(flags)[V134] ? "300w037" : "300w036");
+ } else if (player_said("CARROT JUICE", "GENERATOR")) {
+ wilbur_speech(_G(flags)[V134] ? "300w054" : "300w053");
+ } else if (player_said_any("CARROT JUICE", "DISTILLED CARROT JUICE") &&
+ player_said("BARREL")) {
+ wilbur_speech("300w038");
+ } else if (player_said("LOOK AT", "GENERATOR")) {
+ wilbur_speech(_G(flags)[V134] ? "300w007" : "300w006");
+ } else if (player_said("MATCHES", "GENERATOR")) {
+ wilbur_speech(_G(flags)[V134] ? "300w022" : "300w021");
+ } else if (player_said("LOOK AT", "DEBRIS")) {
+ if (!_G(flags)[V136]) {
+ _G(flags)[V136] = 1;
+ wilbur_speech("305w019");
+ } else {
+ wilbur_speech(Common::String::format("305w020%c",
+ 'a' + imath_ranged_rand(0, 6)).c_str());
+ }
+ } else if (player_said("GEAR", "GENERATOR")) {
+ if (_G(flags)[V134]) {
+ wilbur_speech("305w014");
+ } else {
+ _G(wilbur_should) = 103;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (!player_said("LOOK AT WALL")) {
+ return;
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
Commit: fcbdd6f84730a26c109f7ae04198d8296981fd36
https://github.com/scummvm/scummvm/commit/fcbdd6f84730a26c109f7ae04198d8296981fd36
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merge MineRoom and Mine classes
Changed paths:
R engines/m4/burger/rooms/section3/mine_room.cpp
R engines/m4/burger/rooms/section3/mine_room.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room305.h
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 9a6594bf4d2..5dcdea784b5 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -15,7 +15,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/ },.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@@ -26,10 +26,92 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Mine::init() {
+#define MINE_END 39
+
+const MineEntry Mine::MINE_DATA[] = {
+ { 0, 0 }
+};
+
+const char *Mine::SAID[][4] = {
+ { "TUNNEL", "311w007", "311w007z", nullptr },
+ { "DEBRIS", nullptr, "311w010", "311w011" },
+ { "GROUND", "311w012", "311w007z", "311w007z" },
+ { "WALL", "311w012", "311w007z", "311w007z" },
+ { "CEILING", "311w012", "311w007z", "311w007z" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+
+void Mine::preload() {
+ Section3Room::preload();
+ _mineCtr = 0;
}
void Mine::daemon() {
+ switch (_G(kernel).trigger) {
+ case 304:
+ digi_play("300_007", 2);
+ break;
+
+ // TODO: Further cases
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Mine::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
+ term_message("Room #: %d", _G(flags)[V149]);
+ term_message("Distance from pig: %d", getPigDistance());
+
+ _mineCtr = (_mineCtr + 1) % 5;
+
+ if (_mineCtr == 0) {
+ wilbur_speech("311w012");
+ _G(player).command_ready = false;
+ return;
+ }
+ }
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
+ pal_fade_set_start(0);
+
+ if (_G(hotspot_y) > 300)
+ changeRoom(DIR_SOUTH);
+ else if (_G(hotspot_x) < 200)
+ changeRoom(DIR_WEST);
+ else if (_G(hotspot_x) > 400)
+ changeRoom(DIR_EAST);
+ else
+ changeRoom(DIR_NORTH);
+ } else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
+ _G(wilbur_should) = 407;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+int Mine::getPigDistance() const {
+ int distance = 0;
+
+ for (int index = _G(flags)[V149]; index != MINE_END; ++distance) {
+ const MineEntry &me = MINE_DATA[index];
+ index = me._indexes[me._offset];
+ }
+
+ return distance;
+}
+
+void Mine::changeRoom(MineDirection dir) {
+ error("TODO: Mine::changeRoom");
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 3bca03a4c6d..8a876e71e54 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -19,27 +19,48 @@
*
*/
-#ifndef M4_BURGER_ROOMS_SECTION3_MINE_H
-#define M4_BURGER_ROOMS_SECTION3_MINE_H
+#ifndef M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
+#define M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
-#include "m4/burger/rooms/section3/mine_room.h"
+#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Mine : public MineRoom {
+enum MineDirection {
+ DIR_NORTH = 0, DIR_SOUTH = 1, DIR_WEST = 2, DIR_EAST = 3
+};
+
+struct MineEntry {
+ int32 _unknown;
+ int16 _indexes[7];
+ int32 _offset;
+ int16 _field16;
+};
+
+class Mine : public Section3Room {
+private:
+ static const MineEntry MINE_DATA[];
+ static const char *SAID[][4];
+ int _mineCtr = 0;
+
+ int getPigDistance() const;
+
protected:
const char *getDigi() override {
return "300_004";
}
+ void changeRoom(MineDirection dir);
+
public:
- Mine() : MineRoom() {}
- ~Mine() override {}
+ Mine() : Section3Room() {}
+ virtual ~Mine() {}
- void init() override;
+ void preload() override;
void daemon() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/mine_room.cpp b/engines/m4/burger/rooms/section3/mine_room.cpp
deleted file mode 100644
index 461d7e836fa..00000000000
--- a/engines/m4/burger/rooms/section3/mine_room.cpp
+++ /dev/null
@@ -1,106 +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/>.
- *
- */
-
-#include "m4/burger/rooms/section3/mine_room.h"
-#include "m4/burger/vars.h"
-
-namespace M4 {
-namespace Burger {
-namespace Rooms {
-
-#define MINE_END 39
-
-const MineEntry MineRoom::MINE_DATA[] = {
- { 0, 0 }
-};
-
-const char *MineRoom::SAID[][4] = {
- { "TUNNEL", "311w007", "311w007z", nullptr },
- { "DEBRIS", nullptr, "311w010", "311w011" },
- { "GROUND", "311w012", "311w007z", "311w007z" },
- { "WALL", "311w012", "311w007z", "311w007z" },
- { "CEILING", "311w012", "311w007z", "311w007z" },
- { nullptr, nullptr, nullptr, nullptr }
-};
-
-
-void MineRoom::preload() {
- Section3Room::preload();
- _mineCtr = 0;
-}
-
-void MineRoom::parser() {
- _G(kernel).trigger_mode = KT_DAEMON;
-
- if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
- term_message("Room #: %d", _G(flags)[V149]);
- term_message("Distance from pig: %d", getPigDistance());
-
- _mineCtr = (_mineCtr + 1) % 5;
-
- if (_mineCtr == 0) {
- wilbur_speech("311w012");
- _G(player).command_ready = false;
- return;
- }
- }
-
- if (_G(walker).wilbur_said(SAID)) {
- // Already handled
- } else if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
- pal_fade_set_start(0);
-
- if (_G(hotspot_y) > 300)
- changeRoom(DIR_SOUTH);
- else if (_G(hotspot_x) < 200)
- changeRoom(DIR_WEST);
- else if (_G(hotspot_x) > 400)
- changeRoom(DIR_EAST);
- else
- changeRoom(DIR_NORTH);
- } else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
- _G(wilbur_should) = 407;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
- } else {
- return;
- }
-
- _G(player).command_ready = false;
-}
-
-int MineRoom::getPigDistance() const {
- int distance = 0;
-
- for (int index = _G(flags)[V149]; index != MINE_END; ++distance) {
- const MineEntry &me = MINE_DATA[index];
- index = me._indexes[me._offset];
- }
-
- return distance;
-}
-
-void MineRoom::changeRoom(MineDirection dir) {
- error("TODO: MineRoom::changeRoom");
-}
-
-} // namespace Rooms
-} // namespace Burger
-} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/mine_room.h b/engines/m4/burger/rooms/section3/mine_room.h
deleted file mode 100644
index 389fb53d129..00000000000
--- a/engines/m4/burger/rooms/section3/mine_room.h
+++ /dev/null
@@ -1,65 +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/>.
- *
- */
-
-#ifndef M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
-#define M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
-
-#include "m4/burger/rooms/section3/section3_room.h"
-
-namespace M4 {
-namespace Burger {
-namespace Rooms {
-
-enum MineDirection {
- DIR_NORTH = 0, DIR_SOUTH = 1, DIR_WEST = 2, DIR_EAST = 3
-};
-
-struct MineEntry {
- int32 _unknown;
- int16 _indexes[7];
- int32 _offset;
- int16 _field16;
-};
-
-class MineRoom : public Section3Room {
-private:
- static const MineEntry MINE_DATA[];
- static const char *SAID[][4];
- int _mineCtr = 0;
-
- int getPigDistance() const;
-
-protected:
- void changeRoom(MineDirection dir);
-
-public:
- MineRoom() : Section3Room() {}
- virtual ~MineRoom() {}
-
- void preload() override;
- void parser() override;
-};
-
-} // namespace Rooms
-} // namespace Burger
-} // namespace M4
-
-#endif
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index dd6b01ec496..c7da8c2fe1c 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -106,7 +106,7 @@ void Room305::init() {
}
void Room305::daemon() {
- MineRoom::daemon();
+ Mine::daemon();
if (!_G(kernel).continue_handling_trigger)
return;
_G(kernel).continue_handling_trigger = false;
@@ -206,7 +206,7 @@ void Room305::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
// Handle any generic mine stuff
- MineRoom::parser();
+ Mine::parser();
if (!_G(player).command_ready)
// Already handled
return;
diff --git a/engines/m4/burger/rooms/section3/room305.h b/engines/m4/burger/rooms/section3/room305.h
index da0552f6afe..ed198ace879 100644
--- a/engines/m4/burger/rooms/section3/room305.h
+++ b/engines/m4/burger/rooms/section3/room305.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM305_H
#define M4_BURGER_ROOMS_SECTION3_ROOM305_H
-#include "m4/burger/rooms/section3/mine_room.h"
+#include "m4/burger/rooms/section3/mine.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room305 : public MineRoom {
+class Room305 : public Mine {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -42,7 +42,7 @@ protected:
}
public:
- Room305() : MineRoom() {}
+ Room305() : Mine() {}
~Room305() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 99d92a31b1e..043d3749c3a 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -77,7 +77,7 @@ const seriesPlayBreak Room310::PLAY6[] = {
long Room310::_state1;
-Room310::Room310() : MineRoom() {
+Room310::Room310() : Mine() {
_state1 = 0;
}
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index 7572e537fcd..6216ee671f6 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM310_H
#define M4_BURGER_ROOMS_SECTION3_ROOM310_H
-#include "m4/burger/rooms/section3/mine_room.h"
+#include "m4/burger/rooms/section3/mine.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room310 : public MineRoom {
+class Room310 : public Mine {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 276cec7ccdf..40f87a3fca6 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -116,7 +116,7 @@ MODULE_OBJS = \
burger/rooms/section2/room207.o \
burger/rooms/section3/section3.o \
burger/rooms/section3/section3_room.o \
- burger/rooms/section3/mine_room.o \
+ burger/rooms/section3/mine.o \
burger/rooms/section3/room301.o \
burger/rooms/section3/room302.o \
burger/rooms/section3/room303.o \
@@ -125,7 +125,6 @@ MODULE_OBJS = \
burger/rooms/section3/room306.o \
burger/rooms/section3/room307.o \
burger/rooms/section3/room310.o \
- burger/rooms/section3/mine.o \
burger/rooms/section4/section4.o \
burger/rooms/section4/room401.o \
burger/rooms/section4/room402.o \
Commit: 0dd7df46ce08f7f6f3d405a6fc7cc182349f5782
https://github.com/scummvm/scummvm/commit/0dd7df46ce08f7f6f3d405a6fc7cc182349f5782
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding Mine parser methods and support
Changed paths:
engines/m4/adv_r/adv_player.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/walker.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index fe2fd27b16c..45c1e73e9ad 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -206,7 +206,7 @@ PlayerInfo *player_update_info() {
}
void player_set_facing_hotspot(int trigger) {
- player_set_facing_at(trigger, _G(hotspot_x), _G(hotspot_y));
+ player_set_facing_at(trigger, _G(click_x), _G(click_y));
}
void player_set_facing_at(int x, int y, int trigger) {
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index f2582505a42..7772de2c9fb 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -396,8 +396,8 @@ ControlStatus Interface::trackHotspots(int event, int x, int y) {
if (event == 5 && hotspot) {
_G(player).walk_x = x;
_G(player).walk_y = y;
- _G(hotspot_x) = x;
- _G(hotspot_y) = y;
+ _G(click_x) = x;
+ _G(click_y) = y;
if (hotspot) {
if (hotspot->feet_x != 0x7fff)
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 33a0b291eec..0eafc68b010 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -631,7 +631,7 @@ void Room142::pre_parser() {
if (_G(flags)[V000] == 1003 &&
_G(player).walk_x >= 230 && _G(player).walk_x <= 294 &&
_G(player).walk_y >= 250 && _G(player).walk_y <= 277) {
- player_hotspot_walk_override(_G(hotspot_x), 278);
+ player_hotspot_walk_override(_G(click_x), 278);
} else if (player_said_any("GEAR", "LOOK AT")) {
if (player_said("MAIN STREET")) {
player_hotspot_walk_override(_G(player).walk_x, 400);
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 0abbe5b4798..0bc40e1543c 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -645,7 +645,7 @@ void Room171::pre_parser() {
if ((_val1 == 10019 || _val1 == 10020) &&
_G(player).walk_x > 378 && _G(player).walk_x <= 518 &&
_G(player).walk_y >= 300 && _G(player).walk_y <= 354) {
- player_walk_to(_G(hotspot_x), 355);
+ player_walk_to(_G(click_x), 355);
}
if (player_said("GEAR") && player_said("FRONT DOOR")) {
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 5dcdea784b5..bb14c394aaa 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -28,10 +28,6 @@ namespace Rooms {
#define MINE_END 39
-const MineEntry Mine::MINE_DATA[] = {
- { 0, 0 }
-};
-
const char *Mine::SAID[][4] = {
{ "TUNNEL", "311w007", "311w007z", nullptr },
{ "DEBRIS", nullptr, "311w010", "311w011" },
@@ -41,6 +37,84 @@ const char *Mine::SAID[][4] = {
{ nullptr, nullptr, nullptr, nullptr }
};
+const int16 Mine::MINE_SCENE_NUMBERS[] = {
+ 305, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319
+};
+
+const MineRoom Mine::MINE_INFO[] = {
+ // Links Doors
+ // --------------------- -------------------------- Correct
+ // Room# Scene ID Back Front Left Right Back Front Left Right Link Check
+ // ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ------- -----
+ 0, SCENE_305, 6, -1, -1, -1, FRONT, NONE, NONE, NONE, BACK, 0, // mine entrance
+ 1, SCENE_313, -1, -1, 2, 6, NONE, NONE, RIGHT, LEFT, RIGHT, 0,
+ 2, SCENE_316, -1, 11, 13, 1, NONE, BACK, RIGHT, LEFT, LEFT, 0,
+ 3, SCENE_318, 9, 14, 5, 4, FRONT, BACK, RIGHT, LEFT, FRONT, 0,
+ 4, SCENE_315, 5, -1, 3, 10, FRONT, NONE, RIGHT, LEFT, LEFT, 0,
+ 5, SCENE_317, 18, 4, 9, 3, FRONT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 6, SCENE_318, 11, 0, 1, 7, FRONT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 7, SCENE_317, 13, 14, 6, 18, FRONT, RIGHT, RIGHT, LEFT, FRONT, 0,
+ 8, SCENE_313, -1, -1, 10, 9, NONE, NONE, RIGHT, LEFT, RIGHT, 0,
+ 9, SCENE_318, 10, 3, 8, 5, FRONT, BACK, RIGHT, LEFT, FRONT, 0,
+ // ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ---- -----
+ 10, SCENE_316, -1, 9, 4, 8, NONE, BACK, RIGHT, LEFT, LEFT, 0,
+ 11, SCENE_317, 2, 6, 11, 11, FRONT, BACK, RIGHT, LEFT, FRONT, 0,
+ 12, SCENE_319, -1, -1, -1, 13, NONE, NONE, NONE, LEFT, RIGHT, 0,
+ 13, SCENE_316, -1, 7, 12, 2, NONE, BACK, RIGHT, LEFT, FRONT, 0,
+ 14, SCENE_315, 3, -1, 26, 7, FRONT, NONE, BACK, FRONT, LEFT, 0,
+ 15, SCENE_317, 17, 16, 17, 20, FRONT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 16, SCENE_311, 15, -1, -1, -1, FRONT, NONE, NONE, NONE, BACK, 0,
+ 17, SCENE_318, 22, 15, 20, 15, FRONT, BACK, RIGHT, LEFT, LEFT, 0,
+ 18, SCENE_316, -1, 5, 7, 19, NONE, BACK, RIGHT, LEFT, LEFT, 0,
+ 19, SCENE_312, -1, -1, 18, -1, NONE, NONE, RIGHT, NONE, LEFT, 0,
+ // ----- ---------- ---- ----- ---- ----- ----- ----- ------ ----- ---- -----
+ 20, SCENE_315, 26, -1, 15, 17, FRONT, NONE, RIGHT, LEFT, BACK, 0,
+ 21, SCENE_319, -1, -1, -1, 22, NONE, NONE, NONE, LEFT, RIGHT, 0,
+ 22, SCENE_316, -1, 17, 21, 23, NONE, BACK, RIGHT, LEFT, FRONT, 0,
+ 23, SCENE_312, -1, -1, 22, -1, NONE, NONE, RIGHT, NONE, LEFT, 0,
+ 24, SCENE_318, 35, 29, 33, 25, FRONT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 25, SCENE_314, -1, -1, 24, 26, NONE, NONE, RIGHT, LEFT, RIGHT, 0,
+ 26, SCENE_317, 14, 20, 25, 38, LEFT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 27, SCENE_318, 38, 38, 37, 28, FRONT, BACK, RIGHT, LEFT, BACK, 0,
+ 28, SCENE_312, -1, -1, 27, -1, NONE, NONE, RIGHT, NONE, LEFT, 0,
+ 29, SCENE_317, 24, 30, 35, 31, FRONT, BACK, RIGHT, LEFT, BACK, 0,
+ // ----- ---------- ---- ----- ---- ----- ----- ----- ------ ----- ---- -----
+ 30, SCENE_311, 29, -1, -1, -1, FRONT, NONE, NONE, NONE, BACK, 0,
+ 31, SCENE_312, -1, -1, 29, -1, NONE, NONE, RIGHT, NONE, LEFT, 0,
+ 32, SCENE_319, -1, -1, -1, 33, NONE, NONE, NONE, LEFT, RIGHT, 0,
+ 33, SCENE_314, -1, -1, 32, 24, NONE, NONE, RIGHT, LEFT, RIGHT, 0,
+ 34, SCENE_319, -1, -1, -1, 35, NONE, NONE, NONE, LEFT, RIGHT, 0,
+ 35, SCENE_316, -1, 24, 34, 29, NONE, BACK, RIGHT, LEFT, FRONT, 0,
+ 36, SCENE_319, -1, -1, -1, 37, NONE, NONE, NONE, LEFT, RIGHT, 0,
+ 37, SCENE_314, -1, -1, 36, 27, NONE, NONE, RIGHT, LEFT, RIGHT, 0,
+ 38, SCENE_318, 27, 27, 26, 39, FRONT, BACK, RIGHT, LEFT, RIGHT, 0,
+ 39, SCENE_310, -1, -1, 38, -1, NONE, NONE, RIGHT, NONE, NONE, 0, // treasure
+ // ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ------- -----
+ 40, NO_SCENE, -1, -1, -1, -1, NONE, NONE, NONE, NONE, NONE, 0
+};
+
+/**
+ * Coords for starting fade down for exits
+ */
+Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
+ //
+ // ( x1, y1, x2, y2) for four directions
+ //
+ // Back Front Left Right
+ //------------------- ------------------- ------------------- -------------------
+ 255, 0, 315, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 305
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 270, 0, 0, 0, 0, // 310
+ 270, 0, 365, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 311
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 268, 0, 0, 0, 0, // 312
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 256, 470, 0, 639, 265, // 313
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 265, 470, 0, 639, 280, // 314
+ 280, 0, 365, 245, 0, 0, 0, 0, 0, 0, 165, 257, 470, 0, 639, 271, // 315
+ 0, 0, 0, 0, 325, 350, 500, 374, 0, 0, 178, 265, 470, 0, 639, 265, // 316
+ 275, 0, 365, 255, 136, 344, 360, 374, 0, 0, 165, 268, 470, 0, 639, 270, // 317
+ 275, 0, 365, 252, 185, 344, 500, 374, 0, 0, 165, 265, 470, 0, 639, 270, // 318
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 0, 639, 270 // 319
+};
+
void Mine::preload() {
Section3Room::preload();
@@ -60,12 +134,30 @@ void Mine::daemon() {
}
}
+void Mine::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
+ if (_G(click_y) > 300)
+ set_fade_down_rect(FRONT);
+ else if (_G(click_x) < 200)
+ set_fade_down_rect(LEFT);
+ else if (_G(click_x) < 400)
+ set_fade_down_rect(BACK);
+ else
+ set_fade_down_rect(RIGHT);
+
+ // Turn on the fade down area
+ _fade_down_rect_active = true;
+ }
+}
+
void Mine::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
term_message("Room #: %d", _G(flags)[V149]);
- term_message("Distance from pig: %d", getPigDistance());
+ term_message("Distance from pig: %d", getTreasureDistance());
_mineCtr = (_mineCtr + 1) % 5;
@@ -81,14 +173,14 @@ void Mine::parser() {
} else if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
pal_fade_set_start(0);
- if (_G(hotspot_y) > 300)
- changeRoom(DIR_SOUTH);
- else if (_G(hotspot_x) < 200)
- changeRoom(DIR_WEST);
- else if (_G(hotspot_x) > 400)
- changeRoom(DIR_EAST);
+ if (_G(click_y) > 300)
+ mine_travel_link(FRONT);
+ else if (_G(click_x) < 200)
+ mine_travel_link(LEFT);
+ else if (_G(click_x) > 400)
+ mine_travel_link(RIGHT);
else
- changeRoom(DIR_NORTH);
+ mine_travel_link(BACK);
} else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
_G(wilbur_should) = 407;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
@@ -99,21 +191,36 @@ void Mine::parser() {
_G(player).command_ready = false;
}
-int Mine::getPigDistance() const {
+int Mine::getTreasureDistance() const {
int distance = 0;
for (int index = _G(flags)[V149]; index != MINE_END; ++distance) {
- const MineEntry &me = MINE_DATA[index];
- index = me._indexes[me._offset];
+ const MineRoom &me = MINE_INFO[index];
+ index = me.link[me.correctLink];
}
return distance;
}
-void Mine::changeRoom(MineDirection dir) {
- error("TODO: Mine::changeRoom");
+void Mine::mine_travel_link(int16 takeLink) {
+ _mineRoomInfo = MINE_INFO[_mineRoomIndex]; // Get this mine room info
+ _entranceDoor = _mineRoomInfo.door[takeLink]; // Get which door to enter from in new room
+ _mineRoomIndex = _mineRoomInfo.link[takeLink]; // Get which link to take
+
+ _mineRoomInfo = MINE_INFO[_mineRoomIndex]; // Get new mine room info from new index
+ _presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
+ _G(game).new_room = MINE_SCENE_NUMBERS[_presentSceneID]; // Go to the corresponding scene number
+ _G(kernel).force_restart = true; // Makes the scene start over even if new_room = present room
+}
+
+void Mine::set_fade_down_rect(MineDoors exit_door) {
+ _fade_down_rect.x1 = FADE_DOWN_INFO[_presentSceneID][exit_door].x1;
+ _fade_down_rect.y1 = FADE_DOWN_INFO[_presentSceneID][exit_door].y1;
+ _fade_down_rect.x2 = FADE_DOWN_INFO[_presentSceneID][exit_door].x2;
+ _fade_down_rect.y2 = FADE_DOWN_INFO[_presentSceneID][exit_door].y2;
}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 8a876e71e54..34744d26787 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -28,31 +28,68 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-enum MineDirection {
- DIR_NORTH = 0, DIR_SOUTH = 1, DIR_WEST = 2, DIR_EAST = 3
+enum MineDoors {
+ BACK, FRONT, LEFT, RIGHT, MAX_DOORS, NONE
};
-struct MineEntry {
- int32 _unknown;
- int16 _indexes[7];
- int32 _offset;
- int16 _field16;
+enum MineScenes {
+ SCENE_305, // treasure
+ SCENE_310, // mine entrance
+ SCENE_311, // one door (a)
+ SCENE_312, // one door (b)
+ SCENE_313, // two doors (a)
+ SCENE_314, // two doors (b)
+ SCENE_315, // three doors (a)
+ SCENE_316, // three doors (b)
+ SCENE_317, // four doors (a)
+ SCENE_318, // four doors (b)
+ SCENE_319, // one door (c)
+ MAX_SCENE_TYPES,
+ TREASURE_SCENE = SCENE_310,
+ ENTRANCE_SCENE = SCENE_305,
+ NO_SCENE = MAX_SCENE_TYPES
+};
+
+
+struct MineRoom {
+ int16 roomNumber; // The mine room number
+ int16 scene_id; // The scene id (indexes for mine_scene_numbers)
+ int16 link[4]; // Links to other mine rooms
+ int16 door[4]; // Specify doors to use
+ int16 correctLink; // The correct link to take to get to the treasure
+ int16 check; // Used to check the maze sanity
+};
+
+struct Rectangle {
+ int16 x1 = 0;
+ int16 y1 = 0;
+ int16 x2 = 0;
+ int16 y2 = 0;
};
class Mine : public Section3Room {
private:
- static const MineEntry MINE_DATA[];
static const char *SAID[][4];
+ static const int16 MINE_SCENE_NUMBERS[];
+ static const MineRoom MINE_INFO[];
+ static Rectangle FADE_DOWN_INFO[MAX_SCENE_TYPES][4];
int _mineCtr = 0;
+ int16 _mineRoomIndex = 0;
+ int16 _presentSceneID = 0;
+ int16 _entranceDoor = FRONT;
+ MineRoom _mineRoomInfo;
+ bool _fade_down_rect_active = false; // True if a fade down should occurr when walker in the fade_down_rect
+ Rectangle _fade_down_rect; // If the walker is in his rectum and its active, turn off the lights
- int getPigDistance() const;
+ int getTreasureDistance() const;
protected:
const char *getDigi() override {
return "300_004";
}
- void changeRoom(MineDirection dir);
+ void mine_travel_link(int16 takeLink);
+ void set_fade_down_rect(MineDoors exit_door);
public:
Mine() : Section3Room() {}
@@ -60,6 +97,7 @@ public:
void preload() override;
void daemon() override;
+ void pre_parser() override;
void parser() override;
};
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index c7da8c2fe1c..e6f1c879f0d 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -187,7 +187,7 @@ void Room305::daemon() {
break;
case 108:
- changeRoom(DIR_NORTH);
+ mine_travel_link(FRONT);
break;
default:
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 0cd47087f30..1db865649a7 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -882,10 +882,10 @@ void Room503::pre_parser() {
} else {
if (_flag1) {
player_update_info();
- HotSpotRec *hotspot = hotspot_which(_G(hotspot_x), _G(hotspot_y));
+ HotSpotRec *hotspot = hotspot_which(_G(click_x), _G(click_y));
- if (_G(hotspot_x) > 272 && _G(hotspot_y) < 300 && player_said("FLOOR")) {
- ws_walk(_G(hotspot_x), 301, nullptr, -1, 1);
+ if (_G(click_x) > 272 && _G(click_y) < 300 && player_said("FLOOR")) {
+ ws_walk(_G(click_x), 301, nullptr, -1, 1);
} else if (hotspot->feet_x > 272 && hotspot->feet_y < 300) {
player_hotspot_walk_override(hotspot->feet_x, 301, 1);
}
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index a1e756281cf..a0750d938a0 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -426,7 +426,7 @@ void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigge
}
void player_walk_to(int32 x, int32 y, int trigger) {
- player_walk_to(x, y, _G(hotspot_x), _G(hotspot_y), trigger);
+ player_walk_to(x, y, _G(click_x), _G(click_y), trigger);
}
void wilbur_speech(const char *name, int trigger, int room, byte flags,
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index d94ba9fbbd0..6ec12ad0cb1 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -185,7 +185,7 @@ public:
bool _shut_down_digi_tracks_between_rooms = false;
cursor_states _cursor_state = kARROW;
int _iPitch = 0;
- int _hotspot_x = 0, _hotspot_y = 0;
+ int _click_x = 0, _click_y = 0;
bool _visited_room = false;
};
Commit: f571158e6d18efb00b07af2c8e708e0c48137f3f
https://github.com/scummvm/scummvm/commit/f571158e6d18efb00b07af2c8e708e0c48137f3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Mine daemon entrance info
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section3/room305.cpp
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index bfe759fa24e..795b29182be 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -182,7 +182,7 @@ enum {
V146 = 146,
V147 = 147,
V148 = 148,
- V149 = 149,
+ kMineRoomIndex = 149,
V150 = 150,
V151 = 151,
V152 = 152,
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index bb14c394aaa..948726fd854 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -93,10 +93,27 @@ const MineRoom Mine::MINE_INFO[] = {
40, NO_SCENE, -1, -1, -1, -1, NONE, NONE, NONE, NONE, NONE, 0
};
-/**
- * Coords for starting fade down for exits
- */
-Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
+const EntranceInfo Mine::ENTRANCE_INFO[MAX_SCENE_TYPES][4] = {
+ //
+ // ( offscreen_x, offscreen_y, enter_facing, home_x, home_y, home_facing ) x 4 possible entrances
+ //
+ // Back Front Left Right
+ //----------------------- ------------------------- ------------------------- -------------------------
+ 285, 240, 5, 320, 290, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 305
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 245, 3, 225, 275, 3, 0, 0, 0, 0, 0, 0, // 310
+ 315, 225, 7, 310, 275, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 311
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 240, 3, 220, 270, 4, 0, 0, 0, 0, 0, 0, // 312
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 230, 3, 215, 270, 4, 550, 240, 8, 400, 270, 8, // 313
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 240, 3, 190, 270, 4, 570, 250, 8, 440, 280, 8, // 314
+ 320, 210, 7, 315, 270, 7, 0, 0, 0, 0, 0, 0, 60, 230, 3, 190, 270, 4, 560, 250, 9, 400, 270, 8, // 315
+ 0, 0, 0, 0, 0, 0, 400, 373,11, 335, 300, 7, 60, 220, 3, 200, 270, 4, 570, 240, 8, 400, 270, 7, // 316
+ 320, 215, 7, 315, 270, 7, 230, 373, 1, 330, 300, 7, 60, 220, 3, 200, 270, 4, 570, 240, 8, 400, 270, 7, // 317
+ 320, 215, 5, 315, 270, 7, 350, 373,11, 330, 300, 7, 60, 240, 3, 190, 270, 4, 560, 235, 9, 420, 270, 8, // 318
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 530, 240, 9, 420, 270, 7 // 319
+};
+
+
+const Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
//
// ( x1, y1, x2, y2) for four directions
//
@@ -119,10 +136,18 @@ Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
void Mine::preload() {
Section3Room::preload();
_mineCtr = 0;
+ _G(player).walker_type = 0;
+ _G(player).shadow_type = 0;
}
void Mine::daemon() {
switch (_G(kernel).trigger) {
+ case 301: {
+ const EntranceInfo &ei = ENTRANCE_INFO[_presentSceneID][_entranceDoor];
+ ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
+ break;
+ }
+
case 304:
digi_play("300_007", 2);
break;
@@ -156,7 +181,7 @@ void Mine::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
- term_message("Room #: %d", _G(flags)[V149]);
+ term_message("Room #: %d", _G(flags)[kMineRoomIndex]);
term_message("Distance from pig: %d", getTreasureDistance());
_mineCtr = (_mineCtr + 1) % 5;
@@ -194,7 +219,7 @@ void Mine::parser() {
int Mine::getTreasureDistance() const {
int distance = 0;
- for (int index = _G(flags)[V149]; index != MINE_END; ++distance) {
+ for (int index = _G(flags)[kMineRoomIndex]; index != MINE_END; ++distance) {
const MineRoom &me = MINE_INFO[index];
index = me.link[me.correctLink];
}
@@ -203,11 +228,13 @@ int Mine::getTreasureDistance() const {
}
void Mine::mine_travel_link(int16 takeLink) {
- _mineRoomInfo = MINE_INFO[_mineRoomIndex]; // Get this mine room info
+ long &mineRoomIndex = _G(flags)[kMineRoomIndex];
+
+ _mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
_entranceDoor = _mineRoomInfo.door[takeLink]; // Get which door to enter from in new room
- _mineRoomIndex = _mineRoomInfo.link[takeLink]; // Get which link to take
+ mineRoomIndex = _mineRoomInfo.link[takeLink]; // Get which link to take
- _mineRoomInfo = MINE_INFO[_mineRoomIndex]; // Get new mine room info from new index
+ _mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get new mine room info from new index
_presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
_G(game).new_room = MINE_SCENE_NUMBERS[_presentSceneID]; // Go to the corresponding scene number
_G(kernel).force_restart = true; // Makes the scene start over even if new_room = present room
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 34744d26787..fbc6211d0af 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -60,6 +60,15 @@ struct MineRoom {
int16 check; // Used to check the maze sanity
};
+struct EntranceInfo {
+ int16 offscreen_x;
+ int16 offscreen_y;
+ int16 enter_facing;
+ int16 home_x;
+ int16 home_y;
+ int16 home_facing;
+};
+
struct Rectangle {
int16 x1 = 0;
int16 y1 = 0;
@@ -72,9 +81,18 @@ private:
static const char *SAID[][4];
static const int16 MINE_SCENE_NUMBERS[];
static const MineRoom MINE_INFO[];
- static Rectangle FADE_DOWN_INFO[MAX_SCENE_TYPES][4];
+
+ /**
+ * Coords for starting fade down for exits
+ */
+ static const Rectangle FADE_DOWN_INFO[MAX_SCENE_TYPES][4];
+
+ /**
+ * Room coords for entrance walk-ins
+ */
+ static const EntranceInfo ENTRANCE_INFO[MAX_SCENE_TYPES][4];
+
int _mineCtr = 0;
- int16 _mineRoomIndex = 0;
int16 _presentSceneID = 0;
int16 _entranceDoor = FRONT;
MineRoom _mineRoomInfo;
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index e6f1c879f0d..e5f2f32fcce 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -70,7 +70,7 @@ void Room305::init() {
setupDigi();
set_palette_brightness(60);
pal_cycle_init(96, 111, 6, -1, -1);
- _G(flags)[V149] = 0;
+ _G(flags)[kMineRoomIndex] = 0;
if (_G(flags)[V134] && !_G(flags)[V135] && !_G(flags)[V137]) {
hotspot_set_active("DARKNESS", true);
Commit: a92a50ada38b34d6b70523de0d189034e6800d45
https://github.com/scummvm/scummvm/commit/a92a50ada38b34d6b70523de0d189034e6800d45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More of mine daemon
Changed paths:
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 948726fd854..6bba6f389ac 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -132,6 +132,18 @@ const Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 0, 639, 270 // 319
};
+void MineRoom::clear() {
+ roomNumber = 0;
+ scene_id = 0;
+ Common::fill(link, link + 4, 0);
+ Common::fill(door, door + 4, 0);
+ correctLink = 0;
+ check = 0;
+}
+
+Mine::Mine() : Section3Room() {
+ _mineRoomInfo.clear();
+}
void Mine::preload() {
Section3Room::preload();
@@ -148,10 +160,117 @@ void Mine::daemon() {
break;
}
+ case 302: {
+ const EntranceInfo &ei = ENTRANCE_INFO[_mineRoomInfo.roomNumber][_entranceDoor];
+ ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
+ player_set_commands_allowed(false);
+ break;
+ }
+
+ case 303:
+ player_set_commands_allowed(true);
+
+ if (_G(game).room_id == 310) {
+ if (_G(flags)[V141]) {
+ _G(wilbur_should) = 10002;
+ } else {
+ _G(flags)[V141] = 1;
+ _G(wilbur_should) = 408;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (_G(game).room_id != 305) {
+ if (!_G(flags)[V137]) {
+ _G(flags)[V137] = 1;
+ _G(wilbur_should) = _G(flags)[V111] ? 402 : 401;
+ } else if (!imath_rand_bool(3)) {
+ _G(wilbur_should) = 10002;
+ } else if (!_G(flags)[V111]) {
+ _G(wilbur_should) = 404;
+ } else {
+ _G(wilbur_should) = inv_player_has("WHISTLE") ? 406 : 405;
+ }
+
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
case 304:
digi_play("300_007", 2);
break;
+ case 305:
+ _volume = 160 - getTreasureDistance() * 25;
+ _random1 = imath_ranged_rand(0, 5);
+ digi_play(Common::String::format("300t001%c", 'a' + _random1).c_str(), 3, _volume);
+ break;
+
+ case 10008:
+ switch (_G(game).room_id) {
+ case 305:
+ case 310:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+
+ default:
+ if (_G(flags)[V111] && !_G(flags)[V144])
+ kernel_timing_trigger(15, 305);
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 401:
+ wilbur_speech("311w001");
+ break;
+
+ case 402:
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 403;
+ wilbur_speech("311w002", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 403:
+ player_set_commands_allowed(true);
+ wilbur_speech("311w003");
+ break;
+
+ case 404:
+ player_set_commands_allowed(true);
+ _random2 = imath_ranged_rand(0, 5);
+ wilbur_speech(Common::String::format("311w004%c", 'a' + _random2).c_str());
+ break;
+
+ case 405:
+ term_message("Wilbur enters the mine with no whistle!");
+ player_set_commands_allowed(true);
+ _random2 = imath_ranged_rand(0, 3);
+ digi_play(Common::String::format("311w005%c", 'a' + _random2).c_str(), 3, _volume);
+ break;
+
+ case 406:
+ _random2 = imath_ranged_rand(0, 2);
+ wilbur_speech(Common::String::format("311w006%c", 'a' + _random2).c_str());
+ break;
+
+ case 407:
+ if (_G(flags)[V136]) {
+ _random2 = imath_ranged_rand(0, 6);
+ wilbur_speech(Common::String::format("311w009%c", 'a' + _random2).c_str());
+ } else {
+ wilbur_speech("311w008");
+ }
+ break;
+
+ case g10013:
+ // TODO
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
// TODO: Further cases
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index fbc6211d0af..74cb60eba32 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -58,6 +58,8 @@ struct MineRoom {
int16 door[4]; // Specify doors to use
int16 correctLink; // The correct link to take to get to the treasure
int16 check; // Used to check the maze sanity
+
+ void clear();
};
struct EntranceInfo {
@@ -98,6 +100,9 @@ private:
MineRoom _mineRoomInfo;
bool _fade_down_rect_active = false; // True if a fade down should occurr when walker in the fade_down_rect
Rectangle _fade_down_rect; // If the walker is in his rectum and its active, turn off the lights
+ int _volume = 0;
+ int _random1 = 0;
+ int _random2 = 0;
int getTreasureDistance() const;
@@ -110,7 +115,7 @@ protected:
void set_fade_down_rect(MineDoors exit_door);
public:
- Mine() : Section3Room() {}
+ Mine();
virtual ~Mine() {}
void preload() override;
Commit: 5f372e62c193b1c33c7fb971bbbcdcd2cd3ff6c2
https://github.com/scummvm/scummvm/commit/5f372e62c193b1c33c7fb971bbbcdcd2cd3ff6c2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added remainder of mine daemon
Changed paths:
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room510.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section9/menu_room.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index 5a0e2f1270a..fa288fcea78 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -132,7 +132,7 @@ void Section::init_series_players() {
void Section::tick() {
int oldTrigger = _G(kernel).trigger;
- _G(kernel).trigger = gCALLED_EACH_LOOP;
+ _G(kernel).trigger = kCALLED_EACH_LOOP;
g_engine->game_daemon_code();
_G(kernel).trigger = oldTrigger;
}
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 0eafc68b010..1fb9f2ba567 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -576,7 +576,7 @@ void Room142::daemon() {
}
break;
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
if (_actionType == 0) {
_G(kernel).call_daemon_every_loop = false;
} else {
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index 7cebd5ecc1a..0fa2d8a6d91 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -148,7 +148,7 @@ void Room170::daemon() {
}
break;
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
term_message("Calling daemon each loop..............");
if (_lookTownHall) {
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 0bc40e1543c..6f322e7f350 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -625,7 +625,7 @@ void Room171::daemon() {
}
break;
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
if (_doorFlag) {
frontDoor();
} else {
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 6bba6f389ac..e0f8d28f1ed 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -263,8 +263,89 @@ void Mine::daemon() {
}
break;
+ case 408:
+ wilbur_speech("310w001");
+ break;
+
case g10013:
- // TODO
+ player_set_commands_allowed(true);
+ ws_unhide_walker();
+ _G(wilbur_should) = 10002;
+ term_message("Mine whistle daemon thing");
+
+ switch (_G(game).room_id) {
+ case 305:
+ if (_G(flags)[V111]) {
+ _G(flags)[V002] = 1;
+ wilbur_speech("300w060");
+ }
+ break;
+
+ case 310:
+ if (_G(flags)[V111] && !_G(flags)[V144]) {
+ _G(flags)[V144] = 1;
+ } else {
+ wilbur_speech("300w069");
+ }
+ break;
+
+ default:
+ if (!_G(flags)[V111] && _G(flags)[V144]) {
+ wilbur_speech("300w061");
+ } else if (!_G(flags)[V148]) {
+ _G(flags)[V148] = 1;
+ _treasureDistance = getTreasureDistance();
+
+ switch (_treasureDistance) {
+ case 1:
+ wilbur_speech("300w062");
+ break;
+ case 2:
+ wilbur_speech("300w063");
+ break;
+ case 3:
+ case 4:
+ wilbur_speech("300w064");
+ break;
+ case 5:
+ case 6:
+ wilbur_speech("300w065");
+ break;
+ default:
+ break;
+ }
+ } else {
+ _treasureDistance = getTreasureDistance();
+
+ if (_treasureDistance < _treasureThreshold) {
+ wilbur_speech("300w068");
+ } else if (_treasureDistance == _treasureThreshold) {
+ wilbur_speech("300w067");
+ } else {
+ wilbur_speech("300w066");
+ }
+ }
+ break;
+ }
+ break;
+
+ case kCALLED_EACH_LOOP:
+ if (_fade_down_rect_active) {
+ player_update_info();
+
+ if (_G(player_info).x >= _fade_down_rect.x1 &&
+ _G(player_info).x <= _fade_down_rect.x2 &&
+ _G(player_info).y >= _fade_down_rect.y1 &&
+ _G(player_info).y <= _fade_down_rect.y2) {
+ if (player_commands_allowed()) {
+ pal_fade_set_start(100);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 40, -1);
+ }
+
+ player_set_commands_allowed(false);
+ }
+ }
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 74cb60eba32..645a83f2968 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -103,6 +103,8 @@ private:
int _volume = 0;
int _random1 = 0;
int _random2 = 0;
+ int _treasureDistance = 0;
+ int _treasureThreshold = 0;
int getTreasureDistance() const;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 672fdf609a0..3f3630fb20f 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -591,7 +591,7 @@ void Room504::daemon() {
break;
}
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
player_update_info();
if (_G(player_info).x > 300 && _G(player_info).y > 307) {
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index 8cfc01e2584..f66c5496cb4 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -115,7 +115,7 @@ void Room510::daemon() {
buttonAction(7, 30, 34);
break;
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
if (player_commands_allowed())
updateButtons();
break;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index a4c5d5833cf..77df202e590 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -1247,7 +1247,7 @@ void Room602::daemon() {
break;
}
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
if (_G(player).walker_in_this_scene) {
player_update_info();
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index b25a95b5d7b..e5515b76196 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -558,7 +558,7 @@ void Room603::daemon() {
}
break;
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
player_update_info();
if (_G(player_info).x > 420 && _G(player_info).x < 490 &&
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 66c54a4e214..11fb992f0eb 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -636,7 +636,7 @@ void Room604::daemon() {
break;
}
- case gCALLED_EACH_LOOP:
+ case kCALLED_EACH_LOOP:
player_update_info();
if (_G(player_info).x > 319 && _G(player_info).x < 413 &&
_G(player_info).y > 280 && _G(player_info).y < 305 &&
diff --git a/engines/m4/burger/rooms/section9/menu_room.cpp b/engines/m4/burger/rooms/section9/menu_room.cpp
index e6ab92cc26d..261a177537b 100644
--- a/engines/m4/burger/rooms/section9/menu_room.cpp
+++ b/engines/m4/burger/rooms/section9/menu_room.cpp
@@ -37,7 +37,7 @@ void MenuRoom::init() {
void MenuRoom::daemon() {
- if (_G(kernel).trigger == gCALLED_EACH_LOOP) {
+ if (_G(kernel).trigger == kCALLED_EACH_LOOP) {
if (player_commands_allowed())
buttonsFrame();
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8d0fc4dd4a3..55f8e9fb98c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -68,7 +68,7 @@ enum global_triggers {
g10027 = 10027,
g10028 = 10028,
- gCALLED_EACH_LOOP = 32764,
+ kCALLED_EACH_LOOP = 32764,
gLAST_GLOBAL_TRIGGER
#if UNUSED
Commit: fc7d39787c2ef7b6f5d54000ef593f82c6de9a44
https://github.com/scummvm/scummvm/commit/fc7d39787c2ef7b6f5d54000ef593f82c6de9a44
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 3 methods
Changed paths:
engines/m4/burger/rooms/section3/section3.cpp
engines/m4/burger/rooms/section3/section3.h
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index 72e16335db5..3ca1f2fb236 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -57,8 +57,168 @@ Section3::Section3() : Rooms::Section() {
}
void Section3::daemon() {
- // TODO
- _G(kernel).continue_handling_trigger = true;
+ switch (_G(kernel).trigger) {
+ case 3001:
+ _G(game).new_room = 302;
+ break;
+
+ case 3002:
+ _G(game).new_room = 303;
+ break;
+
+ case 3003:
+ _G(game).new_room = 304;
+ break;
+
+ case 3004:
+ _G(game).new_room = 305;
+ break;
+
+ case 3005:
+ digi_unload("303_003");
+ _G(game).new_room = 306;
+ break;
+
+ case 3006:
+ _G(game).new_room = 307;
+ break;
+
+ case 3007:
+ player_set_commands_allowed(false);
+ gr_pal_clear(_G(master_palette));
+ release_trigger_on_digi_state(3005, 1, 0);
+ break;
+
+ case 3008:
+ _random1 = imath_ranged_rand(0, 5);
+ digi_play(Common::String::format("300t001%c", 'a' + _random1).c_str(), 2, 55, -1, 300);
+ break;
+
+ case 10008:
+ if (!_G(flags)[V111])
+ kernel_timing_trigger(15, 3008);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 3001:
+ player_update_info();
+ _G(flags)[V124] = 1;
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ _G(wilbur_should) = 3002;
+ series_play_with_breaks(PLAY1, "300wdcj", _G(player_info).depth,
+ gCHANGE_WILBUR_ANIMATION, 3, 6, _G(player_info).scale,
+ _G(player_info).x, _G(player_info).y);
+ break;
+
+ case 3002:
+ inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
+ inv_give_to_player("JUG");
+ ws_unhide_walker();
+ _G(wilbur_should) = 10001;
+
+ wilbur_speech(_G(flags)[V101] ? "300w041" : "300w040");
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 10013:
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ _G(wilbur_should) = 10002;
+
+ if (_G(flags)[V111]) {
+ _G(flags)[V002] = 1;
+ wilbur_speech("300w060");
+ }
+ break;
+
+ case 10015:
+ _G(game).new_room = 306;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Section3::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("DISTILLED CARROT JUICE")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech("300w030");
+ } else if (player_said("TRUFFLES") || player_said("TROUGH")) {
+ wilbur_speech("300w031");
+ } else if (player_said_any("GEAR", "WILBUR")) {
+ _G(wilbur_should) = 3001;
+ ws_turn_to_face(3, gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("BOTTLE")) {
+ wilbur_speech("300w076");
+ } else if (player_said("TAKE") && inv_player_has("DISTILLED CARROT JUICE")) {
+ wilbur_speech("999w021");
+ } else {
+ wilbur_speech("300w042");
+ }
+ } else if (player_said("BURGER MORSEL")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech("300w006");
+ } else if (player_said("TROUGH")) {
+ wilbur_speech("300w004");
+ } else if (player_said("WILBUR")) {
+ wilbur_speech("300w013");
+ } else if (player_said("TRUFFLES") && _G(game).room_id == 310) {
+ wilbur_speech("300w012");
+ } else if (player_said("STOVE") || player_said("FRYING PAN") || player_said("POT")) {
+ wilbur_speech("300w011");
+ } else if (player_said("TAKE") && inv_player_has("BURGER MORSEL")) {
+ wilbur_speech("999w021");
+ } else {
+ wilbur_speech("300w014");
+ }
+ } else if (player_said("MATCHES")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech("300w015");
+ } else if (player_said("TRUFFLES")) {
+ wilbur_speech("300w016");
+ } else if (player_said("CABIN")) {
+ wilbur_speech("300w017");
+ } else if (player_said("WILBUR")) {
+ wilbur_speech("300w024");
+ } else if (player_said("TAKE") && inv_player_has("MATCHES")) {
+ wilbur_speech("999w021");
+ } else {
+ wilbur_speech("300w025");
+ }
+ } else if (player_said("JUG")) {
+ if (player_said("LOOK AT")) {
+ wilbur_speech("303w022");
+ } else if (player_said("BOILER") || player_said("WILBUR") || player_said("GEAR")) {
+ wilbur_speech("300w027");
+ } else if (player_said("CARROT JUICE")) {
+ wilbur_speech("300w050");
+ } else if (player_said("TAKE") && inv_player_has("JUG")) {
+ wilbur_speech("999w021");
+ } else {
+ wilbur_speech("300w029");
+ }
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Section3::mine_check_maze() {
+ // This was used in the original to do sanity checks that the
+ // mine maze data was all valid
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/section3.h b/engines/m4/burger/rooms/section3/section3.h
index e506c1a6630..e63dedcbc8a 100644
--- a/engines/m4/burger/rooms/section3/section3.h
+++ b/engines/m4/burger/rooms/section3/section3.h
@@ -49,12 +49,19 @@ private:
Room307 _room307;
Room310 _room310;
Mine _mine;
+ int _random1 = 0;
+
+ void mine_check_maze();
public:
Section3();
virtual ~Section3() {}
+ void init() override {
+ mine_check_maze();
+ }
void daemon() override;
+ void parser() override;
};
} // namespace Rooms
Commit: f9b2bc7f1121968e48472d25774a68fc66a58a54
https://github.com/scummvm/scummvm/commit/f9b2bc7f1121968e48472d25774a68fc66a58a54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 306
Changed paths:
engines/m4/burger/rooms/section3/room306.cpp
engines/m4/burger/rooms/section3/room306.h
diff --git a/engines/m4/burger/rooms/section3/room306.cpp b/engines/m4/burger/rooms/section3/room306.cpp
index d321e97b982..7494a298d50 100644
--- a/engines/m4/burger/rooms/section3/room306.cpp
+++ b/engines/m4/burger/rooms/section3/room306.cpp
@@ -51,10 +51,39 @@ const seriesStreamBreak Room306::SERIES3[] = {
};
+void Room306::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room306::init() {
+ pal_cycle_init(101, 110, 6);
+ kernel_trigger_dispatch_now(3007);
}
void Room306::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
+ release_trigger_on_digi_state(g10027, 1);
+ break;
+
+ case 3007:
+ if (!_G(flags)[V112]) {
+ digi_preload_stream_breaks(SERIES2);
+ series_stream_with_breaks(SERIES2, "306burnt", 6, 1, 1);
+ } else if (_G(flags)[V118] == 3003) {
+ digi_preload_stream_breaks(SERIES3);
+ series_stream_with_breaks(SERIES3, "306burnt", 6, 1, 1);
+ } else {
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "306fail", 6, 1, 1);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room306.h b/engines/m4/burger/rooms/section3/room306.h
index e24188e649b..8da9f04421b 100644
--- a/engines/m4/burger/rooms/section3/room306.h
+++ b/engines/m4/burger/rooms/section3/room306.h
@@ -38,6 +38,7 @@ public:
Room306() : Room() {}
~Room306() override {}
+ void preload() override;
void init() override;
void daemon() override;
};
Commit: d43881f8a066253b8d9042af88325923388c1e25
https://github.com/scummvm/scummvm/commit/d43881f8a066253b8d9042af88325923388c1e25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 307
Changed paths:
engines/m4/burger/rooms/section3/room307.cpp
engines/m4/burger/rooms/section3/room307.h
diff --git a/engines/m4/burger/rooms/section3/room307.cpp b/engines/m4/burger/rooms/section3/room307.cpp
index b22e82d2003..d63adb5a416 100644
--- a/engines/m4/burger/rooms/section3/room307.cpp
+++ b/engines/m4/burger/rooms/section3/room307.cpp
@@ -45,9 +45,55 @@ const seriesPlayBreak Room307::PLAY1[] = {
void Room307::init() {
+ _G(flags)[V099] = 1;
+ ws_demand_location(418, 309, 9);
+ ws_hide_walker();
+ digi_preload("307_001");
+ digi_play_loop("307_001", 3, 125, -1, 307);
+ kernel_trigger_dispatch_now(1);
}
void Room307::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "307brig", 6, 1, 2);
+ break;
+
+ case 2:
+ digi_unload_stream_breaks(SERIES1);
+ _series1.show("307zg01", 0x400);
+ ws_unhide_walker();
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 3:
+ wilbur_speech("307w001y", 4);
+ break;
+
+ case 4:
+ wilbur_speech("307w001z", 7);
+ break;
+
+ case 5:
+ digi_preload("608_002");
+ series_play("307door", 9, 16, -1, 7);
+ digi_play("608_002", 2, 200, 6);
+ break;
+
+ case 6:
+ wilbur_speech("307w002", g10027);
+ break;
+
+ case 7:
+ _series1.terminate();
+ series_play_with_breaks(PLAY1, "307zg01", 0x400, 5, 3, 5, 100, 0, 0);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room307.h b/engines/m4/burger/rooms/section3/room307.h
index 78688777662..d0ea23842ec 100644
--- a/engines/m4/burger/rooms/section3/room307.h
+++ b/engines/m4/burger/rooms/section3/room307.h
@@ -32,6 +32,7 @@ class Room307 : public Room {
private:
static const seriesStreamBreak SERIES1[];
static const seriesPlayBreak PLAY1[];
+ Series _series1;
public:
Room307() : Room() {}
Commit: c09c674f2a5441b438275229e2f7d79da27eeb1a
https://github.com/scummvm/scummvm/commit/c09c674f2a5441b438275229e2f7d79da27eeb1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 310
Changed paths:
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 043d3749c3a..9b595cae235 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -82,9 +82,237 @@ Room310::Room310() : Mine() {
}
void Room310::init() {
+ Mine::init();
+ setupDigi();
+ set_palette_brightness(48, 127, 30);
+ digi_preload("601_007");
+
+ _val1 = 7;
+ kernel_trigger_dispatch_now(1);
+
+ if (!_G(flags)[V144] && _G(flags)[V111]) {
+ _walk1 = intr_add_no_walk_rect(360, 265, 515, 293, 359, 294);
+ _val2 = 12;
+ kernel_trigger_dispatch_now(3);
+ } else {
+ hotspot_set_active("TRUFFLES", false);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ case 319:
+ break;
+
+ default:
+ _G(flags)[kMineRoomIndex] = 39;
+ ws_demand_location(300, 306, 4);
+ player_set_commands_allowed(true);
+ break;
+ }
}
void Room310::daemon() {
+ Mine::daemon();
+ if (!_G(kernel).continue_handling_trigger)
+ return;
+ _G(kernel).continue_handling_trigger = false;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_val1) {
+ case 7:
+ _series2 = series_play("310prob", 0xb00, 0, -1, 6, -1, 100, 0, 0, 0, 17);
+ break;
+
+ case 8:
+ _val1 = 7;
+ terminateMachineAndNull(_series2);
+ series_play_with_breaks(PLAY3, "310prob", 0xb00, 1, 2);
+ break;
+
+ case 9:
+ _val1 = 10;
+ terminateMachineAndNull(_series2);
+ series_play_with_breaks(PLAY5, "310prob", 0xb00, 1, 2);
+ break;
+
+ case 10:
+ _val1 = 11;
+ series_play_with_breaks(PLAY6, "310prob", 0xb00, 1, 2, 3);
+ break;
+
+ case 11:
+ series_show("310prob", 0xb00, 0, -1, -1, 60);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ _series1.terminate();
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 3:
+ switch (_val2) {
+ case 12:
+ _series1.show("310tr01", 0xb00);
+ _val2 = (imath_ranged_rand(1, 4) == 1) ? 13 : 12;
+ kernel_timing_trigger(30, 2);
+ break;
+
+ case 13:
+ _val2 = 12;
+ _val1 = 8;
+ series_play_with_breaks(PLAY1, "310tr01", 0xb00, 3, 3);
+ _state1 = imath_ranged_rand(1, 4);
+ break;
+
+ case 14:
+ term_message("Truffles goes to snarl at Wilbur!");
+ _G(flags)[V145] = 1;
+ _G(wilbur_should) = 4;
+ _val2 = 15;
+ series_play_with_breaks(PLAY2, "310tr02", 0xb00, 3, 3);
+ _state1 = imath_ranged_rand(1, 4);
+ break;
+
+ case 15:
+ player_set_commands_allowed(true);
+ wilbur_speech(_G(flags)[V142] ? "310w007" : "310w006");
+ _val2 = 12;
+ kernel_trigger_dispatch_now(12);
+ break;
+
+ case 16:
+ digi_play("300t002", 2, 155, -1, 300);
+ hotspot_set_active("TRUFFLES", false);
+ hotspot_set_active("GROUND ", false);
+ intr_remove_no_walk_rect(_walk1);
+ series_play("310tr04", 0xb00);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10008:
+ _val2 = 16;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ ws_hide_walker();
+ _general.play("310wi01", 0xb00, 16, -1, 6, 0, 100, 0, 0, 0, 5);
+ _val1 = 9;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 2:
+ _general.terminate();
+ _G(wilbur_should) = 3;
+ series_play_with_breaks(PLAY4, "310wi01", 0xb00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ ws_unhide_walker();
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 3006);
+ break;
+
+ case 4:
+ _state1 = imath_ranged_rand(0, 2);
+
+ switch (_state1) {
+ case 0:
+ wilbur_speech("310w005a");
+ term_message("Wilbur: Whoa, easy Truffles!");
+ break;
+
+ case 1:
+ wilbur_speech("310w005b");
+ term_message("Wilbur: Down, piggy!");
+ break;
+
+ case 2:
+ wilbur_speech("310w005c");
+ term_message("Wilbur: Aaaaaaaaaa!");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ wilbur_speech(_G(flags)[V145] ? "310w010" : "310w009");
+ break;
+
+ case 6:
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 1;
+ wilbur_speech("310w008", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Room310::pre_parser() {
+ Mine::pre_parser();
+
+ if (player_said("GEAR", "PROBE") && (!_G(flags)[V111] || _G(flags)[V144] == 1)) {
+ _G(wilbur_should) = 6;
+ player_hotspot_walk_override(293, 288, 3, gCHANGE_WILBUR_ANIMATION);
+ _G(player).command_ready = false;
+ } else if (!_G(flags)[V144]) {
+ HotSpotRec *hotspot = hotspot_which(_G(click_x), _G(click_y));
+ assert(hotspot);
+
+ if (hotspot->feet_x > 360 && hotspot->feet_x < 515 &&
+ hotspot->feet_y > 265 && hotspot->feet_y < 293) {
+ player_hotspot_walk_override(hotspot->feet_x, 294, 11);
+ }
+ }
+}
+
+void Room310::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ Mine::parser();
+ if (!_G(player).command_ready)
+ return;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("GEAR", "PROBE") || player_said("TAKE", "PROBE")) {
+ term_message("truffles in mine %d truffles ran away %d",
+ _G(flags)[V111], _G(flags)[V144]);
+
+ if (_G(flags)[V111] == 1 && !_G(flags)[V144]) {
+ term_message("Wilbur pissed off truffles!");
+ player_set_commands_allowed(false);
+ _val2 = 14;
+ }
+ } else if (player_said("LOOK AT", "TRUFFLES")) {
+ _G(wilbur_should) = 5;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ return;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index 6216ee671f6..ca49af81d01 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -38,6 +38,11 @@ private:
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static long _state1;
+ Series _series1;
+ machine *_series2 = nullptr;
+ noWalkRect *_walk1 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
protected:
const char *getDigi() override {
@@ -50,6 +55,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: 431de407e4082d444514d2ae43add47bb082a8e0
https://github.com/scummvm/scummvm/commit/431de407e4082d444514d2ae43add47bb082a8e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 401
Changed paths:
engines/m4/burger/rooms/section4/room401.cpp
engines/m4/burger/rooms/section4/room401.h
diff --git a/engines/m4/burger/rooms/section4/room401.cpp b/engines/m4/burger/rooms/section4/room401.cpp
index 2988e34b20e..08d981a4c44 100644
--- a/engines/m4/burger/rooms/section4/room401.cpp
+++ b/engines/m4/burger/rooms/section4/room401.cpp
@@ -62,10 +62,72 @@ const seriesStreamBreak Room401::SERIES3[] = {
STREAM_BREAK_END
};
+void Room401::preload() {
+ _G(player).walker_in_this_scene = false;
+}
+
void Room401::init() {
+ _G(flags).reset5();
+ player_set_commands_allowed(false);
+ digi_preload("401_001");
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_play_loop("401_001", 3, 75, -1, 401);
+ kernel_trigger_dispatch_now(1);
}
void Room401::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ series_stream_with_breaks(SERIES1, "401_01a", 6, 1, 2);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 2:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 3);
+ break;
+
+ case 3:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 4);
+ break;
+
+ case 4:
+ series_stream_with_breaks(SERIES2, "401_01b", 6, 1, 5);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 5:
+ pal_fade_set_start(0);
+ kernel_timing_trigger(6, 6);
+ break;
+
+ case 6:
+ compact_mem_and_report();
+ kernel_timing_trigger(6, 7);
+ break;
+
+ case 7:
+ digi_unload_stream_breaks(SERIES1);
+ digi_unload_stream_breaks(SERIES2);
+ _series1 = series_stream_with_breaks(SERIES3, "401_02", 6, 1, 4002);
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 8:
+ series_set_frame_rate(_series1, 20);
+ break;
+
+ case 9:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, -1);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/room401.h b/engines/m4/burger/rooms/section4/room401.h
index 9efe1e6da0f..5aff8f08e77 100644
--- a/engines/m4/burger/rooms/section4/room401.h
+++ b/engines/m4/burger/rooms/section4/room401.h
@@ -33,11 +33,13 @@ private:
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
static const seriesStreamBreak SERIES3[];
+ machine *_series1 = nullptr;
public:
Room401() : Room() {}
~Room401() override {}
+ void preload() override;
void init() override;
void daemon() override;
};
Commit: 47b3e21317ee0dd6aeaa2374ec2ae0867e6b477e
https://github.com/scummvm/scummvm/commit/47b3e21317ee0dd6aeaa2374ec2ae0867e6b477e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 402 methods
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section4/section4.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 55063d4649e..04577db4927 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section4/room402.h"
+#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -174,9 +175,432 @@ const seriesPlayBreak Room402::PLAY16[] = {
void Room402::init() {
+ term_message(_G(visited_room) ? " been here before" : " NOT been here before");
+ _val4 = 0;
+ _dr01 = _dr01s = -1;
+ _dr02 = _dr02s = -1;
+ _dr03 = _dr03s = -1;
+ _dr08 = _dr08s = -1;
+ _pe01 = _pe01s = -1;
+ _pe02 = _pe02s = -1;
+ _pe03 = _pe03s = -1;
+ _pe04 = _pe04s = -1;
+ _wi01 = _wi01s = -1;
+ _wi02 = _wi02s = -1;
+ _series1Set = _series2Set = false;
+
+ pal_cycle_init(114, 127, 6);
+ digi_preload("400_001");
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 406:
+ player_set_commands_allowed(false);
+ ws_demand_location(597, 170, 8);
+ ws_hide_walker();
+ break;
+
+ default:
+ player_set_commands_allowed(false);
+ ws_demand_location(93, 260, 4);
+ ws_hide_walker();
+ break;
+ }
+
+ if (_G(flags)[V159]) {
+ hotspot_set_active("elmo", false);
+ hotspot_set_active("stolie", false);
+
+ if (_G(game).previous_room != RESTORING_GAME) {
+ _G(wilbur_should) = 5;
+ kernel_timing_trigger(120, gCHANGE_WILBUR_ANIMATION);
+ }
+ } else {
+ _G(flags)[V298] = 1;
+ static const char *NAMES[11] = {
+ "402p903a", "402p903b", "402p903c", "402p903d", "402p903e", "402p903f",
+ "402s010f", "402s010g", "402s010h", "402s010a", "402s010d"
+ };
+ for (int i = 0; i < 11; ++i)
+ digi_preload(NAMES[i]);
+
+ loadPe1();
+ _val5 = 15;
+ _val3 = 15;
+ kernel_trigger_dispatch_now(3);
+
+ if (_G(visited_room)) {
+ if (_G(game).previous_room == RESTORING_GAME) {
+ _val2 = 15;
+ } else {
+ _G(wilbur_should) = 5;
+ kernel_timing_trigger(120, gCHANGE_WILBUR_ANIMATION);
+ _val2 = 15;
+ }
+ } else {
+ _val2 = 15;
+
+ if (_G(game).previous_room != RESTORING_GAME) {
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ series_load("402dr06");
+ series_load("402dr06s");
+ digi_preload("402p901");
+ series_load("402pe4n");
+ series_load("402pe4ns");
+
+ _val2 = 16;
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ }
+
+ _val6 = 15;
+ kernel_trigger_dispatch_now(2);
+ }
+
+ digi_play_loop("400_001", 3, 175);
}
void Room402::daemon() {
+ // TODO
+}
+
+void Room402::pre_parser() {
+ if (player_said("disc") && !player_said("poof") && !player_said("gear"))
+ player_hotspot_walk_override(162, 264, 9, -1);
+
+ if (player_said("disc ") && !player_said("poof ") && !player_said("gear"))
+ player_hotspot_walk_override(556, 189, 2, -1);
+}
+
+void Room402::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (lookFlag && player_said("stolie")) {
+ wilbur_speech(_G(flags)[V157] ? "402w002" : "402w001");
+ } else if (lookFlag && player_said_any("disc", "disc ")) {
+ wilbur_speech(_G(flags)[V154] ? "400w002" : "402w004");
+ } else if (player_said_any("disc", "disc ") && inv_player_has(_G(player).verb)) {
+ wilbur_speech("400w004");
+ } else if (player_said("poof") || player_said("gear", "disc")) {
+ Section4::poof(4006);
+ } else if (player_said("poof ") || player_said("gear", "disc ")) {
+ Section4::poof(4005);
+ } else if (player_said("stolie") && inv_player_has(_G(player).verb) &&
+ !player_said("deed")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("402w901");
+ break;
+
+ case 1:
+ _digiName = "402s006";
+ _flag1 = true;
+ _val1 = 2;
+ freeSeries1();
+ _val2 = 45;
+ break;
+
+ case 2:
+ _val2 = 15;
+ kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("elmo") && inv_player_has(_G(player).verb) &&
+ !player_said("deed")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ _digiName = "402p904a";
+ break;
+ case 2:
+ _digiName = "402p904b";
+ break;
+ case 3:
+ _digiName = "402p904c";
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 1:
+ _val3 = 15;
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("TALK TO", "stolie")) {
+ player_set_commands_allowed(false);
+ conv_load_and_prepare("conv84", 1);
+ } else if (player_said("TALK TO", "elmo")) {
+ if (_G(flags)[V158]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("402w501");
+ break;
+
+ case 1:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ _digiName = "402p502a";
+ break;
+ case 2:
+ _digiName = "402p502b";
+ break;
+ case 3:
+ _digiName = "402p502c";
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ _val3 = 15;
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("402w501");
+ break;
+
+ case 1:
+ _digiName = "402p501";
+ _flag1 = true;
+ _val1 = 2;
+ _val3 = 45;
+ break;
+
+ case 2:
+ _G(flags)[V158] = 1;
+ _val3 = 15;
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ }
+ } else if (player_said("deed", "stolie") || player_said("deed", "elmo")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech(_G(flags)[V157] ? "402w902" : "402w502");
+ break;
+
+ case 1:
+ freeSeries2();
+ freeDr2();
+ _digiName = "402p902";
+ _flag1 = true;
+ _val1 = 2;
+ _val3 = 45;
+ break;
+
+ case 2:
+ _val3 = 41;
+ _digiName = "402s007";
+ _flag1 = true;
+ _val1 = 3;
+ _val2 = 40;
+ break;
+
+ case 3:
+ _digiName = "402s008";
+ _flag1 = true;
+ _val1 = 4;
+ freeSeries1();
+ freeDr2();
+ _val2 = 46;
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 4:
+ _val2 = 47;
+ kernel_trigger_dispatch_now(2);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("402w903");
+ break;
+
+ case 5:
+ _digiName = "402s009";
+ _flag1 = true;
+ _val1 = 6;
+ _val2 = 45;
+ break;
+
+ case 6:
+ _val2 = 47;
+ kernel_trigger_dispatch_now(2);
+ _G(kernel).trigger_mode = KT_PARSE;
+ wilbur_speech("402w904");
+ break;
+
+ case 7:
+ ws_walk(337, 375, nullptr, 15, 2);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("conv84")) {
+ conv84();
+ } else {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room402::conv84() {
+ // TODO
+}
+
+void Room402::freeSeries1() {
+ if (_series1Set) {
+ _series1.terminate();
+ _series1Set = false;
+ }
+}
+
+void Room402::freeSeries2() {
+ if (_series2Set) {
+ _series2.terminate();
+ _series2Set = false;
+ }
+}
+
+void Room402::loadDr1() {
+ if (_dr01 == -1) {
+ _dr01 = series_load("402dr01");
+ _dr01s = series_load("402dr01s");
+ }
+}
+
+void Room402::freeDr1() {
+ if (_dr01 != -1) {
+ series_unload(_dr01);
+ series_unload(_dr01);
+ _dr01 = _dr01s = -1;
+ }
+}
+
+void Room402::loadDr2() {
+ if (_dr02 == -1) {
+ _dr02 = series_load("402dr02");
+ _dr02s = series_load("402dr02s");
+ }
+}
+
+void Room402::freeDr2() {
+ if (_dr02 != -1) {
+ series_unload(_dr02);
+ series_unload(_dr02);
+ _dr02 = _dr02s = -1;
+ }
+}
+
+void Room402::loadDr8() {
+ if (_dr08 == -1) {
+ _dr08 = series_load("402dr08");
+ _dr08s = series_load("402dr08s");
+ }
+}
+
+void Room402::freeDr8() {
+ if (_dr08 != -1) {
+ series_unload(_dr08);
+ series_unload(_dr08);
+ _dr08 = _dr08s = -1;
+ }
+}
+
+void Room402::loadPe1() {
+ if (_pe01 == -1) {
+ _pe01 = series_load("402pe01");
+ _pe01s = series_load("402pe01s");
+ }
+}
+
+void Room402::freePe1() {
+ if (_pe01 != -1) {
+ series_unload(_pe01);
+ series_unload(_pe01s);
+ _pe01 = _pe01s = -1;
+ }
+}
+
+void Room402::loadPe2() {
+ if (_pe02 == -1) {
+ _pe02 = series_load("402pe02");
+ _pe02s = series_load("402pe02s");
+ }
+}
+
+void Room402::freePe2() {
+ if (_pe02 != -1) {
+ series_unload(_pe02);
+ series_unload(_pe02s);
+ _pe02 = _pe02s = -1;
+ }
+}
+
+void Room402::loadPe3() {
+ if (_pe03 == -1) {
+ _pe03 = series_load("403pe03");
+ _pe03s = series_load("403pe03s");
+ }
+}
+
+void Room402::freePe3() {
+ if (_pe03 != -1) {
+ series_unload(_pe03);
+ series_unload(_pe03s);
+ _pe03 = _pe03s = -1;
+ }
+}
+
+void Room402::loadPe4() {
+ if (_pe04 == -1) {
+ _pe04 = series_load("404pe04");
+ _pe04s = series_load("404pe04s");
+ }
+}
+
+void Room402::freePe4() {
+ if (_pe04 != -1) {
+ series_unload(_pe04);
+ series_unload(_pe04s);
+ _pe04 = _pe04s = -1;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index 6dadb68aa9e..a329613c5be 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -49,6 +49,47 @@ private:
static const seriesPlayBreak PLAY14[];
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
+ const char *_digiName = nullptr;
+ bool _flag1 = false;
+ bool _series1Set = false;
+ Series _series1;
+ bool _series2Set = false;
+ Series _series2;
+ int _dr01 = -1, _dr01s = -1;
+ int _dr02 = -1, _dr02s = -1;
+ int _dr03 = -1, _dr03s = -1;
+ int _dr08 = -1, _dr08s = -1;
+ int _pe01 = -1, _pe01s = -1;
+ int _pe02 = -1, _pe02s = -1;
+ int _pe03 = -1, _pe03s = -1;
+ int _pe04 = -1, _pe04s = -1;
+ int _wi01 = -1, _wi01s = -1;
+ int _wi02 = -1, _wi02s = -1;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+
+ void conv84();
+ void freeSeries1();
+ void freeSeries2();
+
+ void loadDr1();
+ void freeDr1();
+ void loadDr2();
+ void freeDr2();
+ void loadDr8();
+ void freeDr8();
+ void loadPe1();
+ void freePe1();
+ void loadPe2();
+ void freePe2();
+ void loadPe3();
+ void freePe3();
+ void loadPe4();
+ void freePe4();
public:
Room402() : Room() {}
@@ -56,6 +97,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 569c2a1b214..8cad8e558bf 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -135,6 +135,28 @@ void Section4::daemon() {
_G(kernel).continue_handling_trigger = true;
}
+void Section4::poof(int trigger) {
+ player_set_commands_allowed(false);
+ digi_preload("999_003");
+ player_update_info();
+
+ if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ ws_hide_walker();
+ series_play("999poof", _G(player_info).depth, 0, trigger, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ } else {
+ kernel_timing_trigger(120, trigger);
+ }
+
+ digi_play("999_003", 2);
+
+ if (!_G(flags)[V154] || imath_rand_bool(8)) {
+ digi_preload("402w005z");
+ digi_play("402w005z", 1);
+ _G(flags)[V154] = 1;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4.h b/engines/m4/burger/rooms/section4/section4.h
index c98744e6956..9f6312a89c1 100644
--- a/engines/m4/burger/rooms/section4/section4.h
+++ b/engines/m4/burger/rooms/section4/section4.h
@@ -47,6 +47,9 @@ private:
Room406 _room406;
Room407 _room407;
+public:
+ static void poof(int trigger);
+
public:
Section4();
virtual ~Section4() {}
Commit: 9e91b883405dbc5f2ba261b4a3e4eae0550ec3f8
https://github.com/scummvm/scummvm/commit/9e91b883405dbc5f2ba261b4a3e4eae0550ec3f8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added placeholder Walker class
Changed paths:
A engines/m4/riddle/walker.cpp
A engines/m4/riddle/walker.h
engines/m4/module.mk
engines/m4/riddle/vars.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 40f87a3fca6..233d589c919 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -193,7 +193,8 @@ MODULE_OBJS = \
riddle/riddle.o \
riddle/hotkeys.o \
riddle/inventory.o \
- ridle/vars.o
+ ridle/vars.o \
+ riddle/walker.o
# This module can be built as a plugin
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index 7daaec3e205..495abcff505 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -23,6 +23,7 @@
#define M4_RIDDLE_VARS_H
#include "common/textconsole.h"
+#include "m4/riddle/walker.h"
#include "m4/vars.h"
namespace M4 {
@@ -44,7 +45,8 @@ protected:
void main_cold_data_init() override;
public:
- // Globals go here
+ Riddle::Walker _walker;
+
public:
Vars();
virtual ~Vars();
@@ -56,7 +58,7 @@ public:
return nullptr;
}
M4::Walker *getWalker() override {
- return nullptr;
+ return &_walker;
}
void initialize_game() override;
diff --git a/engines/m4/riddle/walker.cpp b/engines/m4/riddle/walker.cpp
new file mode 100644
index 00000000000..e1e16f06682
--- /dev/null
+++ b/engines/m4/riddle/walker.cpp
@@ -0,0 +1,247 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/walker.h"
+#include "m4/riddle/vars.h"
+#include "m4/core/imath.h"
+#include "m4/graphics/gr_series.h"
+
+namespace M4 {
+namespace Riddle {
+
+// Starting hashes for walker machines/sequences/etc
+#define WALKER_HASH 8 // machine/data starting hash for wilbur
+#define WALKER_SERIES_HASH 0
+#define NUM_WALKER_SERIES 8
+#define SHADOW_SERIES_HASH 8
+#define NUM_SHADOW_SERIES 5
+
+// These are the walker types
+#define WALKER_WILBUR 0
+#define WALKER_FLUMIX 1
+
+// These are the shadow types
+#define SHADOW_WILBUR 0
+#define SHADOW_FLUMIX 1
+
+static const char *WILBUR_SERIES[8] = {
+ "WILBUR01", "WILBUR02", "WILBUR03", "WILBUR04", "WILBUR05",
+ "WILBUR07", "WILBUR08", "WILBUR09"
+};
+static const int16 WILBUR_SERIES_DIRS[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, -1
+};
+
+static const char *WILBUR_SHADOWS[5] = {
+ "WILBUR01_SHADOW", "WILBUR02_SHADOW", "WILBUR03_SHADOW",
+ "WILBUR04_SHADOW", "WILBUR05_SHADOW"
+};
+static const int16 WILBUR_SHADOWS_DIRS[6] = {
+ 8, 9, 10, 11, 12, -1
+};
+
+void Walker::player_walker_callback(frac16 myMessage, machine *sender) {
+#ifdef TODO
+ int32 triggerType, soundNumber;
+
+ triggerType = _G(globals)[GLB_TEMP_1] >> 16;
+
+ switch (triggerType) {
+ case 0:
+ // Ignore this trigger, it's not important
+ break;
+
+ case 1:
+ // Specific action is finished
+ // If user trigger is desired, dispatch it
+ if (myMessage >> 16 >= 0)
+ // Trigger will go to where it was called from
+ kernel_trigger_dispatchx(myMessage);
+ break;
+
+ case 2:
+ // Walker has arrived at a node
+ if (walker_has_walk_finished(sender)) {
+ // Walks walker to next node if not at end of walk
+ sendWSMessage(ENDWALK << 16, 0, sender, 0, nullptr, 1);
+ }
+ break;
+
+ case 3:
+ // Walker has finished his walk and is facing final direction
+ _G(player).waiting_for_walk = false;
+
+ // if user trigger is desired, dispatch it
+ if (myMessage >> 16 >= 0)
+ // trigger will go to where it was called from
+ kernel_trigger_dispatchx(myMessage);
+ break;
+
+ case 20:
+ // Walker wants to make a sound
+ soundNumber = myMessage >> 16;
+ switch (soundNumber) {
+ case 21:
+ case 22:
+ case 25:
+ if (!_G(flags)[V298])
+ _G(digi).playRandom();
+ break;
+
+ case 23:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("crack1", 1, 50, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 2:
+ digi_play("crack2", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ case 3:
+ digi_play("crack3", 1, 80, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 24:
+ if (!_G(flags)[V298])
+ digi_play("hmmm", 1, 60, NO_TRIGGER, GLOBAL_SCENE);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ _G(player).waiting_for_walk = false;
+ break;
+ }
+#endif
+}
+
+bool Walker::walk_load_walker_and_shadow_series() {
+ return ws_walk_load_walker_series(WILBUR_SERIES_DIRS, WILBUR_SERIES, true) &&
+ ws_walk_load_shadow_series(WILBUR_SHADOWS_DIRS, WILBUR_SHADOWS);
+}
+
+machine *Walker::walk_initialize_walker() {
+#ifdef TODO
+ machine *m;
+ int32 s;
+
+ if (!_G(player).walker_in_this_scene) {
+ _G(roomVal2) = 0;
+ m = nullptr;
+
+ } else {
+ _G(roomVal2) = 1;
+
+ // Wilbur walker
+ _G(player).walker_type = WALKER_WILBUR;
+ _G(player).shadow_type = SHADOW_WILBUR;
+
+ _G(globals)[GLB_TEMP_1] = _G(player).walker_type << 16;
+ _G(globals)[GLB_TEMP_2] = WALKER_SERIES_HASH << 24; // starting series hash of default walker GAMECTRL loads shadows starting @ 0
+ _G(globals)[GLB_TEMP_3] = SHADOW_SERIES_HASH << 24; // starting series hash of default walker shadows. GAMECTRL loads shadows starting @ 10
+
+ // initialize with bogus data (this is for the real walker)
+ s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
+ _G(globals)[GLB_TEMP_4] = 320 << 16;
+ _G(globals)[GLB_TEMP_5] = 400 << 16;
+ _G(globals)[GLB_TEMP_6] = s;
+ _G(globals)[GLB_TEMP_7] = 3 << 16; // facing
+
+ m = TriggerMachineByHash(WALKER_HASH, nullptr, _G(player).walker_type + WALKER_HASH, 0, player_walker_callback, false, "Wilbur Walker");
+
+ // we need to all init sequences to happen immediately (init coordinates)
+ cycleEngines(nullptr, &(_G(currentSceneDef).depth_table[0]),
+ nullptr, (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
+
+ _G(inverse_pal)->release();
+ }
+
+ return m;
+#else
+ return nullptr;
+#endif
+}
+
+void Walker::reset_walker_sprites() {
+#ifdef TODO
+ if (_G(roomVal3)) {
+ for (int i = 0; WILBUR_SERIES_DIRS[i] != -1; ++i) {
+ series_load(WILBUR_SERIES[i], WILBUR_SERIES_DIRS[i]);
+ }
+ }
+
+ ws_unhide_walker(_G(my_walker));
+ gr_restore_palette();
+ kernel_timing_trigger(1, 1026);
+#endif
+}
+
+void Walker::unloadSprites() {
+ if (_G(player).walker_in_this_scene) {
+ term_message("Unloading Wilbur walker...");
+ player_update_info();
+
+ // Send message for the unload
+ sendWSMessage(0x60000, 0, _G(my_walker), 0, nullptr, 1);
+ _G(player).walker_in_this_scene = false;
+
+ for (int i = 0; i < 7; ++i)
+ series_unload(i);
+
+ // TODO: This seems like it would leak memory
+ _G(my_walker) = nullptr;
+ }
+}
+
+void enable_player() {
+ player_set_commands_allowed(true);
+ ws_unhide_walker(_G(my_walker));
+}
+
+void disable_player() {
+ player_set_commands_allowed(false);
+ ws_hide_walker(_G(my_walker));
+}
+
+void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigger) {
+#ifdef TODO
+ _G(player_facing_x) = facing_x;
+ _G(player_facing_y) = facing_y;
+ _G(player_trigger) = trigger;
+ player_hotspot_walk_override(x, y, -1, gSET_FACING);
+#endif
+}
+
+void player_walk_to(int32 x, int32 y, int trigger) {
+#ifdef TODO
+ player_walk_to(x, y, _G(hotspot_x), _G(hotspot_y), trigger);
+#endif
+}
+
+} // namespace Riddle
+} // namespace M4
+
diff --git a/engines/m4/riddle/walker.h b/engines/m4/riddle/walker.h
new file mode 100644
index 00000000000..9e873309195
--- /dev/null
+++ b/engines/m4/riddle/walker.h
@@ -0,0 +1,58 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_WALKER_H
+#define M4_RIDDLE_WALKER_H
+
+#include "common/array.h"
+#include "m4/adv_r/adv_walk.h"
+
+namespace M4 {
+namespace Riddle {
+
+class Walker : public M4::Walker {
+private:
+ /**
+ * This is called when PLAYER walker code sends system message back to C (used by MAIN PLAYER WALKER ONLY)
+ */
+ static void player_walker_callback(frac16 myMessage, machine *sender);
+
+public:
+ ~Walker() override {}
+
+ bool walk_load_walker_and_shadow_series() override;
+ machine *walk_initialize_walker() override;
+
+ void reset_walker_sprites();
+ static void unloadSprites();
+};
+
+extern void enable_player();
+extern void disable_player();
+extern void wilbur_abduct(int trigger);
+extern void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigger = -1);
+extern void player_walk_to(int32 x, int32 y, int trigger = -1);
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
Commit: b1a90c95e6c9e07d3f64c40c8a715e9881692354
https://github.com/scummvm/scummvm/commit/b1a90c95e6c9e07d3f64c40c8a715e9881692354
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Fix accessing HAS file
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/fileio/sys_file.cpp
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/metaengine.cpp
engines/m4/riddle/riddle.cpp
engines/m4/riddle/riddle.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index bd45c60b89e..fef6fca9ede 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -243,7 +243,7 @@ static const char *GLOBAL_PARSER_LIST[] = {
nullptr
};
-BurgerEngine::BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+BurgerEngine::BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
_sections.push_back(&_section2);
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 9cfa202d8a9..2457f7d9b36 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -69,7 +69,7 @@ protected:
M4::Vars *createVars() override;
public:
- BurgerEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc);
~BurgerEngine() override {}
/**
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 445e5517dfb..2b6c53095ef 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -651,7 +651,7 @@ void sysfile_init(bool in_hag_mode) {
if (in_hag_mode) {
_G(hag).hash_file = Common::String::format("%s.has",
- g_engine->getGameId().c_str());
+ g_engine->getGameType() == GType_Riddle ? "ripley" : "burger");
term_message("Initialized in hag mode");
} else {
term_message("Initialized in file mode");
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 87017000745..088dbb1591c 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -42,7 +42,7 @@ namespace M4 {
M4Engine *g_engine;
-M4Engine::M4Engine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("M4") {
g_engine = this;
}
@@ -52,15 +52,19 @@ M4Engine::~M4Engine() {
}
uint32 M4Engine::getFeatures() const {
- return _gameDescription->flags;
+ return _gameDescription->desc.flags;
}
Common::String M4Engine::getGameId() const {
- return _gameDescription->gameId;
+ return _gameDescription->desc.gameId;
+}
+
+int M4Engine::getGameType() const {
+ return _gameDescription->gameType;
}
Common::Language M4Engine::getLanguage() const {
- return _gameDescription->language;
+ return _gameDescription->desc.language;
}
Common::Error M4Engine::run() {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 6c19d2da2e8..725563c42b3 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -44,7 +44,7 @@ struct M4GameDescription;
class M4Engine : public Engine, public Sections {
private:
- const ADGameDescription *_gameDescription;
+ const M4GameDescription *_gameDescription;
Common::RandomSource _randomSource;
/**
@@ -65,7 +65,7 @@ public:
Graphics::Screen *_screen = nullptr;
public:
- M4Engine(OSystem *syst, const ADGameDescription *gameDesc);
+ M4Engine(OSystem *syst, const M4GameDescription *gameDesc);
~M4Engine() override;
uint32 getFeatures() const;
@@ -75,6 +75,11 @@ public:
*/
Common::String getGameId() const;
+ /**
+ * Returns the game type
+ */
+ int getGameType() const;
+
/**
* Return game language
*/
diff --git a/engines/m4/metaengine.cpp b/engines/m4/metaengine.cpp
index 0e78bba0996..303a576b6a7 100644
--- a/engines/m4/metaengine.cpp
+++ b/engines/m4/metaengine.cpp
@@ -58,10 +58,10 @@ Common::Error M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const
switch (gd->gameType) {
case M4::GType_Burger:
- *engine = new M4::Burger::BurgerEngine(syst, desc);
+ *engine = new M4::Burger::BurgerEngine(syst, gd);
break;
case M4::GType_Riddle:
- *engine = new M4::Riddle::RiddleEngine(syst, desc);
+ *engine = new M4::Riddle::RiddleEngine(syst, gd);
break;
default:
return Common::kUnsupportedGameidError;
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
index 486154e8c8d..40f0c5ec2aa 100644
--- a/engines/m4/riddle/riddle.cpp
+++ b/engines/m4/riddle/riddle.cpp
@@ -27,7 +27,7 @@
namespace M4 {
namespace Riddle {
-RiddleEngine::RiddleEngine(OSystem *syst, const ADGameDescription *gameDesc) :
+RiddleEngine::RiddleEngine(OSystem *syst, const M4GameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
}
diff --git a/engines/m4/riddle/riddle.h b/engines/m4/riddle/riddle.h
index 64b72f600fa..93099067960 100644
--- a/engines/m4/riddle/riddle.h
+++ b/engines/m4/riddle/riddle.h
@@ -35,7 +35,7 @@ protected:
M4::Vars *createVars() override;
public:
- RiddleEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ RiddleEngine(OSystem *syst, const M4GameDescription *gameDesc);
~RiddleEngine() override {}
/**
Commit: 1121536d6a62e1e1485660270738c656ff0b35b8
https://github.com/scummvm/scummvm/commit/1121536d6a62e1e1485660270738c656ff0b35b8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added Hotkeys instance
Changed paths:
engines/m4/riddle/vars.h
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index 495abcff505..edb08ae753a 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -23,6 +23,7 @@
#define M4_RIDDLE_VARS_H
#include "common/textconsole.h"
+#include "m4/riddle/hotkeys.h"
#include "m4/riddle/walker.h"
#include "m4/vars.h"
@@ -46,6 +47,7 @@ protected:
public:
Riddle::Walker _walker;
+ Riddle::Hotkeys _hotkeys;
public:
Vars();
@@ -55,7 +57,7 @@ public:
return nullptr;
}
Hotkeys *getHotkeys() override {
- return nullptr;
+ return &_hotkeys;
}
M4::Walker *getWalker() override {
return &_walker;
Commit: a66adde6fa7f306020c6d641282827fef330055e
https://github.com/scummvm/scummvm/commit/a66adde6fa7f306020c6d641282827fef330055e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Properly hooked up placeholder section 9
Changed paths:
engines/m4/module.mk
engines/m4/riddle/riddle.cpp
engines/m4/riddle/riddle.h
engines/m4/riddle/rooms/section.cpp
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 233d589c919..864e6af95d3 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -181,6 +181,8 @@ MODULE_OBJS = \
burger/series_player.o \
burger/vars.o \
burger/walker.o \
+ riddle/rooms/section.o \
+ riddle/rooms/section9/section9.o \
riddle/rooms/section9/room901.o \
riddle/rooms/section9/room902.o \
riddle/rooms/section9/room903.o \
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
index 40f0c5ec2aa..551ab4cd056 100644
--- a/engines/m4/riddle/riddle.cpp
+++ b/engines/m4/riddle/riddle.cpp
@@ -29,6 +29,15 @@ namespace Riddle {
RiddleEngine::RiddleEngine(OSystem *syst, const M4GameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section9);
}
M4::Vars *RiddleEngine::createVars() {
diff --git a/engines/m4/riddle/riddle.h b/engines/m4/riddle/riddle.h
index 93099067960..4029ace73a9 100644
--- a/engines/m4/riddle/riddle.h
+++ b/engines/m4/riddle/riddle.h
@@ -23,11 +23,15 @@
#define M4_RIDDLE_RIDDLE_H
#include "m4/m4.h"
+#include "m4/riddle/rooms/section9/section9.h"
namespace M4 {
namespace Riddle {
class RiddleEngine : public M4Engine {
+private:
+ Rooms::Section9 _section9;
+
protected:
/**
* Creates the structure that holds all the global variables
diff --git a/engines/m4/riddle/rooms/section.cpp b/engines/m4/riddle/rooms/section.cpp
index c5b4b506ee8..34b1cb8b984 100644
--- a/engines/m4/riddle/rooms/section.cpp
+++ b/engines/m4/riddle/rooms/section.cpp
@@ -129,14 +129,18 @@ void Section::global_room_init() {
}
void Section::init_series_players() {
+#ifdef TODO
_G(seriesPlayers).clear();
+#endif
}
void Section::tick() {
+#ifdef TODO
int oldTrigger = _G(kernel).trigger;
_G(kernel).trigger = gCALLED_EACH_LOOP;
g_engine->game_daemon_code();
_G(kernel).trigger = oldTrigger;
+#endif
}
void Section::daemon() {
Commit: 6720a21f1c361060d0a154655df0c9ad15bea557
https://github.com/scummvm/scummvm/commit/6720a21f1c361060d0a154655df0c9ad15bea557
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: First title room showing
Changed paths:
A engines/m4/riddle/gui/interface.cpp
A engines/m4/riddle/gui/interface.h
engines/m4/module.mk
engines/m4/riddle/vars.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 864e6af95d3..8fa658135c2 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -181,6 +181,7 @@ MODULE_OBJS = \
burger/series_player.o \
burger/vars.o \
burger/walker.o \
+ riddle/gui/interface.o \
riddle/rooms/section.o \
riddle/rooms/section9/section9.o \
riddle/rooms/section9/room901.o \
diff --git a/engines/m4/riddle/gui/interface.cpp b/engines/m4/riddle/gui/interface.cpp
new file mode 100644
index 00000000000..455da80d938
--- /dev/null
+++ b/engines/m4/riddle/gui/interface.cpp
@@ -0,0 +1,564 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/gui/interface.h"
+#include "m4/core/cstring.h"
+#include "m4/core/errors.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_event.h"
+#include "m4/gui/gui_vmng.h"
+#include "m4/riddle/riddle.h"
+#include "m4/riddle/vars.h"
+#include "m4/adv_r/other.h"
+
+namespace M4 {
+namespace Riddle {
+namespace GUI {
+
+#define INTERFACE_SPRITES 22
+
+Interface::Interface() : M4::Interface() {
+ _x1 = 0;
+ _y1 = 374;
+ _x2 = SCREEN_WIDTH;
+ _y2 = SCREEN_HEIGHT;
+}
+
+bool Interface::init(int arrow, int wait, int look, int grab, int use) {
+ M4::Interface::init(arrow, wait, look, grab, use);
+
+ _sprite = series_load("999intr", 22, nullptr);
+ if (_sprite != 22)
+ error_show(FL, 'SLF!');
+
+ mouse_set_sprite(arrow);
+
+ if (!_G(gameInterfaceBuff)) {
+ _G(gameInterfaceBuff) = new GrBuff(_x2 - _x1, _y2 - _y1);
+ setup();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+Interface::~Interface() {
+#ifdef TODO
+ delete _interfaceBox;
+ delete _inventory;
+ delete _textField;
+ delete _btnTake;
+ delete _btnManipulate;
+ delete _btnHandle;
+ delete _btnAbductFail;
+ delete _btnMenu;
+ delete _btnScrollLeft;
+ delete _btnScrollRight;
+#endif
+}
+
+void Interface::show() {
+#ifdef TODO
+ M4::Interface::show();
+ _interfaceBox->_must_redraw_all = true;
+ vmng_screen_show(_G(gameInterfaceBuff));
+ _visible = true;
+ track_hotspots_refresh();
+#endif
+}
+
+void Interface::setup() {
+#ifdef TODO
+ _interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
+ _inventory = new GUI::Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
+ _textField = new TextField(200, 1, 450, 21);
+ _btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5, INTERFACE_SPRITES);
+ _btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8, INTERFACE_SPRITES);
+ _btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2, INTERFACE_SPRITES);
+
+ _interfaceBox->add(_btnTake);
+ _interfaceBox->add(_btnManipulate);
+ _interfaceBox->add(_btnHandle);
+
+
+ if (_G(executing) == WHOLE_GAME) {
+ _btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
+ _btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78, INTERFACE_SPRITES);
+ _interfaceBox->add(_btnAbductFail);
+ _interfaceBox->add(_btnMenu);
+
+ } else {
+ _btnAbductFail = new ButtonClass(RectClass(580, 22, 620, 75), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
+ _interfaceBox->add(_btnAbductFail);
+ }
+
+ _btnScrollLeft = new ButtonClass(RectClass(168, 22, 188, 97), "scroll left", 8, 59, 60, 61, 62, INTERFACE_SPRITES);
+ _btnScrollRight = new ButtonClass(RectClass(539, 22, 559, 97), "scroll right", 9, 63, 64, 65, 66, INTERFACE_SPRITES);
+ _interfaceBox->add(_btnScrollLeft);
+ _interfaceBox->add(_btnScrollRight);
+#endif
+}
+
+void Interface::cancel_sentence() {
+#ifdef TODO
+ _textField->set_string(" ");
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = false;
+ _G(player).command_ready = false;
+
+ _prepText[0] = '\0';
+ _nounText[0] = '\0';
+ _verbText[0] = '\0';
+ _iconSelected = false;
+
+ track_hotspots_refresh();
+#endif
+}
+
+void Interface::freshen_sentence() {
+#ifdef TODO
+ _textField->set_string(" ");
+ _G(player).need_to_walk = false;
+ _G(player).ready_to_walk = _G(player).need_to_walk;
+ _G(player).command_ready = _G(player).ready_to_walk;
+ _prepText[0] = '\0';
+ _nounText[0] = '\0';
+
+ track_hotspots_refresh();
+#endif
+}
+
+bool Interface::set_interface_palette(RGB8 *myPalette) {
+ gr_pal_set_RGB8(&myPalette[1], 0, 68, 0);
+ gr_pal_set_RGB8(&myPalette[2], 0, 134, 0);
+ gr_pal_set_RGB8(&myPalette[3], 0, 204, 0);
+ gr_pal_set_RGB8(&myPalette[4], 28, 8, 90);
+ gr_pal_set_RGB8(&myPalette[5], 204, 204, 250);
+ gr_pal_set_RGB8(&myPalette[6], 204, 204, 102);
+ gr_pal_set_RGB8(&myPalette[7], 5, 1, 0);
+ gr_pal_set_RGB8(&myPalette[8], 102, 51, 222);
+ gr_pal_set_RGB8(&myPalette[9], 85, 117, 255);
+ gr_pal_set_RGB8(&myPalette[10], 68, 68, 68);
+ gr_pal_set_RGB8(&myPalette[11], 51, 255, 0);
+ gr_pal_set_RGB8(&myPalette[12], 51, 51, 115);
+ gr_pal_set_RGB8(&myPalette[13], 119, 119, 119);
+ gr_pal_set_RGB8(&myPalette[14], 151, 153, 150);
+ gr_pal_set_RGB8(&myPalette[15], 153, 0, 0);
+ gr_pal_set_RGB8(&myPalette[16], 153, 53, 9);
+ gr_pal_set_RGB8(&myPalette[17], 117, 246, 255);
+ gr_pal_set_RGB8(&myPalette[18], 88, 0, 0);
+ gr_pal_set_RGB8(&myPalette[19], 195, 0, 83);
+ gr_pal_set_RGB8(&myPalette[20], 204, 102, 61);
+ gr_pal_set_RGB8(&myPalette[21], 204, 153, 118);
+ gr_pal_set_RGB8(&myPalette[22], 204, 255, 204);
+ gr_pal_set_RGB8(&myPalette[23], 207, 158, 73);
+ gr_pal_set_RGB8(&myPalette[24], 238, 0, 0);
+ gr_pal_set_RGB8(&myPalette[25], 248, 51, 31);
+ gr_pal_set_RGB8(&myPalette[26], 255, 131, 0);
+ gr_pal_set_RGB8(&myPalette[27], 255, 153, 102);
+ gr_pal_set_RGB8(&myPalette[28], 255, 204, 153);
+ gr_pal_set_RGB8(&myPalette[29], 255, 252, 144);
+ gr_pal_set_RGB8(&myPalette[30], 255, 255, 0);
+ gr_pal_set_RGB8(&myPalette[31], 255, 255, 255);
+ gr_pal_set_range(myPalette, 1, 31);
+
+ return true;
+}
+
+void Interface::track_hotspots_refresh() {
+ _hotspot = nullptr;
+ --_savedX;
+
+ bool z = false;
+ eventHandler(_G(gameInterfaceBuff), EVENT_MOUSE, 1,
+ _G(MouseState).CursorColumn, _G(MouseState).CursorRow, &z);
+}
+
+bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+#ifdef TODO
+ if (eventType != EVENT_MOUSE)
+ return false;
+
+ if (_G(kernel).fading_to_grey && event == _ME_L_release) {
+ kernel_unexamine_inventory_object(_G(master_palette), 5, 1);
+ return true;
+ }
+
+ if (player_commands_allowed()) {
+ if (x == _savedX && y == _savedY && event != _ME_L_click &&
+ event != _ME_L_release && event != _ME_L_hold && event != _ME_L_drag)
+ return true;
+
+ _savedX = x;
+ _savedY = y;
+
+ ControlStatus status = _interfaceBox->track(event, x - _x1, y - _y1);
+
+ switch (status) {
+ case NOTHING:
+ _state = NOTHING;
+ break;
+ case SELECTED:
+ trackIcons();
+ break;
+ default:
+ _state = IN_CONTROL;
+ break;
+ }
+
+ if (_state == NOTHING || _state == OVER_CONTROL) {
+ status = _inventory->track(event, x - _x1, y - _y1);
+ handleState(status);
+ _state = status ? OVER_CONTROL : NOTHING;
+ }
+
+ if (_state == NOTHING) {
+ int32 scrStatus;
+ ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
+ if (!screen)
+ return false;
+
+ if (y >= _y1) {
+ if (!_iconSelected)
+ mouse_set_sprite(kArrowCursor);
+
+ _textField->set_string(" ");
+ }
+
+ if (trackHotspots(event, x - screen->x1, y - screen->y1) == SELECTED)
+ dispatch_command();
+ }
+ }
+
+ if (_interfaceBox->_must_redraw_all) {
+ _textField->_must_redraw = true;
+ _inventory->_must_redraw_all = true;
+ }
+
+ _interfaceBox->draw(_G(gameInterfaceBuff));
+ _textField->draw(_G(gameInterfaceBuff));
+ _inventory->draw(_G(gameInterfaceBuff));
+#endif
+ return true;
+}
+
+void Interface::refresh_right_arrow() {
+#ifdef TODO
+ if (_inventory->need_right() || _inventory->need_left()) {
+ _btnScrollRight->set_sprite_unknown(63);
+ _btnScrollRight->set_sprite_relaxed(64);
+ _btnScrollRight->set_sprite_picked(66);
+ _btnScrollRight->set_sprite_over(65);
+ _btnScrollRight->unhide();
+ } else {
+ _btnScrollRight->hide();
+ _btnScrollLeft->hide();
+ }
+#endif
+}
+
+void Interface::refresh_left_arrow() {
+#ifdef TODO
+ if (_inventory->need_right() || _inventory->need_left()) {
+ _btnScrollLeft->set_sprite_unknown(59);
+ _btnScrollLeft->set_sprite_relaxed(60);
+ _btnScrollLeft->set_sprite_picked(62);
+ _btnScrollLeft->set_sprite_over(61);
+ _btnScrollLeft->unhide();
+ } else {
+ _btnScrollRight->hide();
+ _btnScrollLeft->hide();
+ }
+#endif
+}
+
+void Interface::trackIcons() {
+#ifdef TODO
+ KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ switch (_interfaceBox->_highlight_index) {
+ case 4:
+ t_cb();
+ break;
+
+ case 5:
+ l_cb();
+ break;
+
+ case 6:
+ mouse_set_sprite(_arrow);
+ _iconSelected = false;
+
+ if (_btnScrollRight->is_hidden())
+ refresh_right_arrow();
+ else
+ _btnScrollRight->hide();
+
+ if (_btnScrollLeft->is_hidden())
+ refresh_left_arrow();
+ else
+ _btnScrollLeft->hide();
+ break;
+
+ case 7:
+ u_cb();
+ break;
+
+ case 8:
+ if (!_btnScrollLeft->is_hidden()) {
+ if (_inventory->need_left()) {
+ _inventory->_scroll = (_inventory->_scroll <= 0) ? 0 :
+ _inventory->_scroll - _inventory->_cells_v;
+ }
+
+ refresh_right_arrow();
+ refresh_left_arrow();
+ _inventory->_must_redraw_all = true;
+ } else {
+ return;
+ }
+ break;
+
+ case 9:
+ if (!_btnScrollRight->is_hidden()) {
+ if (_inventory->need_right())
+ _inventory->_scroll += _inventory->_cells_v;
+
+ refresh_right_arrow();
+ refresh_left_arrow();
+ _inventory->_must_redraw_all = true;
+ } else {
+ return;
+ }
+ break;
+
+ case 10:
+ term_message("Abduct/Fail Button Pressed");
+
+ if (_G(game).section_id == 1) {
+ term_message("Abduct me now!");
+ _G(wilbur_should) = 10017;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (_G(game).section_id == 7) {
+ _G(walker).wilbur_speech("999w023");
+ } else {
+ term_message("Fail me now!");
+ _G(wilbur_should) = 10015;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 11:
+ // Game menu
+ other_save_game_for_resurrection();
+ CreateGameMenu(_G(master_palette));
+ break;
+
+ }
+
+ _G(kernel).trigger_mode = oldMode;
+#endif
+}
+
+ControlStatus Interface::trackHotspots(int event, int x, int y) {
+#ifdef TODO
+ const HotSpotRec *hotspot = g_engine->_activeRoom->custom_hotspot_which(x, y);
+ if (!hotspot)
+ hotspot = hotspot_which(_G(currentSceneDef).hotspots, x, y);
+
+ if (hotspot != _hotspot) {
+ if (!hotspot) {
+ _textField->set_string(" ");
+ _hotspot = nullptr;
+ return NOTHING;
+ }
+
+ if (!_iconSelected) {
+ if (!mouse_set_sprite(hotspot->cursor_number))
+ mouse_set_sprite(kArrowCursor);
+
+ strncpy(_verbText, hotspot->verb, 40);
+ }
+
+ Common::String tmp = (g_engine->getLanguage() == Common::EN_ANY) ?
+ hotspot->vocab : hotspot->prep;
+ tmp.toUppercase();
+ _textField->set_string(tmp.c_str());
+
+ tmp = hotspot->vocab;
+ tmp.toUppercase();
+ strncpy(_nounText, tmp.c_str(), 40);
+
+ _hotspot = hotspot;
+ }
+
+ if (event == 5 && hotspot) {
+ _G(player).walk_x = x;
+ _G(player).walk_y = y;
+ _G(click_x) = x;
+ _G(click_y) = y;
+
+ if (hotspot) {
+ if (hotspot->feet_x != 0x7fff)
+ _G(player).walk_x = hotspot->feet_x;
+ if (hotspot->feet_y != 0x7fff)
+ _G(player).walk_y = hotspot->feet_y;
+ }
+
+ _G(player).walk_facing = hotspot->facing;
+ _hotspot = nullptr;
+
+ return SELECTED;
+ } else {
+ return IN_CONTROL;
+ }
+#endif
+ return NOTHING;
+}
+
+void Interface::dispatch_command() {
+ --_savedX;
+ cstrncpy(_G(player).verb, _verbText, 40);
+ cstrncpy(_G(player).noun, _nounText, 40);
+ cstrncpy(_G(player).prep, _prepText, 40);
+
+ _G(player).waiting_for_walk = true;
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+ _G(player).command_ready = true;
+ _G(kernel).trigger = -1;
+ _G(kernel).trigger_mode = KT_PREPARSE;
+ _iconSelected = false;
+
+ mouse_set_sprite(_arrow);
+ _G(player).walker_trigger = -1;
+
+ g_engine->_activeRoom->pre_parser();
+ g_engine->_activeSection->pre_parser();
+ g_engine->global_pre_parser();
+}
+
+void Interface::handleState(ControlStatus status) {
+#ifdef TODO
+ int highlight = _inventory->_highlight;
+ int index = _inventory->_scroll + highlight;
+
+ switch (status) {
+ case NOTHING:
+ _hotspot = nullptr;
+ cstrncpy(_nounText, " ", 40);
+ _textField->set_string(" ");
+ break;
+
+ case OVER_CONTROL:
+ if (highlight < -1 || (highlight != -1 && (
+ highlight < 128 || highlight > 129))) {
+ _hotspot = nullptr;
+ cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+ }
+ break;
+
+ case SELECTED:
+ if (highlight != -1 && _inventory->_items[index]._cell != -1) {
+ if (_iconSelected) {
+ _hotspot = nullptr;
+ cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+
+ term_message("got %d", index);
+ dispatch_command();
+
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = false;
+ _G(player).waiting_for_walk = false;
+ } else {
+ _hotspot = nullptr;
+ cstrncpy(_verbText, _inventory->_items[index]._name.c_str(), 40);
+
+ if (g_engine->getLanguage() == Common::EN_ANY) {
+ _textField->set_string(_inventory->_items[index]._name.c_str());
+ } else {
+ _textField->set_string(_inventory->_items[index]._verb.c_str());
+ }
+
+ mouse_set_sprite(_inventory->_items[index]._cursor);
+ _iconSelected = true;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+#endif
+}
+
+void Interface::l_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "look at");
+ mouse_set_sprite(_look);
+ _iconSelected = true;
+ _G(cursor_state) = kLOOK;
+ }
+}
+
+void Interface::u_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "gear");
+ mouse_set_sprite(_use);
+ _iconSelected = true;
+ _G(cursor_state) = kUSE;
+ }
+}
+
+void Interface::t_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "take");
+ mouse_set_sprite(_grab);
+ _iconSelected = true;
+ _G(cursor_state) = kTAKE;
+ }
+}
+
+void Interface::a_cb() {
+ if (player_commands_allowed() && INTERFACE_VISIBLE) {
+ Common::strcpy_s(_verbText, "<><><><><><><><>");
+ mouse_set_sprite(_arrow);
+ _iconSelected = true;
+ _G(cursor_state) = kARROW;
+ }
+}
+
+} // namespace GUI
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/gui/interface.h b/engines/m4/riddle/gui/interface.h
new file mode 100644
index 00000000000..9e98dfa025e
--- /dev/null
+++ b/engines/m4/riddle/gui/interface.h
@@ -0,0 +1,89 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_INTERFACE_H
+#define M4_RIDDLE_INTERFACE_H
+
+#include "m4/adv_r/adv_interface.h"
+#include "m4/adv_r/adv_hotspot.h"
+#include "m4/graphics/graphics.h"
+#include "m4/graphics/gr_buff.h"
+
+namespace M4 {
+namespace Riddle {
+namespace GUI {
+
+enum ControlStatus {
+ NOTHING, IN_CONTROL, OVER_CONTROL, SELECTED, TRACKING
+};
+
+struct Interface : public M4::Interface {
+private:
+ void setup();
+
+ void trackIcons();
+ ControlStatus trackHotspots(int event, int x, int y);
+ void dispatch_command();
+ void handleState(ControlStatus status);
+
+public:
+ int _sprite = 22; // main_interface_sprite;
+ bool _shown = false;
+ const HotSpotRec *_hotspot = nullptr;
+ int _savedX = 0, _savedY = 0;
+ char _prepText[40] = { 0 };
+ char _nounText[40] = { 0 };
+ char _verbText[40] = { 0 };
+ bool _iconSelected = false;
+ int _state = 0;
+
+ Interface();
+ ~Interface() override;
+
+ bool init(int arrow, int wait, int look, int grab, int use) override;
+
+ void cancel_sentence() override;
+
+ void freshen_sentence() override;
+
+ bool set_interface_palette(RGB8 *myPalette) override;
+
+ void track_hotspots_refresh() override;
+
+ bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
+
+ void show() override;
+
+ void refresh_right_arrow();
+ void refresh_left_arrow();
+
+ void l_cb();
+ void u_cb();
+ void t_cb();
+ void a_cb();
+};
+
+} // namespace Interface
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index edb08ae753a..a055cabbcef 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -25,6 +25,7 @@
#include "common/textconsole.h"
#include "m4/riddle/hotkeys.h"
#include "m4/riddle/walker.h"
+#include "m4/riddle/gui/interface.h"
#include "m4/vars.h"
namespace M4 {
@@ -48,13 +49,14 @@ protected:
public:
Riddle::Walker _walker;
Riddle::Hotkeys _hotkeys;
+ Riddle::GUI::Interface _interface;
public:
Vars();
virtual ~Vars();
M4::Interface *getInterface() override {
- return nullptr;
+ return &_interface;
}
Hotkeys *getHotkeys() override {
return &_hotkeys;
Commit: 09a5857f9e9fff28743626be6b7b4a02eb7e2d86
https://github.com/scummvm/scummvm/commit/09a5857f9e9fff28743626be6b7b4a02eb7e2d86
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 402 conv84
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 04577db4927..a4a5ccf956c 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -481,7 +481,127 @@ void Room402::parser() {
}
void Room402::conv84() {
- // TODO
+ int who = conv_whos_talking();
+ int entry = conv_current_entry();
+ int node = conv_current_node();
+ const char *sound = conv_sound_to_play();
+
+ switch (_G(kernel).trigger) {
+ case 6:
+ if (who == 0) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (node == 3 && entry == 1) {
+ _val2 = 47;
+ kernel_trigger_dispatch_now(2);
+ } else if (node == 1 && entry == 1) {
+ _val2 = 39;
+ kernel_trigger_dispatch_now(2);
+ } else if (node == 9 && entry == 0) {
+ _val2 = 39;
+ kernel_trigger_dispatch_now(2);
+ term_message("--------------------------------");
+ } else if (node == 9 && entry == 2) {
+ _val2 = 15;
+ kernel_trigger_dispatch_now(2);
+ term_message("HHHHHHHHHHHHHHHHHH");
+ } else if ((node == 1 && entry == 6) ||
+ (node == 2 && entry == 0) ||
+ (node == 3 && entry == 0) ||
+ (node == 4 && entry == 0) ||
+ (node == 5 && entry == 0) ||
+ (node == 6 && entry == 1) ||
+ (node == 6 && entry == 3) ||
+ (node == 8 && entry == 1) ||
+ (node == 9 && entry == 1)) {
+ _val3 = 47;
+ } else {
+ term_message("xxxxxxxxxxxxxxxxxxxxx");
+ _val2 = 47;
+ kernel_trigger_dispatch_now(2);
+ }
+
+ conv_resume(conv_get_handle());
+ }
+ break;
+
+ case 21:
+ _val3 = 47;
+
+ if (_val5 == 45)
+ _G(kernel).trigger_mode = KT_DAEMON;
+ break;
+
+ default:
+ if (sound) {
+ if (who <= 0) {
+ _digiName = sound;
+ _flag1 = true;
+ _val1 = 6;
+
+ if (node == 1 && entry == 0)
+ kernel_timing_trigger(180, 21);
+
+ if ((node == 4 && entry == 0) ||
+ (node == 1 && entry == 6) ||
+ (node == 9 && entry == 1)) {
+ if (!(node == 9 && entry == 1))
+ _val2 = 7;
+
+ if (_val6 == 45)
+ _G(kernel).trigger_mode = KT_DAEMON;
+ }
+
+ if (node == 3 && entry == 1) {
+ _val2 = 40;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(2);
+ } else if (node == 6 && entry == 2) {
+ _val2 = 40;
+ } else if ((node == 1 && entry == 1) || (node == 9 && entry == 0)) {
+ _val2 = 40;
+
+ if (_val6 == 45)
+ _G(kernel).trigger_mode = KT_DAEMON;
+ } else if (node == 9 && entry == 2) {
+ _val2 = 40;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(2);
+ } else if ((node == 1 && entry == 6) ||
+ (node == 2 && entry == 0) ||
+ (node == 3 && entry == 0) ||
+ (node == 4 && entry == 0) ||
+ (node == 5 && entry == 0) ||
+ (node == 6 && entry == 1) ||
+ (node == 6 && entry == 3) ||
+ (node == 8 && entry == 1) ||
+ (node == 9 && entry == 1)) {
+ _val3 = 45;
+
+ if (_val5 == 45) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(3);
+ }
+ } else {
+ _val2 = 45;
+
+ if (_val6 == 45)
+ _G(kernel).trigger_mode = KT_DAEMON;
+ }
+ } else if (who == 1) {
+ if ((node == 1 && entry == 1) || (node == 1 && entry == 3)) {
+ _val2 = 39;
+
+ if (_val6 == 45)
+ _G(kernel).trigger_mode = KT_DAEMON;
+ }
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ wilbur_speech(sound, 10001);
+ }
+ }
+ break;
+ }
}
void Room402::freeSeries1() {
Commit: 8c443148b797e9b91b0b10af4ac1935a63a6b30c
https://github.com/scummvm/scummvm/commit/8c443148b797e9b91b0b10af4ac1935a63a6b30c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 402 daemon
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index a4a5ccf956c..f465ae5e74f 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -187,7 +187,7 @@ void Room402::init() {
_pe04 = _pe04s = -1;
_wi01 = _wi01s = -1;
_wi02 = _wi02s = -1;
- _series1Set = _series2Set = false;
+ _stolieSet = _series2Set = false;
pal_cycle_init(114, 127, 6);
digi_preload("400_001");
@@ -265,7 +265,605 @@ void Room402::init() {
}
void Room402::daemon() {
- // TODO
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ _val2 = 15;
+ if (_stolieSet)
+ kernel_trigger_dispatch_now(2);
+
+ _val3 = 15;
+ if (_series2Set)
+ kernel_trigger_dispatch_now(3);
+
+ player_set_commands_allowed(true);
+ break;
+
+ case 2:
+ switch (_val6) {
+ case 6:
+ freeDr8();
+ _wi02 = series_load("402wi02");
+ _wi02s = series_load("402wi02s");
+ series_play("402dr04", 0x300, 0, 11, 6, 0, 100, 0, 0, 0, 25);
+ series_play("420dr04s", 0x301, 0, -1, 6, 0, 100, 0, 0, 0, 25);
+ break;
+
+ case 7:
+ switch (_val2) {
+ case 7:
+ loadDr8();
+ _stolie.play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 75, 75);
+ break;
+
+ case 8:
+ _val6 = 45;
+ loadDr8();
+ _stolie.play("402dr08", 0x300, 2, 2, 6, 0, 100, 0, 0, 72, 75);
+ break;
+
+
+ default:
+ break;
+ }
+ break;
+
+ case 15:
+ switch (_val2) {
+ case 6:
+ _val6 = 6;
+ loadDr1();
+ Series::series_play("402dr01", 0x300, 0, 2, 6, 0, 100, 0, 0, 0, 7);
+ break;
+
+ case 8:
+ digi_unload_stream_breaks(SERIES1);
+ _val2 = 11;
+ series_play_with_breaks(PLAY2, "402dr06", 0x300, 2, 3);
+ break;
+
+ case 10:
+ _val2 = 8;
+ digi_preload("402_003");
+ series_play_with_breaks(PLAY1, "402DR10s", 0x300, -1, 2);
+ series_stream_with_breaks(SERIES1, "402dr10", 6, 0x300, 2);
+ break;
+
+ case 11:
+ _val2 = 12;
+ loadPe4();
+ series_play_with_breaks(PLAY3, "402DR11s", 0x301, -1, 2);
+ series_stream_with_breaks(SERIES2, "402dr11", 6, 0x300, 2);
+ break;
+
+ case 12:
+ digi_unload_stream_breaks(SERIES2);
+ _val2 = 13;
+ loadDr1();
+ Series::series_play("402dr01", 0x300, 0, 2, 6, 0, 100, 0, 0, 3, -1);
+ break;
+
+ case 13:
+ _stolieSet = true;
+ loadDr2();
+ _stolie.play("402dr02", 0x300, 0, -1, 6, -1, 100, 0, 0, 12, 12);
+ kernel_trigger_dispatch_now(27);
+ break;
+
+ case 15:
+ loadDr8();
+ series_play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+ series_play("402dr08s", 0x301, 0, -1, 60, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 16:
+ Series::series_play("402dr12", 0x300, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 40:
+ _val6 = 39;
+ loadDr1();
+ _stolie.play("402dr01", 0x300, 0, 2, 6);
+ break;
+
+ case 45:
+ case 47:
+ _val6 = 48;
+ playRandom1();
+ loadDr8();
+ Series::series_play("402dr08", 0x300, 0, 2, 5, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 46:
+ _val6 = 45;
+ freeDr8();
+ series_play_with_breaks(PLAY16, "402dr08", 0x300, 2, 3, 5);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 39:
+ switch (_val2) {
+ case 39:
+ freeStolie();
+ _stolieSet = true;
+ loadDr2();
+ _stolie.play("402dr02", 0x300, 0, -1, 6, -1, 100, 0, 0, 12, 12);
+ break;
+
+ case 40:
+ freeStolie();
+ _val6 = 40;
+ loadDr2();
+ series_play("402dr02", 0x300, 4, 2, 6, 0, 100, 0, 0, 0, 2);
+ series_play("402dr02s", 0x301, 4, -1, 6, 0, 100, 0, 0, 0, 2);
+ playDigiName();
+ break;
+
+ default:
+ freeStolie();
+ _val6 = 15;
+ loadDr1();
+ series_play("402dr01", 0x300, 2, 2, 6);
+ series_play("402dr01s", 0x301, 2, -1, 6);
+ break;
+ }
+ break;
+
+ case 40:
+ if (_val2 == 40) {
+ freeStolie();
+ _stolieSet = true;
+ loadDr2();
+ _stolie.play("402dr02", 0x300, 4, -1, 6, -1, 100, 0, 0, 3, 5);
+ } else {
+ freeStolie();
+ _val6 = 39;
+ loadDr2();
+ Series::series_play("402dr02", 0x300, 0, 2, 6, 0, 100, 0, 0, 6, 12);
+ }
+ break;
+
+ case 45:
+ switch (_val2) {
+ case 7:
+ freeStolie();
+ _val6 = 7;
+ loadDr8();
+ _stolie.play("402dr08", 0x300, 0, 2, 6, 0, 100, 0, 0, 72, 75);
+ break;
+
+ case 46:
+ freeStolie();
+ _stolieSet = true;
+ loadDr8();
+ _stolie.play("402dr08", 0x300, 4, -1, 6, -1, 100, 0, 0, 67, 71);
+ playDigiName();
+ break;
+
+ case 47:
+ freeStolie();
+ loadDr8();
+ Series::series_play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 67, 67);
+ break;
+
+ default:
+ freeStolie();
+ _val6 = 49;
+ loadDr8();
+ Series::series_play("402dr08", 0x300, 2, 2, 5, 0, 100, 0, 0, 64, 66);
+ break;
+ }
+ break;
+
+ case 48:
+ _val6 = 45;
+ loadDr8();
+ Series::series_play("402dr08", 0x300, 0, 2, 6, 0, 100, 0, 0, 64, 66);
+ break;
+
+ case 49:
+ _val6 = 15;
+ loadDr8();
+ Series::series_play("402dr08", 0x300, 2, 2, 6, 0, 100, 0, 0, 0, 8);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ switch (_val5) {
+ case 15:
+ switch (_val3) {
+ case 15:
+ if (imath_ranged_rand(1, 7) == 1) {
+ _val5 = 17;
+ loadPe2();
+ Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 0, 3);
+ playRandom2();
+ } else {
+ loadPe2();
+ Series::series_play("402pe02", 0x100, 0, 3, 60, 0, 100, 0, 0, 7, 7);
+ }
+ break;
+
+ case 20:
+ _val3 = 21;
+ series_play_with_breaks(PLAY12, "402pe01", 0x100, 3, 3);
+ break;
+
+ case 21:
+ loadPe1();
+ _series2.show("402pe01", 0x100, 0, 3, 30, 9);
+ break;
+
+ case 27:
+ _val3 = 28;
+ _series2Set = true;
+ kernel_trigger_dispatch_now(27);
+
+ loadPe4();
+ _series2.show("402pe04", 0x100, 0, -1, -1, 16);
+ break;
+
+ case 28:
+ freeSeries2();
+ freePe4();
+ _val3 = 29;
+ series_play_with_breaks(PLAY7, "402pe04", 0x100, 3, 3);
+ break;
+
+ case 29:
+ _val3 = 30;
+ loadPe4();
+ _series2.play("402pe04", 0x100, 1, -1, 12, -1, 100, 0, 0, 19, 21);
+ break;
+
+ case 30:
+ _val3 = 20;
+ freeSeries2();
+ freePe4();
+ series_play_with_breaks(PLAY11, "402pe04", 0x100, 3, 3);
+ break;
+
+ case 34:
+ _val3 = 43;
+ series_play_with_breaks(PLAY15, "402pe05", 0x100, 3, 3);
+ break;
+
+ case 23:
+ case 42:
+ case 45:
+ case 47:
+ loadPe1();
+ _val5 = 45;
+ _series2.play("402pe01", 0x100, 0, 3, 5, 0, 100, 0, 0, 0, -1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 17:
+ if (_val3 == 15) {
+ if (imath_ranged_rand(1, 7) == 1) {
+ _val5 = 15;
+ loadPe2();
+ Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 4, 7);
+ playRandom2();
+ } else {
+ loadPe2();
+ Series::series_play("402pe02", 0x100, 0, 3, 60, 0, 100, 0, 0, 3, 3);
+ }
+ } else {
+ _val5 = 15;
+ loadPe2();
+ Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 4, 7);
+ }
+ break;
+
+ case 45:
+ switch (_val3) {
+ case 23:
+ _val3 = 24;
+ freePe4();
+ series_play_with_breaks(PLAY4, "402pe04", 0x100, 3, 3);
+ break;
+
+ case 24:
+ _val3 = 25;
+ series_play_with_breaks(PLAY5, "402pe4n", 0x100, 3, 3);
+ break;
+
+ case 25:
+ _val3 = 27;
+ _val5 = 15;
+ freePe4();
+ series_play_with_breaks(PLAY6, "402pe04", 0x100, 3, 3);
+ break;
+
+ case 41:
+ loadPe1();
+ freePe3();
+ _series2Set = true;
+ _series2.play("402pe01", 0x100, 0, -1, 6, -1, 100, 0, 0, 9, 9);
+ break;
+
+ case 42:
+ Series::series_play("402pe01", 0x100, 0, 3, 60, 0, 100, 0, 0, 9, 9);
+ break;
+
+ case 45:
+ freeSeries2();
+
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ frame = 0;
+ break;
+ case 2:
+ frame = 1;
+ break;
+ default:
+ frame = 16;
+ break;
+ }
+
+ loadPe3();
+ Series::series_play("402pe03", 0x100, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ playDigiName();
+ break;
+
+ case 47:
+ loadPe3();
+ _series2Set = true;
+ Series::series_play("402pe03", 0x100, 0, -1, 6, -1, 100, 0, 0, 15, 15);
+ break;
+
+ default:
+ freeSeries2();
+ freePe3();
+ loadPe1();
+ _val5 = 15;
+ _series2.play("402pe01", 0x100, 2, 3, 5, 0, 100, 0, 0, 0, -1);
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ freeStolie();
+ hotspot_set_active("stolie", false);
+ _G(flags)[V159] = 1;
+ break;
+
+ case 5:
+ freeSeries2();
+ hotspot_set_active("elmo", false);
+ break;
+
+ case 7:
+ digi_play("402_003", 2, 150, 8);
+ break;
+
+ case 8:
+ digi_unload("402_003");
+ break;
+
+ case 9:
+ _val3 = 23;
+ break;
+
+ case 11:
+ _stolie.play("402dr04", 0x300, 0, -1, 6, -1, 100, 0, 0, 25, 25);
+ ws_hide_walker();
+ series_play("402wi02", 0x100, 0, 12, 5, 0, 100, 0, 0, 0, 4);
+ series_play("402wi02s", 0x101, 0, -1, 5, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 12:
+ _stolie.terminate();
+ inv_give_to_player("fish");
+ series_play("402dr04", 0x300, 0, 14, 5, 0, 100, 0, 0, 26, -1);
+ series_play("402dr04s", 0x301, 0, -1, 5, 0, 100, 0, 0, 26, -1);
+ series_play("402wi02", 0x100, 0, 13, 5, 0, 100, 0, 0, 5, -1);
+ series_play("402wi02s", 0x101, 0, -1, 5, 0, 100, 0, 0, 5, -1);
+ break;
+
+ case 13:
+ series_unload(_wi02);
+ series_unload(_wi02s);
+ enable_player();
+ break;
+
+ case 14:
+ series_play_with_breaks(PLAY14, "402poof", 0x100, -1, 2);
+ _stolieSet = true;
+ _stolie.play("402dr04", 0x300, 0, -1, 6, -1, 100, 0, 0, 28, 28);
+ break;
+
+ case 15:
+ freeDr2();
+ _wi01 = series_load("402wi01");
+ _wi01s = series_load("402wi01s");
+ ws_hide_walker();
+
+ _val3 = 15;
+ series_play("402wi01", 0x100, 0, 16, 5, 0, 100, 0, 0, 0, 16);
+ series_play("402wi01s", 0x101, 0, -1, 5, 0, 100, 0, 0, 0, 16);
+ break;
+
+ case 16:
+ freeSeries2();
+ _series3.play("402wi01", 0, 0, -1, 6, -1, 100, 0, 0, 16, 16);
+ freePe1();
+ freePe2();
+ freePe3();
+ series_play("402pe05", 0x100, 0, 17, 5, 0, 100, 0, 0, 0, 5);
+ series_play("402pe05s", 0x101, 0, -1, 5, 0, 100, 0, 0, 0, 5);
+ break;
+
+ case 17:
+ _series3.terminate();
+ series_play("402wi01", 0x100, 0, 19, 5, 0, 100, 0, 0, 17, -1);
+ series_play("402wi01s", 0x101, 0, -1, 5, 0, 100, 0, 0, 17, -1);
+ digi_play("402p903b", 1, 255, -1);
+ series_play("402pe05", 0x100, 0, 18, 5, 0, 100, 0, 0, 6, -1);
+ series_play("402pe05s", 0x101, 0, -1, 5, 0, 100, 0, 0, 6, -1);
+ inv_move_object("deed", NOWHERE);
+ break;
+
+ case 18:
+ kernel_timing_trigger(1, 20);
+ _series2Set = true;
+ _series2.play("402pe05", 0x100, 0, -1, 6, -1, 100, 0, 0, 10, 10);
+ break;
+
+ case 19:
+ series_unload(_wi01);
+ series_unload(_wi01s);
+ ws_unhide_walker();
+ kernel_timing_trigger(1, 20);
+ break;
+
+ case 20:
+ if (++_val4 == 2) {
+ _val4 = 0;
+ _val2 = 6;
+ ws_walk(316, 354, 0, -1, 2);
+ }
+ break;
+
+ case 22:
+ _val3 = 42;
+ break;
+
+ case 25:
+ freeDr1();
+ series_play_with_breaks(PLAY8, "402dr01", 0x300, 26, 3);
+ break;
+
+ case 26:
+ loadDr1();
+ _stolieSet = true;
+ _stolie.show("402dr01", 0x300, 0, -1, -1, 10);
+ break;
+
+ case 27:
+ if (++_val4 >= 2) {
+ _val4 = 0;
+ freeStolie();
+ freeDr2();
+ series_play_with_breaks(PLAY9, "402dr02", 0x300, 28, 3);
+ }
+ break;
+
+ case 28:
+ series_play_with_breaks(PLAY10, "402dr03", 0x300, 30, 3);
+ break;
+
+ case 29:
+ _series2Set = true;
+ loadPe4();
+ _series2.show("402pe04", 0x100, 0, -1, -1, 21);
+ break;
+
+ case 30:
+ freeSeries2();
+ digi_play("402s010h", 1, 170);
+ _stolieSet = true;
+ _stolie.show("402dr03", 0x300, 0, -1, -1, 2);
+ _dr03 = series_load("402dr03");
+ _dr03s = series_load("402dr03s");
+
+ freePe4();
+ series_play_with_breaks(PLAY11, "402pe04", 0x100, 32, 3);
+ break;
+
+ case 32:
+ _val3 = 41;
+ _val5 = 45;
+ kernel_trigger_dispatch_now(3);
+ break;
+
+ case 33:
+ freeStolie();
+ series_play("402dr03", 0x300, 2, 34, 6, 0, 100, 0, 0, 0, 1);
+ series_play("402dr03s", 0x301, 2, -1, 6, 0, 100, 0, 0, 0, -1);
+ break;
+
+ case 34:
+ series_unload(_dr03);
+ series_unload(_dr03s);
+ freeDr2();
+ series_play_with_breaks(PLAY13, "402dr02", 0x300, 35, 3);
+ break;
+
+ case 35:
+ loadDr1();
+ series_play("402dr01", 0x300, 2, 36, 6, 0, 100, 0, 0, 0, -1);
+ series_play("402dr01s", 0x301, 2, -1, 6, 0, 100, 0, 0, 0, -1);
+ break;
+
+ case 36:
+ series_play("402dr12", 0x300, 0, 37, 6, 0, 100, 0, 0, 0, 0);
+ series_play("402dr12s", 0x301, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 37:
+ freeDr1();
+ _val2 = 15;
+ _val6 = 15;
+ kernel_trigger_dispatch_now(2);
+ player_set_commands_allowed(true);
+ break;
+
+ case 38:
+ freeSeries2();
+ loadPe4();
+ Series::series_play("402pe04", 0x100, 0, 29, 6, 0, 100, 0, 0, 17, 21);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 2:
+ _G(wilbur_should) = 3;
+ kernel_timing_trigger(180, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 3:
+ ws_unhide_walker();
+ _G(walker).wilbur_poof();
+ _val2 = 10;
+ kernel_timing_trigger(30, 22);
+ break;
+
+ case 5:
+ ws_unhide_walker();
+ _G(walker).wilbur_poof();
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room402::pre_parser() {
@@ -303,9 +901,9 @@ void Room402::parser() {
case 1:
_digiName = "402s006";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 2;
- freeSeries1();
+ freeStolie();
_val2 = 45;
break;
@@ -393,7 +991,7 @@ void Room402::parser() {
case 1:
_digiName = "402p501";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 2;
_val3 = 45;
break;
@@ -420,7 +1018,7 @@ void Room402::parser() {
freeSeries2();
freeDr2();
_digiName = "402p902";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 2;
_val3 = 45;
break;
@@ -428,16 +1026,16 @@ void Room402::parser() {
case 2:
_val3 = 41;
_digiName = "402s007";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 3;
_val2 = 40;
break;
case 3:
_digiName = "402s008";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 4;
- freeSeries1();
+ freeStolie();
freeDr2();
_val2 = 46;
kernel_trigger_dispatch_now(2);
@@ -452,7 +1050,7 @@ void Room402::parser() {
case 5:
_digiName = "402s009";
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 6;
_val2 = 45;
break;
@@ -536,7 +1134,7 @@ void Room402::conv84() {
if (sound) {
if (who <= 0) {
_digiName = sound;
- _flag1 = true;
+ _newMode = KT_PARSE;
_val1 = 6;
if (node == 1 && entry == 0)
@@ -604,10 +1202,30 @@ void Room402::conv84() {
}
}
-void Room402::freeSeries1() {
- if (_series1Set) {
- _series1.terminate();
- _series1Set = false;
+void Room402::playDigiName() {
+ if (_digiName) {
+ _G(kernel).trigger_mode = _newMode;
+ digi_play(_digiName, 1, 255, _val1);
+ }
+}
+
+void Room402::playRandom1() {
+ static const char *NAMES[5] = {
+ "402s010f", "402s010g", "402s010h", "402s010a", "402s010d"
+ };
+
+ if (!digi_play_state(1))
+ digi_play(NAMES[imath_ranged_rand(0, 4)], 1, 140, -1);
+}
+
+void Room402::playRandom2() {
+ digi_play(Common::String::format("402p903%c", 'a' + imath_ranged_rand(0, 5)).c_str(), 2, 140);
+}
+
+void Room402::freeStolie() {
+ if (_stolieSet) {
+ _stolie.terminate();
+ _stolieSet = false;
}
}
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index a329613c5be..5d8296ba797 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -50,11 +50,12 @@ private:
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
const char *_digiName = nullptr;
- bool _flag1 = false;
- bool _series1Set = false;
- Series _series1;
+ KernelTriggerType _newMode = KT_DAEMON;
+ bool _stolieSet = false;
+ Series _stolie;
bool _series2Set = false;
Series _series2;
+ Series _series3;
int _dr01 = -1, _dr01s = -1;
int _dr02 = -1, _dr02s = -1;
int _dr03 = -1, _dr03s = -1;
@@ -73,9 +74,11 @@ private:
int _val6 = 0;
void conv84();
- void freeSeries1();
+ void playDigiName();
+ void playRandom1();
+ void playRandom2();
+ void freeStolie();
void freeSeries2();
-
void loadDr1();
void freeDr1();
void loadDr2();
Commit: e913e4b4342e2d4582ec24598e294fe4aff59750
https://github.com/scummvm/scummvm/commit/e913e4b4342e2d4582ec24598e294fe4aff59750
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 404
Changed paths:
engines/m4/burger/rooms/section4/room404.cpp
engines/m4/burger/rooms/section4/room404.h
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
index cafb17020e8..13e4bf55656 100644
--- a/engines/m4/burger/rooms/section4/room404.cpp
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -46,9 +46,107 @@ const seriesPlayBreak Room404::PLAY1[] = {
void Room404::init() {
+ digi_preload("400_001");
+ digi_play_loop("400_001", 3, 125);
+ pal_cycle_init(112, 127, 6);
+
+ if (_G(flags)[V162]) {
+ hotspot_set_active("QUARTER ", false);
+ } else {
+ hotspot_set_active("QUARTER ", true);
+ _quarter.show("404wi01", 0xf00);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 406:
+ ws_demand_location(320, 350, 1);
+ break;
+
+ default:
+ _G(flags)[V171] = 4001;
+ _G(flags)[V172] = 10026;
+ _G(flags)[V176] = 1;
+ _G(flags)[V175] = 1;
+ _G(flags)[V174] = 4004;
+ ws_demand_location(320, 271, 5);
+ break;
+ }
}
void Room404::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ player_update_info();
+
+ if (_G(player_info).y > 350) {
+ disable_player_commands_and_fade_init(-1);
+ } else {
+ kernel_timing_trigger(6, 1);
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ _G(wilbur_should) = 2;
+ disable_player();
+ series_play_with_breaks(PLAY1, "404wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 1);
+ break;
+
+ case 2:
+ _G(wilbur_should) = 10001;
+ _quarter.terminate();
+ _G(flags)[V162] = 1;
+ hotspot_set_active("QUARTER ", false);
+ inv_give_to_player("QUARTER");
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Room404::pre_parser() {
+ if (player_said("IMPOUND YARD") && !player_said("EXIT") &&
+ !player_said("LOOK AT") && !player_said("GEAR")) {
+ player_hotspot_walk_override(320, 346, 5);
+ } else {
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(1);
+ }
+}
+
+void Room404::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("IMPOUND YARD")) {
+ if (player_said("TAKE", "QUARTER ")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TOILET")) {
+ wilbur_speech("404w004");
+ } else if (player_said("BARS")) {
+ wilbur_speech("404w013");
+ } else {
+ return;
+ }
+ } else if (player_said("EXIT") || player_said("LOOK AT") || player_said("GEAR")) {
+ kernel_trigger_dispatch_now(4005);
+ }
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/room404.h b/engines/m4/burger/rooms/section4/room404.h
index c14979ac013..b72cd757e3e 100644
--- a/engines/m4/burger/rooms/section4/room404.h
+++ b/engines/m4/burger/rooms/section4/room404.h
@@ -32,6 +32,7 @@ class Room404 : public Room {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
+ Series _quarter;
public:
Room404() : Room() {}
@@ -39,6 +40,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: 0180bcdb3f3d3d27d05d29652c01f73c668c0cd3
https://github.com/scummvm/scummvm/commit/0180bcdb3f3d3d27d05d29652c01f73c668c0cd3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 405 methods
Changed paths:
A engines/m4/burger/rooms/section4/section4_room.cpp
A engines/m4/burger/rooms/section4/section4_room.h
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section4/room404.h
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room405.h
engines/m4/burger/vars.h
engines/m4/module.mk
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index fef6fca9ede..9356d262ae4 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -436,7 +436,7 @@ void BurgerEngine::global_daemon() {
_G(player_trigger));
break;
- case gSET_DEST:
+ case kSET_DEST:
ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
_G(walker).wilbur_poof();
kernel_trigger_dispatch_now(gSET_COMMANDS_ALLOWED);
diff --git a/engines/m4/burger/rooms/section4/room404.h b/engines/m4/burger/rooms/section4/room404.h
index b72cd757e3e..d2304f80844 100644
--- a/engines/m4/burger/rooms/section4/room404.h
+++ b/engines/m4/burger/rooms/section4/room404.h
@@ -28,6 +28,9 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+/**
+ * Error: room not found
+ */
class Room404 : public Room {
private:
static const char *SAID[][4];
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index c3d014e43b5..8b542305be0 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section4/room405.h"
+#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -116,9 +117,293 @@ const seriesPlayBreak Room405::PLAY7[] = {
void Room405::init() {
+ _volume = 255;
+ pal_cycle_init(122, 127, 6);
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(false);
+ ws_demand_location(199, 253, 4);
+ player_set_commands_allowed(true);
+ break;
+
+ case 406:
+ player_set_commands_allowed(false);
+ ws_demand_location(413, 356, 10);
+ setDest(120);
+ break;
+
+ default:
+ player_set_commands_allowed(false);
+ ws_demand_location(241, 266, 4);
+ setDest(120);
+ break;
+ }
+
+ _series1 = series_play("405plate", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ if (_G(flags)[V166]) {
+ hotspot_set_active("vipe", false);
+ hotspot_set_active("guitar", false);
+ } else {
+ _val1 = 39;
+ _val2 = 39;
+ kernel_trigger_dispatch_now(15);
+ }
+
+ if (inv_object_is_here("records")) {
+ _records = series_play("405rec", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("records", false);
+ }
+
+ if (_G(flags)[V167]) {
+ _box = series_play("405box1", 0xf00, 2, -1, 600, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("box", false);
+ }
+
+ if (_G(flags)[V168]) {
+ hotspot_set_active("vera", false);
+ hotspot_set_active("order window", false);
+ } else {
+ _val3 = 4;
+ _val4 = 4;
+ kernel_trigger_dispatch_now(17);
+ }
+
+ _val5 = 3;
+ kernel_trigger_dispatch_now(16);
+ _lid = series_play("405lid", 0xf00, 2, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ if (_G(flags)[V168]) {
+ digi_preload("400_001");
+ digi_play_loop("400_001", 3, 140);
+ } else {
+ digi_preload("405_010");
+ digi_play_loop("405_010", 3, 180);
+ }
}
void Room405::daemon() {
+ // TODO: daemon
+}
+
+void Room405::pre_parser() {
+ if (player_said("quarter", "jukebox") && inv_player_has("quarter") && _G(flags)[V167])
+ player_hotspot_walk_override(199, 253, 2, -1);
+
+ if (player_said("disc") && !player_said("poof") && !player_said("gear"))
+ player_hotspot_walk_override(264, 284, 10);
+
+ if (player_said("disc ") && !player_said("poof ") && !player_said("gear"))
+ player_hotspot_walk_override(360, 333, 10);
+
+}
+
+void Room405::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv86")) {
+ conv86();
+ } else if (player_said("conv89")) {
+ conv89();
+ } else if (player_said("conv90")) {
+ conv90();
+ } else if (player_said("conv91")) {
+ conv90();
+ } else if (player_said("conv92")) {
+ conv92();
+ } else if (player_said("talk to", "vipe")) {
+ talkToVipe();
+ } else if (player_said("talk to", "vera")) {
+ talkToVera();
+ } else if (player_said("gear", "records") && inv_object_is_here("records") && _G(flags)[V166]) {
+ wilbur_speech("405w005");
+ } else if (player_said("poof") || player_said("gear", "disc")) {
+ Section4::poof(4006);
+ } else if (player_said("poof ") || player_said("gear", "disc ")) {
+ Section4::poof(4005);
+ } else if ((player_said("take", "records") && inv_object_is_here("records")) ||
+ (player_said("gear", "records") && inv_object_is_here("records"))) {
+ if (!_G(flags)[V166]) {
+ startConv91();
+ } else if (inv_object_is_here("records")) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(23);
+ }
+ } else if (player_said("dog collar", "vipe")) {
+ _G(wilbur_should) = 25;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ hotspot_set_active("vipe", false);
+ hotspot_set_active("guitar", false);
+ } else if (player_said("swinging door") && player_said_any("enter", "gear") && !_G(flags)[V168]) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val3 = 7;
+ _digiName = "405V504";
+ _newMode = KT_PARSE;
+ _newTrigger = 1;
+ break;
+
+ case 1:
+ _val3 = 4;
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play("405e502", 1, 255, 2);
+ break;
+
+ case 2:
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("muffin") && !_G(flags)[V168] &&
+ (player_said_any("take", "gear") || inv_player_has(_G(player).verb))) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val3 = 21;
+ _digiName = "405V502";
+ _newMode = KT_PARSE;
+ _newTrigger = 1;
+ _val5 = 1;
+ kernel_trigger_dispatch_now(16);
+ break;
+
+ case 1:
+ term_message("spat 1");
+ _G(kernel).trigger_mode = KT_PARSE;
+ series_play("405eu02", 0xf00, 0, 4, 4, 0, 100, 0, 0, 10, 14);
+ digi_play("405e501", 1, 255, 2);
+ break;
+
+ case 2:
+ terminateMachineAndNull(_eu02);
+ series_play("405eu02", 0xf00, 0, -1, 4, 0, 100, 0, 0, 16, 18);
+ _val3 = 10;
+ _digiName = "405V503";
+ _newMode = KT_PARSE;
+ _newTrigger = 3;
+ break;
+
+ case 3:
+ player_set_commands_allowed(true);
+ _val3 = 4;
+ break;
+
+ case 4:
+ term_message("spat 4");
+ _eu02 = series_play("405eu02", 0xf00, 0, -1, 600, -1, 100, 0, 0, 15, 15);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("vipe") && inv_player_has(_G(player).verb)) {
+ _G(wilbur_should) = 27;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("records", "jukebox")) {
+ _G(wilbur_should) = 32;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (!_G(flags)[V168] && (player_said("quarter", "jukebox") || player_said("gear", "jukebox"))) {
+ if (!inv_player_has("quarter")) {
+ wilbur_speech("405w008");
+ } else if (_G(flags)[V167]) {
+ _G(wilbur_should) = 34;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else {
+ switch (_G(kernel).trigger) {
+ case -1:
+ _val3 = 17;
+ player_set_commands_allowed(false);
+ _digiName = "405v510";
+ _newMode = KT_PARSE;
+ _newTrigger = 1;
+ break;
+
+ case 1:
+ _val3 = 4;
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ }
+ } else if (player_said("vera") && inv_player_has(_G(player).verb)) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val3 = 7;
+ _digiName = "405v511";
+ _newMode = KT_PARSE;
+ _newTrigger = 1;
+ break;
+
+ case 1:
+ player_set_commands_allowed(true);
+ _val3 = 4;
+ break;
+
+ default:
+ break;
+ }
+ } else if ((player_said("disc") && inv_player_has(_G(player).verb)) ||
+ (player_said("disc ") && inv_player_has(_G(player).verb))) {
+ wilbur_speech("400w004");
+ } else if (lookFlag && player_said("vipe")) {
+ wilbur_speech(_G(flags)[V165] ? "405w002" : "405w001");
+ } else if (!_G(walker).wilbur_said(SAID)) {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room405::conv86() {
+ // TODO: conv
+}
+
+void Room405::conv89() {
+ // TODO: conv
+}
+
+void Room405::conv90() {
+ // TODO: conv
+}
+
+void Room405::conv91() {
+ // TODO: conv
+}
+
+void Room405::conv92() {
+ // TODO: conv
+}
+
+void Room405::talkToVipe() {
+ // TODO: talk
+}
+
+void Room405::talkToVera() {
+ // TODO: talk
+}
+
+void Room405::startConv91() {
+ conv_load_and_prepare("conv91", 4);
+ conv_export_value_curr(_G(flags)[V165], 0);
+ conv_play_curr();
+}
+
+void Room405::playDigi() {
+ if (_digiName) {
+ _G(kernel).trigger_mode = _newMode;
+ digi_play(_digiName, 1, 255, _newTrigger);
+ _digiName = nullptr;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/room405.h b/engines/m4/burger/rooms/section4/room405.h
index 1a17ccd8421..cb9fba83ac0 100644
--- a/engines/m4/burger/rooms/section4/room405.h
+++ b/engines/m4/burger/rooms/section4/room405.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION4_ROOM405_H
#define M4_BURGER_ROOMS_SECTION4_ROOM405_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section4/section4_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room405 : public Room {
+class Room405 : public Section4Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -39,13 +39,39 @@ private:
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
+ machine *_series1 = nullptr;
+ machine *_records = nullptr;
+ machine *_box = nullptr;
+ machine *_lid = nullptr;
+ machine *_eu02 = nullptr;
+ const char *_digiName = nullptr;
+ KernelTriggerType _newMode = (KernelTriggerType)0;
+ int _volume = 0;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _newTrigger = 0;
+
+ void conv86();
+ void conv89();
+ void conv90();
+ void conv91();
+ void conv92();
+ void startConv91();
+ void talkToVipe();
+ void talkToVera();
+ void playDigi();
public:
- Room405() : Room() {}
+ Room405() : Section4Room() {}
~Room405() override {}
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/section4_room.cpp b/engines/m4/burger/rooms/section4/section4_room.cpp
new file mode 100644
index 00000000000..a49fb2aaa6c
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/section4_room.cpp
@@ -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/ },.
+ *
+ */
+
+#include "m4/burger/rooms/section4/section4_room.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Section4Room::setDest(int ticks) {
+ player_set_commands_allowed(false);
+ player_update_info();
+
+ _G(player_dest_x) = _G(player_info).x;
+ _G(player_dest_y) = _G(player_info).y;
+
+ ws_demand_location(-100, _G(player_dest_y));
+ ws_unhide_walker();
+ kernel_timing_trigger(ticks, kSET_DEST);
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4_room.h b/engines/m4/burger/rooms/section4/section4_room.h
new file mode 100644
index 00000000000..e737b0d2262
--- /dev/null
+++ b/engines/m4/burger/rooms/section4/section4_room.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION4_ROOM_H
+#define M4_BURGER_ROOMS_SECTION4_ROOM_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Section4Room : public Room {
+protected:
+ void setDest(int ticks);
+
+public:
+ Section4Room() : Room() {}
+ ~Section4Room() override {}
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 55f8e9fb98c..2a887813e10 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -60,7 +60,7 @@ enum global_triggers {
gWILBURS_SPEECH_START = 10015,
gCHANGE_WILBUR_ANIMATION = 10016,
gSET_FACING = 10018,
- gSET_DEST = 10019,
+ kSET_DEST = 10019,
gSET_COMMANDS_ALLOWED = 10020,
gUNPOOF = 10021,
gTELEPROTED1 = 10024,
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8fa658135c2..6082baf3b58 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -126,6 +126,7 @@ MODULE_OBJS = \
burger/rooms/section3/room307.o \
burger/rooms/section3/room310.o \
burger/rooms/section4/section4.o \
+ burger/rooms/section4/section4_room.o \
burger/rooms/section4/room401.o \
burger/rooms/section4/room402.o \
burger/rooms/section4/room404.o \
Commit: cb6b63647a9779cecf1fee7e55db550c0bd4c75b
https://github.com/scummvm/scummvm/commit/cb6b63647a9779cecf1fee7e55db550c0bd4c75b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 405 conv methods
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/section4_room.cpp
engines/m4/burger/rooms/section4/section4_room.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index f465ae5e74f..6eb559d6913 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -887,9 +887,9 @@ void Room402::parser() {
} else if (player_said_any("disc", "disc ") && inv_player_has(_G(player).verb)) {
wilbur_speech("400w004");
} else if (player_said("poof") || player_said("gear", "disc")) {
- Section4::poof(4006);
+ poof(4006);
} else if (player_said("poof ") || player_said("gear", "disc ")) {
- Section4::poof(4005);
+ poof(4005);
} else if (player_said("stolie") && inv_player_has(_G(player).verb) &&
!player_said("deed")) {
switch (_G(kernel).trigger) {
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index 5d8296ba797..441e2c6fa5a 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -22,13 +22,13 @@
#ifndef M4_BURGER_ROOMS_SECTION4_ROOM402_H
#define M4_BURGER_ROOMS_SECTION4_ROOM402_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section4/section4_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room402 : public Room {
+class Room402 : public Section4Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
@@ -95,7 +95,7 @@ private:
void freePe4();
public:
- Room402() : Room() {}
+ Room402() : Section4Room() {}
~Room402() override {}
void init() override;
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 8b542305be0..5f0a3750d1e 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -20,7 +20,6 @@
*/
#include "m4/burger/rooms/section4/room405.h"
-#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -222,9 +221,9 @@ void Room405::parser() {
} else if (player_said("gear", "records") && inv_object_is_here("records") && _G(flags)[V166]) {
wilbur_speech("405w005");
} else if (player_said("poof") || player_said("gear", "disc")) {
- Section4::poof(4006);
+ poof(4006);
} else if (player_said("poof ") || player_said("gear", "disc ")) {
- Section4::poof(4005);
+ poof(4005);
} else if ((player_said("take", "records") && inv_object_is_here("records")) ||
(player_said("gear", "records") && inv_object_is_here("records"))) {
if (!_G(flags)[V166]) {
@@ -365,31 +364,246 @@ void Room405::parser() {
}
void Room405::conv86() {
- // TODO: conv
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ const char *sound = conv_sound_to_play();
+
+ if (_G(kernel).trigger == 18) {
+ if (who <= 0) {
+ if (_val2 == 39)
+ _val1 = 39;
+ else if (_val2 == 47)
+ _val1 = 47;
+ else
+ _val1 = 43;
+
+ conv_resume();
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+
+ conv_resume();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if (_val2 == 39)
+ _val1 = 40;
+ else if (_val2 == 47)
+ _val1 = 48;
+ else
+ _val1 = 44;
+
+ _digiName = sound;
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+
+ digi_play(sound, 1, 255, 18);
+ }
+
+ _newMode = KT_PARSE;
+ _newTrigger = 18;
+ } else {
+ conv_resume();
+ }
}
void Room405::conv89() {
- // TODO: conv
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+ const char *sound = conv_sound_to_play();
+
+ if (_G(kernel).trigger == 18) {
+ if (who <= 0) {
+ if (_val2 == 39)
+ _val1 = 39;
+ else if (_val2 == 47)
+ _val1 = 47;
+ else
+ _val1 = 43;
+
+ conv_resume();
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+
+ conv_resume();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if ((node == 1 && entry == 0) || (node == 2 && entry == 0)) {
+ _val1 = 44;
+ } else if ((node == 1 && entry == 1) || (node == 2 && entry == 1)) {
+ _val1 = 48;
+ } else if (_val2 == 39) {
+ _val1 = 40;
+ } else if (_val2 == 47) {
+ _val1 = 48;
+ } else {
+ _val1 = 44;
+ }
+
+ _digiName = sound;
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+
+ digi_play(sound, 1, 255, 18);
+ }
+
+ _newMode = KT_PARSE;
+ _newTrigger = 18;
+ } else {
+ conv_resume();
+ }
}
void Room405::conv90() {
- // TODO: conv
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ const char *sound = conv_sound_to_play();
+
+ if (_G(kernel).trigger == 18) {
+ if (who <= 0) {
+ _val1 = 39;
+ conv_resume();
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+
+ conv_resume();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ _val1 = 44;
+ _digiName = sound;
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+
+ digi_play(sound, 1, 255, 18);
+ }
+
+ _newMode = KT_PARSE;
+ _newTrigger = 18;
+ } else {
+ conv_resume();
+ }
}
void Room405::conv91() {
- // TODO: conv
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ const char *sound = conv_sound_to_play();
+
+ if (_G(kernel).trigger == 18) {
+ if (who <= 0) {
+ _val1 = 39;
+ conv_resume();
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+
+ conv_resume();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ _val1 = 44;
+ _digiName = sound;
+ } else if (who == 1) {
+ if (_G(roomVal2))
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+
+ digi_play(sound, 1, 255, 18);
+ }
+
+ _newMode = KT_PARSE;
+ _newTrigger = 18;
+ } else {
+ conv_resume();
+ }
}
void Room405::conv92() {
- // TODO: conv
+ _G(kernel).trigger_mode = KT_PARSE;
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+ const char *sound = conv_sound_to_play();
+
+ if (_G(kernel).trigger == 18) {
+ if (who <= 0) {
+ if (node == 5 && entry == 0) {
+ _val3 = 9;
+ } else if (node == 6 && entry == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ } else if (node == 5 && entry == 1) {
+ digi_preload("92n0603");
+ _val3 = 9;
+ } else {
+ _val3 = 4;
+ }
+ } else if (who == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ conv_resume();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if ((node == 2 && entry == 1) ||
+ (node == 3) ||
+ (node == 5 && entry == 1) ||
+ (node == 5 && entry == 3) ||
+ (node == 6 && entry == 2) ||
+ (node == 7 && entry == 0) ||
+ (node == 8 && entry == 2) ||
+ (node == 9 && entry == 1) ) {
+ if (node == 2 && entry == 1)
+ _val3 = 9;
+
+ digi_play(sound, 1, 255, 18);
+ } else if (node == 5 && entry == 0) {
+ _val3 = 10;
+ _digiName = sound;
+ } else if (node == 5 && entry == 2) {
+ _val3 = 14;
+ } else if (node == 6 && entry == 1) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(sound, 1, 255, 18);
+ } else if ((node == 1 && entry == 1) || (node == 2 && entry == 2) ||
+ (node == 1 && entry == 4)) {
+ _val3 = 17;
+ _digiName = sound;
+ } else if (node == 4) {
+ _val3 = 10;
+ _digiName = sound;
+ } else {
+ _val3 = 7;
+ _digiName = sound;
+ }
+ } else if (who == 1) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(sound, 1, 255, 18);
+ }
+
+ _newMode = KT_PARSE;
+ _newTrigger = 18;
+ } else {
+ conv_resume();
+ }
}
void Room405::talkToVipe() {
- // TODO: talk
+ conv_load_and_prepare("conv86", 1, 0);
+ conv_export_pointer_curr(&_G(flags)[V165], 1);
+ conv_play_curr();
}
void Room405::talkToVera() {
- // TODO: talk
+ conv_load_and_prepare("conv92", 5);
+ conv_export_value_curr(_G(flags)[V062], 0);
+ conv_play_curr();
}
void Room405::startConv91() {
diff --git a/engines/m4/burger/rooms/section4/section4_room.cpp b/engines/m4/burger/rooms/section4/section4_room.cpp
index a49fb2aaa6c..2987ab7f746 100644
--- a/engines/m4/burger/rooms/section4/section4_room.cpp
+++ b/engines/m4/burger/rooms/section4/section4_room.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section4/section4_room.h"
+#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -38,6 +39,10 @@ void Section4Room::setDest(int ticks) {
kernel_timing_trigger(ticks, kSET_DEST);
}
+void Section4Room::poof(int trigger) {
+ Section4::poof(trigger);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4_room.h b/engines/m4/burger/rooms/section4/section4_room.h
index e737b0d2262..4f163a6fe55 100644
--- a/engines/m4/burger/rooms/section4/section4_room.h
+++ b/engines/m4/burger/rooms/section4/section4_room.h
@@ -31,6 +31,7 @@ namespace Rooms {
class Section4Room : public Room {
protected:
void setDest(int ticks);
+ void poof(int trigger);
public:
Section4Room() : Room() {}
Commit: 28044c6acbf156a13da65400ba7726536db5c58e
https://github.com/scummvm/scummvm/commit/28044c6acbf156a13da65400ba7726536db5c58e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 405 daemon
Changed paths:
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room405.h
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section4/section4.h
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 5f0a3750d1e..f86121ec51a 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section4/room405.h"
+#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/vars.h"
namespace M4 {
@@ -185,7 +186,694 @@ void Room405::init() {
}
void Room405::daemon() {
- // TODO: daemon
+ int frame;
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ case 4:
+ player_set_commands_allowed(true);
+ _val1 = 39;
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+ _val1 = 49;
+ break;
+
+ case 3:
+ player_set_commands_allowed(false);
+ _G(wilbur_should) = 30;
+ break;
+
+ case 5:
+ player_set_commands_allowed(true);
+ _val3 = 4;
+ break;
+
+ case 7:
+ _volume -= 10;
+ if (_volume >= 6) {
+ digi_change_volume(3, _volume);
+ kernel_timing_trigger(3, 7);
+ } else {
+ digi_stop(3);
+ }
+ break;
+
+ case 8:
+ ws_unhide_walker();
+ _G(walker).wilbur_poof();
+ player_set_commands_allowed(true);
+ break;
+
+ case 9:
+ digi_play("92n0603", 1, 255);
+ digi_play("405_009", 2, 255, 12);
+ break;
+
+ case 11:
+ terminateMachineAndNull(_series1);
+ _series1 = nullptr;
+ break;
+
+ case 13:
+ digi_play("405v513", 1, 255);
+ break;
+
+ case 15:
+ switch (_val2) {
+ case 39:
+ switch (_val1) {
+ case 39:
+ if (imath_ranged_rand(1, 20) == 1) {
+ _val2 = 42;
+ Series::series_play("405vp03", 0x900, 0, 15, 6, 0, 100, 0, 0, 0, 4);
+ } else {
+ Series::series_play("405vp01", 0x900, 0, 15, 60, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 40:
+ frame = imath_ranged_rand(0, 5);
+ Series::series_play("405vp02", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ playDigi2();
+ break;
+
+ default:
+ _val2 = 42;
+ Series::series_play("405vp03", 0x900, 0, 15, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 41:
+ if (_val1 == 39) {
+ if (imath_ranged_rand(1, 10) == 1) {
+ Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 5, 6);
+ } else {
+ Series::series_play("405vp07", 0x900, 2, 15, 60, 0, 100, 0, 0, 4, 4);
+ }
+ } else {
+ _val2 = 42;
+ Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 5, 6);
+ }
+ break;
+
+ case 42:
+ switch (_val1) {
+ case 39:
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ _val2 = 39;
+ Series::series_play("405vp03", 0x900, 2, 15, 10, 0, 100, 0, 0, 0, 4);
+ break;
+ case 2:
+ _val2 = 41;
+ Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 0, 4);
+ break;
+
+ default:
+ Series::series_play("405vp03", 0x900, 0, 15, 60, 0, 100, 0, 0, 4, 4);
+ break;
+ }
+ break;
+
+ case 43:
+ Series::series_play("405vp03", 0x900, 0, 15, 60, 0, 100, 0, 0, 4, 4);
+ break;
+
+ case 44:
+ frame = imath_ranged_rand(0, 5);
+ Series::series_play("405vp05", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ playDigi2();
+ break;
+
+ case 45:
+ frame = imath_ranged_rand(0, 6);
+ Series::series_play("405vp06", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 49:
+ digi_preload("999_003");
+ _vpoof = series_load("405vpoof");
+ _val1 = 50;
+ Series::series_play("405vp13", 0x900, 0, 15, 7, 0, 100, 0, 0, 0, 16);
+ break;
+
+ case 50:
+ _val1 = 51;
+ Series::series_play("405vp13", 0x900, 0, -1, 7, 0, 100, 0, 0, 17, 18);
+
+ _G(flags)[V166] = 1;
+ digi_play("999_003", 1, 255);
+ series_play("405vpoof", 0x500, 0, 15, 7, 0, 70, 40, 40, 0, -1);
+ _val5 = 2;
+ kernel_trigger_dispatch_now(16);
+ break;
+
+ case 51:
+ series_unload(_vpoof);
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ kernel_trigger_dispatch_now(25);
+ break;
+ }
+ break;
+
+ case 46:
+ switch (_val1) {
+ case 47:
+ Series::series_play("405vp10", 0x900, 0, 15, 60, 0, 100, 0, 0, 5, 5);
+ break;
+
+ case 48:
+ frame = imath_ranged_rand(0, 6);
+ Series::series_play("405vp11", 0x900, 0, 15, 5, 0, 100, 0, 0, frame, frame);
+ playDigi2();
+ break;
+
+ case 49:
+ _val2 = 42;
+ kernel_trigger_dispatch_now(15);
+ break;
+
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 16:
+ switch (_val5) {
+ case 1:
+ _cat.terminate();
+ _val5 = 3;
+ series_play_with_breaks(PLAY3, "405cat", 0, 16, 3, 9, 100, 0, 0);
+ break;
+
+ case 2:
+ _cat.terminate();
+ _val5 = 3;
+ series_play_with_breaks(PLAY4, "405cat", 0, 16, 3, 6, 100, 0, 0);
+ break;
+
+ case 3:
+ _cat.show("405cat", 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 17:
+ switch (_val4) {
+ case 4:
+ switch (_val3) {
+ case 4:
+ switch (imath_ranged_rand(1, 15)) {
+ case 1:
+ series_play_with_breaks(PLAY1, "405ve02", 0xf00, 17, 2);
+ break;
+ case 2:
+ series_play("405ve03", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 3);
+ break;
+ default:
+ series_play("405ve01", 0xf00, 0, 17, 60, 0);
+ break;
+ }
+ break;
+
+ case 7:
+ _val4 = 6;
+ series_play("405ve03", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 11:
+ _val4 = 9;
+ series_play("405ve14", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 17:
+ _val4 = 16;
+ series_play("405ve08", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 21:
+ _val4 = 22;
+ series_play("405ve04", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 5);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ switch (_val3) {
+ case 4:
+ if (imath_ranged_rand(1, 10) == 1) {
+ _val4 = 16;
+ Series::series_play("405ve10", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 3);
+ } else {
+ Series::series_play("405ve10", 0xf00, 0, 17, 6, 0, 100, 0, 0, 3, 3);
+ }
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 16;
+ Series::series_play("405ve10", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 3);
+ break;
+ }
+ break;
+
+ case 6:
+ switch (_val3) {
+ case 4:
+ if (imath_ranged_rand(1, 10) == 1) {
+ series_play("405ve03", 0xf00, 2, 17, 10, 0, 100, 0, 0, 0, 3);
+ } else {
+ series_play("405ve03", 0xf00, 0, 17, 60, 0, 100, 0, 0, 3, 3);
+ }
+ break;
+
+ case 7:
+ frame = imath_ranged_rand(3, 6);
+ series_play("405ve03", 0xf00, 2, 17, 4, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 4;
+ series_play("405ve03", 0xf00, 2, 17, 10, 0, 100, 0, 0, 0, 3);
+ break;
+ }
+ break;
+
+ case 9:
+ switch (_val3) {
+ case 9:
+ Series::series_play("405ve15", 0xf00, 0, 17, 60, 0, 100, 0, 0, 4, 4);
+ break;
+
+ case 10:
+ _val4 = 10;
+ Series::series_play("405ve17", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 11:
+ _val4 = imath_ranged_rand(1, 2) == 1 ? 12 : 13;
+ Series::series_play("405ve18", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 14:
+ _val3 = 15;
+ digi_preload("405_009");
+ series_play_with_breaks(PLAY2, "405ve16", 0x100, 17, 3);
+ break;
+
+ case 15:
+ _val3 = 9;
+ kernel_trigger_dispatch_now(17);
+ break;
+
+ case 16:
+ _val4 = 16;
+ Series::series_play("405ve15", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ default:
+ _val4 = 4;
+ Series::series_play("405ve08", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 10:
+ switch (_val3) {
+ case 10:
+ frame = imath_ranged_rand(3, 5);
+ Series::series_play("405ve17", 0xf00, 0, 17, 4, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 9;
+ Series::series_play("405ve17", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 2);
+ break;
+ }
+ break;
+
+ case 12:
+ switch (_val3) {
+ case 11:
+ frame = imath_ranged_rand(1, 4);
+ Series::series_play("405ve18", 0xf00, 0, 17, 4, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 9;
+ Series::series_play("405ve18", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 13:
+ switch (_val3) {
+ case 11:
+ frame = imath_ranged_rand(5, 8);
+ Series::series_play("405ve18", 0xf00, 0, 17, 4, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 9;
+ Series::series_play("405ve18", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 16:
+ switch (_val3) {
+ case 11:
+ _val4 = 9;
+ Series::series_play("405ve15", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 16:
+ if (imath_ranged_rand(1, 10) == 1) {
+ _val4 = 5;
+ Series::series_play("405ve10", 0xf00, 0, 17, 10, 0, 100, 0, 0, 0, 3);
+ } else {
+ series_play("405ve08", 0xf00, 0, 17, 60, 0, 100, 0, 0, 4, 4);
+ }
+ break;
+
+ case 17:
+ if (imath_ranged_rand(1, 2) == 1) {
+ _val4 = 18;
+ kernel_trigger_dispatch_now(17);
+ } else {
+ _val4 = 19;
+ Series::series_play("405ve11", 0xf00, 0, 17, 6, 0, 100, 0, 0, 2, 4);
+ }
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 4;
+ series_play("405ve08", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 18:
+ switch (_val3) {
+ case 17:
+ frame = imath_ranged_rand(0, 1);
+ Series::series_play("405ve11", 0xf00, 0, 17, 4, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 16;
+ kernel_trigger_dispatch_now(17);
+ break;
+ }
+ break;
+
+ case 19:
+ switch (_val3) {
+ case 17:
+ frame = imath_ranged_rand(4, 6);
+ Series::series_play("405ve11", 0xf00, 0, 17, 4, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ Series::series_play("405ve11", 0xf00, 2, 17, 6, 0, 100, 0, 0, 2, 4);
+ break;
+ }
+ break;
+
+ case 20:
+ switch (_val3) {
+ case 20:
+ Series::series_play("405ve06", 0xf00, 0, 17, 60, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 21:
+ frame = imath_ranged_rand(0, 4);
+ Series::series_play("405ve06", 0xf00, 0, 17, 5, 0, 100, 0, 0, frame, frame);
+ playDigi();
+ break;
+
+ case 24:
+ break;
+
+ default:
+ _val4 = 23;
+ Series::series_play("405ve05", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 22:
+ _val4 = 20;
+ Series::series_play("405ve05", 0xf00, 0, 17, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 23:
+ _val4 = 4;
+ series_play("405ve04", 0xf00, 2, 17, 6, 0, 100, 0, 0, 0, 5);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 19:
+ _val5 = 1;
+ kernel_trigger_dispatch_now(16);
+ break;
+
+ case 20:
+ player_set_commands_allowed(true);
+ break;
+
+ case 21:
+ ws_unhide_walker();
+ break;
+
+ case 22:
+ pal_fade_init(15, 255, 100, 0, -1);
+ break;
+
+ case 23:
+ player_update_info();
+ ws_demand_location(_G(player_info).x - 5, _G(player_info).y);
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ terminateMachineAndNull(_records);
+
+ Series::series_play("405wi02", 0, 0, 24, 6, 0, 100);
+ break;
+
+ case 24:
+ conv_resume_curr();
+ ws_unhide_walker();
+ inv_give_to_player("records");
+ hotspot_set_active("records", false);
+ player_set_commands_allowed(true);
+ break;
+
+ case 25:
+ _vp03.terminate();
+ _vp03.series_play("405vp03", 0x900, 0, -1, 600, -1, 100, 0, 0, 4, 4);
+ Series::series_play("405wi01", 0x100, 0, 26, 7, 0, 100, 0, 0, 16, 18);
+ break;
+
+ case 26:
+ _vp03.terminate();
+ Series::series_play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, 18, 18);
+ Series::series_play("405vp09", 0x900, 0, 27, 7, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 27:
+ _vp03.terminate();
+ inv_move_object("dog collar", 405);
+
+ _G(flags)[V171] = 4003;
+ Series::series_play("405wi01", 0x100, 0, 21, 7, 0, 100, 0, 0, 19, 24);
+ Series::series_play("405vp09", 0x900, 0, 28, 7, 0, 100, 0, 0, 4, 4);
+ break;
+
+ case 28:
+ _val2 = 47;
+ Series::series_play("405vp10", 0x900, 0, 15, 7, 0, 100, 0, 0, 0, 5);
+ break;
+
+ case 29:
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 30);
+ break;
+
+ case 30:
+ digi_play("405w503", 1, 255, 31);
+ break;
+
+ case 31:
+ _G(flags)[V168] = 1;
+ hotspot_set_active("order window", false);
+ if (!Section4::checkOrderWindow())
+ _G(game).room_id = 1;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 25:
+ disable_player();
+ _G(wilbur_should) = 26;
+ Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
+ break;
+
+ case 26:
+ _vp03.series_play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, 15, 15);
+ startConv89();
+ break;
+
+ case 27:
+ disable_player();
+ _G(wilbur_should) = 28;
+ Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 28:
+ _G(wilbur_should) = 29;
+ Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 11, 11);
+ startConv90();
+ break;
+
+ case 29:
+ Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 60, 0, 100, 0, 0, 11, 11);
+ break;
+
+ case 30:
+ _G(wilbur_should) = 31;
+ Series::series_play("405wi01", 0x100, 2, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
+ break;
+
+ case 31:
+ enable_player();
+ break;
+
+ case 32:
+ terminateMachineAndNull(_lid);
+ disable_player();
+ _G(wilbur_should) = 33;
+ series_play_with_breaks(PLAY5, "405wi07", 0x100, gCHANGE_WILBUR_ANIMATION, 3, 7, 100, 0, 0);
+ break;
+
+ case 33:
+ inv_move_object("records", NOWHERE);
+ _G(flags)[V167] = 1;
+
+ _lid = series_play("405lid", 0xf00, 2, -1, 600, -1, 100, 0, 0, 0, 0);
+ _box = series_play("405box1", 0xf00, 2, -1, 600, -1, 100, 0, 0, 0, 0);
+ hotspot_set_active("box", true);
+ enable_player();
+ break;
+
+ case 34:
+ disable_player();
+ _G(wilbur_should) = 35;
+ series_play_with_breaks(PLAY6, "405wi04", 0xe00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ break;
+
+ case 35:
+ inv_move_object("quarter", 405);
+ _G(wilbur_should) = 36;
+ series_play_with_breaks(PLAY7, "405wi05", 0xe00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ break;
+
+ case 36:
+ digi_preload("405_001");
+ digi_play("405_001", 2, 255);
+ ws_unhide_walker();
+ player_update_info();
+
+ _G(wilbur_should) = 37;
+ ws_walk(_G(player_info).x, _G(player_info).y, nullptr, gCHANGE_WILBUR_ANIMATION, 5);
+ break;
+
+ case 37:
+ _G(wilbur_should) = 38;
+ gr_backup_palette();
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 15, gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 38:
+ player_update_info();
+ _G(walker).unloadSprites();
+ _cat.terminate();
+ terminateMachineAndNull(_lid);
+ terminateMachineAndNull(_box);
+
+ if (_series1)
+ terminateMachineAndNull(_series1);
+
+ _val3 = 24;
+
+ digi_preload("405_007");
+ digi_preload("405w503");
+ digi_preload("405v513");
+
+ digi_stop(3);
+ digi_unload("405_010");
+ digi_play_loop("405_007", 3, 255);
+
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "405disco", 7, 0, 6);
+ break;
+
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room405::pre_parser() {
@@ -606,6 +1294,18 @@ void Room405::talkToVera() {
conv_play_curr();
}
+void Room405::startConv89() {
+ conv_load_and_prepare("conv89", 2);
+ conv_export_value_curr(_G(flags)[V165], 0);
+ conv_play_curr();
+}
+
+void Room405::startConv90() {
+ conv_load_and_prepare("conv90", 3);
+ conv_export_value_curr(_G(flags)[V165], 0);
+ conv_play_curr();
+}
+
void Room405::startConv91() {
conv_load_and_prepare("conv91", 4);
conv_export_value_curr(_G(flags)[V165], 0);
diff --git a/engines/m4/burger/rooms/section4/room405.h b/engines/m4/burger/rooms/section4/room405.h
index cb9fba83ac0..af9160fd1f3 100644
--- a/engines/m4/burger/rooms/section4/room405.h
+++ b/engines/m4/burger/rooms/section4/room405.h
@@ -44,7 +44,10 @@ private:
machine *_box = nullptr;
machine *_lid = nullptr;
machine *_eu02 = nullptr;
+ Series _vp03;
+ Series _cat;
const char *_digiName = nullptr;
+ int32 _vpoof = -1;
KernelTriggerType _newMode = (KernelTriggerType)0;
int _volume = 0;
int _val1 = 0;
@@ -59,10 +62,15 @@ private:
void conv90();
void conv91();
void conv92();
+ void startConv89();
+ void startConv90();
void startConv91();
void talkToVipe();
void talkToVera();
void playDigi();
+ void playDigi2() {
+ playDigi();
+ }
public:
Room405() : Section4Room() {}
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 8cad8e558bf..5d325f9d4b7 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -157,6 +157,17 @@ void Section4::poof(int trigger) {
}
}
+bool Section4::checkOrderWindow() {
+ if (_G(flags)[V168] && _G(flags)[V181] && _G(flags)[V176] && _G(flags)[V159]) {
+ player_set_commands_allowed(false);
+ _G(flags)[V152] = 1;
+ disable_player_commands_and_fade_init(g10027);
+ return true;
+ } else {
+ return false;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4.h b/engines/m4/burger/rooms/section4/section4.h
index 9f6312a89c1..b2169b6494c 100644
--- a/engines/m4/burger/rooms/section4/section4.h
+++ b/engines/m4/burger/rooms/section4/section4.h
@@ -49,6 +49,7 @@ private:
public:
static void poof(int trigger);
+ static bool checkOrderWindow();
public:
Section4();
Commit: 55e68260e993c6b0c705dd68109854f468afcf91
https://github.com/scummvm/scummvm/commit/55e68260e993c6b0c705dd68109854f468afcf91
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added room 901
Changed paths:
A engines/m4/riddle/flags.cpp
A engines/m4/riddle/flags.h
engines/m4/module.mk
engines/m4/riddle/rooms/section9/room901.cpp
engines/m4/riddle/rooms/section9/room901.h
engines/m4/riddle/vars.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 6082baf3b58..04f2a5fc6f9 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -195,6 +195,7 @@ MODULE_OBJS = \
riddle/rooms/section9/room918.o \
riddle/rooms/section9/room996.o \
riddle/riddle.o \
+ riddle/flags.o \
riddle/hotkeys.o \
riddle/inventory.o \
ridle/vars.o \
diff --git a/engines/m4/riddle/flags.cpp b/engines/m4/riddle/flags.cpp
new file mode 100644
index 00000000000..73e779b6406
--- /dev/null
+++ b/engines/m4/riddle/flags.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/flags.h"
+#include "m4/riddle/vars.h"
+#include "m4/core/term.h"
+#include "m4/adv_r/adv.h"
+#include "m4/adv_r/adv_inv.h"
+
+namespace M4 {
+namespace Riddle {
+
+long Flags::_flags[FLAGS_COUNT];
+
+Flags::Flags() {
+ reset();
+}
+
+void Flags::sync(Common::Serializer &s) {
+ size_t count = size();
+ for (uint i = 0; i < count; ++i)
+ s.syncAsSint32LE((*this)[i]);
+}
+
+void Flags::reset() {
+ Common::fill(&(*this)[0], &(*this)[0] + FLAGS_COUNT, 0);
+ _flags[V071] = 2;
+ _flags[V088] = 1;
+ _flags[V086] = 2;
+ _flags[V014] = 1;
+ _flags[V270] = 824;
+ _flags[V282] = 1;
+ _flags[V292] = 1;
+}
+
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/flags.h b/engines/m4/riddle/flags.h
new file mode 100644
index 00000000000..110c81dddfd
--- /dev/null
+++ b/engines/m4/riddle/flags.h
@@ -0,0 +1,583 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_FLAGS_H
+#define M4_RIDDLE_FLAGS_H
+
+#include "common/array.h"
+#include "common/serializer.h"
+#include "m4/m4_types.h"
+
+namespace M4 {
+namespace Riddle {
+
+#define FLAGS_COUNT 512
+
+enum {
+ V000 = 0,
+ V001 = 1,
+ V002 = 2,
+ V003 = 3,
+ V004 = 4,
+ V005 = 5,
+ V006 = 6,
+ V007 = 7,
+ V008 = 8,
+ V009 = 9,
+ V010 = 10,
+ V011 = 11,
+ V012 = 12,
+ V013 = 13,
+ V014 = 14,
+ V015 = 15,
+ V016 = 16,
+ V017 = 17,
+ V018 = 18,
+ V019 = 19,
+ V020 = 20,
+ V021 = 21,
+ V022 = 22,
+ V023 = 23,
+ V024 = 24,
+ V025 = 25,
+ V026 = 26,
+ V027 = 27,
+ V028 = 28,
+ V029 = 29,
+ V030 = 30,
+ V031 = 31,
+ V032 = 32,
+ V033 = 33,
+ V034 = 34,
+ V035 = 35,
+ V036 = 36,
+ V037 = 37,
+ V038 = 38,
+ V039 = 39,
+ V040 = 40,
+ V041 = 41,
+ V042 = 42,
+ V043 = 43,
+ V044 = 44,
+ V045 = 45,
+ V046 = 46,
+ V047 = 47,
+ V048 = 48,
+ V049 = 49,
+ V050 = 50,
+ V051 = 51,
+ V052 = 52,
+ V053 = 53,
+ V054 = 54,
+ V055 = 55,
+ V056 = 56,
+ V057 = 57,
+ V058 = 58,
+ V059 = 59,
+ V060 = 60,
+ V061 = 61,
+ V062 = 62,
+ V063 = 63,
+ V064 = 64,
+ V065 = 65,
+ V066 = 66,
+ V067 = 67,
+ V068 = 68,
+ V069 = 69,
+ V070 = 70,
+ V071 = 71,
+ V072 = 72,
+ V073 = 73,
+ V074 = 74,
+ V075 = 75,
+ V076 = 76,
+ V077 = 77,
+ V078 = 78,
+ V079 = 79,
+ V080 = 80,
+ V081 = 81,
+ V082 = 82,
+ V083 = 83,
+ V084 = 84,
+ V085 = 85,
+ V086 = 86,
+ V087 = 87,
+ V088 = 88,
+ V089 = 89,
+ V090 = 90,
+ V091 = 91,
+ V092 = 92,
+ V093 = 93,
+ V094 = 94,
+ V095 = 95,
+ V096 = 96,
+ V097 = 97,
+ V098 = 98,
+ V099 = 99,
+
+ V100 = 100,
+ V101 = 101,
+ V102 = 102,
+ V103 = 103,
+ V104 = 104,
+ V105 = 105,
+ V106 = 106,
+ V107 = 107,
+ V108 = 108,
+ V109 = 109,
+ V110 = 110,
+ V111 = 111,
+ V112 = 112,
+ V113 = 113,
+ V114 = 114,
+ V115 = 115,
+ V116 = 116,
+ V117 = 117,
+ V118 = 118,
+ V119 = 119,
+ V120 = 120,
+ V121 = 121,
+ V122 = 122,
+ V123 = 123,
+ V124 = 124,
+ V125 = 125,
+ V126 = 126,
+ V127 = 127,
+ V128 = 128,
+ V129 = 129,
+ V130 = 130,
+ V131 = 131,
+ V132 = 132,
+ V133 = 133,
+ V134 = 134,
+ V135 = 135,
+ V136 = 136,
+ V137 = 137,
+ V138 = 138,
+ V139 = 139,
+ V140 = 140,
+ V141 = 141,
+ V142 = 142,
+ V143 = 143,
+ V144 = 144,
+ V145 = 145,
+ V146 = 146,
+ V147 = 147,
+ V148 = 148,
+ V149 = 149,
+ V150 = 150,
+ V151 = 151,
+ V152 = 152,
+ V153 = 153,
+ V154 = 154,
+ V155 = 155,
+ V156 = 156,
+ V157 = 157,
+ V158 = 158,
+ V159 = 159,
+ V160 = 160,
+ V161 = 161,
+ V162 = 162,
+ V163 = 163,
+ V164 = 164,
+ V165 = 165,
+ V166 = 166,
+ V167 = 167,
+ V168 = 168,
+ V169 = 169,
+ V170 = 170,
+ V171 = 171,
+ V172 = 172,
+ V173 = 173,
+ V174 = 174,
+ V175 = 175,
+ V176 = 176,
+ V177 = 177,
+ V178 = 178,
+ V179 = 179,
+ V180 = 180,
+ V181 = 181,
+ V182 = 182,
+ V183 = 183,
+ V184 = 184,
+ V185 = 185,
+ V186 = 186,
+ V187 = 187,
+ V188 = 188,
+ V189 = 189,
+ V190 = 190,
+ V191 = 191,
+ V192 = 192,
+ V193 = 193,
+ V194 = 194,
+ V195 = 195,
+ V196 = 196,
+ V197 = 197,
+ V198 = 198,
+ V199 = 199,
+
+ V200 = 200,
+ V201 = 201,
+ V202 = 202,
+ V203 = 203,
+ V204 = 204,
+ V205 = 205,
+ V206 = 206,
+ V207 = 207,
+ V208 = 208,
+ V209 = 209,
+ V210 = 210,
+ V211 = 211,
+ V212 = 212,
+ V213 = 213,
+ V214 = 214,
+ V215 = 215,
+ V216 = 216,
+ V217 = 217,
+ V218 = 218,
+ V219 = 219,
+ V220 = 220,
+ V221 = 221,
+ V222 = 222,
+ V223 = 223,
+ V224 = 224,
+ V225 = 225,
+ V226 = 226,
+ V227 = 227,
+ V228 = 228,
+ V229 = 229,
+ V230 = 230,
+ V231 = 231,
+ V232 = 232,
+ V233 = 233,
+ V234 = 234,
+ V235 = 235,
+ V236 = 236,
+ V237 = 237,
+ V238 = 238,
+ V239 = 239,
+ V240 = 240,
+ V241 = 241,
+ V242 = 242,
+ V243 = 243,
+ V244 = 244,
+ V245 = 245,
+ V246 = 246,
+ V247 = 247,
+ V248 = 248,
+ V249 = 249,
+ V250 = 250,
+ V251 = 251,
+ V252 = 252,
+ V253 = 253,
+ V254 = 254,
+ V255 = 255,
+ V256 = 256,
+ V257 = 257,
+ V258 = 258,
+ V259 = 259,
+ V260 = 260,
+ V261 = 261,
+ V262 = 262,
+ V263 = 263,
+ V264 = 264,
+ V265 = 265,
+ V266 = 266,
+ V267 = 267,
+ V268 = 268,
+ V269 = 269,
+ V270 = 270,
+ V271 = 271,
+ V272 = 272,
+ V273 = 273,
+ V274 = 274,
+ V275 = 275,
+ V276 = 276,
+ V277 = 277,
+ V278 = 278,
+ V279 = 279,
+ V280 = 280,
+ V281 = 281,
+ V282 = 282,
+ V283 = 283,
+ V284 = 284,
+ V285 = 285,
+ V286 = 286,
+ V287 = 287,
+ V288 = 288,
+ V289 = 289,
+ V290 = 290,
+ V291 = 291,
+ V292 = 292,
+ V293 = 293,
+ V294 = 294,
+ V295 = 295,
+ V296 = 296,
+ V297 = 297,
+ V298 = 298,
+ V299 = 299,
+
+ V300 = 300,
+ V301 = 301,
+ V302 = 302,
+ V303 = 303,
+ V304 = 304,
+ V305 = 305,
+ V306 = 306,
+ V307 = 307,
+ V308 = 308,
+ V309 = 309,
+ V310 = 310,
+ V311 = 311,
+ V312 = 312,
+ V313 = 313,
+ V314 = 314,
+ V315 = 315,
+ V316 = 316,
+ V317 = 317,
+ V318 = 318,
+ V319 = 319,
+ V320 = 320,
+ V321 = 321,
+ V322 = 322,
+ V323 = 323,
+ V324 = 324,
+ V325 = 325,
+ V326 = 326,
+ V327 = 327,
+ V328 = 328,
+ V329 = 329,
+ V330 = 330,
+ V331 = 331,
+ V332 = 332,
+ V333 = 333,
+ V334 = 334,
+ V335 = 335,
+ V336 = 336,
+ V337 = 337,
+ V338 = 338,
+ V339 = 339,
+ V340 = 340,
+ V341 = 341,
+ V342 = 342,
+ V343 = 343,
+ V344 = 344,
+ V345 = 345,
+ V346 = 346,
+ V347 = 347,
+ V348 = 348,
+ V349 = 349,
+ V350 = 350,
+ V351 = 351,
+ V352 = 352,
+ V353 = 353,
+ V354 = 354,
+ V355 = 355,
+ V356 = 356,
+ V357 = 357,
+ V358 = 358,
+ V359 = 359,
+ V360 = 360,
+ V361 = 361,
+ V362 = 362,
+ V363 = 363,
+ V364 = 364,
+ V365 = 365,
+ V366 = 366,
+ V367 = 367,
+ V368 = 368,
+ V369 = 369,
+ V370 = 370,
+ V371 = 371,
+ V372 = 372,
+ V373 = 373,
+ V374 = 374,
+ V375 = 375,
+ V376 = 376,
+ V377 = 377,
+ V378 = 378,
+ V379 = 379,
+ V380 = 380,
+ V381 = 381,
+ V382 = 382,
+ V383 = 383,
+ V384 = 384,
+ V385 = 385,
+ V386 = 386,
+ V387 = 387,
+ V388 = 388,
+ V389 = 389,
+ V390 = 390,
+ V391 = 391,
+ V392 = 392,
+ V393 = 393,
+ V394 = 394,
+ V395 = 395,
+ V396 = 396,
+ V397 = 397,
+ V398 = 398,
+ V399 = 399,
+
+ V400 = 400,
+ V401 = 401,
+ V402 = 402,
+ V403 = 403,
+ V404 = 404,
+ V405 = 405,
+ V406 = 406,
+ V407 = 407,
+ V408 = 408,
+ V409 = 409,
+ V410 = 410,
+ V411 = 411,
+ V412 = 412,
+ V413 = 413,
+ V414 = 414,
+ V415 = 415,
+ V416 = 416,
+ V417 = 417,
+ V418 = 418,
+ V419 = 419,
+ V420 = 420,
+ V421 = 421,
+ V422 = 422,
+ V423 = 423,
+ V424 = 424,
+ V425 = 425,
+ V426 = 426,
+ V427 = 427,
+ V428 = 428,
+ V429 = 429,
+ V430 = 430,
+ V431 = 431,
+ V432 = 432,
+ V433 = 433,
+ V434 = 434,
+ V435 = 435,
+ V436 = 436,
+ V437 = 437,
+ V438 = 438,
+ V439 = 439,
+ V440 = 440,
+ V441 = 441,
+ V442 = 442,
+ V443 = 443,
+ V444 = 444,
+ V445 = 445,
+ V446 = 446,
+ V447 = 447,
+ V448 = 448,
+ V449 = 449,
+ V450 = 450,
+ V451 = 451,
+ V452 = 452,
+ V453 = 453,
+ V454 = 454,
+ V455 = 455,
+ V456 = 456,
+ V457 = 457,
+ V458 = 458,
+ V459 = 459,
+ V460 = 460,
+ V461 = 461,
+ V462 = 462,
+ V463 = 463,
+ V464 = 464,
+ V465 = 465,
+ V466 = 466,
+ V467 = 467,
+ V468 = 468,
+ V469 = 469,
+ V470 = 470,
+ V471 = 471,
+ V472 = 472,
+ V473 = 473,
+ V474 = 474,
+ V475 = 475,
+ V476 = 476,
+ V477 = 477,
+ V478 = 478,
+ V479 = 479,
+ V480 = 480,
+ V481 = 481,
+ V482 = 482,
+ V483 = 483,
+ V484 = 484,
+ V485 = 485,
+ V486 = 486,
+ V487 = 487,
+ V488 = 488,
+ V489 = 489,
+ V490 = 490,
+ V491 = 491,
+ V492 = 492,
+ V493 = 493,
+ V494 = 494,
+ V495 = 495,
+ V496 = 496,
+ V497 = 497,
+ V498 = 498,
+ V499 = 499,
+
+ V500 = 500,
+ V501 = 501,
+ V502 = 502,
+ V503 = 503,
+ V504 = 504,
+ V505 = 505,
+ V506 = 506,
+ V507 = 507,
+ V508 = 508,
+ V509 = 509,
+ V510 = 510,
+ V511 = 511
+};
+
+class Flags {
+public:
+ static long _flags[FLAGS_COUNT];
+
+public:
+ Flags();
+
+ /**
+ * Save/load values to a save file
+ */
+ void sync(Common::Serializer &s);
+
+ size_t size() const {
+ return FLAGS_COUNT;
+ }
+ long &operator[](uint idx) {
+ assert(idx < FLAGS_COUNT);
+ return _flags[idx];
+ }
+
+ /**
+ * Reset the flags
+ */
+ void reset();
+};
+
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section9/room901.cpp b/engines/m4/riddle/rooms/section9/room901.cpp
index 2f9e8e797ee..42619b61140 100644
--- a/engines/m4/riddle/rooms/section9/room901.cpp
+++ b/engines/m4/riddle/rooms/section9/room901.cpp
@@ -22,21 +22,109 @@
#include "m4/riddle/rooms/section9/room901.h"
#include "m4/graphics/gr_series.h"
#include "m4/riddle/vars.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/platform/keys.h"
namespace M4 {
namespace Riddle {
namespace Rooms {
void Room901::preload() {
+ if (_G(game).room_id == 494)
+ digi_preload("wind", 901);
+
+ _G(player).walker_type = 1;
+ _G(player).shadow_type = 1;
_G(player).walker_in_this_scene = false;
}
void Room901::init() {
+ if (true) {
+ _G(game).previous_room = 494;
+ digi_preload("wind", 901);
+ _G(flags)[V001] = 1;
+ }
+
+ player_set_commands_allowed(false);
+
+ if (_G(game).previous_room == 494) {
+ digi_play_loop("wind", 1, 255, -1, 901);
+ kernel_timing_trigger(1, 10);
+ AddSystemHotkey(KEY_ESCAPE, escapePressed);
+ _G(kernel).call_daemon_every_loop = true;
+
+ } else {
+ mouse_hide();
+ kernel_timing_trigger(1, 5);
+ interface_hide();
+ AddSystemHotkey(KEY_ESCAPE, escapePressed);
+ }
}
void Room901::daemon() {
+ switch (_G(kernel).trigger) {
+ case 5:
+ kernel_timing_trigger(300, 6);
+ break;
+
+ case 6:
+ disable_player_commands_and_fade_init(7);
+ break;
+
+ case 7:
+ case 56:
+#ifdef TODO
+ AddSystemHotkey(KEY_ESCAPE, cb_Esc);
+ AddSystemHotkey(KEY_F2, cb_F2);
+ AddSystemHotkey(KEY_F3, cb_F3);
+#endif
+ _G(game).setRoom(494);
+ break;
+
+ case 10:
+ kernel_timing_trigger(300, 20);
+ break;
+
+ case 20:
+ digi_play_loop("wind", 2, 255, -1, 901);
+ kernel_timing_trigger(100, 21);
+ disable_player_commands_and_fade_init(30);
+ break;
+
+ case 21:
+ digi_stop(1);
+ break;
+
+ case 30:
+ adv_kill_digi_between_rooms(false);
+ _G(game).setRoom(902);
+ break;
+
+ case 55:
+ _G(game).setRoom(304);
+ break;
+
+ default:
+ break;
+ }
+
+ bool mouseReleased = false;
+ if (_G(MouseState).ButtonState) {
+ _btnPressed = true;
+ } else if (_btnPressed) {
+ _btnPressed = false;
+ mouseReleased = false;
+ }
+
+ if (mouseReleased)
+ disable_player_commands_and_fade_init(55);
+}
+
+void Room901::escapePressed(void *, void *) {
+ // TODO
}
+
} // namespace Rooms
} // namespace Riddle
} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room901.h b/engines/m4/riddle/rooms/section9/room901.h
index 6a8c452f623..ee0c4bda4c2 100644
--- a/engines/m4/riddle/rooms/section9/room901.h
+++ b/engines/m4/riddle/rooms/section9/room901.h
@@ -29,6 +29,11 @@ namespace Riddle {
namespace Rooms {
class Room901 : public Room {
+private:
+ bool _btnPressed = false;
+
+ static void escapePressed(void *, void *);
+
public:
Room901() : Room() {}
~Room901() override {}
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index a055cabbcef..dff9082a6d1 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -23,6 +23,7 @@
#define M4_RIDDLE_VARS_H
#include "common/textconsole.h"
+#include "m4/riddle/flags.h"
#include "m4/riddle/hotkeys.h"
#include "m4/riddle/walker.h"
#include "m4/riddle/gui/interface.h"
@@ -47,6 +48,7 @@ protected:
void main_cold_data_init() override;
public:
+ Riddle::Flags _flags;
Riddle::Walker _walker;
Riddle::Hotkeys _hotkeys;
Riddle::GUI::Interface _interface;
Commit: 099085e7bdd0df2cef55272d822ad6af31f1c381
https://github.com/scummvm/scummvm/commit/099085e7bdd0df2cef55272d822ad6af31f1c381
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 406 init and dependent methods
Changed paths:
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index f18dacba68b..08a6c87e188 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -416,7 +416,7 @@ long Room406::_state3;
long Room406::_state4;
-Room406::Room406() : Room() {
+Room406::Room406() : Section4Room() {
_state1 = 0;
_state2 = 0;
_state3 = 0;
@@ -424,11 +424,316 @@ Room406::Room406() : Room() {
}
void Room406::init() {
+ digi_preload("400_001");
+ digi_play_loop("400_001", 3, 125);
+ pal_cycle_init(119, 127, 10);
+ _flag1 = false;
+
+ if (_G(flags)[V172] != 10026) {
+ loadSeries();
+
+ if (_G(game).previous_room == RESTORING_GAME) {
+ switch (_G(flags)[V172]) {
+ case 10023:
+ _val1 = 51;
+ break;
+ case 10024:
+ _val1 = 58;
+ break;
+ case 10025:
+ _val1 = 64;
+ break;
+ default:
+ break;
+ }
+
+ if (_G(flags)[V172] == 10026)
+ kernel_trigger_dispatch_now(12);
+ } else {
+ _val1 = imath_ranged_rand(1, 2) == 1 ? 49 : 50;
+
+ if (_G(flags)[V172] == 10025) {
+ _val1 = 64;
+ kernel_trigger_dispatch_now(12);
+ }
+ }
+ }
+
+ setHotspots1();
+ _val2 = 0;
+
+ if (_G(game).previous_room != RESTORING_GAME) {
+ if (player_been_here(406) || _G(flags)[V176]) {
+ if (_G(flags)[V172] != 10025 && _G(flags)[V172] != 10026) {
+ _val2 = 23;
+ kernel_trigger_dispatch_now(1);
+ }
+ } else {
+ _val2 = 22;
+ kernel_trigger_dispatch_now(22);
+ }
+ }
+
+ _flag2 = !_G(flags)[V176];
+
+ if (!_val2 && _flag2)
+ kernel_timing_trigger(300, 9);
+
+ if (_G(flags)[V171] == 4001)
+ _coll.show("406coll", 0x4fd, 0, -1, -1, 2);
+
+ setHotspots2();
+
+ if (!_G(flags)[V175]) {
+ _gateS1 = series_load("406gate");
+ _gateS2 = series_load("406gateS");
+ _gate.show("406gate", 0x4fd);
+ }
+
+ series_show("406tire", 0x702);
+ _tire = 0;
+ setupTt();
+ setNoWalk();
+
+ if (_G(flags)[V174] != 4003)
+ _tts = series_show("406tts", 0x601);
+
+ setHotspots4();
+ setupFish();
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ if (_G(flags)[V174] == 4003) {
+ ws_hide_walker();
+ _G(wilbur_should) = 7;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ case 402:
+ ws_demand_location(44, 310);
+ setDest(120);
+ break;
+
+ case 404:
+ ws_demand_location(173, 302, 1);
+ ws_walk(237, 308, nullptr, -1);
+ break;
+
+ case 405:
+ ws_demand_location(460, 346);
+ setDest(120);
+ break;
+
+ default:
+ ws_demand_location(169, 336, 5);
+ break;
+ }
}
void Room406::daemon() {
}
+void Room406::loadSeries() {
+ if (_G(flags)[V172] == 10025) {
+ series_load("406dg02");
+ series_load("406dg02s");
+ }
+
+ if (_G(flags)[V172] == 10023 || _G(flags)[V172] == 10024) {
+ if (_val1 == 49) {
+ series_load("406dg06");
+ series_load("406dg06s");
+ }
+
+ if (_val1 == 50) {
+ series_load("406dg07");
+ series_load("406dg07s");
+ }
+
+ series_load("406dg11");
+ series_load("406dg11s");
+ series_load("406dg15");
+ series_load("406dg15s");
+ }
+}
+
+void Room406::setHotspots1() {
+ hotspot_set_active("PEGLEG", false);
+ hotspot_set_active("PEGLEG ", false);
+ hotspot_set_active("PEGLEG ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+ hotspot_set_active("DOG COLLAR ", false);
+
+ switch (_G(flags)[V172]) {
+ case 10023:
+ hotspot_set_active("PEGLEG", true);
+ hotspot_set_active("DOG COLLAR ", true);
+ break;
+
+ case 10024:
+ hotspot_set_active("PEGLEG ", true);
+ hotspot_set_active("DOG COLLAR ", true);
+ break;
+
+ case 10025:
+ if (!_G(flags)[V173]) {
+ hotspot_set_active("PEGLEG ", true);
+ if (_G(flags)[V171] == 4000)
+ hotspot_set_active("DOG COLLAR ", true);
+ }
+
+ hotspot_set_active("HOLE", false);
+ break;
+
+ case 10026:
+ if (_G(flags)[V171] == 4001)
+ hotspot_set_active("DOG COLLAR ", true);
+
+ default:
+ break;
+ }
+}
+
+void Room406::setHotspots2() {
+ if (_G(flags)[V175]) {
+ hotspot_set_active("GATE", false);
+ hotspot_set_active("LOCK", false);
+ hotspot_set_active("CHAIN", false);
+ hotspot_set_active("RAZOR WIRE ", false);
+ hotspot_set_active("YARD", true);
+ } else {
+ hotspot_set_active("GATE", true);
+ hotspot_set_active("LOCK", true);
+ hotspot_set_active("CHAIN", true);
+ hotspot_set_active("RAZOR WIRE ", true);
+ hotspot_set_active("YARD", false);
+ }
+}
+
+void Room406::setHotspots3() {
+ hotspot_set_active("HOOK ", false);
+ hotspot_set_active("HOOK ", false);
+ hotspot_set_active("HOOK ", false);
+ hotspot_set_active("HOOK ", false);
+ hotspot_set_active("CHAIN ", false);
+ hotspot_set_active("CHAIN ", false);
+ hotspot_set_active("CHAIN ", false);
+ hotspot_set_active("CHAIN ", false);
+ hotspot_set_active("LEVER", false);
+ hotspot_set_active("LEVER ", false);
+
+ switch (_G(flags)[V174]) {
+ case 4000:
+ hotspot_set_active("HOOK ", true);
+ hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("LEVER", true);
+ break;
+
+ case 4001:
+ hotspot_set_active("HOOK ", true);
+ hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("LEVER ", true);
+ break;
+
+ case 4002:
+ hotspot_set_active("HOOK ", true);
+ hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("LEVER ", true);
+ break;
+
+ case 4003:
+ hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("LEVER ", true);
+ break;
+
+ case 4004:
+ hotspot_set_active("HOOK ", true);
+ hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("LEVER", true);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Room406::setHotspots4() {
+ hotspot_set_active("JAIL CELL ", false);
+ hotspot_set_active("RUBBLE", false);
+ hotspot_set_active("BARRED WINDOW ", false);
+ hotspot_set_active("HOOK ", false);
+
+ if (_G(flags)[V174] == 4004) {
+ hotspot_set_active("JAIL CELL ", true);
+ hotspot_set_active("RUBBLE", true);
+ hotspot_set_active("BARRED WINDOW ", false);
+ hotspot_set_active("BARRED WINDOW ", true);
+ hotspot_set_active("HOOK ", true);
+ }
+}
+
+void Room406::setupFish() {
+ hotspot_set_active("FISH ", false);
+ hotspot_set_active("FISH ", false);
+
+ if (_G(flags)[V173]) {
+ _fish = series_show("406fish", 0x4fd);
+ hotspot_set_active("FISH ", true);
+ }
+
+ if (_G(flags)[V172] == 10025)
+ hotspot_set_active("FISH ", true);
+}
+
+void Room406::setupTt() {
+ if (_tt)
+ terminateMachineAndNull(_tt);
+ if (_tire)
+ series_unload(_tire);
+
+ switch (_G(flags)[V174]) {
+ case 4000:
+ _tire = series_load("406tt");
+ _tt = series_show("406tt", 0x600);
+ break;
+
+ case 4001:
+ _tire = series_load("406tt02");
+ _tt = series_show("406tt02", 0x600);
+ break;
+
+ case 4002:
+ _tire = series_load("406tt03");
+ _tt = series_show("406tt03", 0x600);
+ break;
+
+ case 4004:
+ _tire = series_load("406tt05");
+ _tt = series_show("406tt05", 0x600);
+ break;
+
+ default:
+ break;
+ }
+
+ setHotspots3();
+}
+
+void Room406::setNoWalk() {
+ if (_G(flags)[V174] == 4002) {
+ _walk1 = intr_add_no_walk_rect(180, 271, 309, 280, 179, 281);
+ _walk2 = intr_add_no_walk_rect(350, 263, 409, 283, 349, 284);
+ }
+
+ if (_G(flags)[V174] == 4004) {
+ _walk3 = intr_add_no_walk_rect(336, 272, 388, 291, 335, 292);
+ _walk4 = intr_add_no_walk_rect(378, 259, 409, 291, 377, 292);
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index 7a91023d40e..e5eb63b8c75 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -22,14 +22,14 @@
#ifndef M4_BURGER_ROOMS_SECTION4_ROOM406_H
#define M4_BURGER_ROOMS_SECTION4_ROOM406_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section4/section4_room.h"
#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room406 : public Room {
+class Room406 : public Section4Room {
private:
static const char *SAID[][4];
static const WilburMatch MATCH[];
@@ -74,6 +74,31 @@ private:
static long _state2;
static long _state3;
static long _state4;
+ Series _coll;
+ Series _gate;
+ int32 _gateS1 = 0, _gateS2 = 0;
+ int32 _tire = 0;
+ machine *_tt = nullptr;
+ machine *_tts = nullptr;
+ machine *_fish = nullptr;
+ noWalkRect *_walk1 = nullptr;
+ noWalkRect *_walk2 = nullptr;
+ noWalkRect *_walk3 = nullptr;
+ noWalkRect *_walk4 = nullptr;
+ bool _flag1 = false;
+ bool _flag2 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+
+ void loadSeries();
+ void setHotspots1();
+ void setHotspots2();
+ void setHotspots3();
+ void setHotspots4();
+ void setupFish();
+ void setupTt();
+ void setNoWalk();
public:
Room406();
Commit: c6642c226887094c26a7433ccc67991f559dabad
https://github.com/scummvm/scummvm/commit/c6642c226887094c26a7433ccc67991f559dabad
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 406 parser
Changed paths:
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index 08a6c87e188..6bef32ace60 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -532,6 +532,94 @@ void Room406::init() {
}
void Room406::daemon() {
+ // TODO
+}
+
+void Room406::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (inv_player_has("HOOK")) {
+ if (player_said("HOOK", "BARRED WINDOW ")) {
+ _G(wilbur_should) = 11;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (!player_said("HOOK") ||
+ (player_said("HOOK") && player_said_any("YARD", "YARD "))) {
+ _G(wilbur_should) = 8;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ }
+ } else if (player_said("GATE") && _G(flags)[V172] == 10025) {
+ player_hotspot_walk_override(280, 296, 2);
+ } else if (player_said("GEAR") && player_said_any("WINCH", "LEVER", "LEVER ") && _G(flags)[V175]) {
+ player_hotspot_walk_override(546, 284, 9);
+ } else if (player_said("TAKE", "DOG COLLAR ") || player_said("FISH", "TIRE")) {
+ player_hotspot_walk_override(248, 298, 1);
+ } else if (player_said_any("CHAIN ", "CHAIN ")) {
+ player_walk_to(340, 300);
+ } else if (player_said("GEAR", "DISC")) {
+ _val4 = 4007;
+ player_hotspot_walk_override(44, 310, -1, 5);
+ } else if (player_said("GEAR", "DISC ")) {
+ _val4 = 4007;
+ player_hotspot_walk_override(460, 346, -1, 5);
+ } else if (player_said("LOOK AT") && player_said_any("JAIL CELL", "JAIL CELL ") && _G(flags)[V174] == 4004) {
+ if (!_flag1) {
+ parseJail();
+ _G(kernel).call_daemon_every_loop = true;
+
+ if (player_said("LOOK AT", "JAIL CELL"))
+ player_hotspot_walk_override(173, 302, 10);
+ }
+ } else {
+ if (_G(flags)[V174] == 4002) {
+ if (_G(player).walk_x >= 180 && _G(player).walk_x <= 309 &&
+ _G(player).walk_y >= 271 && _G(player).walk_y <= 280)
+ player_walk_to(_G(player).walk_x, 281);
+
+ if (_G(player).walk_x >= 350 && _G(player).walk_x <= 409 &&
+ _G(player).walk_y >= 263 && _G(player).walk_y <= 283)
+ player_walk_to(_G(player).walk_x, 284);
+ }
+
+ if (_G(flags)[V174] == 4004) {
+ if (_G(player).walk_x >= 336 && _G(player).walk_x <= 388 &&
+ _G(player).walk_y >= 272 && _G(player).walk_y <= 291)
+ player_walk_to(_G(player).walk_x, 292);
+
+ if (_G(player).walk_x >= 378 && _G(player).walk_x <= 409 &&
+ _G(player).walk_y >= 259 && _G(player).walk_y <= 291)
+ player_walk_to(_G(player).walk_x, 292);
+ }
+
+ if (player_said("FORCE FIELD")) {
+ player_set_facing_hotspot();
+ } else if (!_G(flags)[V175]) {
+ _hotspot = hotspot_which(_G(click_x), _G(click_y));
+ assert(_hotspot);
+
+ if (_hotspot->feet_y == 0x7fff) {
+ term_message("click_y: %d taboo_area_y (click_x)",
+ _G(click_x), tabooAreaY(_G(click_x)));
+ } else {
+ term_message("feet_y: %d taboo_area_y (feet_x): %d",
+ _hotspot->feet_y, tabooAreaY(_hotspot->feet_x));
+ }
+
+ if (_hotspot->feet_x > _hotspot->feet_y ||
+ (_hotspot->feet_y == 0x7fff && _G(click_y) > tabooAreaY(_G(click_x))))
+ player_walk_to(_hotspot->feet_x, tabooAreaY(_hotspot->feet_x) + 1);
+ }
+
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room406::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID) || _G(walker).wilbur_match(MATCH))
+ _G(player).command_ready = false;
}
void Room406::loadSeries() {
@@ -734,6 +822,22 @@ void Room406::setNoWalk() {
}
}
+void Room406::parseJail() {
+ if (player_said("LOOK AT") && player_said_any("JAIL CELL", "JAIL CELL "))
+ _flag1 = true;
+
+ if (_flag1) {
+ player_update_info();
+
+ if (_G(player_info).x < 183 && _G(player_info).y < 312 && player_commands_allowed())
+ disable_player_commands_and_fade_init(4003);
+ }
+}
+
+int Room406::tabooAreaY(int x) const {
+ return ((double)x * -0.1050583 + -240.21069) * -1.0;
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index e5eb63b8c75..80bed909f8e 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -85,11 +85,13 @@ private:
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
noWalkRect *_walk4 = nullptr;
+ HotSpotRec *_hotspot = nullptr;
bool _flag1 = false;
bool _flag2 = false;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
+ int _val4 = 0;
void loadSeries();
void setHotspots1();
@@ -99,6 +101,9 @@ private:
void setupFish();
void setupTt();
void setNoWalk();
+ void parseJail();
+
+ int tabooAreaY(int x) const;
public:
Room406();
@@ -106,6 +111,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
Commit: 381926963d7b498fd197262e419409d7a69b4d3f
https://github.com/scummvm/scummvm/commit/381926963d7b498fd197262e419409d7a69b4d3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 406 daemon
Changed paths:
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index 6bef32ace60..b3878e42746 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section4/room406.h"
#include "m4/burger/vars.h"
+#include "m4/burger/burger.h"
namespace M4 {
namespace Burger {
@@ -532,7 +533,805 @@ void Room406::init() {
}
void Room406::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ player_set_commands_allowed(false);
+
+ switch (_val2) {
+ case 22:
+ switch (_val1) {
+ case 49:
+ _state2 = imath_ranged_rand(1, 7);
+ _val1 = 51;
+ series_play_with_breaks(PLAY20, "406dg06", 0x701, 12, 3);
+ break;
+
+ case 50:
+ _val1 = 51;
+ series_play_with_breaks(PLAY21, "406dg07", 0x701, 12, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 23:
+ switch (_val1) {
+ case 49:
+ _state2 = imath_ranged_rand(1, 7);
+ series_play_with_breaks(PLAY20, "406dg06", 0x701, 2, 3);
+ break;
+
+ case 50:
+ series_play_with_breaks(PLAY21, "406dg07", 0x701, 2, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_val2) {
+ case 22:
+ playRandom(3);
+ break;
+
+ case 23:
+ _state2 = imath_ranged_rand(1, 6);
+ series_play_with_breaks(PLAY22, "406dg16", 0x701, 3, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 3:
+ switch (_val2) {
+ case 22:
+ kernel_timing_trigger(300, 9);
+ _state4 = 22;
+ ws_turn_to_face(calc_facing(162, 191), 8);
+ break;
+
+ case 23:
+ _val1 = 51;
+ kernel_trigger_dispatch_now(12);
+ kernel_timing_trigger(300, 9);
+ _state4 = 23;
+ ws_turn_to_face(calc_facing(415, 234), 8);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ poof(6);
+ break;
+
+ case 6:
+ disable_player_commands_and_fade_init(_val4);
+ break;
+
+ case 7:
+ _G(walker).wilbur_poof();
+
+ if (_val2)
+ ws_unhide_walker();
+ else
+ enable_player();
+ break;
+
+ case 8:
+ switch (_state4) {
+ case 22:
+ player_set_commands_allowed(true);
+ wilbur_speech("406w001");
+ break;
+
+ case 23:
+ player_set_commands_allowed(true);
+ _G(walker).wilbur_speech_random("406w002a", "406w002b", "406w002c");
+ break;
+
+ case 24:
+ wilbur_speech("400w001");
+ break;
+
+ case 25:
+ wilbur_speech("406w013");
+ break;
+
+ case 26:
+ wilbur_speech("406w014");
+ break;
+
+ case 27:
+ wilbur_speech("406w015");
+ break;
+
+ case 28:
+ term_message("The gate isn't open yet. I can't get over there!");
+ break;
+
+ case 29:
+ wilbur_speech("406w020");
+ break;
+
+ case 30:
+ wilbur_speech("406w021");
+ break;
+
+ case 31:
+ wilbur_speech("406w022");
+ break;
+
+ case 32:
+ wilbur_speech("406w023");
+ break;
+
+ case 33:
+ wilbur_speech("406w024");
+ break;
+
+ case 34:
+ _G(wilbur_should) = 13;
+ wilbur_speech("406w017", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 35:
+ wilbur_speech("406w019");
+ break;
+
+ case 36:
+ wilbur_speech("406w026");
+ break;
+
+ case 37:
+ wilbur_speech("406w008");
+ break;
+
+ case 38:
+ wilbur_speech("406w009");
+ break;
+
+ case 39:
+ wilbur_speech("406w027");
+ break;
+
+ case 40:
+ wilbur_speech("406w029");
+ break;
+
+ case 41:
+ wilbur_speech("406w030");
+ break;
+
+ case 42:
+ wilbur_speech("406w031");
+ break;
+
+ case 43:
+ wilbur_speech("406w032");
+ break;
+
+ case 44:
+ wilbur_speech("406w033");
+ break;
+
+ case 45:
+ digi_unload("406_111");
+ _G(wilbur_should) = 15;
+ wilbur_speech("406w018", gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 46:
+ _val5 = 68;
+ wilbur_speech("406w901", 11);
+ break;
+
+ case 47:
+ _val5 = 71;
+ _state1 = 80;
+ wilbur_speech("406w902", 11);
+ break;
+
+ case 48:
+ wilbur_speech("406w038");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ if (_flag2) {
+ _flag3 = false;
+ playRandom(-1);
+ _ticks = imath_ranged_rand(300, 600);
+ kernel_timing_trigger(_ticks - 120, 10);
+ kernel_timing_trigger(_ticks, 9);
+ }
+ break;
+
+ case 10:
+ _flag3 = true;
+ break;
+
+ case 11:
+ switch (_val5) {
+ case 68:
+ _val5 = 69;
+ digi_play("406g002", 1, 255, 11);
+ break;
+
+ case 69:
+ _val5 = 70;
+ series_play_with_breaks(PLAY11, "406mg01", 0x5ff, 11, 3);
+ break;
+
+ case 70:
+ _state1 = 79;
+ _val5 = 71;
+ series_play_with_breaks(PLAY12, "406mg03", 0x5ff, 11, 3);
+ break;
+
+ case 71:
+ _mg03.terminate();
+
+ switch (_state1) {
+ case 80:
+ _val5 = 73;
+ break;
+ case 81:
+ _val5 = 74;
+ break;
+ case 82:
+ _val5 = 72;
+ break;
+ default:
+ break;
+ }
+
+ series_play_with_breaks(PLAY13, "406mg04", 0x5ff, 11, 3);
+ break;
+
+ case 72:
+ _mg03.show("406mg03", 0x5ff);
+ _state4 = 47;
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ case 73:
+ _val5 = 71;
+ _state1 = 81;
+ series_play_with_breaks(PLAY14, "406mg05", 0x5ff, 11, 3);
+ break;
+
+ case 74:
+ _val1 = 67;
+ _mg03.show("406mg03", 0x5ff, 0, -1, -1, 14);
+ break;
+
+ case 75:
+ _mg03.terminate();
+ _val5 = 76;
+ series_play_with_breaks(PLAY15,
+ _G(flags)[V171] == 4000 ? "406mg06" : "406mg07",
+ 0x5ff, 11, 3);
+ break;
+
+ case 76:
+ _val6 = 85;
+ _val5 = 77;
+
+ if (_G(flags)[V171] == 4000)
+ series_play_with_breaks(PLAY16, "405mg06", 0x6fe, 11, 3);
+ else
+ series_play_with_breaks(PLAY17, "405mg07", 0x6fe, 11, 3);
+ break;
+
+ case 77:
+ _G(flags)[V176] = 1;
+ _G(flags)[V172] = 10026;
+
+ if (_G(flags)[V171] == 4000)
+ _G(flags)[V171] = 4001;
+
+ setHotspots1();
+ _val5 = 78;
+ series_play_with_breaks(PLAY18, "406mgpof", 0x6fe, 11, 2);
+ _val6 = 77;
+ kernel_trigger_dispatch_now(15);
+ break;
+
+ case 78:
+ hotspot_set_active("HOLE", true);
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 12:
+ switch (_val1) {
+ case 51:
+ _G(flags)[V172] = 10023;
+ setHotspots1();
+
+ if (_G(flags)[V173]) {
+ _val1 = 62;
+ kernel_trigger_dispatch_now(12);
+ } else {
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ _val1 = 51;
+ break;
+ case 2:
+ _val1 = 55;
+ break;
+ case 3:
+ _val3 = 53;
+ break;
+ case 4:
+ _val4 = 54;
+ break;
+ default:
+ break;
+ }
+
+ Series::series_show("406dg15", 0x701, 0, 12, 120, 0);
+ }
+ break;
+
+ case 53:
+ _state2 = imath_ranged_rand(1, 7);
+ _val1 = 51;
+
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ series_play_with_breaks(PLAY23, "406dg08", 0x701, 12, 3);
+ } else {
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 54:
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ _G(flags)[V172] = 10024;
+ _state2 = imath_ranged_rand(1, 3);
+ _val1 = 58;
+ series_play_with_breaks(PLAY24, "406dg10", 0x701, 12, 3);
+ } else {
+ _val1 = 51;
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 55:
+ _state2 = imath_ranged_rand(1, 6);
+ _val1 = 51;
+
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ series_play_with_breaks(PLAY22, "406dg16", 0x701, 12, 3);
+ } else {
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 56:
+ _state2 = imath_ranged_rand(1, 6);
+ _val1 = 58;
+
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ series_play_with_breaks(PLAY22, "406dg12", 0x701, 12, 3);
+ } else {
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 57:
+ if ((!digi_play_state(1) && !digi_play_state(2)) || _G(flags)[V173]) {
+ _state2 = imath_ranged_rand(1, 3);
+ _val1 = 51;
+ _G(flags)[V172] = 10023;
+ series_play_with_breaks(PLAY25, "406dg14", 0x701, 12, 3);
+ } else {
+ _val1 = 58;
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 58:
+ _G(flags)[V172] = 10024;
+ setHotspots1();
+
+ if (_G(flags)[V173]) {
+ _val1 = 57;
+ kernel_trigger_dispatch_now(12);
+ } else {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ _val1 = 58;
+ break;
+ case 2:
+ _val1 = 57;
+ break;
+ case 3:
+ _val1 = 56;
+ break;
+ default:
+ break;
+ }
+
+ Series::series_show("406dg11", 0x701, 0, 12, 120);
+ }
+ break;
+
+ case 59:
+ _state2 = imath_ranged_rand(1, 6);
+ _val1 = 54;
+ series_play_with_breaks(PLAY26, "406dg09", 0x701, 12, 3);
+ break;
+
+ case 60:
+ _state2 = imath_ranged_rand(1, 6);
+ _val1 = 56;
+ series_play_with_breaks(PLAY27, "406dg13", 0x701, 12, 3);
+ break;
+
+ case 61:
+ _state2 = imath_ranged_rand(1, 6);
+ _val1 = 64;
+ series_play_with_breaks(PLAY28,
+ _G(flags)[V171] == 4000 ? "406dg04" : "406dg05", 0x6fe, 12, 3);
+ break;
+
+ case 62:
+ _G(flags)[V172] = 10025;
+ _G(flags)[V173] = 0;
+ setHotspots1();
+ terminateMachineAndNull(_fish);
+ series_unload(_fishS);
+ _state2 = imath_ranged_rand(1, 4);
+ _state3 = imath_ranged_rand(1, 4);
+ _val1 = 63;
+ series_play_with_breaks(PLAY29, "406dg01", 0x6fe, 12, 3);
+ break;
+
+ case 63:
+ setupFish();
+ setHotspots1();
+ kernel_trigger_dispatch_now(12);
+ hotspot_set_active("HOLE", false);
+ break;
+
+ case 64:
+ _val1 = imath_ranged_rand(1, 3) == 1 ? 66 : 64;
+ _state2 = imath_ranged_rand(1, 6);
+
+ if (digi_play_state(2) || _flag3)
+ _state2 = 0;
+
+ _seriesName = _G(flags)[V171] == 4000 ? "406dg02" : "406dg03";
+ series_play_with_breaks(PLAY30, _seriesName, 0x6fe, 12, 3, 10);
+ break;
+
+ case 65:
+ _G(wilbur_should) = 21;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ _val1 = 64;
+ kernel_trigger_dispatch_now(12);
+ break;
+
+ case 66:
+ _val1 = 64;
+ _state2 = imath_ranged_rand(1, 5);
+
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ const seriesPlayBreak *PLAY[6] = {
+ PLAY31, PLAY32, PLAY33, PLAY34, PLAY35, PLAY36
+ };
+
+ _seriesName = _G(flags)[V171] == 4000 ? "406dg02" : "406dg03";
+ series_play_with_breaks(PLAY[imath_ranged_rand(0, 5)],
+ _seriesName, 0x6fe, 12, 3);
+ } else {
+ kernel_trigger_dispatch_now(12);
+ }
+ break;
+
+ case 67:
+ _val5 = 75;
+ kernel_trigger_dispatch_now(11);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 13:
+ digi_play("406_113", 2);
+ break;
+
+ case 14:
+ switch (_val7) {
+ case 82:
+ terminateMachineAndNull(_tt);
+ _G(flags)[V174] = 4001;
+ _val7 = 83;
+ series_play_with_breaks(PLAY10, "406tt06", 0x600, 14, 2);
+ break;
+
+ case 83:
+ player_set_commands_allowed(true);
+ setupTt();
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 15:
+ switch (_val6) {
+ case 77:
+ terminateMachineAndNull(_fish);
+ series_play_with_breaks(PLAY19, "406fishp", 0x4fd, -1, 2);
+ break;
+
+ case 84:
+ _G(flags)[V173] = 1;
+ setupFish();
+ inv_move_object("FISH", NOWHERE);
+
+ if (_G(flags)[V172] == 10024)
+ _val1 = 57;
+ if (_G(flags)[V172] == 10023)
+ _val1 = 62;
+ break;
+
+ case 85:
+ _fish = series_play("406fish2", 0x4fd, 16);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 16:
+ _state4 = 45;
+ digi_play("406_111", 1, 255, 8);
+ break;
+
+ case 17:
+ _coll.play("406coll", 0x4fd, 16);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ ws_unhide_walker();
+ break;
+
+ case 2:
+ disable_player();
+ _val6 = 84;
+ _fishS = series_load("406fish");
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY2, "406wi05", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ disable_player();
+ _val7 = 82;
+ kernel_trigger_dispatch_now(14);
+ _G(wilbur_should) = 1;
+ series_play_with_breaks(PLAY4, "406wi03", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 4:
+ terminateMachineAndNull(_tt);
+ disable_player();
+ _G(wilbur_should) = 5;
+ series_play_with_breaks(PLAY5, "406tt6a", 0x4fd, gCHANGE_WILBUR_ANIMATION, 2);
+ _wi03 = series_play("406wi03s", 0x4fe, 18);
+ break;
+
+ case 5:
+ terminateMachineAndNull(_wi03);
+ enable_player();
+ _G(flags)[V174] = 4000;
+ setupTt();
+ break;
+
+ case 6:
+ terminateMachineAndNull(_tt);
+ disable_player();
+ _G(wilbur_should) = 7;
+ series_play_with_breaks(PLAY6, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 7:
+ _general.show("406wi04", 0x4fd);
+ inv_give_to_player("HOOK");
+ _G(flags)[V174] = 4003;
+ setHotspots3();
+ break;
+
+ case 8:
+ _general.terminate();
+ disable_player();
+ _G(wilbur_should) = 9;
+ series_play_with_breaks(PLAY7, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 9:
+ inv_move_object("HOOK", NOWHERE);
+ _G(flags)[V174] = 4001;
+ setupTt();
+ enable_player();
+
+ if (!player_said("HOOK") || !player_said_any("YARD", "YARD "))
+ triggerPreparser();
+ break;
+
+ case 11:
+ _general.terminate();
+ _G(flags)[V174] = 4002;
+ ws_demand_location(183, 281, 10);
+ disable_player();
+ _G(wilbur_should) = 12;
+ series_play_with_breaks(PLAY8, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 12:
+ inv_move_object("HOOK", NOWHERE);
+ setupTt();
+ enable_player();
+ setNoWalk();
+ break;
+
+ case 13:
+ terminateMachineAndNull(_tt);
+ _G(flags)[V174] = 4004;
+ _flag2 = false;
+ digi_preload("406_111");
+ disable_player();
+
+ _G(wilbur_should) = 14;
+ digi_preload_stream_breaks(SERIES1);
+ series_stream_with_breaks(SERIES1, "406tt04", 6, 0x600, gCHANGE_WILBUR_ANIMATION);
+
+ _wi03 = series_play("406wi03s", 0x601, 18);
+ break;
+
+ case 14:
+ digi_unload_stream_breaks(SERIES1);
+ setupTt();
+ setHotspots4();
+ intr_remove_no_walk_rect(_walk1);
+ intr_remove_no_walk_rect(_walk2);
+ setNoWalk();
+
+ _flag2 = _flag3 = false;
+ terminateMachineAndNull(_wi03);
+ ws_unhide_walker();
+ break;
+
+ case 15:
+ _state4 = 46;
+ ws_walk(292, 333, nullptr, 8, 10);
+ break;
+
+ case 16:
+ if (player_commands_allowed()) {
+ player_set_commands_allowed(false);
+ _flag2 = false;
+ _flag3 = true;
+ }
+
+ if (digi_play_state(2)) {
+ kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _gate.terminate();
+ series_unload(_gateS1);
+ series_unload(_gateS2);
+ ws_hide_walker();
+
+ _G(flags)[V175] = 1;
+ _G(flags)[V177] = 1;
+ setHotspots2();
+
+ _G(wilbur_should) = 17;
+ series_play_with_breaks(PLAY1, "406wi01", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ }
+ break;
+
+ case 17:
+ enable_player();
+ _flag2 = true;
+ _flag3 = false;
+ kernel_trigger_dispatch_now(9);
+ break;
+
+ case 18:
+ disable_player();
+ terminateMachineAndNull(_coll406);
+ _G(wilbur_should) = 19;
+ series_play_with_breaks(PLAY3, "406wi02", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 19:
+ enable_player();
+ inv_give_to_player("DOG COLLAR");
+ _G(flags)[V171] = 4002;
+ setHotspots1();
+ break;
+
+ case 20:
+ player_set_commands_allowed(false);
+ _G(flags)[V171] = 4002;
+ _val1 = 65;
+ break;
+
+ case 21:
+ ws_hide_walker();
+ _G(wilbur_should) = 19;
+ series_play_with_breaks(PLAY9, "406wi06", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 10008:
+ switch (_G(flags)[V172]) {
+ case 10023:
+ _val1 = 59;
+ break;
+ case 10024:
+ _val1 = 60;
+ break;
+ case 10025:
+ _val1 = 61;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case gSET_COMMANDS_ALLOWED:
+ if (!_val2)
+ player_set_commands_allowed(true);
+ break;
+
+ case kCALLED_EACH_LOOP:
+ if (_flag1)
+ parseJail();
+ else
+ _G(kernel).call_daemon_every_loop = false;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room406::pre_parser() {
@@ -838,6 +1637,34 @@ int Room406::tabooAreaY(int x) const {
return ((double)x * -0.1050583 + -240.21069) * -1.0;
}
+void Room406::playRandom(int trigger) {
+ digi_unload(_randomDigi);
+
+ if (!digi_play_state(2)) {
+ _randomDigi = Common::String::format("406g001%c", 'a' + imath_ranged_rand(0, 18));
+ digi_preload(_randomDigi);
+ digi_play(_randomDigi.c_str(), 2, 125, trigger);
+ }
+}
+
+void Room406::triggerPreparser() {
+ _G(player).waiting_for_walk = true;
+ _G(player).ready_to_walk = true;
+ _G(player).need_to_walk = true;
+ _G(player).command_ready = true;
+ _G(kernel).trigger = -1;
+ _G(kernel).trigger_mode = KT_PREPARSE;
+ _G(player).walker_trigger = -1;
+
+ pre_parser();
+ if (_G(player).command_ready) {
+ g_engine->_activeSection->pre_parser();
+
+ if (_G(player).command_ready)
+ g_engine->global_pre_parser();
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index 80bed909f8e..68da686d903 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -76,11 +76,17 @@ private:
static long _state4;
Series _coll;
Series _gate;
+ Series _mg03;
int32 _gateS1 = 0, _gateS2 = 0;
int32 _tire = 0;
+ const char *_seriesName = nullptr;
machine *_tt = nullptr;
machine *_tts = nullptr;
machine *_fish = nullptr;
+ machine *_wi03 = nullptr;
+ machine *_coll406 = nullptr;
+ int32 _fishS = 0;
+ Common::String _randomDigi;
noWalkRect *_walk1 = nullptr;
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
@@ -88,10 +94,15 @@ private:
HotSpotRec *_hotspot = nullptr;
bool _flag1 = false;
bool _flag2 = false;
+ bool _flag3 = false;
+ int _ticks = 0;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+ int _val7 = 0;
void loadSeries();
void setHotspots1();
@@ -102,8 +113,9 @@ private:
void setupTt();
void setNoWalk();
void parseJail();
-
+ void playRandom(int trigger);
int tabooAreaY(int x) const;
+ void triggerPreparser();
public:
Room406();
Commit: 2d187f3f6a5fba618c2d88cd4216673cab224b51
https://github.com/scummvm/scummvm/commit/2d187f3f6a5fba618c2d88cd4216673cab224b51
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 407 methods
Changed paths:
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
engines/m4/burger/rooms/section4/section4_room.h
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index f86121ec51a..58b82aa4d3b 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -130,13 +130,13 @@ void Room405::init() {
case 406:
player_set_commands_allowed(false);
ws_demand_location(413, 356, 10);
- setDest(120);
+ setDest();
break;
default:
player_set_commands_allowed(false);
ws_demand_location(241, 266, 4);
- setDest(120);
+ setDest();
break;
}
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index b3878e42746..e6a504f5c57 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -513,7 +513,7 @@ void Room406::init() {
case 402:
ws_demand_location(44, 310);
- setDest(120);
+ setDest();
break;
case 404:
@@ -523,7 +523,7 @@ void Room406::init() {
case 405:
ws_demand_location(460, 346);
- setDest(120);
+ setDest();
break;
default:
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 818b679599d..b9078b4d5f0 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -156,14 +156,119 @@ const seriesPlayBreak Room407::PLAY19[] = {
long Room407::_state1;
-Room407::Room407() : Room() {
+Room407::Room407() : Section4Room() {
_state1 = 0;
}
void Room407::init() {
+ digi_preload("400_001");
+ digi_play_loop("400_001", 3, 125, -1);
+ pal_cycle_init(112, 127, 6);
+
+ if (!_G(flags)[V181] && _G(flags)[V171] == 4003) {
+ _G(flags)[V298] = 1;
+ player_set_commands_allowed(false);
+ }
+
+ _flag1 = false;
+ if (_G(flags)[V181]) {
+ hotspot_set_active("DRUMZ", false);
+ hotspot_set_active("VIPE", false);
+ hotspot_set_active("ROXY", false);
+
+ } else {
+ loadSeries();
+ _walk1 = intr_add_no_walk_rect(140, 295, 240, 325, 139, 326);
+ _val2 = 10;
+ kernel_trigger_dispatch_now(7);
+
+ _val3 = 22;
+ kernel_trigger_dispatch_now(8);
+
+ if (_G(flags)[V171] == 4003)
+ _vp02.series_show("407vp02", 0x300);
+ }
+
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 402:
+ ws_demand_location(43, 302);
+ setDest();
+ break;
+
+ case 405:
+ ws_demand_location(578, 296);
+ setDest();
+ break;
+
+ default:
+ ws_demand_location(520, 330, 9);
+ break;
+ }
}
void Room407::daemon() {
+ // TODO
+}
+
+void Room407::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(flags)[V067] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
+ _G(player).walk_y >= 295 && _G(player).walk_y <= 325)
+ player_walk_to(139, 326);
+
+ if (player_said("FORCE FIELD")) {
+ player_set_facing_hotspot();
+ } else if (player_said("GEAR", "DISC")) {
+ _val1 = 4007;
+ player_hotspot_walk_override(43, 302, -1, 1);
+ _G(player).command_ready = false;
+ } else if (player_said("GEAR", "DISC ")) {
+ _val1 = 4007;
+ player_hotspot_walk_override(578, 296, -1, 1);
+ _G(player).command_ready = false;
+ }
+}
+
+void Room407::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("conv87")) {
+ conv87();
+ } else if (player_said("conv88")) {
+ conv88();
+ } else if (!_G(walker).wilbur_match(MATCH)) {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room407::loadSeries() {
+ static const char *NAMES[16] = {
+ "407dz01", "407dz01s", "407dz02", "407dz02s", "407dz05",
+ "407dz05s", "407dz06", "407dz06s", "407rx04",
+ "407vp03", "407vp03s", "407vp05", "407vp05s", "407rx06",
+ "407rx08", "407rx09"
+ };
+ for (int i = 0; i < (_G(flags)[V171] == 4003 ? 16 : 9); ++i)
+ series_load(NAMES[i]);
+
+ digi_preload("407_001");
+ digi_preload("145_004");
+}
+
+void Room407::conv87() {
+
+}
+
+void Room407::conv88() {
+
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index c1ceec063b9..7e091f4339c 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -22,14 +22,14 @@
#ifndef M4_BURGER_ROOMS_SECTION4_ROOM407_H
#define M4_BURGER_ROOMS_SECTION4_ROOM407_H
-#include "m4/burger/rooms/room.h"
+#include "m4/burger/rooms/section4/section4_room.h"
#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
-class Room407 : public Room {
+class Room407 : public Section4Room {
private:
static const char *SAID[][4];
static const WilburMatch MATCH[];
@@ -53,6 +53,16 @@ private:
static const seriesPlayBreak PLAY18[];
static const seriesPlayBreak PLAY19[];
static long _state1;
+ Series _vp02;
+ noWalkRect *_walk1 = nullptr;
+ bool _flag1 = false;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+
+ void loadSeries();
+ void conv87();
+ void conv88();
public:
Room407();
@@ -60,6 +70,8 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section4/section4_room.h b/engines/m4/burger/rooms/section4/section4_room.h
index 4f163a6fe55..3d5fea8d8ed 100644
--- a/engines/m4/burger/rooms/section4/section4_room.h
+++ b/engines/m4/burger/rooms/section4/section4_room.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Section4Room : public Room {
protected:
- void setDest(int ticks);
+ void setDest(int ticks = 120);
void poof(int trigger);
public:
Commit: 24660792ef187ce453c6535cd72d0b4c90fc985c
https://github.com/scummvm/scummvm/commit/24660792ef187ce453c6535cd72d0b4c90fc985c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Merge InitMouseSeries
Changed paths:
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/riddle/vars.cpp
engines/m4/riddle/vars.h
engines/m4/vars.cpp
engines/m4/vars.h
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index bc53943e11b..22a637eb790 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -143,39 +143,6 @@ void Vars::initialize_game() {
Rooms::Room::setWilburHotspot();
}
-void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
- int32 maxW, maxH;
-
- _mouseSeriesHandle = nullptr;
- _mouseSeriesOffset = 0;
- _mouseSeriesPalOffset = 0;
-
- if (_mouseSprite)
- _mouseSprite->data = nullptr;
- if (_mouseBuffer.data)
- mem_free(_mouseBuffer.data);
-
- if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
- _mouseSeriesResource = assetName;
-
- if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
- if (maxW && maxH) {
- _mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
- _mouseBuffer.w = maxW;
- _mouseBuffer.h = maxH;
- _mouseBuffer.stride = maxW;
-
- vmng_screen_show(_mouseScreenSource);
- ResizeScreen(_mouseScreenSource, maxW, maxH);
-
- _currMouseNum = -1;
- _mouseIsLocked = false;
- mouse_set_sprite(kArrowCursor);
- }
- }
- }
-}
-
void Vars::custom_ascii_converter_proc(char *string) {
char *str;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 2a887813e10..79895a575e5 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -79,7 +79,6 @@ enum global_triggers {
class Vars : public M4::Vars {
private:
- void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
static void custom_ascii_converter_proc(char *string);
static void escape_key_pressed(void *, void *);
static void cb_F2(void *, void *);
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
index 6275feee535..479a456394e 100644
--- a/engines/m4/riddle/vars.cpp
+++ b/engines/m4/riddle/vars.cpp
@@ -96,39 +96,6 @@ void Vars::initialize_game() {
*/
}
-void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
- int32 maxW, maxH;
-
- _mouseSeriesHandle = nullptr;
- _mouseSeriesOffset = 0;
- _mouseSeriesPalOffset = 0;
-
- if (_mouseSprite)
- _mouseSprite->data = nullptr;
- if (_mouseBuffer.data)
- mem_free(_mouseBuffer.data);
-
- if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
- _mouseSeriesResource = assetName;
-
- if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
- if (maxW && maxH) {
- _mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
- _mouseBuffer.w = maxW;
- _mouseBuffer.h = maxH;
- _mouseBuffer.stride = maxW;
-
- vmng_screen_show(_mouseScreenSource);
- ResizeScreen(_mouseScreenSource, maxW, maxH);
-
- _currMouseNum = -1;
- _mouseIsLocked = false;
- mouse_set_sprite(kArrowCursor);
- }
- }
- }
-}
-
void Vars::custom_ascii_converter_proc(char *string) {
/*
char *str;
diff --git a/engines/m4/riddle/vars.h b/engines/m4/riddle/vars.h
index dff9082a6d1..5b4d5385a3f 100644
--- a/engines/m4/riddle/vars.h
+++ b/engines/m4/riddle/vars.h
@@ -38,7 +38,6 @@ enum global_triggers {
class Vars : public M4::Vars {
private:
- void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
static void custom_ascii_converter_proc(char *string);
static void escape_key_pressed(void *, void *);
static void cb_F2(void *, void *);
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index c873ae7cf9c..d6deb449e20 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -294,4 +294,37 @@ void Vars::create_mouse_watch_dialog() {
Dialog_Configure(_mousePosDialog, 0, 0, 0);
}
+void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
+ int32 maxW, maxH;
+
+ _mouseSeriesHandle = nullptr;
+ _mouseSeriesOffset = 0;
+ _mouseSeriesPalOffset = 0;
+
+ if (_mouseSprite)
+ _mouseSprite->data = nullptr;
+ if (_mouseBuffer.data)
+ mem_free(_mouseBuffer.data);
+
+ if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
+ _mouseSeriesResource = assetName;
+
+ if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
+ if (maxW && maxH) {
+ _mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
+ _mouseBuffer.w = maxW;
+ _mouseBuffer.h = maxH;
+ _mouseBuffer.stride = maxW;
+
+ vmng_screen_show(_mouseScreenSource);
+ ResizeScreen(_mouseScreenSource, maxW, maxH);
+
+ _currMouseNum = -1;
+ _mouseIsLocked = false;
+ mouse_set_sprite(kArrowCursor);
+ }
+ }
+ }
+}
+
} // namespace M4
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 6ec12ad0cb1..2d103e0547d 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -77,6 +77,7 @@ private:
void create_mouse_watch_dialog();
protected:
+ void initMouseSeries(const Common::String &assetName, RGB8 *myPalette);
virtual void main_cold_data_init() = 0;
public:
Commit: fb82baa15800b3ada48a111e399f2c4257a41922
https://github.com/scummvm/scummvm/commit/fb82baa15800b3ada48a111e399f2c4257a41922
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added missing room 901 code
Changed paths:
engines/m4/riddle/rooms/section9/room901.cpp
diff --git a/engines/m4/riddle/rooms/section9/room901.cpp b/engines/m4/riddle/rooms/section9/room901.cpp
index 42619b61140..5f5b241eab0 100644
--- a/engines/m4/riddle/rooms/section9/room901.cpp
+++ b/engines/m4/riddle/rooms/section9/room901.cpp
@@ -19,7 +19,9 @@
*
*/
+#include "common/config-manager.h"
#include "m4/riddle/rooms/section9/room901.h"
+#include "m4/riddle/hotkeys.h"
#include "m4/graphics/gr_series.h"
#include "m4/riddle/vars.h"
#include "m4/gui/gui_sys.h"
@@ -39,7 +41,13 @@ void Room901::preload() {
}
void Room901::init() {
- if (true) {
+ // WORKAROUND: Original created a dummy file called believe.it
+ // on first run with "Never forget the llama and the spleen."
+ // For ScummVM, I've instead used a simple config manager flag
+
+ if (!ConfMan.getBool("believe_it")) {
+ ConfMan.setBool("believe_it", true);
+
_G(game).previous_room = 494;
digi_preload("wind", 901);
_G(flags)[V001] = 1;
@@ -73,11 +81,10 @@ void Room901::daemon() {
case 7:
case 56:
-#ifdef TODO
- AddSystemHotkey(KEY_ESCAPE, cb_Esc);
- AddSystemHotkey(KEY_F2, cb_F2);
- AddSystemHotkey(KEY_F3, cb_F3);
-#endif
+ AddSystemHotkey(KEY_ESCAPE, Hotkeys::escape_key_pressed);
+ AddSystemHotkey(KEY_F2, Hotkeys::cb_F2);
+ AddSystemHotkey(KEY_F3, Hotkeys::cb_F3);
+
_G(game).setRoom(494);
break;
@@ -121,10 +128,10 @@ void Room901::daemon() {
}
void Room901::escapePressed(void *, void *) {
- // TODO
+ _G(kernel).trigger_mode = KT_DAEMON;
+ disable_player_commands_and_fade_init(56);
}
-
} // namespace Rooms
} // namespace Riddle
} // namespace M4
Commit: 67b470c6b55fbb045436360b3e1c833e6d91137f
https://github.com/scummvm/scummvm/commit/67b470c6b55fbb045436360b3e1c833e6d91137f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Created base class for section 9 rooms
Changed paths:
A engines/m4/riddle/rooms/section9/section9_room.cpp
A engines/m4/riddle/rooms/section9/section9_room.h
engines/m4/module.mk
engines/m4/riddle/rooms/section9/room901.cpp
engines/m4/riddle/rooms/section9/room901.h
engines/m4/riddle/rooms/section9/room902.cpp
engines/m4/riddle/rooms/section9/room902.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 04f2a5fc6f9..9bcf79fb591 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -185,6 +185,7 @@ MODULE_OBJS = \
riddle/gui/interface.o \
riddle/rooms/section.o \
riddle/rooms/section9/section9.o \
+ riddle/rooms/section9/section9_room.o \
riddle/rooms/section9/room901.o \
riddle/rooms/section9/room902.o \
riddle/rooms/section9/room903.o \
diff --git a/engines/m4/riddle/rooms/section9/room901.cpp b/engines/m4/riddle/rooms/section9/room901.cpp
index 5f5b241eab0..0f9438d2dbf 100644
--- a/engines/m4/riddle/rooms/section9/room901.cpp
+++ b/engines/m4/riddle/rooms/section9/room901.cpp
@@ -127,11 +127,6 @@ void Room901::daemon() {
disable_player_commands_and_fade_init(55);
}
-void Room901::escapePressed(void *, void *) {
- _G(kernel).trigger_mode = KT_DAEMON;
- disable_player_commands_and_fade_init(56);
-}
-
} // namespace Rooms
} // namespace Riddle
} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room901.h b/engines/m4/riddle/rooms/section9/room901.h
index ee0c4bda4c2..6f325e355ef 100644
--- a/engines/m4/riddle/rooms/section9/room901.h
+++ b/engines/m4/riddle/rooms/section9/room901.h
@@ -22,20 +22,18 @@
#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM901_H
#define M4_RIDDLE_ROOMS_SECTION9_ROOM901_H
-#include "m4/core/rooms.h"
+#include "m4/riddle/rooms/section9/section9_room.h"
namespace M4 {
namespace Riddle {
namespace Rooms {
-class Room901 : public Room {
+class Room901 : public Section9Room {
private:
bool _btnPressed = false;
- static void escapePressed(void *, void *);
-
public:
- Room901() : Room() {}
+ Room901() : Section9Room() {}
~Room901() override {}
void preload() override;
diff --git a/engines/m4/riddle/rooms/section9/room902.cpp b/engines/m4/riddle/rooms/section9/room902.cpp
index 11ec8413611..4b62f1aaf72 100644
--- a/engines/m4/riddle/rooms/section9/room902.cpp
+++ b/engines/m4/riddle/rooms/section9/room902.cpp
@@ -20,21 +20,37 @@
*/
#include "m4/riddle/rooms/section9/room902.h"
-#include "m4/graphics/gr_series.h"
#include "m4/riddle/vars.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/gui/gui_sys.h"
+#include "m4/platform/keys.h"
namespace M4 {
namespace Riddle {
namespace Rooms {
void Room902::preload() {
+ _G(player).walker_type = 1;
+ _G(player).shadow_type = 1;
_G(player).walker_in_this_scene = false;
}
void Room902::init() {
+ player_set_commands_allowed(false);
+ digi_preload("gunshot1", 902);
+ digi_preload("gunshot2", 902);
+ digi_preload("introcu-", 901);
+ digi_play("introcu-", 1, 255, -1, 901);
+ series_load("902 one frame hold");
+ kernel_timing_trigger(1, 1);
+ interface_hide();
+
+ AddSystemHotkey(KEY_ESCAPE, escapePressed);
+ _G(kernel).call_daemon_every_loop = true;
}
void Room902::daemon() {
+ // TODO
}
} // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section9/room902.h b/engines/m4/riddle/rooms/section9/room902.h
index 9a9955f5918..b0519726a26 100644
--- a/engines/m4/riddle/rooms/section9/room902.h
+++ b/engines/m4/riddle/rooms/section9/room902.h
@@ -22,15 +22,18 @@
#ifndef M4_RIDDLE_ROOMS_SECTION9_ROOM902_H
#define M4_RIDDLE_ROOMS_SECTION9_ROOM902_H
-#include "m4/core/rooms.h"
+#include "m4/riddle/rooms/section9/section9_room.h"
namespace M4 {
namespace Riddle {
namespace Rooms {
-class Room902 : public Room {
+class Room902 : public Section9Room {
+private:
+ machine *_title = nullptr;
+
public:
- Room902() : Room() {}
+ Room902() : Section9Room() {}
~Room902() override {}
void preload() override;
diff --git a/engines/m4/riddle/rooms/section9/section9_room.cpp b/engines/m4/riddle/rooms/section9/section9_room.cpp
new file mode 100644
index 00000000000..877a9062924
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/section9_room.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section9/section9_room.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Section9Room::escapePressed(void *, void *) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ disable_player_commands_and_fade_init(56);
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/section9_room.h b/engines/m4/riddle/rooms/section9/section9_room.h
new file mode 100644
index 00000000000..609ffeed9c0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section9/section9_room.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION9_ROOM_H
+#define M4_RIDDLE_ROOMS_SECTION9_ROOM_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section9Room : public Room {
+protected:
+ static void escapePressed(void *, void *);
+
+public:
+ Section9Room() : Room() {}
+ virtual ~Section9Room() {}
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
Commit: 3700a8a2c8d15ff9d6e48e813408e196884b1a3a
https://github.com/scummvm/scummvm/commit/3700a8a2c8d15ff9d6e48e813408e196884b1a3a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix typo
Changed paths:
engines/m4/module.mk
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9bcf79fb591..01ed2f65141 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -199,7 +199,7 @@ MODULE_OBJS = \
riddle/flags.o \
riddle/hotkeys.o \
riddle/inventory.o \
- ridle/vars.o \
+ riddle/vars.o \
riddle/walker.o
Commit: 5da14abe397bc44dc4dbcdf0616b0ac961d4cc70
https://github.com/scummvm/scummvm/commit/5da14abe397bc44dc4dbcdf0616b0ac961d4cc70
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix compilation
Changed paths:
engines/m4/burger/rooms/section3/mine.h
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 645a83f2968..169eeba51e1 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -72,10 +72,10 @@ struct EntranceInfo {
};
struct Rectangle {
- int16 x1 = 0;
- int16 y1 = 0;
- int16 x2 = 0;
- int16 y2 = 0;
+ int16 x1;
+ int16 y1;
+ int16 x2;
+ int16 y2;
};
class Mine : public Section3Room {
Commit: 6883519bf91de9cb057e4f5c336b22b354c24b91
https://github.com/scummvm/scummvm/commit/6883519bf91de9cb057e4f5c336b22b354c24b91
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added more room 407 support methods
Changed paths:
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index b9078b4d5f0..4b77f68bee4 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -264,13 +264,79 @@ void Room407::loadSeries() {
}
void Room407::conv87() {
-
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+
+ if (sound) {
+ if (who == 1)
+ wilbur_speech(sound, 10001);
+ else
+ playConvSound();
+ }
}
void Room407::conv88() {
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (sound) {
+ if (who == 1) {
+ wilbur_speech(sound, 10001);
+ } else if (_flag1) {
+ _val2 = 18;
+ } else if (node == 1) {
+ switch (entry) {
+ case 0:
+ case 2:
+ case 4:
+ _val2 = 13;
+ break;
+ case 1:
+ _val2 = 12;
+ break;
+ case 3:
+ case 5:
+ _val2 = 11;
+ break;
+ case 6:
+ _val2 = 10;
+ conv_resume_curr();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+int Room407::getRandomState() const {
+ switch (imath_ranged_rand(1, 10)) {
+ case 1:
+ return 15;
+ case 2:
+ return 16;
+ default:
+ return 10;
+ }
+}
+
+void Room407::freeDz() {
+ _dz.terminate();
+ series_unload(_dzS1);
+ series_unload(_dzS2);
+}
+
+void Room407::playConvSound() {
+ terminateMachineAndNull(_rx);
+ _val3 = 25;
+ digi_play(conv_sound_to_play(), 1, 255, 8);
+ _rx = series_play("407rx04", 0x901, 4, -1, 6, -1);
}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index 7e091f4339c..e7862daac3f 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -54,6 +54,9 @@ private:
static const seriesPlayBreak PLAY19[];
static long _state1;
Series _vp02;
+ Series _dz;
+ int _dzS1 = 0, _dzS2 = 0;
+ machine *_rx = nullptr;
noWalkRect *_walk1 = nullptr;
bool _flag1 = false;
int _val1 = 0;
@@ -63,6 +66,9 @@ private:
void loadSeries();
void conv87();
void conv88();
+ int getRandomState() const;
+ void freeDz();
+ void playConvSound();
public:
Room407();
Commit: bf65c714cc539db36ad1162f3a531d8b1025ff09
https://github.com/scummvm/scummvm/commit/bf65c714cc539db36ad1162f3a531d8b1025ff09
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 407 daemon
Changed paths:
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 58b82aa4d3b..8eb2262b311 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -717,7 +717,7 @@ void Room405::daemon() {
case 25:
_vp03.terminate();
- _vp03.series_play("405vp03", 0x900, 0, -1, 600, -1, 100, 0, 0, 4, 4);
+ _vp03.play("405vp03", 0x900, 0, -1, 600, -1, 100, 0, 0, 4, 4);
Series::series_play("405wi01", 0x100, 0, 26, 7, 0, 100, 0, 0, 16, 18);
break;
@@ -765,7 +765,7 @@ void Room405::daemon() {
break;
case 26:
- _vp03.series_play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, 15, 15);
+ _vp03.play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, 15, 15);
startConv89();
break;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 4b77f68bee4..fa9db1a1e6d 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -186,7 +186,7 @@ void Room407::init() {
kernel_trigger_dispatch_now(8);
if (_G(flags)[V171] == 4003)
- _vp02.series_show("407vp02", 0x300);
+ _vp02.show("407vp02", 0x300);
}
switch (_G(game).previous_room) {
@@ -210,7 +210,377 @@ void Room407::init() {
}
void Room407::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case 1:
+ poof(2);
+ break;
+
+ case 2:
+ disable_player_commands_and_fade_init(_val1);
+ break;
+
+ case 3:
+ _G(walker).wilbur_poof();
+
+ if (!_G(flags)[V181] && _G(flags)[V171] == 4003) {
+ ws_unhide_walker();
+ } else {
+ enable_player();
+ }
+ break;
+
+ case 4:
+ switch (_state1) {
+ case 3:
+ wilbur_speech("400w001");
+ break;
+ case 4:
+ wilbur_speech("407w004");
+ break;
+ case 5:
+ wilbur_speech("407w005");
+ break;
+ case 6:
+ wilbur_speech("407w006");
+ break;
+ case 7:
+ wilbur_speech("407w008");
+ break;
+ case 8:
+ wilbur_speech("407w011");
+ break;
+ case 9:
+ wilbur_speech("407w012");
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ _val2 = 17;
+
+ if (_val4) {
+ kernel_timing_trigger(120, 7);
+ } else {
+ _digiName = Common::String::format("407r902%c", 'a' + imath_ranged_rand(1, 25));
+
+ _flag1 = true;
+ digi_preload(_digiName);
+ digi_play(_digiName.c_str(), 2, 180, 6);
+ }
+ break;
+
+ case 6:
+ digi_unload(_digiName);
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ case 7:
+ switch (_val2) {
+ case 10:
+ if (!digi_play_state(2))
+ digi_play_loop("407_001", 2);
+
+ _val2 = getRandomState();
+ series_play_with_breaks(PLAY1, "407dz01", 0xa01, 7, 3);
+ break;
+
+ case 11:
+ _val2 = 14;
+ series_play_with_breaks(PLAY2, "407dz02", 0xa01, 7, 3);
+ break;
+
+ case 12:
+ _val2 = 14;
+ series_play_with_breaks(PLAY3, "407dz03", 0xa01, 7, 3);
+ break;
+
+ case 13:
+ digi_stop(2);
+ _val2 = 14;
+ series_play_with_breaks(PLAY4, "407dz04", 0xa01, 7, 3);
+ break;
+
+ case 14:
+ _val2 = getRandomState();
+ kernel_trigger_dispatch_now(7);
+ kernel_trigger_dispatch_now(10001);
+ break;
+
+ case 15:
+ digi_stop(2);
+ _val2 = getRandomState();
+ series_play_with_breaks(PLAY5, "407dz05", 0xa01, 7, 3);
+ break;
+
+ case 16:
+ digi_stop(2);
+ _dzS1 = series_load("407dz06");
+ _dzS2 = series_load("407dz06s");
+ _dz.show("407dz06", 0xa01, 18);
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 17:
+ _flag1 = false;
+ freeDz();
+ _val2 = getRandomState();
+ series_play_with_breaks(PLAY6, "407dz06", 0xa01, 7, 3);
+ break;
+
+ case 18:
+ _flag1 = false;
+ freeDz();
+ _val2 = 19;
+ series_play_with_breaks(PLAY6, "407dz06", 0xa01, 7, 3);
+ break;
+
+ case 19:
+ if (!digi_play_state(2))
+ digi_play_loop("407_001", 2);
+
+ conv88();
+ kernel_trigger_dispatch_now(7);
+ break;
+
+ case 20:
+ digi_stop(2);
+ _dz.play("407dz02", 0xa01, 16, -1, 6, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 21:
+ _dz.terminate();
+ hotspot_set_active("DRUMZ", false);
+ intr_remove_no_walk_rect(_walk1);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 8:
+ switch (_val3) {
+ case 22:
+ _rx = series_show("407rx02", 0x901);
+ break;
+
+ case 23:
+ terminateMachineAndNull(_rx);
+
+ switch (_val4) {
+ case 1:
+ _val3 = 26;
+ break;
+ case 2:
+ _val3 = 24;
+ break;
+ case 3:
+ _val3 = 27;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 24:
+ _rx = series_show("407rx02", 0x901, 0, -1, -1, 4);
+ kernel_trigger_dispatch_now(10);
+ break;
+
+ case 25:
+ terminateMachineAndNull(_rx);
+ _rx = series_show("407rx02", 0x901, 0, -1, -1, 4);
+ conv_resume_curr();
+ break;
+
+ case 26:
+ terminateMachineAndNull(_rx);
+ _val3 = 30;
+ series_play_with_breaks(PLAY9, "407rx04", 0x901, 8, 2);
+ break;
+
+ case 27:
+ _val3 = 28;
+ series_play_with_breaks(PLAY8, "407rx04", 0x901, 8, 2);
+ break;
+
+ case 28:
+ _val3 = 29;
+ series_play_with_breaks(PLAY10, "407rx02", 0x901, 8, 2);
+ break;
+
+ case 29:
+ _val3 = 22;
+ kernel_trigger_dispatch_now(8);
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case 30:
+ _val3 = 31;
+ series_play_with_breaks(PLAY11, "407rx06", 0x901, 8, 2);
+ break;
+
+ case 31:
+ _val5 = 36;
+ kernel_trigger_dispatch_now(9);
+ _val3 = 32;
+ series_play_with_breaks(PLAY12, "407rx08", 0x901, 8, 2);
+ break;
+
+ case 32:
+ _val3 = 33;
+ series_play_with_breaks(PLAY13, "407rx08", 0x901, 8, 2);
+ break;
+
+ case 33:
+ _val3 = 34;
+ series_play_with_breaks(PLAY14, "407rx09", 0x901, 8, 2);
+ break;
+
+ case 34:
+ kernel_trigger_dispatch_now(14);
+ terminateMachineAndNull(_rx);
+ _rx = series_show("407rx09", 0x901);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ switch (_val5) {
+ case 35:
+ _vp02.show("407vp02", 0x300);
+ _val4 = 1;
+ _val3 = 23;
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ case 36:
+ _vp02.terminate();
+ _val5 = 37;
+ series_play_with_breaks(PLAY16, "407vp02", 0x300, 9, 3);
+ break;
+
+ case 37:
+ _val5 = 39;
+ series_play_with_breaks(PLAY17, "407vp03", 0x300, 9, 3);
+ break;
+
+ case 38:
+ _vp02.terminate();
+ _val2 = 20;
+ _val5 = 35;
+ series_play_with_breaks(PLAY15, "407vp02", 0x300, 9, 3);
+ player_set_facing_at(412, 336);
+ break;
+
+ case 39:
+ _vp02.show("407vp05", 0x300);
+ break;
+
+ case 40:
+ terminateMachineAndNull(_rx);
+ _vp02.terminate();
+ hotspot_set_active("ROXY", false);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 10:
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ conv_load_and_prepare("conv87", 12);
+ conv_export_pointer_curr(&_G(flags)[V180], 0);
+ conv_play_curr();
+ break;
+
+ case 11:
+ _G(flags)[V298] = 1;
+ _G(flags)[V299] = 1;
+ player_set_commands_allowed(false);
+ conv_load_and_prepare("conv88", 13);
+ conv_play_curr();
+ break;
+
+ case 12:
+ _G(flags)[V298] = 0;
+ _G(flags)[V299] = 0;
+ _G(flags)[V180] = 1;
+ terminateMachineAndNull(_rx);
+ _val3 = 28;
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ case 13:
+ _G(flags)[V298] = 0;
+ _G(flags)[V299] = 0;
+ player_set_commands_allowed(true);
+ break;
+
+ case 14:
+ _G(flags)[V298] = 0;
+ _val2 = 21;
+ _val5 = 40;
+ series_play_with_breaks(PLAY18, "407poof", 0x2ff, 4008, 2);
+ _G(flags)[V181] = 1;
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+
+ if (_flag1) {
+ digi_stop(2);
+ _val2 = 17;
+ kernel_trigger_dispatch_now(7);
+ }
+
+ _val4 = 3;
+ _val3 = 20;
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ case 2:
+ player_set_commands_allowed(false);
+
+ if (_flag1) {
+ digi_stop(2);
+ _val2 = 17;
+ kernel_trigger_dispatch_now(7);
+ }
+
+ _val4 = 2;
+ _val3 = 23;
+ kernel_trigger_dispatch_now(8);
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case gSET_COMMANDS_ALLOWED:
+ if (!_G(flags)[V181] && _G(flags)[V171] == 4003) {
+ _val5 = 38;
+ kernel_timing_trigger(60, 9);
+ } else {
+ player_set_commands_allowed(true);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Room407::pre_parser() {
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index e7862daac3f..c31e63fe413 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -58,10 +58,14 @@ private:
int _dzS1 = 0, _dzS2 = 0;
machine *_rx = nullptr;
noWalkRect *_walk1 = nullptr;
+ Common::String _digiName;
bool _flag1 = false;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _digiTrigger = 0;
void loadSeries();
void conv87();
Commit: fc5aefaa618a49dbfe814de0892bf4a248c37827
https://github.com/scummvm/scummvm/commit/fc5aefaa618a49dbfe814de0892bf4a248c37827
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 971
Changed paths:
engines/m4/burger/rooms/section9/room971.cpp
engines/m4/burger/rooms/section9/room971.h
diff --git a/engines/m4/burger/rooms/section9/room971.cpp b/engines/m4/burger/rooms/section9/room971.cpp
index b0f4a573d59..d9ba827fa6d 100644
--- a/engines/m4/burger/rooms/section9/room971.cpp
+++ b/engines/m4/burger/rooms/section9/room971.cpp
@@ -27,16 +27,483 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const seriesStreamBreak Room971::SERIES1[] = {
+ { 0, "971intro", 1, 255, -1, 0, nullptr, 0 },
+ { 79, "971ship", 2, 255, -1, 0, nullptr, 0 },
+ { 109, nullptr, 0, 0, 56, 0, nullptr, 0 },
+ { 110, "972birds", 3, 100, 1024, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES2[] = {
+ { 0, "971d001", 1, 255, -1, 0, nullptr, 0 },
+ { 0, "971tunes", 3, 100, -1, 0, nullptr, 0 },
+ { 77, "971run", 2, 160, -1, 0, nullptr, 0 },
+ { 122, "971open", 2, 200, -1, 0, nullptr, 0 },
+ { 125, "971slam", 2, 200, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES3[] = {
+ { 0, "972birds", 3, 80, -1, 1024, 0, 0 },
+ { 1, "972d001", 1, 255, -1, 0, 0, 0 },
+ { 35, "971slam", 2, 80, -1, 0, 0, 0 },
+ { 53, "972run_1", 2, 100, -1, 0, 0, 0 },
+ { 110, "972dream", 2, 150, -1, 0, 0, 0 },
+ { 129, nullptr, 0, 0, 56, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES4[] = {
+ { 0, "973ambi", 3, 80, -1, 1024, nullptr, 0 },
+ { 1, "973d001", 1, 255, -1, 0, nullptr, 0 },
+ { 1, nullptr, 0, 0, 57, 0, nullptr, 0 },
+ { 1, "973zap_1", 2, 155, -1, 0, nullptr, 0 },
+ { 14, "973zap_2", 2, 155, -1, 0, nullptr, 0 },
+ { 25, "973ducto", 2, 80, -1, 0, nullptr, 0 },
+ { 64, "973whirl", 2, 155, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES5[] = {
+ { 1, "975d001", 1, 255, -1, 0, nullptr, 0 },
+ { 36, "975zlick", 2, 155, -1, 0, nullptr, 0 },
+ { 48, "975zeat", 2, 155, -1, 0, nullptr, 0 },
+ { 56, "975zeat", 2, 155, -1, 0, nullptr, 0 },
+ { 64, "975zgulp", 2, 155, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES6[] = {
+ { 3, "976d001", 1, 255, -1, 0, nullptr, 0 },
+ { 9, "976spark", 2, 155, -1, 0, nullptr, 0 },
+ { 15, "976spark", 2, 155, -1, 0, nullptr, 0 },
+ { 29, "976clamp", 2, 100, -1, 0, nullptr, 0 },
+ { 43, "976tv", 3, 100, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES7[] = {
+ { 0, "977ambi", 3, 50, -1, 1024, nullptr, 0 },
+ { 1, "977d001", 1, 255, -1, 0, nullptr, 0 },
+ { 32, "977wahh", 2, 120, -1, 0, nullptr, 0 },
+ { 43, "977zlaff", 2, 120, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES8[] = {
+ { 1, "978d001", 1, 255, -1, 0, nullptr, 0 },
+ { 11, "978lick", 2, 200, -1, 0, nullptr, 0 },
+ { 19, "978eat", 2, 200, -1, 0, nullptr, 0 },
+ { 31, "978gulp", 2, 200, -1, 0, nullptr, 0 },
+ { 54, "978lick", 2, 200, -1, 0, nullptr, 0 },
+ { 64, "978eat", 2, 200, -1, 0, nullptr, 0 },
+ { 76, "978gulp", 2, 200, -1, 0, nullptr, 0 },
+ { 82, nullptr, 3, 0, -1, 2048, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES9[] = {
+ { 0, "972birds", 3, 70, -1, 1024, nullptr, 0 },
+ { 1, "972d002", 1, 255, -1, 0, nullptr, 0 },
+ { 3, "972run_2", 2, 80, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES10[] = {
+ { 0, "980ambi", 3, 150, -1, 1024, nullptr, 0 },
+ { 10, "980d001", 1, 255, -1, 0, nullptr, 0 },
+ { 46, "980smash", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES11[] = {
+ { 0, "981ambi", 3, 70, -1, 0, nullptr, 0 },
+ { 2, "981cut", 2, 150, -1, 0, nullptr, 0 },
+ { 12, "981cut", 2, 150, -1, 0, nullptr, 0 },
+ { 26, "981cut", 2, 150, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES12[] = {
+ { 1, "982p001", 1, 255, -1, 0, nullptr, 0 },
+ { 23, "982gun", 2, 255, -1, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES13[] = {
+ { 0, "984ambi", 3, 60, -1, 1024, 0, 0 },
+ { 10, "984d001", 1, 255, -1, 0, 0, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES14[] = {
+ { 36, "985w001", 2, 225, -1, 0, nullptr, 0 },
+ { 48, "985a001", 1, 225, -1, 0, nullptr, 0 },
+ { 68, nullptr, 3, 0, -1, 2048, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES15[] = {
+ { 0, "972birds", 3, 70, -1, 1024, nullptr, 0 },
+ { 0, "972d003", 1, 255, -1, 0, nullptr, 0 },
+ { 84, "972d004", 1, 255, -1, 0, nullptr, 0 },
+ { 149, "972w001", 2, 255, -1, 0, nullptr, 0 },
+ { 219, "972ducto", 1, 155, -1, 0, nullptr, 0 },
+ { 232, "972w002", 2, 255, -1, 0, nullptr, 0 },
+ { 255, "972d005", 1, 255, -1, 0, nullptr, 0 },
+ { 325, "972glug", 2, 155, -1, 0, nullptr, 0 },
+ { 335, nullptr, 0, 0, 46, 0, nullptr, 0 },
+ { 338, nullptr, 0, 0, 56, 0, nullptr, 0 },
+ STREAM_BREAK_END
+};
+
+const seriesStreamBreak Room971::SERIES16[] = {
+ STREAM_BREAK_END
+};
+
void Room971::preload() {
+ palette_prep_for_stream();
_G(player).walker_in_this_scene = false;
}
void Room971::init() {
-
+ palette_prep_for_stream();
+ _G(kernel).suppress_fadeup = true;
+ pal_fade_set_start(0);
+ kernel_timing_trigger(1, 1);
}
void Room971::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ palette_prep_for_stream();
+ digi_stop(1);
+ digi_stop(2);
+ digi_stop(3);
+ digi_unload("971outro");
+ digi_unload_stream_breaks(SERIES16);
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+ digi_preload_stream_breaks(SERIES5);
+
+ series_stream_with_breaks(SERIES1, "971title", 6, 1, 2);
+ pal_fade_init(0, 255, 100, 60, -1);
+ break;
+
+ case 2:
+ palette_prep_for_stream();
+ release_trigger_on_digi_state(3, 3);
+ break;
+
+ case 3:
+ digi_unload("971intro");
+ digi_unload("971ship");
+ palette_prep_for_stream();
+ series_stream_with_breaks(SERIES2, "971a", 6, 1, 4);
+ pal_fade_init(0, 255, 100, 60, -1);
+ break;
+
+ case 4:
+ palette_prep_for_stream();
+ kernel_timing_trigger(5, 6);
+ break;
+
+ case 5:
+ release_trigger_on_digi_state(6, 1);
+ break;
+
+ case 6:
+ series_stream_with_breaks(SERIES3, "972a", 6, 1, 7);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 7:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 8);
+ break;
+
+ case 8:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(9, 1);
+ break;
+
+ case 9:
+ series_stream_with_breaks(SERIES4, "973a", 6, 1, 10);
+ pal_fade_init(0, 255, 100, 120, -1);
+ break;
+
+ case 10:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 11);
+ break;
+
+ case 11:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(12, 1);
+ break;
+
+ case 12:
+ series_stream_with_breaks(SERIES5, "975a", 6, 1, 13);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 13:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 14);
+ break;
+
+ case 14:
+ digi_unload_stream_breaks(SERIES2);
+ digi_unload_stream_breaks(SERIES3);
+ digi_unload_stream_breaks(SERIES4);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES6);
+ release_trigger_on_digi_state(15, 1);
+ break;
+
+ case 15:
+ series_stream_with_breaks(SERIES6, "976a", 6, 1, 16);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 16:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 17);
+ break;
+
+ case 17:
+ digi_unload_stream_breaks(SERIES5);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES7);
+ release_trigger_on_digi_state(18, 1);
+ break;
+
+ case 18:
+ series_stream_with_breaks(SERIES7, "977a", 6, 1, 19);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 19:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 20);
+ break;
+
+ case 20:
+ digi_unload_stream_breaks(SERIES6);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES8);
+ release_trigger_on_digi_state(21, 1);
+ break;
+
+ case 21:
+ series_stream_with_breaks(SERIES8, "978a", 6, 1, 22);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 22:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 23);
+ break;
+
+ case 23:
+ digi_unload_stream_breaks(SERIES7);
+ compact_mem_and_report();
+ release_trigger_on_digi_state(24, 1);
+ break;
+
+ case 24:
+ series_stream_with_breaks(SERIES9, "972b", 6, 1, 25);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 25:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 26);
+ break;
+
+ case 26:
+ digi_unload_stream_breaks(SERIES8);
+ digi_unload_stream_breaks(SERIES9);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES10);
+ digi_preload_stream_breaks(SERIES11);
+ digi_preload_stream_breaks(SERIES12);
+ release_trigger_on_digi_state(30, 1);
+ break;
+
+ case 30:
+ series_stream_with_breaks(SERIES10, "980a", 6, 1, 31);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 31:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 32);
+ break;
+
+ case 32:
+ compact_mem_and_report();
+ kernel_trigger_dispatch_now(33);
+ break;
+
+ case 33:
+ series_stream_with_breaks(SERIES11, "981a", 6, 1, 34);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 34:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 35);
+ break;
+
+ case 35:
+ compact_mem_and_report();
+ release_trigger_on_digi_state(36, 1);
+ break;
+
+ case 36:
+ series_stream_with_breaks(SERIES12, "982a", 6, 1, 37);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 37:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 38);
+ break;
+
+ case 38:
+ digi_unload_stream_breaks(SERIES10);
+ digi_unload_stream_breaks(SERIES11);
+ digi_unload_stream_breaks(SERIES12);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES13);
+ digi_preload_stream_breaks(SERIES14);
+ release_trigger_on_digi_state(39, 1);
+ break;
+
+ case 39:
+ series_stream_with_breaks(SERIES13, "984a", 6, 1, 40);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 40:
+ palette_prep_for_stream();
+ kernel_trigger_dispatch_now(42);
+ break;
+
+ case 42:
+ // The Ultimate answer to Life, The Universe, and Everything
+ series_stream_with_breaks(SERIES14, "985a", 6, 1, 43);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 43:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 44);
+ break;
+
+ case 44:
+ digi_unload_stream_breaks(SERIES13);
+ digi_unload_stream_breaks(SERIES14);
+ compact_mem_and_report();
+ digi_preload_stream_breaks(SERIES15);
+ digi_preload("971outro");
+ release_trigger_on_digi_state(45, 1);
+ break;
+
+ case 45:
+ series_stream_with_breaks(SERIES15, "972c", 6, 1, 47);
+ pal_fade_init(0, 255, 100, 15, -1);
+ break;
+
+ case 46:
+ digi_play("971outro", 3, 200, 53);
+ break;
+
+ case 47:
+ palette_prep_for_stream();
+ kernel_timing_trigger(6, 48);
+ break;
+
+ case 48:
+ digi_unload_stream_breaks(SERIES15);
+ compact_mem_and_report();
+ release_trigger_on_digi_state(49, 1);
+ break;
+
+ case 49:
+ palette_prep_for_stream();
+ _comeSoonS = series_load("comesoon", -1, _G(master_palette));
+ _comeSoon = series_show("comesoon", 0);
+ pal_fade_init(0, 255, 100, 120, 50);
+ break;
+
+ case 50:
+ kernel_timing_trigger(480, 51);
+ digi_preload_stream_breaks(SERIES1);
+ digi_preload_stream_breaks(SERIES2);
+ digi_preload_stream_breaks(SERIES3);
+ digi_preload_stream_breaks(SERIES4);
+ digi_preload_stream_breaks(SERIES5);
+ break;
+
+ case 51:
+ pal_fade_init(0, 255, 0, 120, 52);
+ break;
+
+ case 52:
+ terminateMachineAndNull(_comeSoon);
+ series_unload(_comeSoonS);
+ digi_preload_stream_breaks(SERIES16);
+ series_stream_with_breaks(SERIES16, "swmclogo", 6, 1, -1);
+ pal_fade_init(0, 255, 100, 60, -1);
+ break;
+
+ case 53:
+ pal_fade_init(0, 255, 0, 120, 58);
+ break;
+
+ case 54:
+ pal_fade_init(0, 255, 0, 30, -1);
+ break;
+
+ case 55:
+ pal_fade_init(0, 255, 100, 30, -1);
+ break;
+
+ case 56:
+ pal_fade_init(0, 255, 0, 60, -1);
+ break;
+
+ case 57:
+ pal_fade_init(0, 255, 100, 60, -1);
+ break;
+
+ case 58:
+ switch (_G(executing)) {
+ case JUST_OVERVIEW:
+ kernel_trigger_dispatch_now(1);
+ break;
+
+ case INTERACTIVE_DEMO:
+ _G(game).new_room = 901;
+ player_set_commands_allowed(false);
+ break;
+
+ case WHOLE_GAME:
+ _G(game).new_room = 903;
+ player_set_commands_allowed(false);
+ break;
+ }
+ break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section9/room971.h b/engines/m4/burger/rooms/section9/room971.h
index a16b9f852fd..000b95b8e4e 100644
--- a/engines/m4/burger/rooms/section9/room971.h
+++ b/engines/m4/burger/rooms/section9/room971.h
@@ -29,6 +29,26 @@ namespace Burger {
namespace Rooms {
class Room971 : public Rooms::Room {
+private:
+ static const seriesStreamBreak SERIES1[];
+ static const seriesStreamBreak SERIES2[];
+ static const seriesStreamBreak SERIES3[];
+ static const seriesStreamBreak SERIES4[];
+ static const seriesStreamBreak SERIES5[];
+ static const seriesStreamBreak SERIES6[];
+ static const seriesStreamBreak SERIES7[];
+ static const seriesStreamBreak SERIES8[];
+ static const seriesStreamBreak SERIES9[];
+ static const seriesStreamBreak SERIES10[];
+ static const seriesStreamBreak SERIES11[];
+ static const seriesStreamBreak SERIES12[];
+ static const seriesStreamBreak SERIES13[];
+ static const seriesStreamBreak SERIES14[];
+ static const seriesStreamBreak SERIES15[];
+ static const seriesStreamBreak SERIES16[];
+ int32 _comeSoonS = 0;
+ machine *_comeSoon = nullptr;
+
public:
Room971() : Rooms::Room() {}
~Room971() override {}
Commit: 9895b55fcbae74d435e62fa3c2343849565dbffe
https://github.com/scummvm/scummvm/commit/9895b55fcbae74d435e62fa3c2343849565dbffe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add missing line from room 801 daemon
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index b9388818dc8..88851c75d5a 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -398,6 +398,7 @@ void Room801::daemon() {
freeSeries1();
digi_unload_stream_breaks(SERIES7);
+ digi_unload("804_005");
kernel_trigger_dispatch_now(20);
break;
Commit: fc1e0e7d83b6874a6719001c5ad1154276295ac6
https://github.com/scummvm/scummvm/commit/fc1e0e7d83b6874a6719001c5ad1154276295ac6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 4 class methods
Changed paths:
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section4/section4.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 5d325f9d4b7..45f1794b8a0 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -119,7 +119,15 @@ const char *Section4::PARSER[] = {
"Th-th-th-that's all folks...",
nullptr
};
-
+
+const Section4::TeleportEntry Section4::TELEPORTS[] = {
+ { 402, 407, 406 },
+ { 405, 407, 406 },
+ { 406, 402, 405 },
+ { 407, 402, 405 },
+ { 0, 0, 0 }
+};
+
Section4::Section4() : Rooms::Section() {
add(401, &_room401);
@@ -130,9 +138,67 @@ Section4::Section4() : Rooms::Section() {
add(407, &_room407);
}
+void Section4::init() {
+ if (_G(executing) != WHOLE_GAME) {
+ inv_give_to_player("JAWZ O' LIFE");
+ inv_give_to_player("DEED");
+ }
+}
+
void Section4::daemon() {
- // TODO
- _G(kernel).continue_handling_trigger = true;
+ switch (_G(kernel).trigger) {
+ case 4001:
+ _G(game).new_room = 401;
+ break;
+
+ case 4002:
+ _G(game).new_room = 402;
+ break;
+
+ case 4003:
+ _G(game).new_room = 404;
+ break;
+
+ case 4004:
+ _G(game).new_room = 405;
+ break;
+
+ case 4005:
+ _G(game).new_room = 406;
+ break;
+
+ case 4006:
+ _G(game).new_room = 407;
+ break;
+
+ case 4007:
+ term_message("Teleporting...");
+ term_message(teleport() ? "...scuccessful" : "ERROR while teleporting!");
+ break;
+
+ case 4008:
+ player_set_commands_allowed(!checkOrderWindow());
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ if (_G(wilbur_should) == 10015) {
+ kernel_trigger_dispatch_now(10027);
+ } else {
+ _G(kernel).continue_handling_trigger = true;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+}
+
+void Section4::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_parser(PARSER))
+ _G(player).command_ready = false;
}
void Section4::poof(int trigger) {
@@ -168,6 +234,28 @@ bool Section4::checkOrderWindow() {
}
}
+bool Section4::teleport() {
+ const TeleportEntry *te;
+ for (te = TELEPORTS; te->_room && te->_room != _G(game).room_id; ++te) {
+ }
+
+ if (te->_room) {
+ if (player_said("DISC")) {
+ _G(game).new_room = te->_newRoom1;
+ term_message("...%d...", te->_newRoom1);
+ return true;
+ } else if (player_said("DISC ")) {
+ _G(game).new_room = te->_newRoom2;
+ term_message("...%d...", te->_newRoom2);
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section4/section4.h b/engines/m4/burger/rooms/section4/section4.h
index b2169b6494c..79349bcde0d 100644
--- a/engines/m4/burger/rooms/section4/section4.h
+++ b/engines/m4/burger/rooms/section4/section4.h
@@ -36,8 +36,14 @@ namespace Burger {
namespace Rooms {
class Section4 : public Rooms::Section {
+ struct TeleportEntry {
+ int _room;
+ int _newRoom1;
+ int _newRoom2;
+ };
private:
static const char *PARSER[];
+ static const TeleportEntry TELEPORTS[];
private:
Room401 _room401;
@@ -47,6 +53,8 @@ private:
Room406 _room406;
Room407 _room407;
+ bool teleport();
+
public:
static void poof(int trigger);
static bool checkOrderWindow();
@@ -55,7 +63,9 @@ public:
Section4();
virtual ~Section4() {}
+ void init() override;
void daemon() override;
+ void parser() override;
};
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 8be461e5ebe..52fd04c2cb2 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -334,6 +334,13 @@ Section5::Section5() : Rooms::Section() {
add(513, &_room513);
}
+void Section5::init() {
+ if (_G(executing) != WHOLE_GAME) {
+ inv_give_to_player("AMPLIFIER");
+ inv_give_to_player("BOTTLE");
+ }
+}
+
void Section5::daemon() {
// TODO: daemon method
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 5f650e1b33b..0d390ad2098 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -75,6 +75,7 @@ public:
Section5();
virtual ~Section5() {}
+ void init() override;
void daemon() override;
void parser() override;
};
Commit: 721c33b24dd14dadc6d1de5c9a3175b122825ee5
https://github.com/scummvm/scummvm/commit/721c33b24dd14dadc6d1de5c9a3175b122825ee5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added skeletons for two missing section 1 rooms
Changed paths:
A engines/m4/burger/rooms/section1/room143.cpp
A engines/m4/burger/rooms/section1/room143.h
A engines/m4/burger/rooms/section1/room145.cpp
A engines/m4/burger/rooms/section1/room145.h
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
new file mode 100644
index 00000000000..53f98818ec4
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room143.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/burger.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room143::init() {
+
+}
+
+void Room143::daemon() {
+
+}
+
+void Room143::pre_parser() {
+
+}
+
+void Room143::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
new file mode 100644
index 00000000000..c22da53030a
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM143_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM143_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room143 : public Room {
+public:
+ Room143() : Room() {}
+ ~Room143() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
new file mode 100644
index 00000000000..ddf1748ab05
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/burger/rooms/section1/room145.h"
+#include "m4/burger/rooms/section1/section1.h"
+#include "m4/burger/burger.h"
+#include "m4/burger/vars.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+void Room145::init() {
+
+}
+
+void Room145::daemon() {
+
+}
+
+void Room145::pre_parser() {
+
+}
+
+void Room145::parser() {
+
+}
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
new file mode 100644
index 00000000000..ec20669a572
--- /dev/null
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_BURGER_ROOMS_SECTION1_ROOM145_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM145_H
+
+#include "m4/burger/rooms/room.h"
+
+namespace M4 {
+namespace Burger {
+namespace Rooms {
+
+class Room145 : public Room {
+public:
+ Room145() : Room() {}
+ ~Room145() override {}
+
+ void init() override;
+ void daemon() override;
+ void pre_parser() override;
+ void parser() override;
+};
+
+} // namespace Rooms
+} // namespace Burger
+} // namespace M4
+
+#endif
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 3b6291ada24..3a09e4d24c0 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -45,6 +45,8 @@ Section1::Section1() : Rooms::Section() {
add(139, &_room139_144);
add(141, &_room141);
add(142, &_room142);
+ add(143, &_room143);
+ add(145, &_room145);
add(144, &_room139_144);
add(170, &_room170);
add(171, &_room171);
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 594d756fdd3..2a051e59438 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -38,6 +38,8 @@
#include "m4/burger/rooms/section1/room139_144.h"
#include "m4/burger/rooms/section1/room141.h"
#include "m4/burger/rooms/section1/room142.h"
+#include "m4/burger/rooms/section1/room143.h"
+#include "m4/burger/rooms/section1/room145.h"
#include "m4/burger/rooms/section1/room170.h"
#include "m4/burger/rooms/section1/room171.h"
#include "m4/burger/rooms/section1/room172.h"
@@ -68,9 +70,11 @@ private:
Room135 _room135;
Room137 _room137;
Room138 _room138;
+ Room139_144 _room139_144;
Room141 _room141;
Room142 _room142;
- Room139_144 _room139_144;
+ Room143 _room143;
+ Room145 _room145;
Room170 _room170;
Room171 _room171;
Room172 _room172;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 01ed2f65141..8329e56619d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -104,6 +104,8 @@ MODULE_OBJS = \
burger/rooms/section1/room139_144.o \
burger/rooms/section1/room141.o \
burger/rooms/section1/room142.o \
+ burger/rooms/section1/room143.o \
+ burger/rooms/section1/room145.o \
burger/rooms/section1/room170.o \
burger/rooms/section1/room171.o \
burger/rooms/section1/room172.o \
Commit: fe12011c89decceeaad54d12553de62495efcbc7
https://github.com/scummvm/scummvm/commit/fe12011c89decceeaad54d12553de62495efcbc7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added static arrays for newly added rooms
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room143.h
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 53f98818ec4..71d77944ed5 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -28,6 +28,111 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room143::SAID[][4] = {
+ { "VERA", "143W001", "999w011", "999w011" },
+ { "BURL", nullptr, "999w011", "999w011" },
+ { "SWINGING DOOR", "143w006", "999w011", nullptr },
+ { "ORDER WINDOW", "143w006", "999w011", "999w011" },
+ { "JUKEBOX", "143w008", nullptr, nullptr },
+ { "OUTSIDE", nullptr, "999w011", nullptr },
+ { "MUFFIN", "143w009", nullptr, nullptr },
+ { "FOUNTAIN", "143W010", nullptr, nullptr },
+ { "MOOSEHEAD", "143W011", nullptr, nullptr },
+ { "MENU", "143W012", nullptr, nullptr },
+ { "MOUSE TRAP", "143W013", nullptr, "999w011" },
+ { "STOOL", nullptr, nullptr, "143W017" },
+ { "BOOTH", nullptr, nullptr, "143W017" },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const seriesPlayBreak Room143::PLAY1[] = {
+ { 0, 20, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 21, 21, "405_003", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 22, 28, "405w015", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 29, -1, "143_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY2[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, -1, nullptr, 0, 255, 12, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY3[] = {
+ { 0, 76, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 77, -1, nullptr, 2, 0, 3, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY4[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY5[] = {
+ { 0, 3, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY6[] = {
+ { 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 3, 14, "143_006", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 15, 25, "143_005", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 26, 29, "143_007", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 30, 30, nullptr, 0, 0, 40, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY7[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY8[] = {
+ { 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 24, -1, nullptr, 0, 0, 8, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY9[] = {
+ { 0, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 26, -1, "143_004", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY10[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, 32, 0, 0, nullptr, 0 },
+ { 7, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 13, 16, "143b007", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 17, 21, "143b009", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 22, 23, nullptr, 1, 255, -1, 2048, 0, nullptr, 0 },
+ { 24, -1, "143b010", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room143::PLAY11[] = {
+ { 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 0, 0, nullptr, 0, 0, 36, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+
void Room143::init() {
}
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
index c22da53030a..5fab99d5d06 100644
--- a/engines/m4/burger/rooms/section1/room143.h
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -29,6 +29,29 @@ namespace Burger {
namespace Rooms {
class Room143 : public Room {
+private:
+ static const char *SAID[][4];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ machine *_plate = nullptr;
+ machine *_mouseTrap = nullptr;
+ noWalkRect *_walk1 = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+ int _val5 = 0;
+ int _val6 = 0;
+
public:
Room143() : Room() {}
~Room143() override {}
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index ddf1748ab05..6fef1d088bc 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -28,6 +28,185 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+const char *Room145::SAID[][4] = {
+ { "TOUR BUS", "145w001", "145w002", "145w003" },
+ { "INSTRUMENTS", "145w005", "145w006", "145w006" },
+ { "AMPLIFIER ", "145w009", nullptr, "145w012" },
+ { "VIPE", "145w013", "145w004", "145w004" },
+ { "ROXY", "145w016", "145w004", "145w004" },
+ { "DRUMZ", "145w019", "145w004", "145w004" },
+ { "MAP", "145w022", "145w002", "145w023" },
+ { "VERA'S DINER", "145w024", "145w004", "145w004" },
+ { "VERA'S DINER ", "145w024", "145w004", nullptr },
+ { nullptr, nullptr, nullptr, nullptr }
+};
+
+const WilburMatch Room145::MATCH[] = {
+ { nullptr, "TOUR BUS", 1, 0, 0, &_state1, 12 },
+ { "TALK", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 11 },
+ { "AMPLIFIER", "ROXY", 1, 0, 0, &_state1, 15 },
+ { nullptr, "ROXY", 1, 0, 0, &_state1, 17 },
+ { "TALK" , "DRUMZ", 10, 0, 0, 0, 0 },
+ { "LAXATIVE" , "DRUMZ", 10016, 0, 0, &Vars::_wilbur_should, 3 },
+ { nullptr, "DRUMZ", 1, 0, 0, &_state1, 16 },
+ { "TALK" , "VIPE", 10016, 0, 0, &Vars::_wilbur_should, 10 },
+ { "AMPLIFIER", "VIPE", 1, 0, 0, &_state1, 15 },
+ { nullptr, "VIPE", 1, 0, 0, &_state1, 16 },
+ { "AMPLIFIER" , "INSTRUMENTS", 1, 0, 0, &_state1, 13 },
+ { nullptr, "INSTRUMENTS", 1, 0, 0, &_state1, 14 },
+ { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[V067], 0, &Vars::_wilbur_should, 1 },
+ { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[V067], 1, &Vars::_wilbur_should, 8 },
+ { nullptr, "AMPLIFIER ", 1, 0, 0, &_state1, 14 },
+ { nullptr, "MAP", 1, 0, 0, &_state1, 18 },
+ WILBUR_MATCH_END
+};
+
+const seriesPlayBreak Room145::PLAY1[] = {
+ { 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 6, nullptr, 0, 0, -1, 0, 6, nullptr, 0 },
+ { 6, 6, "145w010", 1, 255, -1, 0, -1, nullptr, 0 },
+ { 0, 6, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY2[] = {
+ { 0, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 24, -1, "145w011", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY3[] = {
+ { 15, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY4[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 5, 9, "145w021", 1, 255, -1, 4, -1, nullptr, 0 },
+ { 4, 4, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 0, 3, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY5[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY6[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY7[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, -1, nullptr, 0, 0, -1, 0, 4, nullptr, 0 },
+ { 0, 1, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY8[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY9[] = {
+ { 0, -1, "145_004", 2, 125, -1, 1, 0, &_state2, 0 },
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, &_state2, 1 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY10[] = {
+ { 0, -1, nullptr, 0, 0, -1, 3, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY11[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY12[] = {
+ { 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 2, 4, nullptr, 0, 0, -1, 1, 2, nullptr, 0 },
+ { 5, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY13[] = {
+ { 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 6, 16, nullptr, 0, 0, 10016, 0, 0, nullptr, 0 },
+ { 17, 20, "145_002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 21, 25, "145_005", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY14[] = {
+ { 26, -1, "145_001", 1, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY15[] = {
+ { 0, 3, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY16[] = {
+ { 0, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY17[] = {
+ { 1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY18[] = {
+ { 0, -1, "145r901", 2, 125, -1, 4, -1, &_state3, 1 },
+ { 0, -1, "145r902", 2, 125, -1, 4, -1, &_state3, 2 },
+ { 0, -1, "145r903", 2, 125, -1, 4, -1, &_state3, 3 },
+ { 0, -1, "145r904", 2, 125, -1, 4, -1, &_state3, 4 },
+ { 0, -1, "145r905", 2, 125, -1, 4, -1, &_state3, 5 },
+ { 0, -1, "145r906", 2, 125, -1, 4, -1, &_state3, 6 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY19[] = {
+ { 1, -1, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY20[] = {
+ { 1, -1, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY21[] = {
+ { 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY22[] = {
+ { 0, -1, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+const seriesPlayBreak Room145::PLAY23[] = {
+ { 0, -1, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
+ PLAY_BREAK_END
+};
+
+long Room145::_state1;
+long Room145::_state2;
+long Room145::_state3;
+
+Room145::Room145() : Room() {
+ _state1 = 0;
+ _state2 = 0;
+ _state3 = 0;
+}
+
void Room145::init() {
}
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index ec20669a572..70e8aae99c7 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -23,14 +23,46 @@
#define M4_BURGER_ROOMS_SECTION1_ROOM145_H
#include "m4/burger/rooms/room.h"
+#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room145 : public Room {
+private:
+ static const char *SAID[][4];
+ static const WilburMatch MATCH[];
+ static const seriesPlayBreak PLAY1[];
+ static const seriesPlayBreak PLAY2[];
+ static const seriesPlayBreak PLAY3[];
+ static const seriesPlayBreak PLAY4[];
+ static const seriesPlayBreak PLAY5[];
+ static const seriesPlayBreak PLAY6[];
+ static const seriesPlayBreak PLAY7[];
+ static const seriesPlayBreak PLAY8[];
+ static const seriesPlayBreak PLAY9[];
+ static const seriesPlayBreak PLAY10[];
+ static const seriesPlayBreak PLAY11[];
+ static const seriesPlayBreak PLAY12[];
+ static const seriesPlayBreak PLAY13[];
+ static const seriesPlayBreak PLAY14[];
+ static const seriesPlayBreak PLAY15[];
+ static const seriesPlayBreak PLAY16[];
+ static const seriesPlayBreak PLAY17[];
+ static const seriesPlayBreak PLAY18[];
+ static const seriesPlayBreak PLAY19[];
+ static const seriesPlayBreak PLAY20[];
+ static const seriesPlayBreak PLAY21[];
+ static const seriesPlayBreak PLAY22[];
+ static const seriesPlayBreak PLAY23[];
+
+ static long _state1;
+ static long _state2;
+ static long _state3;
+
public:
- Room145() : Room() {}
+ Room145();
~Room145() override {}
void init() override;
Commit: 1a9dfe846b00dcb6ddc730d21d3f336cb2e19a80
https://github.com/scummvm/scummvm/commit/1a9dfe846b00dcb6ddc730d21d3f336cb2e19a80
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 143 methods
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room143.h
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 71d77944ed5..a67bc79fe6b 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -134,19 +134,419 @@ const seriesPlayBreak Room143::PLAY11[] = {
void Room143::init() {
+ _frame = 0;
+ _flag1 = false;
+ digi_preload("143_001");
+ _G(kernel).call_daemon_every_loop = true;
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 142:
+ player_set_commands_allowed(false);
+ ws_demand_location(148, 247, 3);
+ ws_walk(249, 252, 0, 13, 4);
+ break;
+
+ default:
+ ws_demand_location(290, 300, 5);
+ break;
+ }
+
+ _plate = series_play("143plate", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+
+ if (_G(flags)[V000] == 1003 && _G(flags)[V063])
+ digi_preload("143_002");
+
+ _val1 = 8;
+ _val2 = 8;
+ kernel_trigger_dispatch_now(44);
+ _val3 = 0;
+ _val4 = 6;
+ kernel_trigger_dispatch_now(43);
+
+ if (_G(flags)[V064] == 1)
+ loadCheese();
+ else
+ hotspot_set_active("cheese", false);
+
+ if (_G(flags)[V000] == 1003) {
+ if (_G(flags)[V063]) {
+ _val5 = _val6 = 42;
+ } else {
+ _val5 = _val6 = 31;
+ }
+
+ kernel_trigger_dispatch_now(45);
+ } else {
+ hotspot_set_active("burl", false);
+ }
+
+ if (inv_object_in_scene("BROKEN MOUSE TRAP", 143)) {
+ _walk1 = intr_add_no_walk_rect(298, 310, 348, 343, 285, 314);
+ _mouseTrap = series_play("143mtrap", 0xf00, 0, -1, 600, -1, 100, 25, 0, 0, 0);
+ } else {
+ hotspot_set_active("MOUSE TRAP", false);
+ }
+
+ if (_G(flags)[V000] == 1004) {
+ loadMoney();
+ series_play("143money", 0xf02, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ } else {
+ hotspot_set_active("money ", false);
+ }
+
+ digi_play_loop("143_001", 3, 255, -1);
}
void Room143::daemon() {
-
+ // TODO
}
void Room143::pre_parser() {
-
+ if (player_said("outside") && player_said_any("exit", "gear", "look", "look at"))
+ player_hotspot_walk_override_just_face(9, 0);
}
void Room143::parser() {
+ bool lookFlag = player_said_any("look", "look at");
+ bool money = player_said("money ");
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("conv35")) {
+ conv35();
+ } else if (player_said("conv30")) {
+ conv30();
+ } else if (money && lookFlag) {
+ wilbur_speech("143w030");
+ } else if (money && player_said_any("take", "gear")) {
+ wilbur_speech("143w031");
+ } else if (money && player_said("take")) {
+ wilbur_speech("143w030");
+ } else if (player_said("take", "mouse trap")) {
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("talk to", "vera")) {
+ talkToVera();
+ } else if (player_said("talk to", "burl")) {
+ if (player_commands_allowed() || INTERFACE_VISIBLE) {
+ talkToBurl();
+
+ if (_val5 != 42 && _val5 != 43) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(60, 19);
+ }
+ }
+ } else if (player_said("outside") && (lookFlag || player_said_any("exit", "gear"))) {
+ player_set_commands_allowed(false);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1014);
+ } else if (player_said("laxative", "burl")) {
+ kernel_trigger_dispatch_now(28);
+ } else if (player_said("burl") && inv_player_has(_G(player).verb)) {
+ kernel_trigger_dispatch_now(24);
+ } else if (player_said("vera") && inv_player_has(_G(player).verb)) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val1 = 22;
+ _digiName = "143v511";
+ _val7 = 1;
+ _val8 = 1;
+ break;
+
+ case 1:
+ player_set_commands_allowed(false);
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("burl") && inv_player_has(_G(player).verb)) {
+ // This seems a duplicate of a prior check
+ wilbur_speech("143w005");
+ } else if (player_said("swinging door") && player_said_any("enter", "gear")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val1 = 11;
+ _digiName = "143v504";
+ _val7 = 1;
+ _val8 = 1;
+ break;
+
+ case 1:
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ digi_play("143e502", 1, 255, 1);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("quarter", "jukebox") || player_said("gear", "jukebox")) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val1 = 22;
+ _digiName = "143v510";
+ _val7 = 1;
+ _val8 = 1;
+ _G(flags)[V062] = 1;
+ break;
+
+ case 1:
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ break;
+ }
+ } else if (player_said("muffin") &&
+ (player_said_any("take", "gear") || inv_player_has(_G(player).verb))) {
+ switch (_G(kernel).trigger) {
+ case -1:
+ player_set_commands_allowed(false);
+ _val1 = 26;
+ _digiName = "143v502";
+ _val7 = 1;
+ _val8 = 1;
+ _val4 = 21;
+ kernel_trigger_dispatch_now(43);
+ break;
+
+ case 1:
+ _val1 = 13;
+ kernel_trigger_dispatch_now(44);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play("143e501", 1, 255, 2);
+ break;
+
+ case 2:
+ _val1 = 14;
+ _digiName = "143V503";
+ _val7 = 1;
+ _val8 = 3;
+ break;
+
+ case 3:
+ player_set_commands_allowed(true);
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ break;
+
+ default:
+ break;
+ }
+ } else if (lookFlag && player_said("burl")) {
+ if (_val5 == 42 || _val5 == 43 || _val5 == 44)
+ wilbur_speech("143w004");
+ else
+ wilbur_speech("143w003");
+ } if (!_G(walker).wilbur_said(SAID)) {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room143::conv35() {
+ _G(kernel).trigger_mode = KT_PARSE;
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ switch (_G(kernel).trigger) {
+ case 9:
+ if (who <= 0) {
+ if ((node == 9 && entry == 1) || (node == 5 && entry == 1) ||
+ (node == 17 && entry == 0) || (node == 19 && entry == 0)) {
+ terminateMachineAndNull(_eu02);
+ series_play("14eu02", 0xf00, 2, -1, 4, 0, 100, 0, 0, 0, 3);
+ }
+
+ if (node == 11 && entry == 0) {
+ _val1 = 13;
+ } else if ((node == 1 && entry == 4) ||
+ (node == 4 && entry == 0) ||
+ (node == 5 && entry == 1) ||
+ (node == 7 && entry == 0) ||
+ (node == 7 && entry == 1) ||
+ (node == 9 && entry == 1) ||
+ (node == 10 && entry == 1) ||
+ (node == 11 && entry == 0) ||
+ (node == 12 && entry == 2) ||
+ (node == 13 && entry == 2) ||
+ (node == 13 && entry == 1) ||
+ (node == 15) ||
+ (node == 16 && entry == 0) ||
+ (node == 16 && entry == 2) ||
+ (node == 17 && entry == 0) ||
+ (node == 18 && entry == 0) ||
+ (node == 19 && entry == 0)) {
+ // Do nothing
+ } else {
+ _val1 = 8;
+ if (_val2 != 13) {
+ _G(kernel).trigger = KT_DAEMON;
+ kernel_trigger_dispatch_now(44);
+ }
+ }
+
+ conv_resume();
+ } else if (who == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ conv_resume();
+ }
+ break;
+
+ case 27:
+ _eu02 = series_play("143eu02", 0xf00, 0, -1, 600, -1, 100, 0, 0, 3, 3);
+ break;
+
+ default:
+ if (sound) {
+ if (who <= 0) {
+ if (node == 5 && entry == 3) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_timing_trigger(300, 21);
+ _G(kernel).trigger_mode = KT_PARSE;
+ }
+
+ if ((node == 9 && entry == 1) || (node == 5 && entry == 1) ||
+ (node == 17 && entry == 0) || (node == 19 && entry == 0)) {
+ series_play("143eu02", 0xf00, 0, 27, 4, 0, 100, 0, 0, 0, 3);
+ }
+
+ if ((node == 1 && entry == 4) ||
+ (node == 4 && entry == 0) ||
+ (node == 5 && entry == 1) ||
+ (node == 7 && entry == 0) ||
+ (node == 7 && entry == 1) ||
+ (node == 9 && entry == 1) ||
+ (node == 10 && entry == 1) ||
+ (node == 11 && entry == 0) ||
+ (node == 12 && entry == 2) ||
+ (node == 13 && entry == 1) ||
+ (node == 15) ||
+ (node = 16 && entry == 0) ||
+ (node == 16 && entry == 2) ||
+ (node == 17 && entry == 0) ||
+ (node == 18 && entry == 0) ||
+ (node == 19 && entry == 0)) {
+ digi_play(sound, 1, 255, 9);
+ } else if (node == 3) {
+ _val6 = 34;
+ _digiName = sound;
+ } else if ((node == 9 && entry == 0) || (node == 17 && entry == 1)) {
+ _val1 = 15;
+ _digiName = sound;
+ } else if (node == 5 && entry == 3) {
+ _val1 = 26;
+ _digiName = sound;
+ } else if ((node == 5 && entry == 0) ||
+ (node == 1 && entry == 7) ||
+ (node == 11 && entry == 1) ||
+ (node == 18 && entry == 1) ||
+ (node == 8) ||
+ (node == 9 && entry == 0) ||
+ (node == 10 && entry == 0)) {
+ _val1 = 14;
+ _digiName = sound;
+ } else {
+ _val1 = 11;
+ _digiName = sound;
+ }
+ } else if (who == 1) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(sound, 1, 255, 9);
+ }
+
+ _val7 = 1;
+ _val8 = 9;
+ } else {
+ conv_resume();
+ }
+ break;
+ }
+}
+
+void Room143::conv30() {
+ _G(kernel).trigger_mode = KT_PARSE;
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+
+ if (_G(kernel).trigger == 9) {
+ if (who <= 0) {
+ if (_val5 == 37 || _val5 == 31) {
+ _val6 = 37;
+ } else if (_val5 == 42 || _val5 == 43) {
+ _val6 = 43;
+ digi_change_volume(2, 255);
+ }
+
+ conv_resume();
+ } else if (who == 1) {
+ sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if (_val5 == 37 || _val5 == 31) {
+ _val6 = 36;
+ } else if (_val5 == 42 || _val5 == 43) {
+ _val6 = 44;
+ }
+
+ _digiName = sound;
+ } else if (who == 1) {
+ sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
+ digi_play(sound, 1, 255, 9);
+ }
+
+ _val7 = 1;
+ _val8 = 9;
+ } else {
+ conv_resume();
+ }
+}
+
+void Room143::talkToVera() {
+ conv_load_and_prepare("conv35", 10);
+
+ if (_G(flags)[V000] == 1003) {
+ conv_export_value_curr(1, 0);
+ } else {
+ conv_export_value_curr(0, 0);
+ }
+
+ conv_export_value_curr(_G(flags)[V062], 1);
+ conv_play_curr();
+}
+
+void Room143::talkToBurl() {
+ conv_load_and_prepare("conv30", 11, 0);
+
+ if (_val5 == 42 || _val5 == 43)
+ conv_export_value_curr(1, 0);
+ else
+ conv_export_value_curr(0, 0);
+
+ conv_export_pointer_curr(&_G(flags)[V053], 3);
+ conv_export_pointer_curr(&_G(flags)[V052], 4);
+ conv_play_curr();
+}
+
+void Room143::loadCheese() {
+ _cheese = series_play("143CHES", 0xf00, 0, -1, 600, -1, 100, 35, -5, 0, 0);
+}
+void Room143::loadMoney() {
+ Series::series_play("143pl01", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
index 5fab99d5d06..845d52ae2f4 100644
--- a/engines/m4/burger/rooms/section1/room143.h
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -42,15 +42,29 @@ private:
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
- machine *_plate = nullptr;
+ machine *_cheese = nullptr;
machine *_mouseTrap = nullptr;
+ machine *_plate = nullptr;
+ machine *_eu02 = nullptr;
noWalkRect *_walk1 = nullptr;
+ const char *_digiName = nullptr;
+ bool _flag1 = false;
+ int _frame = 0;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
+ int _val7 = 0;
+ int _val8 = 0;
+
+ void conv35();
+ void conv30();
+ void talkToVera();
+ void talkToBurl();
+ void loadCheese();
+ void loadMoney();
public:
Room143() : Room() {}
Commit: b9bc4b9e581feda7bad2a39816c53a60c036c8b1
https://github.com/scummvm/scummvm/commit/b9bc4b9e581feda7bad2a39816c53a60c036c8b1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress room 143 daemon
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room143.h
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index a67bc79fe6b..545f565f1c4 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -201,6 +201,332 @@ void Room143::init() {
}
void Room143::daemon() {
+ // TODO: Room143::daemon is in progress
+
+ if (_G(flags)[V064] == 1) {
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ player_update_info();
+
+ if (_G(player_info).y < 260) {
+ _G(flags)[V064] = 2;
+ kernel_timing_trigger(1, 5);
+ }
+ }
+ }
+
+ if (_G(flags)[V063] && !digi_play_state(2))
+ digi_play_loop("143_002", 2, 255, -1);
+
+ if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE && _flag1) {
+ player_update_info();
+
+ if (_G(player_info).y > 324)
+ ws_demand_location(_G(player_info).x, 324);
+ }
+
+ switch (_G(kernel).trigger) {
+ case 1:
+ player_set_commands_allowed(true);
+ break;
+
+ case 2:
+ ws_unhide_walker();
+ break;
+
+ case 3:
+ digi_play("143_010", 2, 255, 4);
+ break;
+
+ case 4:
+ digi_unload("143_010");
+ break;
+
+ case 5:
+ terminateMachineAndNull(_cheese);
+ hotspot_set_active("cheese", false);
+ _flag1 = true;
+ digi_preload("143_010", false);
+ series_play_with_breaks(PLAY3, "143mous", 0xf00, 6, 3, 4, 100, 35, -5);
+ break;
+
+ case 6:
+ _flag1 = false;
+ break;
+
+ case 7:
+ digi_play("143e600", 1, 255, 1);
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ break;
+
+ case 12:
+ _G(flags)[V063] = 1;
+ break;
+
+ case 13:
+ if (_G(visited_room)) {
+ if (inv_object_is_here("broken mouse trap")) {
+ wilbur_speech("143w507", 14);
+ } else {
+ _digiName = "143v508";
+ _val1 = 11;
+ _val7 = 2;
+ _val8 = 15;
+ }
+ } else {
+ wilbur_speech("143w506");
+ }
+ break;
+
+ case 14:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ _digiName = "143v509a";
+ break;
+ case 2:
+ _digiName = "143v509b";
+ break;
+ default:
+ _digiName = "143v509c";
+ break;
+ }
+ _val1 = 11;
+ _val7 = 2;
+ _val8 = 15;
+ break;
+
+ case 15:
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ player_set_commands_allowed(true);
+ break;
+
+ case 16:
+ _digiName = "143v506";
+ _val1 = 22;
+ _val7 = 2;
+ _val8 = 17;
+ break;
+
+ case 17:
+ _val1 = 13;
+ kernel_trigger_dispatch_now(44);
+ digi_play("143e503", 1, 255, 18);
+ break;
+
+ case 18:
+ _digiName = "143v507";
+ _val1 = 14;
+ _val7 = 2;
+ _val8 = 15;
+ break;
+
+ case 22:
+ _digiName = "143b001";
+ _val7 = 2;
+ _val8 = 23;
+ _val6 = 30;
+ _val5 = 29;
+ _val1 = 21;
+ kernel_trigger_dispatch_now(45);
+ break;
+
+ case 23:
+ _digiName = "143v901";
+ _val7 = 2;
+ _val8 = 24;
+ _val6 = 29;
+ _val1 = 22;
+ break;
+
+ case 25:
+ _digiName = "143v902";
+ _val7 = 2;
+ _val8 = 26;
+ _val6 = 29;
+ _val1 = 22;
+ break;
+
+ case 26:
+ _digiName = "143v903";
+ _val7 = 2;
+ _val8 = 7;
+ _val1 = 14;
+ _val6 = 31;
+ kernel_trigger_dispatch_now(44);
+ break;
+
+ case 28:
+ disable_player();
+ digi_play("143w610", 1, 255, 29);
+ series_play("143wi03", 0x100, 0, 31, 8, 0, 100, 0, 0, 0, 10);
+ break;
+
+ case 29:
+ _digiName = "143b006";
+ _val7 = 2;
+ _val8 = 30;
+ _val6 = 36;
+ break;
+
+ case 30:
+ _val6 = 39;
+ break;
+
+ case 31:
+ _wi03 = series_play("143wi03", 0x100, 0, -1, 600, -1, 100, 0, 0, 10, 10);
+ break;
+
+ case 32:
+ terminateMachineAndNull(_wi03);
+ series_play("143wi03", 0x100, 0, 33, 6, 0, 100, 0, 0, 11, -1);
+ break;
+
+ case 33:
+ ws_unhide_walker();
+ break;
+
+ case 34:
+ disable_player();
+ Series::series_play("143wi03", 0x100, 0, 35, 8, 0, 100, 0, 0, 0, 10);
+ break;
+
+ case 35:
+ _wi03 = series_play("143wi03", 0x100, 0, -1, 600, -1, 100, 0, 0, 10, 10);
+ _wi03S = series_play("143wi03s", 0x101, 0, -1, 600, -1, 100, 0, 0, 10, 10);
+ _digiName = "143b005";
+ _val7 = 2;
+ _val8 = 39;
+ _val6 = (_val5 == 42) ? 44 : 36;
+ break;
+
+ case 38:
+ enable_player();
+ break;
+
+ case 39:
+ terminateMachineAndNull(_wi03);
+ terminateMachineAndNull(_wi03S);
+ Series::series_play("143wi03", 0x100, 0, 38, 6, 0, 100, 0, 0, 11, -1);
+ _val6 = (_val5 == 42) ? 42 : 31;
+ break;
+
+ case 40:
+ _digiName = "143v904";
+ _val7 = 2;
+ _val8 = 41;
+ _val6 = 35;
+ _val1 = 11;
+ break;
+
+ case 45:
+ switch (_val5) {
+ case 31:
+ switch (_val6) {
+ case 31: {
+ int rand = imath_ranged_rand(1, 20);
+
+ if (_val3 != -1) {
+ ++_val3;
+
+ if (imath_ranged_rand(10, 20) >= _val3)
+ rand = 2;
+ else
+ _val3 = -1;
+ }
+
+ switch (rand) {
+ case 1:
+ _val5 = 47;
+ Series::series_play("143bu10", 0xa00, 0, 45);
+ break;
+
+ case 2:
+ if (_val3 == -1)
+ _val3 = 0;
+
+ Series::series_play("143bu05", 0xa00, 0, 45);
+ break;
+
+ default:
+ Series::series_play("143bu05", 0xa00, 0, 45, 20, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 2:
+ terminateMachineAndNull(_mouseTrap);
+ disable_player();
+ _G(wilbur_should) = 3;
+ series_play_with_breaks(PLAY1, "143wi02", 0xf00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 25, 0);
+ _val1 = 21;
+ break;
+
+ case 3:
+ ws_unhide_walker();
+ intr_remove_no_walk_rect(_walk1);
+ inv_move_object("BROKEN MOUSE TRAP", NOWHERE);
+ inv_give_to_player("SPRING");
+ hotspot_set_active("MOUSE TRAP", false);
+
+ _val1 = 22;
+ _digiName = "143v501";
+ _val7 = 2;
+ _G(wilbur_should) = 5;
+ _val8 = gCHANGE_WILBUR_ANIMATION;
+ _G(flags)[V064] = 1;
+ loadCheese();
+ hotspot_set_active("cheese", true);
+ break;
+
+ case 5:
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ player_set_commands_allowed(true);
+ break;
+
+ case 10017:
+ _G(kernel).continue_handling_trigger = true;
+ if (_G(flags)[V064] == 1)
+ _G(flags)[V064] = 2;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ case 10029:
+ if (_G(flags)[V000] == 1002) {
+ _G(kernel).continue_handling_trigger = true;
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ _val1 = 20;
+ player_set_commands_allowed(false);
+ intr_freshen_sentence();
+ Section1::walk();
+ } else {
+ kernel_timing_trigger(60, 10029);
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
// TODO
}
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
index 845d52ae2f4..a739007d649 100644
--- a/engines/m4/burger/rooms/section1/room143.h
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -46,6 +46,8 @@ private:
machine *_mouseTrap = nullptr;
machine *_plate = nullptr;
machine *_eu02 = nullptr;
+ machine *_wi03 = nullptr;
+ machine *_wi03S = nullptr;
noWalkRect *_walk1 = nullptr;
const char *_digiName = nullptr;
bool _flag1 = false;
Commit: 024915a8376af9fe5d9a12c09cdfedca623ccc91
https://github.com/scummvm/scummvm/commit/024915a8376af9fe5d9a12c09cdfedca623ccc91
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remainder of room 143 daemon
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room143.h
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 545f565f1c4..61d1f328ac8 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -201,7 +201,7 @@ void Room143::init() {
}
void Room143::daemon() {
- // TODO: Room143::daemon is in progress
+ int frame;
if (_G(flags)[V064] == 1) {
if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
@@ -259,6 +259,20 @@ void Room143::daemon() {
kernel_trigger_dispatch_now(44);
break;
+ case 8:
+ hotspot_set_active("money ", true);
+ series_play("143money", 0xf02, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ break;
+
+ case 10:
+ player_set_commands_allowed(true);
+ break;
+
+ case 11:
+ _val6 = (_val5 == 42) ? 42 : 31;
+ player_set_commands_allowed(true);
+ break;
+
case 12:
_G(flags)[V063] = 1;
break;
@@ -270,8 +284,8 @@ void Room143::daemon() {
} else {
_digiName = "143v508";
_val1 = 11;
- _val7 = 2;
- _val8 = 15;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 15;
}
} else {
wilbur_speech("143w506");
@@ -291,8 +305,8 @@ void Room143::daemon() {
break;
}
_val1 = 11;
- _val7 = 2;
- _val8 = 15;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 15;
break;
case 15:
@@ -304,8 +318,8 @@ void Room143::daemon() {
case 16:
_digiName = "143v506";
_val1 = 22;
- _val7 = 2;
- _val8 = 17;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 17;
break;
case 17:
@@ -317,14 +331,23 @@ void Room143::daemon() {
case 18:
_digiName = "143v507";
_val1 = 14;
- _val7 = 2;
- _val8 = 15;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 15;
+ break;
+
+ case 19:
+ _val6 = 37;
+ break;
+
+ case 21:
+ _val4 = 7;
+ kernel_trigger_dispatch_now(43);
break;
case 22:
_digiName = "143b001";
- _val7 = 2;
- _val8 = 23;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 23;
_val6 = 30;
_val5 = 29;
_val1 = 21;
@@ -333,24 +356,33 @@ void Room143::daemon() {
case 23:
_digiName = "143v901";
- _val7 = 2;
- _val8 = 24;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 24;
_val6 = 29;
_val1 = 22;
break;
+ case 24:
+ _digiName = "143b002";
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 25;
+ _val6 = 30;
+ _val1 = 21;
+ kernel_trigger_dispatch_now(44);
+ break;
+
case 25:
_digiName = "143v902";
- _val7 = 2;
- _val8 = 26;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 26;
_val6 = 29;
_val1 = 22;
break;
case 26:
_digiName = "143v903";
- _val7 = 2;
- _val8 = 7;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 7;
_val1 = 14;
_val6 = 31;
kernel_trigger_dispatch_now(44);
@@ -364,8 +396,8 @@ void Room143::daemon() {
case 29:
_digiName = "143b006";
- _val7 = 2;
- _val8 = 30;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 30;
_val6 = 36;
break;
@@ -395,8 +427,8 @@ void Room143::daemon() {
_wi03 = series_play("143wi03", 0x100, 0, -1, 600, -1, 100, 0, 0, 10, 10);
_wi03S = series_play("143wi03s", 0x101, 0, -1, 600, -1, 100, 0, 0, 10, 10);
_digiName = "143b005";
- _val7 = 2;
- _val8 = 39;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 39;
_val6 = (_val5 == 42) ? 44 : 36;
break;
@@ -413,14 +445,352 @@ void Room143::daemon() {
case 40:
_digiName = "143v904";
- _val7 = 2;
- _val8 = 41;
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 41;
_val6 = 35;
_val1 = 11;
break;
+ case 41:
+ _val6 = 34;
+ _digiName = "143b003";
+ _digiMode = KT_DAEMON;
+ _digiTrigger = 42;
+ _val1 = 8;
+ kernel_trigger_dispatch_now(44);
+ break;
+
+ case 42:
+ _val6 = 42;
+ break;
+
+ case 43:
+ switch (_val4) {
+ case 6:
+ _cat.series_show("143cat", 0);
+ break;
+
+ case 7:
+ _cat.terminate();
+ _val4 = 6;
+ series_play_with_breaks(PLAY4, "143cat", 0, 43, 3, 10, 100, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 44:
+ switch (_val2) {
+ case 8:
+ switch (_val1) {
+ case 8:
+ switch (imath_ranged_rand(1, 20)) {
+ case 1:
+ series_play_with_breaks(PLAY5, "143ve02", 0xf00, 44, 2);
+ break;
+
+ case 2:
+ _val2 = 10;
+ series_play("143ve03", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ default:
+ series_play("143ve01", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 0);
+ break;
+ }
+ break;
+
+ case 11:
+ _val2 = 10;
+ series_play("143ve03", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 15:
+ _val2 = 13;
+ Series::series_play("143ve14", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 8);
+ break;
+
+ case 20:
+ _val1 = 8;
+ series_play_with_breaks(PLAY6, "143ve07", 0xf00, 44, 3);
+ break;
+
+ case 22:
+ _val2 = 21;
+ Series::series_play("143ve08", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 26:
+ _val2 = 27;
+ series_play("143ve04", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 5);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 9:
+ if (_val1 == 8) {
+ if (imath_ranged_rand(1, 20) == 1) {
+ _val2 = 21;
+ Series::series_play("143ve10", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 3);
+ } else {
+ Series::series_play("143ve10", 0xf00, 0, 44, 10, 0, 100, 0, 0, 3, 3);
+ }
+ } else {
+ _val2 = 21;
+ Series::series_play("143ve10", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 3);
+ }
+ break;
+
+ case 10:
+ switch (_val1) {
+ case 8:
+ if (imath_ranged_rand(1, 20) == 1) {
+ _val2 = 8;
+ series_play("143ve03", 0xf00, 2, 44, 10, 0, 100, 0, 0, 0, 3);
+ } else {
+ series_play("143ve03", 0xf00, 0, 44, 10, 0, 100, 0, 0, 3, 3);
+ }
+ break;
+
+ case 11:
+ _val2 = 11;
+ series_play("143ve03", 0xf00, 0, 44, 4, 0, 100, 0, 0, 3, 3);
+ break;
+
+ default:
+ _val2 = 8;
+ series_play("143ve03", 0xf00, 2, 44, 10, 0, 100, 0, 0, 0, 3);
+ break;
+ }
+ break;
+
+ case 11:
+ if (_val1 == 11) {
+ _ve03 = series_play("143ve03", 0xf00, 4, -1, 4, -1, 100, 0, 0, 3, 6);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ _val2 = 10;
+ kernel_trigger_dispatch_now(44);
+ }
+ break;
+
+ case 13:
+ switch (_val1) {
+ case 13:
+ Series::series_play("143ve15", 0xf00, 0, 44, 10, 0, 100, 0, 0, 4, 4);
+ break;
+
+ case 14:
+ _val2 = 14;
+ Series::series_play("143ve17", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 2);
+ break;
+
+ case 15:
+ _val2 = (imath_ranged_rand(1, 2) == 1) ? 16 : 17;
+ Series::series_play("143ve18", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 18:
+ _val1 = 19;
+ Series::series_play("143ve16", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 1);
+ break;
+
+ case 19:
+ terminateMachineAndNull(_plate);
+ _val1 = 13;
+ Series::series_play("143ve16", 0xf00, 0, 44, 6, 0, 100, 0, 0, 2, 15);
+ break;
+
+ case 21:
+ _val2 = 21;
+ Series::series_play("143ve15", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ default:
+ _val2 = 10;
+ Series::series_play("143ve19", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, -1);
+ break;
+ }
+ break;
+
+ case 14:
+ if (_val1 == 14) {
+ _ve03 = series_play("143ve18", 0xf00, 4, -1, 4, -1, 100, 0, 0, 1, 4);
+ _ve03S = series_play("143ve18s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 1, 4);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 13;
+ Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 16:
+ if (_val1 == 15) {
+ _ve03 = series_play("143ve17", 0xf00, 4, -1, 4, -1, 100, 0, 0, 3, 5);
+ _ve03S = series_play("143ve17s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 3, 5);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 13;
+ Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 2);
+ }
+ break;
+
+ case 17:
+ if (_val1 == 15) {
+ _ve03 = series_play("143ve18", 0xf00, 4, -1, 4, -1, 100, 0, 0, 5, 8);
+ _ve03S = series_play("143ve18s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 5, 8);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 13;
+ Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+
+ case 21:
+ switch (_val1) {
+ case 15:
+ _val2 = 13;
+ Series::series_play("143ve15", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 21:
+ if (imath_ranged_rand(1, 20) == 1) {
+ _val2 = 9;
+ Series::series_play("143ve10", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 3);
+ } else {
+ Series::series_play("143ve08", 0xf00, 0, 44, 10, 0, 100, 0, 0, 4, 4);
+ }
+ break;
+
+ case 22:
+ if (imath_ranged_rand(1, 2) == 1) {
+ _val2 = 23;
+ kernel_trigger_dispatch_now(44);
+ } else {
+ _val2 = 24;
+ Series::series_play("143ve11", 0xf00, 0, 44, 6, 0, 100, 0, 0, 2, 4);
+ }
+ break;
+
+ default:
+ _val2 = 8;
+ Series::series_play("143ve08", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 23:
+ if (_val1 == 22) {
+ _ve03 = series_play("143ve11", 0xf00, 0, -1, 6, -1, 100, 0, 0, 0, 1);
+ _ve03S = series_play("143ve11s", 0xf01, 0, -1, 6, -1, 100, 0, 0, 0, 1);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 21;
+ kernel_trigger_dispatch_now(44);
+ }
+ break;
+
+ case 24:
+ if (_val1 == 22) {
+ _ve03 = series_play("143ve11", 0xf00, 4, -1, 6, -1, 100, 0, 0, 4, 6);
+ _ve03S = series_play("143ve11s", 0xf01, 4, -1, 6, -1, 100, 0, 0, 4, 6);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 21;
+ Series::series_play("143ve11", 0xf00, 2, 44, 6, 0, 100, 0, 0, 2, 4);
+ }
+ break;
+
+ case 25:
+ switch (_val1) {
+ case 25:
+ Series::series_play("143ve06", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 26:
+ _val2 = 26;
+ Series::series_play("143ve06", 0xf00, 0, 44, 4, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ _val2 = 28;
+ Series::series_play("143ve05", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+ }
+ break;
+
+ case 26:
+ if (_val1 == 26) {
+ _ve03 = series_play("143ve06", 0xf00, 4, -1, 5, -1, 100, 0, 0, 0, 4);
+ _ve03S = series_play("143ve06s", 0xf01, 4, -1, 5, -1, 100, 0, 0, 0, 4);
+ playDigi2();
+ } else {
+ terminateMachineAndNull(_ve03);
+ terminateMachineAndNull(_ve03S);
+ _val2 = 25;
+ kernel_trigger_dispatch_now(44);
+ }
+ break;
+
+ case 27:
+ _val2 = 25;
+ Series::series_play("143ve05", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ break;
+
+ case 28:
+ _val2 = 8;
+ Series::series_play("143ve04", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 5);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case 45:
switch (_val5) {
+ case 20:
+ _val5 = 31;
+ kernel_trigger_dispatch_now(45);
+ break;
+
+ case 29:
+ switch (_val6) {
+ case 29:
+ Series::series_play("143bu02", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 30:
+ frame = imath_ranged_rand(0, 5);
+ Series::series_play("143bu03", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ playDigi1();
+ break;
+
+ default:
+ _G(flags)[V298] = 0;
+ _val5 = 20;
+ series_play_with_breaks(PLAY9, "143bu04", 0xa00, 45, 3);
+ break;
+ }
+ break;
+
case 31:
switch (_val6) {
case 31: {
@@ -455,11 +825,197 @@ void Room143::daemon() {
break;
}
+ case 33:
+ _val6 = 31;
+ series_play_with_breaks(PLAY11, "143bu11", 0xa00, 45, 3);
+ break;
+
+ case 35:
+ _val5 = 35;
+ Series::series_play("143bu06", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 3);
+ break;
+
+ case 39:
+ _val5 = 37;
+ Series::series_play("143bu11", 0xa00, 0, 45);
+ break;
+
+ case 45:
+ series_load("143money");
+ series_play_with_breaks(PLAY8, "143bu24", 0xe00, 1, 3);
+ break;
+
+ default:
+ _val5 = 41;
+ Series::series_play("143bu17", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 7);
+ break;
+ }
+ break;
+
+ case 32:
+ digi_stop(2);
+ _G(flags)[V063] = 0;
+
+ _val5 = 31;
+ loadMoney();
+ Series::series_play("143bu25", 0xa00, 2, 45);
+ break;
+
+ case 35:
+ switch (_val6) {
+ case 34:
+ Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 3, 3);
+ playDigi1();
+ break;
+
+ case 35:
+ Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 3, 3);
+ break;
+
default:
+ _val5 = 31;
+ Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 0, 3);
break;
}
break;
+ case 37:
+ switch (_val6) {
+ case 36:
+ frame = imath_ranged_rand(0, 5);
+ Series::series_play("143bu13", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ playDigi1();
+ break;
+
+ case 37:
+ if (imath_ranged_rand(1, 60) == 22) {
+ // Talk about unlikely chance of happening
+ Series::series_play("143bu14", 0xa00, 0, 45);
+
+ switch (imath_ranged_rand(1, 4)) {
+ case 1:
+ digi_play("143b007", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("143b011", 2, 255, -1);
+ break;
+ case 3:
+ digi_play("143b012", 2, 255, -1);
+ break;
+ case 4:
+ digi_play("143b013", 2, 255, -1);
+ break;
+ default:
+ break;
+ }
+ } else {
+ Series::series_play("143bu13", 0xa00, 0, 45, 10, 0, 100, 0, 0, 0, 0);
+ }
+ break;
+
+ case 39:
+ _val6 = 40;
+ series_play_with_breaks(PLAY10, "143bu15", 0xa00, 45);
+ break;
+
+ case 40:
+ digi_play("143b008", 1, 255, 1);
+ _val6 = 31;
+ kernel_trigger_dispatch_now(45);
+ break;
+
+ default:
+ _val5 = 31;
+ Series::series_play("143bu11", 0xa00, 2, 45, 6, 0, 100, 0, 0, 0, 7);
+ break;
+ }
+ break;
+
+ case 41:
+ _val5 = 42;
+ digi_preload("143_002");
+ player_set_commands_allowed(true);
+ series_play_with_breaks(PLAY2, "143bu18", 0xa00, 45, 3, 6, 100, 0, 0);
+ break;
+
+ case 42:
+ switch (_val6) {
+ case 42:
+ ++_val3;
+
+ if (imath_ranged_rand(10, 15) >= _val3) {
+ do {
+ if (_frame >= 5)
+ _frame = 0;
+ frame = imath_ranged_rand(0, 5);
+ } while (frame <= _frame);
+
+ _frame = frame;
+ Series::series_play("143bu19", 0xa00, 0, 45, 8, 0, 100, 0, 0, frame, frame);
+
+ } else if (imath_ranged_rand(1, 30) == 1) {
+ Series::series_play("143bu19", 0xa00, 0, -1, 8, 0, 100, 0, 0, 6, 12);
+ } else {
+ do {
+ if (_frame >= 5)
+ _frame = 0;
+ frame = imath_ranged_rand(0, 5);
+ } while (frame <= _frame);
+
+ _frame = frame;
+ Series::series_play("143bu19", 0xa00, 0, 45, 8, 0, 100, 0, 0, frame, frame);
+ }
+ break;
+
+ case 44:
+ _val5 = 43;
+ Series::series_play("143bu20", 0xa00, 0, 45, 4);
+ break;
+
+ case 45:
+ _G(flags)[V063] = 0;
+ _val5 = 46;
+ Series::series_play("143bu19", 0xa00, 0, 45, 4, 0, 100, 0, 0, 13, -1);
+ break;
+
+ default:
+ _G(flags)[V063] = 0;
+ _val5 = 32;
+ Series::series_play("143bu19", 0xa00, 0, 45, 4, 0, 100, 0, 0, 13, -1);
+ break;
+ }
+ break;
+
+ case 43:
+ switch (_val6) {
+ case 43:
+ frame = imath_ranged_rand(0, 5);
+ Series::series_play("143bu21", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ break;
+
+ case 44:
+ frame = imath_ranged_rand(0, 4);
+ Series::series_play("143bu22", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ break;
+
+ default:
+ Series::series_play("143bu20", 0xa00, 2, 45, 6, 0, 100, 0, 0, 0, 7);
+ break;
+ }
+ break;
+
+ case 46:
+ digi_stop(3);
+ loadMoney();
+ series_load("143money");
+ series_play_with_breaks(PLAY8, "143bu24", 0xe00, 1, 3);
+ break;
+
+ case 47:
+ _val5 = 31;
+ Series::series_play("143bu10", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
default:
break;
}
@@ -484,9 +1040,9 @@ void Room143::daemon() {
_val1 = 22;
_digiName = "143v501";
- _val7 = 2;
+ _digiMode = KT_DAEMON;
_G(wilbur_should) = 5;
- _val8 = gCHANGE_WILBUR_ANIMATION;
+ _digiTrigger = gCHANGE_WILBUR_ANIMATION;
_G(flags)[V064] = 1;
loadCheese();
hotspot_set_active("cheese", true);
@@ -510,6 +1066,28 @@ void Room143::daemon() {
}
break;
+ case 10028:
+ if (_G(flags)[kRoadOpened]) {
+ _G(kernel).continue_handling_trigger = true;
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ _G(flags)[V000] = 1003;
+ hotspot_set_active("burl", true);
+ player_set_commands_allowed(false);
+ intr_freshen_sentence();
+ Section1::walk();
+
+ player_update_info();
+ if (_G(player_info).y < 304) {
+ ws_walk(220, 304, 0, -1, 2);
+ _G(flags)[V298] = 1;
+ }
+
+ series_play_with_breaks(PLAY7, "143bu01", 0xe00, 22, 3);
+ } else {
+ kernel_timing_trigger(60, 10028);
+ }
+ break;
+
case 10029:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
@@ -523,6 +1101,36 @@ void Room143::daemon() {
}
break;
+ case 10030:
+ if (_G(flags)[V000] == 1002) {
+ _G(kernel).continue_handling_trigger = true;
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ _val6 = 31;
+ } else {
+ kernel_timing_trigger(60, 10030);
+ }
+ break;
+
+ case 10031:
+ if (_G(flags)[V000] == 1002) {
+ _G(kernel).continue_handling_trigger = true;
+ } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ _G(kernel).continue_handling_trigger = true;
+ player_update_info();
+ player_set_commands_allowed(false);
+ intr_freshen_sentence();
+ Section1::walk();
+
+ if (_G(player_info).y < 300)
+ ws_walk(213, 287, 0, -1, 2);
+
+ _val6 = 45;
+ hotspot_set_active("burl", false);
+ } else {
+ kernel_timing_trigger(60, 10031);
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -577,8 +1185,8 @@ void Room143::parser() {
player_set_commands_allowed(false);
_val1 = 22;
_digiName = "143v511";
- _val7 = 1;
- _val8 = 1;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 1;
break;
case 1:
@@ -599,8 +1207,8 @@ void Room143::parser() {
player_set_commands_allowed(false);
_val1 = 11;
_digiName = "143v504";
- _val7 = 1;
- _val8 = 1;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 1;
break;
case 1:
@@ -618,8 +1226,8 @@ void Room143::parser() {
player_set_commands_allowed(false);
_val1 = 22;
_digiName = "143v510";
- _val7 = 1;
- _val8 = 1;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 1;
_G(flags)[V062] = 1;
break;
@@ -639,8 +1247,8 @@ void Room143::parser() {
player_set_commands_allowed(false);
_val1 = 26;
_digiName = "143v502";
- _val7 = 1;
- _val8 = 1;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 1;
_val4 = 21;
kernel_trigger_dispatch_now(43);
break;
@@ -655,8 +1263,8 @@ void Room143::parser() {
case 2:
_val1 = 14;
_digiName = "143V503";
- _val7 = 1;
- _val8 = 3;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 3;
break;
case 3:
@@ -793,8 +1401,8 @@ void Room143::conv35() {
digi_play(sound, 1, 255, 9);
}
- _val7 = 1;
- _val8 = 9;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 9;
} else {
conv_resume();
}
@@ -834,8 +1442,8 @@ void Room143::conv30() {
digi_play(sound, 1, 255, 9);
}
- _val7 = 1;
- _val8 = 9;
+ _digiMode = KT_PARSE;
+ _digiTrigger = 9;
} else {
conv_resume();
}
@@ -875,6 +1483,25 @@ void Room143::loadMoney() {
Series::series_play("143pl01", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
}
+void Room143::playDigi1() {
+ if (_digiName) {
+ _G(kernel).trigger_mode = _digiMode;
+ digi_play(_digiName, 1, 255, _digiTrigger);
+ _digiName = nullptr;
+
+ if (_val5 == 43)
+ digi_change_volume(2, 0);
+ }
+}
+
+void Room143::playDigi2() {
+ if (_digiName) {
+ _G(kernel).trigger_mode = _digiMode;
+ digi_play(_digiName, 1, 255, _digiTrigger);
+ _digiName = nullptr;
+ }
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
index a739007d649..66725a73397 100644
--- a/engines/m4/burger/rooms/section1/room143.h
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -48,6 +48,8 @@ private:
machine *_eu02 = nullptr;
machine *_wi03 = nullptr;
machine *_wi03S = nullptr;
+ machine *_ve03 = nullptr, *_ve03S = nullptr;
+ Series _cat;
noWalkRect *_walk1 = nullptr;
const char *_digiName = nullptr;
bool _flag1 = false;
@@ -58,8 +60,8 @@ private:
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
- int _val8 = 0;
+ KernelTriggerType _digiMode = (KernelTriggerType)0;
+ int _digiTrigger = 0;
void conv35();
void conv30();
@@ -67,6 +69,8 @@ private:
void talkToBurl();
void loadCheese();
void loadMoney();
+ void playDigi1();
+ void playDigi2();
public:
Room143() : Room() {}
Commit: 0bc20e230487200d5794e0ff33713792380a890d
https://github.com/scummvm/scummvm/commit/0bc20e230487200d5794e0ff33713792380a890d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect reference to Series static method
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 61d1f328ac8..5e4c884d718 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -467,7 +467,7 @@ void Room143::daemon() {
case 43:
switch (_val4) {
case 6:
- _cat.series_show("143cat", 0);
+ _cat.show("143cat", 0);
break;
case 7:
Commit: 5b6eb2e4d89902d7ef86055b833513d1e2dd1f77
https://github.com/scummvm/scummvm/commit/5b6eb2e4d89902d7ef86055b833513d1e2dd1f77
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding room 145 methods
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 6fef1d088bc..6d71de45876 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -208,19 +208,129 @@ Room145::Room145() : Room() {
}
void Room145::init() {
+ digi_preload("145_006");
+ digi_play_loop("145_006", 3, 255, -1);
+ _state2 = 0;
+ switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
+ case 142:
+ ws_demand_location(680, 340, 9);
+ ws_walk(570, 330, 0, -1, -1);
+ break;
+
+ default:
+ ws_demand_location(570, 330, 9);
+ break;
+ }
+
+ kernel_timing_trigger(600, 7);
+
+ if (_G(flags)[V067]) {
+ series_show("145drum", 0xa01);
+ hotspot_set_active("DRUMZ", false);
+ } else {
+ loadDrum();
+ _walk1 = intr_add_no_walk_rect(140, 295, 240, 325, 139, 326);
+ _val1 = 19;
+ kernel_trigger_dispatch_now(2);
+ }
+
+ loadRx();
+
+ _walk2 = intr_add_no_walk_rect(423, 308, 540, 340, 541, 341);
+ _val2 = 101;
+ _val3 = 33;
+ kernel_trigger_dispatch_now(4);
+
+ _walk3 = intr_add_no_walk_rect(341, 326, 480, 365, 481, 366);
+ _val4 = 43;
+ kernel_trigger_dispatch_now(5);
+
+ if (inv_player_has("AMPLIFIER")) {
+ hotspot_set_active("AMPLIFIER ", false);
+ } else {
+ _amplifier = series_show("145amp", 0xa01);
+ }
}
void Room145::daemon() {
-
+ // TODO
}
void Room145::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (!_G(flags)[V067] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
+ _G(player).walk_y >= 295 && _G(player).walk_y <= 325)
+ player_walk_to(139, 326);
+
+ if (_G(player).walk_x >= 423 && _G(player).walk_x <= 540 &&
+ _G(player).walk_y >= 308 && _G(player).walk_y <= 340)
+ player_walk_to(541, 341);
+ if (_G(player).walk_x >= 341 && _G(player).walk_x <= 480 &&
+ _G(player).walk_y >= 326 && _G(player).walk_y <= 365)
+ player_walk_to(481, 366);
+
+ if (player_said("GEAR") && player_said("VERA'S DINER "))
+ player_set_facing_at(680, 340);
}
void Room145::parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said("conv21")) {
+ conv21();
+ } else if (player_said("conv22")) {
+ conv22();
+ } else if (player_said("conv23")) {
+ conv23();
+ } else if (player_said("GEAR", "VERA'S DINER ")) {
+ disable_player_commands_and_fade_init(1014);
+ } else if (!_G(walker).wilbur_match(MATCH)) {
+ return;
+ }
+
+ _G(player).command_ready = false;
+}
+
+void Room145::loadDrum() {
+ static const char *NAMES[12] = {
+ "145dz01", "145dz02", "145dz03", "145dz04", "145dz05",
+ "145dz06", "145dz01s", "145dz02s", "145dz03s", "145dz04s",
+ "145dz05s", "145dz06s"
+ };
+ for (int i = 0; i < 12; ++i)
+ series_load(NAMES[i]);
+
+ digi_preload("145_003");
+ digi_preload("145_004");
+}
+
+void Room145::loadRx() {
+ static const char *NAMES[8] = {
+ "145rx01", "145rx02", "145rx04", "145rx06",
+ "145rx01s", "145rx02s", "145rx04s", "145rx06s"
+ };
+ for (int i = 0; i < 8; ++i)
+ series_load(NAMES[i]);
+}
+
+void Room145::conv21() {
+ // TODO: conv
+}
+
+void Room145::conv22() {
+ // TODO: conv
+}
+void Room145::conv23() {
+ // TODO: conv
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 70e8aae99c7..326682ce95f 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -56,10 +56,23 @@ private:
static const seriesPlayBreak PLAY21[];
static const seriesPlayBreak PLAY22[];
static const seriesPlayBreak PLAY23[];
-
static long _state1;
static long _state2;
static long _state3;
+ noWalkRect *_walk1 = nullptr;
+ noWalkRect *_walk2 = nullptr;
+ noWalkRect *_walk3 = nullptr;
+ machine *_amplifier = nullptr;
+ int _val1 = 0;
+ int _val2 = 0;
+ int _val3 = 0;
+ int _val4 = 0;
+
+ void loadDrum();
+ void loadRx();
+ void conv21();
+ void conv22();
+ void conv23();
public:
Room145();
Commit: f0a69ca46e78253edff8f125189a33bf3185e900
https://github.com/scummvm/scummvm/commit/f0a69ca46e78253edff8f125189a33bf3185e900
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 145 support methods
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 6d71de45876..381572dae56 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -322,15 +322,192 @@ void Room145::loadRx() {
}
void Room145::conv21() {
- // TODO: conv
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (sound) {
+ if (who == 1) {
+ wilbur_speech(sound, 10001);
+ } else {
+ switch (node) {
+ case 2:
+ case 7:
+ case 12:
+ loadVp4();
+ break;
+
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 8:
+ case 11:
+ loadRx4();
+ break;
+
+ case 9:
+ if (entry <= 0) {
+ loadRx4();
+ } else if (entry == 2) {
+ loadVp4();
+ }
+ break;
+
+ case 10:
+ if (entry <= 0) {
+ loadVp4();
+ } else if (entry == 1) {
+ loadRx4();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
}
void Room145::conv22() {
- // TODO: conv
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+
+ if (sound) {
+ if (who == 1)
+ wilbur_speech(sound, 10001);
+ else
+ loadRx4();
+ }
}
void Room145::conv23() {
- // TODO: conv
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (sound) {
+ if (who == 1) {
+ wilbur_speech(sound, 10001);
+ } else {
+ switch (node) {
+ case 2:
+ switch (entry) {
+ case 0:
+ _val1 = 20;
+ break;
+ case 1:
+ _val1 = 21;
+ break;
+ case 2:
+ case 3:
+ _val1 = 22;
+ break;
+ case 4:
+ _val1 = 21;
+ break;
+ case 5:
+ _val1 = 20;
+ break;
+ case 6:
+ _val1 = 20;
+ break;
+ case 7:
+ conv_resume_curr();
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ _val1 = 20;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void Room145::loadVp4() {
+ _vp.terminate();
+ _val4 = 39;
+ digi_play(conv_sound_to_play(), 1, 255, 5);
+ _vp.play("145vp04", 0x300, 4, -1);
+}
+
+void Room145::loadRx4() {
+ _rx.terminate();
+ _val3 = 39;
+ digi_play(conv_sound_to_play(), 1, 255, 4);
+ _rx.play("145rx04", 0x900, 4, -1);
+}
+
+void Room145::loadSeries1() {
+ series_load("145wi02");
+ series_load("145wi02s");
+ series_load("145wi03");
+ series_load("145wi03s");
+ series_load("145dz08");
+ series_load("145dz08s");
+}
+
+int Room145::getRandomState() const {
+ switch (imath_ranged_rand(1, 10)) {
+ case 1:
+ return 24;
+ case 2:
+ return 25;
+ default:
+ return 19;
+ }
+}
+
+void Room145::resetRoxy() {
+ switch (_val5) {
+ case 31:
+ _rx.terminate();
+ _val3 = 32;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 33:
+ _rx.terminate();
+ _val3 = 33;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ default:
+ term_message("Can't move roxy to home state, just have to wait!");
+ break;
+ }
+}
+
+void Room145::playRandomDigi1() {
+ _state2 = 1;
+ static const char *NAMES[4] = { "145v907", "145v908", "145v909", "145v910" };
+
+ _digiName1 = NAMES[imath_ranged_rand(0, 3)];
+ digi_preload(_digiName1);
+ digi_play(_digiName1, 2, 125, 6);
+}
+
+void Room145::playRandomDigi2() {
+ _state2 = 1;
+ static const char *NAMES[13] = {
+ "145r907", "145r908", "145r909", "145r910", "145r911",
+ "145r912", "145r913", "145r914", "145r915", "145r916",
+ "145r917", "145r918", "145r919"
+ };
+
+ _digiName1 = NAMES[imath_ranged_rand(0, 12)];
+ _val3 = 34;
+ digi_preload(_digiName1);
+ npc_say(_digiName2, 4, "145rx01", 0x900, 1, 3, 7, 2);
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 326682ce95f..6cf348f9be9 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -63,16 +63,29 @@ private:
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
machine *_amplifier = nullptr;
+ Series _vp;
+ Series _rx;
+ const char *_digiName1 = nullptr;
+ const char *_digiName2 = nullptr;
+ bool _flag1 = false;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
+ int _val5 = 0;
void loadDrum();
void loadRx();
void conv21();
void conv22();
void conv23();
+ void loadVp4();
+ void loadRx4();
+ void loadSeries1();
+ int getRandomState() const;
+ void resetRoxy();
+ void playRandomDigi1();
+ void playRandomDigi2();
public:
Room145();
Commit: b52f30bfcc2dfbdad082eee8a55d824e985b86bc
https://github.com/scummvm/scummvm/commit/b52f30bfcc2dfbdad082eee8a55d824e985b86bc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 145 daemon
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 381572dae56..bf97acca8c7 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -257,6 +257,482 @@ void Room145::init() {
}
void Room145::daemon() {
+ switch (_G(kernel).trigger) {
+ case 1:
+ switch (_state1) {
+ case 12:
+ wilbur_speech("145w004");
+ break;
+
+ case 13:
+ wilbur_speech("145w007");
+ break;
+
+ case 14:
+ wilbur_speech("145w008");
+ break;
+
+ case 15:
+ wilbur_speech("145w014");
+ break;
+
+ case 16:
+ wilbur_speech("145w015");
+ break;
+
+ case 17:
+ wilbur_speech("145w018");
+ break;
+
+ case 18:
+ wilbur_speech("145w003");
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 2:
+ switch (_val1) {
+ case 19:
+ if (!digi_play_state(2))
+ digi_play_loop("145_003", 2, 125, -1);
+
+ _val1 = getRandomState();
+ series_play_with_breaks(PLAY5, "145dz01", 0xa01, 2, 3);
+ break;
+
+ case 20:
+ _val1 = 23;
+ series_play_with_breaks(PLAY6, "145dz02", 0xa01, 2, 3);
+ break;
+
+ case 21:
+ _val1 = 23;
+ series_play_with_breaks(PLAY7, "145dz03", 0xa01, 2, 3);
+ break;
+
+ case 22:
+ if (!_state2)
+ digi_stop(2);
+
+ _val1 = 23;
+ series_play_with_breaks(PLAY8, "145dz04", 0xa01, 2, 3);
+ break;
+
+ case 23:
+ kernel_trigger_dispatch_now(10001);
+ _val1 = getRandomState();
+ kernel_trigger_dispatch_now(2);
+ break;
+
+ case 24:
+ _val1 = getRandomState();
+ series_play_with_breaks(PLAY9, "145dz05", 0xa01, 2, 3);
+ break;
+
+ case 25:
+ if (!_state2)
+ digi_stop(2);
+
+ _val1 = getRandomState();
+ series_play_with_breaks(PLAY10, "145dz06", 0xa01, 2, 3);
+ break;
+
+ case 26:
+ _val1 = 27;
+ series_play_with_breaks(PLAY11, "145dz05", 0xa01, 2, 3);
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ case 27:
+ _val1 = getRandomState();
+ series_play_with_breaks(PLAY12, "145dz06", 0xa01, 2, 3);
+ break;
+
+ case 28:
+ if (!_state2)
+ digi_stop(2);
+
+ _G(wilbur_should) = 5;
+ _val1 = 29;
+ series_play_with_breaks(PLAY13, "145dz08", 0xa01, 2, 3);
+ break;
+
+ case 29:
+ hotspot_set_active("DRUMZ", false);
+ intr_remove_no_walk_rect(_walk1);
+
+ _G(flags)[V067] = 1;
+ series_play_with_breaks(PLAY14, "145dz08", 0, -1, 3);
+ series_show("145drum", 0xa01);
+ _G(wilbur_should) = 6;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 4:
+ _val5 = _val3;
+
+ switch (_val3) {
+ case 30:
+ _rx.terminate();
+ _val3 = 31;
+ series_play_with_breaks(PLAY15, "145rx01", 0x900, 4, 3, 6, 100, 0, 0);
+ break;
+
+ case 31:
+ _duration = imath_ranged_rand(180, 360);
+ _val3 = 32;
+ _rx.show("145rx01", 0x900, 0, 4, _duration);
+ break;
+
+ case 32:
+ _rx.terminate();
+ _val3 = 33;
+ series_play_with_breaks(PLAY16, "145rx01", 0x900, 4, 3);
+ break;
+
+ case 33:
+ if (_val2 == 101) {
+ _duration = imath_ranged_rand(180, 360);
+ _val3 = 30;
+ _rx.show("145rx01", 0x900, 0, 4, _duration, 3);
+ } else if (_val2 == 17) {
+ playRandomDigi2();
+ } else {
+ _val3 = 35;
+ kernel_trigger_dispatch_now(4);
+ }
+ break;
+
+ case 34:
+ digi_unload(_digiName2);
+ _state2 = 0;
+ _val2 = 101;
+ _val3 = 33;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 35:
+ switch (_val2) {
+ case 0:
+ player_set_commands_allowed(false);
+ _val3 = 36;
+ break;
+
+ case 15:
+ _val3 = 37;
+ break;
+
+ case 100:
+ _val3 = 40;
+ break;
+
+ default:
+ term_message("ERROR!!! Who is roxy talking to???");
+ break;
+ }
+
+ series_play_with_breaks(PLAY17, "145rx02", 0x900, 4, 3);
+ break;
+
+ case 36:
+ kernel_trigger_dispatch_now(9);
+ _val3 = 40;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 37:
+ _state2 = 1;
+ _val3 = 38;
+ series_play_with_breaks(PLAY18, "145rx04", 0x900, 4, 3);
+ break;
+
+ case 38:
+ _rx.show("145rx04", 0x900);
+
+ switch (_state3) {
+ case 1:
+ _digiName1 = "145v901";
+ break;
+ case 2:
+ _digiName1 = "145v902";
+ break;
+ case 3:
+ _digiName1 = "145v903";
+ break;
+ case 4:
+ _digiName1 = "145v904";
+ break;
+ case 5:
+ _digiName1 = "145v905";
+ break;
+ case 6:
+ _digiName1 = "145v906";
+ break;
+ default:
+ break;
+ }
+
+ digi_preload(_digiName1);
+ digi_play(_digiName1, 2, 125, -1);
+ _val3 = 42;
+ kernel_timing_trigger(120, 4);
+ break;
+
+ case 39:
+ _rx.terminate();
+ _val3 = 40;
+ kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(10001);
+ break;
+
+ case 40:
+ _rx.show("145rx04", 0x900);
+ break;
+
+ case 41:
+ _val2 = 101;
+ _rx.terminate();
+ _val3 = 33;
+ series_play_with_breaks(PLAY19, "145rx02", 0x900, 4, 3);
+ break;
+
+ case 42:
+ digi_unload(_digiName1);
+ _state2 = 0;
+ _rx.terminate();
+ _val3 = 41;
+ series_play_with_breaks(PLAY20, "145rx06", 0x900, 4, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 5:
+ switch (_val4) {
+ case 39:
+ _vp.terminate();
+ _val4 = 40;
+ kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(10001);
+ break;
+
+ case 40:
+ _vp.show("145vp04", 0x300);
+ break;
+
+ case 43:
+ player_set_commands_allowed(true);
+ _vp.show("145vp02", 0x300);
+ break;
+
+ case 44:
+ player_set_commands_allowed(true);
+ _flag1 = true;
+
+ if (_val2 == 101) {
+ _val2 = 100;
+ resetRoxy();
+ _vp.terminate();
+ _val4 = 45;
+ series_play_with_breaks(PLAY21, "145vp02", 0x300, 5, 3);
+ } else {
+ kernel_timing_trigger(15, 5);
+ }
+ break;
+
+ case 45:
+ _val4 = 46;
+ series_play_with_breaks(PLAY22, "145vp06", 0x300, 5, 3);
+ break;
+
+ case 46:
+ kernel_trigger_dispatch_now(8);
+ _val4 = 40;
+ kernel_trigger_dispatch_now(5);
+ break;
+
+ case 47:
+ _vp.terminate();
+ _val4 = 43;
+ series_play_with_breaks(PLAY23, "145vp02", 0x300, 5, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case 6:
+ digi_unload(_digiName1);
+ _state2 = 0;
+ break;
+
+ case 7:
+ if (!digi_play_state(1) && !_flag1 && _val2 == 101) {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ _state3 = imath_ranged_rand(1, 6);
+ _val2 = 15;
+ resetRoxy();
+ break;
+
+ case 2:
+ playRandomDigi2();
+ break;
+
+ default:
+ _val2 = 17;
+ resetRoxy();
+ break;
+ }
+ }
+
+ kernel_timing_trigger(imath_ranged_rand(600, 900), 7);
+ break;
+
+ case 8:
+ conv_load_and_prepare("conv21", 11);
+ conv_export_pointer_curr(&_G(flags)[V068], 0);
+ conv_export_pointer_curr(&_G(flags)[V069], 1);
+ conv_export_pointer_curr(&_G(flags)[V070], 2);
+ conv_export_pointer_curr(&_G(flags)[V071], 3);
+ conv_export_pointer_curr(&_G(flags)[V072], 4);
+ conv_play_curr();
+ break;
+
+ case 9:
+ conv_load_and_prepare("conv22", 12);
+ conv_export_pointer_curr(&_G(flags)[V073], 0);
+ break;
+
+ case 10:
+ player_set_commands_allowed(false);
+ conv_load_and_prepare("conv23", 13);
+ conv_export_value_curr(_G(flags)[V068], 0);
+ conv_export_value_curr(_G(flags)[V069], 1);
+ conv_export_pointer_curr(&_G(flags)[V074], 2);
+ conv_export_pointer_curr(&_G(flags)[V075], 3);
+ conv_export_pointer_curr(&_G(flags)[V076], 4);
+ conv_play_curr();
+ break;
+
+ case 11:
+ _val4 = 47;
+ kernel_trigger_dispatch_now(5);
+ _val3 = 41;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 12:
+ _G(flags)[V073] = 1;
+ player_set_commands_allowed(true);
+ _val3 = 41;
+ kernel_trigger_dispatch_now(4);
+ break;
+
+ case 13:
+ _G(flags)[V070] = 1;
+ player_set_commands_allowed(true);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 1:
+ player_set_commands_allowed(false);
+ _val1 = 26;
+ break;
+
+ case 2:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY1, "145wi04", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 3:
+ player_set_commands_allowed(false);
+ loadSeries1();
+ ws_hide_walker();
+ _G(wilbur_should) = 4;
+ _general.play("145wi02", 0xa00, 16, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 14);
+ digi_play("145w020", 1, 255, -1);
+ break;
+
+ case 4:
+ _val1 = 28;
+ break;
+
+ case 5:
+ _general.terminate();
+ _G(wilbur_should) = 7;
+ series_play_with_breaks(PLAY3, "145wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 6:
+ disable_player();
+ _G(wilbur_should) = 10001;
+ series_play_with_breaks(PLAY4, "145wi03", 0xa01, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 7:
+ ws_unhide_walker();
+ break;
+
+ case 8:
+ player_set_commands_allowed(false);
+ ws_hide_walker();
+ terminateMachineAndNull(_amplifier);
+ _G(wilbur_should) = 9;
+ series_play_with_breaks(PLAY2, "145wi04", 0xa01, gCHANGE_WILBUR_ANIMATION, 3);
+ break;
+
+ case 9:
+ hotspot_set_active("AMPLIFIER ", false);
+ inv_give_to_player("AMPLIFIER");
+ break;
+
+ case 10:
+ player_set_commands_allowed(false);
+
+ if (_state2) {
+ kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ } else {
+ _val4 = 44;
+ kernel_trigger_dispatch_now(5);
+ }
+ break;
+
+ case 11:
+ player_set_commands_allowed(false);
+
+ if (_val2 == 101) {
+ _val2 = 0;
+ resetRoxy();
+ } else {
+ kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+
// TODO
}
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 6cf348f9be9..8963f5b3797 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -68,6 +68,7 @@ private:
const char *_digiName1 = nullptr;
const char *_digiName2 = nullptr;
bool _flag1 = false;
+ int _duration = 0;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
Commit: 8a375b2dbeadb78cbdba4166e23cfc480afb6897
https://github.com/scummvm/scummvm/commit/8a375b2dbeadb78cbdba4166e23cfc480afb6897
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added missing room 141 method
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 631f319558c..ab2f01c77b7 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -170,6 +170,7 @@ void Room141::init() {
series_load("140pe01");
series_load("140pe01s");
+ loadSeries();
digi_preload("20n01011", 140);
digi_preload("20n01012", 140);
digi_preload("20n01013", 140);
@@ -1084,6 +1085,20 @@ void Room141::playRandom() {
}
}
+void Room141::loadSeries() {
+ static const char *NAMES[34] = {
+ "140pe02", "140pe02s", "140pe03", "140pe03s", "140pe04",
+ "140pe04s", "140pe06", "140pe06s", "140pe07", "140pe07s",
+ "140pe08", "140pe08s", "140pe09", "140pe09s", "140pe11",
+ "140pe11s", "140pe13", "140pe13s", "140pe14", "140pe14s",
+ "140pe15", "140pe15s", "140pe16", "140pe16s", "140pe17",
+ "140pe17s", "140pe18", "140pe18s", "140pe19", "140pe19s",
+ "140pe20", "140pe20s", "140pe21", "140pe21s"
+ };
+ for (int i = 0; i < 34; ++i)
+ series_load(NAMES[i]);
+}
+
} // namespace Rooms
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 9c7d402ee75..e318a4bd319 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -44,6 +44,7 @@ private:
void conv20();
void playRandom();
+ void loadSeries();
public:
Room141() : Room() {}
Commit: 6159d3648d21c9c9e34673880e0cb703ca9a0c18
https://github.com/scummvm/scummvm/commit/6159d3648d21c9c9e34673880e0cb703ca9a0c18
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added room 102 conv methods
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 800df352ca2..2fdbb51ddeb 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -135,7 +135,7 @@ void Flags::reset1() {
(*this)[V011] = 0;
(*this)[V012] = 0;
(*this)[V013] = 0;
- (*this)[ROOM101_FLAG1] = 0;
+ (*this)[V014] = 0;
(*this)[V015] = 0;
(*this)[V017] = 0;
(*this)[V018] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 795b29182be..b0c0e44670a 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -46,7 +46,7 @@ enum {
V011 = 11,
V012 = 12,
V013 = 13,
- ROOM101_FLAG1 = 14,
+ V014 = 14,
V015 = 15,
V016 = 16,
V017 = 17,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 0cf93d6add7..a7d332dc096 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -136,8 +136,8 @@ void Room101::init() {
case 102:
player_set_commands_allowed(false);
- if (_G(flags)[ROOM101_FLAG1]) {
- _G(flags)[ROOM101_FLAG1] = 0;
+ if (_G(flags)[V014]) {
+ _G(flags)[V014] = 0;
ws_demand_facing(_G(my_walker), 10);
ws_demand_location(_G(my_walker), 338, 265);
_G(wilbur_should) = 16;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 0b191169c65..b342ea37f92 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -678,7 +678,7 @@ void Room102::daemon() {
if (_G(flags)[V013]) {
_play1 = "102h204";
_val11 = 56;
- _G(flags)[ROOM101_FLAG1] = 1;
+ _G(flags)[V014] = 1;
} else {
_val11 = 55;
_play1 = _G(flags)[V015] ? "102h203" : "102h201";
@@ -1514,15 +1514,209 @@ void Room102::freshen() {
}
void Room102::conv04() {
- error("TODO: conv04");
+ _G(kernel).trigger_mode = KT_PARSE;
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 22) {
+ if (who <= 0) {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (node == 1 && entry == 0) {
+ _val11 = 26;
+ kernel_trigger_dispatch_now(3);
+ player_update_info();
+ ws_walk(192, 327, 0, -1, 4);
+ } else if (node == 4 && entry == 0) {
+ digi_preload("102_030");
+ digi_preload("102_031");
+ digi_preload("102_032");
+ digi_preload("102_033");
+ _val1 = 28;
+ kernel_trigger_dispatch_now(3);
+ } else if ((node == 4 && entry == 1) || (node == 4 && entry == 2)) {
+ _val1 = 35;
+ conv_resume_curr();
+ } else {
+ _val1 = 19;
+ kernel_trigger_dispatch_now(3);
+ conv_resume_curr();
+ }
+ } else if (who == 1) {
+ if (node == 4 && entry == 1) {
+ // Nothing
+ } else if (node == 4 && entry == 2) {
+ _val13 = 58;
+ conv_resume_curr();
+ } else {
+ _G(wilbur_should) = 10002;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ conv_resume_curr();
+ }
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if ((node == 4 && entry == 1) || (node == 4 && entry == 2)) {
+ _val11 = 36;
+ digi_play(sound, 1, 255, 22);
+ _G(flags)[V012] = 1;
+ } else {
+ queuePlay(sound, 22, KT_PARSE);
+ }
+ } else if (who == 1) {
+ player_update_info();
+
+ if (_G(walkTrigger) != 2) {
+ ws_walk(192, 327, 0, 7, 2);
+ } else if (node == 4 && entry == 1) {
+ digi_preload("04p0502", 102);
+ digi_play(sound, 1, 255, 22);
+ } else if (node == 4 && entry == 2) {
+ _val13 = 60;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(4);
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(sound, 1, 255, 22);
+ } else {
+ wilbur_speech(sound, 22);
+ }
+ }
+ } else {
+ conv_resume_curr();
+ }
}
void Room102::conv05() {
- error("TODO: conv05");
+ _G(kernel).trigger_mode = KT_PARSE;
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 22) {
+ if (who <= 0) {
+ if ((node == 1 && entry == 3) || (node == 3 && entry == 9) ||
+ (node == 5 && entry == 8) || (node == 2)) {
+ _val11 = 41;
+ conv_resume_curr();
+ } else if ((node == 1 && entry == 0) || (node == 3 && entry == 8) ||
+ (node == 5 && entry == 7)) {
+ _val11 = _G(flags)[V019] ? 38 : 37;
+ conv_resume_curr();
+ } else {
+ _val11 = 55;
+ conv_resume_curr();
+ }
+ } else if (who == 1) {
+ _val13 = 58;
+ conv_resume_curr();
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ _val11 = 36;
+ } else if (who == 1) {
+ if ((node == 1 && entry == 1) || (node == 3 && entry == 0) ||
+ (node == 3 && entry == 3) || (node == 5 && entry == 3)) {
+ _val13 = 61;
+ } else {
+ _val13 = 60;
+ }
+
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(4);
+ }
+
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(sound, 1, 255, 22);
+ } else {
+ conv_resume_curr();
+ }
}
void Room102::conv06() {
- error("TODO: conv06");
+ _G(kernel).trigger_mode = KT_PARSE;
+ const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
+ int node = conv_current_node();
+ int entry = conv_current_entry();
+
+ if (_G(kernel).trigger == 22) {
+ if (who <= 0) {
+ if (node == 2) {
+ _val11 = 19;
+ _G(kernel).trigger_mode = KT_PARSE;
+ kernel_trigger_dispatch_now(3);
+ } else if (node == 1 && entry == 4) {
+ _G(flags)[V014] = 1;
+ _val11 = 43;
+ } else if (node != 1 || entry != 1) {
+ _val11 = 43;
+ }
+
+ conv_resume_curr();
+
+ } else if (who == 1) {
+ if (node == 1 && entry == 1) {
+ _val13 = 63;
+ } else if (node == 2) {
+ _val11 = _G(flags)[GLB_TEMP_4] == 1 ? 49 : 48;
+ _val13 = 58;
+ } else {
+ _val13 = 58;
+ conv_resume_curr();
+ }
+ }
+ } else if (sound) {
+ if (who <= 0) {
+ if (node == 1 && entry == 3) {
+ _G(flags)[GLB_TEMP_4] = 3;
+
+ if (_G(flags)[GLB_TEMP_5] == 1)
+ _G(flags)[V021] = 10034;
+ }
+
+ if (node == 2) {
+ term_message("gonna_say_sheepdog %d %d", _val12, _val11);
+ queuePlay(sound, 22, KT_PARSE);
+ _flag1 = true;
+ } else if (node == 1 && entry == 1) {
+ _G(flags)[GLB_TEMP_4] = 1;
+ _G(flags)[V001] -= 8;
+
+ if (_G(flags)[GLB_TEMP_5] == 1)
+ _G(flags)[V021] = 10032;
+ } else if (node == 1 && entry == 4) {
+ _val11 = 21;
+ _G(flags)[GLB_TEMP_4] = 2;
+
+ if (_G(flags)[GLB_TEMP_5] == 1)
+ _G(flags)[V021] = 10033;
+
+ _G(flags)[V013] = 1;
+ _flag1 = false;
+ } else {
+ _val11 = 20;
+ }
+
+ } else if (who == 1) {
+ if (_val14 == 64) {
+ kernel_timing_trigger(30, 7);
+ } else {
+ _val13 = 60;
+ _G(kernel).trigger_mode = KT_DAEMON;
+ kernel_trigger_dispatch_now(4);
+ }
+ }
+
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(sound, 1, 255, 22);
+
+ } else {
+ conv_resume_curr();
+ }
}
Commit: 6dfd674efc03ed0cf32d4a53fd2f7d0a75661a3f
https://github.com/scummvm/scummvm/commit/6dfd674efc03ed0cf32d4a53fd2f7d0a75661a3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added section 5 daemon
Changed paths:
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
engines/m4/burger/rooms/section5/section5_room.cpp
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index fa9db1a1e6d..40388e6465d 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -146,13 +146,6 @@ const seriesPlayBreak Room407::PLAY18[] = {
PLAY_BREAK_END
};
-const seriesPlayBreak Room407::PLAY19[] = {
- { 0, 25, 0, 1, 0, -1, 2048, 0, 0, 0 },
- { 26, 42, "500_030", 1, 255, -1, 0, 0, 0, 0 },
- { 43, -1, "500_030", 1, 255, -1, 0, 0, 0, 0 },
- PLAY_BREAK_END
-};
-
long Room407::_state1;
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index c31e63fe413..f20513717f1 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -51,7 +51,6 @@ private:
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
static const seriesPlayBreak PLAY18[];
- static const seriesPlayBreak PLAY19[];
static long _state1;
Series _vp02;
Series _dz;
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 52fd04c2cb2..c484b8bb77d 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -29,7 +29,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-static const char *PARSER[] = {
+const char *Section5::PARSER[] = {
"GIZMO",
"LOOK AT",
"500w006",
@@ -311,8 +311,16 @@ static const char *PARSER[] = {
nullptr
};
+const seriesPlayBreak Section5::PLAY1[] = {
+ { 0, 25, 0, 1, 0, -1, 2048, 0, 0, 0 },
+ { 26, 42, "500_030", 1, 255, -1, 0, 0, 0, 0 },
+ { 43, -1, "500_030", 1, 255, -1, 0, 0, 0, 0 },
+ PLAY_BREAK_END
+};
+
machine *Section5::_bork;
const char *Section5::_digiName;
+const char *Section5::_bgDigiName;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
@@ -342,8 +350,179 @@ void Section5::init() {
}
void Section5::daemon() {
- // TODO: daemon method
- _G(kernel).continue_handling_trigger = true;
+ switch (_G(kernel).trigger) {
+ case 5001:
+ flagsTrigger();
+ break;
+
+ case 5002:
+ break;
+
+ case 5003: {
+ term_message("SET AMBIENCE trigger hit");
+ Section5Room *room = dynamic_cast<Section5Room *>(g_engine->_activeRoom);
+ assert(room);
+ room->init();
+ break;
+ }
+
+ case 5004:
+ term_message("Bork ambient noises trigger hit");
+
+ if (!digi_play_state(1) && _bgDigiName) {
+ digi_unload(_bgDigiName);
+ _bgDigiName = nullptr;
+ }
+
+ if (!digi_play_state(1) && !digi_play_state(2)) {
+ // FIXME: The original does a random of 1 to 9, but the switch has 1 to 13.
+ // Check if extra cases are valid, and if so, re-enable them
+ switch (imath_ranged_rand(1, 9)) {
+ case 1:
+ _bgDigiName = "500_015";
+ break;
+ case 2:
+ _bgDigiName = "500_016";
+ break;
+ case 3:
+ _bgDigiName = "500_017";
+ break;
+ case 4:
+ _bgDigiName = "500_018";
+ break;
+ case 5:
+ _bgDigiName = "500_019";
+ break;
+ case 6:
+ _bgDigiName = "500_020";
+ break;
+ case 7:
+ _bgDigiName = "500_021";
+ break;
+ case 8:
+ _bgDigiName = "500_022";
+ break;
+ case 9:
+ _bgDigiName = "500_023";
+ break;
+ case 10:
+ _bgDigiName = "500_024";
+ break;
+ case 11:
+ _bgDigiName = "500_025";
+ break;
+ case 12:
+ _bgDigiName = "500_026";
+ break;
+ case 13:
+ _bgDigiName = "500_027";
+ break;
+ default:
+ break;
+ }
+
+ digi_preload(_bgDigiName);
+ digi_play(_bgDigiName, 1, 125, -1);
+ }
+
+ kernel_timing_trigger(imath_ranged_rand(240, 360), 5004);
+ break;
+
+ case 5006:
+ _G(game).new_room = 502;
+ break;
+
+ case 5007:
+ _G(game).new_room = 503;
+ break;
+
+ case 5008:
+ _G(game).new_room = 504;
+ break;
+
+ case 5009:
+ _G(game).new_room = 505;
+ break;
+
+ case 5010:
+ _G(game).new_room = 506;
+ break;
+
+ case 5011:
+ _G(game).new_room = 507;
+ break;
+
+ case 5012:
+ _G(game).new_room = 508;
+ break;
+
+ case 5013:
+ _G(game).new_room = 509;
+ break;
+
+ case 5014:
+ player_update_info();
+ _G(flags)[V187] = _G(player_info).x;
+ _G(flags)[V188] = _G(player_info).y;
+ _G(flags)[V189] = _G(walkTrigger);
+ _G(game).new_room = 510;
+ break;
+
+ case 5015:
+ _G(game).new_room = 511;
+ break;
+
+ case 5016:
+ _G(game).new_room = 512;
+ break;
+
+ case 5017:
+ _G(game).new_room = 513;
+ break;
+
+ case 5018:
+ disable_player_commands_and_fade_init(5017);
+ break;
+
+ case gCHANGE_WILBUR_ANIMATION:
+ switch (_G(wilbur_should)) {
+ case 5001:
+ _G(flags)[V234] = 1;
+ ws_hide_walker();
+ _G(wilbur_should) = 5002;
+ player_update_info();
+ series_play_with_breaks(PLAY1, "503wi07", _G(player_info).depth,
+ gCHANGE_WILBUR_ANIMATION, 3, _G(player_info).scale,
+ _G(player_info).x, _G(player_info).y);
+ break;
+
+ case 5002:
+ inv_move_object("RUBBER GLOVES", NOWHERE);
+ ws_unhide_walker();
+ player_set_commands_allowed(true);
+ wilbur_speech("500w077");
+ break;
+
+ case 5003:
+ player_set_commands_allowed(false);
+ ws_unhide_walker();
+ wilbur_speech("500w092", 5018);
+ break;
+
+ case 10015:
+ _G(game).new_room = 512;
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
+ break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
+ }
}
void Section5::parser() {
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 0d390ad2098..346433a27b7 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -65,8 +65,11 @@ private:
void gizmoDigiPlay(const char *name, int vol, bool &done);
public:
+ static const char *PARSER[];
+ static const seriesPlayBreak PLAY1[];
static machine *_bork;
static const char *_digiName;
+ static const char *_bgDigiName;
static bool checkFlags();
static void flagsTrigger();
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index f81ddc6e24d..78bfafdb036 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -32,6 +32,8 @@ void Section5Room::preload() {
Rooms::Room::preload();
_G(flags)[V186] = 0;
_initFlag = false;
+ Section5::_digiName = nullptr;
+ Section5::_bgDigiName = nullptr;
}
void Section5Room::init() {
Commit: b35af25ac5bc9f3a2cf4566a9befbbd34e4f4ae1
https://github.com/scummvm/scummvm/commit/b35af25ac5bc9f3a2cf4566a9befbbd34e4f4ae1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of section 5 gizmo gui
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 3ddce52363f..beec620844d 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -24,7 +24,10 @@
#include "m4/core/errors.h"
#include "m4/adv_r/adv_background.h"
#include "m4/adv_r/adv_control.h"
+#include "m4/graphics/gr_sprite.h"
+#include "m4/gui/gui_event.h"
#include "m4/mem/mem.h"
+#include "m4/platform/keys.h"
namespace M4 {
namespace Burger {
@@ -35,7 +38,8 @@ static void gizmo_restore_interface(bool fade);
static void gizmo_free_gui(ScreenContext *screenContext);
static bool gizmo_load_sprites(const char *name, size_t count);
static void gizmo_free_sprites();
-static ScreenContext *gui_create_gizmo(M4sprite *sprite, int zero1, int zero2, int v505);
+static void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY);
+static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags);
void gizmo_anim(RGB8 *pal) {
if (!_GIZMO(initialized))
@@ -151,7 +155,80 @@ static void gizmo_free_sprites() {
}
}
-static ScreenContext *gui_create_gizmo(M4sprite *sprite, int zero1, int zero2, int v505) {
+void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY) {
+ Buffer src;
+ DrawRequest dr;
+
+ if (sprite && dest) {
+ HLock(sprite->sourceHandle);
+ sprite->data = (uint8 *)((intptr)*sprite->sourceHandle + sprite->sourceOffset);
+ src.stride = src.w = sprite->w;
+ src.h = sprite->h;
+ src.encoding = sprite->encoding & 0x7f;
+ src.data = sprite->data;
+
+ dr.Src = &src;
+ dr.Dest = dest;
+ dr.x = destX;
+ dr.y = destY;
+ dr.scaleX = dr.scaleY = 100;
+ dr.srcDepth = 0;
+ dr.depthCode = nullptr;
+ dr.Pal = nullptr;
+ dr.ICT = nullptr;
+ gr_sprite_draw(&dr);
+ HUnLock(sprite->sourceHandle);
+ }
+}
+
+static void gui_gizmo_show(ScreenContext *s, RectList *r, Buffer *dest, int32 destX, int32 destY) {
+ if (!s)
+ return;
+ void *scrnContent = s->scrnContent;
+ if (!scrnContent)
+ return;
+
+ GrBuff *buf = (GrBuff *)s->scrnContent;
+ if (!buf)
+ return;
+ Buffer *src = buf->get_buffer();
+ if (!src)
+ return;
+
+ if (dest) {
+ for (RectList *rect = r; rect; rect = rect->next) {
+ vmng_refresh_video(rect->x1, rect->y1,
+ rect->x1 - s->x1, rect->y1 - s->y1, rect->x2 - s->x1, rect->y2 - s->y1,
+ src);
+ }
+ } else {
+ for (RectList *rect = r; rect; rect = rect->next) {
+ gr_buffer_rect_copy_2(src, dest,
+ rect->x1 - s->x1, rect->y1 - s->y1, destX, destY,
+ rect->x2 - rect->x1 + 1, rect->y2 - rect->y1 + 1);
+ }
+ }
+}
+
+static bool gui_gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+ ScreenContext *srcBuffer = (ScreenContext *)s;
+ *z = false;
+ /*
+ int32 status = 0;
+ ScreenContext *ctx = vmng_screen_find(s, &status);
+ if (!ctx || status != 1)
+ return false;
+
+ if (eventType == EVENT_KEY && event == KEY_ESCAPE && myScreen->y1 != 0) {
+ _GIZMO(val1) = 0;
+
+ }
+ */
+ // TODO: event handler
+ return false;
+}
+
+static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags) {
if (!sprite)
return nullptr;
@@ -161,10 +238,25 @@ static ScreenContext *gui_create_gizmo(M4sprite *sprite, int zero1, int zero2, i
GrBuff *grBuff = new GrBuff(sprite->w, sprite->h);
gui->_grBuff = grBuff;
+ gui->_eventHandler = gui_gizmo_eventHandler;
+
+ Buffer *dest = gui->_grBuff->get_buffer();
+ Buffer *src = _G(gameDrawBuff)->get_buffer();
+
+ if ((_G(gameDrawBuff)->h - sy) >= dest->h) {
+ gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, dest->w, dest->h);
+ } else {
+ gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, dest->w, _G(gameDrawBuff)->h - sy);
+ }
+
+ _G(gameDrawBuff)->release();
+ if (sprite->sourceHandle)
+ gizmo_draw_sprite(sprite, dest, 0, 0);
+ gui->_grBuff->release();
- // TODO: More stuff
- return nullptr;
+ return vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
+ 69, scrnFlags, gui, (RefreshFunc)gui_gizmo_show, gui_gizmo_eventHandler);
}
} // namespace GUI
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index c484b8bb77d..98f5dfe4be2 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -549,7 +549,7 @@ void Section5::parser() {
void Section5::takeGizmo(RGB8 *pal) {
if (player_commands_allowed() && INTERFACE_VISIBLE &&
!_G(pal_fade_in_progress) && !_GIZMO(initialized)) {
- gizmoAnim(pal);
+ GUI::gizmo_anim(pal);
player_set_commands_allowed(false);
if (_G(flags)[V238] == 0) {
@@ -562,10 +562,6 @@ void Section5::takeGizmo(RGB8 *pal) {
}
}
-void Section5::gizmoAnim(RGB8 *pal) {
- // TODO
-}
-
void Section5::gizmoDigiPlay(const char *name, int vol, bool &done) {
if (!done) {
done = true;
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 346433a27b7..33fda7aba07 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -61,7 +61,6 @@ private:
bool _gizmoRoomNums[15];
void takeGizmo(RGB8 *pal);
- void gizmoAnim(RGB8 *pal);
void gizmoDigiPlay(const char *name, int vol, bool &done);
public:
Commit: b1168889ec82b8e169054d637c84f7a967003aba
https://github.com/scummvm/scummvm/commit/b1168889ec82b8e169054d637c84f7a967003aba
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding more gizmo functions
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index beec620844d..ee8d5c774e8 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -26,6 +26,7 @@
#include "m4/adv_r/adv_control.h"
#include "m4/graphics/gr_sprite.h"
#include "m4/gui/gui_event.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/platform/keys.h"
@@ -49,6 +50,7 @@ void gizmo_anim(RGB8 *pal) {
_GIZMO(gui) = gui_create_gizmo(_GIZMO(sprites)[0], 0, 0, 505);
if (_GIZMO(gui)) {
+
// TODO
}
}
@@ -211,9 +213,10 @@ static void gui_gizmo_show(ScreenContext *s, RectList *r, Buffer *dest, int32 de
}
static bool gui_gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+ /*
ScreenContext *srcBuffer = (ScreenContext *)s;
*z = false;
- /*
+
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(s, &status);
if (!ctx || status != 1)
@@ -228,6 +231,88 @@ static bool gui_gizmo_eventHandler(void *s, int32 eventType, int32 event, int32
return false;
}
+static void gizmo_item_fn1(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2) {
+ // TODO
+}
+
+static void gizmo_item_fn2(GizmoItem *item) {
+ // TODO
+}
+
+static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
+ if (!gizmo || !gizmo->_grBuff)
+ return nullptr;
+
+ GrBuff *grBuff = new GrBuff(w, h);
+ Buffer *src = gizmo->_grBuff->get_buffer();
+ Buffer *dest = grBuff->get_buffer();
+ assert(src && dest);
+
+ gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, w, h);
+ gizmo->_grBuff->release();
+ grBuff->release();
+
+ return grBuff;
+}
+
+static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
+ int boundsX, int boundsY, int boundsW, int boundsH,
+ int rect1X, int rect1Y, int rect1W, int rect1H, int arg5,
+ int arg6, int arg7, bool hasBuffer, int arg9, int arg10) {
+ if (!gizmo)
+ return nullptr;
+
+ // Create new item
+ GizmoItem *item = (GizmoItem *)mem_alloc(sizeof(GizmoItem), "*gui gizmo item");
+ assert(item);
+
+ // Put the new item at the head of the list
+ item->_next = gizmo->_items;
+ item->_prior = nullptr;
+ item->_gizmo = gizmo;
+
+ if (gizmo->_items)
+ gizmo->_items->_prior = item;
+ gizmo->_items = item;
+
+ // Set fields
+ item->_id = id;
+ item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
+ boundsY + boundsH - 1);
+ item->_rect1 = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y - rect1H - 1);
+ item->_field39 = arg5;
+
+ item->_hasBuffer = hasBuffer;
+ if (hasBuffer) {
+ item->_grBuff = gizmo_create_buffer(gizmo, rect1X, rect1Y, rect1W, rect1H);
+ } else {
+ item->_grBuff = nullptr;
+ }
+
+ GizmoButton *btn = (GizmoButton *)mem_alloc(sizeof(GizmoButton), "*gizmo button");
+ assert(btn);
+
+ btn->_field4 = arg6;
+ btn->_field8 = arg9;
+ btn->_field10 = id - 1000;
+ item->_button = btn;
+
+ item->_fn1 = gizmo_item_fn1;
+ item->_fn2 = gizmo_item_fn2;
+ item->_field45 = arg10;
+ (*item->_fn1)(item, gizmo, rect1X, rect1Y, 0, 0);
+
+ int32 status = 0;
+ ScreenContext *ctx = vmng_screen_find(gizmo, &status);
+
+ if (ctx && status == 1) {
+ RestoreScreens(ctx->x1 + item->_bounds.left, ctx->y1 + item->_bounds.top,
+ ctx->x1 + item->_bounds.right, ctx->y1 + item->_bounds.bottom);
+ }
+
+ return item;
+}
+
static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags) {
if (!sprite)
return nullptr;
@@ -238,6 +323,8 @@ static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint sc
GrBuff *grBuff = new GrBuff(sprite->w, sprite->h);
gui->_grBuff = grBuff;
+ //gui->_items = nullptr;
+
gui->_eventHandler = gui_gizmo_eventHandler;
Buffer *dest = gui->_grBuff->get_buffer();
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 0deaa1a0c40..cbe7f502cab 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -23,6 +23,7 @@
#ifndef M4_BURGER_GUI_GIZMO_H
#define M4_BURGER_GUI_GIZMO_H
+#include "common/rect.h"
#include "m4/m4_types.h"
#include "m4/gui/gui_vmng_core.h"
#include "m4/graphics/gr_buff.h"
@@ -49,20 +50,42 @@ struct Gizmo_Globals {
M4sprite **_sprites = nullptr;
};
+struct GizmoItem;
+
struct Gizmo {
GrBuff *_grBuff = nullptr;
- int _field4 = 0;
+ GizmoItem *_items = nullptr;
int _field8 = 0;
int _fieldC = 0;
EventHandler _eventHandler = nullptr;
};
-struct GizmoItem {
- // TODO
+struct GizmoButton {
+ int _field0 = 0;
+ int _field4 = 0;
+ int _field8 = 0;
+ int _fieldC = 0;
+ int _field10 = 0;
};
-struct GizmoButton {
- // TODO
+typedef void (*GizmoItemFn1)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
+typedef void (*GizmoItemFn2)(GizmoItem *item);
+
+struct GizmoItem {
+ GizmoItem *_next = nullptr;
+ GizmoItem *_prior = nullptr;
+ Gizmo *_gizmo = nullptr;
+ GrBuff *_grBuff = nullptr;
+ GizmoButton *_button = nullptr;
+
+ int _id = 0;
+ Common::Rect _bounds;
+ Common::Rect _rect1;
+ bool _hasBuffer = false;
+ int _field39 = 0;
+ GizmoItemFn1 _fn1 = nullptr;
+ GizmoItemFn2 _fn2 = nullptr;
+ int _field45 = 0;
};
extern void gizmo_anim(RGB8 *pal);
Commit: 96854b2e719ee3d19043c927697ad4adf97478d7
https://github.com/scummvm/scummvm/commit/96854b2e719ee3d19043c927697ad4adf97478d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding gizmo digi play
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index ee8d5c774e8..d7bf3190414 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -26,9 +26,11 @@
#include "m4/adv_r/adv_control.h"
#include "m4/graphics/gr_sprite.h"
#include "m4/gui/gui_event.h"
+#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/platform/keys.h"
+#include "m4/m4.h"
namespace M4 {
namespace Burger {
@@ -41,6 +43,24 @@ static bool gizmo_load_sprites(const char *name, size_t count);
static void gizmo_free_sprites();
static void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY);
static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags);
+static void gizmo_digi_daemon(int trigger);
+
+void gizmo_digi_play(const char *name, int vol, bool &done) {
+ if (!done) {
+ done = true;
+ digi_play(name, 2, vol);
+ digi_read_another_chunk();
+ player_set_commands_allowed(false);
+
+ while (!g_engine->shouldQuit() && digi_play_state(2)) {
+ digi_read_another_chunk();
+ midi_loop();
+ gui_system_event_handler();
+ }
+
+ player_set_commands_allowed(true);
+ }
+}
void gizmo_anim(RGB8 *pal) {
if (!_GIZMO(initialized))
@@ -78,6 +98,69 @@ void gizmo_shutdown(void *, void *) {
gizmo_restore_interface(true);
}
+static void gizmo_digi_daemon(int trigger) {
+ switch (trigger) {
+ case 5000:
+ if (player_been_here(503)) {
+ if (_G(flags)[kBORK_STATE] == 16)
+ gizmo_digi_play("510w005", 255, _GIZMO(roomNums)[3]);
+ else
+ gizmo_digi_play("510w004", 255, _GIZMO(roomNums)[2]);
+ }
+ break;
+
+ case 5001:
+ if (player_been_here(507)) {
+ if (_G(flags)[V223] == 2)
+ gizmo_digi_play("510w008", 255, _GIZMO(roomNums)[5]);
+ else
+ gizmo_digi_play("510w007", 255, _GIZMO(roomNums)[4]);
+ }
+ break;
+
+ case 5002:
+ if (player_been_here(504)) {
+ if (_G(flags)[V210] == 5002)
+ gizmo_digi_play("510w011", 255, _GIZMO(roomNums)[7]);
+ else
+ gizmo_digi_play("510w010", 255, _GIZMO(roomNums)[6]);
+ }
+ break;
+
+ case 5003:
+ if (player_been_here(508)) {
+ if (_G(flags)[V227] != 0)
+ gizmo_digi_play("510w014", 255, _GIZMO(roomNums)[9]);
+ else
+ gizmo_digi_play("510w013", 255, _GIZMO(roomNums)[8]);
+ }
+ break;
+
+ case 5004:
+ if (player_been_here(506)) {
+ if (_G(flags)[V218] == 5003)
+ gizmo_digi_play("510w017", 255, _GIZMO(roomNums)[11]);
+ else
+ gizmo_digi_play("510w016", 255, _GIZMO(roomNums)[10]);
+ }
+ break;
+
+ case 5005:
+ if (_G(flags)[V200] == 5003)
+ gizmo_digi_play("510w019", 255, _GIZMO(roomNums)[13]);
+ else
+ gizmo_digi_play("510w018", 255, _GIZMO(roomNums)[12]);
+ break;
+
+ case 5006:
+ gizmo_digi_play("510w020", 255, _GIZMO(roomNums)[14]);
+ break;
+
+ default:
+ break;
+ }
+}
+
static void gizmo_restore_interface(bool fade) {
if (_GIZMO(initialized)) {
_GIZMO(val1) = 0;
@@ -255,10 +338,15 @@ static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
return grBuff;
}
+static void gizmo_item_fn3() {
+ // TODO
+}
+
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
int boundsX, int boundsY, int boundsW, int boundsH,
- int rect1X, int rect1Y, int rect1W, int rect1H, int arg5,
- int arg6, int arg7, bool hasBuffer, int arg9, int arg10) {
+ int rect1X, int rect1Y, int rect1W, int rect1H,
+ GizmoItemFn0 fn0, int arg6, int arg7 = 0, bool hasBuffer = false,
+ int arg9 = 0, GizmoItemFn3 fn3 = gizmo_item_fn3) {
if (!gizmo)
return nullptr;
@@ -280,7 +368,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
boundsY + boundsH - 1);
item->_rect1 = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y - rect1H - 1);
- item->_field39 = arg5;
+ item->_fn0 = fn0;
item->_hasBuffer = hasBuffer;
if (hasBuffer) {
@@ -299,7 +387,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_fn1 = gizmo_item_fn1;
item->_fn2 = gizmo_item_fn2;
- item->_field45 = arg10;
+ item->_fn3 = fn3;
(*item->_fn1)(item, gizmo, rect1X, rect1Y, 0, 0);
int32 status = 0;
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index cbe7f502cab..9fba71d0dc5 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -48,6 +48,7 @@ struct Gizmo_Globals {
char *_assetName = nullptr;
int _spriteCount = 0;
M4sprite **_sprites = nullptr;
+ bool _roomNums[15];
};
struct GizmoItem;
@@ -68,8 +69,10 @@ struct GizmoButton {
int _field10 = 0;
};
+typedef void (*GizmoItemFn0)();
typedef void (*GizmoItemFn1)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
typedef void (*GizmoItemFn2)(GizmoItem *item);
+typedef void (*GizmoItemFn3)();
struct GizmoItem {
GizmoItem *_next = nullptr;
@@ -82,15 +85,16 @@ struct GizmoItem {
Common::Rect _bounds;
Common::Rect _rect1;
bool _hasBuffer = false;
- int _field39 = 0;
+ GizmoItemFn0 _fn0 = nullptr;
GizmoItemFn1 _fn1 = nullptr;
GizmoItemFn2 _fn2 = nullptr;
- int _field45 = 0;
+ GizmoItemFn3 _fn3 = nullptr;
};
extern void gizmo_anim(RGB8 *pal);
extern void gizmo_initialize(RGB8 *pal);
extern void gizmo_shutdown(void *, void *);
+extern void gizmo_digi_play(const char *name, int vol, bool &done);
} // namespace GUI
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 98f5dfe4be2..bf0ad121f79 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -325,7 +325,7 @@ const char *Section5::_bgDigiName;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
_digiName = nullptr;
- Common::fill(_gizmoRoomNums, _gizmoRoomNums + 15, false);
+ Common::fill(_GIZMO(roomNums), _GIZMO(roomNums) + 15, false);
add(501, &_room501);
add(502, &_room502);
@@ -553,32 +553,15 @@ void Section5::takeGizmo(RGB8 *pal) {
player_set_commands_allowed(false);
if (_G(flags)[V238] == 0) {
- gizmoDigiPlay("510w001", 255, _gizmoRoomNums[0]);
+ GUI::gizmo_digi_play("510w001", 255, _GIZMO(roomNums)[0]);
++_G(flags)[V238];
} else if (_G(flags)[V238] == 1) {
- gizmoDigiPlay("510w002", 255, _gizmoRoomNums[1]);
+ GUI::gizmo_digi_play("510w002", 255, _GIZMO(roomNums)[1]);
++_G(flags)[V238];
}
}
}
-void Section5::gizmoDigiPlay(const char *name, int vol, bool &done) {
- if (!done) {
- done = true;
- digi_play(name, 2, vol);
- digi_read_another_chunk();
- player_set_commands_allowed(false);
-
- while (!g_engine->shouldQuit() && digi_play_state(2)) {
- digi_read_another_chunk();
- midi_loop();
- gui_system_event_handler();
- }
-
- player_set_commands_allowed(true);
- }
-}
-
bool Section5::checkFlags() {
return _G(flags)[V197] && _G(flags)[V200] == 5003 &&
_G(flags)[V210] == 5002 && _G(flags)[V218] == 5003 &&
diff --git a/engines/m4/burger/rooms/section5/section5.h b/engines/m4/burger/rooms/section5/section5.h
index 33fda7aba07..2c0bea4def9 100644
--- a/engines/m4/burger/rooms/section5/section5.h
+++ b/engines/m4/burger/rooms/section5/section5.h
@@ -58,10 +58,8 @@ private:
Room511 _room511;
Room512 _room512;
Room513 _room513;
- bool _gizmoRoomNums[15];
void takeGizmo(RGB8 *pal);
- void gizmoDigiPlay(const char *name, int vol, bool &done);
public:
static const char *PARSER[];
Commit: ad7ad11d880f1d51b9470ddc946de857fcf943d4
https://github.com/scummvm/scummvm/commit/ad7ad11d880f1d51b9470ddc946de857fcf943d4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Gizmo digi daemons
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index d7bf3190414..ee318f29866 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -22,6 +22,7 @@
#include "m4/burger/gui/gui_gizmo.h"
#include "m4/burger/vars.h"
#include "m4/core/errors.h"
+#include "m4/core/imath.h"
#include "m4/adv_r/adv_background.h"
#include "m4/adv_r/adv_control.h"
#include "m4/graphics/gr_sprite.h"
@@ -38,12 +39,13 @@ namespace GUI {
static void gizmo_dispose_gui();
static void gizmo_restore_interface(bool fade);
-static void gizmo_free_gui(ScreenContext *screenContext);
+static void gizmo_free_gui(Gizmo *gizmo);
static bool gizmo_load_sprites(const char *name, size_t count);
static void gizmo_free_sprites();
static void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY);
-static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags);
+static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags);
static void gizmo_digi_daemon(int trigger);
+static void gizmo_daemon(int trigger);
void gizmo_digi_play(const char *name, int vol, bool &done) {
if (!done) {
@@ -161,6 +163,164 @@ static void gizmo_digi_daemon(int trigger) {
}
}
+static void gizmo_restore_sprite(int spriteIndex) {
+ if (!_GIZMO(gui))
+ return;
+
+ Buffer *dest = _GIZMO(gui)->_grBuff->get_buffer();
+ if (!dest)
+ return;
+
+ if (spriteIndex >= 22)
+ gizmo_draw_sprite(_GIZMO(sprites)[spriteIndex], dest, 270, 38);
+
+ int32 status = 0;
+ ScreenContext *ctx = vmng_screen_find(_GIZMO(gui), &status);
+
+ if (ctx && status == 1)
+ RestoreScreens(270, 38, 381, 93);
+}
+
+static void gizmo_digi_wait(int spriteIndex1, int spriteIndex2) {
+ player_set_commands_allowed(false);
+ digi_read_another_chunk();
+
+ int spriteNum = spriteIndex1;
+ while (digi_play_state(2)) {
+ // Cycle displayed sprite
+ gizmo_restore_sprite(spriteIndex1);
+ spriteNum = (spriteNum == spriteIndex2) ? spriteIndex1 : spriteNum + 1;
+
+ uint32 timer = timer_read_60();
+ while (!g_engine->shouldQuit() && (timer_read_60() - timer) < 6) {
+ digi_read_another_chunk();
+ midi_loop();
+ gui_system_event_handler();
+ }
+ }
+}
+
+static void gizmo_daemon(int trigger) {
+ switch (trigger) {
+ case 5000:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b001a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b001b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b001c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(32, 36);
+ break;
+
+ case 5001:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b002a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b002b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b002c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(27, 31);
+ break;
+
+ case 5002:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b003a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b003b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b003c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(32, 36);
+ break;
+
+ case 5003:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b004a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b004b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b004c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(37, 41);
+ break;
+
+ case 5004:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b005a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b005b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b005c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(42, 46);
+ break;
+
+ case 5005:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b006a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b006b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b006c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(47, 51);
+ break;
+
+ case 5006:
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ digi_play("510b007a", 2, 255, -1);
+ break;
+ case 2:
+ digi_play("510b007b", 2, 255, -1);
+ break;
+ default:
+ digi_play("510b007c", 2, 255, -1);
+ break;
+ }
+
+ gizmo_digi_wait(52, 56);
+ break;
+
+ default:
+ break;
+ }
+
+ gizmo_digi_daemon(trigger);
+}
+
static void gizmo_restore_interface(bool fade) {
if (_GIZMO(initialized)) {
_GIZMO(val1) = 0;
@@ -195,7 +355,7 @@ static void gizmo_dispose_gui() {
}
}
-static void gizmo_free_gui(ScreenContext *screenContext) {
+static void gizmo_free_gui(Gizmo *gizmo) {
// TODO
}
@@ -401,7 +561,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
return item;
}
-static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags) {
+static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags) {
if (!sprite)
return nullptr;
@@ -430,8 +590,9 @@ static ScreenContext *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint sc
gui->_grBuff->release();
- return vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
+ ScreenContext *ctx = vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
69, scrnFlags, gui, (RefreshFunc)gui_gizmo_show, gui_gizmo_eventHandler);
+ return ctx ? gui : nullptr;
}
} // namespace GUI
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 9fba71d0dc5..c5e86f2adca 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -34,14 +34,17 @@ namespace GUI {
#define _GIZMO(X) g_vars->_gizmo._##X
+struct Gizmo;
+struct GizmoItem;
+
struct Gizmo_Globals {
bool _initialized = false;
bool _interface_visible = false;
+ Gizmo *_gui = nullptr;
RGB8 *_palette = nullptr;
bool _lowMemory1 = false;
bool _lowMemory2 = false;
int _val1 = 0;
- ScreenContext *_gui = nullptr;
MemHandle _seriesHandle = nullptr;
int32 _celsOffset = 0;
int32 _palOffset = 0;
@@ -51,8 +54,6 @@ struct Gizmo_Globals {
bool _roomNums[15];
};
-struct GizmoItem;
-
struct Gizmo {
GrBuff *_grBuff = nullptr;
GizmoItem *_items = nullptr;
Commit: 2630633d1f0e8f4bb7a373a15e815012455e73ee
https://github.com/scummvm/scummvm/commit/2630633d1f0e8f4bb7a373a15e815012455e73ee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gizmo_anim
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 9356d262ae4..4ea5c5b41eb 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -23,6 +23,7 @@
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/burger/core/conv.h"
+#include "m4/burger/gui/gui_gizmo.h"
#include "m4/graphics/krn_pal.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
@@ -256,6 +257,10 @@ BurgerEngine::BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc) :
_sections.push_back(&_section9);
}
+BurgerEngine::~BurgerEngine() {
+ GUI::gizmo_shutdown();
+}
+
M4::Vars *BurgerEngine::createVars() {
return new Burger::Vars();
}
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 2457f7d9b36..1775be26b89 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -70,7 +70,7 @@ protected:
public:
BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc);
- ~BurgerEngine() override {}
+ ~BurgerEngine() override;
/**
* Show the engine information
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index ee318f29866..5bfdd221d83 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -64,20 +64,6 @@ void gizmo_digi_play(const char *name, int vol, bool &done) {
}
}
-void gizmo_anim(RGB8 *pal) {
- if (!_GIZMO(initialized))
- gizmo_initialize(pal);
-
- if (gizmo_load_sprites("500gizmo", 58)) {
- _GIZMO(gui) = gui_create_gizmo(_GIZMO(sprites)[0], 0, 0, 505);
-
- if (_GIZMO(gui)) {
-
- // TODO
- }
- }
-}
-
void gizmo_initialize(RGB8 *pal) {
if (!_GIZMO(initialized)) {
_GIZMO(initialized) = true;
@@ -595,6 +581,35 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
return ctx ? gui : nullptr;
}
+void gizmo_anim(RGB8 *pal) {
+ if (!_GIZMO(initialized))
+ gizmo_initialize(pal);
+ if (!gizmo_load_sprites("500gizmo", 58))
+ return;
+
+ Gizmo *gizmo = gui_create_gizmo(_GIZMO(sprites)[0], 0, 0, 505);
+ _GIZMO(gui) = gizmo;
+ assert(gizmo);
+
+ gizmo_add_item(gizmo, 1, 234, 153, 178, 48, 251, 163, 144, 25,
+ []() { gizmo_daemon(5000); }, 0);
+ gizmo_add_item(gizmo, 2, 234, 178, 178, 48, 254, 188, 136, 25,
+ []() { gizmo_daemon(5001); }, 1);
+ gizmo_add_item(gizmo, 3, 235, 203, 178, 48, 256, 212, 128, 27,
+ []() { gizmo_daemon(5002); }, 2);
+ gizmo_add_item(gizmo, 6, 234, 230, 178, 48, 260, 239, 119, 25,
+ []() { gizmo_daemon(5003); }, 3);
+ gizmo_add_item(gizmo, 5, 234, 255, 178, 48, 264, 264, 109, 25,
+ []() { gizmo_daemon(5004); }, 4);
+ gizmo_add_item(gizmo, 6, 234, 278, 178, 48, 266, 289, 102, 25,
+ []() { gizmo_daemon(5005); }, 5);
+ gizmo_add_item(gizmo, 7, 234, 300, 178, 48, 268, 314, 96, 25,
+ []() { gizmo_daemon(5006); }, 6);
+
+ vmng_screen_show(gizmo);
+ mouse_lock_sprite(0);
+}
+
} // namespace GUI
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index c5e86f2adca..0537305c1ed 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -94,7 +94,7 @@ struct GizmoItem {
extern void gizmo_anim(RGB8 *pal);
extern void gizmo_initialize(RGB8 *pal);
-extern void gizmo_shutdown(void *, void *);
+extern void gizmo_shutdown(void *v1 = nullptr, void *v2 = nullptr);
extern void gizmo_digi_play(const char *name, int vol, bool &done);
} // namespace GUI
Commit: a1a46c118979a2d5f8423a911a7fdd46db178e3d
https://github.com/scummvm/scummvm/commit/a1a46c118979a2d5f8423a911a7fdd46db178e3d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix startup crash
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/rooms/section5/section5.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 5bfdd221d83..fc673043943 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -441,7 +441,9 @@ static void gui_gizmo_show(ScreenContext *s, RectList *r, Buffer *dest, int32 de
}
}
-static bool gui_gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
+ warning("TODO: gizmo_eventHandler %d %d", eventType, event);
+
/*
ScreenContext *srcBuffer = (ScreenContext *)s;
*z = false;
@@ -559,7 +561,7 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
gui->_grBuff = grBuff;
//gui->_items = nullptr;
- gui->_eventHandler = gui_gizmo_eventHandler;
+ gui->_eventHandler = gizmo_eventHandler;
Buffer *dest = gui->_grBuff->get_buffer();
Buffer *src = _G(gameDrawBuff)->get_buffer();
@@ -577,7 +579,7 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
gui->_grBuff->release();
ScreenContext *ctx = vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
- 69, scrnFlags, gui, (RefreshFunc)gui_gizmo_show, gui_gizmo_eventHandler);
+ 69, scrnFlags, gui, (RefreshFunc)gui_gizmo_show, gizmo_eventHandler);
return ctx ? gui : nullptr;
}
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index bf0ad121f79..b1d6e7edd8b 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -325,7 +325,6 @@ const char *Section5::_bgDigiName;
Section5::Section5() : Rooms::Section() {
_bork = nullptr;
_digiName = nullptr;
- Common::fill(_GIZMO(roomNums), _GIZMO(roomNums) + 15, false);
add(501, &_room501);
add(502, &_room502);
Commit: c674ef6254f69f5bcaebf1e18122356b0e46e3c5
https://github.com/scummvm/scummvm/commit/c674ef6254f69f5bcaebf1e18122356b0e46e3c5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix setting _borkTable in room 502
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 6cce7275c29..002be766bf1 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -940,6 +940,7 @@ void Room502::setup2() {
kernel_trigger_dispatch_now(18);
} else {
loadSeries3();
+ _borkTable = BORK_TABLE;
_val4 = _G(game).previous_room == 505 ? 33 : 27;
kernel_trigger_dispatch_now(13);
}
Commit: e705cf3d7193a65e3d071e989d7fe5f995036342
https://github.com/scummvm/scummvm/commit/e705cf3d7193a65e3d071e989d7fe5f995036342
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix crash on qutting within section 5 rooms
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 4ea5c5b41eb..3beae455957 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -258,7 +258,6 @@ BurgerEngine::BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc) :
}
BurgerEngine::~BurgerEngine() {
- GUI::gizmo_shutdown();
}
M4::Vars *BurgerEngine::createVars() {
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index fc673043943..e3bda978d06 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -47,6 +47,10 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
static void gizmo_digi_daemon(int trigger);
static void gizmo_daemon(int trigger);
+Gizmo_Globals::~Gizmo_Globals() {
+ mem_free(_gui);
+}
+
void gizmo_digi_play(const char *name, int vol, bool &done) {
if (!done) {
done = true;
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 0537305c1ed..3118e99988a 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -52,6 +52,8 @@ struct Gizmo_Globals {
int _spriteCount = 0;
M4sprite **_sprites = nullptr;
bool _roomNums[15];
+
+ ~Gizmo_Globals();
};
struct Gizmo {
Commit: 52d0f19534dd1f2453c06bb576a47cf1de160735
https://github.com/scummvm/scummvm/commit/52d0f19534dd1f2453c06bb576a47cf1de160735
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In room 510, the 4th button only has two random digis
Changed paths:
engines/m4/burger/rooms/section5/room510.cpp
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index f66c5496cb4..e5ce47139fc 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -262,7 +262,8 @@ void Room510::setButtonState(int index, GUI::ControlStatus state) {
}
void Room510::buttonAction(int index, int firstFrame, int lastFrame) {
- digi_play(Common::String::format("510b00%d%c", index, 'a' + imath_ranged_rand(0, 2)).c_str(), 2);
+ int max = (index == 4) ? 1 : 2;
+ digi_play(Common::String::format("510b00%d%c", index, 'a' + imath_ranged_rand(0, max)).c_str(), 2);
series_play("510waves", 0, 0, 2, 6, 2, 100, 0, 0, firstFrame, lastFrame);
}
Commit: 41ecc0c9a1763ee895f0d9db4a9da0b0f515a4bd
https://github.com/scummvm/scummvm/commit/41ecc0c9a1763ee895f0d9db4a9da0b0f515a4bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect rect calculation in gizmo setup
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index e3bda978d06..659375603fc 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -519,7 +519,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_id = id;
item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
boundsY + boundsH - 1);
- item->_rect1 = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y - rect1H - 1);
+ item->_rect1 = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y + rect1H - 1);
item->_fn0 = fn0;
item->_hasBuffer = hasBuffer;
Commit: e3c06a61b41a7eff0d8d7062bc592f5d0fcb0a00
https://github.com/scummvm/scummvm/commit/e3c06a61b41a7eff0d8d7062bc592f5d0fcb0a00
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gizmo item draw
Changed paths:
engines/m4/adv_r/adv_inv.cpp
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index d9c7fbedc81..c5237264c8f 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -38,7 +38,7 @@ void InventoryBase::syncGame(Common::Serializer &s) {
uint32 inv_size, scene;
int32 i;
- inv_size = _tail * MAX_NAME_LENGTH;
+ inv_size = _tail * (MAX_NAME_LENGTH + sizeof(uint32));
s.syncAsUint32LE(inv_size);
if (s.isLoading()) {
assert((inv_size % (MAX_NAME_LENGTH + sizeof(uint32))) == 0);
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 659375603fc..e45a36e79f4 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -466,8 +466,46 @@ static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, i
return false;
}
-static void gizmo_item_fn1(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2) {
- // TODO
+static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2) {
+ if (!item || !item->_button || !gizmo)
+ return;
+
+ Buffer *src = nullptr;
+ if (item->_hasBuffer) {
+ if (!item->_grBuff)
+ return;
+
+ src = item->_grBuff->get_buffer();
+ if (!src)
+ return;
+ }
+
+ Buffer *dest = gizmo->_grBuff->get_buffer();
+ if (!dest)
+ return;
+
+ GizmoButton *btn = item->_button;
+ M4sprite *sprite = nullptr;
+
+ switch (btn->_state) {
+ case IN_CONTROL:
+ sprite = _GIZMO(sprites)[15 + btn->_index];
+ break;
+ case OVER_CONTROL:
+ sprite = _GIZMO(sprites)[8 + btn->_index];
+ break;
+ default:
+ sprite = _GIZMO(sprites)[1 + btn->_index];
+ break;
+ }
+
+ if (src) {
+ gr_buffer_rect_copy_2(src, dest, 0, 0, x, y, src->w, src->h);
+ item->_grBuff->release();
+ }
+
+ gizmo_draw_sprite(sprite, dest, x, y);
+ gizmo->_grBuff->release();
}
static void gizmo_item_fn2(GizmoItem *item) {
@@ -497,8 +535,9 @@ static void gizmo_item_fn3() {
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
int boundsX, int boundsY, int boundsW, int boundsH,
int rect1X, int rect1Y, int rect1W, int rect1H,
- GizmoItemFn0 fn0, int arg6, int arg7 = 0, bool hasBuffer = false,
- int arg9 = 0, GizmoItemFn3 fn3 = gizmo_item_fn3) {
+ GizmoItemFn0 fn0, int btnIndex, bool selected = false,
+ bool hasBuffer = false, int arg9 = 0,
+ GizmoItemFn3 fn3 = gizmo_item_fn3) {
if (!gizmo)
return nullptr;
@@ -532,15 +571,16 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
GizmoButton *btn = (GizmoButton *)mem_alloc(sizeof(GizmoButton), "*gizmo button");
assert(btn);
- btn->_field4 = arg6;
+ btn->_state = selected ? SELECTED : NOTHING;
+ btn->_index = btnIndex;
btn->_field8 = arg9;
btn->_field10 = id - 1000;
item->_button = btn;
- item->_fn1 = gizmo_item_fn1;
+ item->_draw = gizmo_item_draw;
item->_fn2 = gizmo_item_fn2;
item->_fn3 = fn3;
- (*item->_fn1)(item, gizmo, rect1X, rect1Y, 0, 0);
+ (*item->_draw)(item, gizmo, rect1X, rect1Y, 0, 0);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(gizmo, &status);
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 3118e99988a..6159a19254d 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -27,6 +27,7 @@
#include "m4/m4_types.h"
#include "m4/gui/gui_vmng_core.h"
#include "m4/graphics/gr_buff.h"
+#include "m4/burger/gui/gui_cheapo.h"
namespace M4 {
namespace Burger {
@@ -65,15 +66,15 @@ struct Gizmo {
};
struct GizmoButton {
- int _field0 = 0;
- int _field4 = 0;
+ ControlStatus _state = NOTHING;
+ int _index = 0;
int _field8 = 0;
int _fieldC = 0;
int _field10 = 0;
};
typedef void (*GizmoItemFn0)();
-typedef void (*GizmoItemFn1)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
+typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
typedef void (*GizmoItemFn2)(GizmoItem *item);
typedef void (*GizmoItemFn3)();
@@ -89,7 +90,7 @@ struct GizmoItem {
Common::Rect _rect1;
bool _hasBuffer = false;
GizmoItemFn0 _fn0 = nullptr;
- GizmoItemFn1 _fn1 = nullptr;
+ GizmoItemFnDraw _draw = nullptr;
GizmoItemFn2 _fn2 = nullptr;
GizmoItemFn3 _fn3 = nullptr;
};
Commit: 7a8ac084d48964934ff80e5c7397694bc1ecdcfb
https://github.com/scummvm/scummvm/commit/7a8ac084d48964934ff80e5c7397694bc1ecdcfb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove unused platform/sound.cpp
Changed paths:
R engines/m4/platform/sound.cpp
R engines/m4/platform/sound.h
engines/m4/adv_r/adv_inv.cpp
engines/m4/m4.cpp
engines/m4/module.mk
engines/m4/platform/sound/midi.cpp
engines/m4/platform/sound/midi.h
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index c5237264c8f..802f2324720 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -47,6 +47,7 @@ void InventoryBase::syncGame(Common::Serializer &s) {
for (i = 0; i < _tail; ++i) {
char *objName = _G(inventory)->_objects[i]->name;
+ scene = _G(inventory)->_objects[i]->scene;
if (s.isLoading()) {
s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
@@ -59,6 +60,7 @@ void InventoryBase::syncGame(Common::Serializer &s) {
} else {
Common::strcpy_s(invName, MAX_NAME_LENGTH, objName);
s.syncBytes((byte *)invName, MAX_NAME_LENGTH);
+ s.syncAsUint32LE(scene);
}
}
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 088dbb1591c..155751f3d7d 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -32,7 +32,8 @@
#include "m4/adv_r/adv_file.h"
#include "m4/adv_r/conv_io.h"
#include "m4/gui/hotkeys.h"
-#include "m4/platform/sound.h"
+#include "m4/platform/sound/digi.h"
+#include "m4/platform/sound/midi.h"
#include "m4/detection.h"
#include "m4/console.h"
#include "m4/metaengine.h"
@@ -137,10 +138,8 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(kernel).restore_game = true;
_G(game).previous_room = KERNEL_RESTORING_GAME;
-#ifdef TODO
- digi_set_overall_volume(game.digi_overall_volume_percent);
- midi_set_overall_volume(game.midi_overall_volume_percent);
-#endif
+ digi_set_overall_volume(_G(game).digi_overall_volume_percent);
+ midi_set_overall_volume(_G(game).midi_overall_volume_percent);
}
return Common::kNoError;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 8329e56619d..9fe9f37daac 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -67,7 +67,6 @@ MODULE_OBJS = \
mem/res.o \
platform/draw.o \
platform/events.o \
- platform/sound.o \
platform/timer.o \
platform/sound/digi.o \
platform/sound/midi.o \
diff --git a/engines/m4/platform/sound.cpp b/engines/m4/platform/sound.cpp
deleted file mode 100644
index be3c8416578..00000000000
--- a/engines/m4/platform/sound.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/>.
- *
- */
-
-#include "m4/platform/sound.h"
-#include "m4/vars.h"
-
-namespace M4 {
-
-void midi_stop() {
- warning("TODO: midi_stop");
-}
-
-} // End of namespace M4
diff --git a/engines/m4/platform/sound.h b/engines/m4/platform/sound.h
deleted file mode 100644
index 617eab1cde4..00000000000
--- a/engines/m4/platform/sound.h
+++ /dev/null
@@ -1,34 +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/>.
- *
- */
-
-#ifndef M4_PLATFORM_SOUND_H
-#define M4_PLATFORM_SOUND_H
-
-#include "m4/m4_types.h"
-
-namespace M4 {
-
-extern void midi_stop();
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/platform/sound/midi.cpp b/engines/m4/platform/sound/midi.cpp
index 79833e18f54..5dc72ab072b 100644
--- a/engines/m4/platform/sound/midi.cpp
+++ b/engines/m4/platform/sound/midi.cpp
@@ -30,7 +30,15 @@ void Midi::task() {
}
void Midi::loop() {
- warning("TODO: Midi::loop");
+ // No implementation
+}
+
+void Midi::stop() {
+ warning("TODO: Midi::stop");
+}
+
+void Midi::set_overall_volume(int vol) {
+ warning("TODO: Midi::set_overall_volume");
}
} // namespace Sound
@@ -39,4 +47,12 @@ void midi_loop() {
_G(midi).loop();
}
+void midi_stop() {
+ _G(midi).stop();
+}
+
+void midi_set_overall_volume(int vol) {
+ _G(midi).set_overall_volume(vol);
+}
+
} // namespace M4
diff --git a/engines/m4/platform/sound/midi.h b/engines/m4/platform/sound/midi.h
index b14e1e53992..2cf92b51299 100644
--- a/engines/m4/platform/sound/midi.h
+++ b/engines/m4/platform/sound/midi.h
@@ -32,11 +32,15 @@ class Midi {
public:
void task();
void loop();
+ void stop();
+ void set_overall_volume(int vol);
};
} // namespace Sound
extern void midi_loop();
+extern void midi_stop();
+extern void midi_set_overall_volume(int vol);
} // namespace M4
Commit: ae41287b2c83cf48a0d390fe2056499a5073a1ed
https://github.com/scummvm/scummvm/commit/ae41287b2c83cf48a0d390fe2056499a5073a1ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for loading savegames
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_game.cpp
engines/m4/core/rooms.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index fd6b8c57aac..a1acac6a1fb 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -284,7 +284,7 @@ int kernel_save_game(int slot, const char *desc, int32 sizeofDesc, M4sprite *thu
}
bool kernel_load_game(int slot) {
- return g_engine->loadGameState(slot).getCode() == Common::kNoError;
+ return g_engine->loadGameStateDoIt(slot).getCode() == Common::kNoError;
}
int32 extract_room_num(const Common::String &name) {
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
index 4e683f1813e..7fe750367f3 100644
--- a/engines/m4/adv_r/adv_game.cpp
+++ b/engines/m4/adv_r/adv_game.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/adv_r/adv_game.h"
+#include "m4/core/rooms.h"
namespace M4 {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index d0a9d9ce23a..835dd9b837e 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -85,7 +85,7 @@ void Sections::game_daemon_code() {
if (_G(kernel).trigger == 32001) {
_G(game).room_id = -1;
_G(game).section_id = -1;
- _G(game).previous_room = -2;
+ _G(game).previous_room = RESTORING_GAME;
}
}
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 155751f3d7d..41d2d20d9fa 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -79,6 +79,12 @@ Common::Error M4Engine::run() {
// Set the console
setDebugger(new Console());
+ // Check for launcher savegame to load
+ if (ConfMan.hasKey("save_slot")) {
+ _G(kernel).restore_slot = ConfMan.getInt("save_slot");
+ _G(game).previous_room = RESTORING_GAME;
+ }
+
// Run game here
m4_inflight();
}
@@ -94,7 +100,7 @@ void M4Engine::m4_inflight() {
_G(kernel).going = true;
while (KEEP_PLAYING) {
- if (_G(game).previous_room == -2) {
+ if (_G(game).previous_room == RESTORING_GAME) {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
}
@@ -121,6 +127,21 @@ bool M4Engine::canSaveGameStateCurrently(Common::U32String *msg) {
return g_vars && g_vars->getInterface() && g_vars->getInterface()->_visible;
}
+Common::Error M4Engine::loadGameState(int slot) {
+ // Don't load savegame immediately, just set the slot for the engine's
+ // kernel to take care of in the outer game loop
+ _G(kernel).restore_slot = slot;
+ _G(game).new_room = RESTORING_GAME;
+ _G(game).new_section = RESTORING_GAME;
+ _G(game).previous_room = RESTORING_GAME;
+
+ return Common::kNoError;
+}
+
+Common::Error M4Engine::loadGameStateDoIt(int slot) {
+ return Engine::loadGameState(slot);
+}
+
Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(game).syncGame(s);
_G(player).syncGame(s);
@@ -136,6 +157,7 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
if (s.isLoading()) {
// set up variables so everyone knows we've teleported
_G(kernel).restore_game = true;
+ _G(between_rooms) = true;
_G(game).previous_room = KERNEL_RESTORING_GAME;
digi_set_overall_volume(_G(game).digi_overall_volume_percent);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 725563c42b3..3ea5f782142 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -102,6 +102,9 @@ public:
bool canLoadGameStateCurrently(Common::U32String * msg = nullptr) override;
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+ Common::Error loadGameState(int slot) override;
+ Common::Error loadGameStateDoIt(int slot);
+
/**
* Uses a serializer to allow implementing savegame
* loading and saving using a single method
Commit: df7f82a11e924b96fd6620a4857fe2b52a1fc2eb
https://github.com/scummvm/scummvm/commit/df7f82a11e924b96fd6620a4857fe2b52a1fc2eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix room 502 init on savegame load
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 002be766bf1..fe5a567629e 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -273,6 +273,10 @@ void Room502::init() {
bool skip = false;
switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
case 503:
ws_demand_location(620, 311, 9);
ws_walk(304, 308, 0, -1, -1);
Commit: c4a9ab3eb46e5b2e4f603b2d861999450f75ae7f
https://github.com/scummvm/scummvm/commit/c4a9ab3eb46e5b2e4f603b2d861999450f75ae7f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes to gizmo_draw method
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index e45a36e79f4..144db17adbe 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -416,32 +416,32 @@ void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY) {
}
}
-static void gui_gizmo_show(ScreenContext *s, RectList *r, Buffer *dest, int32 destX, int32 destY) {
+static void gizmo_draw(ScreenContext *s, RectList *r, Buffer *dest, int32 destX, int32 destY) {
if (!s)
return;
void *scrnContent = s->scrnContent;
if (!scrnContent)
return;
- GrBuff *buf = (GrBuff *)s->scrnContent;
- if (!buf)
+ Gizmo *gizmo = (Gizmo *)s->scrnContent;
+ if (!gizmo)
return;
- Buffer *src = buf->get_buffer();
+ Buffer *src = gizmo->_grBuff->get_buffer();
if (!src)
return;
if (dest) {
- for (RectList *rect = r; rect; rect = rect->next) {
- vmng_refresh_video(rect->x1, rect->y1,
- rect->x1 - s->x1, rect->y1 - s->y1, rect->x2 - s->x1, rect->y2 - s->y1,
- src);
- }
- } else {
for (RectList *rect = r; rect; rect = rect->next) {
gr_buffer_rect_copy_2(src, dest,
rect->x1 - s->x1, rect->y1 - s->y1, destX, destY,
rect->x2 - rect->x1 + 1, rect->y2 - rect->y1 + 1);
}
+ } else {
+ for (RectList *rect = r; rect; rect = rect->next) {
+ vmng_refresh_video(rect->x1, rect->y1,
+ rect->x1 - s->x1, rect->y1 - s->y1, rect->x2 - s->x1, rect->y2 - s->y1,
+ src);
+ }
}
}
@@ -623,7 +623,7 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
gui->_grBuff->release();
ScreenContext *ctx = vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
- 69, scrnFlags, gui, (RefreshFunc)gui_gizmo_show, gizmo_eventHandler);
+ 69, scrnFlags, gui, (RefreshFunc)gizmo_draw, gizmo_eventHandler);
return ctx ? gui : nullptr;
}
Commit: 155306b6b5ceba242a54c3117248f1f0c216c1d6
https://github.com/scummvm/scummvm/commit/155306b6b5ceba242a54c3117248f1f0c216c1d6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gizmo event handler
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 144db17adbe..e5158461ec1 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -313,7 +313,7 @@ static void gizmo_daemon(int trigger) {
static void gizmo_restore_interface(bool fade) {
if (_GIZMO(initialized)) {
- _GIZMO(val1) = 0;
+ _GIZMO(currentItem) = 0;
if (_GIZMO(lowMemory2)) {
if (!adv_restoreBackground())
@@ -446,24 +446,101 @@ static void gizmo_draw(ScreenContext *s, RectList *r, Buffer *dest, int32 destX,
}
static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
- warning("TODO: gizmo_eventHandler %d %d", eventType, event);
-
- /*
- ScreenContext *srcBuffer = (ScreenContext *)s;
- *z = false;
-
+ Gizmo *gizmo = (Gizmo *)s;
+ bool flag = false;
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(s, &status);
+ *z = false;
+
if (!ctx || status != 1)
return false;
- if (eventType == EVENT_KEY && event == KEY_ESCAPE && myScreen->y1 != 0) {
- _GIZMO(val1) = 0;
+ if (eventType == EVENT_KEY) {
+ if (event == KEY_ESCAPE && gizmo->_fnEscape) {
+ _GIZMO(currentItem) = nullptr;
+ (*gizmo->_fnEscape)();
+ return true;
+ } else if (event == KEY_RETURN && gizmo->_fnEnter) {
+ _GIZMO(currentItem) = nullptr;
+ (*gizmo->_fnEnter)();
+ return true;
+ }
+ }
+
+ int xs = x + ctx->x1;
+ int ys = y + ctx->y1;
+
+ if (!_GIZMO(currentItem)) {
+ flag = (*_GIZMO(currentItem)->_fnEvents)(_GIZMO(currentItem),
+ eventType, event, xs, ys, &_GIZMO(currentItem));
+ if (_GIZMO(currentItem))
+ *z = true;
+
+ if (flag)
+ return true;
}
- */
- // TODO: event handler
- return false;
+
+ if (eventType == EVENT_MOUSE) {
+ GizmoItem *item;
+ for (item = gizmo->_items; item; item = item->_next) {
+ if (item->_btnRect.contains(xs, ys))
+ break;
+ }
+
+ if (item && item->_fnEvents) {
+ item->_fnEvents(item, eventType, event, xs, ys, &_GIZMO(currentItem));
+
+ if (_GIZMO(currentItem))
+ *z = true;
+
+ return true;
+ }
+
+ } else if (eventType == EVENT_KEY) {
+ GizmoItem *item;
+ for (item = gizmo->_items; item && !flag; item = item->_next) {
+ if (item->_fnEvents)
+ flag = (*item->_fnEvents)(item, eventType, event, -1, -1, nullptr);
+ }
+
+ return flag;
+ }
+
+ switch (event) {
+ case 2:
+ case 14:
+ if (!(ctx->scrnFlags & SF_IMMOVABLE)) {
+ *z = true;
+ _GIZMO(savedFlag) = true;
+ _GIZMO(savedX) = x;
+ _GIZMO(savedY) = y;
+ }
+
+ if (xs < 230 || xs > 420 || ys > 374)
+ gizmo_shutdown();
+ break;
+
+ case 4:
+ case 16:
+ if (_GIZMO(savedFlag)) {
+ MoveScreenDelta(ctx, _GIZMO(savedX), _GIZMO(savedY));
+ _GIZMO(savedX) = x;
+ _GIZMO(savedY) = y;
+ }
+ break;
+
+ case 5:
+ case 17:
+ *z = false;
+ _GIZMO(savedFlag) = false;
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
}
static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2) {
@@ -528,8 +605,10 @@ static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
return grBuff;
}
-static void gizmo_item_fn3() {
+static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x, int y,
+ GizmoItem **currentItem) {
// TODO
+ return false;
}
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
@@ -537,7 +616,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
int rect1X, int rect1Y, int rect1W, int rect1H,
GizmoItemFn0 fn0, int btnIndex, bool selected = false,
bool hasBuffer = false, int arg9 = 0,
- GizmoItemFn3 fn3 = gizmo_item_fn3) {
+ GizmoItemFnEvents events = gizmo_item_events) {
if (!gizmo)
return nullptr;
@@ -558,7 +637,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_id = id;
item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
boundsY + boundsH - 1);
- item->_rect1 = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y + rect1H - 1);
+ item->_btnRect = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y + rect1H - 1);
item->_fn0 = fn0;
item->_hasBuffer = hasBuffer;
@@ -577,10 +656,10 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
btn->_field10 = id - 1000;
item->_button = btn;
- item->_draw = gizmo_item_draw;
+ item->_fnDraw = gizmo_item_draw;
item->_fn2 = gizmo_item_fn2;
- item->_fn3 = fn3;
- (*item->_draw)(item, gizmo, rect1X, rect1Y, 0, 0);
+ item->_fnEvents = events;
+ (*item->_fnDraw)(item, gizmo, rect1X, rect1Y, 0, 0);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(gizmo, &status);
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 6159a19254d..7c5672afbf2 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -45,7 +45,7 @@ struct Gizmo_Globals {
RGB8 *_palette = nullptr;
bool _lowMemory1 = false;
bool _lowMemory2 = false;
- int _val1 = 0;
+ GizmoItem *_currentItem = nullptr;
MemHandle _seriesHandle = nullptr;
int32 _celsOffset = 0;
int32 _palOffset = 0;
@@ -54,14 +54,18 @@ struct Gizmo_Globals {
M4sprite **_sprites = nullptr;
bool _roomNums[15];
+ bool _savedFlag = false;
+ int _savedX = 0;
+ int _savedY = 0;
+
~Gizmo_Globals();
};
struct Gizmo {
GrBuff *_grBuff = nullptr;
GizmoItem *_items = nullptr;
- int _field8 = 0;
- int _fieldC = 0;
+ void (*_fnEnter)() = nullptr;
+ void (*_fnEscape)() = nullptr;
EventHandler _eventHandler = nullptr;
};
@@ -76,7 +80,8 @@ struct GizmoButton {
typedef void (*GizmoItemFn0)();
typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
typedef void (*GizmoItemFn2)(GizmoItem *item);
-typedef void (*GizmoItemFn3)();
+typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
+ GizmoItem **currentItem);
struct GizmoItem {
GizmoItem *_next = nullptr;
@@ -87,12 +92,12 @@ struct GizmoItem {
int _id = 0;
Common::Rect _bounds;
- Common::Rect _rect1;
+ Common::Rect _btnRect;
bool _hasBuffer = false;
GizmoItemFn0 _fn0 = nullptr;
- GizmoItemFnDraw _draw = nullptr;
+ GizmoItemFnDraw _fnDraw = nullptr;
GizmoItemFn2 _fn2 = nullptr;
- GizmoItemFn3 _fn3 = nullptr;
+ GizmoItemFnEvents _fnEvents = nullptr;
};
extern void gizmo_anim(RGB8 *pal);
Commit: e25c4e3e06afaa22d468fa74e57c6dc4be4269ad
https://github.com/scummvm/scummvm/commit/e25c4e3e06afaa22d468fa74e57c6dc4be4269ad
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added gizmo free code
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index e5158461ec1..b3901186955 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -346,7 +346,19 @@ static void gizmo_dispose_gui() {
}
static void gizmo_free_gui(Gizmo *gizmo) {
- // TODO
+ if (!gizmo)
+ return;
+
+ for (GizmoItem *item = gizmo->_items; item; item = gizmo->_items) {
+ gizmo->_items = item->_next;
+ (*item->_fnFree)(item);
+ }
+
+ GrBuff *grBuff = gizmo->_grBuff;
+ if (grBuff)
+ delete grBuff;
+
+ mem_free(gizmo);
}
static bool gizmo_load_sprites(const char *name, size_t count) {
@@ -585,8 +597,16 @@ static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y, int zer
gizmo->_grBuff->release();
}
-static void gizmo_item_fn2(GizmoItem *item) {
- // TODO
+static void gizmo_item_free(GizmoItem *item) {
+ if (!item)
+ return;
+
+ if (item->_grBuff)
+ delete item->_grBuff;
+
+ if (item->_button)
+ mem_free(item->_button);
+ mem_free(item);
}
static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
@@ -657,7 +677,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_button = btn;
item->_fnDraw = gizmo_item_draw;
- item->_fn2 = gizmo_item_fn2;
+ item->_fnFree = gizmo_item_free;
item->_fnEvents = events;
(*item->_fnDraw)(item, gizmo, rect1X, rect1Y, 0, 0);
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 7c5672afbf2..f0f29e0f7d0 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -79,7 +79,7 @@ struct GizmoButton {
typedef void (*GizmoItemFn0)();
typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
-typedef void (*GizmoItemFn2)(GizmoItem *item);
+typedef void (*GizmoItemFnFree)(GizmoItem *item);
typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
GizmoItem **currentItem);
@@ -96,7 +96,7 @@ struct GizmoItem {
bool _hasBuffer = false;
GizmoItemFn0 _fn0 = nullptr;
GizmoItemFnDraw _fnDraw = nullptr;
- GizmoItemFn2 _fn2 = nullptr;
+ GizmoItemFnFree _fnFree = nullptr;
GizmoItemFnEvents _fnEvents = nullptr;
};
Commit: a01c1ee7234846b7007a05d213be8018f2ae8a46
https://github.com/scummvm/scummvm/commit/a01c1ee7234846b7007a05d213be8018f2ae8a46
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress gizmo item event handler
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index b3901186955..c3fe6a35239 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -555,7 +555,7 @@ static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, i
return true;
}
-static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2) {
+static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y) {
if (!item || !item->_button || !gizmo)
return;
@@ -625,10 +625,130 @@ static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
return grBuff;
}
+static bool gizmo_item_contains(GizmoItem *item, int x, int y) {
+ return item->_btnRect.contains(x, y);
+}
+
static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x, int y,
- GizmoItem **currentItem) {
- // TODO
- return false;
+ GizmoItem **currentItem) {
+ if (!item || !item->_button || eventType != EVENT_MOUSE)
+ return false;
+
+ GizmoButton *btn = item->_button;
+ if (btn->_state == SELECTED)
+ return false;
+
+ bool flag1 = false;
+ bool flag2 = false;
+ bool flag3 = false;
+
+ switch (event) {
+ case _ME_move:
+ if (gizmo_item_contains(item, x, y)) {
+ if (!player_commands_allowed())
+ return false;
+
+ *currentItem = item;
+
+ if (btn->_state != IN_CONTROL) {
+ btn->_state = IN_CONTROL;
+ flag1 = true;
+ }
+ } else {
+ *currentItem = nullptr;
+
+ if (btn->_state != NOTHING) {
+ btn->_state = NOTHING;
+ flag1 = true;
+ flag3 = false;
+ }
+ }
+ break;
+
+ case _ME_L_click:
+ case _ME_doubleclick:
+ if (gizmo_item_contains(item, x, y)) {
+ if (!player_commands_allowed())
+ return false;
+
+ btn->_state = OVER_CONTROL;
+ *currentItem = item;
+ flag1 = true;
+
+ } else {
+ *currentItem = nullptr;
+
+ if (btn->_state != NOTHING) {
+ btn->_state = NOTHING;
+ flag1 = true;
+ }
+ }
+ break;
+
+ case _ME_L_hold:
+ case _ME_doubleclick_hold:
+ break;
+
+ case _ME_L_drag:
+ case _ME_doubleclick_drag:
+ if (!*currentItem)
+ return true;
+
+ if (gizmo_item_contains(item, x, y)) {
+ if (!player_commands_allowed())
+ return false;
+
+ if (btn->_state != OVER_CONTROL) {
+ btn->_state = OVER_CONTROL;
+ flag1 = true;
+ }
+ } else {
+ if (btn->_state != IN_CONTROL) {
+ btn->_state = IN_CONTROL;
+ flag1 = true;
+ }
+ }
+ break;
+
+ case _ME_L_release:
+ case _ME_doubleclick_release:
+ if (gizmo_item_contains(item, x, y)) {
+ if (!player_commands_allowed())
+ return false;
+
+ if (*currentItem)
+ flag2 = true;
+ else
+ *currentItem = item;
+ } else {
+ *currentItem = nullptr;
+ btn->_state = NOTHING;
+ flag1 = true;
+ flag3 = false;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (flag1) {
+ (*item->_fnDraw)(item, item->_gizmo, item->_bounds.left, item->_bounds.top);
+
+ int32 status;
+ ScreenContext *ctx = vmng_screen_find(item->_gizmo, &status);
+
+ if (ctx && status == 1)
+ RestoreScreens(item->_bounds.left + ctx->x1, item->_bounds.top + ctx->y1,
+ item->_bounds.right + ctx->x1, item->_bounds.bottom + ctx->y1);
+ }
+
+ if (flag2 && item->_fn0) {
+ // TODO: drag release code
+ error("TODO: fn0");
+ }
+
+ return flag3;
}
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
@@ -679,7 +799,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_fnDraw = gizmo_item_draw;
item->_fnFree = gizmo_item_free;
item->_fnEvents = events;
- (*item->_fnDraw)(item, gizmo, rect1X, rect1Y, 0, 0);
+ (*item->_fnDraw)(item, gizmo, rect1X, rect1Y);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(gizmo, &status);
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index f0f29e0f7d0..af04dd8da13 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -78,7 +78,7 @@ struct GizmoButton {
};
typedef void (*GizmoItemFn0)();
-typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y, int zero1, int zero2);
+typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y);
typedef void (*GizmoItemFnFree)(GizmoItem *item);
typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
GizmoItem **currentItem);
Commit: a2a63dc36a3909a54c23e36a04607b3fb5cf5cca
https://github.com/scummvm/scummvm/commit/a2a63dc36a3909a54c23e36a04607b3fb5cf5cca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add remaining gizmo select code
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index c3fe6a35239..4149be3f2bf 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -482,7 +482,7 @@ static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, i
int xs = x + ctx->x1;
int ys = y + ctx->y1;
- if (!_GIZMO(currentItem)) {
+ if (_GIZMO(currentItem)) {
flag = (*_GIZMO(currentItem)->_fnEvents)(_GIZMO(currentItem),
eventType, event, xs, ys, &_GIZMO(currentItem));
@@ -629,6 +629,15 @@ static bool gizmo_item_contains(GizmoItem *item, int x, int y) {
return item->_btnRect.contains(x, y);
}
+static GizmoItem *gizmo_findItem(int id, Gizmo *gizmo) {
+ for (GizmoItem *item = gizmo->_items; item; item = item->_next) {
+ if (item->_id == id)
+ return item;
+ }
+
+ return nullptr;
+}
+
static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x, int y,
GizmoItem **currentItem) {
if (!item || !item->_button || eventType != EVENT_MOUSE)
@@ -743,9 +752,19 @@ static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x,
item->_bounds.right + ctx->x1, item->_bounds.bottom + ctx->y1);
}
- if (flag2 && item->_fn0) {
- // TODO: drag release code
- error("TODO: fn0");
+ if (flag2 && item->_select) {
+ (*item->_select)();
+
+ int32 status;
+ ScreenContext *ctx = vmng_screen_find(item->_gizmo, &status);
+
+ if (ctx && status == 1) {
+ if (!gizmo_findItem(item->_id, item->_gizmo))
+ *currentItem = nullptr;
+
+ } else {
+ *currentItem = nullptr;
+ }
}
return flag3;
@@ -754,7 +773,7 @@ static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x,
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
int boundsX, int boundsY, int boundsW, int boundsH,
int rect1X, int rect1Y, int rect1W, int rect1H,
- GizmoItemFn0 fn0, int btnIndex, bool selected = false,
+ GizmoItemFnSelect select, int btnIndex, bool selected = false,
bool hasBuffer = false, int arg9 = 0,
GizmoItemFnEvents events = gizmo_item_events) {
if (!gizmo)
@@ -778,7 +797,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
boundsY + boundsH - 1);
item->_btnRect = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y + rect1H - 1);
- item->_fn0 = fn0;
+ item->_select = select;
item->_hasBuffer = hasBuffer;
if (hasBuffer) {
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index af04dd8da13..90c126704c7 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -77,7 +77,7 @@ struct GizmoButton {
int _field10 = 0;
};
-typedef void (*GizmoItemFn0)();
+typedef void (*GizmoItemFnSelect)();
typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y);
typedef void (*GizmoItemFnFree)(GizmoItem *item);
typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
@@ -94,7 +94,7 @@ struct GizmoItem {
Common::Rect _bounds;
Common::Rect _btnRect;
bool _hasBuffer = false;
- GizmoItemFn0 _fn0 = nullptr;
+ GizmoItemFnSelect _select = nullptr;
GizmoItemFnDraw _fnDraw = nullptr;
GizmoItemFnFree _fnFree = nullptr;
GizmoItemFnEvents _fnEvents = nullptr;
Commit: 2704b02e4ca9466445c9d540347d9922df452fde
https://github.com/scummvm/scummvm/commit/2704b02e4ca9466445c9d540347d9922df452fde
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix crash pressing key when gizmo is active
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 4149be3f2bf..f9267d42304 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -462,6 +462,11 @@ static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, i
bool flag = false;
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(s, &status);
+
+ // WORKAROUND: gui_system_event_handler may call without z being set
+ bool dummyZ = false;
+ if (!z)
+ z = &dummyZ;
*z = false;
if (!ctx || status != 1)
Commit: 4b658ccfe3ac3949980d294d8112fc376d8c3bc5
https://github.com/scummvm/scummvm/commit/4b658ccfe3ac3949980d294d8112fc376d8c3bc5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify gizmo room flags, event handling fix
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/gui_gizmo.h
engines/m4/burger/rooms/section5/section5.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index f9267d42304..bed2cd8bbd7 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -95,57 +95,57 @@ static void gizmo_digi_daemon(int trigger) {
case 5000:
if (player_been_here(503)) {
if (_G(flags)[kBORK_STATE] == 16)
- gizmo_digi_play("510w005", 255, _GIZMO(roomNums)[3]);
+ gizmo_digi_play("510w005", 255, _GIZMO(roomFlags)[3]);
else
- gizmo_digi_play("510w004", 255, _GIZMO(roomNums)[2]);
+ gizmo_digi_play("510w004", 255, _GIZMO(roomFlags)[2]);
}
break;
case 5001:
if (player_been_here(507)) {
if (_G(flags)[V223] == 2)
- gizmo_digi_play("510w008", 255, _GIZMO(roomNums)[5]);
+ gizmo_digi_play("510w008", 255, _GIZMO(roomFlags)[5]);
else
- gizmo_digi_play("510w007", 255, _GIZMO(roomNums)[4]);
+ gizmo_digi_play("510w007", 255, _GIZMO(roomFlags)[4]);
}
break;
case 5002:
if (player_been_here(504)) {
if (_G(flags)[V210] == 5002)
- gizmo_digi_play("510w011", 255, _GIZMO(roomNums)[7]);
+ gizmo_digi_play("510w011", 255, _GIZMO(roomFlags)[7]);
else
- gizmo_digi_play("510w010", 255, _GIZMO(roomNums)[6]);
+ gizmo_digi_play("510w010", 255, _GIZMO(roomFlags)[6]);
}
break;
case 5003:
if (player_been_here(508)) {
if (_G(flags)[V227] != 0)
- gizmo_digi_play("510w014", 255, _GIZMO(roomNums)[9]);
+ gizmo_digi_play("510w014", 255, _GIZMO(roomFlags)[9]);
else
- gizmo_digi_play("510w013", 255, _GIZMO(roomNums)[8]);
+ gizmo_digi_play("510w013", 255, _GIZMO(roomFlags)[8]);
}
break;
case 5004:
if (player_been_here(506)) {
if (_G(flags)[V218] == 5003)
- gizmo_digi_play("510w017", 255, _GIZMO(roomNums)[11]);
+ gizmo_digi_play("510w017", 255, _GIZMO(roomFlags)[11]);
else
- gizmo_digi_play("510w016", 255, _GIZMO(roomNums)[10]);
+ gizmo_digi_play("510w016", 255, _GIZMO(roomFlags)[10]);
}
break;
case 5005:
if (_G(flags)[V200] == 5003)
- gizmo_digi_play("510w019", 255, _GIZMO(roomNums)[13]);
+ gizmo_digi_play("510w019", 255, _GIZMO(roomFlags)[13]);
else
- gizmo_digi_play("510w018", 255, _GIZMO(roomNums)[12]);
+ gizmo_digi_play("510w018", 255, _GIZMO(roomFlags)[12]);
break;
case 5006:
- gizmo_digi_play("510w020", 255, _GIZMO(roomNums)[14]);
+ gizmo_digi_play("510w020", 255, _GIZMO(roomFlags)[14]);
break;
default:
@@ -846,9 +846,10 @@ static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags)
GrBuff *grBuff = new GrBuff(sprite->w, sprite->h);
gui->_grBuff = grBuff;
- //gui->_items = nullptr;
-
- gui->_eventHandler = gizmo_eventHandler;
+ gui->_items = nullptr;
+ gui->_fnEnter = nullptr;
+ gui->_fnEscape = nullptr;
+ gui->_fnEvents = gizmo_eventHandler;
Buffer *dest = gui->_grBuff->get_buffer();
Buffer *src = _G(gameDrawBuff)->get_buffer();
diff --git a/engines/m4/burger/gui/gui_gizmo.h b/engines/m4/burger/gui/gui_gizmo.h
index 90c126704c7..4238d09367c 100644
--- a/engines/m4/burger/gui/gui_gizmo.h
+++ b/engines/m4/burger/gui/gui_gizmo.h
@@ -52,7 +52,7 @@ struct Gizmo_Globals {
char *_assetName = nullptr;
int _spriteCount = 0;
M4sprite **_sprites = nullptr;
- bool _roomNums[15];
+ bool _roomFlags[15];
bool _savedFlag = false;
int _savedX = 0;
@@ -66,7 +66,7 @@ struct Gizmo {
GizmoItem *_items = nullptr;
void (*_fnEnter)() = nullptr;
void (*_fnEscape)() = nullptr;
- EventHandler _eventHandler = nullptr;
+ EventHandler _fnEvents = nullptr;
};
struct GizmoButton {
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index b1d6e7edd8b..d02bbc75ed4 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -552,12 +552,14 @@ void Section5::takeGizmo(RGB8 *pal) {
player_set_commands_allowed(false);
if (_G(flags)[V238] == 0) {
- GUI::gizmo_digi_play("510w001", 255, _GIZMO(roomNums)[0]);
+ GUI::gizmo_digi_play("510w001", 255, _GIZMO(roomFlags)[0]);
++_G(flags)[V238];
} else if (_G(flags)[V238] == 1) {
- GUI::gizmo_digi_play("510w002", 255, _GIZMO(roomNums)[1]);
+ GUI::gizmo_digi_play("510w002", 255, _GIZMO(roomFlags)[1]);
++_G(flags)[V238];
}
+
+ player_set_commands_allowed(true);
}
}
Commit: 86ea0b72abbbe56912a8381be3808bada0f01a0a
https://github.com/scummvm/scummvm/commit/86ea0b72abbbe56912a8381be3808bada0f01a0a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix placement of gizmo content
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index bed2cd8bbd7..44001af0617 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -823,7 +823,7 @@ static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
item->_fnDraw = gizmo_item_draw;
item->_fnFree = gizmo_item_free;
item->_fnEvents = events;
- (*item->_fnDraw)(item, gizmo, rect1X, rect1Y);
+ (*item->_fnDraw)(item, gizmo, boundsX, boundsY);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(gizmo, &status);
Commit: ba4f3119505358b73335cbfaca3817a839c56ee8
https://github.com/scummvm/scummvm/commit/ba4f3119505358b73335cbfaca3817a839c56ee8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix pressing multiple gizmo buttons
Changed paths:
engines/m4/burger/gui/gui_gizmo.cpp
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 44001af0617..e3fda55806a 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -188,6 +188,9 @@ static void gizmo_digi_wait(int spriteIndex1, int spriteIndex2) {
gui_system_event_handler();
}
}
+
+ gizmo_restore_sprite(57);
+ player_set_commands_allowed(true);
}
static void gizmo_daemon(int trigger) {
Commit: ea9f27a1191fe06ddb7dc5c1ba40c6b89a198894
https://github.com/scummvm/scummvm/commit/ea9f27a1191fe06ddb7dc5c1ba40c6b89a198894
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove no longer relevant TODOs
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index b342ea37f92..8740bc045d7 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1291,7 +1291,6 @@ void Room102::parser() {
} else if (player_said("take", "stove")) {
_G(walker).wilbur_speech("102w040");
} else if (player_said("gear", "stove")) {
- // TODO
flagAction("102w041", "102h031");
} else if (player_said("harry") && inv_player_has(_G(player).verb) && !_G(flags)[V012]) {
queuePlay(imath_ranged_rand(1, 2) == 1 ? "102h009y" : "102h009z");
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 5e4c884d718..d20a3d1d1b0 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -1135,7 +1135,6 @@ void Room143::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
- // TODO
}
void Room143::pre_parser() {
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index e0f8d28f1ed..60c59f107a7 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -352,7 +352,6 @@ void Mine::daemon() {
break;
}
- // TODO: Further cases
default:
_G(kernel).continue_handling_trigger = true;
break;
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 22a637eb790..c3758e158d7 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -88,7 +88,6 @@ Vars::~Vars() {
}
void Vars::main_cold_data_init() {
- // TODO
initMouseSeries("cursor", nullptr);
_kernel.first_fade = 32;
Commit: 2d9d250e690eb1404580a16adb739237968ba62b
https://github.com/scummvm/scummvm/commit/2d9d250e690eb1404580a16adb739237968ba62b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix unknown depth/scale references
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 3beae455957..83f1f12a027 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -340,51 +340,51 @@ void BurgerEngine::global_daemon() {
break;
case 10003:
player_set_commands_allowed(false);
- player_update_info(_G(my_walker), &_G(player_info));
- ws_hide_walker(_G(my_walker));
+ player_update_info();
+ ws_hide_walker();
_G(wilbur_should) = 10013;
- series_play_with_breaks(PLAY_BREAKS1, "999wbw", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS1, "999wbw", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 7,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10004:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10012;
- series_play_with_breaks(PLAY_BREAKS2, "999wbj", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS2, "999wbj", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10005:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10009;
- series_play_with_breaks(PLAY_BREAKS3, "600wek", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS3, "600wek", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10006:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY_BREAKS4, "999wsdu", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 7,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS4, "999wsdu", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 7,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10007:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10014;
- series_play_with_breaks(PLAY_BREAKS5, "999wtpe", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS5, "999wtpe", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10008:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY_BREAKS6, "999wtpf", UNKNOWN_DEPTH_1, gCHANGE_WILBUR_ANIMATION, 3, 6,
- UNKNOWN_SCALE_1, _G(player_info).x, _G(player_info).y);
+ series_play_with_breaks(PLAY_BREAKS6, "999wtpf", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 79895a575e5..d5132e19b5a 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -145,16 +145,6 @@ extern Vars *g_vars;
#define _GI(X) _G(interface)._##X
#define _GINT() _G(interface)
-
-inline int UNKNOWN_depth1() {
- error("TODO: Uninitialized? depth UNKNOWN_1");
-}
-inline int UNKNOWN_scale1() {
- error("TODO: Uninitialized? depth UNKNOWN_1");
-}
-#define UNKNOWN_DEPTH_1 UNKNOWN_depth1()
-#define UNKNOWN_SCALE_1 UNKNOWN_scale1()
-
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index a0750d938a0..5bf727fd80f 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -296,38 +296,38 @@ void wilbur_abduct(int trigger) {
switch (_G(walkTrigger)) {
case 1:
case 2:
- series_play("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
- series_play("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
case 3:
case 4:
case 5:
- series_play("999ab04", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab04", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
- series_play("999ab04s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab04s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
case 7:
case 8:
case 9:
- series_play("999ab08", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab08", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
- series_play("999ab08s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab08s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
case 10:
case 11:
- series_play("999ab10", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab10", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
- series_play("999ab10s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab10s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
default:
- series_play("999ab02", UNKNOWN_DEPTH_1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
- series_play("999ab02s", UNKNOWN_DEPTH_1 + 1, 0, -1, 6, 0, UNKNOWN_SCALE_1,
+ series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
}
Commit: 67f66d767fbc9f22ac84b3bc7c54419d6c1baf76
https://github.com/scummvm/scummvm/commit/67f66d767fbc9f22ac84b3bc7c54419d6c1baf76
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Fix clash of Room classes
Changed paths:
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/room.h
engines/m4/module.mk
engines/m4/riddle/rooms/room.cpp
engines/m4/riddle/rooms/room.h
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 291ae48fb72..ac7f882bbe1 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -41,14 +41,6 @@ void Room::setWilburHotspot() {
_wilburHotspot.cursor_number = kArrowCursor;
}
-
-void Room::shutdown() {
-}
-
-void Room::parser_code() {
- warning("TODO: global_parser_code");
-}
-
HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
if (!_G(player).walker_in_this_scene || !_G(roomVal2))
return nullptr;
diff --git a/engines/m4/burger/rooms/room.h b/engines/m4/burger/rooms/room.h
index dc1f24ce5fb..7288f0dc921 100644
--- a/engines/m4/burger/rooms/room.h
+++ b/engines/m4/burger/rooms/room.h
@@ -52,9 +52,6 @@ public:
Room() : M4::Room() {}
~Room() override {}
- void shutdown() override;
- void parser_code() override;
-
/**
* Used to tell if x,y is over the walker hotspot
*/
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 9fe9f37daac..93feed78b74 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -184,6 +184,7 @@ MODULE_OBJS = \
burger/vars.o \
burger/walker.o \
riddle/gui/interface.o \
+ riddle/rooms/room.o \
riddle/rooms/section.o \
riddle/rooms/section9/section9.o \
riddle/rooms/section9/section9_room.o \
diff --git a/engines/m4/riddle/rooms/room.cpp b/engines/m4/riddle/rooms/room.cpp
index 291ae48fb72..1ca950ba138 100644
--- a/engines/m4/riddle/rooms/room.cpp
+++ b/engines/m4/riddle/rooms/room.cpp
@@ -19,84 +19,13 @@
*
*/
-#include "m4/burger/rooms/room.h"
-#include "m4/burger/vars.h"
+#include "m4/riddle/rooms/room.h"
+#include "m4/riddle/vars.h"
namespace M4 {
-namespace Burger {
+namespace Riddle {
namespace Rooms {
-HotSpotRec Room::_wilburHotspot;
-char Room::_wilburName[16];
-char Room::_wilburVerb = 0;
-
-void Room::setWilburHotspot() {
- Common::strcpy_s(_wilburName, "Wilbur");
-
- _wilburHotspot.clear();
- _wilburHotspot.vocab = _wilburName;
- _wilburHotspot.verb = &_wilburVerb;
- _wilburHotspot.feet_x = 0x7fff;
- _wilburHotspot.feet_y = 0x7fff;
- _wilburHotspot.cursor_number = kArrowCursor;
-}
-
-
-void Room::shutdown() {
-}
-
-void Room::parser_code() {
- warning("TODO: global_parser_code");
-}
-
-HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
- if (!_G(player).walker_in_this_scene || !_G(roomVal2))
- return nullptr;
-
- player_update_info();
- int y2 = _G(player_info).y - (_G(player_info).scale * 75 / 100);
- int y1 = _G(player_info).y - (_G(player_info).scale * 150 / 100);
- int xSize = _G(player_info).scale * 22 / 100;
-
- if (y > y2 || y <= y1 || imath_abs(x - _G(player_info).x) >= xSize)
- return nullptr;
-
- return &_wilburHotspot;
-}
-
-void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
- int layer, bool shadow, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
- term_message("npc_say: %s npc_series: %s npc_trigger: %d",
- digiName, seriesName, trigger);
-
- _G(npcTrigger) = trigger;
-
- if (seriesName) {
- _G(npcSpeech1) = series_play(seriesName, layer, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
-
- if (shadow) {
- char temp[20];
- Common::strcpy_s(temp, 20, seriesName);
- Common::strcat_s(temp, 20, "s");
- _G(npcSpeech2) = series_play(temp, layer + 1, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
- }
- }
-
- kernel_trigger_dispatch_now(gNPC_SPEECH_STARTED);
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
-
- _G(kernel).trigger_mode = KT_DAEMON;
- digi_play(digiName, digiSlot, digiVol, gNPC_SPEECH_FINISHED);
-
- _G(kernel).trigger_mode = oldMode;
-}
-
-void Room::npc_say(int trigger, const char *seriesName, int layer, bool shadow,
- int firstFrame, int lastFrame, int digiSlot, int digiVol) {
- npc_say(conv_sound_to_play(), trigger, seriesName, layer, shadow,
- firstFrame, lastFrame, digiSlot, digiVol);
-}
-
} // namespace Rooms
-} // namespace Burger
+} // namespace Riddle
} // namespace M4
diff --git a/engines/m4/riddle/rooms/room.h b/engines/m4/riddle/rooms/room.h
index dc1f24ce5fb..969a2897200 100644
--- a/engines/m4/riddle/rooms/room.h
+++ b/engines/m4/riddle/rooms/room.h
@@ -19,59 +19,27 @@
*
*/
-#ifndef M4_BURGER_ROOMS_ROOM_H
-#define M4_BURGER_ROOMS_ROOM_H
+#ifndef M4_RIDDLE_ROOMS_ROOM_H
+#define M4_RIDDLE_ROOMS_ROOM_H
#include "m4/core/rooms.h"
-#include "m4/burger/core/play_break.h"
-#include "m4/burger/core/stream_break.h"
-#include "m4/burger/core/conv.h"
#include "m4/adv_r/conv_io.h"
#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
#include "m4/adv_r/adv_hotspot.h"
namespace M4 {
-namespace Burger {
+namespace Riddle {
namespace Rooms {
class Room : public M4::Room {
-private:
- static char _wilburName[16];
- static char _wilburVerb;
-
-protected:
- static HotSpotRec _wilburHotspot;
- Series _roomSeries1;
- Series _general;
-
-public:
- static void setWilburHotspot();
-
public:
Room() : M4::Room() {}
~Room() override {}
-
- void shutdown() override;
- void parser_code() override;
-
- /**
- * Used to tell if x,y is over the walker hotspot
- */
- HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
-
- void compact_mem_and_report() {}
-
- void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
- int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
- int digiSlot = 1, int digiVol = 255);
- void npc_say(int trigger = -1, const char *seriesName = nullptr,
- int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
- int digiSlot = 1, int digiVol = 255);
};
} // namespace Rooms
-} // namespace Burger
+} // namespace Riddle
} // namespace M4
#endif
Commit: 6d5427c93adc98849480144ac1bda3666d122df0
https://github.com/scummvm/scummvm/commit/6d5427c93adc98849480144ac1bda3666d122df0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implemented wilbur_poof
Changed paths:
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 5bf727fd80f..0507f5169dc 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -409,7 +409,11 @@ bool Walker::wilbur_match(const WilburMatch *list) {
}
void Walker::wilbur_poof() {
- error("TODO: Walker::wilbur_poof");
+ player_update_info();
+ _wilburPoof = series_load("999poof");
+ series_play("999poof", _G(player_info).depth, 0, gUNPOOF, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ digi_play("999_003", 1, 255);
}
void Walker::wilbur_unpoof() {
Commit: e2b6d6f0831024494e9c74db6f582f58d47fbd3d
https://github.com/scummvm/scummvm/commit/e2b6d6f0831024494e9c74db6f582f58d47fbd3d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove deprecated code
Changed paths:
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
engines/m4/core/cstring.cpp
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 0507f5169dc..fbfd84e025c 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -271,10 +271,6 @@ void Walker::wilburs_speech_finished() {
kernel_trigger_dispatchx(_trigger);
}
-void Walker::wilbur_teleported() {
- error("TODO: wilbur_teleported");
-}
-
void enable_player() {
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 77551a26b5d..08822e529d1 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -78,7 +78,6 @@ public:
int vol = 256, int channel = 1);
void wilbur_say();
void wilburs_speech_finished();
- void wilbur_teleported();
/**
* Takes an array of string constants in the form of "object", "lookline", "takeline", "useline".
diff --git a/engines/m4/core/cstring.cpp b/engines/m4/core/cstring.cpp
index 6067c505855..46e3bd5c1a9 100644
--- a/engines/m4/core/cstring.cpp
+++ b/engines/m4/core/cstring.cpp
@@ -248,52 +248,6 @@ void str_add_final_lf(char *mystring) {
*temp = '\0';
}
-#ifdef TODO
-char str_parse_buffer[STR_PARSE_BUFFER_SIZE + 1];
-char str_parse_delimiter;
-bool str_parse_done = YES;
-
-void str_parse_init(char *instring, char delimiter) {
- if (!instring)
- return;
-
- int len;
-
- len = strlen(instring); /* Eval once since C's STRLEN is way slow */
-
- Common::strcpy_s(str_parse_buffer, instring);
- str_parse_delimiter = delimiter;
- str_parse_done = NO;
-}
-
-char *str_parse(char *out) {
- if (!out)
- return NULL;
-
- char *test;
- char tmp[STR_PARSE_BUFFER_SIZE + 1];
-
- Common::strcpy_s(tmp, str_parse_buffer);
- test = tmp;
- while (test[0] != 0 && test[0] != str_parse_delimiter)
- test++;
-
- if (test[0] == 0) { /* Last segment in original string */
- Common::strcpy_s(out, str_parse_buffer);
- str_parse_done = YES;
- return(out);
- }
-
- /* Otherwise, there must be more left in the buffer */
- test[0] = 0; /* Force an end-of-string in our temp area */
- Common::strcpy_s(out, tmp); /* Copy the good part to the output string */
- Common::strcpy_s(str_parse_buffer, test + 1); /* Copy back the remainder */
- return(out);
-}
-
-#endif
-
-//new!
int16 char_IsIn(char ch, char *str) {
if (!str)
return -1;
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 2b6c53095ef..01a606eef85 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -223,7 +223,7 @@ void SysFile::open_read() {
}
void SysFile::open_write() {
- error("TODO: open_write");
+ error("TODO: open_write if needed");
}
Common::String SysFile::get_last_string(const Common::String &src) {
Commit: 2a96a63e8eaae8cd96b432d8babcd015e15e5853
https://github.com/scummvm/scummvm/commit/2a96a63e8eaae8cd96b432d8babcd015e15e5853
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Handle original save files outer file structure
Changed paths:
engines/m4/m4.cpp
engines/m4/m4.h
engines/m4/metaengine.cpp
engines/m4/metaengine.h
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 41d2d20d9fa..e9e0050b9b7 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -139,7 +139,49 @@ Common::Error M4Engine::loadGameState(int slot) {
}
Common::Error M4Engine::loadGameStateDoIt(int slot) {
- return Engine::loadGameState(slot);
+ Common::InSaveFile *save = getOriginalSave(slot);
+
+ if (save) {
+ // Skip original description
+ int descSize = save->readUint32LE();
+ save->seek(descSize + 45, SEEK_CUR);
+
+ int thumbSize = save->readUint32LE();
+ save->seek(thumbSize, SEEK_CUR);
+
+ // We're now at data section, handle it
+ Common::Serializer s(save, nullptr);
+ Common::Error result = syncGame(s);
+
+ delete save;
+
+ return result;
+
+ } else {
+ return Engine::loadGameState(slot);
+ }
+}
+
+Common::InSaveFile *M4Engine::getOriginalSave(int slot) const {
+ Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(
+ getSaveStateName(slot));
+ char name[16];
+
+ if (save) {
+ if (save->seek(-44, SEEK_END) && save->read(name, 7) == 7 &&
+ !strncmp(name, "MIRROR", 7)) {
+ save->seek(0);
+ return save;
+ } else if (save->seek(-44, SEEK_END) && save->read(name, 7) == 7 &&
+ !strncmp(name, "FAUCET ", 7)) {
+ save->seek(0);
+ return save;
+ }
+
+ delete save;
+ }
+
+ return nullptr;
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 3ea5f782142..9640cd1bd1a 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -52,6 +52,12 @@ private:
*/
void m4_inflight();
+ /**
+ * Opens up a savefile in a given slot, and if it's an
+ * original savegame, returns a reference to it
+ */
+ Common::InSaveFile *getOriginalSave(int slot) const;
+
protected:
// Engine APIs
Common::Error run() override;
diff --git a/engines/m4/metaengine.cpp b/engines/m4/metaengine.cpp
index 303a576b6a7..7b9105b1c3f 100644
--- a/engines/m4/metaengine.cpp
+++ b/engines/m4/metaengine.cpp
@@ -20,6 +20,8 @@
*/
#include "common/translation.h"
+#include "common/savefile.h"
+#include "common/system.h"
#include "m4/metaengine.h"
#include "m4/detection.h"
@@ -75,6 +77,45 @@ bool M4MetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+SaveStateDescriptor M4MetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String saveName = Common::String::format("%s.%03u", target, slot);
+ Common::InSaveFile *save = getOriginalSave(saveName);
+
+ if (save) {
+ save->skip(4);
+ char saveDesc[32];
+ save->read(saveDesc, 32);
+ saveDesc[31] = '\0';
+ delete save;
+
+ SaveStateDescriptor desc(this, slot, saveDesc);
+ return desc;
+ } else {
+ return AdvancedMetaEngine::querySaveMetaInfos(target, slot);
+ }
+}
+
+Common::InSaveFile *M4MetaEngine::getOriginalSave(const Common::String &saveName) const {
+ Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(saveName);
+ char name[16];
+
+ if (save) {
+ if (save->seek(-44, SEEK_END) && save->read(name, 7) == 7 &&
+ !strncmp(name, "MIRROR", 7)) {
+ save->seek(0);
+ return save;
+ } else if (save->seek(-44, SEEK_END) && save->read(name, 7) == 7 &&
+ !strncmp(name, "FAUCET ", 7)) {
+ save->seek(0);
+ return save;
+ }
+
+ delete save;
+ }
+
+ return nullptr;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(M4)
REGISTER_PLUGIN_DYNAMIC(M4, PLUGIN_TYPE_ENGINE, M4MetaEngine);
#else
diff --git a/engines/m4/metaengine.h b/engines/m4/metaengine.h
index 5596b24a7da..8a81e5875b0 100644
--- a/engines/m4/metaengine.h
+++ b/engines/m4/metaengine.h
@@ -25,6 +25,9 @@
#include "engines/advancedDetector.h"
class M4MetaEngine : public AdvancedMetaEngine {
+private:
+ Common::InSaveFile *getOriginalSave(const Common::String &saveName) const;
+
public:
const char *getName() const override;
@@ -38,6 +41,8 @@ public:
bool hasFeature(MetaEngineFeature f) const override;
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
};
#endif // M4_METAENGINE_H
Commit: 080019ccec2aa5361cbcce62ff66b3e5b9a18183
https://github.com/scummvm/scummvm/commit/080019ccec2aa5361cbcce62ff66b3e5b9a18183
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: roomVal2 is player.walker_visible
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/riddle/walker.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 83f1f12a027..d6684bcb68c 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -429,7 +429,7 @@ void BurgerEngine::global_daemon() {
case 10017:
if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
- _G(player).walker_in_this_scene && _G(roomVal2))
+ _G(player).walker_in_this_scene && _G(player).walker_visible)
sendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
@@ -514,7 +514,7 @@ void BurgerEngine::global_parser() {
_G(walker).wilbur_speech("300w056");
goto done;
- } else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ } else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(flags)[V123] = 1;
_G(wilbur_should) = 10004;
ws_turn_to_face(_G(my_walker), 3, gCHANGE_WILBUR_ANIMATION);
@@ -524,35 +524,35 @@ void BurgerEngine::global_parser() {
}
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
- _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10003;
ws_turn_to_face(_G(my_walker), 7, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
- _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10005;
ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
- _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10006;
ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("broken puz dispenser") && player_said_any("gear", "wilbur") &&
- _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10007;
ws_turn_to_face(_G(my_walker), 5, 10016);
goto done;
}
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
- _G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ _G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10008;
ws_turn_to_face(_G(my_walker), 5, gCHANGE_WILBUR_ANIMATION);
goto done;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 2fdbb51ddeb..1214db0664d 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -91,7 +91,7 @@ void Flags::set_boonsville_time(int32 time) {
}
bool Flags::advance_boonsville_time_and_check_schedule(int32 time) {
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
(*this)[BOONSVILLE_TIME2] = (*this)[BOONSVILLE_TIME];
(*this)[BOONSVILLE_TIME] = time;
return dispatch_scheduled_boonsville_time_trigger(
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index ac7f882bbe1..6116c4dbd4d 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -42,7 +42,7 @@ void Room::setWilburHotspot() {
}
HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
- if (!_G(player).walker_in_this_scene || !_G(roomVal2))
+ if (!_G(player).walker_in_this_scene || !_G(player).walker_visible)
return nullptr;
player_update_info();
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index a7d332dc096..7e58b20206a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -202,7 +202,7 @@ void Room101::init() {
}
void Room101::daemon() {
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info(_G(my_walker), &_G(player_info));
if (_G(player_info).y > 374 && player_said("old bridge")) {
@@ -601,7 +601,7 @@ void Room101::daemon() {
if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) &&
+ } else if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 8740bc045d7..b4b35964615 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -960,7 +960,7 @@ void Room102::daemon() {
break;
case 1037:
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE)
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE)
freshen();
else
kernel_timing_trigger(60, 1037);
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index cab618efcfa..f21cf8c81db 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -173,7 +173,7 @@ void Room103::daemon() {
_flag1 = false;
term_message("left");
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
term_message("caught");
kernel_timing_trigger(1, 8);
intr_freshen_sentence();
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index d1e51a55e5d..3365af218db 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -105,7 +105,7 @@ void Room104::init() {
void Room104::daemon() {
int frame, frameRate;
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info();
if (_G(player_info).y > 374) {
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 1581a1dc76b..0714d774494 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -103,7 +103,7 @@ void Room133_136::init() {
void Room133_136::daemon() {
int frame;
- if (player_commands_allowed() && _G(roomVal2)) {
+ if (player_commands_allowed() && _G(player).walker_visible) {
player_update_info();
if (_G(player_info).y < 188 && _flag) {
@@ -265,7 +265,7 @@ void Room133_136::daemon() {
break;
case 10028:
- if (player_commands_allowed() && _G(roomVal2) &&
+ if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 1268a8402be..37fc165ac42 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -763,7 +763,7 @@ void Room135::daemon() {
break;
case 10028:
- if (player_commands_allowed() && _G(roomVal2) &&
+ if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 385317190d5..e3c3acd654f 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -148,7 +148,7 @@ void Room137::init() {
void Room137::daemon() {
int frame;
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info();
if (_G(player_info).y < 235 && player_said("FORK IN THE ROAD")) {
@@ -645,7 +645,7 @@ void Room137::daemon() {
break;
case 10028:
- if (player_commands_allowed() && _G(roomVal2) &&
+ if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index 78328ae5602..a4b377a7ce0 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -376,7 +376,7 @@ void Room139_144::daemon() {
case g10028:
if (!_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
Section1::updateDisablePlayer();
kernel_timing_trigger(1, 3);
} else {
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 1fb9f2ba567..eb1ccaf734e 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -508,7 +508,7 @@ void Room142::daemon() {
_G(flags)[V000] = 1003;
- if (player_commands_allowed() && _G(roomVal2) &&
+ if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
digi_preload("100_013");
digi_play("100_013", 3, 155);
@@ -536,7 +536,7 @@ void Room142::daemon() {
} else {
player_update_info();
- if (player_commands_allowed() && _G(roomVal2) &&
+ if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
player_set_commands_allowed(false);
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index d20a3d1d1b0..391da3ba810 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -204,7 +204,7 @@ void Room143::daemon() {
int frame;
if (_G(flags)[V064] == 1) {
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info();
if (_G(player_info).y < 260) {
@@ -217,7 +217,7 @@ void Room143::daemon() {
if (_G(flags)[V063] && !digi_play_state(2))
digi_play_loop("143_002", 2, 255, -1);
- if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE && _flag1) {
+ if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE && _flag1) {
player_update_info();
if (_G(player_info).y > 324)
@@ -1069,7 +1069,7 @@ void Room143::daemon() {
case 10028:
if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
_G(flags)[V000] = 1003;
hotspot_set_active("burl", true);
player_set_commands_allowed(false);
@@ -1091,7 +1091,7 @@ void Room143::daemon() {
case 10029:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
_val1 = 20;
player_set_commands_allowed(false);
intr_freshen_sentence();
@@ -1104,7 +1104,7 @@ void Room143::daemon() {
case 10030:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
_val6 = 31;
} else {
kernel_timing_trigger(60, 10030);
@@ -1114,7 +1114,7 @@ void Room143::daemon() {
case 10031:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
- } else if (player_commands_allowed() && _G(roomVal2) && INTERFACE_VISIBLE) {
+ } else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
_G(kernel).continue_handling_trigger = true;
player_update_info();
player_set_commands_allowed(false);
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 8eb2262b311..88aac9ef7f0 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -1067,7 +1067,7 @@ void Room405::conv86() {
conv_resume();
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
@@ -1083,7 +1083,7 @@ void Room405::conv86() {
_digiName = sound;
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(sound, 1, 255, 18);
@@ -1114,7 +1114,7 @@ void Room405::conv89() {
conv_resume();
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
@@ -1135,7 +1135,7 @@ void Room405::conv89() {
_digiName = sound;
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(sound, 1, 255, 18);
@@ -1158,7 +1158,7 @@ void Room405::conv90() {
_val1 = 39;
conv_resume();
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
@@ -1168,7 +1168,7 @@ void Room405::conv90() {
_val1 = 44;
_digiName = sound;
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(sound, 1, 255, 18);
@@ -1191,7 +1191,7 @@ void Room405::conv91() {
_val1 = 39;
conv_resume();
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
conv_resume();
@@ -1201,7 +1201,7 @@ void Room405::conv91() {
_val1 = 44;
_digiName = sound;
} else if (who == 1) {
- if (_G(roomVal2))
+ if (_G(player).walker_visible)
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
digi_play(sound, 1, 255, 18);
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 45f1794b8a0..23bedc7413e 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -206,7 +206,7 @@ void Section4::poof(int trigger) {
digi_preload("999_003");
player_update_info();
- if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
ws_hide_walker();
series_play("999poof", _G(player_info).depth, 0, trigger, 6, 0,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 1db865649a7..9801dfbf5e8 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -685,7 +685,7 @@ void Room503::daemon() {
case 16:
if (!_flag4) {
- if (_G(roomVal2) && player_commands_allowed()) {
+ if (_G(player).walker_visible && player_commands_allowed()) {
intr_cancel_sentence();
player_set_commands_allowed(false);
ws_walk(260, 300, 0, 17, 2, true);
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index d5132e19b5a..c7e8d6cdd5f 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -107,7 +107,6 @@ public:
bool _menuSystemInitialized = false;
bool _gameMenuFromMain = false;
int _room902Flag = 0;
- int _roomVal2 = 0;
int _roomVal3 = 0;
int _roomVal4 = 0;
int _roomVal7 = 3;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index fbfd84e025c..0c8e4cadace 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -147,11 +147,11 @@ machine *Walker::walk_initialize_walker() {
int32 s;
if (!_G(player).walker_in_this_scene) {
- _G(roomVal2) = 0;
+ _G(player).walker_visible = false;
m = nullptr;
} else {
- _G(roomVal2) = 1;
+ _G(player).walker_visible = true;
// Wilbur walker
_G(player).walker_type = WALKER_WILBUR;
@@ -226,7 +226,7 @@ void Walker::wilbur_speech(const char *name, int trigger, int room, byte flags,
void Walker::wilbur_say() {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
- if (_flag && _G(player).walker_in_this_scene && _G(roomVal2))
+ if (_flag && _G(player).walker_in_this_scene && _G(player).walker_visible)
sendWSMessage(0x140000, 0, _G(my_walker), 0, 0, 1);
term_message("wilbur_say: wilburs_talk_trigger = %d", _trigger);
@@ -264,7 +264,7 @@ bool Walker::wilbur_said(const char *list[][4]) {
}
void Walker::wilburs_speech_finished() {
- if (_flag && !_G(player).walker_in_this_scene && !_G(roomVal2))
+ if (_flag && !_G(player).walker_in_this_scene && !_G(player).walker_visible)
sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
term_message("wilburs_speech_finished: dispatching wilburs_talk_trigger = %d", _trigger);
@@ -286,7 +286,7 @@ void wilbur_abduct(int trigger) {
digi_stop(1);
digi_preload("999_004");
- if (_G(my_walker) && _G(player).walker_in_this_scene && _G(roomVal2)) {
+ if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
player_update_info(_G(my_walker), &_G(player_info));
switch (_G(walkTrigger)) {
diff --git a/engines/m4/riddle/walker.cpp b/engines/m4/riddle/walker.cpp
index e1e16f06682..93a02463327 100644
--- a/engines/m4/riddle/walker.cpp
+++ b/engines/m4/riddle/walker.cpp
@@ -150,11 +150,11 @@ machine *Walker::walk_initialize_walker() {
int32 s;
if (!_G(player).walker_in_this_scene) {
- _G(roomVal2) = 0;
+ _G(player).walker_visible = false;
m = nullptr;
} else {
- _G(roomVal2) = 1;
+ _G(player).walker_visible = true;
// Wilbur walker
_G(player).walker_type = WALKER_WILBUR;
Commit: 6f4301c8f0ea91bc88249e536bf7e1ca2d9fbe33
https://github.com/scummvm/scummvm/commit/6f4301c8f0ea91bc88249e536bf7e1ca2d9fbe33
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: visited_room is player.been_here_before
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room609.cpp
engines/m4/core/rooms.cpp
engines/m4/vars.h
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index e3c3acd654f..6a90245abc4 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -578,7 +578,7 @@ void Room137::daemon() {
case 4:
player_set_commands_allowed(true);
- if (!_G(visited_room))
+ if (!_G(player).been_here_before)
wilbur_speech("137w001");
break;
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 391da3ba810..70a281033fd 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -278,7 +278,7 @@ void Room143::daemon() {
break;
case 13:
- if (_G(visited_room)) {
+ if (_G(player).been_here_before) {
if (inv_object_is_here("broken mouse trap")) {
wilbur_speech("143w507", 14);
} else {
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 6eb559d6913..b228aff8667 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -175,7 +175,7 @@ const seriesPlayBreak Room402::PLAY16[] = {
void Room402::init() {
- term_message(_G(visited_room) ? " been here before" : " NOT been here before");
+ term_message(_G(player).been_here_before ? " been here before" : " NOT been here before");
_val4 = 0;
_dr01 = _dr01s = -1;
_dr02 = _dr02s = -1;
@@ -231,7 +231,7 @@ void Room402::init() {
_val3 = 15;
kernel_trigger_dispatch_now(3);
- if (_G(visited_room)) {
+ if (_G(player).been_here_before) {
if (_G(game).previous_room == RESTORING_GAME) {
_val2 = 15;
} else {
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 77df202e590..393cc95546c 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -796,7 +796,7 @@ void Room602::daemon() {
ws_unhide_walker();
player_set_commands_allowed(true);
- if (_G(visited_room)) {
+ if (_G(player).been_here_before) {
_G(wilbur_should) = 10001;
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
} else {
diff --git a/engines/m4/burger/rooms/section6/room609.cpp b/engines/m4/burger/rooms/section6/room609.cpp
index feb637da0c0..0767ea280c4 100644
--- a/engines/m4/burger/rooms/section6/room609.cpp
+++ b/engines/m4/burger/rooms/section6/room609.cpp
@@ -55,7 +55,7 @@ void Room609::init() {
void Room609::daemon() {
switch (_G(kernel).trigger) {
case 1:
- _state1 = _G(visited_room) ? 1 : imath_ranged_rand(2, 3);
+ _state1 = _G(player).been_here_before ? 1 : imath_ranged_rand(2, 3);
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "609wi01", 6, 1, 6010);
break;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 835dd9b837e..dd4bce4b103 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -154,7 +154,7 @@ void Sections::m4SceneLoad() {
MoveScreenAbs(_G(game_buff_ptr), _G(player_info).camera_x, _G(player_info).camera_y);
}
- _G(visited_room) = player_been_here(_G(game).room_id);
+ _G(player).been_here_before = player_been_here(_G(game).room_id);
term_message("calling room_init_code");
room_init();
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 2d103e0547d..2ff64b9c374 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -187,7 +187,6 @@ public:
cursor_states _cursor_state = kARROW;
int _iPitch = 0;
int _click_x = 0, _click_y = 0;
- bool _visited_room = false;
};
#define _G(X) (g_vars->_##X)
Commit: ff2f33d306298d9644773f9ac07005e648f8944a
https://github.com/scummvm/scummvm/commit/ff2f33d306298d9644773f9ac07005e648f8944a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Changed walkTrigger to player_info.trigger
Changed paths:
engines/m4/adv_r/adv_player.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 9d5783a79a8..4ca57151d78 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -90,7 +90,9 @@ struct Player {
};
struct PlayerInfo {
- int32 x = 0, y = 0, facing = 0, scale = 0, depth = 0;
+ int32 x = 0, y = 0, facing = 0;
+ int32 trigger = 0;
+ int32 scale = 0, depth = 0;
int32 camera_x = 0, camera_y = 0;
void syncGame(Common::Serializer &s);
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index b4b35964615..e62bb69a6f3 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1568,7 +1568,7 @@ void Room102::conv04() {
} else if (who == 1) {
player_update_info();
- if (_G(walkTrigger) != 2) {
+ if (_G(player_info).trigger != 2) {
ws_walk(192, 327, 0, 7, 2);
} else if (node == 4 && entry == 1) {
digi_preload("04p0502", 102);
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 3a09e4d24c0..23f1e36492b 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -94,7 +94,7 @@ void Section1::walk(int facing, int trigger) {
player_update_info(_G(my_walker), &_G(player_info));
if (facing == -1)
- ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(walkTrigger));
+ ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(player_info).trigger);
else
ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, facing, _G(completeWalk));
}
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index d02bbc75ed4..9591032e6f0 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -463,7 +463,7 @@ void Section5::daemon() {
player_update_info();
_G(flags)[V187] = _G(player_info).x;
_G(flags)[V188] = _G(player_info).y;
- _G(flags)[V189] = _G(walkTrigger);
+ _G(flags)[V189] = _G(player_info).trigger;
_G(game).new_room = 510;
break;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 393cc95546c..493b1daf6b7 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -1254,7 +1254,7 @@ void Room602::daemon() {
if (_G(player_info).x >= (_val2 + 330) &&
_G(player_info).y > 289 && _G(player_info).y < 305) {
if (_G(flags)[V255] == 1 && _G(flags)[V278] == 0 &&
- _G(walkTrigger) > 2 && _G(walkTrigger) < 7) {
+ _G(player_info).trigger > 2 && _G(player_info).trigger < 7) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
} else {
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index e5515b76196..802cae53692 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -563,7 +563,7 @@ void Room603::daemon() {
if (_G(player_info).x > 420 && _G(player_info).x < 490 &&
_G(player_info).y > 284 && _G(player_info).y < 305 &&
- _G(walkTrigger) > 2 && _G(walkTrigger) < 7 &&
+ _G(player_info).trigger > 2 && _G(player_info).trigger < 7 &&
_G(flags)[V269] == 1) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 11fb992f0eb..cba50d7cf7b 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -640,7 +640,7 @@ void Room604::daemon() {
player_update_info();
if (_G(player_info).x > 319 && _G(player_info).x < 413 &&
_G(player_info).y > 280 && _G(player_info).y < 305 &&
- _G(walkTrigger) > 2 && _G(walkTrigger) < 7 &&
+ _G(player_info).trigger > 2 && _G(player_info).trigger < 7 &&
_G(flags)[V273] == 1) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index c7e8d6cdd5f..8937f91310c 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -110,7 +110,6 @@ public:
int _roomVal3 = 0;
int _roomVal4 = 0;
int _roomVal7 = 3;
- int _walkTrigger = 0;
machine *_npcSpeech1 = nullptr;
machine *_npcSpeech2 = nullptr;
int _npcTrigger = -1;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 0c8e4cadace..6e534faa9e7 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -289,7 +289,7 @@ void wilbur_abduct(int trigger) {
if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
player_update_info(_G(my_walker), &_G(player_info));
- switch (_G(walkTrigger)) {
+ switch (_G(player_info).trigger) {
case 1:
case 2:
series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
Commit: 5f1d4f11b518b463202cfebb286f17dfcf58e29f
https://github.com/scummvm/scummvm/commit/5f1d4f11b518b463202cfebb286f17dfcf58e29f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: player_info trigger is really facing
Changed paths:
engines/m4/adv_r/adv_player.h
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/walker.cpp
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index 4ca57151d78..dc8472feb1d 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -91,7 +91,6 @@ struct Player {
struct PlayerInfo {
int32 x = 0, y = 0, facing = 0;
- int32 trigger = 0;
int32 scale = 0, depth = 0;
int32 camera_x = 0, camera_y = 0;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index e62bb69a6f3..962c4ed4326 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1568,7 +1568,7 @@ void Room102::conv04() {
} else if (who == 1) {
player_update_info();
- if (_G(player_info).trigger != 2) {
+ if (_G(player_info).facing != 2) {
ws_walk(192, 327, 0, 7, 2);
} else if (node == 4 && entry == 1) {
digi_preload("04p0502", 102);
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 23f1e36492b..f95f9835376 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -94,7 +94,7 @@ void Section1::walk(int facing, int trigger) {
player_update_info(_G(my_walker), &_G(player_info));
if (facing == -1)
- ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(player_info).trigger);
+ ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(player_info).facing);
else
ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, facing, _G(completeWalk));
}
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 9591032e6f0..3445ed8e584 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -463,7 +463,7 @@ void Section5::daemon() {
player_update_info();
_G(flags)[V187] = _G(player_info).x;
_G(flags)[V188] = _G(player_info).y;
- _G(flags)[V189] = _G(player_info).trigger;
+ _G(flags)[V189] = _G(player_info).facing;
_G(game).new_room = 510;
break;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 493b1daf6b7..74ee5da093b 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -1254,7 +1254,7 @@ void Room602::daemon() {
if (_G(player_info).x >= (_val2 + 330) &&
_G(player_info).y > 289 && _G(player_info).y < 305) {
if (_G(flags)[V255] == 1 && _G(flags)[V278] == 0 &&
- _G(player_info).trigger > 2 && _G(player_info).trigger < 7) {
+ _G(player_info).facing > 2 && _G(player_info).facing < 7) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
} else {
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 802cae53692..92c843107d2 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -563,7 +563,7 @@ void Room603::daemon() {
if (_G(player_info).x > 420 && _G(player_info).x < 490 &&
_G(player_info).y > 284 && _G(player_info).y < 305 &&
- _G(player_info).trigger > 2 && _G(player_info).trigger < 7 &&
+ _G(player_info).facing > 2 && _G(player_info).facing < 7 &&
_G(flags)[V269] == 1) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index cba50d7cf7b..1d5df7887f1 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -640,7 +640,7 @@ void Room604::daemon() {
player_update_info();
if (_G(player_info).x > 319 && _G(player_info).x < 413 &&
_G(player_info).y > 280 && _G(player_info).y < 305 &&
- _G(player_info).trigger > 2 && _G(player_info).trigger < 7 &&
+ _G(player_info).facing > 2 && _G(player_info).facing < 7 &&
_G(flags)[V273] == 1) {
if (_G(flags)[V264]) {
_G(flags)[V264] = 1;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 6e534faa9e7..348c27cb83b 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -289,7 +289,7 @@ void wilbur_abduct(int trigger) {
if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
player_update_info(_G(my_walker), &_G(player_info));
- switch (_G(player_info).trigger) {
+ switch (_G(player_info).facing) {
case 1:
case 2:
series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
Commit: 30811806ad9f79d2498d54414d44ad9d266340a7
https://github.com/scummvm/scummvm/commit/30811806ad9f79d2498d54414d44ad9d266340a7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: In progress making savegame data match original
Changed paths:
engines/m4/adv_r/adv_game.cpp
engines/m4/adv_r/adv_game.h
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/kernel.h
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
index 7fe750367f3..075e1f56a14 100644
--- a/engines/m4/adv_r/adv_game.cpp
+++ b/engines/m4/adv_r/adv_game.cpp
@@ -24,21 +24,4 @@
namespace M4 {
-void GameControl::syncGame(Common::Serializer &s) {
- // TODO: Ensure this matches the original structure
- for (uint i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
- s.syncAsUint32LE(scratch[i]);
-
- s.syncAsSint16LE(room_id);
- s.syncAsSint16LE(new_room);
- s.syncAsSint16LE(previous_section);
- s.syncAsSint16LE(section_id);
- s.syncAsSint16LE(new_section);
- s.syncAsSint16LE(previous_room);
-
- s.syncAsUint32LE(digi_overall_volume_percent);
- s.syncAsUint32LE(midi_overall_volume_percent);
- s.syncAsByte(camera_pan_instant);
-}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_game.h b/engines/m4/adv_r/adv_game.h
index 4437a36b604..80d7e6c2df6 100644
--- a/engines/m4/adv_r/adv_game.h
+++ b/engines/m4/adv_r/adv_game.h
@@ -29,10 +29,7 @@
namespace M4 {
-#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
-
struct GameControl {
- uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
int16 room_id = 0;
int16 new_room = 0;
int16 previous_section = 0;
@@ -51,8 +48,6 @@ struct GameControl {
new_room = newRoom;
new_section = newRoom / 100;
}
-
- void syncGame(Common::Serializer &s);
};
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index 45c1e73e9ad..3a15c145a31 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -29,36 +29,28 @@
namespace M4 {
void Player::syncGame(Common::Serializer &s) {
- // TODO: Make this match the original's field ordering
- s.syncAsSint32LE(x);
- s.syncAsSint32LE(y);
- s.syncAsSint32LE(facing);
-
+ s.skip(12);
s.syncBytes((byte *)verb, MAX_PLYR_STRING_LEN);
s.syncBytes((byte *)noun, MAX_PLYR_STRING_LEN);
- s.syncBytes((byte *)prep, MAX_PLYR_STRING_LEN);
s.syncBytes((byte *)object, MAX_PLYR_STRING_LEN);
- s.syncBytes((byte *)ws_asset_name, 32);
- s.syncBytes((byte *)ws_shadow_name, 32);
+ s.syncBytes((byte *)prep, MAX_PLYR_STRING_LEN);
+ s.skip(64);
s.syncAsSint16LE(walker_type);
s.syncAsSint16LE(shadow_type);
- s.syncAsSint32LE(walk_off_edge_to_room);
+ s.skip(4);
s.syncAsByte(need_to_walk);
s.syncAsByte(ready_to_walk);
s.syncAsByte(waiting_for_walk);
s.syncAsByte(comm_allowed);
-
- s.syncAsSint32LE(command_ready);
+ s.syncAsUint32LE(command_ready);
s.syncAsByte(walker_visible);
- s.syncAsByte(look_around);
+ s.skip(1);
s.syncAsByte(been_here_before);
-
s.syncAsByte(walker_reload_palette);
s.syncAsByte(disable_hyperwalk);
s.syncAsByte(walker_loads_first);
s.syncAsByte(walker_in_this_scene);
-
s.syncAsSint32LE(walker_trigger);
s.syncAsSint32LE(walk_x);
s.syncAsSint32LE(walk_y);
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 6cdd8081ca7..ab91a012c3b 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -51,7 +51,8 @@ namespace M4 {
void Converstation_Globals::syncGame(Common::Serializer &s) {
uint32 val;
- conv_reset_all();
+ if (s.isLoading())
+ conv_reset_all();
// Handle size
val = conv_save_buff.size();
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index db70aacd4b1..1f995ad1fbc 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -29,8 +29,10 @@ namespace M4 {
#define CACHE_NOT_OVERRIDE_BY_FLAG_PARSE 2
#define KERNEL_RESTORING_GAME -2
+#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
struct Kernel {
+ uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
bool hag_mode = true;
uint32 clock = 0; // Current game timing clock
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index e9e0050b9b7..0ddf0b9e823 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -185,17 +185,40 @@ Common::InSaveFile *M4Engine::getOriginalSave(int slot) const {
}
Common::Error M4Engine::syncGame(Common::Serializer &s) {
- _G(game).syncGame(s);
+ if (s.isSaving())
+ _G(kernel).pause = false;
+
+ // To match the original, we sync a set of fields from kernel and game
+ s.syncAsByte(_G(kernel).pause);
+ for (int i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
+ s.syncAsUint32LE(_G(kernel).scratch[i]);
+
+ s.syncAsByte(_G(kernel)._val1);
+ s.syncAsSint16LE(_G(kernel).last_save);
+ s.syncAsSint16LE(_G(game).room_id);
+ s.syncAsSint16LE(_G(game).new_room);
+ s.syncAsSint16LE(_G(game).previous_section);
+ s.syncAsSint16LE(_G(game).section_id);
+ s.syncAsSint16LE(_G(game).new_section);
+ s.syncAsSint16LE(_G(game).previous_room);
+
+ s.syncAsSint16LE(_G(kernel).restore_game);
+ s.syncAsSint16LE(_G(game).digi_overall_volume_percent);
+ s.syncAsSint16LE(_G(game).midi_overall_volume_percent);
+ s.syncAsByte(_G(kernel)._val2);
+ s.skip(1);
+
_G(player).syncGame(s);
+
_G(player_info).syncGame(s);
syncFlags(s);
player_been_sync(s);
+
_G(conversations).syncGame(s);
_G(inventory)->syncGame(s);
-
if (s.isLoading()) {
// set up variables so everyone knows we've teleported
_G(kernel).restore_game = true;
Commit: e1d5325a00ae8477b6bdfc342915ad3e1f89cc01
https://github.com/scummvm/scummvm/commit/e1d5325a00ae8477b6bdfc342915ad3e1f89cc01
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: game structure save differences for Riddle
Changed paths:
engines/m4/adv_r/conv_io.cpp
engines/m4/m4.cpp
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index ab91a012c3b..108d03bb120 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -49,20 +49,20 @@ namespace M4 {
#define DECL_POINTER 1
void Converstation_Globals::syncGame(Common::Serializer &s) {
- uint32 val;
+ uint32 count;
if (s.isLoading())
conv_reset_all();
// Handle size
- val = conv_save_buff.size();
- s.syncAsUint32LE(val);
+ count = conv_save_buff.size();
+ s.syncAsUint32LE(count);
if (s.isLoading())
- conv_save_buff.resize(val);
+ conv_save_buff.resize(count);
// Read in the buffer
- if (val)
- s.syncBytes(&conv_save_buff[0], val);
+ if (count)
+ s.syncBytes(&conv_save_buff[0], count);
}
void Converstation_Globals::conv_reset_all() {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 0ddf0b9e823..012b02505f5 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -120,11 +120,11 @@ void M4Engine::m4_inflight() {
}
bool M4Engine::canLoadGameStateCurrently(Common::U32String *msg) {
- return g_vars && g_vars->getInterface() && g_vars->getInterface()->_visible;
+ return g_vars && INTERFACE_VISIBLE;
}
bool M4Engine::canSaveGameStateCurrently(Common::U32String *msg) {
- return g_vars && g_vars->getInterface() && g_vars->getInterface()->_visible;
+ return g_vars && INTERFACE_VISIBLE;
}
Common::Error M4Engine::loadGameState(int slot) {
@@ -189,6 +189,9 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
_G(kernel).pause = false;
// To match the original, we sync a set of fields from kernel and game
+ if (getGameType() == GType_Riddle)
+ s.syncAsByte(_G(kernel).going);
+
s.syncAsByte(_G(kernel).pause);
for (int i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
s.syncAsUint32LE(_G(kernel).scratch[i]);
@@ -202,11 +205,15 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
s.syncAsSint16LE(_G(game).new_section);
s.syncAsSint16LE(_G(game).previous_room);
- s.syncAsSint16LE(_G(kernel).restore_game);
- s.syncAsSint16LE(_G(game).digi_overall_volume_percent);
- s.syncAsSint16LE(_G(game).midi_overall_volume_percent);
- s.syncAsByte(_G(kernel)._val2);
- s.skip(1);
+ if (getGameType() == GType_Riddle) {
+ s.skip(20);
+
+ } else {
+ s.syncAsByte(_G(kernel).restore_game);
+ s.syncAsSint32LE(_G(game).digi_overall_volume_percent);
+ s.syncAsSint32LE(_G(game).midi_overall_volume_percent);
+ s.syncAsByte(_G(kernel)._val2);
+ }
_G(player).syncGame(s);
Commit: f1c70d76785ea834848cd9b39bd8c65e2f74ff77
https://github.com/scummvm/scummvm/commit/f1c70d76785ea834848cd9b39bd8c65e2f74ff77
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Savegame fix for game/kernel structure
Changed paths:
engines/m4/m4.cpp
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 012b02505f5..7b2e8adf906 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -206,7 +206,8 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
s.syncAsSint16LE(_G(game).previous_room);
if (getGameType() == GType_Riddle) {
- s.skip(20);
+ // TODO: Determinate if the extra fields need to be synced
+ s.skip(22);
} else {
s.syncAsByte(_G(kernel).restore_game);
Commit: b5c9983f4b53a40d7837ee769bb5c1451456df94
https://github.com/scummvm/scummvm/commit/b5c9983f4b53a40d7837ee769bb5c1451456df94
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup and script fixes for room 104
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room104.h
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 962c4ed4326..0dd6291f102 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -147,7 +147,7 @@ void Room102::init() {
_trigger = -1;
- if (_G(game).previous_room == -2) {
+ if (_G(game).previous_room == RESTORING_GAME) {
if (_G(flags)[V012] == 1) {
ws_demand_location(321, 343);
ws_demand_facing(4);
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 3365af218db..581ce1fec0e 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -84,8 +84,7 @@ void Room104::init() {
break;
default:
- ws_demand_location(213, 297);
- ws_demand_facing(5);
+ ws_demand_location(213, 297, 5);
break;
}
@@ -129,50 +128,45 @@ void Room104::daemon() {
case 6:
_flag1 = false;
_val2 = 9;
- series_play("104dr04", 512, 2, 3, 6, 0, 100, 0, 0, 0, 10);
- series_play("104dr04s", 513, 2, -1, 6, 0, 100, 0, 0, 0, 10);
+ Series::series_play("104dr04", 0x200, 2, 3, 6, 0, 100, 0, 0, 0, 10);
break;
case 8:
_flag1 = false;
_val2 = 13;
- series_play("104dr04", 512, 2, 3, 6, 0, 100, 0, 0, 0, 10);
- series_play("104dr04s", 513, 2, -1, 6, 0, 100, 0, 0, 0, 10);
+ Series::series_play("104dr04", 0x200, 2, 3, 6, 0, 100, 0, 0, 0, 10);
break;
case 9:
_flag1 = false;
_val2 = 14;
- series_play("104dr02", 512, 0, 3, 6, 0, 100, 0, 0, 0, 7);
- series_play("104dr02s", 513, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ Series::series_play("104dr02", 0x200, 0, 3, 6, 0, 100, 0, 0, 0, 7);
break;
case 10:
digi_stop(2);
freeSeries();
_flag1 = true;
- _series1 = series_play("104DR04", 512, 16, 4, 6, 0, 100, 0, 0, 0, 10);
- _series2 = series_play("104DR04S", 513, 16, -1, 6, 0, 100, 0, 0, 0, 10);
+ _series1.play("104DR04", 0x200, 16, 4, 6, 0, 100, 0, 0, 0, 10);
break;
case 12:
freeSeries();
_val2 = 10;
- series_play_with_breaks(PLAY1, "104DR03", 512, 3, 1);
+ series_play_with_breaks(PLAY1, "104DR03", 0x200, 3, 1);
break;
case 13:
_flag1 = false;
_val2 = 9;
- series_play_with_breaks(PLAY2, "104dr01", 512, 3, 1);
+ series_play_with_breaks(PLAY2, "104dr01", 0x200, 3, 1);
break;
case 14:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
_val2 = 15;
- series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 13, 14);
- series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 13, 14);
+ Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 13, 14);
return;
}
@@ -225,8 +219,7 @@ void Room104::daemon() {
}
frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
- series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
- series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
+ Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 15:
@@ -234,13 +227,11 @@ void Room104::daemon() {
switch (imath_ranged_rand(1, 6)) {
case 1:
_val2 = 14;
- series_play("104dr02", 512, 2, 3, 8, 0, 100, 0, 0, 13, 14);
- series_play("104dr02s", 513, 2, -1, 8, 0, 100, 0, 0, 13, 14);
+ Series::series_play("104dr02", 0x200, 2, 3, 8, 0, 100, 0, 0, 13, 14);
return;
case 2:
_val2 = 16;
- series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 20, 20);
- series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 20, 20);
+ Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 20, 20);
return;
default:
break;
@@ -268,43 +259,41 @@ void Room104::daemon() {
default:
break;
}
+ }
- _flag1 = false;
- ++_val1;
+ _flag1 = false;
+ ++_val1;
- frame = 0;
- if (_val1 < 3)
- frame = 16;
- else if (_val1 < 14)
- frame = 18;
- else {
- switch (imath_ranged_rand(1, 3)) {
- case 1:
- frame = 15;
- break;
- case 2:
- frame = 17;
- break;
- case 3:
- frame = 19;
- break;
- default:
- break;
- }
+ frame = 0;
+ if (_val1 < 3)
+ frame = 11;
+ else if (_val1 < 14)
+ frame = 10;
+ else {
+ switch (imath_ranged_rand(1, 3)) {
+ case 1:
+ frame = 8;
+ break;
+ case 2:
+ frame = 9;
+ break;
+ case 3:
+ frame = 12;
+ break;
+ default:
+ break;
}
-
- frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
- series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
- series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
}
+
+ frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
+ Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 16:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
_val2 = 15;
- series_play("104dr02", 512, 0, 3, 8, 0, 100, 0, 0, 20, 20);
- series_play("104dr02s", 513, 0, -1, 8, 0, 100, 0, 0, 20, 20);
+ Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 20, 20);
break;
} else {
switch (getRandom()) {
@@ -353,8 +342,7 @@ void Room104::daemon() {
}
frameRate = (_val1 < 14) ? 15 : imath_ranged_rand(6, 15);
- series_play("104dr02", 512, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
- series_play("104dr02s", 513, 0, -1, frameRate, 0, 100, 0, 0, frame, frame);
+ Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
}
}
break;
@@ -363,16 +351,14 @@ void Room104::daemon() {
freeSeries();
_flag1 = true;
_val2 = 18;
- _series1 = series_play("104DR04", 512, 4, -1, 6, -1, 100, 0, 0, 11, 15);
- _series2 = series_show("104DR04S", 513, 0, -1, -1, 11);
+ _series1.play("104DR04", 512, 4, -1, 6, -1, 100, 0, 0, 11, 15);
digi_play(conv_sound_to_play(), 1, 255, 3);
break;
case 18:
freeSeries();
_flag1 = true;
- _series1 = series_show("104DR04", 512, 0, -1, -1, 11);
- _series2 = series_show("104DR04S", 513, 0, -1, -1, 11);
+ _series1.show("104DR04", 512, 0, -1, -1, 11);
conv_resume_curr();
break;
@@ -529,8 +515,7 @@ void Room104::conv() {
void Room104::freeSeries() {
if (_flag1) {
- terminateMachine(_series1);
- terminateMachine(_series2);
+ _series1.terminate();
_flag1 = false;
}
}
diff --git a/engines/m4/burger/rooms/section1/room104.h b/engines/m4/burger/rooms/section1/room104.h
index 7886711d143..2ef2355fcd8 100644
--- a/engines/m4/burger/rooms/section1/room104.h
+++ b/engines/m4/burger/rooms/section1/room104.h
@@ -34,8 +34,7 @@ private:
int _val2 = 14;
int _val3 = 0;
bool _flag1 = false;
- machine *_series1 = nullptr;
- machine *_series2 = nullptr;
+ Series _series1;
void conv();
void freeSeries();
Commit: 8e5f7c7cf159b9964bf75601a226b8a1f95af998
https://github.com/scummvm/scummvm/commit/8e5f7c7cf159b9964bf75601a226b8a1f95af998
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect rendering of backwards rendered sprites
Changed paths:
engines/m4/graphics/gr_surface.cpp
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index f0a60bd0824..1ec15bed9a9 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -134,7 +134,7 @@ void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
// Above top of screen
continue;
- const byte *srcP = forwards ? src.getBasePtr(0, srcY) : getBasePtr(src.w - 1, srcY);
+ const byte *srcP = forwards ? src.getBasePtr(0, srcY) : src.getBasePtr(src.w - 1, srcY);
byte *destP = getBasePtr(x, y);
const byte *depthP = depthCodes ? depthCodes + y * w + x : nullptr;
int deltaX = forwards ? 1 : -1;
Commit: 98f791ef86f962f60823695bd0fe9b184c173d76
https://github.com/scummvm/scummvm/commit/98f791ef86f962f60823695bd0fe9b184c173d76
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Script fixes for room 102
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 0dd6291f102..70c79221322 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -159,6 +159,12 @@ void Room102::init() {
digi_preload("102_038");
digi_play("102_038", 2, 255, gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
+
+ // FIXME: In the ScummVM implemention, Wilbur appears bottom center by default,
+ // but it seems like in the original game he doesn't, and remains hidden until
+ // explicitly positioned in the new scene. Doing the positioning below ensures
+ // he doesn't appear briefly in the default location as the scene fades in
+ ws_demand_location(628, 325, 9);
}
kernel_trigger_dispatch_now(6);
@@ -953,7 +959,7 @@ void Room102::daemon() {
break;
case 29:
- if (_G(flags)[V012] == 2)
+ if (_G(flags)[V012] != 2)
player_set_commands_allowed(true);
_val11 = 19;
kernel_trigger_dispatch_now(3);
Commit: 748bc38c6ce4a3eb5883687155c939bada7267d3
https://github.com/scummvm/scummvm/commit/748bc38c6ce4a3eb5883687155c939bada7267d3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix sprite drawing with depth codes
Changed paths:
engines/m4/graphics/gr_surface.cpp
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 1ec15bed9a9..43e0c9f1d2f 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -146,7 +146,8 @@ void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
break;
byte v = *srcP;
- if (destX >= 0 && v != 0 && (!depthP || *depthP == 0 || srcDepth < *depthP)) {
+ byte depth = depthP ? *depthP & 0xf : 0;
+ if (destX >= 0 && v != 0 && (!depthP || depth == 0 || srcDepth < depth)) {
*destP = v;
}
Commit: 4fc5ad38735df47e3d5c584d043284e9c1491a70
https://github.com/scummvm/scummvm/commit/4fc5ad38735df47e3d5c584d043284e9c1491a70
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Reset startup room back to title screen
Changed paths:
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index c3758e158d7..33262e64561 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,8 +110,6 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(101); /*****DEBUG*****/
-
font_set_colors(2, 1, 3);
}
Commit: a20e9226021134017348c6b474ee024855ea8fb1
https://github.com/scummvm/scummvm/commit/a20e9226021134017348c6b474ee024855ea8fb1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Added room 902 daemon
Changed paths:
engines/m4/graphics/gr_series.cpp
engines/m4/graphics/gr_series.h
engines/m4/riddle/rooms/section9/room902.cpp
engines/m4/riddle/rooms/section9/room902.h
diff --git a/engines/m4/graphics/gr_series.cpp b/engines/m4/graphics/gr_series.cpp
index e3d421da7b0..b2e0fb238ef 100644
--- a/engines/m4/graphics/gr_series.cpp
+++ b/engines/m4/graphics/gr_series.cpp
@@ -287,4 +287,27 @@ machine *series_play(const char *seriesName, frac16 layer, uint32 flags, int16 t
return m;
}
+machine *series_ranged_play(const char *seriesName, int32 loopCount, uint32 flags,
+ int32 firstFrame, int32 lastFrame, int32 s, uint32 layer,
+ int32 frameRate, int32 trigger, bool stickWhenDone) {
+ if (loopCount != 1)
+ loopCount = 0;
+ if (stickWhenDone)
+ flags |= 0x10;
+
+ return series_play(seriesName, layer, flags, trigger, frameRate,
+ loopCount, s, 0, 0, firstFrame, lastFrame);
+}
+
+machine *series_plain_play(const char *seriesName, int32 loopCount, uint32 flags,
+ int32 s, int32 layer, int32 frameRate, int32 trigger, bool stickWhenDone) {
+ if (stickWhenDone)
+ flags |= 0x10;
+ if (loopCount != 1)
+ loopCount = 0;
+
+ return series_play(seriesName, layer, flags, trigger, frameRate, loopCount, s);
+}
+
+
} // namespace M4
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 731b41a155e..042ccb959d9 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -102,20 +102,15 @@ extern machine *series_show(const char *seriesName, frac16 layer, uint32 flags =
int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
int32 x = 0, int32 y = 0);
-/*extern machine *series_ranged_play(char *seriesName, int32 loopCount, uint32 flags,
- int32 firstFrame, int32 lastFrame,
- int32 s, int32 layer, int32 frameRate,
- int16 triggerNum, bool stick_when_done);
-
-machine *series_ranged_play_xy(char *seriesName, int32 loopCount, uint32 flags,
- int32 firstFrame, int32 lastFrame,
- int32 x, int32 y,
- int32 s, int32 layer, int32 frameRate,
- int16 triggerNum, bool stick_when_done);
- */
-machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger);
-bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
-void series_set_frame_rate(machine *m, int32 newFrameRate);
+extern machine *series_ranged_play(const char *seriesName, int32 loopCount, uint32 flags,
+ int32 firstFrame, int32 lastFrame, int32 s, uint32 layer,
+ int32 frameRate, int32 trigger = -1, bool stick_when_done = false);
+extern machine *series_plain_play(const char *seriesName, int32 loopCount, uint32 flags,
+ int32 s, int32 layer, int32 frameRate, int32 trigger = -1, bool stickWhenDone = false);
+
+extern machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger);
+extern bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
+extern void series_set_frame_rate(machine *m, int32 newFrameRate);
} // namespace M4
diff --git a/engines/m4/riddle/rooms/section9/room902.cpp b/engines/m4/riddle/rooms/section9/room902.cpp
index 4b62f1aaf72..c5dff231dfe 100644
--- a/engines/m4/riddle/rooms/section9/room902.cpp
+++ b/engines/m4/riddle/rooms/section9/room902.cpp
@@ -50,7 +50,80 @@ void Room902::init() {
}
void Room902::daemon() {
- // TODO
+ switch (_G(kernel).trigger) {
+ case -1:
+ // TODO: Is this index correct? Is any of the trigger cases correct?
+ digi_stop(2);
+ break;
+
+ case 0:
+ adv_kill_digi_between_rooms(false);
+ _G(game).setRoom(903);
+ break;
+
+ case 1:
+ series_plain_play("902 one frame hold", -1, 0, 100, 256, 3000);
+ disable_player_commands_and_fade_init(132);
+ break;
+
+ case 2:
+ digi_play("gunshot2", 3, 255, -1, 902);
+ break;
+
+ case 3:
+ digi_play("gunshot1", 3);
+ series_stream_break_on_frame(_everything, 144, 102);
+ break;
+
+ case 4:
+ _G(game).setRoom(494);
+ break;
+
+ case 5:
+ _G(game).setRoom(304);
+ break;
+
+ case 54:
+ _everything = series_stream("EVERYTHING MINUS TITLE FADE", 6, 0x100, 131);
+ series_stream_break_on_frame(_everything, 121, 101);
+ break;
+
+ case 55:
+ kernel_timing_trigger(120, 6);
+ break;
+
+ case 100:
+ terminateMachineAndNull(_title);
+ series_ranged_play("902 TITLE", 1, 2, 0, 9, 100, 0xa00, 5, 5, 0);
+ break;
+
+ case 101:
+ _title = series_ranged_play("902 TITLE", -1, 0, 9, 9, 100, 0xa00, 500, -1, 0);
+ break;
+
+ case 130:
+ series_ranged_play("902 TITLE", 1, 0, 0, 9, 100, 0xa00, 5, 3, 0);
+ break;
+
+ case 131:
+ kernel_timing_trigger(120, 2);
+ kernel_timing_trigger(100, 789);
+ break;
+
+ default:
+ break;
+ }
+
+ bool flag = false;
+ if (_G(MouseState).ButtonState) {
+ _buttonDown = true;
+ } else if (_buttonDown) {
+ _buttonDown = false;
+ flag = true;
+ }
+
+ if (flag)
+ disable_player_commands_and_fade_init(55);
}
} // namespace Rooms
diff --git a/engines/m4/riddle/rooms/section9/room902.h b/engines/m4/riddle/rooms/section9/room902.h
index b0519726a26..ad77233bd91 100644
--- a/engines/m4/riddle/rooms/section9/room902.h
+++ b/engines/m4/riddle/rooms/section9/room902.h
@@ -31,6 +31,8 @@ namespace Rooms {
class Room902 : public Section9Room {
private:
machine *_title = nullptr;
+ machine *_everything = nullptr;
+ bool _buttonDown = false;
public:
Room902() : Section9Room() {}
Commit: 317f6976a7436bc11a5521dd598d03ad62bb7971
https://github.com/scummvm/scummvm/commit/317f6976a7436bc11a5521dd598d03ad62bb7971
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Increased time rate to empirically match original
Changed paths:
engines/m4/platform/timer.cpp
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
index 79a3e65a78c..452cc4fe9c8 100644
--- a/engines/m4/platform/timer.cpp
+++ b/engines/m4/platform/timer.cpp
@@ -25,20 +25,24 @@
namespace M4 {
+// FIXME: I'm honestly not sure what the timer rate is meant to be.
+// THe methods seem indicative of 60 time increments a second,
+// but in ScummVM that makes things too slow. Doubling it to 120
+// seems to resolve the slowness, so I'm leaving the change in place.
uint32 timer_read() {
- return g_system->getMillis() * 60 / 1000;
+ return g_system->getMillis() * 120 / 1000;
}
uint32 timer_read_dos() {
- return g_system->getMillis() * 60 / 1000;
+ return g_system->getMillis() * 120 / 1000;
}
uint32 timer_read_600() {
- return g_system->getMillis() * 600 / 1000;
+ return g_system->getMillis() * 1200 / 1000;
}
uint32 timer_read_60() {
- return g_system->getMillis() * 60 / 1000;
+ return g_system->getMillis() * 120 / 1000;
}
} // End of namespace M4
Commit: 93e1362ba310567dee0b6ff4468d829ad080761b
https://github.com/scummvm/scummvm/commit/93e1362ba310567dee0b6ff4468d829ad080761b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Set default position for player to be off-screen
This prevents the player's position from briefly flashing
on the bottom center of the screen before being placed
where it should be depending on where you entered from
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 70c79221322..15a76cde6f0 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -159,12 +159,6 @@ void Room102::init() {
digi_preload("102_038");
digi_play("102_038", 2, 255, gCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
-
- // FIXME: In the ScummVM implemention, Wilbur appears bottom center by default,
- // but it seems like in the original game he doesn't, and remains hidden until
- // explicitly positioned in the new scene. Doing the positioning below ensures
- // he doesn't appear briefly in the default location as the scene fades in
- ws_demand_location(628, 325, 9);
}
kernel_trigger_dispatch_now(6);
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 348c27cb83b..1ade441f4e6 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -163,7 +163,7 @@ machine *Walker::walk_initialize_walker() {
// initialize with bogus data (this is for the real walker)
s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
- _G(globals)[GLB_TEMP_4] = 320 << 16;
+ _G(globals)[GLB_TEMP_4] = -320 << 16;
_G(globals)[GLB_TEMP_5] = 400 << 16;
_G(globals)[GLB_TEMP_6] = s;
_G(globals)[GLB_TEMP_7] = 3 << 16; // facing
Commit: 77c3a7c58452530e5fd7c8facf049f64fd5bab7c
https://github.com/scummvm/scummvm/commit/77c3a7c58452530e5fd7c8facf049f64fd5bab7c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix resuming game from main menu
Changed paths:
engines/m4/burger/other.cpp
engines/m4/m4.cpp
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
index 816938b5fe4..2e04ffe3adc 100644
--- a/engines/m4/burger/other.cpp
+++ b/engines/m4/burger/other.cpp
@@ -41,7 +41,7 @@ void other_resurrect_player() {
old_mode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
- other_fade_me_out(255);
+ other_fade_me_out(32001);
_G(kernel).trigger_mode = old_mode;
player_set_commands_allowed(false);
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 7b2e8adf906..156609bed00 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -250,7 +250,7 @@ bool M4Engine::autosaveExists() const {
}
bool M4Engine::savesExist() const {
- return getMetaEngine()->listSaves(_targetName.c_str()).empty();
+ return !getMetaEngine()->listSaves(_targetName.c_str()).empty();
}
} // End of namespace M4
Commit: e196872c38f4cf592069dab56f71abfc0887cee8
https://github.com/scummvm/scummvm/commit/e196872c38f4cf592069dab56f71abfc0887cee8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Implement InitializeSlotTables
Changed paths:
engines/m4/burger/gui/game_menu.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 12008f91f19..a09c3bf4d79 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -3474,46 +3474,25 @@ void cb_SaveLoad_Slot(void *theItem, void *theMenu) {
}
}
-
void InitializeSlotTables(void) {
-#ifdef TODO
- int32 i, j;
- char saveFN[80];
- FILE *handle;
- int32 read1, read2;
+ const SaveStateList saves = g_engine->listSaves();
- Common::sprintf_s(saveFN, "%s\\saves.dir", homeDir);
- handle = fopen(saveFN, "rb");
+ // First reset all the slots to empty
+ for (int i = 0; i < MAX_SLOTS; ++i) {
+ Common::strcpy_s(_GM(slotTitles)[i], 80, "<empty>");
+ _GM(slotInUse)[i] = false;
+ }
- if (handle) {
- for (i = 0; i < MAX_SLOTS; i++) {
- read1 = fread(&_GM(slotInUse)[i], 1, 1, handle);
- read2 = fread(_GM(slotTitles)[i], 80, 1, handle);
- if ((!read1) || (!read2)) {
- for (j = i; j < MAX_SLOTS; j++) {
- _GM(slotInUse)[j] = false;
- Common::strcpy_s(_GM(slotTitles)[j], "<empty>");
- }
- i = MAX_SLOTS;
- }
- }
- fclose(handle);
- } else {
- for (i = 0; i < MAX_SLOTS; i++) {
- Common::strcpy_s(_GM(slotTitles)[i], "<empty>");
- _GM(slotInUse)[i] = false;
- }
+ for (const auto &save : saves) {
+ Common::String desc = save.getDescription();
+ Common::strcpy_s(_GM(slotTitles)[save.getSaveSlot()], 80, desc.c_str());
}
-#else
- error("TODO: InitializeSlotTables");
-#endif
}
-
bool load_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
menuItem *myItem = (menuItem *)theItem;
menuItemButton *myButton;
- bool handled;
+ bool handled;
// Handle the event just like any other button
handled = button_Handler(theItem, eventType, event, x, y, currItem);
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 156609bed00..f935892a87b 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -249,8 +249,12 @@ bool M4Engine::autosaveExists() const {
return result;
}
+SaveStateList M4Engine::listSaves() const {
+ return getMetaEngine()->listSaves(_targetName.c_str());
+}
+
bool M4Engine::savesExist() const {
- return !getMetaEngine()->listSaves(_targetName.c_str()).empty();
+ return !listSaves().empty();
}
} // End of namespace M4
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 9640cd1bd1a..a1e5cf55bf2 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -138,6 +138,11 @@ public:
*/
bool savesExist() const;
+ /**
+ * Lists the saves
+ */
+ SaveStateList listSaves() const;
+
/**
* Show the engine information
*/
Commit: 4a59005825f555755237c485ad52bb7c4e542b35
https://github.com/scummvm/scummvm/commit/4a59005825f555755237c485ad52bb7c4e542b35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: game_menu.cpp formatting
Changed paths:
engines/m4/burger/gui/game_menu.cpp
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index a09c3bf4d79..6b795602f23 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -144,21 +144,17 @@ Sprite *menu_CreateThumbnail(int32 *spriteSize) {
// Paint the interface section of the thumbnail
if (currRow < MAX_VIDEO_Y) {
-
// If the interface is visible, grab it
if (intrBuff) {
-
srcRowPtr = intrBuff->data;
endRow = imath_min(MAX_VIDEO_Y, beginRow + intrBuff->h - 1);
for (currRow = beginRow; currRow <= endRow; currRow += 3) {
-
// Set the src pointers
srcPtr = srcRowPtr;
srcPtr2 = srcRowPtr + intrBuff->stride;
srcPtr3 = srcRowPtr + (intrBuff->stride << 1);
for (i = 0; i < (MAX_VIDEO_X + 1) / 3; i++) {
-
// If the pix is outside of the inventory objects in the interface, set to black
// If ((srcPtr - srcRowPtr < 180) || (srcPtr - srcRowPtr > 575)) {
if (true) { // for now make everything in the interface black
@@ -192,9 +188,8 @@ Sprite *menu_CreateThumbnail(int32 *spriteSize) {
// Update the row pointer
srcRowPtr += intrBuff->stride * 3;
}
- }
- // Else paint the bottom of the thumbnail black
- else {
+ } else {
+ // Else paint the bottom of the thumbnail black
destPtr = (uint8 *)(destBuff->data + ((currRow / 3) * destBuff->stride));
memset(destPtr, 21, (destBuff->h - (currRow / 3)) * destBuff->stride);
}
@@ -377,7 +372,7 @@ menuItem *menu_MsgAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int
menuItem *newItem;
menuItemMsg *msgInfo;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -667,10 +662,10 @@ void menu_DrawButton(void *theItem, void *theMenu, int32 x, int32 y, int32, int3
bool button_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
menuItem *myItem = (menuItem *)theItem;
menuItemButton *myButton;
- bool redrawItem, execCallback, handled;
+ bool redrawItem, execCallback, handled;
ScreenContext *myScreen;
- int32 status;
- int32 currTag;
+ int32 status;
+ int32 currTag;
guiMenu *currMenu;
menuItem *tempItem;
@@ -802,7 +797,7 @@ menuItem *menu_ButtonAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w,
menuItem *newItem;
menuItemButton *buttonInfo;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -989,12 +984,12 @@ void menu_DrawHSlider(void *theItem, void *theMenu, int32 x, int32 y, int32, int
bool hslider_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
menuItem *myItem = (menuItem *)theItem;
menuItemHSlider *mySlider;
- bool redrawItem, execCallback, handled;
+ bool redrawItem, execCallback, handled;
ScreenContext *myScreen;
- int32 status;
- int32 deltaSlide;
- static bool movingFlag;
- static int32 movingX;
+ int32 status;
+ int32 deltaSlide;
+ static bool movingFlag;
+ static int32 movingX;
// Verify params
if ((!myItem) || (!myItem->itemInfo)) {
@@ -1131,7 +1126,7 @@ menuItem *menu_HSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w,
menuItem *newItem;
menuItemHSlider *sliderInfo;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -1321,15 +1316,15 @@ int32 vslider_WhereIsCursor(menuItemVSlider *myVSlider, int32 y) {
bool vslider_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
menuItem *myItem = (menuItem *)theItem;
menuItemVSlider *myVSlider;
- bool redrawItem, execCallback, handled;
- int32 tempFlags;
+ bool redrawItem, execCallback, handled;
+ int32 tempFlags;
ScreenContext *myScreen;
- int32 status;
- int32 deltaSlide;
- int32 currTime;
- static bool movingFlag;
- static int32 movingY;
- static int32 callbackTime;
+ int32 status;
+ int32 deltaSlide;
+ int32 currTime;
+ static bool movingFlag;
+ static int32 movingY;
+ static int32 callbackTime;
// Verify params
if ((!myItem) || (!myItem->itemInfo)) {
@@ -1524,7 +1519,7 @@ menuItem *menu_VSliderAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w,
menuItem *newItem;
menuItemVSlider *vsliderInfo;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -1652,8 +1647,8 @@ void menu_DrawTextField(void *theItem, void *theMenu, int32 x, int32 y, int32, i
Buffer *myBuff = nullptr;
Buffer *backgroundBuff = nullptr;
Sprite *mySprite = nullptr;
- char tempStr[64], tempChar;
- int32 cursorX;
+ char tempStr[64], tempChar;
+ int32 cursorX;
// Verify params
if ((!myItem) || (!myItem->itemInfo) || (!myMenu)) {
@@ -1921,7 +1916,7 @@ menuItem *menu_TextFieldAdd(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32
menuItem *newItem;
menuItemTextField *textInfo;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -2007,7 +2002,7 @@ bool menu_LoadSprites(const char *series, int32 numSprites) {
_GM(menuSeriesResource) = mem_strdup(series);
// Update the palette for the menu
- gr_pal_set_range(_GM(menuPalette), 59, 197); // rid
+ gr_pal_set_range(_GM(menuPalette), 59, 197); // Rid
_GM(spriteCount) = numSprites;
@@ -2072,7 +2067,7 @@ bool menu_Initialize(RGB8 *myPalette) {
game_pause(true);
// Hide the telegram window
- // Hide_telegram_dialog(); // ripley shit again!
+ // Hide_telegram_dialog(); // Ripley shit again!
// Hide the interface
if (INTERFACE_VISIBLE) {
@@ -2327,7 +2322,7 @@ guiMenu *menu_Create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFla
} else {
gr_buffer_rect_copy_2(matte, tempBuff, x1, y1, 0, 0, tempBuff->w, tempBuff->h); // copy all of it
}
- _G(gameDrawBuff)->release(); // release the buffer so it can be moved if nesessary
+ _G(gameDrawBuff)->release(); // Release the buffer so it can be moved if nesessary
// draw the sprite
if (backgroundSprite->sourceHandle) {
@@ -2403,11 +2398,11 @@ bool menu_EventHandler(void *theMenu, int32 eventType, int32 parm1, int32 parm2,
ScreenContext *myScreen;
guiMenu *myMenu = (guiMenu *)theMenu;
menuItem *myItem;
- int32 status, menuX, menuY;
- bool handled;
- static int32 movingX;
- static int32 movingY;
- static bool movingScreen = false;
+ int32 status, menuX, menuY;
+ bool handled;
+ static int32 movingX;
+ static int32 movingY;
+ static bool movingScreen = false;
// Initialize the vars
handled = false;
@@ -2596,7 +2591,7 @@ void menu_ItemDelete(menuItem *myItem, int32 tag, guiMenu *myMenu) {
void menu_ItemRefresh(menuItem *myItem, int32 tag, guiMenu *myMenu) {
ScreenContext *myScreen;
- int32 status;
+ int32 status;
// Verify params
if (!myMenu) {
@@ -2763,7 +2758,7 @@ void DestroyOptionsMenu();
void cb_Options_Game_Cancel(void *, void *) {
- // reset values of items to what they were when options menu came up
+ // Reset values of items to what they were when options menu came up
digi_set_overall_volume(_GM(remember_digi_volume));
_G(flags)[digestability] = _GM(remember_digestability);
@@ -2792,7 +2787,7 @@ void cb_Options_Digi(void *theItem, void *theMenu) {
digi_set_overall_volume(mySlider->percent);
term_message("digi volume: %d", mySlider->percent);
- // this scroller control has been moved, so make sure that the DONE button is not greyed out
+ // This scroller control has been moved, so make sure that the DONE button is not greyed out
menu_EnableButton(nullptr, OM_TAG_DONE, myMenu);
menu_ItemRefresh(nullptr, OM_TAG_DONE, myMenu);
@@ -2808,7 +2803,7 @@ void cb_Options_Digestability(void *theItem, void *theMenu) {
term_message("digestability: %d", mySlider->percent);
_G(flags)[digestability] = mySlider->percent;
- // this scroller control has been moved, so make sure that the DONE button is not greyed out
+ // This scroller control has been moved, so make sure that the DONE button is not greyed out
menu_EnableButton(nullptr, OM_TAG_DONE, myMenu);
menu_ItemRefresh(nullptr, OM_TAG_DONE, myMenu);
}
@@ -2855,7 +2850,7 @@ void CreateOptionsMenu(RGB8 *myPalette) {
menu_HSliderAdd(_GM(opMenu), OM_TAG_DIGESTABILITY, OM_DIGESTABILITY_X, OM_DIGESTABILITY_Y,
OM_DIGESTABILITY_W, OM_DIGESTABILITY_H, _G(flags)[digestability], cb_Options_Digestability, true);
- // remember the values of the items in case the user cancels
+ // Remember the values of the items in case the user cancels
_GM(remember_digi_volume) = digi_get_overall_volume();
_GM(remember_digestability) = _G(flags)[digestability];
@@ -3060,7 +3055,6 @@ void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu) {
firstSlot = imath_max(imath_min(firstSlot, 89), 0);
if (firstSlot > _GM(thumbIndex)) {
-
// Dump Out all thumbnails in slots which don't overlap
startIndex = _GM(thumbIndex);
endIndex = imath_min(_GM(thumbIndex) + 9, firstSlot - 1);
@@ -3080,11 +3074,8 @@ void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu) {
}
}
}
- }
-
- // Else firstSlot < _GM(thumbIndex)
- else {
-
+ } else {
+ // Else firstSlot < _GM(thumbIndex)
// Dump Out all thumbnails in slots which don't overlap
startIndex = imath_max(firstSlot + 10, _GM(thumbIndex));
endIndex = imath_min(_GM(thumbIndex) + 9, 98);
@@ -3114,7 +3105,7 @@ void UpdateThumbNails(int32 firstSlot, guiMenu *myMenu) {
void SetFirstSlot(int32 firstSlot, guiMenu *myMenu) {
menuItem *tempItem;
menuItemButton *myButton;
- int32 i;
+ int32 i;
if (!myMenu) {
return;
@@ -3143,7 +3134,7 @@ void cb_SaveLoad_VSlider(void *theItem, void *theMenu) {
guiMenu *myMenu = (guiMenu *)theMenu;
menuItem *myItem = (menuItem *)theItem;
menuItemVSlider *mySlider;
- bool redraw;
+ bool redraw;
if ((!myMenu) || (!myItem) || (!myItem->itemInfo)) {
return;
@@ -3340,7 +3331,7 @@ void cb_SaveLoad_Load(void *, void *theMenu) {
void cb_SaveLoad_Cancel(void *, void *theMenu) {
guiMenu *myMenu = (guiMenu *)theMenu;
menuItem *myItem;
- int32 i, x, y, w, h;
+ int32 i, x, y, w, h;
// If a slot has been selected, cancel will re-enable all slots
if (_GM(slotSelected) >= 0) {
@@ -3417,7 +3408,7 @@ void cb_SaveLoad_Slot(void *theItem, void *theMenu) {
guiMenu *myMenu = (guiMenu *)theMenu;
menuItem *myItem = (menuItem *)theItem;
menuItemButton *myButton;
- int32 i, x, y, w, h;
+ int32 i, x, y, w, h;
// Verify params
if ((!myMenu) || (!myItem) || (!myItem->itemInfo)) {
@@ -3547,7 +3538,7 @@ bool load_Handler(void *theItem, int32 eventType, int32 event, int32 x, int32 y,
void DestroySaveLoadMenu(bool saveMenu) {
- int32 i;
+ int32 i;
if (!_GM(slMenu)) {
return;
@@ -3581,7 +3572,7 @@ void DestroySaveLoadMenu(bool saveMenu) {
void CreateSaveLoadMenu(RGB8 *myPalette, bool saveMenu) {
ItemHandlerFunction i_handler;
- bool buttonGreyed;
+ bool buttonGreyed;
if (!_G(menuSystemInitialized)) {
menu_Initialize(myPalette);
@@ -3634,6 +3625,7 @@ void CreateSaveLoadMenu(RGB8 *myPalette, bool saveMenu) {
buttonGreyed = true;
i_handler = load_Handler;
}
+
for (int32 i = 0; i < MAX_SLOTS_SHOWN; i++) {
menu_ButtonAdd(_GM(slMenu), 1001 + i,
SL_SCROLL_FIELD_X, SL_SCROLL_FIELD_Y + i * SL_SCROLL_LINE_H,
@@ -3649,6 +3641,7 @@ void CreateSaveLoadMenu(RGB8 *myPalette, bool saveMenu) {
UpdateThumbNails(0, _GM(slMenu));
_GM(saveLoadThumbNail) = _GM(menuSprites)[SL_EMPTY_THUMB];
}
+
menu_MsgAdd(_GM(slMenu), SL_TAG_THUMBNAIL, SL_THUMBNAIL_X, SL_THUMBNAIL_Y, SL_THUMBNAIL_W, SL_THUMBNAIL_H, false);
if (_GM(currMenuIsSave)) {
@@ -3670,6 +3663,7 @@ void CreateGameMenu(RGB8 *myPalette) {
_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
+
_GM(gameMenuFromMain) = false;
CreateGameMenuMain(myPalette);
}
@@ -3678,6 +3672,7 @@ void CreateGameMenuFromMain(RGB8 *myPalette) {
if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
+
_GM(gameMenuFromMain) = true;
CreateGameMenuMain(myPalette);
}
@@ -3692,6 +3687,7 @@ void CreateF2SaveMenu(RGB8 *myPalette) {
_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
+
_GM(saveLoadFromHotkey) = true;
_GM(gameMenuFromMain) = false;
CreateSaveLoadMenu(myPalette, true);
@@ -3707,6 +3703,7 @@ void CreateF3LoadMenu(RGB8 *myPalette) {
_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
+
_GM(saveLoadFromHotkey) = true;
_GM(gameMenuFromMain) = false;
CreateSaveLoadMenu(myPalette, false);
@@ -3716,6 +3713,7 @@ void CreateLoadMenuFromMain(RGB8 *myPalette) {
if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
return;
}
+
_GM(saveLoadFromHotkey) = true;
_GM(gameMenuFromMain) = true;
CreateSaveLoadMenu(myPalette, false);
Commit: 09f92a5bd0f465b3c536970faafddf038287e326
https://github.com/scummvm/scummvm/commit/09f92a5bd0f465b3c536970faafddf038287e326
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove the shorthand pal_fade_init method
Too many callers had parameter variations from it's defaults.
Changed paths:
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/krn_pal.h
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index f21cf8c81db..b32193066b1 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -609,7 +609,7 @@ void Room103::daemon() {
_val2 = 2;
if (!_G(flags)[V023])
- pal_fade_init(1001);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
default:
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 7956ec55d55..6ce33908073 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -1380,7 +1380,7 @@ void Room105::parser() {
wilbur_speech("105w011");
} else if (player_said("exit", "STAIRS")) {
player_set_commands_allowed(false);
- pal_fade_init(7);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 7);
} else if (!player_said("take", "baitbox")) {
return;
}
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 0714d774494..5290319718c 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -314,12 +314,12 @@ void Room133_136::parser() {
} else if (player_said("enter", "old bridge") || player_said("gear", "old bridge") ||
(lookFlag && player_said("old bridge"))) {
player_set_commands_allowed(false);
- pal_fade_init(1008);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1008);
} else if (player_said("enter", "town limits") || player_said("gear", "town limits") ||
(lookFlag && player_said("town limits"))) {
player_set_commands_allowed(false);
- pal_fade_init(1010);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
} else if (inv_player_has(_G(player).verb) &&
player_said_any("old bridge", "town limits", "construction")) {
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 37fc165ac42..1c1742584d0 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -800,11 +800,11 @@ void Room135::parser() {
if (player_said("ENTER", "FORK IN THE ROAD") || player_said("gear", "fork in the road") ||
(lookFlag && player_said("fork in the road"))) {
player_set_commands_allowed(false);
- pal_fade_init(1009);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
} else if (player_said("ENTER", "MAIN STREET") || player_said("gear", "main street") ||
(lookFlag && player_said("main street"))) {
- pal_fade_init(1001);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
} else if (player_said("conv01")) {
conv01();
} else if (player_said("conv02")) {
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 6a90245abc4..8db84fe43fc 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -153,7 +153,7 @@ void Room137::daemon() {
if (_G(player_info).y < 235 && player_said("FORK IN THE ROAD")) {
player_set_commands_allowed(false);
- pal_fade_init(1009);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
}
}
@@ -515,10 +515,10 @@ void Room137::daemon() {
inv_move_object("keys", 138);
inv_move_object("jawz o' life", 137);
_G(flags)[V046] = 0;
- pal_fade_init(1006);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1006);
} else {
- pal_fade_init(1009);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
}
break;
@@ -635,7 +635,7 @@ void Room137::daemon() {
series_play("137wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION,
600, 0, 100, 0, 0, 9, 9);
series_play("137wi01s", 0x100, 0, -1, 600, 0, 100, 0, 0, 9, 9);
- pal_fade_init(1011);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1011);
break;
default:
@@ -700,7 +700,7 @@ void Room137::parser() {
} else if (player_said("ENTER", "FORK IN THE ROAD") ||
player_said("look at", "FORK IN THE ROAD")) {
player_set_commands_allowed(false);
- pal_fade_init(1009);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
} else if (player_said("LOOK AT", "CAR WINDOW")) {
_G(wilbur_should) = 35;
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 8a5f86fc566..fbaff3c4915 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -556,7 +556,7 @@ void Room138::daemon() {
break;
case 7:
- pal_fade_init(1010);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
break;
case 8:
@@ -669,7 +669,7 @@ void Room138::parser() {
} else if (player_said("exit") || player_said("look at", "exit")) {
player_set_commands_allowed(false);
- pal_fade_init(1010);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
} else {
return;
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index a4b377a7ce0..d7cef15397f 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -199,7 +199,7 @@ void Room139_144::daemon() {
break;
case 8:
- pal_fade_init(1013);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1013);
break;
case 9:
@@ -432,7 +432,7 @@ void Room139_144::parser() {
} else if (player_said("enter", "vera's diner") || (lookFlag && player_said("vera's diner"))) {
player_set_commands_allowed(false);
- pal_fade_init(1014);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1014);
} else if (player_said("gear", "rowboat") || player_said("go island")) {
player_set_commands_allowed(false);
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index ab2f01c77b7..fc6464cb438 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -877,7 +877,7 @@ void Room141::daemon() {
break;
case 18:
- pal_fade_init(1012);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1012);
break;
case 19:
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 88851c75d5a..05e28209aa6 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -129,8 +129,8 @@ void Room801::init() {
const char *HEADER = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++";
interface_hide();
player_set_commands_allowed(false);
- pal_fade_set_start(_G(master_palette), 0);
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 0, -1);
+ pal_fade_set_start(0);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
_val1 = 10;
digi_preload("800_001");
@@ -155,7 +155,7 @@ void Room801::init() {
digi_preload_stream_breaks(SERIES7);
digi_preload_stream_breaks(SERIES8);
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 0, -1);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
kernel_trigger_dispatch_now(1);
break;
@@ -187,7 +187,7 @@ void Room801::init() {
void Room801::daemon() {
switch (_G(kernel).trigger) {
case 1:
- pal_fade_init(-1);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
series_stream_with_breaks(SERIES6, "801A", 6, 1, 2);
kernel_timing_trigger(1, 39);
break;
@@ -203,7 +203,7 @@ void Room801::daemon() {
case 4:
digi_play_loop("802_002", 3);
- pal_fade_init(-1);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
series_stream_with_breaks(SERIES7, "802A", 6, 1, 5);
kernel_timing_trigger(1, 39);
break;
@@ -226,7 +226,7 @@ void Room801::daemon() {
case 7:
digi_unload_stream_breaks(SERIES6);
series_stream_with_breaks(SERIES8, "803A", 6, 1, 8);
- pal_fade_init(-1);
+ pal_fade_init(0, 255, 100, 30, -1);
kernel_timing_trigger(1, 40);
break;
@@ -254,7 +254,7 @@ void Room801::daemon() {
_series3 = series_load("804FX03");
_series4 = series_load("804FX04");
series_stream_with_breaks(SERIES9, "804A", 6, 1, 11);
- pal_fade_init(-1);
+ pal_fade_init(0, 255, 100, 30, -1);
break;
case 11:
@@ -513,7 +513,7 @@ void Room801::daemon() {
break;
case 37:
- pal_fade_init(30);
+ pal_fade_init(_G(kernel).first_fade, 255, 100, 30, -1);
break;
case 38:
@@ -525,7 +525,7 @@ void Room801::daemon() {
break;
case 40:
- pal_mirror_colours(119, 112, _G(master_palette));
+ pal_mirror_colours(119, 122, _G(master_palette));
gr_pal_set_range(119, 8);
pal_cycle_init(119, 126, 6, -1, -1);
break;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index e8f96359346..12cb50df926 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -566,10 +566,6 @@ void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent,
pal_fade_init(_G(master_palette), firstPalEntry, lastPalEntry, targetPercent, numTicks, triggerNum);
}
-void pal_fade_init(int32 triggerNum) {
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, triggerNum);
-}
-
void disable_player_commands_and_fade_init(int trigger) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, trigger);
diff --git a/engines/m4/graphics/krn_pal.h b/engines/m4/graphics/krn_pal.h
index e058cf8eb98..8a434a7c52d 100644
--- a/engines/m4/graphics/krn_pal.h
+++ b/engines/m4/graphics/krn_pal.h
@@ -87,7 +87,6 @@ extern void pal_fade_set_start(RGB8 *origPalette, int32 percent);
extern void pal_fade_set_start(int32 percent);
extern void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
extern void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
-extern void pal_fade_init(int32 triggerNum);
extern void disable_player_commands_and_fade_init(int trigger);
extern void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks,
Commit: 56a1b475fa302e837530866ad51befa219306809
https://github.com/scummvm/scummvm/commit/56a1b475fa302e837530866ad51befa219306809
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Revert timer increase
This reverts commit a08f307c4f1da40c4d2270189a952feb4c9faeaf.
This screwed up the timing in the intro cutscenes
Changed paths:
engines/m4/platform/timer.cpp
diff --git a/engines/m4/platform/timer.cpp b/engines/m4/platform/timer.cpp
index 452cc4fe9c8..79a3e65a78c 100644
--- a/engines/m4/platform/timer.cpp
+++ b/engines/m4/platform/timer.cpp
@@ -25,24 +25,20 @@
namespace M4 {
-// FIXME: I'm honestly not sure what the timer rate is meant to be.
-// THe methods seem indicative of 60 time increments a second,
-// but in ScummVM that makes things too slow. Doubling it to 120
-// seems to resolve the slowness, so I'm leaving the change in place.
uint32 timer_read() {
- return g_system->getMillis() * 120 / 1000;
+ return g_system->getMillis() * 60 / 1000;
}
uint32 timer_read_dos() {
- return g_system->getMillis() * 120 / 1000;
+ return g_system->getMillis() * 60 / 1000;
}
uint32 timer_read_600() {
- return g_system->getMillis() * 1200 / 1000;
+ return g_system->getMillis() * 600 / 1000;
}
uint32 timer_read_60() {
- return g_system->getMillis() * 120 / 1000;
+ return g_system->getMillis() * 60 / 1000;
}
} // End of namespace M4
Commit: fda93e5847131acf3bea9f011e206ac29056bbf6
https://github.com/scummvm/scummvm/commit/fda93e5847131acf3bea9f011e206ac29056bbf6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 801 fixes
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 05e28209aa6..3a27f865225 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -290,7 +290,7 @@ void Room801::daemon() {
_G(roomVal4) = 2;
_val3 = 2;
- _series9 = series_play("804FL01", 2);
+ _series9 = series_play("804FL01", 2, 0, -1, 6, -1);
kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(16);
kernel_trigger_dispatch_now(15);
@@ -313,7 +313,7 @@ void Room801::daemon() {
_G(roomVal4) = 13;
}
} else if (who == 1) {
- _val3 = 13;
+ _G(wilbur_should) = 5;
}
}
break;
Commit: 15fcafbd91c82042938bb405d5fc2d8fdeea6c25
https://github.com/scummvm/scummvm/commit/15fcafbd91c82042938bb405d5fc2d8fdeea6c25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: CLeanups and formatting for gui_dialog.cpp
Changed paths:
engines/m4/gui/gui_dialog.cpp
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index ba9616ec6a6..d87e6cdc5bf 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -119,6 +119,7 @@ void vmng_Dialog_Destroy(Dialog *d) {
Item_destroy(tempItem);
tempItem = myItems;
}
+
delete d->dlgBuffer;
mem_free((void *)d);
}
@@ -126,7 +127,9 @@ void vmng_Dialog_Destroy(Dialog *d) {
void DialogDestroy(Dialog *d, M4Rect *r) {
ScreenContext *myScreen;
- if (!d) return;
+ if (!d)
+ return;
+
if (r) {
if ((myScreen = vmng_screen_find((void *)d, nullptr)) != nullptr) {
r->x1 = myScreen->x1;
@@ -135,14 +138,18 @@ void DialogDestroy(Dialog *d, M4Rect *r) {
r->y2 = myScreen->y2;
}
}
+
vmng_screen_dispose((void *)d);
vmng_Dialog_Destroy(d);
}
bool GetDialogCoords(Dialog *d, M4Rect *r) {
ScreenContext *myScreen;
- if ((!d) || (!r)) return false;
- if ((myScreen = vmng_screen_find((void *)d, nullptr)) == nullptr) return false;
+ if ((!d) || (!r))
+ return false;
+ if ((myScreen = vmng_screen_find((void *)d, nullptr)) == nullptr)
+ return false;
+
r->x1 = myScreen->x1;
r->x2 = myScreen->x2;
r->y1 = myScreen->y1;
@@ -155,7 +162,9 @@ bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 t
if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, MESSAGE, nullptr, 0)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+
+ if (!d->itemList)
+ d->itemList = myItem;
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -167,7 +176,10 @@ bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag)
myBuff->w, myBuff->h, (char *)myBuff->data, tag, PICTURE, nullptr, 0)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+
+ if (!d->itemList)
+ d->itemList = myItem;
+
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -178,7 +190,9 @@ bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBA
if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, BUTTON, cb, 0)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+ if (!d->itemList)
+ d->itemList = myItem;
+
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -189,7 +203,10 @@ bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *prompt, M4
if ((myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, REPEAT_BUTTON, cb, 0)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+
+ if (!d->itemList)
+ d->itemList = myItem;
+
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -201,7 +218,9 @@ bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2,
if ((myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, y2 - y1 + 1, nullptr, tag, LISTBOX, cb, 0)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+ if (!d->itemList)
+ d->itemList = myItem;
+
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -213,7 +232,9 @@ bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2,
if ((myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, 0, defaultPrompt, tag, TEXTFIELD, cb, fieldLength)) == nullptr) {
return false;
}
- if (!d->itemList) d->itemList = myItem;
+ if (!d->itemList)
+ d->itemList = myItem;
+
d->listBottom = myItem;
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
@@ -230,17 +251,26 @@ bool Dialog_Remove_Key(Dialog *d, long myKey) {
bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag) {
Buffer *tempBuffer;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
- if (!myItem) myItem = ItemFind(d->itemList, tag);
- if (!myItem) return false;
- //NOTE: if the item removed is the default, cancel, or return item, problems could happen...
- if (myItem->next) myItem->next->prev = myItem->prev;
- else d->listBottom = myItem;
- if (myItem->prev) myItem->prev->next = myItem->next;
- else d->itemList = myItem->next;
+ if (!myScreen)
+ return false;
+ if (!myItem)
+ myItem = ItemFind(d->itemList, tag);
+ if (!myItem)
+ return false;
+
+ // NOTE: if the item removed is the default, cancel, or return item, problems could happen...
+ if (myItem->next)
+ myItem->next->prev = myItem->prev;
+ else
+ d->listBottom = myItem;
+ if (myItem->prev)
+ myItem->prev->next = myItem->next;
+ else
+ d->itemList = myItem->next;
+
gr_color_set(__LTGRAY);
tempBuffer = d->dlgBuffer->get_buffer();
gr_buffer_rect_fill(tempBuffer, myItem->x, myItem->y, myItem->w, myItem->h);
@@ -250,35 +280,48 @@ bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag) {
myScreen->x1 + myItem->x + myItem->w - 1,
myScreen->y1 + myItem->y + myItem->h - 1);
}
+
Item_destroy(myItem);
return true;
}
bool Dialog_ListItemExists(Dialog *d, Item *myItem, int32 tag, char *prompt, int32 listTag) {
- if ((!myItem) && (!d)) return false;
- if (!myItem) myItem = ItemFind(d->itemList, tag);
- if (!myItem) return false;
+ if ((!myItem) && (!d))
+ return false;
+ if (!myItem)
+ myItem = ItemFind(d->itemList, tag);
+ if (!myItem)
+ return false;
+
return ListItemExists(myItem, prompt, listTag);
}
bool Dialog_Add_List_Item(Dialog *d, Item *myItem, char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh) {
ScreenContext *myScreen;
- int32 status;
- bool retValue;
+ int32 status;
+ bool retValue;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
- if (!myItem) myItem = ItemFind(d->itemList, tag);
+
+ if (!myScreen)
+ return false;
+ if (!myItem)
+ myItem = ItemFind(d->itemList, tag);
+
retValue = ListItemAdd(myItem, prompt, listTag, addMode, nullptr);
+
if (retValue && refresh) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
}
+
return true;
}
bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag) {
ScreenContext *myScreen;
- int32 status;
- if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return false;
+ int32 status;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr)
+ return false;
+
if (!myItem) {
myItem = ItemFind(d->itemList, tag);
myListItem = nullptr;
@@ -286,46 +329,55 @@ bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myLis
if (ListItemDelete(myItem, myListItem, listTag)) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
}
+
return true;
}
bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem,
int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh) {
ScreenContext *myScreen;
- int32 status;
- bool retValue;
+ int32 status;
+ bool retValue;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
+
+ if (!myScreen)
+ return false;
if (!myItem) {
myItem = ItemFind(d->itemList, tag);
myListItem = nullptr;
}
+
retValue = ListItemChange(myItem, myListItem, listTag, newPrompt, newListTag, changeMode);
if (retValue && refresh) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
}
+
return retValue;
}
void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag) {
Buffer *tempBuffer;
ScreenContext *myScreen;
- int32 status, tempWidth, tempHeight, itemType;
+ int32 status, tempWidth, tempHeight, itemType;
+
if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) {
return;
}
if (!myItem) {
myItem = ItemFind(d->itemList, tag);
}
+
if (myItem) {
tempWidth = myItem->w;
tempHeight = myItem->h;
+
if (Item_change_prompt(myItem, newPrompt)) {
tempWidth = imath_max(tempWidth, myItem->w);
tempHeight = imath_max(tempHeight, myItem->h);
gr_color_set(__LTGRAY);
tempBuffer = d->dlgBuffer->get_buffer();
gr_buffer_rect_fill(tempBuffer, myItem->x, myItem->y, tempWidth, tempHeight);
+
if (myItem == d->default_item) {
itemType = ITEM_DEFAULT;
} else if (myItem == d->return_item) {
@@ -333,6 +385,7 @@ void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, i
} else {
itemType = ITEM_NORMAL;
}
+
if (Item_show(myItem, (void *)d, tempBuffer, itemType)) {
if (status == SCRN_ACTIVE) {
RestoreScreens(myScreen->x1 + myItem->x, myScreen->y1 + myItem->y,
@@ -340,6 +393,7 @@ void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, i
myScreen->y1 + myItem->y + tempHeight - 1);
}
}
+
d->dlgBuffer->release();
}
}
@@ -347,33 +401,50 @@ void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, i
bool Dialog_ListboxSearch(Dialog *d, Item *myItem, int32 tag, int32 searchMode, char *searchStr, int32 parm1) {
ScreenContext *myScreen;
- int32 status;
- bool returnValue;
+ int32 status;
+ bool returnValue;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
- if (!myItem) myItem = ItemFind(d->itemList, tag);
- if (!myItem || (myItem->type != LISTBOX)) return false;
+
+ if (!myScreen)
+ return false;
+ if (!myItem)
+ myItem = ItemFind(d->itemList, tag);
+ if (!myItem || (myItem->type != LISTBOX))
+ return false;
+
returnValue = ListItemSearch(myItem, searchMode, searchStr, parm1);
Dialog_Refresh_Item(d, myItem, myItem->tag);
return returnValue;
}
Item *Dialog_Get_Item(Dialog *d, int32 tag) {
- if (!d) return nullptr;
+ if (!d)
+ return nullptr;
+
return ItemFind(d->itemList, tag);
}
void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag) {
Buffer *tempBuffer;
ScreenContext *myScreen;
- int32 status, itemType;
- if (!d) return;
- if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return;
- if (!myItem) myItem = ItemFind(d->itemList, tag);
- if (!myItem) return;
- if (myItem == d->default_item) itemType = ITEM_DEFAULT;
- else if (myItem == d->return_item) itemType = ITEM_RETURN;
- else itemType = ITEM_NORMAL;
+ int32 status, itemType;
+
+ if (!d)
+ return;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr)
+ return;
+ if (!myItem)
+ myItem = ItemFind(d->itemList, tag);
+ if (!myItem)
+ return;
+
+ if (myItem == d->default_item)
+ itemType = ITEM_DEFAULT;
+ else if (myItem == d->return_item)
+ itemType = ITEM_RETURN;
+ else
+ itemType = ITEM_NORMAL;
+
tempBuffer = d->dlgBuffer->get_buffer();
if (Item_show(myItem, (void *)d, tempBuffer, itemType)) {
if (status == SCRN_ACTIVE) {
@@ -382,6 +453,7 @@ void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag) {
myScreen->y1 + myItem->y + myItem->h - 1);
}
}
+
d->dlgBuffer->release();
}
@@ -389,8 +461,8 @@ void Dialog_Refresh(Dialog *d) {
Buffer *tempBuffer;
ScreenContext *myScreen;
Item *i;
- int32 status, itemType;
- ButtonDrawRec bdr;
+ int32 status, itemType;
+ ButtonDrawRec bdr;
if (!d) return;
@@ -407,9 +479,11 @@ void Dialog_Refresh(Dialog *d) {
else itemType = ITEM_NORMAL;
Item_show(i, (void *)d, tempBuffer, itemType);
}
+
d->dlgBuffer->release();
- if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr) return;
+ if ((myScreen = vmng_screen_find((void *)d, &status)) == nullptr)
+ return;
if (status == SCRN_ACTIVE) {
RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
}
@@ -461,12 +535,14 @@ static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY) {
Dialog *d;
RectList *myRect;
- //parameter verification
- if (!myScreen) return;
+ // Parameter verification
+ if (!myScreen)
+ return;
d = (Dialog *)(myScreen->scrnContent);
- if (!d) return;
+ if (!d)
+ return;
- //if no destBuffer, then draw directly to video
+ // If no destBuffer, then draw directly to video
if (!destBuffer) {
myRect = myRectList;
while (myRect) {
@@ -476,26 +552,29 @@ static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY) {
// myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, d->dlgBuffer);
myRect = myRect->next;
}
- }
-
- //else draw to the dest buffer
- else {
+ } else {
+ // Else draw to the dest buffer
tempBuffer = d->dlgBuffer->get_buffer();
myRect = myRectList;
+
while (myRect) {
gr_buffer_rect_copy_2(tempBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
myRect = myRect->next;
}
+
d->dlgBuffer->release();
}
}
void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancelTag) {
- if (!d) return;
+ if (!d)
+ return;
+
d->return_item = ItemFind(d->itemList, returnTag);
d->cancel_item = ItemFind(d->itemList, cancelTag);
Dialog_SetDefault(d, defaultTag);
+
if (d->default_item) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
@@ -504,11 +583,14 @@ void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancel
void Dialog_SetDefault(Dialog *d, int32 tag) {
ScreenContext *myScreen;
Item *origItem, *newDefault;
- int32 status;
+ int32 status;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return;
+ if (!myScreen)
+ return;
+
origItem = d->default_item;
newDefault = Item_set_default(d->itemList, d->default_item, tag);
+
if ((!newDefault) || ((newDefault->type != LISTBOX) && (newDefault->type != TEXTFIELD))) {
d->default_item = nullptr;
} else {
@@ -524,35 +606,51 @@ void Dialog_SetDefault(Dialog *d, int32 tag) {
bool Dialog_SetPressed(Dialog *d, int32 tag) {
ScreenContext *myScreen;
Item *myItem;
- int32 status;
+ int32 status;
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
+
+ if (!myScreen)
+ return false;
+
myItem = Item_set_pressed(d->itemList, nullptr, tag);
+
if (myItem) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
- } else return false;
+ } else {
+ return false;
+ }
}
static bool Dialog_SetUnpressed(Dialog *d, int32 tag) {
ScreenContext *myScreen;
Item *myItem;
- int32 status;
+ int32 status;
+
myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen) return false;
+ if (!myScreen)
+ return false;
+
myItem = Item_set_unpressed(d->itemList, nullptr, tag);
if (myItem) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
- } else return false;
+ } else {
+ return false;
+ }
}
static bool Dialog_SetNextDefault(ScreenContext *myScreen, Dialog *d) {
- int32 status;
+ int32 status;
Item *origItem;
- if (!myScreen) myScreen = vmng_screen_find((void *)d, &status);
- else status = SCRN_ACTIVE;
- if (!myScreen) return false;
+
+ if (!myScreen)
+ myScreen = vmng_screen_find((void *)d, &status);
+ else
+ status = SCRN_ACTIVE;
+ if (!myScreen)
+ return false;
+
origItem = d->default_item;
d->default_item = Item_set_next_default(d->default_item, d->itemList);
if (status == SCRN_ACTIVE) {
@@ -563,18 +661,27 @@ static bool Dialog_SetNextDefault(ScreenContext *myScreen, Dialog *d) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
- if (d->default_item) return true;
- else return false;
+
+ if (d->default_item)
+ return true;
+ else
+ return false;
}
static bool Dialog_SetPrevDefault(ScreenContext *myScreen, Dialog *d) {
- int32 status;
+ int32 status;
Item *origItem;
- if (!myScreen) myScreen = vmng_screen_find((void *)d, &status);
- else status = SCRN_ACTIVE;
- if (!myScreen) return false;
+
+ if (!myScreen)
+ myScreen = vmng_screen_find((void *)d, &status);
+ else
+ status = SCRN_ACTIVE;
+ if (!myScreen)
+ return false;
+
origItem = d->default_item;
d->default_item = Item_set_prev_default(d->default_item, d->listBottom);
+
if (status == SCRN_ACTIVE) {
if (origItem && (origItem != d->default_item)) {
Dialog_Refresh_Item(d, origItem, origItem->tag);
@@ -583,54 +690,69 @@ static bool Dialog_SetPrevDefault(ScreenContext *myScreen, Dialog *d) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
- if (d->default_item) return true;
- else return false;
+
+ if (d->default_item)
+ return true;
+ else
+ return false;
}
void Dialog_GetNextListItem(Dialog *d) {
- if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if ((!d->default_item) || (d->default_item->type != LISTBOX))
+ return;
if (GetNextListItem(d->default_item)) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
static void Dialog_GetNextPageList(Dialog *d) {
- if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if ((!d->default_item) || (d->default_item->type != LISTBOX))
+ return;
if (GetNextPageList(d->default_item)) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
void Dialog_GetPrevListItem(Dialog *d) {
- if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if ((!d->default_item) || (d->default_item->type != LISTBOX))
+ return;
if (GetPrevListItem(d->default_item)) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
static void Dialog_GetPrevPageList(Dialog *d) {
- if ((!d->default_item) || (d->default_item->type != LISTBOX)) return;
+ if ((!d->default_item) || (d->default_item->type != LISTBOX))
+ return;
if (GetPrevPageList(d->default_item)) {
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
}
ListItem *Dialog_GetCurrListItem(Dialog *d, Item *i, int32 tag) {
- if ((!i) && (!d)) return nullptr;
- if (!i) i = ItemFind(d->itemList, tag);
- if (!i) return nullptr;
+ if ((!i) && (!d))
+ return nullptr;
+ if (!i)
+ i = ItemFind(d->itemList, tag);
+ if (!i)
+ return nullptr;
+
return i->currItem;
}
char *Dialog_GetCurrListItemPrompt(Dialog *d, Item *i, int32 tag) {
ListItem *myListItem;
- if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr) return nullptr;
+ if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr)
+ return nullptr;
+
return myListItem->prompt;
}
bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag) {
ListItem *myListItem;
- if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr) return false;
+ if ((myListItem = Dialog_GetCurrListItem(d, i, tag)) == nullptr)
+ return false;
+
*listTag = myListItem->tag;
return true;
}
@@ -638,18 +760,27 @@ bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag) {
char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag) {
ListItem *myListItem;
- if (!i) i = ItemFind(d->itemList, tag);
- if (!i) return nullptr;
- if ((myListItem = ListItemFind(i, LIST_BY_TAG, nullptr, listTag)) == nullptr) return nullptr;
+ if (!i)
+ i = ItemFind(d->itemList, tag);
+ if (!i)
+ return nullptr;
+ if ((myListItem = ListItemFind(i, LIST_BY_TAG, nullptr, listTag)) == nullptr)
+ return nullptr;
+
return myListItem->prompt;
}
void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
ScreenContext *myScreen;
- int32 status;
- if ((!i) && (!d)) return;
- if (!i) i = ItemFind(d->itemList, tag);
- if (!i) return;
+ int32 status;
+
+ if ((!i) && (!d))
+ return;
+ if (!i)
+ i = ItemFind(d->itemList, tag);
+ if (!i)
+ return;
+
Item_empty_list(i);
myScreen = vmng_screen_find((void *)d, &status);
Dialog_Refresh_Item(d, i, i->tag);
@@ -658,11 +789,13 @@ void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
void Dialog_RegisterTextField(Dialog *d) {
Item *myItem = nullptr;
ScreenContext *myScreen;
- int32 status;
+ int32 status;
myScreen = vmng_screen_find((void *)d, &status);
- if ((!myScreen) || (status != SCRN_ACTIVE)) return;
- if ((myItem = Item_CheckTextField()) == nullptr) return;
+ if ((!myScreen) || (status != SCRN_ACTIVE))
+ return;
+ if ((myItem = Item_CheckTextField()) == nullptr)
+ return;
if (myItem->callback) {
(myItem->callback)((void *)myItem, (void *)d);
myScreen = vmng_screen_find((void *)d, &status);
@@ -675,7 +808,6 @@ static void SystemErrCallback(void *, void *) {
}
void Dialog_SystemError(char *s) {
-
Dialog *aDlog = DialogCreateAbsolute(0, 0, MAX_VIDEO_X, MAX_VIDEO_Y, SF_ALERT);
Dialog_Add_Message(aDlog, 20, 60, s, 2);
Dialog_Add_Button(aDlog, 50, 80, " OK ", SystemErrCallback, 100);
@@ -683,9 +815,11 @@ void Dialog_SystemError(char *s) {
Dialog_Configure(aDlog, 0, 100, 0);
vmng_screen_show((void *)aDlog);
_GD(okButton) = false;
+
while (!_GD(okButton)) {
gui_system_event_handler();
}
+
DialogDestroy(aDlog, (M4Rect *)nullptr);
}
@@ -695,6 +829,7 @@ void Dialog_KeyMouseCollision(void) {
_GD(clickItem) = nullptr;
_GD(doubleClickItem) = nullptr;
_GD(listboxSearchStr)[0] = '\0';
+
if ((textItem = Item_CheckTextField()) != nullptr) {
if (textItem->callback) {
(textItem->callback)((void *)textItem, nullptr);
@@ -706,18 +841,19 @@ static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, in
ScreenContext *myScreen;
Dialog *d = (Dialog *)myDialog;
Item *myItem, *textItem;
- int32 status;
- bool handled;
- bool clearClickItem;
- static uint32 repeatTime;
- int32 scrollable = 0;
- uint32 tempTime;
- static int32 movingX;
- static int32 movingY;
- char tempStr[2];
+ int32 status;
+ bool handled;
+ bool clearClickItem;
+ static uint32 repeatTime;
+ int32 scrollable = 0;
+ uint32 tempTime;
+ static int32 movingX;
+ static int32 movingY;
+ char tempStr[2];
myScreen = vmng_screen_find(myDialog, &status);
- if ((!myScreen) || (status != SCRN_ACTIVE)) return false;
+ if ((!myScreen) || (status != SCRN_ACTIVE))
+ return false;
if (eventType == EVENT_KEY) {
handled = false;
@@ -736,8 +872,8 @@ static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, in
if ((!myScreen) || (status != SCRN_ACTIVE)) handled = true;
}
}
- } //will fall out to catch the "set next/prev default"
- else {
+ } else {
+ // will fall out to catch the "set next/prev default"
handled = Item_TextEdit(d->default_item, parm1);
Dialog_Refresh_Item(d, d->default_item, d->default_item->tag);
}
@@ -991,13 +1127,14 @@ static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, in
_GD(doubleClickItem) = _GD(clickItem);
_GD(clickItem) = nullptr;
}
+
return true;
}
+
return false;
}
-//TEXTSCRN STUFF...
-
+// TEXTSCRN STUFF...
static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
ScreenContext *myScreen = (ScreenContext *)s;
@@ -1017,69 +1154,65 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
RectList *newUpdateList;
Font *currFont;
- //parameter verification
- if (!myScreen) return;
+ // Parameter verification
+ if (!myScreen)
+ return;
myTextScrn = (TextScrn *)(myScreen->scrnContent);
- if (!myTextScrn) return;
+ if (!myTextScrn)
+ return;
-#if defined(__WIN)
- myGrBuff = (CDIBSectionBuffer *)(myTextScrn->textScrnBuffer);
-#else
myGrBuff = (GrBuff *)(myTextScrn->textScrnBuffer);
-#endif
- if (!myGrBuff) return;
+ if (!myGrBuff)
+ return;
- //if no destBuffer, then draw directly to video
+ // If no destBuffer, then draw directly to video
if (!destBuffer) {
-
tempMatte.nextMatte = nullptr;
- //create an updateRectList to catch the black areas afterwards
+ // Create an updateRectList to catch the black areas afterwards
updateList = vmng_CreateNewRect(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
updateList->prev = nullptr;
updateList->next = nullptr;
- //now loop through all the screens behind myScreen
+ // Now loop through all the screens behind myScreen
tempScreen = myScreen->behind;
while (tempScreen && updateList) {
-
- //duplicate the updateList
+ // Duplicate the updateList
newUpdateList = vmng_DuplicateRectList(updateList);
- //loop through the updateList
+ // Loop through the updateList
updateRect = updateList;
while (updateRect) {
-
- //see if it intersects
+ // See if it intersects
tempMatte.x1 = imath_max(updateRect->x1, tempScreen->x1);
tempMatte.y1 = imath_max(updateRect->y1, tempScreen->y1);
tempMatte.x2 = imath_min(updateRect->x2, tempScreen->x2);
tempMatte.y2 = imath_min(updateRect->y2, tempScreen->y2);
if (tempScreen->redraw && (tempMatte.x1 <= tempMatte.x2) && (tempMatte.y1 <= tempMatte.y2)) {
- //draw the intersected part of tempScreen onto myBuffer
+ // Draw the intersected part of tempScreen onto myBuffer
myBuff = myGrBuff->get_buffer();
(tempScreen->redraw)(tempScreen, (void *)&tempMatte, myBuff, tempMatte.x1 - myScreen->x1, tempMatte.y1 - myScreen->y1);
myGrBuff->release();
- //remove that rectangle from the update list
+ // Remove that rectangle from the update list
vmng_RemoveRectFromRectList(&newUpdateList, tempMatte.x1, tempMatte.y1, tempMatte.x2, tempMatte.y2);
}
- //get the next updateRect
+ // Get the next updateRect
updateRect = updateRect->next;
}
- //the newUpdateList now contains all the pieces not covered by tempScreen;
- //turf the update list, and replace it with the newupdateList
+ // The newUpdateList now contains all the pieces not covered by tempScreen;
+ // Turf the update list, and replace it with the newupdateList
vmng_DisposeRectList(&updateList);
updateList = newUpdateList;
- //now get the next screen
+ // Now get the next screen
tempScreen = tempScreen->behind;
}
- //now we've gone through all the screens, whatever is left in the updateList should be filled in with black
+ // Now we've gone through all the screens, whatever is left in the updateList should be filled in with black
gr_color_set(__BLACK);
updateRect = updateList;
myBuff = myGrBuff->get_buffer();
@@ -1090,35 +1223,37 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
}
myGrBuff->release();
- //now dispose of the updateList
+ // Now dispose of the updateList
vmng_DisposeRectList(&updateList);
- //now we darken (or lighten) the screen by the luminance percentage
+ // Now we darken (or lighten) the screen by the luminance percentage
myBuff = myGrBuff->get_buffer();
krn_ChangeBufferLuminance(myBuff, myTextScrn->luminance);
myGrBuff->release();
- //now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
- //now would be the time to draw the contents
+ // Now myBuff should contain a copy of everything on the screen, except the actual contents of this transparent screen
+ // Now would be the time to draw the contents
currFont = gr_font_get();
gr_font_set(myTextScrn->myFont);
myItem = myTextScrn->myTextItems;
myBuff = myGrBuff->get_buffer();
+
while (myItem) {
if (myItem == myTextScrn->hiliteItem) {
- //gr_font_set_color(myTextScrn->hiliteColor);
+ // Gr_font_set_color(myTextScrn->hiliteColor);
font_set_colors(myTextScrn->hiliteColor_alt1, myTextScrn->hiliteColor_alt2, myTextScrn->hiliteColor);
} else {
- //gr_font_set_color(myTextScrn->textColor);
+ // Gr_font_set_color(myTextScrn->textColor);
font_set_colors(myTextScrn->textColor_alt1, myTextScrn->textColor_alt2, myTextScrn->textColor);
}
gr_font_write(myBuff, myItem->prompt, myItem->x, myItem->y, 0, 0); // MattP no auto spacing
myItem = myItem->next;
}
+
myGrBuff->release();
gr_font_set(currFont);
- //now dump the matte list out to video
+ // Now dump the matte list out to video
myMatte = myRectList;
while (myMatte) {
myGrBuff->refresh_video(myMatte->x1, myMatte->y1, myMatte->x1 - myScreen->x1, myMatte->y1 - myScreen->y1,
@@ -1127,10 +1262,8 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
// myMatte->x2 - myScreen->x1, myMatte->y2 - myScreen->y1, myBuff);
myMatte = myMatte->nextMatte;
}
- }
-
- //else draw to the dest buffer
- else {
+ } else {
+ // Else draw to the dest buffer
myMatte = myRectList;
myBuff = myGrBuff->get_buffer();
while (myMatte) {
@@ -1138,6 +1271,7 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
destX, destY, myMatte->x2 - myMatte->x1 + 1, myMatte->y2 - myMatte->y1 + 1);
myMatte = myMatte->nextMatte;
}
+
myGrBuff->release();
}
}
@@ -1203,7 +1337,9 @@ bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
if (!myTextScrn) {
return false;
}
- if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "text item")) == nullptr) return false;
+ if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "text item")) == nullptr)
+ return false;
+
myTextItem->w = gr_font_string_width(prompt, 0); // No auto spacing
myTextItem->h = gr_font_get_height() + 1;
myTextItem->y = y;
@@ -1240,11 +1376,14 @@ bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
if (!myTextScrn) {
return false;
}
- if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "textscrn msg")) == nullptr) return false;
- myTextItem->w = gr_font_string_width(prompt, 0); //No auto spacing
+ if ((myTextItem = (TextItem *)mem_alloc(sizeof(TextItem), "textscrn msg")) == nullptr)
+ return false;
+
+ myTextItem->w = gr_font_string_width(prompt, 0); // No auto spacing
myTextItem->h = gr_font_get_height() + 1;
myTextItem->y = y;
myTextItem->justification = justification;
+
switch (justification) {
case TS_JUST_LEFT:
myTextItem->x = 0;
@@ -1271,11 +1410,14 @@ bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag) {
ScreenContext *myScreen;
- int32 status, x, y, w, h;
+ int32 status, x, y, w, h;
TextItem *myTextItem, *tempTextItem;
- if ((myScreen = vmng_screen_find((void *)myTextScrn, &status)) == nullptr) return;
+ if ((myScreen = vmng_screen_find((void *)myTextScrn, &status)) == nullptr)
+ return;
+
myTextItem = myTextScrn->myTextItems;
+
if (myTextItem->tag == tag) {
myTextScrn->myTextItems = myTextItem->next;
tempTextItem = myTextItem;
@@ -1284,12 +1426,14 @@ void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag) {
if ((tempTextItem = myTextItem->next) == nullptr) return;
myTextItem->next = tempTextItem->next;
}
+
x = tempTextItem->x;
y = tempTextItem->y;
w = tempTextItem->w;
h = tempTextItem->h;
mem_free(tempTextItem->prompt);
mem_free((void *)tempTextItem);
+
if (status == SCRN_ACTIVE) {
RestoreScreens(myScreen->x1 + x, myScreen->y1 + y, myScreen->x1 + x + w - 1, myScreen->y1 + y + h - 1);
}
@@ -1299,16 +1443,17 @@ static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm
ScreenContext *myScreen;
TextScrn *myTextScrn = (TextScrn *)theTextScrn;
TextItem *myTextItem, *oldHiliteItem;
- int32 status;
- static int32 movingX;
- static int32 movingY;
+ int32 status;
+ static int32 movingX;
+ static int32 movingY;
myScreen = vmng_screen_find(theTextScrn, &status);
- if ((!myScreen) || (status != SCRN_ACTIVE)) return false;
- if (!(eventType == EVENT_MOUSE)) {
+ if ((!myScreen) || (status != SCRN_ACTIVE))
return false;
- }
+ if (!(eventType == EVENT_MOUSE))
+ return false;
+
myTextItem = myTextScrn->myTextItems;
while (myTextItem && (!((parm2 >= myScreen->x1) &&
(parm2 <= myScreen->x2) &&
@@ -1316,9 +1461,11 @@ static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm
(parm3 - myScreen->y1 <= (myTextItem->y + myTextItem->h - 1))))) {
myTextItem = myTextItem->next;
}
+
if (myTextItem && (myTextItem->type == MESSAGE)) {
myTextItem = nullptr;
}
+
if (myTextItem != myTextScrn->hiliteItem) {
oldHiliteItem = myTextScrn->hiliteItem;
myTextScrn->hiliteItem = myTextItem;
@@ -1333,6 +1480,7 @@ static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm
myScreen->y1 + myTextItem->y + myTextItem->h - 1);
}
}
+
switch (parm1) {
case _ME_L_click:
if (currScreen) {
Commit: 5a1bfc7b6ce5c7a87dfe8ded9540543eb84379c3
https://github.com/scummvm/scummvm/commit/5a1bfc7b6ce5c7a87dfe8ded9540543eb84379c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Rename global triggers to have k prefix
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/core/play_break.cpp
engines/m4/burger/core/release_trigger.cpp
engines/m4/burger/core/stream_break.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/rooms/room.cpp
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room173.cpp
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section2/room207.cpp
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room306.cpp
engines/m4/burger/rooms/section3/room307.cpp
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/section3.cpp
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room404.cpp
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room508.cpp
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room512.cpp
engines/m4/burger/rooms/section5/room513.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room608.cpp
engines/m4/burger/rooms/section6/section6.cpp
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room706.cpp
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/gui/gui_dialog.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index d6684bcb68c..a5f235978bd 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -279,27 +279,27 @@ void BurgerEngine::syncFlags(Common::Serializer &s) {
void BurgerEngine::global_daemon() {
switch (_G(kernel).trigger) {
- case gRESUME_CONVERSATION:
+ case kRESUME_CONVERSATION:
conv_resume_curr();
break;
- case gSERIES_STREAM_BREAK:
+ case kSERIES_STREAM_BREAK:
handle_series_stream_break();
break;
- case gSERIES_PLAY_BREAK_0:
+ case kSERIES_PLAY_BREAK_0:
handle_series_play_break(0);
break;
- case gSERIES_PLAY_BREAK_1:
+ case kSERIES_PLAY_BREAK_1:
handle_series_play_break(1);
break;
- case gSERIES_PLAY_BREAK_2:
+ case kSERIES_PLAY_BREAK_2:
handle_series_play_break(2);
break;
- case gRELEASE_TRIGGER_DIGI_CHECK:
+ case kRELEASE_TRIGGER_DIGI_CHECK:
release_trigger_digi_check();
break;
@@ -308,7 +308,7 @@ void BurgerEngine::global_daemon() {
kernel_timing_trigger(300, 10007);
break;
- case gNPC_SPEECH_FINISHED:
+ case kNPC_SPEECH_FINISHED:
if (_G(npcSpeech1))
terminateMachineAndNull(_G(npcSpeech1));
if (_G(npcSpeech2))
@@ -317,15 +317,15 @@ void BurgerEngine::global_daemon() {
kernel_trigger_dispatch_now(_G(npcTrigger));
break;
- case gWILBURS_SPEECH_FINISHED:
+ case kWILBURS_SPEECH_FINISHED:
_G(walker).wilburs_speech_finished();
break;
- case gWILBURS_SPEECH_START:
+ case kWILBURS_SPEECH_START:
_G(walker).wilbur_say();
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 10001:
ws_unhide_walker(_G(my_walker));
@@ -343,7 +343,7 @@ void BurgerEngine::global_daemon() {
player_update_info();
ws_hide_walker();
_G(wilbur_should) = 10013;
- series_play_with_breaks(PLAY_BREAKS1, "999wbw", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS1, "999wbw", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 7,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10004:
@@ -351,7 +351,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10012;
- series_play_with_breaks(PLAY_BREAKS2, "999wbj", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS2, "999wbj", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10005:
@@ -359,7 +359,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10009;
- series_play_with_breaks(PLAY_BREAKS3, "600wek", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS3, "600wek", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10006:
@@ -367,7 +367,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY_BREAKS4, "999wsdu", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 7,
+ series_play_with_breaks(PLAY_BREAKS4, "999wsdu", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 7,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10007:
@@ -375,7 +375,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10014;
- series_play_with_breaks(PLAY_BREAKS5, "999wtpe", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS5, "999wtpe", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10008:
@@ -383,17 +383,17 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY_BREAKS6, "999wtpf", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS6, "999wtpf", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
_G(wilbur_should) = 10018;
- _G(walker).wilbur_speech("602w012x", gCHANGE_WILBUR_ANIMATION);
+ _G(walker).wilbur_speech("602w012x", kCHANGE_WILBUR_ANIMATION);
break;
case 10010:
_G(wilbur_should) = 10011;
- _G(walker).wilbur_speech("602w012y", gCHANGE_WILBUR_ANIMATION);
+ _G(walker).wilbur_speech("602w012y", kCHANGE_WILBUR_ANIMATION);
break;
case 10011:
player_set_commands_allowed(true);
@@ -435,7 +435,7 @@ void BurgerEngine::global_daemon() {
kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
break;
- case gSET_FACING:
+ case kSET_FACING:
player_set_facing_at(_G(player_facing_x), _G(player_facing_y),
_G(player_trigger));
break;
@@ -443,20 +443,20 @@ void BurgerEngine::global_daemon() {
case kSET_DEST:
ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
_G(walker).wilbur_poof();
- kernel_trigger_dispatch_now(gSET_COMMANDS_ALLOWED);
+ kernel_trigger_dispatch_now(kSET_COMMANDS_ALLOWED);
- case gSET_COMMANDS_ALLOWED:
+ case kSET_COMMANDS_ALLOWED:
player_set_commands_allowed(true);
break;
- case gUNPOOF:
+ case kUNPOOF:
_G(walker).wilbur_unpoof();
break;
case 10022:
if (_G(game).room_id < 200) {
_G(wilbur_should) = 10017;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
}
@@ -465,15 +465,15 @@ void BurgerEngine::global_daemon() {
case 10023:
if (_G(game).room_id < 700) {
_G(wilbur_should) = 10018;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
- case gTELEPROTED1:
- disable_player_commands_and_fade_init(gTELEPROTED2);
+ case kTELEPROTED1:
+ disable_player_commands_and_fade_init(kTELEPROTED2);
break;
- case gTELEPROTED2:
+ case kTELEPROTED2:
testDone();
break;
@@ -517,7 +517,7 @@ void BurgerEngine::global_parser() {
} else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(flags)[V123] = 1;
_G(wilbur_should) = 10004;
- ws_turn_to_face(_G(my_walker), 3, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(_G(my_walker), 3, kCHANGE_WILBUR_ANIMATION);
goto done;
}
}
@@ -526,21 +526,21 @@ void BurgerEngine::global_parser() {
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10003;
- ws_turn_to_face(_G(my_walker), 7, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(_G(my_walker), 7, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10005;
- ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(_G(my_walker), 9, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10006;
- ws_turn_to_face(_G(my_walker), 9, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(_G(my_walker), 9, kCHANGE_WILBUR_ANIMATION);
goto done;
}
@@ -554,7 +554,7 @@ void BurgerEngine::global_parser() {
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10008;
- ws_turn_to_face(_G(my_walker), 5, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(_G(my_walker), 5, kCHANGE_WILBUR_ANIMATION);
goto done;
}
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index 8fe54964814..ad1f2ccc401 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -63,7 +63,7 @@ static void set_next_series_play_break(int32 slot) {
// There is a sound to play and it is not looping (finite)
if (_G(seriesPlayers)[slot].current_break.loopCount == -1) { // Check if series is to loop as long as sound plays (loopCount = -1)
_G(seriesPlayers)[slot].digi_trigger = true; // Remember that the gSERIES_PLAY_BREAK will be a sound trigger
- digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, gSERIES_PLAY_BREAK_0 + slot);
+ digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, kSERIES_PLAY_BREAK_0 + slot);
} else {
// Use the play break trigger
digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
@@ -84,7 +84,7 @@ static void set_next_series_play_break(int32 slot) {
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
} else { // ask for the gSERIES_PLAY_BREAK trigger
- player->series_machine = series_play(player->name, player->depth, player->current_break.flags, (int16)slot + gSERIES_PLAY_BREAK_0,
+ player->series_machine = series_play(player->name, player->depth, player->current_break.flags, (int16)slot + kSERIES_PLAY_BREAK_0,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
diff --git a/engines/m4/burger/core/release_trigger.cpp b/engines/m4/burger/core/release_trigger.cpp
index d9361b3c64a..25e247aa004 100644
--- a/engines/m4/burger/core/release_trigger.cpp
+++ b/engines/m4/burger/core/release_trigger.cpp
@@ -34,7 +34,7 @@ void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 mat
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(gRELEASE_TRIGGER_DIGI_CHECK);
+ kernel_trigger_dispatch_now(kRELEASE_TRIGGER_DIGI_CHECK);
_G(kernel).trigger_mode = oldMode;
}
@@ -58,7 +58,7 @@ void release_trigger_digi_check() {
if (digi_state == _GT(match_value)) {
kernel_trigger_dispatchx(_GT(released_digi_trigger));
} else {
- kernel_timing_trigger(TENTH_SECOND, gRELEASE_TRIGGER_DIGI_CHECK);
+ kernel_timing_trigger(TENTH_SECOND, kRELEASE_TRIGGER_DIGI_CHECK);
}
}
diff --git a/engines/m4/burger/core/stream_break.cpp b/engines/m4/burger/core/stream_break.cpp
index 6eeb679f1d9..ecf15adc391 100644
--- a/engines/m4/burger/core/stream_break.cpp
+++ b/engines/m4/burger/core/stream_break.cpp
@@ -37,7 +37,7 @@ static void set_next_series_stream_break() {
// If variable is null or variable = value then this break is used
// Note: if Variable != value this break is skipped
if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) {
- series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, gSERIES_STREAM_BREAK);
+ series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, kSERIES_STREAM_BREAK);
break;
}
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 7772de2c9fb..36b1dc63010 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -341,13 +341,13 @@ void Interface::trackIcons() {
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
_G(wilbur_should) = 10017;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
_G(wilbur_should) = 10015;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
diff --git a/engines/m4/burger/rooms/room.cpp b/engines/m4/burger/rooms/room.cpp
index 6116c4dbd4d..8163c45c5f0 100644
--- a/engines/m4/burger/rooms/room.cpp
+++ b/engines/m4/burger/rooms/room.cpp
@@ -74,11 +74,11 @@ void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
}
}
- kernel_trigger_dispatch_now(gNPC_SPEECH_STARTED);
+ kernel_trigger_dispatch_now(kNPC_SPEECH_STARTED);
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
- digi_play(digiName, digiSlot, digiVol, gNPC_SPEECH_FINISHED);
+ digi_play(digiName, digiSlot, digiVol, kNPC_SPEECH_FINISHED);
_G(kernel).trigger_mode = oldMode;
}
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 7e58b20206a..57c8055cdf5 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -96,7 +96,7 @@ static const seriesPlayBreak PLAY_BREAKS3[] = {
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
- { 10, -1, nullptr, 1, 255, gCHANGE_WILBUR_ANIMATION, 0, 0, nullptr, 0 },
+ { 10, -1, nullptr, 1, 255, kCHANGE_WILBUR_ANIMATION, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
@@ -159,27 +159,27 @@ void Room101::init() {
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 104:
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 106:
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 135:
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 142:
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -428,7 +428,7 @@ void Room101::daemon() {
case 21:
digi_play("101_002", 2, 255, -1);
_G(wilbur_should) = 18;
- series_play("101ha01", 3840, 0, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 14, -1);
+ series_play("101ha01", 3840, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
@@ -471,7 +471,7 @@ void Room101::daemon() {
Section1::updateWalker(226, 281, 8, 26);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 2:
player_set_commands_allowed(true);
@@ -503,7 +503,7 @@ void Room101::daemon() {
case 6:
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 7:
@@ -515,7 +515,7 @@ void Room101::daemon() {
// Barbershop door open
_G(wilbur_should) = 9;
terminateMachineAndNull(_doorMachine);
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 9:
@@ -525,7 +525,7 @@ void Room101::daemon() {
case 10:
_G(wilbur_should) = 11;
- series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 11:
@@ -537,17 +537,17 @@ void Room101::daemon() {
case 14:
terminateMachineAndNull(_doorMachine);
_G(wilbur_should) = 15;
- series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 15:
_G(wilbur_should) = 16;
- digi_play("101h001", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("101h001", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 16:
_G(wilbur_should) = 17;
- series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 17:
@@ -557,9 +557,9 @@ void Room101::daemon() {
if (_G(flags)[V005]) {
Common::String name = Common::String::format("101h003%c",
'a' + imath_ranged_rand(0, 5));
- digi_play(name.c_str(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play(name.c_str(), 1, 255, kCHANGE_WILBUR_ANIMATION);
} else {
- digi_play("101h002", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("101h002", 1, 255, kCHANGE_WILBUR_ANIMATION);
_G(flags)[V005] = 1;
}
@@ -578,7 +578,7 @@ void Room101::daemon() {
case 20:
_G(wilbur_should) = 21;
- series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 21:
@@ -646,26 +646,26 @@ void Room101::parser() {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V013]) {
ws_demand_location(_G(my_walker), 338, 265);
ws_demand_facing(_G(my_walker), 10);
ws_hide_walker(_G(my_walker));
player_set_commands_allowed(false);
_G(wilbur_should) = 14;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 20;
ws_hide_walker(_G(my_walker));
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "TOWN HALL") || player_said("gear", "town hall") ||
(lookFlag && player_said("town hall"))) {
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 15a76cde6f0..a6839ad2c5b 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -157,7 +157,7 @@ void Room102::init() {
_G(wilbur_should) = 1;
_val16 = 1;
digi_preload("102_038");
- digi_play("102_038", 2, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("102_038", 2, 255, kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
}
@@ -973,33 +973,33 @@ void Room102::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
digi_unload("102_038");
ws_demand_location(628, 325);
ws_demand_facing(9);
_G(wilbur_should) = 2;
- ws_walk(435, 329, 0, gCHANGE_WILBUR_ANIMATION, 9, 1);
+ ws_walk(435, 329, 0, kCHANGE_WILBUR_ANIMATION, 9, 1);
break;
case 2:
if (_G(flags)[V012] == 2) {
_G(wilbur_should) = 3;
- _G(walker).wilbur_speech("102w003", gCHANGE_WILBUR_ANIMATION);
+ _G(walker).wilbur_speech("102w003", kCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V012] == 0) {
_G(wilbur_should) = 5;
if (_G(flags)[V018]) {
- _G(walker).wilbur_speech("102w002", gCHANGE_WILBUR_ANIMATION);
+ _G(walker).wilbur_speech("102w002", kCHANGE_WILBUR_ANIMATION);
} else {
- queuePlay("102h001", gCHANGE_WILBUR_ANIMATION);
+ queuePlay("102h001", kCHANGE_WILBUR_ANIMATION);
}
}
break;
case 3:
- _G(walker).wilbur_speech("102w004", gCHANGE_WILBUR_ANIMATION);
+ _G(walker).wilbur_speech("102w004", kCHANGE_WILBUR_ANIMATION);
_G(wilbur_should) = 4;
break;
@@ -1036,7 +1036,7 @@ void Room102::daemon() {
_G(wilbur_should) = 72;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, kCHANGE_WILBUR_ANIMATION);
break;
case 72:
@@ -1050,7 +1050,7 @@ void Room102::daemon() {
_G(wilbur_should) = 74;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, kCHANGE_WILBUR_ANIMATION);
break;
case 74:
@@ -1064,7 +1064,7 @@ void Room102::daemon() {
_G(wilbur_should) = 76;
digi_preload_stream_breaks(STREAMS6);
series_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, kCHANGE_WILBUR_ANIMATION);
break;
case 76:
@@ -1078,7 +1078,7 @@ void Room102::daemon() {
_G(wilbur_should) = 78;
digi_preload_stream_breaks(STREAMS7);
series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, kCHANGE_WILBUR_ANIMATION);
break;
case 78:
@@ -1097,7 +1097,7 @@ void Room102::daemon() {
if (!_G(flags)[V020])
digi_preload("102w008");
- series_play_with_breaks(PLAY4, "102wi09", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi09", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 80:
@@ -1123,7 +1123,7 @@ void Room102::daemon() {
terminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
_G(wilbur_should) = 83;
- series_play_with_breaks(PLAY4, "102wi08", 256, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi08", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 83:
@@ -1185,7 +1185,7 @@ void Room102::parser() {
if (player_said("USE", "GO", "DOORWAY")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
if (player_said("USE", "GO", "FIRE ESCAPE")) {
@@ -1199,7 +1199,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(wilbur_should) = _G(flags)[V019] ? 82 : 79;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h005");
}
@@ -1209,7 +1209,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(wilbur_should) = player_said("hair wax") ? 71 : 75;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
}
@@ -1223,7 +1223,7 @@ void Room102::parser() {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
_G(wilbur_should) = player_said("hair wax ") ? 73 : 77;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h007");
}
@@ -1552,7 +1552,7 @@ void Room102::conv04() {
} else {
_G(wilbur_should) = 10002;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
conv_resume_curr();
}
}
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index b32193066b1..7475999635f 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -551,7 +551,7 @@ void Room103::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
digi_unload_stream_breaks(SERIES1);
@@ -565,7 +565,7 @@ void Room103::daemon() {
_G(wilbur_should) = 3;
digi_preload_stream_breaks(SERIES3);
series_play("103wi04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
- series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 3:
@@ -581,7 +581,7 @@ void Room103::daemon() {
terminateMachineAndNull(_series1);
ws_hide_walker();
series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
- series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 5:
@@ -594,13 +594,13 @@ void Room103::daemon() {
case 6:
_G(wilbur_should) = 7;
- kernel_timing_trigger(1, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(1, kCHANGE_WILBUR_ANIMATION);
break;
case 7:
_G(wilbur_should) = 8;
ws_hide_walker();
- series_play_with_breaks(PLAY1, "103wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY1, "103wi02", 0xa00, kCHANGE_WILBUR_ANIMATION, 2);
series_play("103wi02s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 27);
player_set_commands_allowed(false);
break;
@@ -638,20 +638,20 @@ void Room103::parser() {
if (!_G(walker).wilbur_said(SAID)) {
if (player_said("gear", "satellite dish") && _G(flags)[V023] == 0) {
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("gear", "door") || player_said("gear", "stairway")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "FIRE ESCAPE")) {
_val2 = 1;
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
}
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 581ce1fec0e..463a4d5d575 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -63,24 +63,24 @@ void Room104::init() {
case 101:
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 105:
_G(wilbur_should) = 2;
digi_preload("104_005");
digi_play("104_005", 2, 255, 2);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 107:
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 170:
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -407,7 +407,7 @@ void Room104::daemon() {
player_set_commands_allowed(true);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_demand_location(315, 373);
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 6ce33908073..a924b00742c 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -284,7 +284,7 @@ void Room105::init() {
case 104:
ws_demand_location(310, 353, 11);
_G(wilbur_should) = 62;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -1279,7 +1279,7 @@ void Room105::daemon() {
ws_unhide_walker();
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 62:
if (_G(flags)[V112] && !_G(flags)[V034]) {
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 5290319718c..105975ef10c 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -77,7 +77,7 @@ void Room133_136::init() {
case 134:
case 135:
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 136:
@@ -86,7 +86,7 @@ void Room133_136::init() {
case 137:
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -246,7 +246,7 @@ void Room133_136::daemon() {
wilbur_speech("136w0004");
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 3:
player_set_commands_allowed(true);
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 1c1742584d0..216fd559e31 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -104,7 +104,7 @@ void Room135::init() {
_G(flags)[V039] = 1;
_G(wilbur_should) = 37;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 133:
@@ -113,7 +113,7 @@ void Room135::init() {
_G(flags)[V039] = 1;
_G(wilbur_should) = 38;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 135:
@@ -744,7 +744,7 @@ void Room135::daemon() {
player_set_commands_allowed(true);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 37:
player_set_commands_allowed(true);
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 8db84fe43fc..87eda4c8110 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -89,7 +89,7 @@ void Room137::init() {
case 136:
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- kernel_timing_trigger(1, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(1, kCHANGE_WILBUR_ANIMATION);
break;
case 138:
@@ -104,7 +104,7 @@ void Room137::init() {
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
if (_G(flags)[V048] < 200 && _G(flags)[V048] && _G(flags)[V047] == 4)
@@ -555,11 +555,11 @@ void Room137::daemon() {
_series2 = series_play("137jaws", 0x600, 0, -1, 7, -1, 100, 0, 0, 0, 0);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_G(wilbur_should) = 2;
- series_play("137wi01", 0x100, 2, gCHANGE_WILBUR_ANIMATION,
+ series_play("137wi01", 0x100, 2, kCHANGE_WILBUR_ANIMATION,
6, 0, 100, 0, 0, 0, 9);
series_play("137wi01s", 0x101, 2, -1, 6, 0, 100, 0, 0, 0, 9);
break;
@@ -572,7 +572,7 @@ void Room137::daemon() {
case 3:
ws_demand_location(183, 216, 8);
_G(wilbur_should) = 4;
- ws_walk(171, 236, 0, gCHANGE_WILBUR_ANIMATION, 5);
+ ws_walk(171, 236, 0, kCHANGE_WILBUR_ANIMATION, 5);
break;
case 4:
@@ -586,7 +586,7 @@ void Room137::daemon() {
ws_hide_walker();
player_set_commands_allowed(false);
series_load("137jaws");
- series_play_with_breaks(PLAY1, "137wi02", 0x100, gCHANGE_WILBUR_ANIMATION,
+ series_play_with_breaks(PLAY1, "137wi02", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("keys", true);
hotspot_set_active("trunk ", true);
@@ -601,7 +601,7 @@ void Room137::daemon() {
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 9;
- series_play_with_breaks(PLAY2, "137wi03", 0x100, gCHANGE_WILBUR_ANIMATION,
+ series_play_with_breaks(PLAY2, "137wi03", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("keys", false);
hotspot_set_active("trunk ", false);
@@ -613,7 +613,7 @@ void Room137::daemon() {
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 9;
- series_play_with_breaks(PLAY3, "137wi04", 0x100, gCHANGE_WILBUR_ANIMATION,
+ series_play_with_breaks(PLAY3, "137wi04", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("jawz o' life", false);
break;
@@ -626,13 +626,13 @@ void Room137::daemon() {
case 35:
_G(wilbur_should) = 36;
ws_hide_walker();
- series_play("137wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION,
+ series_play("137wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION,
6, 0, 100, 0, 0, 0, 9);
series_play("137wi01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
break;
case 36:
- series_play("137wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION,
+ series_play("137wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION,
600, 0, 100, 0, 0, 9, 9);
series_play("137wi01s", 0x100, 0, -1, 600, 0, 100, 0, 0, 9, 9);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1011);
@@ -668,7 +668,7 @@ void Room137::parser() {
if (_G(flags)[V046] && (player_said("gear", "trunk") || player_said("gear", "trunk "))) {
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("conv15")) {
conv15();
@@ -683,16 +683,16 @@ void Room137::parser() {
}
} else if (player_said("keys", "trunk")) {
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("take", "jawz o' life") && inv_object_is_here("jawz o' life")) {
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if ((player_said("take", "keys") || player_said("gear", "keys")) &&
!inv_player_has("keys")) {
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("gear", "jawz o' life") && inv_object_is_here("jawz o' life")) {
wilbur_speech("137w011");
@@ -705,7 +705,7 @@ void Room137::parser() {
} else if (player_said("LOOK AT", "CAR WINDOW")) {
_G(wilbur_should) = 35;
player_set_commands_allowed(false);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index fbaff3c4915..a612bdf5ddf 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -601,12 +601,12 @@ void Room138::daemon() {
kernel_timing_trigger(10, 13);
break;
- case gWILBURS_SPEECH_START:
+ case kWILBURS_SPEECH_START:
_val8 = 15;
player_set_commands_allowed(false);
break;
- case gWILBURS_SPEECH_FINISHED:
+ case kWILBURS_SPEECH_FINISHED:
_val8 = 1;
player_set_commands_allowed(true);
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index d7cef15397f..be2076ac012 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -373,14 +373,14 @@ void Room139_144::daemon() {
}
break;
- case g10028:
+ case k10028:
if (!_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
Section1::updateDisablePlayer();
kernel_timing_trigger(1, 3);
} else {
- kernel_timing_trigger(60, g10028);
+ kernel_timing_trigger(60, k10028);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index fc6464cb438..3674584e44e 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -888,7 +888,7 @@ void Room141::daemon() {
player_set_commands_allowed(true);
break;
- case g10013:
+ case kWILBUR_SPEECH_STARTED:
_G(kernel).continue_handling_trigger = 1;
_val6 = 53;
break;
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index eb1ccaf734e..cf018242c8b 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -54,8 +54,8 @@ const WilburMatch Room142::MATCH[] = {
{ "LOOK AT", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
{ "GEAR", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
{ "LOOK AT", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
- { "GEAR", "ICE BOX", gCHANGE_WILBUR_ANIMATION, &_G(flags)[V059], 0, &Vars::_wilbur_should, 1 },
- { "TAKE", "FANBELT", gCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
+ { "GEAR", "ICE BOX", kCHANGE_WILBUR_ANIMATION, &_G(flags)[V059], 0, &Vars::_wilbur_should, 1 },
+ { "TAKE", "FANBELT", kCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
{ "GEAR", "BACK DOOR", 6, nullptr, 0, nullptr, 0 },
WILBUR_MATCH_END
};
@@ -176,7 +176,7 @@ void Room142::init() {
if (_G(flags)[V059]) {
ws_hide_walker();
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -406,13 +406,13 @@ void Room142::daemon() {
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
terminateMachineAndNull(_series5);
disable_player();
_G(wilbur_should) = 2;
- series_play_with_breaks(PLAY9, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -432,7 +432,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY11, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY11, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -450,7 +450,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(wilbur_should) = 6;
- series_play_with_breaks(PLAY10, "142wi02", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "142wi02", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
@@ -466,7 +466,7 @@ void Room142::daemon() {
terminateMachineAndNull(_series7);
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY10, "142wi04", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
@@ -480,7 +480,7 @@ void Room142::daemon() {
case 9:
disable_player();
_G(wilbur_should) = 10;
- series_play_with_breaks(PLAY12, "142wi05", 0x400, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY12, "142wi05", 0x400, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
@@ -599,7 +599,7 @@ void Room142::pre_parser() {
if (player_said("GEAR", "ICE BOX")) {
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ICE")) {
if (player_said("LOOK AT")) {
if (_G(flags)[V040] && !inv_player_has("BLOCK OF ICE")) {
@@ -613,7 +613,7 @@ void Room142::pre_parser() {
} else if (inv_player_has("BLOCK_OF_ICE")) {
wilbur_speech("142w009");
} else {
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR")) {
wilbur_speech("142w002");
@@ -622,7 +622,7 @@ void Room142::pre_parser() {
}
} else {
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
_G(player).command_ready = false;
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 70a281033fd..503ef222cbe 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -1021,13 +1021,13 @@ void Room143::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 2:
terminateMachineAndNull(_mouseTrap);
disable_player();
_G(wilbur_should) = 3;
- series_play_with_breaks(PLAY1, "143wi02", 0xf00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 25, 0);
+ series_play_with_breaks(PLAY1, "143wi02", 0xf00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 25, 0);
_val1 = 21;
break;
@@ -1042,7 +1042,7 @@ void Room143::daemon() {
_digiName = "143v501";
_digiMode = KT_DAEMON;
_G(wilbur_should) = 5;
- _digiTrigger = gCHANGE_WILBUR_ANIMATION;
+ _digiTrigger = kCHANGE_WILBUR_ANIMATION;
_G(flags)[V064] = 1;
loadCheese();
hotspot_set_active("cheese", true);
@@ -1159,7 +1159,7 @@ void Room143::parser() {
wilbur_speech("143w030");
} else if (player_said("take", "mouse trap")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("talk to", "vera")) {
talkToVera();
} else if (player_said("talk to", "burl")) {
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index bf97acca8c7..3c65dc45c35 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -344,7 +344,7 @@ void Room145::daemon() {
_val1 = 27;
series_play_with_breaks(PLAY11, "145dz05", 0xa01, 2, 3);
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 27:
@@ -369,7 +369,7 @@ void Room145::daemon() {
series_play_with_breaks(PLAY14, "145dz08", 0, -1, 3);
series_show("145drum", 0xa01);
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -646,7 +646,7 @@ void Room145::daemon() {
player_set_commands_allowed(true);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
@@ -656,7 +656,7 @@ void Room145::daemon() {
case 2:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY1, "145wi04", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "145wi04", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -664,7 +664,7 @@ void Room145::daemon() {
loadSeries1();
ws_hide_walker();
_G(wilbur_should) = 4;
- _general.play("145wi02", 0xa00, 16, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 14);
+ _general.play("145wi02", 0xa00, 16, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 14);
digi_play("145w020", 1, 255, -1);
break;
@@ -675,13 +675,13 @@ void Room145::daemon() {
case 5:
_general.terminate();
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY3, "145wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "145wi02", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY4, "145wi03", 0xa01, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "145wi03", 0xa01, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 7:
@@ -693,7 +693,7 @@ void Room145::daemon() {
ws_hide_walker();
terminateMachineAndNull(_amplifier);
_G(wilbur_should) = 9;
- series_play_with_breaks(PLAY2, "145wi04", 0xa01, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "145wi04", 0xa01, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 9:
@@ -705,7 +705,7 @@ void Room145::daemon() {
player_set_commands_allowed(false);
if (_state2) {
- kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
} else {
_val4 = 44;
kernel_trigger_dispatch_now(5);
@@ -719,7 +719,7 @@ void Room145::daemon() {
_val2 = 0;
resetRoxy();
} else {
- kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index 0fa2d8a6d91..d880b9c268c 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -107,7 +107,7 @@ void Room170::daemon() {
disable_player_commands_and_fade_init(1018);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
@@ -117,7 +117,7 @@ void Room170::daemon() {
case 3:
disable_player();
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY2, "170wi03", 0xa00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY2, "170wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 4:
@@ -132,7 +132,7 @@ void Room170::daemon() {
case 5:
disable_player();
_G(wilbur_should) = 6;
- series_play_with_breaks(PLAY3, "170wi03", 0xa00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY3, "170wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 6:
@@ -193,17 +193,17 @@ void Room170::parser() {
disable_player_commands_and_fade_init(1014);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("MAILBOX")) {
if (_G(flags)[V079]) {
player_set_commands_allowed(false);
if (_G(flags)[V080]) {
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 3;
- wilbur_speech("170w004", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("170w004", kCHANGE_WILBUR_ANIMATION);
}
} else {
wilbur_speech("170w008");
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 6f322e7f350..783754b9d0f 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -302,7 +302,7 @@ kernel_trigger_dispatch_now(6);
case 175:
ws_demand_location(237, 232, 9);
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -588,7 +588,7 @@ void Room171::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
@@ -598,7 +598,7 @@ void Room171::daemon() {
case 2:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "171wi02", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5, 100, 0, -3);
+ series_play_with_breaks(PLAY2, "171wi02", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5, 100, 0, -3);
break;
case 3:
@@ -679,12 +679,12 @@ void Room171::parser() {
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("WHISTLE", "AUNT POLLY")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- wilbur_speech("171w901", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("171w901", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TALK", "AUNT POLLY")) {
kernel_trigger_dispatch_now(6);
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index daca6893538..4a98726c2f4 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -284,7 +284,7 @@ void Room172::daemon() {
_G(flags)[V299] = 0;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_convName = _G(flags)[V087] ? "172p903" : "172p902";
@@ -295,7 +295,7 @@ void Room172::daemon() {
case 2:
disable_player();
_G(wilbur_should) = 3;
- series_play_with_breaks(PLAY1, "172wi01", 0x700, gCHANGE_WILBUR_ANIMATION, 3, 8);
+ series_play_with_breaks(PLAY1, "172wi01", 0x700, kCHANGE_WILBUR_ANIMATION, 3, 8);
break;
case 3:
@@ -350,12 +350,12 @@ void Room172::parser() {
kernel_trigger_dispatch_now(1);
} else {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("WHISTLE", "AUNT POLLY")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
- wilbur_speech("172w901", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("172w901", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TALK", "AUNT POLLY")) {
kernel_trigger_dispatch_now(3);
} else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
index 2e8b156eb38..6d78ad04a09 100644
--- a/engines/m4/burger/rooms/section1/room173.cpp
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -61,7 +61,7 @@ void Room173::init() {
case 172:
ws_demand_location(136, 318, 5);
_G(wilbur_should) = player_been_here(173) ? 1 : 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -76,18 +76,18 @@ void Room173::daemon() {
disable_player_commands_and_fade_init(1019);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY1, "173wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "173wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
disable_player();
_G(wilbur_should) = 3;
- series_play_with_breaks(PLAY1, "173wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "173wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -119,7 +119,7 @@ void Room173::parser() {
// Already handled
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 01cfac474b1..3c8eebf812a 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -111,14 +111,14 @@ void Room174::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
terminateMachineAndNull(_series2);
_action = 5;
_G(wilbur_should) = 2;
- series_play_with_breaks(PLAY1, "174wi03", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "174wi03", 0x8ff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -131,7 +131,7 @@ void Room174::daemon() {
_laxative.terminate();
ws_hide_walker();
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY2, "174wi01", 0x400, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "174wi01", 0x400, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
@@ -166,11 +166,11 @@ void Room174::parser() {
disable_player_commands_and_fade_init(1022);
} else if (player_said("GEAR") && player_said_any("TOILET", "FLUSH CHAIN")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "LAXATIVE ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- wilbur_speech("174w013", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("174w013", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "MIRROR")) {
wilbur_speech("174w001");
} else {
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index 94a45fe88b7..d2129d80874 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -66,7 +66,7 @@ void Room175::init() {
case 171:
ws_demand_location(331, 272, 3);
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 174:
@@ -91,12 +91,12 @@ void Room175::init() {
void Room175::daemon() {
switch (_G(kernel).trigger) {
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY1, "175wi01", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "175wi01", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -108,7 +108,7 @@ void Room175::daemon() {
case 3:
disable_player();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY3, "175wi03", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "175wi03", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
default:
@@ -141,7 +141,7 @@ void Room175::parser() {
// Already handled
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("BATHROOM")) {
disable_player_commands_and_fade_init(1021);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("WILBUR'S ROOM")) {
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index 42dbb7c63a4..4a449e98df2 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -78,13 +78,13 @@ void Room176::init() {
void Room176::daemon() {
switch (_G(kernel).trigger) {
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
terminateMachineAndNull(_puzDispenser);
_G(wilbur_should) = 2;
- series_play_with_breaks(PLAY1, "176wi01", 0x500, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "176wi01", 0x500, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -118,7 +118,7 @@ void Room176::parser() {
disable_player_commands_and_fade_init(1022);
} else if (player_said("TAKE", "PUZ DISPENSER ")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
index fdc59139f0d..6bc9fc4f89d 100644
--- a/engines/m4/burger/rooms/section2/room207.cpp
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -305,7 +305,7 @@ void Room207::daemon() {
_G(wilbur_should) = 4;
_val2 = 0;
_val1 = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(1);
break;
@@ -339,16 +339,16 @@ void Room207::daemon() {
disable_player_commands_and_fade_init(8);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
if (!strcmp(conv_sound_to_play(), "53p0101")) {
_G(wilbur_should) = 3;
conv_resume_curr();
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 2;
- digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
_general1 = series_play("207wi01", 0x400, 4);
}
break;
@@ -357,17 +357,17 @@ void Room207::daemon() {
terminateMachineAndNull(_general1);
_G(wilbur_should) = 3;
conv_resume_curr();
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3:
_G(wilbur_should) = getShould();
- series_show("207wi01", 0x400, 0, gCHANGE_WILBUR_ANIMATION, 30, 0);
+ series_show("207wi01", 0x400, 0, kCHANGE_WILBUR_ANIMATION, 30, 0);
break;
case 4:
_G(wilbur_should) = getShould();
- series_play("207wi01", 0x400, 1, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
+ series_play("207wi01", 0x400, 1, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
break;
default:
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 60c59f107a7..2d890299a45 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -178,7 +178,7 @@ void Mine::daemon() {
_G(wilbur_should) = 408;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(game).room_id != 305) {
if (!_G(flags)[V137]) {
_G(flags)[V137] = 1;
@@ -191,7 +191,7 @@ void Mine::daemon() {
_G(wilbur_should) = inv_player_has("WHISTLE") ? 406 : 405;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -219,7 +219,7 @@ void Mine::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 401:
wilbur_speech("311w001");
@@ -228,7 +228,7 @@ void Mine::daemon() {
case 402:
player_set_commands_allowed(false);
_G(wilbur_should) = 403;
- wilbur_speech("311w002", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("311w002", kCHANGE_WILBUR_ANIMATION);
break;
case 403:
@@ -267,7 +267,7 @@ void Mine::daemon() {
wilbur_speech("310w001");
break;
- case g10013:
+ case kWILBUR_SPEECH_STARTED:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
@@ -407,7 +407,7 @@ void Mine::parser() {
mine_travel_link(BACK);
} else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
_G(wilbur_should) = 407;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index 670fa451346..c1007ece514 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -206,17 +206,17 @@ void Room302::init() {
case 303:
_G(wilbur_should) = _G(flags)[V125] ? 6 : 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 304:
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 305:
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -343,7 +343,7 @@ void Room302::daemon() {
case 27:
ws_hide_walker();
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_val1 = 28;
series_play_with_breaks(PLAY7, "302tr01", 0x700, 9, 3);
break;
@@ -352,7 +352,7 @@ void Room302::daemon() {
hotspot_set_active("truffles", false);
_G(flags)[V111] = 1;
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
series_play_with_breaks(PLAY8, "302tr01", 0x900, -1, 3);
break;
@@ -366,7 +366,7 @@ void Room302::daemon() {
case 29:
digi_preload_stream_breaks(SERIES2);
_G(wilbur_should) = 9;
- series_stream_with_breaks(SERIES2, "302pr01", 6, 1, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES2, "302pr01", 6, 1, kCHANGE_WILBUR_ANIMATION);
break;
case 30:
@@ -384,7 +384,7 @@ void Room302::daemon() {
_val1 = 26;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_hide_walker();
@@ -434,37 +434,37 @@ void Room302::daemon() {
case 8:
ws_unhide_walker();
_G(wilbur_should) = _G(flags)[V110] ? 10001 : 18;
- ws_turn_to_face(3, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(3, kCHANGE_WILBUR_ANIMATION);
break;
case 9:
digi_unload_stream_breaks(SERIES2);
_G(wilbur_should) = 12;
hotspot_set_active("BURGER MORSEL ", true);
- series_play_with_breaks(PLAY4, "302wi10", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY4, "302wi10", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 10:
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY6, "302wi06", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "302wi06", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
_G(wilbur_should) = 17;
- series_play_with_breaks(PLAY9, "302wi07", 0x200, gCHANGE_WILBUR_ANIMATION, 3, 4);
+ series_play_with_breaks(PLAY9, "302wi07", 0x200, kCHANGE_WILBUR_ANIMATION, 3, 4);
break;
case 12:
_series1 = series_show("302BURG", 0x200);
_G(flags)[V107] = 0;
_G(wilbur_should) = 15;
- series_play_with_breaks(PLAY5, "302wi09", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "302wi09", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 13:
_G(wilbur_should) = 14;
- kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(30, kCHANGE_WILBUR_ANIMATION);
break;
case 14:
@@ -478,16 +478,16 @@ void Room302::daemon() {
if (_G(flags)[V108]) {
_val5 = imath_ranged_rand(0, 9);
- wilbur_speech(Common::String::format("302w004%c", 'a' + _val5).c_str(), gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech(Common::String::format("302w004%c", 'a' + _val5).c_str(), kCHANGE_WILBUR_ANIMATION);
} else {
- wilbur_speech("302w003", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("302w003", kCHANGE_WILBUR_ANIMATION);
}
break;
case 16:
_G(wilbur_should) = 7;
player_set_commands_allowed(false);
- wilbur_speech(_G(flags)[V110] ? "300w010" : "300w007", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech(_G(flags)[V110] ? "300w010" : "300w007", kCHANGE_WILBUR_ANIMATION);
break;
case 17:
@@ -538,7 +538,7 @@ void Room302::parser() {
} else if (player_said("LOOK AT", "BURGER MORSEL ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 13;
- wilbur_speech("302w009y", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("302w009y", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "DOOR")) {
wilbur_speech(player_been_here(304) ? "302w006" : "302w005");
} else if (player_said("DISTILLED CARROT JUICE", "CRASHED ROCKET")) {
@@ -550,11 +550,11 @@ void Room302::parser() {
} else if (player_said("TAKE", "BURGER MORSEL ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 10;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "DOOR") || player_said("GEAR", "DOOR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("MATCHES", "PROBE")) {
wilbur_speech("300w023");
} else if (player_said("BOTTLE", "TROUGH")) {
@@ -562,16 +562,16 @@ void Room302::parser() {
} else if (player_said("LOOK AT", "STORM CELLAR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
- wilbur_speech("302w007", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("302w007", kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "ENTER") && player_said("STORM CELLAR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
if (_G(flags)[V133]) {
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
term_message("Wilbur: Here we go...!");
- wilbur_speech("302w008", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("302w008", kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("CARROT JUICE", "TROUGH")) {
wilbur_speech("300w044");
@@ -587,7 +587,7 @@ void Room302::parser() {
if (player_said("BURGER MORSEL")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 16;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT")) {
wilbur_speech(_G(flags)[V109] ? "302w012" : "302w011");
} else if (player_said("MATCHES")) {
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 72d7f0279c0..026271cce8c 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -230,7 +230,7 @@ void Room303::doDaemon(int trigger) {
} else {
_G(wilbur_should) = 18;
player_set_commands_allowed(false);
- ws_walk(290, 325, 0, gCHANGE_WILBUR_ANIMATION, 1);
+ ws_walk(290, 325, 0, kCHANGE_WILBUR_ANIMATION, 1);
}
break;
@@ -241,7 +241,7 @@ void Room303::doDaemon(int trigger) {
} else {
_G(wilbur_should) = 18;
player_set_commands_allowed(false);
- ws_walk(261, 276, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ ws_walk(261, 276, 0, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -316,7 +316,7 @@ void Room303::doDaemon(int trigger) {
_series3 = series_play("303ft_on", 0xd00, 0, -1, 0, -1);
if (_G(wilbur_should) == 19)
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3:
@@ -338,7 +338,7 @@ void Room303::doDaemon(int trigger) {
doDaemon(8);
}
if (_G(wilbur_should) == 20)
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -492,13 +492,13 @@ void Room303::doDaemon(int trigger) {
hotspot_set_active("JUG ", false);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 11:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[0] = kCHANGE_WILBUR_ANIMATION;
if (_val5 > 0 && _val5 < 15) {
_val8 = 27;
@@ -516,7 +516,7 @@ void Room303::doDaemon(int trigger) {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[0] = kCHANGE_WILBUR_ANIMATION;
kernel_trigger_dispatch_now(11);
_val6 = 34;
@@ -530,7 +530,7 @@ void Room303::doDaemon(int trigger) {
player_set_commands_allowed(false);
kernel_trigger_dispatch_now(11);
_G(wilbur_should) = 10001;
- _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[0] = kCHANGE_WILBUR_ANIMATION;
_val6 = 34;
_val9 = 10;
series_play_with_breaks(PLAY4, "303wi4a", 0x100, 1, 3);
@@ -541,7 +541,7 @@ void Room303::doDaemon(int trigger) {
ws_hide_walker();
_G(wilbur_should) = 10001;
- _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[0] = kCHANGE_WILBUR_ANIMATION;
_val6 = _G(flags)[V122] ? 32 : 30;
_val9 = 10;
series_play_with_breaks(PLAY5, "303wi4a", 0x100, 1, 3);
@@ -551,14 +551,14 @@ void Room303::doDaemon(int trigger) {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 23;
- series_play_with_breaks(PLAY10, "303wi15", 0x100, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "303wi15", 0x100, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 16:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 17;
- series_play_with_breaks(PLAY2, "303wi03", 0x100, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "303wi03", 0x100, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 17:
@@ -640,7 +640,7 @@ void Room303::doDaemon(int trigger) {
void Room303::pre_parser() {
if (player_said("GEAR", "BOILER") && !_G(flags)[V119]) {
_G(wilbur_should) = 15;
- player_hotspot_walk_override(409, 312, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(409, 312, 3, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else {
if (player_said("FRONT YARD") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
@@ -675,13 +675,13 @@ void Room303::parser() {
} else if (player_said("JUG", "STOOL") || player_said("DISTILLED CARROT JUICE", "STOOL")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("JUG", "JUG ", "JUG ") && player_said("CARROT JUICE")) {
wilbur_speech("300w046");
} else if (player_said("JUG", "STUMP") || player_said("DISTILLED CARROT JUICE", "STUMP")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 14;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BOTTLE", "BOILER")) {
wilbur_speech("300w074");
} else if (player_said("BOTTLE", "STOOL")) {
@@ -698,10 +698,10 @@ void Room303::parser() {
kernel_trigger_dispatch_now(7);
} else if (player_said("LOOK AT", "BURNER")) {
_G(wilbur_should) = 21;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "BURNER")) {
_G(wilbur_should) = 22;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("MATCHES", "BURNER")) {
if (_G(flags)[V118] == 3001) {
player_set_commands_allowed(false);
@@ -711,16 +711,16 @@ void Room303::parser() {
} else if (player_said("GEAR", "BOILER")) {
if (_G(flags)[V119])
_G(wilbur_should) = 24;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BOILER", "CARROT JUICE")) {
_G(wilbur_should) = 16;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
_G(wilbur_should) = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
_G(wilbur_should) = 13;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "KEG")) {
wilbur_speech(_G(flags)[V120] ? "303w027" : "303w026");
} else if (player_said("BURNER")) {
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index 4c4fe996b42..fcfa74a0773 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -136,7 +136,7 @@ void Room304::daemon() {
_G(flags)[V129] = 1;
player_set_commands_allowed(false);
_G(wilbur_should) = 5;
- ws_walk(300, 306, nullptr, gCHANGE_WILBUR_ANIMATION, 4);
+ ws_walk(300, 306, nullptr, kCHANGE_WILBUR_ANIMATION, 4);
}
break;
@@ -157,7 +157,7 @@ void Room304::daemon() {
case 5:
_fire = series_play("304fire1", 0xa00, 0, -1, 6, -1);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 6:
@@ -165,7 +165,7 @@ void Room304::daemon() {
hotspot_set_active("MATCHES ", false);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
@@ -186,14 +186,14 @@ void Room304::daemon() {
ws_hide_walker();
terminateMachineAndNull(_matches);
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY3, "304wb01", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "304wb01", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "304wi03", 0x101, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY2, "304wi03", 0x101, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 5:
@@ -223,7 +223,7 @@ void Room304::parser() {
// Already handled
} else if (player_said("OPEN", "DOOR") || player_said("GEAR", "DOOR")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "MAP")) {
wilbur_speech(_G(flags)[V135] ? "304w012" : "304w011");
} else if (player_said("DISTILLED CARROT JUICE") &&
@@ -238,13 +238,13 @@ void Room304::parser() {
wilbur_speech("300w035z");
} else if (player_said("MATCHES", "STOVE") && !_G(flags)[V130]) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "MATCHES ")) {
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("READ", "RECIPE BOOK") || player_said("LOOK AT", "RECIPE BOOK")) {
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index e5f2f32fcce..731ab22b10d 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -89,7 +89,7 @@ void Room305::init() {
case 302:
_G(wilbur_should) = 101;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 319:
@@ -116,14 +116,14 @@ void Room305::daemon() {
_series1 = series_show("305genx", 0x200);
_G(flags)[V134] = 1;
_G(wilbur_should) = 105;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3001:
_G(game).new_room = 302;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 101:
ws_demand_location(372, 267, 9);
@@ -137,7 +137,7 @@ void Room305::daemon() {
_G(wilbur_should) = 104;
}
- series_play_with_breaks(PLAY1, "305wi01", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "305wi01", 0x700, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 102:
@@ -168,22 +168,22 @@ void Room305::daemon() {
if (_G(flags)[V135]) {
_G(wilbur_should) = 106;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(flags)[V135] = 1;
_G(wilbur_should) = 106;
- wilbur_speech("305w011", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("305w011", kCHANGE_WILBUR_ANIMATION);
}
break;
case 106:
_G(wilbur_should) = 10001;
- wilbur_speech(_G(flags)[V137] ? "305w013" : "305w012", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech(_G(flags)[V137] ? "305w013" : "305w012", kCHANGE_WILBUR_ANIMATION);
break;
case 107:
_G(wilbur_should) = 10001;
- wilbur_speech("305w012", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("305w012", kCHANGE_WILBUR_ANIMATION);
break;
case 108:
@@ -227,7 +227,7 @@ void Room305::parser() {
_G(wilbur_should) = 108;
if (_G(flags)[V137]) {
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("305w005");
}
@@ -256,7 +256,7 @@ void Room305::parser() {
wilbur_speech("305w014");
} else {
_G(wilbur_should) = 103;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (!player_said("LOOK AT WALL")) {
return;
diff --git a/engines/m4/burger/rooms/section3/room306.cpp b/engines/m4/burger/rooms/section3/room306.cpp
index 7494a298d50..3233c2db67e 100644
--- a/engines/m4/burger/rooms/section3/room306.cpp
+++ b/engines/m4/burger/rooms/section3/room306.cpp
@@ -64,7 +64,7 @@ void Room306::daemon() {
switch (_G(kernel).trigger) {
case 1:
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
- release_trigger_on_digi_state(g10027, 1);
+ release_trigger_on_digi_state(k10027, 1);
break;
case 3007:
diff --git a/engines/m4/burger/rooms/section3/room307.cpp b/engines/m4/burger/rooms/section3/room307.cpp
index d63adb5a416..074cfd78c19 100644
--- a/engines/m4/burger/rooms/section3/room307.cpp
+++ b/engines/m4/burger/rooms/section3/room307.cpp
@@ -82,7 +82,7 @@ void Room307::daemon() {
break;
case 6:
- wilbur_speech("307w002", g10027);
+ wilbur_speech("307w002", k10027);
break;
case 7:
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 9b595cae235..335421033c9 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -206,7 +206,7 @@ void Room310::daemon() {
_val2 = 16;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_hide_walker();
@@ -218,7 +218,7 @@ void Room310::daemon() {
case 2:
_general.terminate();
_G(wilbur_should) = 3;
- series_play_with_breaks(PLAY4, "310wi01", 0xb00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "310wi01", 0xb00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -257,7 +257,7 @@ void Room310::daemon() {
case 6:
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
- wilbur_speech("310w008", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("310w008", kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -277,7 +277,7 @@ void Room310::pre_parser() {
if (player_said("GEAR", "PROBE") && (!_G(flags)[V111] || _G(flags)[V144] == 1)) {
_G(wilbur_should) = 6;
- player_hotspot_walk_override(293, 288, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(293, 288, 3, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else if (!_G(flags)[V144]) {
HotSpotRec *hotspot = hotspot_which(_G(click_x), _G(click_y));
@@ -309,7 +309,7 @@ void Room310::parser() {
}
} else if (player_said("LOOK AT", "TRUFFLES")) {
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index 3ca1f2fb236..0a484987ab3 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -99,7 +99,7 @@ void Section3::daemon() {
kernel_timing_trigger(15, 3008);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 3001:
player_update_info();
@@ -108,7 +108,7 @@ void Section3::daemon() {
ws_hide_walker();
_G(wilbur_should) = 3002;
series_play_with_breaks(PLAY1, "300wdcj", _G(player_info).depth,
- gCHANGE_WILBUR_ANIMATION, 3, 6, _G(player_info).scale,
+ kCHANGE_WILBUR_ANIMATION, 3, 6, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
@@ -119,7 +119,7 @@ void Section3::daemon() {
_G(wilbur_should) = 10001;
wilbur_speech(_G(flags)[V101] ? "300w041" : "300w040");
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 10013:
@@ -159,7 +159,7 @@ void Section3::parser() {
wilbur_speech("300w031");
} else if (player_said_any("GEAR", "WILBUR")) {
_G(wilbur_should) = 3001;
- ws_turn_to_face(3, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(3, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BOTTLE")) {
wilbur_speech("300w076");
} else if (player_said("TAKE") && inv_player_has("DISTILLED CARROT JUICE")) {
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index b228aff8667..44e466d9d15 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -215,7 +215,7 @@ void Room402::init() {
if (_G(game).previous_room != RESTORING_GAME) {
_G(wilbur_should) = 5;
- kernel_timing_trigger(120, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(120, kCHANGE_WILBUR_ANIMATION);
}
} else {
_G(flags)[V298] = 1;
@@ -236,7 +236,7 @@ void Room402::init() {
_val2 = 15;
} else {
_G(wilbur_should) = 5;
- kernel_timing_trigger(120, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(120, kCHANGE_WILBUR_ANIMATION);
_val2 = 15;
}
} else {
@@ -253,7 +253,7 @@ void Room402::init() {
_val2 = 16;
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
}
@@ -834,11 +834,11 @@ void Room402::daemon() {
Series::series_play("402pe04", 0x100, 0, 29, 6, 0, 100, 0, 0, 17, 21);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 2:
_G(wilbur_should) = 3;
- kernel_timing_trigger(180, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(180, kCHANGE_WILBUR_ANIMATION);
break;
case 3:
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
index 13e4bf55656..dd05d206008 100644
--- a/engines/m4/burger/rooms/section4/room404.cpp
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -88,12 +88,12 @@ void Room404::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_G(wilbur_should) = 2;
disable_player();
- series_play_with_breaks(PLAY1, "404wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 1);
+ series_play_with_breaks(PLAY1, "404wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 1);
break;
case 2:
@@ -134,7 +134,7 @@ void Room404::parser() {
} else if (player_said("IMPOUND YARD")) {
if (player_said("TAKE", "QUARTER ")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TOILET")) {
wilbur_speech("404w004");
} else if (player_said("BARS")) {
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 88aac9ef7f0..ad82c86b506 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -756,12 +756,12 @@ void Room405::daemon() {
_G(game).room_id = 1;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 25:
disable_player();
_G(wilbur_should) = 26;
- Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
+ Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
break;
case 26:
@@ -772,22 +772,22 @@ void Room405::daemon() {
case 27:
disable_player();
_G(wilbur_should) = 28;
- Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
+ Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
break;
case 28:
_G(wilbur_should) = 29;
- Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 11, 11);
+ Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 11, 11);
startConv90();
break;
case 29:
- Series::series_play("405wi01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 60, 0, 100, 0, 0, 11, 11);
+ Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 60, 0, 100, 0, 0, 11, 11);
break;
case 30:
_G(wilbur_should) = 31;
- Series::series_play("405wi01", 0x100, 2, gCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
+ Series::series_play("405wi01", 0x100, 2, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
break;
case 31:
@@ -798,7 +798,7 @@ void Room405::daemon() {
terminateMachineAndNull(_lid);
disable_player();
_G(wilbur_should) = 33;
- series_play_with_breaks(PLAY5, "405wi07", 0x100, gCHANGE_WILBUR_ANIMATION, 3, 7, 100, 0, 0);
+ series_play_with_breaks(PLAY5, "405wi07", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 7, 100, 0, 0);
break;
case 33:
@@ -814,13 +814,13 @@ void Room405::daemon() {
case 34:
disable_player();
_G(wilbur_should) = 35;
- series_play_with_breaks(PLAY6, "405wi04", 0xe00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY6, "405wi04", 0xe00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 35:
inv_move_object("quarter", 405);
_G(wilbur_should) = 36;
- series_play_with_breaks(PLAY7, "405wi05", 0xe00, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY7, "405wi05", 0xe00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 36:
@@ -830,13 +830,13 @@ void Room405::daemon() {
player_update_info();
_G(wilbur_should) = 37;
- ws_walk(_G(player_info).x, _G(player_info).y, nullptr, gCHANGE_WILBUR_ANIMATION, 5);
+ ws_walk(_G(player_info).x, _G(player_info).y, nullptr, kCHANGE_WILBUR_ANIMATION, 5);
break;
case 37:
_G(wilbur_should) = 38;
gr_backup_palette();
- pal_fade_init(_G(kernel).first_fade, 255, 0, 15, gCHANGE_WILBUR_ANIMATION);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 15, kCHANGE_WILBUR_ANIMATION);
break;
case 38:
@@ -922,7 +922,7 @@ void Room405::parser() {
}
} else if (player_said("dog collar", "vipe")) {
_G(wilbur_should) = 25;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
hotspot_set_active("vipe", false);
hotspot_set_active("guitar", false);
} else if (player_said("swinging door") && player_said_any("enter", "gear") && !_G(flags)[V168]) {
@@ -992,16 +992,16 @@ void Room405::parser() {
}
} else if (player_said("vipe") && inv_player_has(_G(player).verb)) {
_G(wilbur_should) = 27;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("records", "jukebox")) {
_G(wilbur_should) = 32;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (!_G(flags)[V168] && (player_said("quarter", "jukebox") || player_said("gear", "jukebox"))) {
if (!inv_player_has("quarter")) {
wilbur_speech("405w008");
} else if (_G(flags)[V167]) {
_G(wilbur_should) = 34;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
switch (_G(kernel).trigger) {
case -1:
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index e6a504f5c57..e8c14404594 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -507,7 +507,7 @@ void Room406::init() {
if (_G(flags)[V174] == 4003) {
ws_hide_walker();
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -685,7 +685,7 @@ void Room406::daemon() {
case 34:
_G(wilbur_should) = 13;
- wilbur_speech("406w017", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("406w017", kCHANGE_WILBUR_ANIMATION);
break;
case 35:
@@ -731,7 +731,7 @@ void Room406::daemon() {
case 45:
digi_unload("406_111");
_G(wilbur_should) = 15;
- wilbur_speech("406w018", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("406w018", kCHANGE_WILBUR_ANIMATION);
break;
case 46:
@@ -1030,7 +1030,7 @@ void Room406::daemon() {
case 65:
_G(wilbur_should) = 21;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_val1 = 64;
kernel_trigger_dispatch_now(12);
break;
@@ -1121,7 +1121,7 @@ void Room406::daemon() {
_coll.play("406coll", 0x4fd, 16);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_unhide_walker();
@@ -1132,7 +1132,7 @@ void Room406::daemon() {
_val6 = 84;
_fishS = series_load("406fish");
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "406wi05", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "406wi05", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -1140,14 +1140,14 @@ void Room406::daemon() {
_val7 = 82;
kernel_trigger_dispatch_now(14);
_G(wilbur_should) = 1;
- series_play_with_breaks(PLAY4, "406wi03", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "406wi03", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
terminateMachineAndNull(_tt);
disable_player();
_G(wilbur_should) = 5;
- series_play_with_breaks(PLAY5, "406tt6a", 0x4fd, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY5, "406tt6a", 0x4fd, kCHANGE_WILBUR_ANIMATION, 2);
_wi03 = series_play("406wi03s", 0x4fe, 18);
break;
@@ -1162,7 +1162,7 @@ void Room406::daemon() {
terminateMachineAndNull(_tt);
disable_player();
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY6, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "406wi04", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 7:
@@ -1176,7 +1176,7 @@ void Room406::daemon() {
_general.terminate();
disable_player();
_G(wilbur_should) = 9;
- series_play_with_breaks(PLAY7, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY7, "406wi04", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 9:
@@ -1195,7 +1195,7 @@ void Room406::daemon() {
ws_demand_location(183, 281, 10);
disable_player();
_G(wilbur_should) = 12;
- series_play_with_breaks(PLAY8, "406wi04", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "406wi04", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 12:
@@ -1214,7 +1214,7 @@ void Room406::daemon() {
_G(wilbur_should) = 14;
digi_preload_stream_breaks(SERIES1);
- series_stream_with_breaks(SERIES1, "406tt04", 6, 0x600, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES1, "406tt04", 6, 0x600, kCHANGE_WILBUR_ANIMATION);
_wi03 = series_play("406wi03s", 0x601, 18);
break;
@@ -1245,7 +1245,7 @@ void Room406::daemon() {
}
if (digi_play_state(2)) {
- kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
} else {
_gate.terminate();
series_unload(_gateS1);
@@ -1257,7 +1257,7 @@ void Room406::daemon() {
setHotspots2();
_G(wilbur_should) = 17;
- series_play_with_breaks(PLAY1, "406wi01", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "406wi01", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -1272,7 +1272,7 @@ void Room406::daemon() {
disable_player();
terminateMachineAndNull(_coll406);
_G(wilbur_should) = 19;
- series_play_with_breaks(PLAY3, "406wi02", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "406wi02", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 19:
@@ -1291,7 +1291,7 @@ void Room406::daemon() {
case 21:
ws_hide_walker();
_G(wilbur_should) = 19;
- series_play_with_breaks(PLAY9, "406wi06", 0x4fd, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "406wi06", 0x4fd, kCHANGE_WILBUR_ANIMATION, 3);
break;
default:
@@ -1316,7 +1316,7 @@ void Room406::daemon() {
}
break;
- case gSET_COMMANDS_ALLOWED:
+ case kSET_COMMANDS_ALLOWED:
if (!_val2)
player_set_commands_allowed(true);
break;
@@ -1340,11 +1340,11 @@ void Room406::pre_parser() {
if (inv_player_has("HOOK")) {
if (player_said("HOOK", "BARRED WINDOW ")) {
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (!player_said("HOOK") ||
(player_said("HOOK") && player_said_any("YARD", "YARD "))) {
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GATE") && _G(flags)[V172] == 10025) {
player_hotspot_walk_override(280, 296, 2);
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 40388e6465d..d891caca28f 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -525,7 +525,7 @@ void Room407::daemon() {
_G(flags)[V181] = 1;
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
@@ -561,7 +561,7 @@ void Room407::daemon() {
}
break;
- case gSET_COMMANDS_ALLOWED:
+ case kSET_COMMANDS_ALLOWED:
if (!_G(flags)[V181] && _G(flags)[V171] == 4003) {
_val5 = 38;
kernel_timing_trigger(60, 9);
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 23bedc7413e..304aea5948c 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -180,7 +180,7 @@ void Section4::daemon() {
player_set_commands_allowed(!checkOrderWindow());
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
if (_G(wilbur_should) == 10015) {
kernel_trigger_dispatch_now(10027);
} else {
@@ -227,7 +227,7 @@ bool Section4::checkOrderWindow() {
if (_G(flags)[V168] && _G(flags)[V181] && _G(flags)[V176] && _G(flags)[V159]) {
player_set_commands_allowed(false);
_G(flags)[V152] = 1;
- disable_player_commands_and_fade_init(g10027);
+ disable_player_commands_and_fade_init(k10027);
return true;
} else {
return false;
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index fe5a567629e..da6d37525dd 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -288,19 +288,19 @@ void Room502::init() {
ws_demand_location(237, 235, 9);
ws_hide_walker();
_G(wilbur_should) = _G(flags)[V196] ? 6 : 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 506:
ws_demand_location(402, 272, 1);
_G(wilbur_should) = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -365,7 +365,7 @@ void Room502::daemon() {
_G(wilbur_should) = 1;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 7:
@@ -692,7 +692,7 @@ void Room502::daemon() {
enable_player();
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
kernel_trigger_dispatch_now(7);
@@ -712,7 +712,7 @@ void Room502::daemon() {
case 4:
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ series_play_with_breaks(PLAY2, "502wi03", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5);
break;
case 5:
@@ -724,17 +724,17 @@ void Room502::daemon() {
ws_demand_location(237, 235, 9);
ws_hide_walker();
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY3, "502wi02", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ series_play_with_breaks(PLAY3, "502wi02", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5);
break;
case 6:
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY4, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3, 5);
+ series_play_with_breaks(PLAY4, "502wi03", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5);
break;
case 7:
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY5, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2, 5);
+ series_play_with_breaks(PLAY5, "502wi05", 0xc01, kCHANGE_WILBUR_ANIMATION, 2, 5);
break;
case 8:
@@ -742,9 +742,9 @@ void Room502::daemon() {
_G(wilbur_should) = 9;
if (_G(flags)[V196]) {
- series_play_with_breaks(PLAY7, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY7, "502wi05", 0xc01, kCHANGE_WILBUR_ANIMATION, 2);
} else {
- series_play_with_breaks(PLAY6, "502wi05", 0xc01, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY6, "502wi05", 0xc01, kCHANGE_WILBUR_ANIMATION, 2);
}
_G(flags)[V196] = 0;
@@ -761,20 +761,20 @@ void Room502::daemon() {
inv_move_object("SOAPY WATER", NOWHERE);
inv_give_to_player("BOTTLE");
- series_play_with_breaks(PLAY8, "502wi03", 0xc01, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "502wi03", 0xc01, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 11;
- series_play_with_breaks(PLAY9, "502wi06", 0x801, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "502wi06", 0x801, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
inv_give_to_player("KINDLING");
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 12:
@@ -782,7 +782,7 @@ void Room502::daemon() {
ws_hide_walker();
_val2 = 18;
_G(wilbur_should) = 1;
- series_play_with_breaks(PLAY10, "502wi07", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "502wi07", 0xbff, kCHANGE_WILBUR_ANIMATION, 3);
break;
default:
@@ -847,13 +847,13 @@ void Room502::parser() {
// Already handled
} else if (player_said("GEAR", "FRONT DOOR")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR")) {
_val6 = 5007;
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK ") && player_said("LOOK AT") &&
!player_said_any("GIZMO", "ROLLING PIN", "DIRTY SOCK", "SOAPY WATER", "RUBBER GLOVES") &&
!player_said("LAXATIVE")) {
@@ -863,14 +863,14 @@ void Room502::parser() {
} else if (player_said("TAKE", "KINDLING ")) {
if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
_G(wilbur_should) = 10;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("SOAPY WATER", "RAILING")) {
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BURNING KINDLING", "FIREPLACE")) {
_G(wilbur_should) = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
inv_move_object("BURNING KINDLING", NOWHERE);
} else {
return;
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 9801dfbf5e8..fbddf9f73d8 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -309,7 +309,7 @@ void Room503::init() {
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -461,7 +461,7 @@ void Room503::daemon() {
case 11:
_val6 = 26;
_G(wilbur_should) = 4;
- wilbur_speech("500w017", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("500w017", kCHANGE_WILBUR_ANIMATION);
break;
case 12:
player_set_commands_allowed(false);
@@ -762,10 +762,10 @@ void Room503::daemon() {
case 5002:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(true);
@@ -785,7 +785,7 @@ void Room503::daemon() {
term_message("Wilbur waiting for bork to snarl at him but bork snarling already");
break;
default:
- kernel_timing_trigger(15, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
break;
}
break;
@@ -795,7 +795,7 @@ void Room503::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY20, "503wi01", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY20, "503wi01", 0x800, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
@@ -819,7 +819,7 @@ void Room503::daemon() {
ws_hide_walker();
_G(wilbur_should) = 6;
_G(flags)[V204] = 5003;
- series_play_with_breaks(PLAY22, "503wi03", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY22, "503wi03", 0x800, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
@@ -833,14 +833,14 @@ void Room503::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY23, "503wi06", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY23, "503wi06", 0x800, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY24, "503wi05", 0x800, gCHANGE_WILBUR_ANIMATION, 3, 6);
+ series_play_with_breaks(PLAY24, "503wi05", 0x800, kCHANGE_WILBUR_ANIMATION, 3, 6);
break;
default:
@@ -863,13 +863,13 @@ void Room503::pre_parser() {
_flag2 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
- player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(260, 300, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") && !_flag3 &&
_G(flags)[kBORK_STATE] == 13 && _G(flags)[kBORK_STATE] != 16) {
_flag3 = true;
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
- player_hotspot_walk_override(260, 300, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(260, 300, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK", "ROLLING PIN") &&
(_G(flags)[kBORK_STATE] == 12 || _G(flags)[kBORK_STATE] == 11)) {
_flag1 = false;
@@ -878,7 +878,7 @@ void Room503::pre_parser() {
_val4 = 11;
_G(wilbur_should) = 1;
player_set_commands_allowed(false);
- player_hotspot_walk_override(346, 283, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(346, 283, 2, kCHANGE_WILBUR_ANIMATION);
} else {
if (_flag1) {
player_update_info();
@@ -955,24 +955,24 @@ void Room503::parser() {
// Already handled
} else if (player_said("TAKE", "ROLLING PIN ")) {
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "RUBBER GLOVES ") &&
(_G(flags)[kBORK_STATE] == 16 || _G(flags)[kBORK_STATE] == 13)) {
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BORK") && player_said("LOOK AT") &&
(_G(flags)[kBORK_STATE] == 0 || _G(flags)[kBORK_STATE] == 1) &&
!player_said_any("GIZMO", "ROLLING PIN", "SOCK", "SOAPY WATER", "RUBBER_GLOVES") &&
!player_said("LAXATIVE")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "MICROWAVE") && _G(flags)[kBORK_STATE] == 13) {
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "OVEN") && (_G(flags)[kBORK_STATE] == 16 || _G(flags)[kBORK_STATE] == 13)) {
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR")) {
term_message("Going into 502!");
_val5 = 5006;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 3f3630fb20f..6b509d35c22 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -241,13 +241,13 @@ void Room504::init() {
case 503:
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -297,7 +297,7 @@ void Room504::daemon() {
_val1 = 26;
kernel_trigger_dispatch_now(5);
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_val1 = imath_ranged_rand(0, 100) >= 75 ? 25 : 22;
kernel_trigger_dispatch_now(5);
@@ -314,7 +314,7 @@ void Room504::daemon() {
case 23:
_state2 = imath_ranged_rand(1, 3);
_G(wilbur_should) = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_val1 = 21;
series_play_with_breaks(PLAY14, "504BK09", 0x850, 5, 2, 12);
break;
@@ -477,10 +477,10 @@ void Room504::daemon() {
case 5002:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(true);
@@ -499,14 +499,14 @@ void Room504::daemon() {
_G(wilbur_should) = 1;
}
- series_play_with_breaks(PLAY1, "504wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "504wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
_G(wilbur_should) = 10001;
player_set_commands_allowed(false);
ws_hide_walker();
- series_play_with_breaks(PLAY2, "504wi02", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "504wi02", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
pal_fade_init(_G(kernel).first_fade, 255, 0, 60, 5007);
break;
@@ -514,7 +514,7 @@ void Room504::daemon() {
_G(wilbur_should) = 10001;
player_set_commands_allowed(false);
ws_hide_walker();
- series_play_with_breaks(PLAY8, "504wi06", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "504wi06", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
@@ -523,7 +523,7 @@ void Room504::daemon() {
_val1 = 27;
_G(wilbur_should) = 39;
- series_play_with_breaks(PLAY9, "504Wi07", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "504Wi07", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
inv_move_object("DIRTY SOCK", NOWHERE);
break;
@@ -534,7 +534,7 @@ void Room504::daemon() {
ws_hide_walker();
_val3 = 34;
- series_play_with_breaks(PLAY3, "504wi3b", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY3, "504wi3b", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
_G(flags)[V211] = 5000;
break;
@@ -543,7 +543,7 @@ void Room504::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_val3 = 35;
- series_play_with_breaks(PLAY4, "504Wi3A", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY4, "504Wi3A", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
_G(flags)[V211] = 5001;
break;
@@ -558,7 +558,7 @@ void Room504::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_val4 = 34;
- series_play_with_breaks(PLAY6, "504Wi4B", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY6, "504Wi4B", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 11:
@@ -566,7 +566,7 @@ void Room504::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_val4 = 35;
- series_play_with_breaks(PLAY7, "504Wi4A", 0x200, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY7, "504Wi4A", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 12: {
@@ -577,7 +577,7 @@ void Room504::daemon() {
ws_demand_location(x, _G(player_info).y);
ws_hide_walker();
- series_play_with_breaks(PLAY10, "504Wi08", 0x200, gCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY10, "504Wi08", 0x200, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
}
@@ -665,32 +665,32 @@ void Room504::parser() {
player_set_commands_allowed(false);
_G(kernel).trigger_mode = KT_DAEMON;
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "DIRTY SOCK ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("DIRTY SOCK", "WRINGER")) {
player_set_commands_allowed(false);
_flag1 = true;
} else if (player_said("GEAR", "INSIDE BREAKER")) {
if (_G(flags)[V211] == 5000) {
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 7;
_G(flags)[V211] = 5000;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR", "OUTSIDE BREAKER")) {
if (_G(flags)[V212] == 5000) {
_G(wilbur_should) = 11;
_G(flags)[V212] = 5001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 10;
_G(flags)[V212] = 5000;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("LOOK AT", "HOLE")) {
_val5 = 19;
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 832aea38cf8..a215a90442d 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -93,7 +93,7 @@ void Room505::init() {
case 502:
ws_demand_location(333, 271, 3);
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 506:
@@ -117,7 +117,7 @@ void Room505::init() {
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -255,14 +255,14 @@ void Room505::daemon() {
_series1 = series_play("505fan", 0xbff);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
ws_demand_location(333, 271, 3);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY1, "505wi01", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "505wi01", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -275,7 +275,7 @@ void Room505::daemon() {
case 3:
_G(wilbur_should) = 2;
- wilbur_speech("500w054", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("500w054", kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -321,12 +321,12 @@ void Room505::parser() {
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("SOAPY WATER", "RAILING")) {
_G(flags)[V196] = 1;
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index 2516a169be5..efa11f8aa19 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -169,13 +169,13 @@ void Room506::init() {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -294,7 +294,7 @@ void Room506::daemon() {
case 17:
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 18:
@@ -367,10 +367,10 @@ void Room506::daemon() {
case 5002:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(true);
@@ -392,7 +392,7 @@ void Room506::daemon() {
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "506wi02", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "506wi02", 0x800, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
@@ -409,7 +409,7 @@ void Room506::daemon() {
_state1 = imath_ranged_rand(1, 3);
_G(wilbur_should) = 6;
digi_preload_stream_breaks(SERIES1);
- series_stream_with_breaks(SERIES1, "506wi03", 6, 0x100, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES1, "506wi03", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 6:
@@ -428,7 +428,7 @@ void Room506::daemon() {
_val3 = 5006;
_triggers[0] = 3;
- _triggers[1] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[1] = kCHANGE_WILBUR_ANIMATION;
_G(wilbur_should) = 8;
series_play_with_breaks(PLAY3, "506wi05", 0x2fe, 4, 3);
break;
@@ -453,11 +453,11 @@ void Room506::daemon() {
void Room506::pre_parser() {
if (player_said("AMPLIFIER", "TELEVISION") && _G(flags)[V218] != 5003) {
_G(wilbur_should) = 4;
- player_hotspot_walk_override(456, 245, 8, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(456, 245, 8, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else if (player_said("FIRE", "KINDLING")) {
_G(wilbur_should) = 7;
- player_hotspot_walk_override(409, 311, 4, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(409, 311, 4, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
player_set_facing_hotspot();
@@ -487,7 +487,7 @@ void Room506::parser() {
} else if (player_said_any("ROOF", "WINDOW") && !player_said_any("ENTER", "GEAR") &&
_G(flags)[V219]) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
_val3 = 5009;
kernel_trigger_dispatch_now(3);
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index 8afb1c3f39f..cf10e1f5d61 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -257,7 +257,7 @@ void Room507::init() {
case 510:
ws_demand_location(_G(flags)[V187], _G(flags)[V188], _G(flags)[V189]);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -459,7 +459,7 @@ void Room507::daemon() {
case 25:
_G(wilbur_should) = _val5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_val2 = _val6;
kernel_trigger_dispatch_now(6);
break;
@@ -577,10 +577,10 @@ void Room507::daemon() {
case 5002:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(true);
@@ -592,7 +592,7 @@ void Room507::daemon() {
ws_hide_walker();
_val7 = 0;
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY2, "507wi01", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "507wi01", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -600,28 +600,28 @@ void Room507::daemon() {
ws_hide_walker();
_G(wilbur_should) = 4;
_val2 = 18;
- series_play_with_breaks(PLAY5, "507wi04", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "507wi04", 0x8ff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
ws_hide_walker();
player_update_info();
_G(wilbur_should) = _flag2 ? 8 : 5;
- series_play_with_breaks(PLAY3, "507wi02", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "507wi02", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 5:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY6, "507wi04", 0x8ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "507wi04", 0x8ff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY1, "507wi03", 0xaff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "507wi03", 0xaff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 7:
@@ -649,7 +649,7 @@ void Room507::daemon() {
_val3 = 28;
}
- _triggers[0] = gCHANGE_WILBUR_ANIMATION;
+ _triggers[0] = kCHANGE_WILBUR_ANIMATION;
_val8 = 10;
series_play_with_breaks(PLAY7, "507wi05", 0x8ff, 1, 3);
break;
@@ -658,7 +658,7 @@ void Room507::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY8, "507wi06", 0xd00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "507wi06", 0xd00, kCHANGE_WILBUR_ANIMATION, 3);
break;
default:
@@ -721,18 +721,18 @@ void Room507::parser() {
_val2 = 23;
} else if (player_said("TAKE", "RUBBER DUCKY ")) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RUBBER DUCKY") && player_said_any("GEAR", "WILBUR")) {
_G(wilbur_should) = 3;
- ws_walk(197, 274, nullptr, gCHANGE_WILBUR_ANIMATION, 9);
+ ws_walk(197, 274, nullptr, kCHANGE_WILBUR_ANIMATION, 9);
} else if (player_said("RUBBER DUCKY", "TOILET")) {
_flag2 = true;
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR") && player_said_any("TOILET", "FLUSH CHAIN")) {
if (_G(flags)[V223] == 1 || _G(flags)[V223] == 2) {
_G(wilbur_should) = 9;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (inv_where_is("RUBBER DUCKY") == 500) {
_val5 = 9;
_val6 = 21;
@@ -745,7 +745,7 @@ void Room507::parser() {
} else if (player_said("BOTTLE") && player_said_any("SOAPY WATER ", "TUB ")) {
if (_G(flags)[V223] == 1 || _G(flags)[V223] == 2) {
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("507w038");
}
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
index f19395a4928..9e666c026f2 100644
--- a/engines/m4/burger/rooms/section5/room508.cpp
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -209,7 +209,7 @@ void Room508::init() {
_val6 = 10;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -224,7 +224,7 @@ void Room508::init() {
_G(wilbur_should) = 4;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
}
@@ -279,7 +279,7 @@ void Room508::daemon() {
case 17:
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
++_state3;
_val6 = 11;
setup();
@@ -363,14 +363,14 @@ void Room508::daemon() {
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, 5010);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_val1 = 3;
player_set_commands_allowed(false);
_flag1 = false;
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY6, "508Wi01", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY6, "508Wi01", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 2:
@@ -379,7 +379,7 @@ void Room508::daemon() {
terminateMachineAndNull(_series4);
_val1 = 1;
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY1, "508Wi06", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY1, "508Wi06", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 3:
@@ -391,10 +391,10 @@ void Room508::daemon() {
if (_G(flags)[V212] == 5000) {
_G(wilbur_should) = 6;
- series_play_with_breaks(PLAY2, "508Wi06", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY2, "508Wi06", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
} else {
_G(wilbur_should) = 5;
- series_play_with_breaks(PLAY2, "508Wi03", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY2, "508Wi03", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
}
break;
@@ -413,25 +413,25 @@ void Room508::daemon() {
if (_flag3) {
_G(wilbur_should) = 9;
_flag3 = false;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
if (_val1 == 1) {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ _series4 = series_show("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 0);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 2:
_val1 = 3;
_val1 = 1;
- _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
default:
@@ -441,17 +441,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508Wi09", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 1:
_val1 = 2;
- _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ _series4 = series_show("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 2);
break;
case 2:
_val1 = 3;
- _series4 = series_play("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
default:
@@ -461,17 +461,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508Wi09", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508Wi09", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508Wi09", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
case 2:
_val1 = 3;
- _series4 = series_show("508Wi09", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ _series4 = series_show("508Wi09", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 3);
break;
default:
@@ -492,17 +492,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ _series4 = series_show("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 0);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 2:
_val1 = 3;
- _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
default:
@@ -512,17 +512,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508wi10", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508wi10", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 1:
_val1 = 2;
- _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ _series4 = series_show("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 2);
break;
case 2:
_val1 = 3;
- _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
default:
@@ -532,17 +532,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508wi10", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508wi10", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
case 2:
_val1 = 3;
- _series4 = series_show("508wi10", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ _series4 = series_show("508wi10", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 3);
break;
default:
@@ -563,17 +563,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 0);
+ _series4 = series_show("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 0);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 2:
_val1 = 3;
- _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
default:
@@ -583,17 +583,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
+ _series4 = series_play("508wi11", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 2);
break;
case 1:
_val1 = 2;
- _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 2);
+ _series4 = series_show("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 2);
break;
case 2:
_val1 = 3;
- _series4 = series_play("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
default:
@@ -603,17 +603,17 @@ void Room508::daemon() {
switch (imath_ranged_rand(0, 2)) {
case 0:
_val1 = 1;
- _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
+ _series4 = series_play("508wi11", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 0, 3);
break;
case 1:
_val1 = 2;
- _series4 = series_play("508wi11", 0x200, 2, gCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
+ _series4 = series_play("508wi11", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 20, 0, 100, 0, 0, 2, 3);
break;
case 2:
_val1 = 3;
- _series4 = series_show("508wi11", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 40, 3);
+ _series4 = series_show("508wi11", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 40, 3);
break;
default:
@@ -631,10 +631,10 @@ void Room508::daemon() {
_val1 = 1;
if (_G(flags)[V212] == 5000) {
- series_play_with_breaks(PLAY3, "508Wi07", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY3, "508Wi07", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
inv_move_object("CHRISTMAS LIGHTS ", 508);
} else {
- series_play_with_breaks(PLAY3, "508Wi04", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY3, "508Wi04", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
inv_move_object("CHRISTMAS LIGHTS", 508);
}
break;
@@ -648,10 +648,10 @@ void Room508::daemon() {
_val1 = 1;
if (_G(flags)[V212] == 5000) {
- series_play_with_breaks(PLAY4, "508Wi08", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY4, "508Wi08", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
inv_move_object("CHRISTMAS LIGHTS ", 508);
} else {
- series_play_with_breaks(PLAY4, "508Wi05", 0x300, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY4, "508Wi05", 0x300, kCHANGE_WILBUR_ANIMATION, 2);
inv_move_object("CHRISTMAS LIGHTS", 508);
}
break;
@@ -664,7 +664,7 @@ void Room508::daemon() {
if (inv_player_has("CHRISTMAS LIGHTS") || player_said("CHRISTMAS LIGHTS ")) {
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_G(kernel).continue_handling_trigger = true;
} else {
terminateMachineAndNull(_series4);
@@ -700,16 +700,16 @@ void Room508::parser() {
} else if (player_said("HOLE") && player_said_any("CHRISTMAS LIGHTS ", "CHRISTMAS LIGHTS")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ROOF") && player_said_any("CHRISTMAS LIGHTS ", "CHRISTMAS LIGHTS")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 8;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("WILBUR'S ROOM") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
player_set_commands_allowed(false);
_flag3 = true;
_G(wilbur_should) = 9;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index 3db52488dbe..1868d09fe7f 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -119,7 +119,7 @@ void Room509::init() {
if (inv_player_has("CHRISTMAS LIGHTS") || inv_player_has("CHRISTMAS LIGHTS ")) {
disable_player();
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -137,7 +137,7 @@ void Room509::init() {
default:
ws_demand_location(272, 325);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
}
@@ -244,10 +244,10 @@ void Room509::daemon() {
case 5002:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
@@ -280,13 +280,13 @@ void Room509::daemon() {
_G(wilbur_should) = 14;
series_play_with_breaks(PLAY2, (_G(flags)[V212] == 5000) ? "509wi04" : "509wi02",
- 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
_general.terminate();
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 5:
@@ -297,14 +297,14 @@ void Room509::daemon() {
if (_G(flags)[V234]) {
_G(wilbur_should) = 6;
_val5 = 1;
- series_play_with_breaks(PLAY3, "509wi05", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY3, "509wi05", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
} else {
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY4, "509wi05", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "509wi05", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
}
} else {
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY5, "509wi07", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "509wi07", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -312,7 +312,7 @@ void Room509::daemon() {
_val5 = 2;
hotspot_set_active("CHRISTMAS LIGHTS ", true);
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY6, "609wi08", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "609wi08", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 7:
@@ -334,7 +334,7 @@ void Room509::daemon() {
hotspot_set_active("CHRISTMAS LIGHTS ", true);
_series2 = series_show("509wire", 0x900);
_series1 = series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 9:
@@ -359,33 +359,33 @@ void Room509::daemon() {
switch (_val2) {
case 0:
- digi_play("500w079", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w079", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 1:
- digi_play("500w080", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w080", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 2:
- digi_play("500w089", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w089", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 3:
- digi_play("500w090", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w090", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 4:
- digi_play("500w091", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w091", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 5:
_G(wilbur_should) = 4;
- digi_play("500w084", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w084", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 6:
_G(wilbur_should) = 4;
- digi_play("500w085", 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play("500w085", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -402,7 +402,7 @@ void Room509::daemon() {
case 13:
_general.terminate();
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 14:
@@ -461,7 +461,7 @@ void Room509::pre_parser() {
_G(player).ready_to_walk = false;
_general.terminate();
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
}
}
@@ -486,7 +486,7 @@ void Room509::parser() {
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 5009);
} else if (player_said("TAKE", "CHRISTMAS LIGHTS ")) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
diff --git a/engines/m4/burger/rooms/section5/room512.cpp b/engines/m4/burger/rooms/section5/room512.cpp
index ae212c42f71..502878fcefb 100644
--- a/engines/m4/burger/rooms/section5/room512.cpp
+++ b/engines/m4/burger/rooms/section5/room512.cpp
@@ -60,7 +60,7 @@ void Room512::daemon() {
switch (_G(kernel).trigger) {
case 1:
switch (_G(wilbur_should)) {
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
_state1 = imath_ranged_rand(11, 12);
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "512burnt", 6, 1, 2);
@@ -82,7 +82,7 @@ void Room512::daemon() {
case 2:
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
- release_trigger_on_digi_state(g10027, 1);
+ release_trigger_on_digi_state(k10027, 1);
break;
default:
diff --git a/engines/m4/burger/rooms/section5/room513.cpp b/engines/m4/burger/rooms/section5/room513.cpp
index e0b00a8d369..e4389771dce 100644
--- a/engines/m4/burger/rooms/section5/room513.cpp
+++ b/engines/m4/burger/rooms/section5/room513.cpp
@@ -57,7 +57,7 @@ void Room513::daemon() {
switch (_G(kernel).trigger) {
case 1:
digi_preload_stream_breaks(SERIES1);
- series_stream_with_breaks(SERIES1, "513OUTRO", 6, 1, g10027);
+ series_stream_with_breaks(SERIES1, "513OUTRO", 6, 1, k10027);
break;
default:
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 3445ed8e584..cf19f1a6c4a 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -483,7 +483,7 @@ void Section5::daemon() {
disable_player_commands_and_fade_init(5017);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 5001:
_G(flags)[V234] = 1;
@@ -491,7 +491,7 @@ void Section5::daemon() {
_G(wilbur_should) = 5002;
player_update_info();
series_play_with_breaks(PLAY1, "503wi07", _G(player_info).depth,
- gCHANGE_WILBUR_ANIMATION, 3, _G(player_info).scale,
+ kCHANGE_WILBUR_ANIMATION, 3, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
@@ -531,7 +531,7 @@ void Section5::parser() {
_G(flags)[V234] == 0 && _G(game).previous_room != 508) {
player_set_commands_allowed(false);
_G(wilbur_should) = 5001;
- ws_turn_to_face(4, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(4, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GIZMO") && player_said_any("WILBUR", "GEAR", "TAKE")) {
takeGizmo(_G(master_palette));
@@ -574,7 +574,7 @@ void Section5::flagsTrigger() {
if (checkFlags()) {
_G(wilbur_should) = 5003;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
kernel_trigger_dispatch_now(5002);
}
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 74ee5da093b..aded78d919e 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -371,7 +371,7 @@ void Room602::init() {
player_set_commands_allowed(true);
if (_G(flags)[V263]) {
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -379,17 +379,17 @@ void Room602::init() {
ws_hide_walker();
if (_G(roomVal7) == 1) {
_G(wilbur_should) = 2;
- kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(30, kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 3;
- kernel_timing_trigger(60, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(60, kCHANGE_WILBUR_ANIMATION);
}
break;
case 604:
ws_hide_walker();
_G(wilbur_should) = 3;
- kernel_timing_trigger(60, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(60, kCHANGE_WILBUR_ANIMATION);
break;
case 609:
@@ -455,7 +455,7 @@ void Room602::daemon() {
wilbur_speech("602w005");
_series8 = series_play("612mot01", 0x400, 0, 1, 0, 0, 100, 0, 0, 8, 18);
_G(wilbur_should) = 10001;
- kernel_timing_trigger(30, gCHANGE_WILBUR_ANIMATION);
+ kernel_timing_trigger(30, kCHANGE_WILBUR_ANIMATION);
break;
case 55:
@@ -529,7 +529,7 @@ void Room602::daemon() {
kernel_trigger_dispatch_now(1);
_G(wilbur_should) = (_G(flags)[V280] == 1) ? 10001 : 35;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 61:
@@ -667,7 +667,7 @@ void Room602::daemon() {
case 7:
inv_give_to_player("KIBBLE");
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 8:
@@ -676,7 +676,7 @@ void Room602::daemon() {
case 9:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(10);
break;
@@ -703,7 +703,7 @@ void Room602::daemon() {
break;
case 14:
- digi_play("602w015", 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ digi_play("602w015", 1, 255, kCHANGE_WILBUR_ANIMATION, 602);
break;
case 6011:
@@ -767,7 +767,7 @@ void Room602::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
@@ -781,7 +781,7 @@ void Room602::daemon() {
ws_demand_location(283, 338, 7);
ws_hide_walker();
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY2, "602wi01", 0x200, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "602wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -789,7 +789,7 @@ void Room602::daemon() {
ws_demand_location(367, 280, 5);
ws_hide_walker();
_G(wilbur_should) = 4;
- series_play_with_breaks(PLAY1, "602wi02", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "602wi02", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
@@ -798,11 +798,11 @@ void Room602::daemon() {
if (_G(player).been_here_before) {
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
player_set_commands_allowed(false);
_G(wilbur_should) = 45;
- ws_turn_to_face(10, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(10, kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -813,9 +813,9 @@ void Room602::daemon() {
_G(wilbur_should) = 30;
if (_G(game).room_id == 602) {
- series_play_with_breaks(PLAY4, "602wi05", 0x500, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "602wi05", 0x500, kCHANGE_WILBUR_ANIMATION, 3);
} else {
- series_play_with_breaks(PLAY5, "602wi19", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "602wi19", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -824,7 +824,7 @@ void Room602::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 31;
- series_play_with_breaks(PLAY5, "602wi19", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "602wi19", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
@@ -832,7 +832,7 @@ void Room602::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 32;
- series_play_with_breaks(PLAY6, "602wi18", 0x300, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "602wi18", 0x300, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 9:
@@ -840,7 +840,7 @@ void Room602::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 33;
- series_play_with_breaks(PLAY7, "602wi21", 0x900, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY7, "602wi21", 0x900, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
@@ -848,7 +848,7 @@ void Room602::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY8, "602wi40", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "602wi40", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
@@ -887,7 +887,7 @@ void Room602::daemon() {
if (_G(flags)[V263]) {
kernel_trigger_dispatch_now(13);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
// TODO: This seems like it's incorrect in the original
@@ -905,10 +905,10 @@ void Room602::daemon() {
case 12:
if (_G(flags)[V262] == 4) {
digi_play(Common::String::format("602w017%c", 'a' + imath_ranged_rand(0, 6)).c_str(),
- 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ 1, 255, kCHANGE_WILBUR_ANIMATION, 602);
} else {
digi_play(Common::String::format("602w016%c", 'a' + imath_ranged_rand(0, 3)).c_str(),
- 1, 255, gCHANGE_WILBUR_ANIMATION, 602);
+ 1, 255, kCHANGE_WILBUR_ANIMATION, 602);
}
break;
@@ -922,9 +922,9 @@ void Room602::daemon() {
_G(wilbur_should) = 14;
if (_G(game).room_id == 602) {
- series_stream_with_breaks(SERIES2, "602wi07c", 6, 0x380, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES2, "602wi07c", 6, 0x380, kCHANGE_WILBUR_ANIMATION);
} else {
- series_stream_with_breaks(SERIES2, "612wi07c", 6, 0x380, gCHANGE_WILBUR_ANIMATION);
+ series_stream_with_breaks(SERIES2, "612wi07c", 6, 0x380, kCHANGE_WILBUR_ANIMATION);
}
if (_G(flags)[V262] >= 4)
@@ -983,7 +983,7 @@ void Room602::daemon() {
player_set_commands_allowed(false);
player_update_info();
_G(wilbur_should) = 21;
- ws_walk(_G(player_info).x + 1, 304, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ ws_walk(_G(player_info).x + 1, 304, 0, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 21:
@@ -994,7 +994,7 @@ void Room602::daemon() {
_G(wilbur_should) = 46;
_test1 = imath_ranged_rand(0, 5);
series_play_with_breaks((_G(game).room_id == 602) ? PLAY16 : PLAY17,
- "602wi13", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX, 0);
+ "602wi13", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX, 0);
break;
case 22:
@@ -1027,7 +1027,7 @@ void Room602::daemon() {
series_play_with_breaks(PLAY10, "612wi17", 0x700, 1, 3, 6, 100, 114, -2);
} else {
_G(wilbur_should) = 24;
- series_play_with_breaks(PLAY9, "612wi17", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "612wi17", 0x700, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -1042,7 +1042,7 @@ void Room602::daemon() {
_G(wilbur_should) = 34;
}
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 25:
@@ -1053,7 +1053,7 @@ void Room602::daemon() {
ws_hide_walker();
_G(wilbur_should) = 44;
- series_play_with_breaks(PLAY19, "612wi14", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY19, "612wi14", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 26:
@@ -1064,11 +1064,11 @@ void Room602::daemon() {
if (_G(flags)[V278]) {
_G(wilbur_should) = 10001;
_test2 = imath_ranged_rand(0, 1);
- series_play_with_breaks(PLAY20, "612wi15", 0x600, gCHANGE_WILBUR_ANIMATION, 3, 6, 100, 114, 0);
+ series_play_with_breaks(PLAY20, "612wi15", 0x600, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 114, 0);
} else {
_G(wilbur_should) = 40;
_test2 = imath_ranged_rand(0, 1);
- series_play_with_breaks(PLAY20, "612wi15", 0x600, gCHANGE_WILBUR_ANIMATION, 3, 6);
+ series_play_with_breaks(PLAY20, "612wi15", 0x600, kCHANGE_WILBUR_ANIMATION, 3, 6);
}
break;
@@ -1087,10 +1087,10 @@ void Room602::daemon() {
digi_preload("602_005");
_val1 = 58;
_G(wilbur_should) = 29;
- series_play_with_breaks(PLAY22, "612wi18", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY22, "612wi18", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
} else {
_G(wilbur_should) = 28;
- series_play_with_breaks(PLAY21, "612wi16", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY21, "612wi16", 0x700, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -1098,14 +1098,14 @@ void Room602::daemon() {
_G(wilbur_should) = 41;
_val1 = 56;
kernel_trigger_dispatch_now(1);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 29:
_G(wilbur_should) = 41;
_val1 = 58;
kernel_trigger_dispatch_now(1);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 30:
@@ -1161,14 +1161,14 @@ void Room602::daemon() {
if (!_G(flags)[V261]) {
_G(flags)[V261] = 1;
- wilbur_speech("602w031", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("602w031", kCHANGE_WILBUR_ANIMATION);
}
break;
case 39:
_G(wilbur_should) = 27;
player_set_commands_allowed(false);
- wilbur_speech("612w056", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("612w056", kCHANGE_WILBUR_ANIMATION);
break;
case 40:
@@ -1194,12 +1194,12 @@ void Room602::daemon() {
case 43:
wilbur_speech("600w003");
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 44:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
if (_G(flags)[V279] > 4)
wilbur_speech("612w066");
@@ -1225,7 +1225,7 @@ void Room602::daemon() {
_G(wilbur_should) = 38;
series_play_with_breaks(_G(flags)[V261] ? PLAY14 : PLAY13,
- "602wi09", 0xc00, gCHANGE_WILBUR_ANIMATION, 3);
+ "602wi09", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -1262,7 +1262,7 @@ void Room602::daemon() {
term_message("Wilbur now slips on kibble!");
intr_cancel_sentence();
_G(wilbur_should) = 20;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
}
}
@@ -1294,7 +1294,7 @@ void Room602::pre_parser() {
if (_G(flags)[V278] == 0) {
if (_G(flags)[V255] == 0) {
_G(wilbur_should) = 22;
- player_hotspot_walk_override(423, 303, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(423, 303, 9, kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("600w008z");
}
@@ -1302,56 +1302,56 @@ void Room602::pre_parser() {
} else if (player_said("RAY GUN", "KIBBLE TRAY")) {
_G(wilbur_should) = 6;
if (_G(game).room_id == 602) {
- player_hotspot_walk_override(172, 325, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(172, 325, 9, kCHANGE_WILBUR_ANIMATION);
} else {
- player_hotspot_walk_override(151, 315, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(151, 315, 9, kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("RAY GUN", "KIBBLE ")) {
_G(wilbur_should) = 7;
- player_hotspot_walk_override(151, 315, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(151, 315, 9, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "EXERCISE WHEEL") && !_G(flags)[V278]) {
_G(wilbur_should) = 8;
- player_hotspot_walk_override(409, 359, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(409, 359, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "DOOR")) {
_G(wilbur_should) = 9;
- player_hotspot_walk_override(331, 303, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(331, 303, 10, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "GERBILS")) {
_G(wilbur_should) = 10;
- player_hotspot_walk_override(315, 317, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(315, 317, 10, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "DOOR")) {
_G(wilbur_should) = 47;
- player_hotspot_walk_override(257, 290, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(257, 290, 10, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "MOTOR") || player_said("GEAR", "MOTOR ")) {
if (_G(flags)[V278] == 0) {
if (_G(flags)[V277] == 6001) {
_G(wilbur_should) = 25;
- player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
}
if (_G(flags)[V277] == 6002 || _G(flags)[V277] == 6003) {
if (_G(flags)[V255] == 1) {
_G(wilbur_should) = 39;
- player_hotspot_walk_override(200, 21, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 21, 3, kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 26;
- player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
}
}
} else {
_G(wilbur_should) = 26;
- player_hotspot_walk_override(314, 319, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(314, 319, 3, kCHANGE_WILBUR_ANIMATION);
}
} else if ((player_said("GEAR", "MOTOR ") || player_said("PANTYHOSE", "MOTOR ")) &&
_G(flags)[V277] != 6002) {
_G(wilbur_should) = 37;
if (_G(flags)[V278]) {
- player_hotspot_walk_override(313, 319, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(313, 319, 3, kCHANGE_WILBUR_ANIMATION);
} else {
- player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
}
} else {
return;
@@ -1368,50 +1368,50 @@ void Room602::parser() {
player_said("MAGNET"))) {
_G(wilbur_should) = 43;
intr_cancel_sentence();
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "PEANUT")) {
wilbur_speech("602w047");
intr_cancel_sentence();
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
_G(flags)[V246] = 1;
Section6::_state2 = 2;
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("EXIT")) {
_G(wilbur_should) = 42;
- ws_turn_to_face(5, gCHANGE_WILBUR_ANIMATION);
+ ws_turn_to_face(5, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("PANTYHOSE", "MOTOR") || player_said("PANTYHOSE", "MOTOR ")) {
if (_G(flags)[V277] == 6001) {
_G(wilbur_should) = 25;
if (_G(flags)[V278]) {
- player_hotspot_walk_override(314, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(314, 321, 3, kCHANGE_WILBUR_ANIMATION);
} else {
- player_hotspot_walk_override(200, 321, 3, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
}
}
if (_G(flags)[V280]) {
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
- wilbur_speech("612w064", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("612w064", kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR", "EXERCISE WHEEL")) {
_G(wilbur_should) = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "DOOR")) {
_G(wilbur_should) = 47;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("KIBBLE ", "TAKE")) {
_G(wilbur_should) = 18;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "EXERCISE WHEEL")) {
if (_G(flags)[V278] == 1 && _G(flags)[V277] == 6003) {
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 92c843107d2..72b8d1d2cb2 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -218,12 +218,12 @@ void Room603::init() {
case 602:
case 612:
_G(wilbur_should) = 3;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 604:
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -261,17 +261,17 @@ void Room603::daemon() {
_val1 = 24;
series_play_with_breaks(PLAY14, "603hole", 0xfff, -1, 6);
} else {
- series_play_with_breaks(PLAY15, "603hole", 0xfff, gCHANGE_WILBUR_ANIMATION, 2);
+ series_play_with_breaks(PLAY15, "603hole", 0xfff, kCHANGE_WILBUR_ANIMATION, 2);
}
- _roomSeries1.play("603wi20", 0x400, 2, gCHANGE_WILBUR_ANIMATION, 0, 0, 100, 0, 0, 0, 17);
+ _roomSeries1.play("603wi20", 0x400, 2, kCHANGE_WILBUR_ANIMATION, 0, 0, 100, 0, 0, 0, 17);
digi_play("603_005", 2, 255, -1, 603);
break;
case 24:
_val1 = 27;
digi_play("603_007", 2);
- series_play("603motor", 0xbff, 0, gCHANGE_WILBUR_ANIMATION);
+ series_play("603motor", 0xbff, 0, kCHANGE_WILBUR_ANIMATION);
series_show("603hole", 0xfff, 0, -1, -1, 41);
_G(flags)[V277] = 6002;
break;
@@ -298,7 +298,7 @@ void Room603::daemon() {
case 1:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(2);
term_message("Kibble is now being removed.");
@@ -369,14 +369,14 @@ void Room603::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 2:
_G(wilbur_should) = 10001;
player_set_commands_allowed(false);
ws_demand_location(215, 311, 3);
ws_hide_walker();
- series_play_with_breaks(PLAY1, "603wi02", 0x7ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "603wi02", 0x7ff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
@@ -384,7 +384,7 @@ void Room603::daemon() {
player_set_commands_allowed(false);
ws_demand_location(400, 280, 7);
ws_hide_walker();
- series_play_with_breaks(PLAY2, "603wi06", 0xdff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY2, "603wi06", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
@@ -444,7 +444,7 @@ void Room603::daemon() {
} else {
wilbur_speech("603w017");
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -453,7 +453,7 @@ void Room603::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 17;
- series_play_with_breaks(PLAY8, "603wi10", 0x900, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY8, "603wi10", 0x900, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
@@ -461,7 +461,7 @@ void Room603::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY9, "603wi40", 0x700, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY9, "603wi40", 0x700, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
@@ -470,7 +470,7 @@ void Room603::daemon() {
ws_hide_walker();
_G(wilbur_should) = 19;
_val1 = 25;
- series_play_with_breaks(PLAY10, "603wi08", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "603wi08", 0xbff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 12:
@@ -479,7 +479,7 @@ void Room603::daemon() {
player_update_info();
_G(wilbur_should) = 13;
- ws_walk(_G(player_info).x + 1, 305, nullptr, gCHANGE_WILBUR_ANIMATION, 3);
+ ws_walk(_G(player_info).x + 1, 305, nullptr, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 13:
@@ -490,7 +490,7 @@ void Room603::daemon() {
_state1 = imath_ranged_rand(0, 5);
series_play_with_breaks(PLAY11, "602wi13", _G(player_info).depth,
- gCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX + 80, 0);
+ kCHANGE_WILBUR_ANIMATION, 3, 6, 100, Section6::_savedX + 80, 0);
break;
case 14:
@@ -509,7 +509,7 @@ void Room603::daemon() {
ws_demand_facing(2);
ws_hide_walker();
- series_play_with_breaks(PLAY13, "603wi07", 0xbff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY13, "603wi07", 0xbff, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -571,7 +571,7 @@ void Room603::daemon() {
term_message("Wilbur now slips on kibble!");
intr_cancel_sentence();
_G(wilbur_should) = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else {
_G(flags)[V264] = 0;
@@ -594,7 +594,7 @@ void Room603::pre_parser() {
} else if (player_said("GEAR", "WATER") || player_said("TAKE", "WATER")) {
_G(wilbur_should) = 15;
- player_hotspot_walk_override(272, 271, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(272, 271, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("KIBBLE", "FLOOR")) {
if (_G(flags)[V269]) {
@@ -605,11 +605,11 @@ void Room603::pre_parser() {
_sectionSeries1 = series_load("602wi20");
Section6::_series603 = series_load("602wi20s");
_G(wilbur_should) = 14;
- player_hotspot_walk_override(502, 301, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(502, 301, 9, kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("RAY GUN", "GERBILS")) {
_G(wilbur_should) = 10;
- player_hotspot_walk_override(226, 301, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(226, 301, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("WATER DISH") || player_said("WATER")) {
if (_G(flags)[V243] == 6006) {
@@ -617,16 +617,16 @@ void Room603::pre_parser() {
intr_cancel_sentence();
} else if (player_said("KIBBLE")) {
_G(wilbur_should) = 11;
- player_hotspot_walk_override(261, 274, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(261, 274, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "WATER DISH")) {
if (_G(flags)[V277] == 6001 && _G(flags)[V270] == 6000)
_series4 = series_load("603motor");
_G(wilbur_should) = 8;
- player_hotspot_walk_override(180, 329, 2, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(180, 329, 2, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "WATER") && _G(flags)[V270] == 6000) {
_G(wilbur_should) = 9;
- player_hotspot_walk_override(350, 282, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(350, 282, 10, kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
@@ -649,22 +649,22 @@ void Room603::parser() {
} else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
_G(flags)[V246] = 1;
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
_G(flags)[V246] = 1;
_G(wilbur_should) = 7;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
_G(flags)[V246] = 1;
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
_G(flags)[V246] = 1;
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "CARROT")) {
wilbur_speech("603w019");
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 1d5df7887f1..b2d39175cd6 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -224,7 +224,7 @@ void Room604::init() {
if (_G(flags)[V242]) {
_roomSeries1.show("604wi04", 1);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
kernel_trigger_dispatch_now(0);
}
@@ -235,10 +235,10 @@ void Room604::init() {
case 612:
if (Section6::_state2) {
_G(wilbur_should) = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -251,7 +251,7 @@ void Room604::init() {
player_set_commands_allowed(false);
_roomSeries1.show("604wi04", 1);
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
}
}
@@ -268,7 +268,7 @@ void Room604::daemon() {
_roomSeries1.show("604wi04", 1);
_val1 = 25;
kernel_trigger_dispatch_now(6012);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 2:
@@ -278,7 +278,7 @@ void Room604::daemon() {
case 3:
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(4);
break;
@@ -396,17 +396,17 @@ void Room604::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_G(wilbur_should) = 2;
- digi_play("604_006", 2, 155, gCHANGE_WILBUR_ANIMATION);
+ digi_play("604_006", 2, 155, kCHANGE_WILBUR_ANIMATION);
break;
case 2:
_roomSeries1.terminate();
inv_give_to_player("RAY GUN");
- series_play_with_breaks(PLAY1, "604wi04", 1, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "604wi04", 1, kCHANGE_WILBUR_ANIMATION, 3);
_G(wilbur_should) = 3;
break;
@@ -465,10 +465,10 @@ void Room604::daemon() {
Section6::_state3 = 6004;
series_stream("604mg06", 4, 0xc80, 6011);
series_play("604mg06s", 4, 0xc80, 0, -1);
- series_play_with_breaks(PLAY4, "604wi08", 0x4ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "604wi08", 0x4ff, kCHANGE_WILBUR_ANIMATION, 3);
} else {
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY4, "604wi08", 0x4ff, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY4, "604wi08", 0x4ff, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -476,7 +476,7 @@ void Room604::daemon() {
_G(wilbur_should) = 10001;
ws_demand_location(337, 279, 7);
ws_hide_walker();
- series_play_with_breaks(PLAY5, "604wi09", 0xc80, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY5, "604wi09", 0xc80, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
@@ -484,20 +484,20 @@ void Room604::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY12, "604wi40", 0x800, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY12, "604wi40", 0x800, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 9:
ws_hide_walker();
_G(wilbur_should) = 20;
- series_play_with_breaks(PLAY6, "604wi10", 0xcc0, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "604wi10", 0xcc0, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
ws_hide_walker();
_G(wilbur_should) = 10001;
player_set_commands_allowed(false);
- series_play_with_breaks(PLAY10, "604wi11", 0xa00, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY10, "604wi11", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
if (_G(flags)[V274] == 0 && _G(flags)[V243] == 600) {
_G(flags)[V243] = 6006;
@@ -516,7 +516,7 @@ void Room604::daemon() {
_series2 = series_load("604chips");
_G(wilbur_should) = 12;
- series_play_with_breaks(PLAY11, "604wi12", 0x600, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY11, "604wi12", 0x600, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 12:
@@ -534,7 +534,7 @@ void Room604::daemon() {
case 13:
ws_hide_walker();
_G(wilbur_should) = 10001;
- series_play_with_breaks(PLAY7, "604wi10", 0xcc0, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY7, "604wi10", 0xcc0, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 14:
@@ -543,7 +543,7 @@ void Room604::daemon() {
player_update_info();
_G(wilbur_should) = 15;
- ws_walk(_G(player_info).x + 1, 316, 0, gCHANGE_WILBUR_ANIMATION, 3);
+ ws_walk(_G(player_info).x + 1, 316, 0, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 15:
@@ -553,7 +553,7 @@ void Room604::daemon() {
Section6::_savedX = _G(player_info).x - 358;
Section6::_state1 = imath_ranged_rand(0, 5);
- series_play_with_breaks(PLAY8, "604wi31", _G(player_info).depth, gCHANGE_WILBUR_ANIMATION,
+ series_play_with_breaks(PLAY8, "604wi31", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, Section6::_savedX, 0);
break;
@@ -580,7 +580,7 @@ void Room604::daemon() {
} else {
_G(wilbur_should) = 11;
player_set_commands_allowed(false);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -607,13 +607,13 @@ void Room604::daemon() {
digi_preload("604w014");
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
- wilbur_speech("604w014", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("604w014", kCHANGE_WILBUR_ANIMATION);
} else {
digi_preload("604w012");
player_set_commands_allowed(false);
_G(wilbur_should) = 10001;
_G(flags)[V248] = 1;
- wilbur_speech("604w012", gCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("604w012", kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -648,7 +648,7 @@ void Room604::daemon() {
_G(flags)[V264] = 1;
intr_cancel_sentence();
_G(wilbur_should) = 14;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else {
_G(flags)[V264] = 0;
@@ -673,15 +673,15 @@ void Room604::pre_parser() {
if (_G(flags)[V274] == 0) {
_G(wilbur_should) = 17;
- player_hotspot_walk_override(353, 313, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(353, 313, 10, kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("WOOD SHAVINGS", "KIBBLE")) {
_G(wilbur_should) = 10;
- player_hotspot_walk_override(308, 301, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(308, 301, 10, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "GERBILS")) {
_G(wilbur_should) = 8;
- player_hotspot_walk_override(286, 297, 10, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(286, 297, 10, kCHANGE_WILBUR_ANIMATION);
} else if (player_said("KIBBLE", "FLOOR")) {
if (_G(flags)[V273]) {
@@ -690,7 +690,7 @@ void Room604::pre_parser() {
wilbur_speech("600w008z");
} else {
_G(wilbur_should) = 16;
- player_hotspot_walk_override(425, 303, 9, gCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(425, 303, 9, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
}
@@ -721,13 +721,13 @@ void Room604::parser() {
_G(flags)[V246] = 1;
Section6::_state2 = 2;
_G(wilbur_should) = 5;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "TUBE") || player_said("CLIMB IN", "TUBE")) {
_G(flags)[V246] = 1;
Section6::_state2 = 0;
_G(wilbur_should) = 4;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (rayGun && player_said("APPLE CORE")) {
wilbur_speech("604w029");
diff --git a/engines/m4/burger/rooms/section6/room608.cpp b/engines/m4/burger/rooms/section6/room608.cpp
index 10571c72276..b0ba6fb1752 100644
--- a/engines/m4/burger/rooms/section6/room608.cpp
+++ b/engines/m4/burger/rooms/section6/room608.cpp
@@ -60,7 +60,7 @@ void Room608::init() {
_G(wilbur_should) = (_G(game).previous_room == 605 ||
_G(game).previous_room == 606) ? 10016 : 10015;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
void Room608::daemon() {
@@ -70,7 +70,7 @@ void Room608::daemon() {
release_trigger_on_digi_state(10027, 1);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 10015:
term_message("failed normally");
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 528c24586f8..b565a92c5f2 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -124,7 +124,7 @@ void Section6::daemon() {
kernel_trigger_dispatch_now(6013);
_G(wilbur_should) = 10001;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 6002:
@@ -262,7 +262,7 @@ void Section6::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 6000:
player_set_commands_allowed(false);
@@ -283,7 +283,7 @@ void Section6::daemon() {
}
_G(wilbur_should) = 6001;
- ws_walk(352, 276, 0, gCHANGE_WILBUR_ANIMATION, 9);
+ ws_walk(352, 276, 0, kCHANGE_WILBUR_ANIMATION, 9);
break;
case 6001:
@@ -293,7 +293,7 @@ void Section6::daemon() {
_state1 = 6001;
_G(wilbur_should) = 6002;
_G(flags)[V244] = 10028;
- series_play_with_breaks(PLAY1, "602melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "602melt", 0x999, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 603:
@@ -301,7 +301,7 @@ void Section6::daemon() {
_state1 = 6001;
_G(wilbur_should) = 6002;
_G(flags)[V244] = 10029;
- series_play_with_breaks(PLAY1, "603melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "603melt", 0x999, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 604:
@@ -313,7 +313,7 @@ void Section6::daemon() {
ws_hide_walker();
_state1 = 6001;
_G(wilbur_should) = 6002;
- series_play_with_breaks(PLAY1, "604melt", 0x999, gCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY1, "604melt", 0x999, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
@@ -362,17 +362,17 @@ void Section6::parser() {
if (player_said("RAY GUN", "BLOCK OF ICE")) {
_G(flags)[V247] = 1;
_G(wilbur_should) = 6000;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "GERBILS") && _G(flags)[V243] == 6006) {
_G(flags)[V247] = 1;
term_message("Taking gun out to shoot gerbils...");
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("RAY GUN", "KIBBLE ")) {
if (inv_player_has("KIBBLE")) {
- _G(wilbur_should) = gSERIES_PLAY_BREAK_2;
- ws_turn_to_face(9, gCHANGE_WILBUR_ANIMATION);
+ _G(wilbur_should) = kSERIES_PLAY_BREAK_2;
+ ws_turn_to_face(9, kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("602w011");
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index f6ee1e12b7e..9164aed22f3 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -71,7 +71,7 @@ void Room702::daemon() {
_G(roomVal4) = 8;
_G(wilbur_should) = 10;
digi_play_loop("700_001", 3, 50, -1, 700);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(5);
kernel_trigger_dispatch_now(6);
_G(flags)[V298] = 1;
@@ -213,7 +213,7 @@ void Room702::daemon() {
}
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 10:
ws_walk(236, 338, 0, 11, 4);
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 456b7e30e9b..49cb48d1ad5 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -513,13 +513,13 @@ void Room706::daemon() {
_G(game).setRoom(_G(executing) == WHOLE_GAME ? 903 : 901);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_G(wilbur_should) = 21;
_flag6 = true;
_series6 = series_play("706WIT01", 0x200);
- digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 21:
@@ -559,7 +559,7 @@ void Room706::conv83() {
} else if (who == 1) {
_G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
}
}
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 3a27f865225..29fb5ec706f 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -267,7 +267,7 @@ void Room801::daemon() {
_G(wilbur_should) = getWilburShould();
_G(roomVal4) = 2;
_val3 = 2;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(16);
kernel_trigger_dispatch_now(15);
@@ -291,7 +291,7 @@ void Room801::daemon() {
_val3 = 2;
_series9 = series_play("804FL01", 2, 0, -1, 6, -1);
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(16);
kernel_trigger_dispatch_now(15);
conv_load_and_prepare("conv80", 18);
@@ -435,7 +435,7 @@ void Room801::daemon() {
_G(game).new_room = 802;
} else {
- kernel_trigger_dispatch_now(g10027);
+ kernel_trigger_dispatch_now(k10027);
}
break;
@@ -509,7 +509,7 @@ void Room801::daemon() {
case 36:
_G(flags)[V287] = 1;
adv_kill_digi_between_rooms(1);
- kernel_trigger_dispatch_now(g10027);
+ kernel_trigger_dispatch_now(k10027);
break;
case 37:
@@ -539,18 +539,18 @@ void Room801::daemon() {
digi_play("806w001", 1, 128);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_val1) {
case 9:
switch (_G(wilbur_should)) {
case 7:
- _series12 = series_play("804WI04", 0x200, 2, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI04", 0x200, 2, kCHANGE_WILBUR_ANIMATION);
_val1 = 11;
break;
default:
_G(wilbur_should) = getWilburShould();
- _series12 = series_show("804Wi04", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 30, 1);
+ _series12 = series_show("804Wi04", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 30, 1);
break;
}
break;
@@ -559,26 +559,26 @@ void Room801::daemon() {
switch (_G(wilbur_should)) {
case 4:
case 7:
- _series12 = series_play("804WI05", 0x200, 2, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI05", 0x200, 2, kCHANGE_WILBUR_ANIMATION);
_val1 = 11;
break;
case 5:
_G(wilbur_should) = 12;
_series12 = series_play("804WI01", 0x200, 4);
- digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 12:
terminateMachineAndNull(_series12);
_G(wilbur_should) = getWilburShould();
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
conv_resume_curr();
break;
default:
_G(wilbur_should) = getWilburShould();
- _series12 = series_show("804WI05", 0x200, 0, gCHANGE_WILBUR_ANIMATION, 30, 3);
+ _series12 = series_show("804WI05", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 30, 3);
break;
}
break;
@@ -586,24 +586,24 @@ void Room801::daemon() {
case 11:
switch (_G(wilbur_should)) {
case 4:
- _series12 = series_play("804WI04", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI04", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
_val1 = 9;
break;
case 5:
case 6:
- _series12 = series_play("804WI05", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI05", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
_val1 = 10;
break;
case 7:
_G(wilbur_should) = getWilburShould();
- _series12 = series_play("804WI03", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI03", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
break;
default:
_G(wilbur_should) = getWilburShould();
- _series12 = series_play("804WI02", 0x200, 0, gCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI02", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
break;
}
break;
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index a2b223b1f38..61c49e1fecf 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -231,7 +231,7 @@ void Room802::daemon() {
_G(wilbur_should) = getWilburShould();
_val2 = 6;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(17);
_series1 = series_play("802BFX03", 0x101);
@@ -284,7 +284,7 @@ void Room802::daemon() {
break;
case 16:
- release_trigger_on_digi_state(g10027, 1);
+ release_trigger_on_digi_state(k10027, 1);
break;
case 17:
@@ -416,7 +416,7 @@ void Room802::daemon() {
digi_play_loop("800_001", 3, 48, -1, 800);
break;
- case gCHANGE_WILBUR_ANIMATION:
+ case kCHANGE_WILBUR_ANIMATION:
switch (_val1) {
case 11:
switch (_G(wilbur_should)) {
@@ -425,14 +425,14 @@ void Room802::daemon() {
_G(wilbur_should) = 20;
_G(roomVal4) = 6;
_series5 = series_play("802BW03", 0x100, 4);
- digi_play(conv_sound_to_play(), 1, 255, gCHANGE_WILBUR_ANIMATION, 802);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION, 802);
break;
case 15:
case 18:
_flag2 = true;
_val1 = 13;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 19:
@@ -447,14 +447,14 @@ void Room802::daemon() {
terminateMachineAndNull(_series5);
_flag2 = true;
_G(wilbur_should) = 16;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
conv_resume_curr();
break;
default:
_flag2 = true;
_val1 = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
}
break;
@@ -465,20 +465,20 @@ void Room802::daemon() {
_flag2 = true;
_G(roomVal4) = 6;
_val1 = 11;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 15:
case 18:
_flag2 = true;
_val1 = 13;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 16:
_flag2 = true;
_G(wilbur_should) = getWilburShould();
- _series5 = series_show("802BW01", 0x100, 0, gCHANGE_WILBUR_ANIMATION, 30, 1);
+ _series5 = series_show("802BW01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 30, 1);
break;
case 19:
@@ -493,7 +493,7 @@ void Room802::daemon() {
_flag2 = false;
_val5 = imath_ranged_rand(15, 30);
_G(wilbur_should) = getWilburShould();
- series_play_with_breaks(PLAY4, "802BW01", 0x100, gCHANGE_WILBUR_ANIMATION, 0, 12);
+ series_play_with_breaks(PLAY4, "802BW01", 0x100, kCHANGE_WILBUR_ANIMATION, 0, 12);
break;
}
break;
@@ -505,7 +505,7 @@ void Room802::daemon() {
case 17:
_flag2 = true;
_val1 = 12;
- kernel_trigger_dispatch_now(gCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 18:
@@ -513,7 +513,7 @@ void Room802::daemon() {
_G(wilbur_should) = 16;
_val1 = 12;
_val5 = imath_ranged_rand(120, 180);
- series_play_with_breaks(PLAY5, "802BW02", 0x100, gCHANGE_WILBUR_ANIMATION);
+ series_play_with_breaks(PLAY5, "802BW02", 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 19:
@@ -528,7 +528,7 @@ void Room802::daemon() {
_flag2 = false;
_G(wilbur_should) = 16;
_val1 = 12;
- series_play_with_breaks(PLAY6, "802BW04", 0x100, gCHANGE_WILBUR_ANIMATION);
+ series_play_with_breaks(PLAY6, "802BW04", 0x100, kCHANGE_WILBUR_ANIMATION);
break;
}
break;
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 33262e64561..d01655f6531 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,6 +110,8 @@ void Vars::main_cold_data_init() {
break;
}
+ _game.setRoom(801); //*****DEBUG****
+
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 8937f91310c..83b66c62709 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -43,38 +43,34 @@ enum GameMode {
};
enum global_triggers {
- gFIRST_GLOBAL_TRIGGER = 10000,
+ kFIRST_GLOBAL_TRIGGER = 10000,
// System triggers
- gRESUME_CONVERSATION = 10001, // Yep, that's what it does!
- gSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
- gSERIES_PLAY_BREAK_0 = 10003,
- gSERIES_PLAY_BREAK_1 = 10004,
- gSERIES_PLAY_BREAK_2 = 10005,
- gRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
-
- gNPC_SPEECH_STARTED = 10010, // NPC talk started
- gNPC_SPEECH_FINISHED = 10011, // NPC talk finished
- g10013 = 10013,
- gWILBURS_SPEECH_FINISHED = 10014,
- gWILBURS_SPEECH_START = 10015,
- gCHANGE_WILBUR_ANIMATION = 10016,
- gSET_FACING = 10018,
+ kRESUME_CONVERSATION = 10001, // Yep, that's what it does!
+ kSERIES_STREAM_BREAK = 10002, // Used only by set_next_stream_break () in global.cpp
+ kSERIES_PLAY_BREAK_0 = 10003,
+ kSERIES_PLAY_BREAK_1 = 10004,
+ kSERIES_PLAY_BREAK_2 = 10005,
+ kRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
+
+ kNPC_SPEECH_STARTED = 10010, // NPC talk started
+ kNPC_SPEECH_FINISHED = 10011, // NPC talk finished
+ kWILBUR_SPEECH_STARTED = 10013,
+ kWILBURS_SPEECH_FINISHED = 10014,
+ kWILBURS_SPEECH_START = 10015,
+ kCHANGE_WILBUR_ANIMATION = 10016,
+ kSET_FACING = 10018,
kSET_DEST = 10019,
- gSET_COMMANDS_ALLOWED = 10020,
- gUNPOOF = 10021,
- gTELEPROTED1 = 10024,
- gTELEPROTED2 = 10025,
- g10027 = 10027,
- g10028 = 10028,
+ kSET_COMMANDS_ALLOWED = 10020,
+ kUNPOOF = 10021,
+ kTELEPROTED1 = 10024,
+ kTELEPROTED2 = 10025,
+ k10027 = 10027,
+ k10028 = 10028,
kCALLED_EACH_LOOP = 32764,
- gLAST_GLOBAL_TRIGGER
-#if UNUSED
- gREACT_TO_WHISTLE, // For anything that reacts to the wistle being blown
- gCHANGE_WILBUR_ANIMATION,
-#endif
+ kLAST_GLOBAL_TRIGGER
};
class Vars : public M4::Vars {
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 1ade441f4e6..94d583297e5 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -219,7 +219,7 @@ void Walker::wilbur_speech(const char *name, int trigger, int room, byte flags,
_flag = (flags & 1) != 0;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(gWILBURS_SPEECH_START);
+ kernel_trigger_dispatch_now(kWILBURS_SPEECH_START);
_G(kernel).trigger_mode = oldMode;
}
@@ -233,8 +233,8 @@ void Walker::wilbur_say() {
digi_stop(_channel);
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(10013);
- digi_play(_name, _channel, _vol, gWILBURS_SPEECH_FINISHED, _room);
+ kernel_trigger_dispatch_now(kWILBUR_SPEECH_STARTED);
+ digi_play(_name, _channel, _vol, kWILBURS_SPEECH_FINISHED, _room);
_G(kernel).trigger_mode = oldMode;
}
@@ -407,7 +407,7 @@ bool Walker::wilbur_match(const WilburMatch *list) {
void Walker::wilbur_poof() {
player_update_info();
_wilburPoof = series_load("999poof");
- series_play("999poof", _G(player_info).depth, 0, gUNPOOF, 6, 0,
+ series_play("999poof", _G(player_info).depth, 0, kUNPOOF, 6, 0,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
digi_play("999_003", 1, 255);
}
@@ -422,7 +422,7 @@ void player_walk_to(int32 x, int32 y, int32 facing_x, int32 facing_y, int trigge
_G(player_facing_x) = facing_x;
_G(player_facing_y) = facing_y;
_G(player_trigger) = trigger;
- player_hotspot_walk_override(x, y, -1, gSET_FACING);
+ player_hotspot_walk_override(x, y, -1, kSET_FACING);
}
void player_walk_to(int32 x, int32 y, int trigger) {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index d87e6cdc5bf..e5de9f85c35 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -513,11 +513,7 @@ void Dialog_Resize(Dialog *d, int32 newW, int32 newH) {
}
delete d->dlgBuffer;
-#if defined(__WIN)
- d->dlgBuffer = new CDIBSectionBuffer(((CM4App *)GetWigalApp())->GetMainWindow(), newW, newH);
-#else
d->dlgBuffer = new GrBuff(newW, newH);
-#endif
d->w = newW;
d->h = newH;
@@ -1143,11 +1139,7 @@ static void TextScrn_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
matte *myRectList = (matte *)r;
Buffer *destBuffer = (Buffer *)b;
Buffer *myBuff;
-#if defined(__WIN)
- CDIBSectionBuffer *myGrBuff;
-#else
GrBuff *myGrBuff;
-#endif
ScreenContext *tempScreen;
matte *myMatte, tempMatte;
RectList *updateList, *updateRect;
@@ -1300,11 +1292,8 @@ TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminanc
myTextScrn->myTextItems = nullptr;
myTextScrn->hiliteItem = nullptr;
-#if defined(__WIN)
- myTextScrn->textScrnBuffer = new CDIBSectionBuffer(((CM4App *)GetWigalApp())->GetMainWindow(), myTextScrn->w, myTextScrn->h);
-#else
myTextScrn->textScrnBuffer = new GrBuff(myTextScrn->w, myTextScrn->h);
-#endif
+
if (!myTextScrn->textScrnBuffer) {
return nullptr;
}
Commit: 86f547b3304d06037b092cdda02137cdebeb3ac2
https://github.com/scummvm/scummvm/commit/86f547b3304d06037b092cdda02137cdebeb3ac2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove duplicated global statics
This fixes the conversation options not being at the bottom.
Changed paths:
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv.h
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index dbb641ad2b0..b0405b2a6a4 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -126,7 +126,7 @@ static void conv_exec_entry(long offset, Conv *c) {
misc = get_misc(c, i);
entry = get_hash_entry(c, misc->index);
if (!(entry->status & DESTROYED)) {
- entry->status &= 0xfffffffb; //mask HIDDEN bit
+ entry->status &= 0xfffffffb; // Mask HIDDEN bit
entry->status |= 0x00000001;
}
break;
@@ -956,126 +956,35 @@ static int conv_run(Conv *c) {
return result;
}
+static void convtestCallback(void *a, void *) {
+ Conv *c;
+ //aug15
+ mouse_unlock_sprite();
+ mouse_lock_sprite(5);
-/*
- "xxxxxxxx" means the size you have calculated a conversation box to be,
- x x given the sentences that are in it, and whatever border
- x x space you may have in it. The boxes in Figure A may be
- xxxxxxxx where the user wants to place them. Obviously, the user
- won't try to put them out in hyperspace, but may do this
- if he wants the box to be flush with a corner (to grow
- up, down, left, or right.) Figure B is the re-calculated
- coordinates of the boxes in order to get them onto the
- background. The new boxes should not be in the interface
- or in the letterboxed areas at the top and bottom.
-
-
-
-
- xxxxxxxxx
- x (d) x
- x x Figure A xxxxxxxxxxxx
- 0,0 xxxxxxxxx x (b) x
- x x
- x x
- (letterbox at top) xxxxxxxxxxxx
-
-
-
-
- (background)
-
-
-
-
-
-
-
-
-
- xxxxxxxxxxxxx
- x (c) x
- x x
- x x
- x x
- x x
- xxxxxxxxxxxxxxxxxx x x
- x x xxxxxxxxxxxxx
- x x (interface)
- x x
- x x
- x x
- x x (letterbox at bottom)
- x x
- x x
- x (a) x 640,479
- xxxxxxxxxxxxxxxxxx
-
-
-
-
-
-
- Figure B
- 0,0
-
-
-
-
-
-
- xxxxxxxx xxxxxxxxxxx
- x (d) x x (b) x
- x x x x
- xxxxxxxx x x
- xxxxxxxxxxx
- xxxxxxxxxxxxxxxxxx
- x x
- x x
- x x xxxxxxxxxxxxx
- x x x (c) x
- x x x x
- x x x x
- x x x x
- x (a) x x x
- xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
-
-
-
-
-
-
-
-
-
-
-
- 640,479
-
-
-
-
- If someone says to draw conversation box (a) at the location in Figure 1,
- then have it automatically re-position itself into where it is in Figure 2.
- The extra space around the newly re-positioned box should be about 10 pixels
- wide and/or tall. Make the spacing visually look identical. In other
- words, if the height of the border is 10 pixels, the width on the side of
- the new conversation box may need to be 15. You may have to experiment
- with this. In even other words, you should correct for the aspect ration.
-
- The same thing should work for boxes (b), (c), and (d).
+ player_set_commands_allowed(false);
+ TextItem *i = (TextItem *)a;
+ c = conv_get_handle();
+ if (!c)
+ return;
-*/
+ c->c_entry_num = i->tag;
+ c->mode = CONV_GET_MESG_MODE;
+ TextScrn_Destroy(_GC(myTextScrn));
+ _GC(myTextScrn) = nullptr; //nov27
+ find_true_ent(c->c_entry_num, c);
-static void convtestCallback(void *a, void *b);
-//static TextScrn *_GC(myTextScrn); //nov27
+ _G(cdd).mesg_snd_file = _G(cdd).snd_files[c->c_entry_num - 1];
+ _G(cdd).player_non_player = 1;
-int32 glob_x = 0, glob_y = 0;
-static int32 r_x1, r_y1, r_x2, r_y2;
+ Common::strcpy_s(_G(player).verb, get_conv_name());
+ _G(player).command_ready = true;
+ conv_set_event(-1); // Must have or conv freezes.
+}
void set_dlg_rect() {
int32 sizex = 0, sizey = 0;
@@ -1094,63 +1003,63 @@ void set_dlg_rect() {
//term_message( "y2 %d", game_buff_ptr->y2 );
//term_message( "y1 %d", game_buff_ptr->y1 );
- _GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v); //must have....
+ _GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v); // Must have....
_GC(width) += 2 * _GC(conv_font_spacing_h);
//fprintf( conv_fp, "_GC(width) %d _GC(height) %d _G(cdd).nte %d\n", _GC(width), _GC(height), _G(cdd).num_txt_ents );
sizex = _GC(width);
sizey = _G(cdd).num_txt_ents * (_GC(height))+_GC(conv_font_spacing_v);
- switch (glob_x) {
+ switch (_GC(glob_x)) {
case DLG_CENTER_H:
- r_x1 = screen_x_center - (sizex / 2);
+ _GC(r_x1) = screen_x_center - (sizex / 2);
break;
case DLG_FLUSH_LEFT:
- r_x1 = 0;
+ _GC(r_x1) = 0;
break;
case DLG_FLUSH_RIGHT:
- r_x1 = screen_x_size - sizex;
+ _GC(r_x1) = screen_x_size - sizex;
break;
default:
- r_x1 = glob_x;
- r_x1 += game_buff_ptr->x1;
+ _GC(r_x1) = _GC(glob_x);
+ _GC(r_x1) += game_buff_ptr->x1;
break;
}
- switch (glob_y) {
+ switch (_GC(glob_y)) {
case DLG_CENTER_V:
- r_y1 = screen_y_center - (sizey / 2);
+ _GC(r_y1) = screen_y_center - (sizey / 2);
break;
case DLG_FLUSH_TOP:
- r_y1 = 0;
+ _GC(r_y1) = 0;
break;
case DLG_FLUSH_BOTTOM:
- r_y1 = screen_y_size - sizey + game_buff_ptr->y1 - 10;
+ _GC(r_y1) = screen_y_size - sizey + game_buff_ptr->y1 - 10;
break;
default:
- r_y1 = glob_y;
- r_y1 += game_buff_ptr->y1;
+ _GC(r_y1) = _GC(glob_y);
+ _GC(r_y1) += game_buff_ptr->y1;
break;
}
- if (r_x1 < 0)
- r_x1 = 0;
+ if (_GC(r_x1) < 0)
+ _GC(r_x1) = 0;
- if (r_y1 < 0)
- r_y1 = 0;
+ if (_GC(r_y1) < 0)
+ _GC(r_y1) = 0;
- //fprintf( conv_fp, "r_x1 %d sizex %d\n", r_x1, sizex );
- r_y2 = r_y1 + sizey - 1;
- r_x2 = r_x1 + sizex - 1;
+ //fprintf( conv_fp, "_GC(r_x1) %d sizex %d\n", _GC(r_x1), sizex );
+ _GC(r_y2) = _GC(r_y1) + sizey - 1;
+ _GC(r_x2) = _GC(r_x1) + sizex - 1;
- r_x2 = imath_min(VIDEO_W, r_x2);
- r_y2 = imath_min(VIDEO_H, r_y2);
+ _GC(r_x2) = imath_min(VIDEO_W, _GC(r_x2));
+ _GC(r_y2) = imath_min(VIDEO_H, _GC(r_y2));
}
static void textBoxInit() {
@@ -1164,7 +1073,7 @@ static void textBoxInit() {
conv_get_node_text(conv_get_handle());
set_dlg_rect();
- _GC(myTextScrn) = TextScrn_Create(r_x1, r_y1, r_x2, r_y2, _GC(conv_shading),
+ _GC(myTextScrn) = TextScrn_Create(_GC(r_x1), _GC(r_y1), _GC(r_x2), _GC(r_y2), _GC(conv_shading),
6 | SF_GET_MOUSE | SF_IMMOVABLE | SF_BLOCK_MOUSE,
_GC(conv_normal_colour), _GC(conv_hilite_colour), _GC(conv_normal_colour_alt1),
_GC(conv_hilite_colour_alt1), _GC(conv_normal_colour_alt2),
@@ -1180,47 +1089,17 @@ static void textBoxInit() {
}
void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2) {
- *x1 = r_x1;
- *y1 = r_y1;
- *x2 = r_x2;
- *y2 = r_y2;
+ *x1 = _GC(r_x1);
+ *y1 = _GC(r_y1);
+ *x2 = _GC(r_x2);
+ *y2 = _GC(r_y2);
}
void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2) {
- r_x1 = x1;
- r_y1 = y1;
- r_x2 = x2;
- r_y2 = y2;
-}
-
-static void convtestCallback(void *a, void *) {
- Conv *c;
-
- //aug15
- mouse_unlock_sprite();
- mouse_lock_sprite(5);
-
- player_set_commands_allowed(false);
- TextItem *i = (TextItem *)a;
-
- c = conv_get_handle();
- if (!c)
- return;
-
- c->c_entry_num = i->tag;
- c->mode = CONV_GET_MESG_MODE;
-
- TextScrn_Destroy(_GC(myTextScrn));
- _GC(myTextScrn) = nullptr; //nov27
-
- find_true_ent(c->c_entry_num, c);
-
- _G(cdd).mesg_snd_file = _G(cdd).snd_files[c->c_entry_num - 1];
- _G(cdd).player_non_player = 1;
-
- Common::strcpy_s(_G(player).verb, get_conv_name());
- _G(player).command_ready = true;
- conv_set_event(-1); //must have or conv freezes.
+ _GC(r_x1) = x1;
+ _GC(r_y1) = y1;
+ _GC(r_x2) = x2;
+ _GC(r_y2) = y2;
}
void conv_go(Conv *c) {
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index 962369216e2..9cce315361a 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -223,7 +223,116 @@ struct c_assign_chunk {
long opnd1; // Integer value.
};
+/**
+ "xxxxxxxx" means the size you have calculated a conversation box to be,
+ x x given the sentences that are in it, and whatever border
+ x x space you may have in it. The boxes in Figure A may be
+ xxxxxxxx where the user wants to place them. Obviously, the user
+ won't try to put them out in hyperspace, but may do this
+ if he wants the box to be flush with a corner (to grow
+ up, down, left, or right.) Figure B is the re-calculated
+ coordinates of the boxes in order to get them onto the
+ background. The new boxes should not be in the interface
+ or in the letterboxed areas at the top and bottom.
+
+
+
+
+ xxxxxxxxx
+ x (d) x
+ x x Figure A xxxxxxxxxxxx
+ 0,0 xxxxxxxxx x (b) x
+ x x
+ x x
+ (letterbox at top) xxxxxxxxxxxx
+
+
+
+
+ (background)
+
+
+
+
+
+
+
+
+
+ xxxxxxxxxxxxx
+ x (c) x
+ x x
+ x x
+ x x
+ x x
+ xxxxxxxxxxxxxxxxxx x x
+ x x xxxxxxxxxxxxx
+ x x (interface)
+ x x
+ x x
+ x x
+ x x (letterbox at bottom)
+ x x
+ x x
+ x (a) x 640,479
+ xxxxxxxxxxxxxxxxxx
+
+
+
+
+
+
+ Figure B
+ 0,0
+
+
+
+
+
+
+ xxxxxxxx xxxxxxxxxxx
+ x (d) x x (b) x
+ x x x x
+ xxxxxxxx x x
+ xxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ x x
+ x x
+ x x xxxxxxxxxxxxx
+ x x x (c) x
+ x x x x
+ x x x x
+ x x x x
+ x (a) x x x
+ xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
+
+
+
+
+
+
+
+
+
+
+
+ 640,479
+
+
+
+
+ If someone says to draw conversation box (a) at the location in Figure 1,
+ then have it automatically re-position itself into where it is in Figure 2.
+ The extra space around the newly re-positioned box should be about 10 pixels
+ wide and/or tall. Make the spacing visually look identical. In other
+ words, if the height of the border is 10 pixels, the width on the side of
+ the new conversation box may need to be 15. You may have to experiment
+ with this. In even other words, you should correct for the aspect ration.
+
+ The same thing should work for boxes (b), (c), and (d).
+*/
extern void set_dlg_rect();
+
extern void conv_go(Conv *c);
} // End of namespace M4
Commit: 8445ccf4f5d30a52123875410b0cf7119f0e2e47
https://github.com/scummvm/scummvm/commit/8445ccf4f5d30a52123875410b0cf7119f0e2e47
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: cleanups of conv.cpp
Changed paths:
engines/m4/adv_r/conv.cpp
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index b0405b2a6a4..4305803e89f 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -31,11 +31,10 @@
namespace M4 {
// ---------------
-
-//set entry stats,
-//get next node pointer
-//process declarations
-//get message text
+// Set entry stats,
+// Get next node pointer
+// Process declarations
+// Get message text
static void conv_exec_entry(long offset, Conv *c) {
long i = offset, entry_count;
long l_op, r_op;
@@ -167,7 +166,7 @@ static void conv_exec_entry(long offset, Conv *c) {
break;
case COND_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_GOTO_CHUNK\n" ); //aug2
+ //fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
c_goto = get_c_goto(c, i);
decl = get_decl(c, c_goto->opnd1);
@@ -178,13 +177,13 @@ static void conv_exec_entry(long offset, Conv *c) {
c->myCNode = c_goto->index;
//////term_message( "COND GOTO %x", c->myCNode );
- //fprintf( conv_fp, "COND GOTO %x\n", c->myCNode ); //aug2
+ //fprintf( conv_fp, "COND GOTO %x\n", c->myCNode );
return;
}
break;
case COND_EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" ); //aug2
+ //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
c_goto = get_c_goto(c, i);
decl = get_decl(c, c_goto->opnd1);
@@ -200,14 +199,13 @@ static void conv_exec_entry(long offset, Conv *c) {
c->myCNode = CONV_QUIT;
}
//////term_message( "COND EXIT GOTO %x", c->myCNode );
- //fprintf( conv_fp, "COND EXIT GOTO %x\n", c->myCNode ); //aug2
-
+ //fprintf( conv_fp, "COND EXIT GOTO %x\n", c->myCNode );
return;
}
break;
case EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" ); //aug2
+ //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
go = get_goto(c, i);
if (go->index != CONV_QUIT) {
@@ -218,7 +216,7 @@ static void conv_exec_entry(long offset, Conv *c) {
c->myCNode = CONV_QUIT;
}
//////term_message( "EXIT GOTO %x", c->myCNode );
- //fprintf( conv_fp, "EXIT GOTO %x\n", c->myCNode ); //aug2
+ //fprintf( conv_fp, "EXIT GOTO %x\n", c->myCNode );
return;
case GOTO_CHUNK:
@@ -226,7 +224,7 @@ static void conv_exec_entry(long offset, Conv *c) {
go = get_goto(c, i);
c->myCNode = go->index;
//////term_message( "GOTO %x", c->myCNode );
- //fprintf( conv_fp, "GOTO %x\n", c->myCNode ); //aug2
+ //fprintf( conv_fp, "GOTO %x\n", c->myCNode );
return;
//replies are non-player responses
@@ -293,7 +291,7 @@ static int conv_get_mesg(long offset, long is_valid, Conv *c) {
break;
case FALL_CHUNK:
- //fprintf( conv_fp, "FALL_CHUNK\n" ); //aug2
+ //fprintf( conv_fp, "FALL_CHUNK\n" );
break;
case C_ASGN_CHUNK:
@@ -504,7 +502,7 @@ static void find_true_ent(int entry_num, Conv *c) {
int result = 1;
for (;; ) {
- //start by getting the current NODE or LNODE
+ // Start by getting the current NODE or LNODE
conv_ops_get_entry(ent, &next, &tag, c);
switch (tag) {
case LNODE_CHUNK:
@@ -533,7 +531,7 @@ static void find_true_ent(int entry_num, Conv *c) {
case FALL_CHUNK:
//we either want to jump to a new node
//or skip to the first offset.
- //fprintf( conv_fp, "FALL_CHUNK 1.\n" ); //aug2
+ //fprintf( conv_fp, "FALL_CHUNK 1.\n" );
fall = get_fall(c, sub_ent);
@@ -575,7 +573,7 @@ static void find_true_ent(int entry_num, Conv *c) {
}
-//simplify me now that all changes have been made.
+// Simplify me now that all changes have been made.
static int conv_get_node_text(Conv *c) {
lnode_chunk *lnode = nullptr;
node_chunk *node = nullptr;
@@ -617,7 +615,7 @@ static int conv_get_node_text(Conv *c) {
case LNODE_CHUNK:
//was in bounds.
//lnode->entry_num starts at 0. in the chunk.
- if (lnode->entry_num >= lnode->num_entries) //aug4: was >
+ if (lnode->entry_num >= lnode->num_entries)
lnode->entry_num = 0;
for (i = 0; (i <= lnode->entry_num) && (i < num_ents); i++) {
@@ -629,7 +627,7 @@ static int conv_get_node_text(Conv *c) {
offset -= sizeof(long);
- //set sound file name instead.?
+ // Set sound file name instead.?
if ((entry->status != 0) && (num_ents != 0) && ok_status(entry)) {
//here here here.
if (conv_get_text(offset + ent, entry->size, c)) {
@@ -679,9 +677,9 @@ static int conv_get_node_text(Conv *c) {
_GC(n_t_e) = 0;
c->myCNode = fall->index;
- c->mode = CONV_GET_TEXT_MODE; //aug2: was CONV_UPDATE_MODE;
- //fprintf( conv_fp, "FALLTHROUGH!\n" ); //aug2
- result = 0; //was 1
+ c->mode = CONV_GET_TEXT_MODE;
+ //fprintf( conv_fp, "FALLTHROUGH!\n" );
+ result = 0;
}
}
break;
@@ -700,21 +698,21 @@ void conv_shutdown(void) {
_GC(myTextScrn) = nullptr;
}
-//simplify me.
+// Simplify me.
static void conv_start(Conv *c) {
long ok = 1, ent = 0, tag = 0, next;
decl_chunk *decl;
switch (c->exit_now) {
- case CONV_OK: //potential prob. when entering while loop.
+ case CONV_OK: // Potential prob. when entering while loop.
break;
- //goto_exit encountered.
+ // Goto_exit encountered.
//a conversation state.
case CONV_BAIL:
return;
- //goodbye forever.
+ // Goodbye forever.
case CONV_QUIT:
return;
@@ -764,7 +762,7 @@ static int conv_next_node(Conv *c) {
return 0;
case CONV_NEW:
- conv_start(c); //should go in conv_load.
+ conv_start(c); // Should go in conv_load.
return 1;
}
return 1;
@@ -784,7 +782,7 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
//repeat fallthrough till done
for (;; ) {
- //start by getting the current NODE or LNODE
+ // Start by getting the current NODE or LNODE
conv_ops_get_entry(ent, &next, &tag, c);
switch (tag) {
case LNODE_CHUNK:
@@ -895,7 +893,7 @@ static int conv_run(Conv *c) {
//////fprintf( conv_fp, "conv_run cdd_init\n" );
//////term_message( "conv_run CONV_GET_TEXT_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_GET_TEXT_MODE %x\n", c->myCNode ); //aug2
+ //////fprintf( conv_fp, "conv_run CONV_GET_TEXT_MODE %x\n", c->myCNode );
c->mode = CONV_GET_MESG_MODE;
if (conv_get_node_text(c)) {
@@ -920,10 +918,9 @@ static int conv_run(Conv *c) {
//////fprintf( conv_fp, "conv_run cdd_init\n" );
//////term_message( "conv_run CONV_GET_MESG_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_GET_MESG_MODE %x %d\n", c->myCNode, c->c_entry_num ); //aug2
+ //////fprintf( conv_fp, "conv_run CONV_GET_MESG_MODE %x %d\n", c->myCNode, c->c_entry_num );
if (conv_process_entry(c->c_entry_num, c, CONV_GET_MESG_MODE)) {
- //aug15
mouse_unlock_sprite();
mouse_lock_sprite(5);
@@ -938,7 +935,7 @@ static int conv_run(Conv *c) {
case CONV_UPDATE_MODE:
//////term_message( "conv_run CONV_UPDATE_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_UPDATE_MODE %x\n", c->myCNode ); //aug2
+ //////fprintf( conv_fp, "conv_run CONV_UPDATE_MODE %x\n", c->myCNode );
//////term_message( "conv_process_entry %d", c->c_entry_num );
conv_process_entry(c->c_entry_num, c, CONV_UPDATE_MODE);
@@ -959,7 +956,6 @@ static int conv_run(Conv *c) {
static void convtestCallback(void *a, void *) {
Conv *c;
- //aug15
mouse_unlock_sprite();
mouse_lock_sprite(5);
@@ -1063,7 +1059,7 @@ void set_dlg_rect() {
}
static void textBoxInit() {
- int32 i;
+ int32 i;
player_set_commands_allowed(true);
mouse_set_sprite(0);
Commit: 1f480cef0078144887950b1206f1ade78f311f20
https://github.com/scummvm/scummvm/commit/1f480cef0078144887950b1206f1ade78f311f20
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixed series_play loopCount default to be 0
Previously the default was incorrectly -1 (infinite).
So now I'll have to keep an eye out for calls where
I didn't pass -1, because I thought it was the default
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 29fb5ec706f..09e61fa8b3e 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -337,7 +337,7 @@ void Room801::daemon() {
case 13:
_G(roomVal4) = 12;
_G(wilbur_should) = 6;
- _series10 = series_play("804FLT01", 1, 4);
+ _series10 = series_play("804FLT01", 1, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, 15);
break;
@@ -370,13 +370,13 @@ void Room801::daemon() {
case 13:
_val3 = 12;
_G(wilbur_should) = 4;
- _series11 = series_play("804ZLT01", 1, 4);
+ _series11 = series_play("804ZLT01", 1, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, 16);
break;
default:
_val3 = 2;
- _series11 = series_play("804ZFX01", 1, 0, 16);
+ _series11 = series_play("804ZFX01", 1, 0, 16, 6, 0);
break;
}
break;
@@ -544,7 +544,7 @@ void Room801::daemon() {
case 9:
switch (_G(wilbur_should)) {
case 7:
- _series12 = series_play("804WI04", 0x200, 2, kCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI04", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 6, 0);
_val1 = 11;
break;
@@ -559,13 +559,13 @@ void Room801::daemon() {
switch (_G(wilbur_should)) {
case 4:
case 7:
- _series12 = series_play("804WI05", 0x200, 2, kCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI05", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 6, 0);
_val1 = 11;
break;
case 5:
_G(wilbur_should) = 12;
- _series12 = series_play("804WI01", 0x200, 4);
+ _series12 = series_play("804WI01", 0x200, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
@@ -586,19 +586,19 @@ void Room801::daemon() {
case 11:
switch (_G(wilbur_should)) {
case 4:
- _series12 = series_play("804WI04", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI04", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0);
_val1 = 9;
break;
case 5:
case 6:
- _series12 = series_play("804WI05", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI05", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0);
_val1 = 10;
break;
case 7:
_G(wilbur_should) = getWilburShould();
- _series12 = series_play("804WI03", 0x200, 0, kCHANGE_WILBUR_ANIMATION);
+ _series12 = series_play("804WI03", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0);
break;
default:
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 042ccb959d9..1a841456496 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -60,7 +60,7 @@ struct Series {
machine *_seriesS = nullptr;
void play(const char *seriesName, frac16 layer, uint32 flags = 0,
- int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
void show(const char *seriesName, frac16 layer, uint32 flags = 0,
int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
@@ -78,7 +78,7 @@ struct Series {
}
static void series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
- int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
static void series_show(const char *seriesName, frac16 layer, uint32 flags = 0,
int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
@@ -94,7 +94,7 @@ extern bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, i
//extern machine *series_show_sprite(const char *seriesName, int32 index, int32 layer); // was simple_show_sprite
extern machine *series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
- int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = -1, int32 s = 100,
+ int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
//extern machine *series_simple_play(char *seriesName, frac16 layer, bool stick_when_done);
Commit: a90364d8dfe4a4e2577b4f97624657ba7c3240a3
https://github.com/scummvm/scummvm/commit/a90364d8dfe4a4e2577b4f97624657ba7c3240a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Minor room 801 fixes
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 09e61fa8b3e..206cdd0745c 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -300,6 +300,7 @@ void Room801::daemon() {
break;
case 14:
+ // Conversation handler
if (conv_sound_to_play()) {
int who = conv_whos_talking();
int node = conv_current_node();
@@ -319,6 +320,7 @@ void Room801::daemon() {
break;
case 15:
+ // Flummox
switch (_G(roomVal4)) {
case 3:
terminateMachineAndNull(_series10);
@@ -349,6 +351,7 @@ void Room801::daemon() {
break;
case 16:
+ // Zlarg
switch (_val3) {
case 2:
if (imath_ranged_rand(0, 15) <= 12) {
@@ -543,6 +546,8 @@ void Room801::daemon() {
switch (_val1) {
case 9:
switch (_G(wilbur_should)) {
+ case 5:
+ case 6:
case 7:
_series12 = series_play("804WI04", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 6, 0);
_val1 = 11;
Commit: fa036363f249cd279f1cbb66a8cf81be6717aea4
https://github.com/scummvm/scummvm/commit/fa036363f249cd279f1cbb66a8cf81be6717aea4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix formatting of tabs in local variables
Changed paths:
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/kernel.h
engines/m4/burger/gui/game_menu.h
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_univ.h
engines/m4/wscript/ws_cruncher.cpp
engines/m4/wscript/ws_load.cpp
engines/m4/wscript/ws_machine.h
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index ebe73cc8e50..9f0f2b3265c 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -33,7 +33,7 @@ namespace M4 {
#define RIGHT_EDGE 0x08
bool InitRails() {
- int32 i, edgeTableSize;
+ int32 i, edgeTableSize;
// Register with the stash the frequently used structs
if (!mem_register_stash_type(&_G(rails).memtypePATHN, sizeof(pathNode), 32, "+PATHNODE")) {
@@ -92,7 +92,7 @@ void rail_system_shutdown(void) {
void ClearRails(void) {
- int32 i, edgeTableSize;
+ int32 i, edgeTableSize;
noWalkRect *myRect;
if (_G(rails).myNodes) {
@@ -624,7 +624,7 @@ void RestoreEdgeList(Buffer *walkCodes) {
}
int32 AddRailNode(int32 x, int32 y, Buffer *walkCodes, bool restoreEdges) {
- int32 i, j;
+ int32 i, j;
railNode *newNode;
if ((!_G(rails).myNodes) || (!_G(rails).myEdges)) {
@@ -696,8 +696,8 @@ bool RailNodeExists(int32 nodeID, int32 *nodeX, int32 *nodeY) {
}
int16 GetEdgeLength(int32 node1, int32 node2) {
- int32 temp;
- int32 index;
+ int32 temp;
+ int32 index;
if (!_G(rails).myEdges) return 0;
if (node1 == node2) return 0;
if (node2 < node1) {
@@ -762,9 +762,9 @@ static railNode *DuplicatePath(railNode *pathStart) {
railNode *CreateCustomPath(int32 coord, ...) {
- va_list argPtr;
+ va_list argPtr;
railNode *firstNode, *prevNode = nullptr, *newNode;
- int32 x, y;
+ int32 x, y;
// Initialize firstNode
firstNode = nullptr;
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index 4305803e89f..37230b6e0b5 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -580,8 +580,8 @@ static int conv_get_node_text(Conv *c) {
entry_chunk *entry = nullptr;
fall_chunk *fall = nullptr;
- long ent = 0, offset = 0, tag, next, num_ents = 0;
- int i = 0, num_vis = 0, result = 0;
+ long ent = 0, offset = 0, tag, next, num_ents = 0;
+ int i = 0, num_vis = 0, result = 0;
_G(cdd).num_txt_ents = 0;
_GC(width) = 0; _GC(height) = 0;
@@ -700,7 +700,7 @@ void conv_shutdown(void) {
// Simplify me.
static void conv_start(Conv *c) {
- long ok = 1, ent = 0, tag = 0, next;
+ long ok = 1, ent = 0, tag = 0, next;
decl_chunk *decl;
switch (c->exit_now) {
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 108d03bb120..b9b8a3068fe 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -98,7 +98,7 @@ Conv *conv_get_handle(void) {
void conv_set_handle(Conv *c) {
_GC(globConv) = c;
-}
+}
void conv_resume(Conv *c) {
conv_go(c);
@@ -197,10 +197,10 @@ void conv_set_decl_val(decl_chunk *decl, long val) {
}
void conv_export_value(Conv *c, long val, int index) {
- long ent = 0, tag = 0, next;
+ long ent = 0, tag = 0, next;
decl_chunk *decl;
- long ent_old = 0;
- int i = 0;
+ long ent_old = 0;
+ int i = 0;
if (!c)
return;
@@ -322,7 +322,7 @@ handled:
}
void find_and_set_conv_name(Conv *c) {
- long ent = 0, tag = 0, next = 0;
+ long ent = 0, tag = 0, next = 0;
conv_chunk *conv;
c->myCNode = 0;
@@ -885,7 +885,7 @@ void conv_unload() {
// only called if node is visible.
// gets the TEXT chunks inside a node.
int conv_get_text(long offset, long size, Conv *c) {
- long i = offset, tag, next, text_len, text_width;
+ long i = offset, tag, next, text_len, text_width;
text_chunk *text;
int result = 0;
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 1f995ad1fbc..83c3e1fdef0 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -32,7 +32,7 @@ namespace M4 {
#define KERNEL_SCRATCH_SIZE 256 // Size of game scratch area
struct Kernel {
- uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
+ uint32 scratch[KERNEL_SCRATCH_SIZE]; // Scratch variables for room
bool hag_mode = true;
uint32 clock = 0; // Current game timing clock
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 9a57e3df675..c9f7b7b834e 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -478,13 +478,13 @@ struct MenuGlobals {
//menu sprite series vars
char *menuSeriesResource = nullptr;
MemHandle menuSeriesHandle;
- int32 menuSeriesOffset;
- int32 menuSeriesPalOffset;
+ int32 menuSeriesOffset;
+ int32 menuSeriesPalOffset;
Font *menuFont = nullptr;
// menu sprites array (used to hold all the sprites for the current menu, spriteCount is set tot he number of sprites in the series)
- int32 spriteCount = 0;
+ int32 spriteCount = 0;
Sprite **menuSprites = nullptr;
// VARS SPECIFIC TO THE GAME MENUS SYSTEM
@@ -497,8 +497,8 @@ struct MenuGlobals {
Sprite **thumbNails = nullptr;
Sprite *saveLoadThumbNail = nullptr;
- int32 sizeofThumbData = -1;
- int32 thumbIndex = 0;
+ int32 sizeofThumbData = -1;
+ int32 thumbIndex = 0;
bool currMenuIsSave = true; // Used to determine load or save menu
bool saveLoadFromHotkey = false; // Come from hotkey, not through game menu
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 12cb50df926..7e12c96792a 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -228,7 +228,7 @@ void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay) {
void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
uint8 *tempPtr;
- int32 i;
+ int32 i;
if (!_G(kernel).fading_to_grey) {
return;
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index 619aa84f076..43d773b763f 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -65,7 +65,7 @@ static void Buffer_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
}
bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler) {
- int32 x2, y2;
+ int32 x2, y2;
x2 = x1 + myBuf->w - 1;
y2 = y1 + myBuf->h - 1;
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index d0b937a4330..0838092ddd6 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -317,8 +317,8 @@ void Item_empty_list(Item *myItem) {
static int32 item_string_width(char *myStr, int32 spacing) {
char *tempPtr, *tempPtr2, *tempPtr3, highlightChar[2];
- int32 highlightNum;
- int32 strWidth, column;
+ int32 highlightNum;
+ int32 strWidth, column;
highlightChar[0] = '~';
highlightChar[1] = '\0';
@@ -346,8 +346,8 @@ static int32 item_string_width(char *myStr, int32 spacing) {
static int32 item_string_write(Buffer *target, char *myStr, int32 x, int32 y, int32 w, int32 spacing, int32 color, int32 highlight) {
char *tempPtr, *strPtr, *nextStrPtr;
char *highlightPtr;
- char tempStr[2];
- int32 currX, column;
+ char tempStr[2];
+ int32 currX, column;
if (!target) return false;
if ((tempPtr = strchr(myStr, '^')) == nullptr) {
@@ -501,17 +501,21 @@ Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *pr
}
Item *ItemFind(Item *itemList, int32 tag) {
- if (!itemList) return nullptr;
+ if (!itemList)
+ return nullptr;
if (tag > 0) {
while (itemList && (itemList->tag != tag)) itemList = itemList->next;
- } else itemList = nullptr;
+ } else {
+ itemList = nullptr;
+ }
+
return itemList;
}
bool Item_SetViewBottom(Item *i) {
- int32 count;
+ int32 count;
ListItem *myListItem;
- bool found = false;
+ bool found = false;
if ((!i) || (!i->viewTop)) return false;
myListItem = i->viewTop;
@@ -545,7 +549,8 @@ static void CalculateViewIndex(Item *myItem) {
static void SetViewIndex(Item *myItem) {
ListItem *myListItem;
- int32 i;
+ int32 i;
+
if ((!myItem) || (!myItem->myList)) return;
if (myItem->thumbY == myItem->h - maxThumbY) {
myItem->viewIndex = myItem->myListCount - myItem->listView;
@@ -748,8 +753,8 @@ bool GetNextListItem(Item *myItem) {
}
bool GetNextPageList(Item *myItem) {
- int32 i;
- bool changed = false;
+ int32 i;
+ bool changed = false;
if (myItem->currItem && myItem->viewBottom) {
for (i = 0; i < (myItem->listView - 1); i++) {
@@ -805,9 +810,9 @@ bool GetPrevPageList(Item *myItem) {
}
void ViewCurrListItem(Item *myItem) {
- int32 i, j;
+ int32 i, j;
ListItem *tempItem;
- bool breakFlag = false;
+ bool breakFlag = false;
if (!myItem->currItem) {
myItem->viewTop = nullptr;
@@ -842,8 +847,10 @@ void ViewCurrListItem(Item *myItem) {
ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1) {
ListItem *myList;
- int32 i;
- if (!myItem) return nullptr;
+ int32 i;
+ if (!myItem)
+ return nullptr;
+
myList = myItem->myList;
if (searchMode == LIST_BY_TAG) {
while (myList && (myList->tag != parm1)) myList = myList->next;
@@ -923,14 +930,14 @@ bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset) {
}
bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType) {
- int32 fontHeight, itemOffset, boxWidth;
+ int32 fontHeight, itemOffset, boxWidth;
ListItem *myListItem;
- bool scrollable = false;
- bool changed = false;
- int32 newThumbY, i;
- static int32 thumbOffset;
- M4Rect interiorRect;
- ButtonDrawRec bdr;
+ bool scrollable = false;
+ bool changed = false;
+ int32 newThumbY, i;
+ static int32 thumbOffset;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
Font *currFont;
if (!myItem) return false;
diff --git a/engines/m4/gui/gui_univ.h b/engines/m4/gui/gui_univ.h
index 3ee7b0c37e5..a69f6b0e7ff 100644
--- a/engines/m4/gui/gui_univ.h
+++ b/engines/m4/gui/gui_univ.h
@@ -47,12 +47,12 @@ struct Hotkey {
struct ScreenContext {
ScreenContext *infront;
ScreenContext *behind;
- int32 x1, y1, x2, y2;
- int32 scrnType;
- uint32 scrnFlags;
+ int32 x1, y1, x2, y2;
+ int32 scrnType;
+ uint32 scrnFlags;
void *scrnContent;
- RefreshFunc redraw;
- EventHandler evtHandler;
+ RefreshFunc redraw;
+ EventHandler evtHandler;
Hotkey *scrnHotkeys;
};
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index d0ff828a013..6d842a3b7fa 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -253,7 +253,7 @@ Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash) {
bool ws_ChangeAnim8Program(machine *m, int32 newSequHash) {
Anim8 *myAnim8;
- int32 numLocalVars;
+ int32 numLocalVars;
// Make sure the cruncher has been initialized
VERIFY_INTIALIZED("ws_ChangeAnim8Program()");
@@ -838,7 +838,7 @@ static void op_POINT(Anim8 *myAnim8) {
}
static void op_DIST2D(Anim8 *myAnim8) {
- int32 temp1, temp2;
+ int32 temp1, temp2;
if (!_GWS(myArg3)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0252, "functionality: arg1 = distance from (x, y) to (arg2, arg3)");
}
@@ -875,7 +875,7 @@ static void op_CRUNCH(Anim8 *myAnim8) {
}
static void op_BRANCH(Anim8 *myAnim8) {
- int32 myOffset;
+ int32 myOffset;
if (!_GWS(myArg2)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0251, "check the CCR, arg1 is the branch type, arg2 is the PC offset");
@@ -976,7 +976,8 @@ static void op_SEQ_SEND_MSG(Anim8 *myAnim8) {
static void op_PUSH(Anim8 *myAnim8) {
uint32 *data;
- int32 direction, numOfArgs, i; //,startReg
+ int32 direction, numOfArgs, i; //,startReg
+
if (!_GWS(myArg1)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: push arg1 or start with arg1, and push a total of arg2 values");
}
@@ -1008,7 +1009,8 @@ static void op_PUSH(Anim8 *myAnim8) {
static void op_POP(Anim8 *myAnim8) {
uint32 *data;
- int32 direction, numOfArgs, i; // startReg,
+ int32 direction, numOfArgs, i; // startReg,
+
if (!_GWS(myArg1)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: pop into arg1 or start with arg1, and pop a total of arg2 values");
}
@@ -1035,7 +1037,7 @@ static void op_POP(Anim8 *myAnim8) {
}
static void op_JSR(Anim8 *myAnim8) {
- int32 dummy;
+ int32 dummy;
if (myAnim8->returnStackIndex >= JSR_STACK_MAX) {
ws_LogErrorMsg(FL, "Max number of nested jsr instructions is: %d", JSR_STACK_MAX);
@@ -1055,8 +1057,8 @@ static void op_JSR(Anim8 *myAnim8) {
}
static void op_RETURN(Anim8 *myAnim8) {
- int32 dummy, dummy2;
- uint32 returnSequHash, returnOffset;
+ int32 dummy, dummy2;
+ uint32 returnSequHash, returnOffset;
if (myAnim8->returnStackIndex <= 0) {
op_END(myAnim8);
@@ -1107,7 +1109,7 @@ static void op_SET_INDEX(Anim8 *myAnim8) {
static void op_SET_LAYER(Anim8 *myAnim8) {
Anim8 *tempAnim8;
- int32 myLayer, newLayer;
+ int32 myLayer, newLayer;
if (!_GWS(myArg1)) {
ws_Error(myAnim8->myMachine, ERR_SEQU, 0x0250, "functionality: set_layer(arg1)");
}
@@ -1543,7 +1545,7 @@ void ws_CrunchAnim8s(int16 *depth_table) {
}
void ws_CrunchEOSreqs(void) {
- int32 pcOffset, pcCount;
+ int32 pcOffset, pcCount;
machine *myXM;
EOSreq *tempEOSreq;
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 7f64e9aa5da..87cb76e852c 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1206,7 +1206,7 @@ int32 GetWSAssetCELCount(uint32 hash) {
int32 GetWSAssetCELFrameRate(uint32 hash) {
uint32 *celsPtr; // *mainAssetPtr,
-// int32 assetSize;
+// int32 assetSize;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1234,7 +1234,7 @@ int32 GetWSAssetCELFrameRate(uint32 hash) {
int32 GetWSAssetCELPixSpeed(uint32 hash) {
uint32 *celsPtr; // *mainAssetPtr,
-// int32 assetSize;
+// int32 assetSize;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1262,7 +1262,7 @@ int32 GetWSAssetCELPixSpeed(uint32 hash) {
int32 ws_get_sprite_width(uint32 hash, int32 index) {
uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
- int32 numCels; // AssetSize,
+ int32 numCels; // AssetSize,
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1307,7 +1307,7 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
int32 ws_get_sprite_height(uint32 hash, int32 index) {
uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
- int32 numCels; // assetSize,
+ int32 numCels; // assetSize,
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1460,7 +1460,7 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
int32 ws_GetDATACount(uint32 hash) {
uint32 *dataPtr; // *mainAssetPtr,
-// int32 assetSize;
+// int32 assetSize;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
diff --git a/engines/m4/wscript/ws_machine.h b/engines/m4/wscript/ws_machine.h
index cbfd62b0dd2..7b31ed7cefb 100644
--- a/engines/m4/wscript/ws_machine.h
+++ b/engines/m4/wscript/ws_machine.h
@@ -166,7 +166,7 @@ struct WSMachine_Globals {
bool _enginesPaused = false;
int32 *_dataFormats = nullptr;
- uint32 _machineIDCount = 0;
+ uint32 _machineIDCount = 0;
machine *_firstMachine = nullptr;
machine *_nextXM = nullptr;
Commit: bbbd36c2a33cbdff08e958d701c15e2582f8b8d6
https://github.com/scummvm/scummvm/commit/bbbd36c2a33cbdff08e958d701c15e2582f8b8d6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove old date based comments
Changed paths:
engines/m4/adv_r/chunk_ops.cpp
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv.h
engines/m4/core/cstring.cpp
engines/m4/mem/mem.cpp
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index 35afe4f71b2..9b78bb11e62 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -84,7 +84,7 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
//fprintf( conv_fp, "CONV_CHUNK\n" );
CC = (conv_chunk *)&outChunk[i];
- j = CC->size; //oct11 was +=
+ j = CC->size;
break;
case DECL_CHUNK:
@@ -101,14 +101,13 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
//fprintf( conv_fp, "LNODE_CHUNK\n" );
L = (lnode_chunk *)&outChunk[i];
- //oct11
k = sizeof(lnode_chunk);
if (_GC(swap)) {
- j = convert_intel32(L->num_entries) * sizeof(long); //was +=
- j = convert_intel32(j); //oct11
+ j = convert_intel32(L->num_entries) * sizeof(long);
+ j = convert_intel32(j);
} else {
- j = L->num_entries * sizeof(long); //was +=
+ j = L->num_entries * sizeof(long);
}
break;
@@ -116,11 +115,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
//fprintf( conv_fp, "NODE_CHUNK\n" );
N = (node_chunk *)&outChunk[i];
- //oct11
k = sizeof(node_chunk);
if (_GC(swap)) {
- j = convert_intel32(N->num_entries) * sizeof(long); //was +=
+ j = convert_intel32(N->num_entries) * sizeof(long);
j = convert_intel32(j);
} else {
j = N->num_entries * sizeof(long); //was +=
@@ -218,19 +216,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
break;
default:
-#ifdef TEST_CONV
- printf("tag %d node %d %x\n", *tag, c->myCNode, c->myCNode);
-#else
- //oct11
error_show(FL, 'PARS', "Tag: %d (%x) Node: %d (%x hex)", *tag, *tag, c->myCNode, c->myCNode);
-#endif
-
- conv_ops_unknown_chunk(*tag, "conv_ops_get_entry");
- //exit( 1 ); //fix me!!!! //oct10
break;
}
- //oct11
if (_GC(swap))
j = convert_intel32(j);
j += k;
@@ -343,8 +332,6 @@ static void swap_lnode(lnode_chunk *l) {
l->entry_num = convert_intel32(l->entry_num);
l->num_entries = convert_intel32(l->num_entries);
- //oct11
- //
L = (long *)l; //was &l
L += 5; // *sizeof( long );
for (i = 0; i < l->num_entries; i++) {
@@ -373,8 +360,6 @@ static void swap_node(node_chunk *n) {
n->size = convert_intel32(n->size);
n->num_entries = convert_intel32(n->num_entries);
- //oct11
- //
j = sizeof(long);
L = (long *)n; //was &n
L += 4; // *sizeof( long ); //was sizeof node_chunk
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index 37230b6e0b5..2bddca88722 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -356,8 +356,8 @@ static int conv_get_mesg(long offset, long is_valid, Conv *c) {
////fprintf( conv_fp, "reply->index %x text_len %d\n", reply->index, text_len );
Common::strcpy_s(_G(cdd).mesg, get_string(c, reply->index + sizeof(mesg_chunk) + text_len));
_G(cdd).mesg_snd_file = get_string(c, reply->index + sizeof(mesg_chunk));
- //////term_message( "Rreply %s", _G(cdd).mesg_snd_file ); //jun10
- ////fprintf( conv_fp, "Rreply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode ); //jun10/jun14
+ //////term_message( "Rreply %s", _G(cdd).mesg_snd_file );
+ ////fprintf( conv_fp, "Rreply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode );
} else {
Common::strcat_s(_G(cdd).mesg, " ");
text_len = conv_ops_text_strlen(get_string(c, reply->index + sizeof(mesg_chunk)));
@@ -465,7 +465,7 @@ static int conv_get_mesg(long offset, long is_valid, Conv *c) {
if (is_valid) {
result = 1;
- _G(cdd).player_non_player = 1; //jun27 was 0;
+ _G(cdd).player_non_player = 1;
if (!strcmp(_G(cdd).mesg, "")) {
text_len = conv_ops_text_strlen(get_string(c, s_offset + sizeof(mesg_chunk)));
@@ -486,10 +486,10 @@ static int conv_get_mesg(long offset, long is_valid, Conv *c) {
}
i = next;
}
+
return result;
}
-//oct10: here.
static void find_true_ent(int entry_num, Conv *c) {
node_chunk *node = nullptr;
lnode_chunk *lnode = nullptr;
@@ -501,7 +501,7 @@ static void find_true_ent(int entry_num, Conv *c) {
long sub_ent = 0;
int result = 1;
- for (;; ) {
+ for (;;) {
// Start by getting the current NODE or LNODE
conv_ops_get_entry(ent, &next, &tag, c);
switch (tag) {
@@ -692,7 +692,6 @@ void conv_shutdown(void) {
if (conv_get_handle())
conv_unload(conv_get_handle());
- //nov27
if (_GC(myTextScrn))
TextScrn_Destroy(_GC(myTextScrn));
_GC(myTextScrn) = nullptr;
@@ -908,7 +907,7 @@ static int conv_run(Conv *c) {
conv_set_event(-1);
//////term_message( "conv_run LNODE text entry" );
Common::strcpy_s(_G(player).verb, get_conv_name()); //was verb.
- c->c_entry_num = 1; //jun11 : as from conv.cp1
+ c->c_entry_num = 1;
}
} ////else fprintf( conv_fp, "didn't get any text\n" );
break;
@@ -970,7 +969,7 @@ static void convtestCallback(void *a, void *) {
c->mode = CONV_GET_MESG_MODE;
TextScrn_Destroy(_GC(myTextScrn));
- _GC(myTextScrn) = nullptr; //nov27
+ _GC(myTextScrn) = nullptr;
find_true_ent(c->c_entry_num, c);
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index 9cce315361a..b54295b6dad 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -70,7 +70,7 @@ namespace M4 {
//reply
#define REPLY_CHUNK ((long) ('R' << 24) | ('P' << 16) | ('L' << 8) | 'Y')
#define WEIGHT_REPLY_CHUNK ((long) ('W' << 24) | ('R' << 16) | ('P' << 8) | 'L')
-#define WEIGHT_PREPLY_CHUNK ((long) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L') //jun27
+#define WEIGHT_PREPLY_CHUNK ((long) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L')
#define COND_REPLY_CHUNK ((long) ('C' << 24) | ('R' << 16) | ('P' << 8) | 'L')
#define MESSAGE_CHUNK ((long) ('M' << 24) | ('E' << 16) | ('S' << 8) | 'G')
diff --git a/engines/m4/core/cstring.cpp b/engines/m4/core/cstring.cpp
index 46e3bd5c1a9..ab68d30d970 100644
--- a/engines/m4/core/cstring.cpp
+++ b/engines/m4/core/cstring.cpp
@@ -161,10 +161,10 @@ void strseg(char *work, char *work2, int indx, int count) {
if (!work || !work2)
return;
- char *s = NULL; //may26 MJE
+ char *s = NULL;
s = &work2[indx];
- strncpy(work, s, count); //may26 MJE
+ strncpy(work, s, count);
}
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 3619ce0be3b..4107f485092 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -108,7 +108,7 @@ void *mem_get_from_stash(int32 memType, const Common::String &name) {
char *mem_strdup(const char *str) {
char *new_str = nullptr;
- //jul4
+
if (!str) {
new_str = (char *)mem_alloc(1, "string");
new_str[0] = '\0';
Commit: 88fb6e7a230a3419f4530eca9c152c61915de7eb
https://github.com/scummvm/scummvm/commit/88fb6e7a230a3419f4530eca9c152c61915de7eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change NULL to nullptr
Changed paths:
engines/m4/adv_r/adv_player.h
engines/m4/adv_r/adv_rails.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/burger/walker.h
engines/m4/core/cstring.cpp
engines/m4/core/rooms.cpp
engines/m4/fileio/sys_file.cpp
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_mouse.cpp
engines/m4/gui/gui_vmng_core.cpp
engines/m4/gui/gui_vmng_core.h
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/mem/res.cpp
engines/m4/platform/tile/tile_read.h
engines/m4/vars.cpp
engines/m4/wscript/ws_timer.cpp
diff --git a/engines/m4/adv_r/adv_player.h b/engines/m4/adv_r/adv_player.h
index dc8472feb1d..021a2a8f649 100644
--- a/engines/m4/adv_r/adv_player.h
+++ b/engines/m4/adv_r/adv_player.h
@@ -97,7 +97,7 @@ struct PlayerInfo {
void syncGame(Common::Serializer &s);
};
-extern bool player_said(const char *w0, const char *w1 = NULL, const char *w2 = NULL);
+extern bool player_said(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr);
extern bool player_said_any(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr,
const char *w3 = nullptr, const char *w4 = nullptr, const char *w5 = nullptr, const char *w6 = nullptr,
const char *w7 = nullptr, const char *w8 = nullptr, const char *w9 = nullptr);
diff --git a/engines/m4/adv_r/adv_rails.cpp b/engines/m4/adv_r/adv_rails.cpp
index 9f0f2b3265c..8304a414cf9 100644
--- a/engines/m4/adv_r/adv_rails.cpp
+++ b/engines/m4/adv_r/adv_rails.cpp
@@ -41,23 +41,23 @@ bool InitRails() {
}
// Create the stack. Since any path through a series of nodes can have at most MAXRAILNODES...
- if ((_G(rails).stackBottom = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == NULL) {
+ if ((_G(rails).stackBottom = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == nullptr) {
return false;
}
// Allocate the array of railNode pointers and initialize...
- if ((_G(rails).myNodes = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == NULL) {
+ if ((_G(rails).myNodes = (railNode **)mem_alloc(sizeof(railNode *) * MAXRAILNODES, STR_RAILNODE)) == nullptr) {
return false;
}
for (i = 0; i < MAXRAILNODES; i++) {
- _G(rails).myNodes[i] = NULL;
+ _G(rails).myNodes[i] = nullptr;
}
// Calculate the size of the edge table, allocate, and initialize
// The edge table stores the upper triangle of a square matrix.
edgeTableSize = (MAXRAILNODES * (MAXRAILNODES - 1)) >> 1;
- if ((_G(rails).myEdges = (int16 *)mem_alloc(sizeof(int16) * edgeTableSize, "edge table")) == NULL) {
+ if ((_G(rails).myEdges = (int16 *)mem_alloc(sizeof(int16) * edgeTableSize, "edge table")) == nullptr) {
return false;
}
@@ -66,7 +66,7 @@ bool InitRails() {
}
// Set the parameters and return
- _G(rails).noWalkRectList = NULL;
+ _G(rails).noWalkRectList = nullptr;
return true;
}
@@ -75,18 +75,18 @@ bool InitRails() {
void rail_system_shutdown(void) {
if (_G(rails).stackBottom) {
mem_free(_G(rails).stackBottom);
- _G(rails).stackBottom = NULL;
+ _G(rails).stackBottom = nullptr;
}
ClearRails();
if (_G(rails).myNodes) {
mem_free(_G(rails).myNodes);
- _G(rails).myNodes = NULL;
+ _G(rails).myNodes = nullptr;
}
if (_G(rails).myEdges) {
mem_free(_G(rails).myEdges);
- _G(rails).myEdges = NULL;
+ _G(rails).myEdges = nullptr;
}
}
@@ -99,7 +99,7 @@ void ClearRails(void) {
for (i = 0; i < MAXRAILNODES; i++) {
if (_G(rails).myNodes[i]) {
mem_free((void *)_G(rails).myNodes[i]);
- _G(rails).myNodes[i] = NULL;
+ _G(rails).myNodes[i] = nullptr;
}
}
}
@@ -126,13 +126,13 @@ noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32
// Parameter verification
if ((x2 < x1) || (y2 < y1)) {
- return NULL;
+ return nullptr;
}
// Create new noWalkRect structure
- if ((newRect = (noWalkRect *)mem_alloc(sizeof(noWalkRect), "intr noWalkRect")) == NULL) {
+ if ((newRect = (noWalkRect *)mem_alloc(sizeof(noWalkRect), "intr noWalkRect")) == nullptr) {
error_show(FL, 'IADN', "rect size: %d %d %d %d", x1, y1, x2, y2);
- return NULL;
+ return nullptr;
}
// Initialize the new rect
@@ -153,7 +153,7 @@ noWalkRect *intr_add_no_walk_rect(int32 x1, int32 y1, int32 x2, int32 y2, int32
newRect->walkAroundNode4 = AddRailNode(x1 - 1, y2 + 1, walkCodes, false);
// Now link the rectangle into the list
- newRect->prev = NULL;
+ newRect->prev = nullptr;
newRect->next = _G(rails).noWalkRectList;
if (_G(rails).noWalkRectList) {
@@ -414,7 +414,7 @@ void CreateEdge(int32 node1, int32 node2, Buffer *walkCodes) {
index = (MAXRAILNODES - 1) * node1 + node2 - 1 - (node1 * (node1 + 1) >> 1);
_G(rails).myEdges[index] = 0;
valid = true;
- walkCodePtr = NULL;
+ walkCodePtr = nullptr;
finished = false;
if ((!_G(rails).myNodes[node1]) || (!_G(rails).myNodes[node2]))
@@ -634,7 +634,7 @@ int32 AddRailNode(int32 x, int32 y, Buffer *walkCodes, bool restoreEdges) {
}
if (i < MAXRAILNODES) {
- if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == NULL) {
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == nullptr) {
return -1;
}
newNode->nodeID = (Byte)i;
@@ -673,7 +673,7 @@ bool RemoveRailNode(int32 nodeID, Buffer *walkCodes, bool restoreEdges) {
return false;
}
mem_free((void *)_G(rails).myNodes[nodeID]);
- _G(rails).myNodes[nodeID] = NULL;
+ _G(rails).myNodes[nodeID] = nullptr;
if (restoreEdges) {
RestoreNodeEdges(nodeID, walkCodes);
@@ -728,22 +728,22 @@ static railNode *DuplicatePath(railNode *pathStart) {
railNode *newNode, *firstNode, *prevNode, *pathNode;
// Initialize pointers
- firstNode = prevNode = NULL;
+ firstNode = prevNode = nullptr;
- // This routine assumes a valid path from _G(rails).myNodes[origID] following _G(rails).myNodes[]->shortPath until NULL
+ // This routine assumes a valid path from _G(rails).myNodes[origID] following _G(rails).myNodes[]->shortPath until nullptr
pathNode = pathStart;
- // Loop until NULL - end of path
+ // Loop until nullptr - end of path
while (pathNode) {
// Create a new railNode, and duplicate values
- if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "+RAIL")) == NULL) {
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "+RAIL")) == nullptr) {
error_show(FL, 'OOM!', "Could not alloc railNode");
- return NULL;
+ return nullptr;
}
newNode->x = pathNode->x;
newNode->y = pathNode->y;
- newNode->shortPath = NULL;
+ newNode->shortPath = nullptr;
// Link into the new list
if (!firstNode) {
@@ -783,15 +783,15 @@ railNode *CreateCustomPath(int32 coord, ...) {
// Create a new node struct
- if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == NULL) {
+ if ((newNode = (railNode *)mem_alloc(sizeof(railNode), "railNode")) == nullptr) {
error_show(FL, 'OOM!', "could not alloc railNode");
- return NULL;
+ return nullptr;
}
// Set the new node values...
newNode->x = x;
newNode->y = y;
- newNode->shortPath = NULL;
+ newNode->shortPath = nullptr;
// Link into path list
if (!firstNode) {
@@ -822,7 +822,7 @@ bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath) {
uint32 currPathNodes;
int32 i, prevID, maxNodeID;
- *shortPath = NULL;
+ *shortPath = nullptr;
// Check that we have two valid and different nodes to walk between
if ((!_G(rails).myNodes) || (!_G(rails).myEdges)) {
@@ -839,7 +839,7 @@ bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath) {
}
// Set the end of the shortest path
- _G(rails).myNodes[destID]->shortPath = NULL;
+ _G(rails).myNodes[destID]->shortPath = nullptr;
// Check to see if we can walk directly from oridID to destID
edgeDist = GetEdgeLength(origID, destID);
@@ -858,7 +858,7 @@ bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath) {
tempNode = _G(rails).myNodes[i];
if (tempNode) {
maxNodeID = i;
- tempNode->shortPath = NULL;
+ tempNode->shortPath = nullptr;
tempNode->pathWeight = 32767;
}
}
@@ -868,7 +868,7 @@ bool GetShortestPath(int32 origID, int32 destID, railNode **shortPath) {
// Initialize the bitmask of the nodes and the current path list
currPathNodes = 0;
- thePath = NULL;
+ thePath = nullptr;
// Put the first node onto the stack (the address of, actually)
_G(rails).myNodes[origID]->pathWeight = 0;
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index 42dd7d022b0..dc70dc20580 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -72,8 +72,8 @@ extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
#define ws_walk_dump_walker_series(xx, yy) (ws_walk_dump_series (xx, yy))
#define ws_walk_dump_shadow_series(xx, yy) (ws_walk_dump_series (xx, yy))
-#define player_walk(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, NULL, tt, ff, true))
-#define player_walk_no_finish(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, NULL, tt, ff, FALSE))
+#define player_walk(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, nullptr, tt, ff, true))
+#define player_walk_no_finish(xx, yy, ff, tt) (ws_walk(_G(my_walker), xx, yy, nullptr, tt, ff, FALSE))
#define player_demand_facing(dd) (ws_demand_facing(_G(my_walker), dd))
#define player_demand_location(xx, yy) (ws_demand_location(_G(my_walker), xx, yy))
#define player_turn_to_face(dd, tt) (ws_turn_to_face(_G(my_walker), dd, tt))
@@ -87,8 +87,8 @@ extern void ws_walk_dump_series(int16 num_directions, int16 start_hash);
extern void ws_custom_walk(machine *myWalker, int32 finalFacing, int32 trigger, bool complete_walk = true);
#define adv_walker_custom_walk(ww, ff, tt) (ws_custom_walk(ww, ff, tt, true))
#define adv_walker_custom_walk_no_finish(ww, ff, tt) (ws_custom_walk(ww, ff, tt, FALSE))
-#define adv_walker_walk(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, NULL, tt, ff, true))
-#define adv_walker_walk_no_finish(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, NULL, tt, ff, FALSE))
+#define adv_walker_walk(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, nullptr, tt, ff, true))
+#define adv_walker_walk_no_finish(ww, xx, yy, ff, tt) (ws_walk(ww, xx, yy, nullptr, tt, ff, FALSE))
#define adv_walker_face(ww, dd) (ws_demand_facing(ww, dd))
#define adv_walker_turn_to_face(ww, dd, tt) (ws_turn_to_face(ww, dd, tt))
#define adv_walker_move(ww, xx, yy) (ws_demand_location(ww, xx, yy))
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 08822e529d1..4ac5d1b44a2 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -81,8 +81,8 @@ public:
/**
* Takes an array of string constants in the form of "object", "lookline", "takeline", "useline".
- * The array has to end with four NULLs: NULL, NULL, NULL, NULL
- * Use NULL in place of a lookline, takeline, or useline if you don't want to this function
+ * The array has to end with four NULLs: nullptr, nullptr, nullptr, nullptr
+ * Use nullptr in place of a lookline, takeline, or useline if you don't want to this function
* to handle it
*/
bool wilbur_said(const char *list[][4]);
diff --git a/engines/m4/core/cstring.cpp b/engines/m4/core/cstring.cpp
index ab68d30d970..c3747bbf880 100644
--- a/engines/m4/core/cstring.cpp
+++ b/engines/m4/core/cstring.cpp
@@ -161,7 +161,7 @@ void strseg(char *work, char *work2, int indx, int count) {
if (!work || !work2)
return;
- char *s = NULL;
+ char *s = nullptr;
s = &work2[indx];
strncpy(work, s, count);
@@ -231,7 +231,7 @@ char *str_strip_final_lf(char *mystring) {
char *temp;
temp = strrchr(mystring, 0x0a);
- if (temp != NULL) {
+ if (temp != nullptr) {
*temp = '\0';
}
return (temp);
@@ -274,7 +274,7 @@ int16 stringIsIn(char *str, char *strings[]) {
return -1;
int16 index = 0;
- while (*strings != NULL) {
+ while (*strings != nullptr) {
if (!strcmp(str, *strings))
return index;
++index;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index dd4bce4b103..26a3fd2cffa 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -239,7 +239,7 @@ void Sections::m4EndScene() {
void Sections::get_ipl() {
if (_G(inverse_pal))
delete _G(inverse_pal);
- _G(inverse_pal) = NULL;
+ _G(inverse_pal) = nullptr;
char *name;
Common::String filename;
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 01a606eef85..fdb69995aa2 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -117,7 +117,7 @@ void SysFile::open_read_low_level() {
if (!temp_fp.seek(hash_table_size * HASH_RECORD_LENGTH, SEEK_CUR))
error("fail to seek");
- _G(hag).hag_name_list = NULL;
+ _G(hag).hag_name_list = nullptr;
while (!temp_fp.eos()) {
if (temp_fp.read(hag_name, 33) != 33)
break;
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index f57fad26620..71b961b3b94 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -87,7 +87,7 @@ uint8 *GrBuff::get_pixmap() {
lock();
return (uint8 *)*pixmap;
}
- return NULL;
+ return nullptr;
}
Buffer *GrBuff::get_buffer() {
@@ -102,7 +102,7 @@ Buffer *GrBuff::get_buffer() {
return &dummy;
}
- return NULL;
+ return nullptr;
}
void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2) {
@@ -113,9 +113,9 @@ void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x
int32 gr_buffer_free(Buffer *buf) {
buf->w = buf->h = buf->stride = 0;
- if (buf->data != NULL) {
+ if (buf->data != nullptr) {
mem_free((char *)buf->data);
- buf->data = NULL;
+ buf->data = nullptr;
return true;
}
@@ -150,7 +150,7 @@ int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
buf->stride = w;
buf->data = (uint8 *)mem_alloc(buf->stride * h, name);
- if (buf->data == NULL)
+ if (buf->data == nullptr)
error_show(FL, 'OOM!', "buffer: %s - w:%d h:%d bytes:%d", name, buf->stride, h, buf->stride * h);
memset(buf->data, 0, buf->stride * h);
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 7e12c96792a..cbb5861d23e 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -298,7 +298,7 @@ void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int de
interface_hide();
_GP(exam_saved_hotspots) = _G(currentSceneDef).hotspots;
- _G(currentSceneDef).hotspots = NULL;
+ _G(currentSceneDef).hotspots = nullptr;
_GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
@@ -350,7 +350,7 @@ void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
terminateMachine(_GP(seriesAnim8));
series_unload(_GP(seriesHash));
- _GP(seriesAnim8) = NULL;
+ _GP(seriesAnim8) = nullptr;
_GP(seriesHash) = 0;
Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
diff --git a/engines/m4/gui/gui_mouse.cpp b/engines/m4/gui/gui_mouse.cpp
index 59a52373df7..c5837b152b8 100644
--- a/engines/m4/gui/gui_mouse.cpp
+++ b/engines/m4/gui/gui_mouse.cpp
@@ -32,8 +32,8 @@ namespace M4 {
static void transShow(void *s, void *r, void *b, int32 destX, int32 destY);
bool gui_mouse_init() {
- _G(mouseBuffer).data = NULL;
- if ((_G(mouseBuffer).data = (uint8 *)mem_alloc(32 * 32, "mouse graphic")) == NULL) {
+ _G(mouseBuffer).data = nullptr;
+ if ((_G(mouseBuffer).data = (uint8 *)mem_alloc(32 * 32, "mouse graphic")) == nullptr) {
return false;
}
_G(mouseBuffer).w = 32;
@@ -42,7 +42,7 @@ bool gui_mouse_init() {
auto &mouseSprite = _G(mouseSprite);
if (!mouseSprite) {
- if ((mouseSprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "mouse sprite")) == NULL) {
+ if ((mouseSprite = (M4sprite *)mem_alloc(sizeof(M4sprite), "mouse sprite")) == nullptr) {
return false;
}
@@ -54,7 +54,7 @@ bool gui_mouse_init() {
mouseSprite->yOffset = 0;
mouseSprite->encoding = 0;
mouseSprite->data = GetMousePicture();
- mouseSprite->sourceHandle = NULL;
+ mouseSprite->sourceHandle = nullptr;
mouseSprite->sourceOffset = 0;
_G(mouseX1offset) = mouseSprite->xOffset;
@@ -63,7 +63,7 @@ bool gui_mouse_init() {
_G(mouseY2offset) = mouseSprite->h - _G(mouseY1offset) - 1;
}
- if ((_G(mouseScreenSource) = (transSprite *)mem_alloc(sizeof(transSprite), "mouse transSprite")) == NULL) {
+ if ((_G(mouseScreenSource) = (transSprite *)mem_alloc(sizeof(transSprite), "mouse transSprite")) == nullptr) {
return false;
}
@@ -126,7 +126,7 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
// If no destBuffer, then draw directly to video
if (!destBuffer) {
- tempMatte.nextMatte = NULL;
+ tempMatte.nextMatte = nullptr;
// Loop through the dirty matte list
myMatte = myRectList;
@@ -134,8 +134,8 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
// Create an updateRectList to catch the black areas afterwards
updateList = vmng_CreateNewRect(myMatte->x1, myMatte->y1, myMatte->x2, myMatte->y2);
- updateList->prev = NULL;
- updateList->next = NULL;
+ updateList->prev = nullptr;
+ updateList->next = nullptr;
// Now loop through all the screens behind myScreen
tempScreen = myScreen->behind;
@@ -208,9 +208,9 @@ void transShow(void *s, void *r, void *b, int32 destX, int32 destY) {
spriteDrawReq.scaleX = 100;
spriteDrawReq.scaleY = 100;
spriteDrawReq.srcDepth = 0;
- spriteDrawReq.depthCode = NULL;
- spriteDrawReq.Pal = NULL;
- spriteDrawReq.ICT = NULL;
+ spriteDrawReq.depthCode = nullptr;
+ spriteDrawReq.Pal = nullptr;
+ spriteDrawReq.ICT = nullptr;
gr_sprite_draw(&spriteDrawReq);
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 3ce570e2e40..572d3346e05 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -174,7 +174,7 @@ ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2, int32
void vmng_screen_dispose(void *scrnContent) {
ScreenContext *myScreen;
Hotkey *myHotkeys, *tempHotkey;
- if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == NULL) return;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == nullptr) return;
RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
myHotkeys = myScreen->scrnHotkeys;
tempHotkey = myHotkeys;
@@ -188,7 +188,7 @@ void vmng_screen_dispose(void *scrnContent) {
void vmng_screen_hide(void *scrnContent) {
ScreenContext *myScreen;
- if ((myScreen = ExtractScreen(scrnContent, SCRN_ACTIVE)) == NULL) return;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ACTIVE)) == nullptr) return;
RestoreScreens(myScreen->x1, myScreen->y1, myScreen->x2, myScreen->y2);
myScreen->behind = _G(inactiveScreens);
myScreen->infront = nullptr;
diff --git a/engines/m4/gui/gui_vmng_core.h b/engines/m4/gui/gui_vmng_core.h
index 9de1f197aa3..fc22d9bc262 100644
--- a/engines/m4/gui/gui_vmng_core.h
+++ b/engines/m4/gui/gui_vmng_core.h
@@ -73,10 +73,10 @@ extern ScreenContext *vmng_screen_create(int32 x1, int32 y1, int32 x2, int32 y2,
* exists but is inactive (invisible, no events are received or blocked), or is undefined
* (does not exist).
* @param scrnContent The window identifier.
- * @param status If not NULL, the status: SCRN_ACTIVE, SCRN_INACTIVE, or SCRN_UNDEFN
+ * @param status If not nullptr, the status: SCRN_ACTIVE, SCRN_INACTIVE, or SCRN_UNDEFN
* is recoreded here.
* @returns the ScreenContext* associated with the window which was created for
- * the structure scrnContent. returns NULL if now window was found.
+ * the structure scrnContent. returns nullptr if now window was found.
*/
extern ScreenContext *vmng_screen_find(void *scrnContent, int32 *status); // was FindScreen
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index 23bc81e3129..bf55cbf2640 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -274,10 +274,10 @@ bool MoveScreenDelta(ScreenContext *myScreen, int32 parmX, int32 parmY) {
void vmng_screen_to_back(void *scrnContent) {
ScreenContext *myScreen, *tempScreen;
- if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == NULL) return;
+ if ((myScreen = ExtractScreen(scrnContent, SCRN_ANY)) == nullptr) return;
if (!_G(backScreen)) {
- myScreen->infront = NULL;
- myScreen->behind = NULL;
+ myScreen->infront = nullptr;
+ myScreen->behind = nullptr;
_G(frontScreen) = myScreen;
_G(backScreen) = myScreen;
} else {
@@ -287,13 +287,13 @@ void vmng_screen_to_back(void *scrnContent) {
tempScreen = tempScreen->infront;
}
if (!tempScreen) {
- myScreen->infront = NULL;
+ myScreen->infront = nullptr;
myScreen->behind = _G(frontScreen);
_G(frontScreen)->infront = myScreen;
_G(frontScreen) = myScreen;
} else if (tempScreen == _G(backScreen)) {
myScreen->infront = _G(backScreen);
- myScreen->behind = NULL;
+ myScreen->behind = nullptr;
_G(backScreen)->behind = myScreen;
_G(backScreen) = myScreen;
} else {
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index 530d982e093..d099470f880 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -166,7 +166,7 @@ MemHandle Resources::rget(const Common::String &resourceName, int32 *resourceSiz
void Resources::rtoss(const Common::String &resourceName) {
int hash_val;
- Entry *resEntry = NULL;
+ Entry *resEntry = nullptr;
Common::String lowerName;
lowerName = resourceName;
diff --git a/engines/m4/platform/tile/tile_read.h b/engines/m4/platform/tile/tile_read.h
index 528f153cb37..1906501a4bc 100644
--- a/engines/m4/platform/tile/tile_read.h
+++ b/engines/m4/platform/tile/tile_read.h
@@ -37,7 +37,7 @@ extern void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
/**
* Returns a pointer to an initialized buffer containing the image data.
* If an error occurs, out.x contains the error number while out.y is zero,
- * and out.data is NULL.
+ * and out.data is nullptr.
*/
extern Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y);
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index d6deb449e20..b415a38a759 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -184,7 +184,7 @@ void Vars::game_systems_shutdown() {
f_stream_Shutdown();
term_message("mouse dialog be gone!");
- DialogDestroy(_mousePosDialog, NULL);
+ DialogDestroy(_mousePosDialog, nullptr);
term_message("sounds stop");
midi_stop();
@@ -207,7 +207,7 @@ void Vars::game_systems_shutdown() {
digi_uninstall();
midi_uninstall();
- f_io_report(NULL, NULL);
+ f_io_report(nullptr, nullptr);
term_message("calling registry shutdown");
registry_shutdown_all();
term_shutdown();
diff --git a/engines/m4/wscript/ws_timer.cpp b/engines/m4/wscript/ws_timer.cpp
index 28f58dbec77..e74c463590d 100644
--- a/engines/m4/wscript/ws_timer.cpp
+++ b/engines/m4/wscript/ws_timer.cpp
@@ -65,7 +65,7 @@ void ws_MakeOnTimeReq(int32 wakeUpTime, machine *myXM, int32 pcOffset, int32 pcC
// Insert the new time req into the list in ascending order
// If the list is empty...
if (!_GWS(firstTimeReq)) {
- newTimeReq->next = NULL;
+ newTimeReq->next = nullptr;
_GWS(firstTimeReq) = newTimeReq;
} else if (newTimeReq->myTime <= _GWS(firstTimeReq)->myTime) {
// Else if it belongs at the front of a non-empty list..
Commit: 87857ecf21f3383ed46a0aab4b11e3c2dd7b8005
https://github.com/scummvm/scummvm/commit/87857ecf21f3383ed46a0aab4b11e3c2dd7b8005
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix conv_current_entry
Changed paths:
engines/m4/adv_r/conv_io.cpp
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index b9b8a3068fe..0726a24e6e7 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -133,7 +133,7 @@ long conv_current_node() {
}
int32 conv_current_entry() {
- return _GC(ent);
+ return _GC(ent) - 1;
}
void conv_reset(const char *filename) {
Commit: c48c2abb18948795b0e83fe090cd20fdc73bd703
https://github.com/scummvm/scummvm/commit/c48c2abb18948795b0e83fe090cd20fdc73bd703
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Intro getting as far as first test execution
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 206cdd0745c..9b6517e197a 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -356,7 +356,7 @@ void Room801::daemon() {
case 2:
if (imath_ranged_rand(0, 15) <= 12) {
_val3 = 2;
- _series11 = series_show("804ZL01", 1, 0, 16);
+ _series11 = series_show("804ZL01", 1, 0, 16, 30, 0);
} else {
_val3 = 1;
kernel_trigger_dispatch_now(16);
@@ -385,6 +385,7 @@ void Room801::daemon() {
break;
case 18:
+ // Beginning the first test
terminateMachineAndNull(_series10);
terminateMachineAndNull(_series9);
_G(roomVal4) = 3;
Commit: c93a0881fe718b5965033b361f2c9667137c4e64
https://github.com/scummvm/scummvm/commit/c93a0881fe718b5965033b361f2c9667137c4e64
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for failing first test
Changed paths:
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index 9b6517e197a..a25c9e92336 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -417,7 +417,7 @@ void Room801::daemon() {
case 21:
pal_fade_set_start(0);
- kernel_timing_trigger(6, 16);
+ kernel_timing_trigger(6, 22);
digi_unload_stream_breaks(SERIES9);
break;
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index 61c49e1fecf..6943a4fe596 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -129,8 +129,8 @@ void Room802::init() {
interface_hide();
player_set_commands_allowed(false);
digi_preload("800_001");
- pal_fade_set_start(_G(master_palette), 0);
- pal_fade_init(_G(master_palette), 0, 255, 100, 40, -1);
+ pal_fade_set_start(0);
+ pal_fade_init(0, 255, 100, 40, -1);
_val1 = 11;
_val2 = 2;
@@ -190,7 +190,7 @@ void Room802::daemon() {
case 4:
kernel_trigger_dispatch_now(24);
series_stream_with_breaks(SERIES3, "803B", 6, 1, 5);
- pal_fade_init(0, 255, 10, 30, -1);
+ pal_fade_init(0, 255, 100, 30, -1);
kernel_timing_trigger(1, 23);
break;
@@ -234,8 +234,8 @@ void Room802::daemon() {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(17);
- _series1 = series_play("802BFX03", 0x101);
- _series2 = series_play("802BFX02", 0x100);
+ _series1 = series_play("802BFX03", 0x101, 0, -1, 6, -1);
+ _series2 = series_play("802BFX02", 0x100, 1, -1, 6, -1);
conv_load_and_prepare("conv81", 13);
conv_play_curr();
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index d01655f6531..5170810455c 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,7 +110,7 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(801); //*****DEBUG****
+ _game.setRoom(802); //*****DEBUG****
font_set_colors(2, 1, 3);
}
Commit: cd44efcc231cb6c1d857a1f9b91f994ff2b1fbea
https://github.com/scummvm/scummvm/commit/cd44efcc231cb6c1d857a1f9b91f994ff2b1fbea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 802 fixes
Changed paths:
engines/m4/burger/rooms/section8/room802.cpp
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index 6943a4fe596..c0cfe6faf18 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -230,7 +230,7 @@ void Room802::daemon() {
digi_unload_stream_breaks(SERIES3);
_G(wilbur_should) = getWilburShould();
- _val2 = 6;
+ _G(roomVal4) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(17);
@@ -398,7 +398,7 @@ void Room802::daemon() {
if (who <= 0)
_G(roomVal4) = 5;
else if (who == 1)
- _G(roomVal4) = 14;
+ _G(wilbur_should) = 14;
}
break;
@@ -424,7 +424,7 @@ void Room802::daemon() {
_flag2 = true;
_G(wilbur_should) = 20;
_G(roomVal4) = 6;
- _series5 = series_play("802BW03", 0x100, 4);
+ _series5 = series_play("802BW03", 0x100, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION, 802);
break;
Commit: 3e74fa989d7ac0af0fd4f89d2cf560cf339d0c81
https://github.com/scummvm/scummvm/commit/3e74fa989d7ac0af0fd4f89d2cf560cf339d0c81
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify Flumix's name and should variable
Changed paths:
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room706.cpp
engines/m4/burger/rooms/section8/room801.cpp
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index 9164aed22f3..8c8dde4083f 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -68,7 +68,7 @@ void Room702::daemon() {
player_set_commands_allowed(true);
ws_demand_location(302, 284, 6);
_val2 = 12;
- _G(roomVal4) = 8;
+ _G(flumix_should) = 8;
_G(wilbur_should) = 10;
digi_play_loop("700_001", 3, 50, -1, 700);
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -84,7 +84,7 @@ void Room702::daemon() {
break;
case 3:
- _G(roomVal4) = 4;
+ _G(flumix_should) = 4;
pal_fade_init(_G(kernel).first_fade, 255, 0, 90, -1);
kernel_timing_trigger(30, 5);
break;
@@ -96,7 +96,7 @@ void Room702::daemon() {
case 5:
switch (_val1) {
case 1:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 3:
_val1 = 2;
break;
@@ -109,7 +109,7 @@ void Room702::daemon() {
break;
case 5:
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series10 = series_play("702C1FL2", 0, 2, 5);
@@ -121,7 +121,7 @@ void Room702::daemon() {
break;
case 6:
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series10 = series_play("702C1FL3", 0, 1, 5);
@@ -133,7 +133,7 @@ void Room702::daemon() {
break;
case 7:
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series10 = series_play("702C1FL2", 0, 0, 5);
@@ -145,14 +145,14 @@ void Room702::daemon() {
break;
case 8:
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series10 = series_play("702C1FL1", 0, 0, 5);
digi_play("702F003B", 2, 120);
break;
case 9:
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series10 = series_play("702FLT01", 0, 0, 5, 60);
break;
@@ -163,13 +163,13 @@ void Room702::daemon() {
break;
case 2:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 3:
if (_flag1)
terminateMachineAndNull(_series10);
_flag1 = true;
- _G(roomVal4) = 21;
+ _G(flumix_should) = 21;
_series10 = series_play("702FLT01", 0, 4);
digi_play(conv_sound_to_play(), 1, 255, 5);
break;
@@ -177,7 +177,7 @@ void Room702::daemon() {
case 21:
terminateMachineAndNull(_series10);
_flag1 = false;
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
kernel_trigger_dispatch_now(5);
conv_resume_curr();
break;
@@ -263,7 +263,7 @@ void Room702::conv82() {
if (conv_sound_to_play()) {
if (who <= 0) {
- _G(roomVal4) = 3;
+ _G(flumix_should) = 3;
kernel_trigger_dispatch_now(5);
} else if (who == 1) {
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 49cb48d1ad5..411000c8582 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -454,7 +454,7 @@ void Room706::daemon() {
break;
case 34:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 2:
getRoomVal();
series_play("706FLX01", 0x400, 0, 34, 6);
@@ -466,7 +466,7 @@ void Room706::daemon() {
break;
default:
- _G(roomVal4) = 4;
+ _G(flumix_should) = 4;
break;
}
break;
@@ -565,7 +565,7 @@ void Room706::conv83() {
}
void Room706::getRoomVal() {
- _G(roomVal4) = imath_ranged_rand(1, 100) >= 10 ? 3 : 2;
+ _G(flumix_should) = imath_ranged_rand(1, 100) >= 10 ? 3 : 2;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index a25c9e92336..d046d41310a 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -265,7 +265,7 @@ void Room801::daemon() {
kernel_trigger_dispatch_now(13);
} else {
_G(wilbur_should) = getWilburShould();
- _G(roomVal4) = 2;
+ _G(flumix_should) = 2;
_val3 = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(16);
@@ -287,7 +287,7 @@ void Room801::daemon() {
loadSeries2();
_G(wilbur_should) = getWilburShould();
- _G(roomVal4) = 2;
+ _G(flumix_should) = 2;
_val3 = 2;
_series9 = series_play("804FL01", 2, 0, -1, 6, -1);
@@ -311,7 +311,7 @@ void Room801::daemon() {
(node == 6 && entry == 1) || (node == 8 && entry == 0)) {
_val3 = 13;
} else {
- _G(roomVal4) = 13;
+ _G(flumix_should) = 13;
}
} else if (who == 1) {
_G(wilbur_should) = 5;
@@ -320,8 +320,8 @@ void Room801::daemon() {
break;
case 15:
- // Flummox
- switch (_G(roomVal4)) {
+ // Flumix
+ switch (_G(flumix_should)) {
case 3:
terminateMachineAndNull(_series10);
_series10 = series_show("804FLX01", 1);
@@ -331,20 +331,20 @@ void Room801::daemon() {
case 12:
terminateMachineAndNull(_series10);
- _G(roomVal4) = 2;
+ _G(flumix_should) = 2;
kernel_trigger_dispatch_now(15);
conv_resume_curr();
break;
case 13:
- _G(roomVal4) = 12;
+ _G(flumix_should) = 12;
_G(wilbur_should) = 6;
_series10 = series_play("804FLT01", 1, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, 15);
break;
default:
- _G(roomVal4) = 2;
+ _G(flumix_should) = 2;
_series10 = series_show("804FL01", 1, 0, 15, 30, 0);
break;
}
@@ -388,7 +388,7 @@ void Room801::daemon() {
// Beginning the first test
terminateMachineAndNull(_series10);
terminateMachineAndNull(_series9);
- _G(roomVal4) = 3;
+ _G(flumix_should) = 3;
_series10 = series_play("804FLX01", 1, 16, -1, 6, 0, 100, 0, 0, 0, 7);
kernel_timing_trigger(180, 15);
break;
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index c0cfe6faf18..3f58c2727c4 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -230,7 +230,7 @@ void Room802::daemon() {
digi_unload_stream_breaks(SERIES3);
_G(wilbur_should) = getWilburShould();
- _G(roomVal4) = 6;
+ _G(flumix_should) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(17);
@@ -247,7 +247,7 @@ void Room802::daemon() {
case 13:
_G(wilbur_should) = 19;
- _G(roomVal4) = 19;
+ _G(flumix_should) = 19;
if (_flag2 && _flag1) {
terminateMachineAndNull(_series5);
@@ -288,9 +288,10 @@ void Room802::daemon() {
break;
case 17:
+ // Flumix
switch (_val2) {
case 1:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 5:
_flag1 = true;
_val2 = 3;
@@ -305,13 +306,13 @@ void Room802::daemon() {
case 9:
_flag1 = false;
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
series_play_with_breaks(PLAY2, "802BF02", 0x100, 17, 3);
break;
case 10:
_flag1 = false;
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_val4 = 30;
series_play_with_breaks(PLAY3, "802BF02", 0x100, 17, 1);
break;
@@ -324,14 +325,14 @@ void Room802::daemon() {
default:
_flag1 = false;
_val4 = 30;
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
series_play_with_breaks(PLAY1, "802BF02", 0x100, 17, 3);
break;
}
break;
case 2:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 5:
_flag1 = true;
_val2 = 3;
@@ -340,7 +341,7 @@ void Room802::daemon() {
case 6:
_flag1 = true;
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_series3.show("802BF03", 0x100, 0, 17, 30, 1);
break;
@@ -358,17 +359,17 @@ void Room802::daemon() {
break;
case 3:
- switch (_G(roomVal4)) {
+ switch (_G(flumix_should)) {
case 5:
_flag1 = true;
- _G(roomVal4) = 20;
+ _G(flumix_should) = 20;
_G(wilbur_should) = 16;
_series3.play("802BF01", 0x100, 4, -1, 6);
break;
case 20:
_series3.terminate();
- _G(roomVal4) = getRoomVal();
+ _G(flumix_should) = getRoomVal();
_flag1 = true;
_series3.show("802BF01", 0x100, 0, 17, 30, 0);
conv_resume_curr();
@@ -396,7 +397,7 @@ void Room802::daemon() {
if (conv_sound_to_play()) {
int who = conv_whos_talking();
if (who <= 0)
- _G(roomVal4) = 5;
+ _G(flumix_should) = 5;
else if (who == 1)
_G(wilbur_should) = 14;
}
@@ -423,7 +424,7 @@ void Room802::daemon() {
case 14:
_flag2 = true;
_G(wilbur_should) = 20;
- _G(roomVal4) = 6;
+ _G(flumix_should) = 6;
_series5 = series_play("802BW03", 0x100, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION, 802);
break;
@@ -463,7 +464,7 @@ void Room802::daemon() {
switch (_G(wilbur_should)) {
case 14:
_flag2 = true;
- _G(roomVal4) = 6;
+ _G(flumix_should) = 6;
_val1 = 11;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 83b66c62709..150b391f9ee 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -104,7 +104,7 @@ public:
bool _gameMenuFromMain = false;
int _room902Flag = 0;
int _roomVal3 = 0;
- int _roomVal4 = 0;
+ int _flumix_should = 0;
int _roomVal7 = 3;
machine *_npcSpeech1 = nullptr;
machine *_npcSpeech2 = nullptr;
Commit: 527c54e397c3904a54825edbad337a0da4ecb3f9
https://github.com/scummvm/scummvm/commit/527c54e397c3904a54825edbad337a0da4ecb3f9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Renamed getRoomVal method as getFlumixShould
Changed paths:
engines/m4/burger/rooms/section8/room802.cpp
engines/m4/burger/rooms/section8/room802.h
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index 3f58c2727c4..64e57046924 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -306,13 +306,13 @@ void Room802::daemon() {
case 9:
_flag1 = false;
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
series_play_with_breaks(PLAY2, "802BF02", 0x100, 17, 3);
break;
case 10:
_flag1 = false;
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_val4 = 30;
series_play_with_breaks(PLAY3, "802BF02", 0x100, 17, 1);
break;
@@ -325,7 +325,7 @@ void Room802::daemon() {
default:
_flag1 = false;
_val4 = 30;
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
series_play_with_breaks(PLAY1, "802BF02", 0x100, 17, 3);
break;
}
@@ -341,7 +341,7 @@ void Room802::daemon() {
case 6:
_flag1 = true;
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_series3.show("802BF03", 0x100, 0, 17, 30, 1);
break;
@@ -369,7 +369,7 @@ void Room802::daemon() {
case 20:
_series3.terminate();
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
_series3.show("802BF01", 0x100, 0, 17, 30, 0);
conv_resume_curr();
@@ -580,7 +580,7 @@ int Room802::getWilburShould() {
}
}
-int Room802::getRoomVal() {
+int Room802::getFlumixShould() {
switch (imath_ranged_rand(1, 16)) {
case 1:
case 3:
diff --git a/engines/m4/burger/rooms/section8/room802.h b/engines/m4/burger/rooms/section8/room802.h
index c7f915ff727..22ee3c9885e 100644
--- a/engines/m4/burger/rooms/section8/room802.h
+++ b/engines/m4/burger/rooms/section8/room802.h
@@ -43,7 +43,7 @@ private:
void loadSeries();
int getWilburShould();
- int getRoomVal();
+ int getFlumixShould();
public:
Room802() : Room() {}
Commit: 13e4b8f132028a20c3b79ecce08f7d5cada49aa0
https://github.com/scummvm/scummvm/commit/13e4b8f132028a20c3b79ecce08f7d5cada49aa0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further room 802 fixes
Changed paths:
engines/m4/burger/rooms/section8/room802.cpp
diff --git a/engines/m4/burger/rooms/section8/room802.cpp b/engines/m4/burger/rooms/section8/room802.cpp
index 64e57046924..94099fbb091 100644
--- a/engines/m4/burger/rooms/section8/room802.cpp
+++ b/engines/m4/burger/rooms/section8/room802.cpp
@@ -339,7 +339,7 @@ void Room802::daemon() {
_series3.show("802BF01", 0x100, 0, 17, 1);
break;
- case 6:
+ case 6 :
_flag1 = true;
_G(flumix_should) = getFlumixShould();
_series3.show("802BF03", 0x100, 0, 17, 30, 1);
@@ -364,7 +364,13 @@ void Room802::daemon() {
_flag1 = true;
_G(flumix_should) = 20;
_G(wilbur_should) = 16;
- _series3.play("802BF01", 0x100, 4, -1, 6);
+ _series3.play("802BF01", 0x100, 4, -1, 6, -1);
+ digi_play(conv_sound_to_play(), 1, 255, 17);
+ break;
+
+ case 19:
+ _flag1 = true;
+ _series3.show("802BF02", 0x100, 0, -1, -1, 5);
break;
case 20:
@@ -375,11 +381,6 @@ void Room802::daemon() {
conv_resume_curr();
break;
- case 21:
- _flag1 = true;
- _series3.show("802BF02", 0x100, 0, -1, -1, 5);
- break;
-
default:
_val2 = 1;
_flag1 = true;
Commit: 861575ed236c6e356e48de89203e245ef69bac79
https://github.com/scummvm/scummvm/commit/861575ed236c6e356e48de89203e245ef69bac79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Reset startup room to title screen
Changed paths:
engines/m4/burger/vars.cpp
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 5170810455c..33262e64561 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,8 +110,6 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(802); //*****DEBUG****
-
font_set_colors(2, 1, 3);
}
Commit: 566d145fe8fab28d145068b46f9c59aad9f45473
https://github.com/scummvm/scummvm/commit/566d145fe8fab28d145068b46f9c59aad9f45473
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Simple string array class
This was used during tracking of resource usage debugging,
and may be needed again in the future.
Changed paths:
engines/m4/core/cstring.h
diff --git a/engines/m4/core/cstring.h b/engines/m4/core/cstring.h
index bdee103fdf7..2183ce06ea1 100644
--- a/engines/m4/core/cstring.h
+++ b/engines/m4/core/cstring.h
@@ -22,10 +22,33 @@
#ifndef M4_CORE_CSTRING_H
#define M4_CORE_CSTRING_H
+#include "common/str-array.h"
#include "m4/m4_types.h"
namespace M4 {
+class StringArray : public Common::StringArray {
+public:
+ StringArray() : Common::StringArray() {}
+
+ int indexOf(const Common::String &str) const {
+ for (uint i = 0; i < size(); ++i) {
+ if ((*this)[i] == str)
+ return i;
+ }
+ return -1;
+ }
+
+ bool contains(const Common::String &str) const {
+ return indexOf(str) != -1;
+ }
+ void remove(const Common::String &str) {
+ int idx = indexOf(str);
+ if (idx != -1)
+ remove_at(idx);
+ }
+};
+
#define STR_PARSE_BUFFER_SIZE 255
extern bool charIsIn(char ch, char *str);
Commit: 28a88afd76a77863ab388745eeca7b3ae8e4844a
https://github.com/scummvm/scummvm/commit/28a88afd76a77863ab388745eeca7b3ae8e4844a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Properly free sound resources in digi_unload
Changed paths:
engines/m4/platform/sound/digi.cpp
engines/m4/platform/sound/digi.h
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 97b32e1d919..93223ec1a32 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -60,11 +60,11 @@ bool Digi::preload(const Common::String &name, int roomNum) {
MemHandle workHandle;
int32 assetSize;
- Common::String fileName = expand_name_2_RAW(name, roomNum);
- if (_sounds.contains(fileName))
+ if (_sounds.contains(name))
return true;
// Load in the sound
+ Common::String fileName = expand_name_2_RAW(name, roomNum);
if ((workHandle = rget(fileName, &assetSize)) == nullptr)
error("Could not find sound - %s", fileName.c_str());
@@ -75,7 +75,7 @@ bool Digi::preload(const Common::String &name, int roomNum) {
HUnLock(workHandle);
- _sounds[name] = DigiEntry(pDest, assetSize);
+ _sounds[name] = DigiEntry(fileName, pDest, assetSize);
return false;
}
@@ -87,6 +87,13 @@ void Digi::unload(const Common::String &name) {
stop(channel);
}
+ // Remove the underlying resource
+ if (!_sounds[name]._filename.empty()) {
+ rtoss(_sounds[name]._filename);
+ _sounds[name]._filename.clear();
+ }
+
+ // Delete the sound entry
delete _sounds[name]._data;
_sounds.erase(name);
}
diff --git a/engines/m4/platform/sound/digi.h b/engines/m4/platform/sound/digi.h
index 6acd63d17b6..a218c91098e 100644
--- a/engines/m4/platform/sound/digi.h
+++ b/engines/m4/platform/sound/digi.h
@@ -41,11 +41,13 @@ class Digi {
* Digital sound entry
*/
struct DigiEntry {
+ Common::String _filename;
byte *_data = nullptr;
size_t _size = 0;
bool _preloaded = false;
DigiEntry() {}
- DigiEntry(byte *data, size_t size) : _data(data), _size(size) {}
+ DigiEntry(Common::String &name, byte *data, size_t size) :
+ _filename(name), _data(data), _size(size) {}
};
/**
* Sound channel
Commit: d8943dc1de9cf9ecbe43cff66a2ef31ef7b0b4dd
https://github.com/scummvm/scummvm/commit/d8943dc1de9cf9ecbe43cff66a2ef31ef7b0b4dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: RIDDLE: Skeleton classes for all game rooms
Changed paths:
A engines/m4/riddle/rooms/section2/room201.cpp
A engines/m4/riddle/rooms/section2/room201.h
A engines/m4/riddle/rooms/section2/room202.cpp
A engines/m4/riddle/rooms/section2/room202.h
A engines/m4/riddle/rooms/section2/room203.cpp
A engines/m4/riddle/rooms/section2/room203.h
A engines/m4/riddle/rooms/section2/room204.cpp
A engines/m4/riddle/rooms/section2/room204.h
A engines/m4/riddle/rooms/section2/room205.cpp
A engines/m4/riddle/rooms/section2/room205.h
A engines/m4/riddle/rooms/section2/room207.cpp
A engines/m4/riddle/rooms/section2/room207.h
A engines/m4/riddle/rooms/section2/section2.cpp
A engines/m4/riddle/rooms/section2/section2.h
A engines/m4/riddle/rooms/section3/room301.cpp
A engines/m4/riddle/rooms/section3/room301.h
A engines/m4/riddle/rooms/section3/room303.cpp
A engines/m4/riddle/rooms/section3/room303.h
A engines/m4/riddle/rooms/section3/room304.cpp
A engines/m4/riddle/rooms/section3/room304.h
A engines/m4/riddle/rooms/section3/room305.cpp
A engines/m4/riddle/rooms/section3/room305.h
A engines/m4/riddle/rooms/section3/room309.cpp
A engines/m4/riddle/rooms/section3/room309.h
A engines/m4/riddle/rooms/section3/room352.cpp
A engines/m4/riddle/rooms/section3/room352.h
A engines/m4/riddle/rooms/section3/room354.cpp
A engines/m4/riddle/rooms/section3/room354.h
A engines/m4/riddle/rooms/section3/section3.cpp
A engines/m4/riddle/rooms/section3/section3.h
A engines/m4/riddle/rooms/section4/room401.cpp
A engines/m4/riddle/rooms/section4/room401.h
A engines/m4/riddle/rooms/section4/room402.cpp
A engines/m4/riddle/rooms/section4/room402.h
A engines/m4/riddle/rooms/section4/room403.cpp
A engines/m4/riddle/rooms/section4/room403.h
A engines/m4/riddle/rooms/section4/room404.cpp
A engines/m4/riddle/rooms/section4/room404.h
A engines/m4/riddle/rooms/section4/room405.cpp
A engines/m4/riddle/rooms/section4/room405.h
A engines/m4/riddle/rooms/section4/room406.cpp
A engines/m4/riddle/rooms/section4/room406.h
A engines/m4/riddle/rooms/section4/room407.cpp
A engines/m4/riddle/rooms/section4/room407.h
A engines/m4/riddle/rooms/section4/room408.cpp
A engines/m4/riddle/rooms/section4/room408.h
A engines/m4/riddle/rooms/section4/room409.cpp
A engines/m4/riddle/rooms/section4/room409.h
A engines/m4/riddle/rooms/section4/room410.cpp
A engines/m4/riddle/rooms/section4/room410.h
A engines/m4/riddle/rooms/section4/room413.cpp
A engines/m4/riddle/rooms/section4/room413.h
A engines/m4/riddle/rooms/section4/room456.cpp
A engines/m4/riddle/rooms/section4/room456.h
A engines/m4/riddle/rooms/section4/room493.cpp
A engines/m4/riddle/rooms/section4/room493.h
A engines/m4/riddle/rooms/section4/room494.cpp
A engines/m4/riddle/rooms/section4/room494.h
A engines/m4/riddle/rooms/section4/room495.cpp
A engines/m4/riddle/rooms/section4/room495.h
A engines/m4/riddle/rooms/section4/section4.cpp
A engines/m4/riddle/rooms/section4/section4.h
A engines/m4/riddle/rooms/section5/room501.cpp
A engines/m4/riddle/rooms/section5/room501.h
A engines/m4/riddle/rooms/section5/room504.cpp
A engines/m4/riddle/rooms/section5/room504.h
A engines/m4/riddle/rooms/section5/room506.cpp
A engines/m4/riddle/rooms/section5/room506.h
A engines/m4/riddle/rooms/section5/room507.cpp
A engines/m4/riddle/rooms/section5/room507.h
A engines/m4/riddle/rooms/section5/room508.cpp
A engines/m4/riddle/rooms/section5/room508.h
A engines/m4/riddle/rooms/section5/room509.cpp
A engines/m4/riddle/rooms/section5/room509.h
A engines/m4/riddle/rooms/section5/room510.cpp
A engines/m4/riddle/rooms/section5/room510.h
A engines/m4/riddle/rooms/section5/section5.cpp
A engines/m4/riddle/rooms/section5/section5.h
A engines/m4/riddle/rooms/section6/room603.cpp
A engines/m4/riddle/rooms/section6/room603.h
A engines/m4/riddle/rooms/section6/room604.cpp
A engines/m4/riddle/rooms/section6/room604.h
A engines/m4/riddle/rooms/section6/room605.cpp
A engines/m4/riddle/rooms/section6/room605.h
A engines/m4/riddle/rooms/section6/room607.cpp
A engines/m4/riddle/rooms/section6/room607.h
A engines/m4/riddle/rooms/section6/room608.cpp
A engines/m4/riddle/rooms/section6/room608.h
A engines/m4/riddle/rooms/section6/room610.cpp
A engines/m4/riddle/rooms/section6/room610.h
A engines/m4/riddle/rooms/section6/room615.cpp
A engines/m4/riddle/rooms/section6/room615.h
A engines/m4/riddle/rooms/section6/room620.cpp
A engines/m4/riddle/rooms/section6/room620.h
A engines/m4/riddle/rooms/section6/room621.cpp
A engines/m4/riddle/rooms/section6/room621.h
A engines/m4/riddle/rooms/section6/room622.cpp
A engines/m4/riddle/rooms/section6/room622.h
A engines/m4/riddle/rooms/section6/room623.cpp
A engines/m4/riddle/rooms/section6/room623.h
A engines/m4/riddle/rooms/section6/room624.cpp
A engines/m4/riddle/rooms/section6/room624.h
A engines/m4/riddle/rooms/section6/room625.cpp
A engines/m4/riddle/rooms/section6/room625.h
A engines/m4/riddle/rooms/section6/room626.cpp
A engines/m4/riddle/rooms/section6/room626.h
A engines/m4/riddle/rooms/section6/room627.cpp
A engines/m4/riddle/rooms/section6/room627.h
A engines/m4/riddle/rooms/section6/room628.cpp
A engines/m4/riddle/rooms/section6/room628.h
A engines/m4/riddle/rooms/section6/room629.cpp
A engines/m4/riddle/rooms/section6/room629.h
A engines/m4/riddle/rooms/section6/room630.cpp
A engines/m4/riddle/rooms/section6/room630.h
A engines/m4/riddle/rooms/section6/room631.cpp
A engines/m4/riddle/rooms/section6/room631.h
A engines/m4/riddle/rooms/section6/room632.cpp
A engines/m4/riddle/rooms/section6/room632.h
A engines/m4/riddle/rooms/section6/room633.cpp
A engines/m4/riddle/rooms/section6/room633.h
A engines/m4/riddle/rooms/section6/room634.cpp
A engines/m4/riddle/rooms/section6/room634.h
A engines/m4/riddle/rooms/section6/room635.cpp
A engines/m4/riddle/rooms/section6/room635.h
A engines/m4/riddle/rooms/section6/room636.cpp
A engines/m4/riddle/rooms/section6/room636.h
A engines/m4/riddle/rooms/section6/room637.cpp
A engines/m4/riddle/rooms/section6/room637.h
A engines/m4/riddle/rooms/section6/room638.cpp
A engines/m4/riddle/rooms/section6/room638.h
A engines/m4/riddle/rooms/section6/room640.cpp
A engines/m4/riddle/rooms/section6/room640.h
A engines/m4/riddle/rooms/section6/room641.cpp
A engines/m4/riddle/rooms/section6/room641.h
A engines/m4/riddle/rooms/section6/room642.cpp
A engines/m4/riddle/rooms/section6/room642.h
A engines/m4/riddle/rooms/section6/room643.cpp
A engines/m4/riddle/rooms/section6/room643.h
A engines/m4/riddle/rooms/section6/room644.cpp
A engines/m4/riddle/rooms/section6/room644.h
A engines/m4/riddle/rooms/section6/room645.cpp
A engines/m4/riddle/rooms/section6/room645.h
A engines/m4/riddle/rooms/section6/room646.cpp
A engines/m4/riddle/rooms/section6/room646.h
A engines/m4/riddle/rooms/section6/room647.cpp
A engines/m4/riddle/rooms/section6/room647.h
A engines/m4/riddle/rooms/section6/room648.cpp
A engines/m4/riddle/rooms/section6/room648.h
A engines/m4/riddle/rooms/section6/room649.cpp
A engines/m4/riddle/rooms/section6/room649.h
A engines/m4/riddle/rooms/section6/room650.cpp
A engines/m4/riddle/rooms/section6/room650.h
A engines/m4/riddle/rooms/section6/room651.cpp
A engines/m4/riddle/rooms/section6/room651.h
A engines/m4/riddle/rooms/section6/section6.cpp
A engines/m4/riddle/rooms/section6/section6.h
A engines/m4/riddle/rooms/section7/room701.cpp
A engines/m4/riddle/rooms/section7/room701.h
A engines/m4/riddle/rooms/section7/room702.cpp
A engines/m4/riddle/rooms/section7/room702.h
A engines/m4/riddle/rooms/section7/room703.cpp
A engines/m4/riddle/rooms/section7/room703.h
A engines/m4/riddle/rooms/section7/room704.cpp
A engines/m4/riddle/rooms/section7/room704.h
A engines/m4/riddle/rooms/section7/room705.cpp
A engines/m4/riddle/rooms/section7/room705.h
A engines/m4/riddle/rooms/section7/room706.cpp
A engines/m4/riddle/rooms/section7/room706.h
A engines/m4/riddle/rooms/section7/room707.cpp
A engines/m4/riddle/rooms/section7/room707.h
A engines/m4/riddle/rooms/section7/room709.cpp
A engines/m4/riddle/rooms/section7/room709.h
A engines/m4/riddle/rooms/section7/room710.cpp
A engines/m4/riddle/rooms/section7/room710.h
A engines/m4/riddle/rooms/section7/room711.cpp
A engines/m4/riddle/rooms/section7/room711.h
A engines/m4/riddle/rooms/section7/section7.cpp
A engines/m4/riddle/rooms/section7/section7.h
A engines/m4/riddle/rooms/section8/room801.cpp
A engines/m4/riddle/rooms/section8/room801.h
A engines/m4/riddle/rooms/section8/room802.cpp
A engines/m4/riddle/rooms/section8/room802.h
A engines/m4/riddle/rooms/section8/room803.cpp
A engines/m4/riddle/rooms/section8/room803.h
A engines/m4/riddle/rooms/section8/room804.cpp
A engines/m4/riddle/rooms/section8/room804.h
A engines/m4/riddle/rooms/section8/room805.cpp
A engines/m4/riddle/rooms/section8/room805.h
A engines/m4/riddle/rooms/section8/room806.cpp
A engines/m4/riddle/rooms/section8/room806.h
A engines/m4/riddle/rooms/section8/room807.cpp
A engines/m4/riddle/rooms/section8/room807.h
A engines/m4/riddle/rooms/section8/room808.cpp
A engines/m4/riddle/rooms/section8/room808.h
A engines/m4/riddle/rooms/section8/room809.cpp
A engines/m4/riddle/rooms/section8/room809.h
A engines/m4/riddle/rooms/section8/room810.cpp
A engines/m4/riddle/rooms/section8/room810.h
A engines/m4/riddle/rooms/section8/room811.cpp
A engines/m4/riddle/rooms/section8/room811.h
A engines/m4/riddle/rooms/section8/room814.cpp
A engines/m4/riddle/rooms/section8/room814.h
A engines/m4/riddle/rooms/section8/room818.cpp
A engines/m4/riddle/rooms/section8/room818.h
A engines/m4/riddle/rooms/section8/room824.cpp
A engines/m4/riddle/rooms/section8/room824.h
A engines/m4/riddle/rooms/section8/room834.cpp
A engines/m4/riddle/rooms/section8/room834.h
A engines/m4/riddle/rooms/section8/room844.cpp
A engines/m4/riddle/rooms/section8/room844.h
A engines/m4/riddle/rooms/section8/room850.cpp
A engines/m4/riddle/rooms/section8/room850.h
A engines/m4/riddle/rooms/section8/room860.cpp
A engines/m4/riddle/rooms/section8/room860.h
A engines/m4/riddle/rooms/section8/room861.cpp
A engines/m4/riddle/rooms/section8/room861.h
A engines/m4/riddle/rooms/section8/section8.cpp
A engines/m4/riddle/rooms/section8/section8.h
engines/m4/module.mk
engines/m4/riddle/riddle.cpp
engines/m4/riddle/riddle.h
engines/m4/riddle/rooms/section.h
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 93feed78b74..1fd46b7107d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -186,6 +186,115 @@ MODULE_OBJS = \
riddle/gui/interface.o \
riddle/rooms/room.o \
riddle/rooms/section.o \
+ riddle/rooms/section2/section2.o \
+ riddle/rooms/section2/room201.o \
+ riddle/rooms/section2/room202.o \
+ riddle/rooms/section2/room203.o \
+ riddle/rooms/section2/room204.o \
+ riddle/rooms/section2/room205.o \
+ riddle/rooms/section2/room207.o \
+ riddle/rooms/section3/section3.o \
+ riddle/rooms/section3/room301.o \
+ riddle/rooms/section3/room303.o \
+ riddle/rooms/section3/room304.o \
+ riddle/rooms/section3/room305.o \
+ riddle/rooms/section3/room309.o \
+ riddle/rooms/section3/room352.o \
+ riddle/rooms/section3/room354.o \
+ riddle/rooms/section4/section4.o \
+ riddle/rooms/section4/room401.o \
+ riddle/rooms/section4/room402.o \
+ riddle/rooms/section4/room403.o \
+ riddle/rooms/section4/room404.o \
+ riddle/rooms/section4/room405.o \
+ riddle/rooms/section4/room406.o \
+ riddle/rooms/section4/room407.o \
+ riddle/rooms/section4/room408.o \
+ riddle/rooms/section4/room409.o \
+ riddle/rooms/section4/room410.o \
+ riddle/rooms/section4/room413.o \
+ riddle/rooms/section4/room456.o \
+ riddle/rooms/section4/room493.o \
+ riddle/rooms/section4/room494.o \
+ riddle/rooms/section4/room495.o \
+ riddle/rooms/section5/section5.o \
+ riddle/rooms/section5/room501.o \
+ riddle/rooms/section5/room504.o \
+ riddle/rooms/section5/room506.o \
+ riddle/rooms/section5/room507.o \
+ riddle/rooms/section5/room508.o \
+ riddle/rooms/section5/room509.o \
+ riddle/rooms/section5/room510.o \
+ riddle/rooms/section6/section6.o \
+ riddle/rooms/section6/room603.o \
+ riddle/rooms/section6/room604.o \
+ riddle/rooms/section6/room605.o \
+ riddle/rooms/section6/room607.o \
+ riddle/rooms/section6/room608.o \
+ riddle/rooms/section6/room610.o \
+ riddle/rooms/section6/room615.o \
+ riddle/rooms/section6/room620.o \
+ riddle/rooms/section6/room621.o \
+ riddle/rooms/section6/room622.o \
+ riddle/rooms/section6/room623.o \
+ riddle/rooms/section6/room624.o \
+ riddle/rooms/section6/room625.o \
+ riddle/rooms/section6/room626.o \
+ riddle/rooms/section6/room627.o \
+ riddle/rooms/section6/room628.o \
+ riddle/rooms/section6/room629.o \
+ riddle/rooms/section6/room630.o \
+ riddle/rooms/section6/room631.o \
+ riddle/rooms/section6/room632.o \
+ riddle/rooms/section6/room633.o \
+ riddle/rooms/section6/room634.o \
+ riddle/rooms/section6/room635.o \
+ riddle/rooms/section6/room636.o \
+ riddle/rooms/section6/room637.o \
+ riddle/rooms/section6/room638.o \
+ riddle/rooms/section6/room640.o \
+ riddle/rooms/section6/room641.o \
+ riddle/rooms/section6/room642.o \
+ riddle/rooms/section6/room643.o \
+ riddle/rooms/section6/room644.o \
+ riddle/rooms/section6/room645.o \
+ riddle/rooms/section6/room646.o \
+ riddle/rooms/section6/room647.o \
+ riddle/rooms/section6/room648.o \
+ riddle/rooms/section6/room649.o \
+ riddle/rooms/section6/room650.o \
+ riddle/rooms/section6/room651.o \
+ riddle/rooms/section7/section7.o \
+ riddle/rooms/section7/room701.o \
+ riddle/rooms/section7/room702.o \
+ riddle/rooms/section7/room703.o \
+ riddle/rooms/section7/room704.o \
+ riddle/rooms/section7/room705.o \
+ riddle/rooms/section7/room706.o \
+ riddle/rooms/section7/room707.o \
+ riddle/rooms/section7/room709.o \
+ riddle/rooms/section7/room710.o \
+ riddle/rooms/section7/room711.o \
+ riddle/rooms/section8/section8.o \
+ riddle/rooms/section8/room801.o \
+ riddle/rooms/section8/room802.o \
+ riddle/rooms/section8/room803.o \
+ riddle/rooms/section8/room804.o \
+ riddle/rooms/section8/room805.o \
+ riddle/rooms/section8/room806.o \
+ riddle/rooms/section8/room807.o \
+ riddle/rooms/section8/room808.o \
+ riddle/rooms/section8/room809.o \
+ riddle/rooms/section8/room810.o \
+ riddle/rooms/section8/room811.o \
+ riddle/rooms/section8/room814.o \
+ riddle/rooms/section8/room818.o \
+ riddle/rooms/section8/room824.o \
+ riddle/rooms/section8/room834.o \
+ riddle/rooms/section8/room844.o \
+ riddle/rooms/section8/room850.o \
+ riddle/rooms/section8/room860.o \
+ riddle/rooms/section8/room861.o \
riddle/rooms/section9/section9.o \
riddle/rooms/section9/section9_room.o \
riddle/rooms/section9/room901.o \
diff --git a/engines/m4/riddle/riddle.cpp b/engines/m4/riddle/riddle.cpp
index 551ab4cd056..e8a7a452991 100644
--- a/engines/m4/riddle/riddle.cpp
+++ b/engines/m4/riddle/riddle.cpp
@@ -29,14 +29,14 @@ namespace Riddle {
RiddleEngine::RiddleEngine(OSystem *syst, const M4GameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
- _sections.push_back(&_section9); // TODO: Replace with proper section
+ _sections.push_back(&_section1);
+ _sections.push_back(&_section2);
+ _sections.push_back(&_section3);
+ _sections.push_back(&_section4);
+ _sections.push_back(&_section5);
+ _sections.push_back(&_section6);
+ _sections.push_back(&_section7);
+ _sections.push_back(&_section8);
_sections.push_back(&_section9);
}
diff --git a/engines/m4/riddle/riddle.h b/engines/m4/riddle/riddle.h
index 4029ace73a9..cf7b7c10f96 100644
--- a/engines/m4/riddle/riddle.h
+++ b/engines/m4/riddle/riddle.h
@@ -23,6 +23,13 @@
#define M4_RIDDLE_RIDDLE_H
#include "m4/m4.h"
+#include "m4/riddle/rooms/section2/section2.h"
+#include "m4/riddle/rooms/section3/section3.h"
+#include "m4/riddle/rooms/section4/section4.h"
+#include "m4/riddle/rooms/section5/section5.h"
+#include "m4/riddle/rooms/section6/section6.h"
+#include "m4/riddle/rooms/section7/section7.h"
+#include "m4/riddle/rooms/section8/section8.h"
#include "m4/riddle/rooms/section9/section9.h"
namespace M4 {
@@ -30,6 +37,14 @@ namespace Riddle {
class RiddleEngine : public M4Engine {
private:
+ Rooms::Section1 _section1;
+ Rooms::Section2 _section2;
+ Rooms::Section3 _section3;
+ Rooms::Section4 _section4;
+ Rooms::Section5 _section5;
+ Rooms::Section6 _section6;
+ Rooms::Section7 _section7;
+ Rooms::Section8 _section8;
Rooms::Section9 _section9;
protected:
diff --git a/engines/m4/riddle/rooms/section.h b/engines/m4/riddle/rooms/section.h
index e1a27ef514b..5a6d09b4cd4 100644
--- a/engines/m4/riddle/rooms/section.h
+++ b/engines/m4/riddle/rooms/section.h
@@ -41,6 +41,15 @@ public:
void daemon() override;
};
+/**
+ * Dummy section 1, since Riddle doesn't have any rooms in it
+ */
+class Section1 : public Section {
+public:
+ Section1() : Section() {}
+ ~Section1() override {}
+};
+
} // namespace Rooms
} // namespace Riddle
} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room201.cpp b/engines/m4/riddle/rooms/section2/room201.cpp
new file mode 100644
index 00000000000..f1c45a66f46
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room201.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 "m4/riddle/rooms/section2/room201.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room201::init() {
+}
+
+void Room201::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room201.h b/engines/m4/riddle/rooms/section2/room201.h
new file mode 100644
index 00000000000..9bee1ed21dc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room201.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM201_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM201_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room201 : public Room {
+public:
+ Room201() : Room() {}
+ ~Room201() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/room202.cpp b/engines/m4/riddle/rooms/section2/room202.cpp
new file mode 100644
index 00000000000..00491db9dbd
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room202.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 "m4/riddle/rooms/section2/room202.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room202::init() {
+}
+
+void Room202::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room202.h b/engines/m4/riddle/rooms/section2/room202.h
new file mode 100644
index 00000000000..7f0dd603701
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room202.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM202_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM202_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room202 : public Room {
+public:
+ Room202() : Room() {}
+ ~Room202() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/room203.cpp b/engines/m4/riddle/rooms/section2/room203.cpp
new file mode 100644
index 00000000000..e06efb67116
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room203.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 "m4/riddle/rooms/section2/room203.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room203::init() {
+}
+
+void Room203::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room203.h b/engines/m4/riddle/rooms/section2/room203.h
new file mode 100644
index 00000000000..a510e38f459
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room203.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM203_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM203_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room203 : public Room {
+public:
+ Room203() : Room() {}
+ ~Room203() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/room204.cpp b/engines/m4/riddle/rooms/section2/room204.cpp
new file mode 100644
index 00000000000..bdfd2f6f5e3
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room204.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 "m4/riddle/rooms/section2/room204.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room204::init() {
+}
+
+void Room204::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room204.h b/engines/m4/riddle/rooms/section2/room204.h
new file mode 100644
index 00000000000..6152073cc1a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room204.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM204_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM204_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room204 : public Room {
+public:
+ Room204() : Room() {}
+ ~Room204() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/room205.cpp b/engines/m4/riddle/rooms/section2/room205.cpp
new file mode 100644
index 00000000000..57e0135064b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room205.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 "m4/riddle/rooms/section2/room205.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room205::init() {
+}
+
+void Room205::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room205.h b/engines/m4/riddle/rooms/section2/room205.h
new file mode 100644
index 00000000000..25dbfe6b1ec
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room205.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM205_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM205_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room205 : public Room {
+public:
+ Room205() : Room() {}
+ ~Room205() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/room207.cpp b/engines/m4/riddle/rooms/section2/room207.cpp
new file mode 100644
index 00000000000..f5fe1734f33
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room207.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 "m4/riddle/rooms/section2/room207.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room207::init() {
+}
+
+void Room207::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/room207.h b/engines/m4/riddle/rooms/section2/room207.h
new file mode 100644
index 00000000000..3f67f47b65d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/room207.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_ROOM207_H
+#define M4_RIDDLE_ROOMS_SECTION2_ROOM207_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room207 : public Room {
+public:
+ Room207() : Room() {}
+ ~Room207() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section2/section2.cpp b/engines/m4/riddle/rooms/section2/section2.cpp
new file mode 100644
index 00000000000..f50eac469e2
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/section2.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section2/section2.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section2::Section2() : Rooms::Section() {
+ add(201, &_room201);
+ add(202, &_room202);
+ add(203, &_room203);
+ add(204, &_room204);
+ add(205, &_room205);
+ add(207, &_room207);
+}
+
+void Section2::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section2/section2.h b/engines/m4/riddle/rooms/section2/section2.h
new file mode 100644
index 00000000000..badf3b34d46
--- /dev/null
+++ b/engines/m4/riddle/rooms/section2/section2.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION2_H
+#define M4_RIDDLE_ROOMS_SECTION2_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section2/room201.h"
+#include "m4/riddle/rooms/section2/room202.h"
+#include "m4/riddle/rooms/section2/room203.h"
+#include "m4/riddle/rooms/section2/room204.h"
+#include "m4/riddle/rooms/section2/room205.h"
+#include "m4/riddle/rooms/section2/room207.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section2 : public Section {
+private:
+ Room201 _room201;
+ Room202 _room202;
+ Room203 _room203;
+ Room204 _room204;
+ Room205 _room205;
+ Room207 _room207;
+public:
+ Section2();
+ virtual ~Section2() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room301.cpp b/engines/m4/riddle/rooms/section3/room301.cpp
new file mode 100644
index 00000000000..2949b4ec16d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room301.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 "m4/riddle/rooms/section3/room301.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room301::init() {
+}
+
+void Room301::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room301.h b/engines/m4/riddle/rooms/section3/room301.h
new file mode 100644
index 00000000000..ce94b792230
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room301.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM301_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM301_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room301 : public Room {
+public:
+ Room301() : Room() {}
+ ~Room301() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room303.cpp b/engines/m4/riddle/rooms/section3/room303.cpp
new file mode 100644
index 00000000000..086d554d0eb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room303.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 "m4/riddle/rooms/section3/room303.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room303::init() {
+}
+
+void Room303::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room303.h b/engines/m4/riddle/rooms/section3/room303.h
new file mode 100644
index 00000000000..ab42340af44
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room303.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM303_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM303_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room303 : public Room {
+public:
+ Room303() : Room() {}
+ ~Room303() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room304.cpp b/engines/m4/riddle/rooms/section3/room304.cpp
new file mode 100644
index 00000000000..92ea30fbbb7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room304.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 "m4/riddle/rooms/section3/room304.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room304::init() {
+}
+
+void Room304::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room304.h b/engines/m4/riddle/rooms/section3/room304.h
new file mode 100644
index 00000000000..5cdb1b74ade
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room304.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM304_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM304_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room304 : public Room {
+public:
+ Room304() : Room() {}
+ ~Room304() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room305.cpp b/engines/m4/riddle/rooms/section3/room305.cpp
new file mode 100644
index 00000000000..519835c7baf
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room305.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 "m4/riddle/rooms/section3/room305.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room305::init() {
+}
+
+void Room305::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room305.h b/engines/m4/riddle/rooms/section3/room305.h
new file mode 100644
index 00000000000..2e9de70afe8
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room305.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM305_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM305_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room305 : public Room {
+public:
+ Room305() : Room() {}
+ ~Room305() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room309.cpp b/engines/m4/riddle/rooms/section3/room309.cpp
new file mode 100644
index 00000000000..323ccf5050d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room309.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 "m4/riddle/rooms/section3/room309.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room309::init() {
+}
+
+void Room309::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room309.h b/engines/m4/riddle/rooms/section3/room309.h
new file mode 100644
index 00000000000..4b56c37214c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room309.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM309_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM309_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room309 : public Room {
+public:
+ Room309() : Room() {}
+ ~Room309() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room352.cpp b/engines/m4/riddle/rooms/section3/room352.cpp
new file mode 100644
index 00000000000..5b616cf5af0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room352.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 "m4/riddle/rooms/section3/room352.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room352::init() {
+}
+
+void Room352::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room352.h b/engines/m4/riddle/rooms/section3/room352.h
new file mode 100644
index 00000000000..1f4b2569594
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room352.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM352_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM352_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room352 : public Room {
+public:
+ Room352() : Room() {}
+ ~Room352() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/room354.cpp b/engines/m4/riddle/rooms/section3/room354.cpp
new file mode 100644
index 00000000000..504e82e4cc0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room354.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 "m4/riddle/rooms/section3/room354.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room354::init() {
+}
+
+void Room354::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/room354.h b/engines/m4/riddle/rooms/section3/room354.h
new file mode 100644
index 00000000000..341e3703aef
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/room354.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_ROOM354_H
+#define M4_RIDDLE_ROOMS_SECTION3_ROOM354_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room354 : public Room {
+public:
+ Room354() : Room() {}
+ ~Room354() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section3/section3.cpp b/engines/m4/riddle/rooms/section3/section3.cpp
new file mode 100644
index 00000000000..5b82befb699
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/section3.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 "m4/riddle/rooms/section3/section3.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section3::Section3() : Rooms::Section() {
+ add(301, &_room301);
+ add(303, &_room303);
+ add(304, &_room304);
+ add(305, &_room305);
+ add(309, &_room309);
+ add(352, &_room352);
+ add(354, &_room354);
+}
+
+void Section3::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section3/section3.h b/engines/m4/riddle/rooms/section3/section3.h
new file mode 100644
index 00000000000..8eae84ec8d7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section3/section3.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION3_H
+#define M4_RIDDLE_ROOMS_SECTION3_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section3/room301.h"
+#include "m4/riddle/rooms/section3/room303.h"
+#include "m4/riddle/rooms/section3/room304.h"
+#include "m4/riddle/rooms/section3/room305.h"
+#include "m4/riddle/rooms/section3/room309.h"
+#include "m4/riddle/rooms/section3/room352.h"
+#include "m4/riddle/rooms/section3/room354.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section3 : public Section {
+private:
+ Room301 _room301;
+ Room303 _room303;
+ Room304 _room304;
+ Room305 _room305;
+ Room309 _room309;
+ Room352 _room352;
+ Room354 _room354;
+
+public:
+ Section3();
+ virtual ~Section3() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room401.cpp b/engines/m4/riddle/rooms/section4/room401.cpp
new file mode 100644
index 00000000000..9252bb1a4c0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room401.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 "m4/riddle/rooms/section4/room401.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room401::init() {
+}
+
+void Room401::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room401.h b/engines/m4/riddle/rooms/section4/room401.h
new file mode 100644
index 00000000000..2bef956874e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room401.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM401_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM401_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room401 : public Room {
+public:
+ Room401() : Room() {}
+ ~Room401() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room402.cpp b/engines/m4/riddle/rooms/section4/room402.cpp
new file mode 100644
index 00000000000..dea4c43d858
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room402.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 "m4/riddle/rooms/section4/room402.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room402::init() {
+}
+
+void Room402::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room402.h b/engines/m4/riddle/rooms/section4/room402.h
new file mode 100644
index 00000000000..54b06f07a16
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room402.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM402_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM402_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room402 : public Room {
+public:
+ Room402() : Room() {}
+ ~Room402() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room403.cpp b/engines/m4/riddle/rooms/section4/room403.cpp
new file mode 100644
index 00000000000..224cdcf4799
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room403.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 "m4/riddle/rooms/section4/room403.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room403::init() {
+}
+
+void Room403::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room403.h b/engines/m4/riddle/rooms/section4/room403.h
new file mode 100644
index 00000000000..010f5bc0735
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room403.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM403_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM403_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room403 : public Room {
+public:
+ Room403() : Room() {}
+ ~Room403() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room404.cpp b/engines/m4/riddle/rooms/section4/room404.cpp
new file mode 100644
index 00000000000..4577ff34050
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room404.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 "m4/riddle/rooms/section4/room404.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room404::init() {
+}
+
+void Room404::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room404.h b/engines/m4/riddle/rooms/section4/room404.h
new file mode 100644
index 00000000000..12969f8a90b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room404.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM404_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM404_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room404 : public Room {
+public:
+ Room404() : Room() {}
+ ~Room404() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room405.cpp b/engines/m4/riddle/rooms/section4/room405.cpp
new file mode 100644
index 00000000000..405307383b8
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room405.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 "m4/riddle/rooms/section4/room405.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room405::init() {
+}
+
+void Room405::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room405.h b/engines/m4/riddle/rooms/section4/room405.h
new file mode 100644
index 00000000000..e4ddb5548c6
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room405.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM405_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM405_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room405 : public Room {
+public:
+ Room405() : Room() {}
+ ~Room405() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room406.cpp b/engines/m4/riddle/rooms/section4/room406.cpp
new file mode 100644
index 00000000000..7f9a8df4088
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room406.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 "m4/riddle/rooms/section4/room406.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room406::init() {
+}
+
+void Room406::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room406.h b/engines/m4/riddle/rooms/section4/room406.h
new file mode 100644
index 00000000000..89e38a19e50
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room406.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM406_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM406_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room406 : public Room {
+public:
+ Room406() : Room() {}
+ ~Room406() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room407.cpp b/engines/m4/riddle/rooms/section4/room407.cpp
new file mode 100644
index 00000000000..affd3500a2d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room407.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 "m4/riddle/rooms/section4/room407.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room407::init() {
+}
+
+void Room407::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room407.h b/engines/m4/riddle/rooms/section4/room407.h
new file mode 100644
index 00000000000..30904415e4f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room407.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM407_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM407_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room407 : public Room {
+public:
+ Room407() : Room() {}
+ ~Room407() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room408.cpp b/engines/m4/riddle/rooms/section4/room408.cpp
new file mode 100644
index 00000000000..ba192ec27d1
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room408.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 "m4/riddle/rooms/section4/room408.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room408::init() {
+}
+
+void Room408::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room408.h b/engines/m4/riddle/rooms/section4/room408.h
new file mode 100644
index 00000000000..2207625e47b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room408.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM408_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM408_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room408 : public Room {
+public:
+ Room408() : Room() {}
+ ~Room408() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room409.cpp b/engines/m4/riddle/rooms/section4/room409.cpp
new file mode 100644
index 00000000000..8089e7d5ab4
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room409.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 "m4/riddle/rooms/section4/room409.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room409::init() {
+}
+
+void Room409::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room409.h b/engines/m4/riddle/rooms/section4/room409.h
new file mode 100644
index 00000000000..909789c015d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room409.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM409_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM409_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room409 : public Room {
+public:
+ Room409() : Room() {}
+ ~Room409() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room410.cpp b/engines/m4/riddle/rooms/section4/room410.cpp
new file mode 100644
index 00000000000..dfb04fde6c6
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room410.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 "m4/riddle/rooms/section4/room410.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room410::init() {
+}
+
+void Room410::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room410.h b/engines/m4/riddle/rooms/section4/room410.h
new file mode 100644
index 00000000000..ca4644b843e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room410.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM410_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM410_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room410 : public Room {
+public:
+ Room410() : Room() {}
+ ~Room410() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room413.cpp b/engines/m4/riddle/rooms/section4/room413.cpp
new file mode 100644
index 00000000000..92603829032
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room413.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 "m4/riddle/rooms/section4/room413.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room413::init() {
+}
+
+void Room413::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room413.h b/engines/m4/riddle/rooms/section4/room413.h
new file mode 100644
index 00000000000..4404f06be0f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room413.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM413_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM413_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room413 : public Room {
+public:
+ Room413() : Room() {}
+ ~Room413() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room456.cpp b/engines/m4/riddle/rooms/section4/room456.cpp
new file mode 100644
index 00000000000..2eb0bed3cb7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room456.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 "m4/riddle/rooms/section4/room456.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room456::init() {
+}
+
+void Room456::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room456.h b/engines/m4/riddle/rooms/section4/room456.h
new file mode 100644
index 00000000000..a2435abcdf1
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room456.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM456_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM456_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room456 : public Room {
+public:
+ Room456() : Room() {}
+ ~Room456() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room493.cpp b/engines/m4/riddle/rooms/section4/room493.cpp
new file mode 100644
index 00000000000..96266ba25f5
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room493.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 "m4/riddle/rooms/section4/room493.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room493::init() {
+}
+
+void Room493::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room493.h b/engines/m4/riddle/rooms/section4/room493.h
new file mode 100644
index 00000000000..a2d882238b3
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room493.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM493_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM493_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room493 : public Room {
+public:
+ Room493() : Room() {}
+ ~Room493() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room494.cpp b/engines/m4/riddle/rooms/section4/room494.cpp
new file mode 100644
index 00000000000..118f446010b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room494.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 "m4/riddle/rooms/section4/room494.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room494::init() {
+}
+
+void Room494::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room494.h b/engines/m4/riddle/rooms/section4/room494.h
new file mode 100644
index 00000000000..c4838d0b24b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room494.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM494_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM494_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room494 : public Room {
+public:
+ Room494() : Room() {}
+ ~Room494() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/room495.cpp b/engines/m4/riddle/rooms/section4/room495.cpp
new file mode 100644
index 00000000000..a0f711925c6
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room495.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 "m4/riddle/rooms/section4/room495.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room495::init() {
+}
+
+void Room495::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/room495.h b/engines/m4/riddle/rooms/section4/room495.h
new file mode 100644
index 00000000000..b896205538c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/room495.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_ROOM495_H
+#define M4_RIDDLE_ROOMS_SECTION4_ROOM495_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room495 : public Room {
+public:
+ Room495() : Room() {}
+ ~Room495() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section4/section4.cpp b/engines/m4/riddle/rooms/section4/section4.cpp
new file mode 100644
index 00000000000..016c203d76e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/section4.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section4/section4.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section4::Section4() : Rooms::Section() {
+ add(401, &_room401);
+ add(402, &_room402);
+ add(403, &_room403);
+ add(404, &_room404);
+ add(405, &_room405);
+ add(406, &_room406);
+ add(407, &_room407);
+ add(408, &_room408);
+ add(409, &_room409);
+ add(410, &_room410);
+ add(413, &_room413);
+ add(456, &_room456);
+ add(493, &_room493);
+ add(494, &_room494);
+ add(495, &_room495);
+}
+
+void Section4::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section4/section4.h b/engines/m4/riddle/rooms/section4/section4.h
new file mode 100644
index 00000000000..e91f825e81d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section4/section4.h
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION4_H
+#define M4_RIDDLE_ROOMS_SECTION4_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section4/room401.h"
+#include "m4/riddle/rooms/section4/room402.h"
+#include "m4/riddle/rooms/section4/room403.h"
+#include "m4/riddle/rooms/section4/room404.h"
+#include "m4/riddle/rooms/section4/room405.h"
+#include "m4/riddle/rooms/section4/room406.h"
+#include "m4/riddle/rooms/section4/room407.h"
+#include "m4/riddle/rooms/section4/room408.h"
+#include "m4/riddle/rooms/section4/room409.h"
+#include "m4/riddle/rooms/section4/room410.h"
+#include "m4/riddle/rooms/section4/room413.h"
+#include "m4/riddle/rooms/section4/room456.h"
+#include "m4/riddle/rooms/section4/room493.h"
+#include "m4/riddle/rooms/section4/room494.h"
+#include "m4/riddle/rooms/section4/room495.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section4 : public Section {
+private:
+ Room401 _room401;
+ Room402 _room402;
+ Room403 _room403;
+ Room404 _room404;
+ Room405 _room405;
+ Room406 _room406;
+ Room407 _room407;
+ Room408 _room408;
+ Room409 _room409;
+ Room410 _room410;
+ Room413 _room413;
+ Room456 _room456;
+ Room493 _room493;
+ Room494 _room494;
+ Room495 _room495;
+
+public:
+ Section4();
+ virtual ~Section4() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room501.cpp b/engines/m4/riddle/rooms/section5/room501.cpp
new file mode 100644
index 00000000000..b559eb9f7e0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room501.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 "m4/riddle/rooms/section5/room501.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room501::init() {
+}
+
+void Room501::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room501.h b/engines/m4/riddle/rooms/section5/room501.h
new file mode 100644
index 00000000000..897788b3240
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room501.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM501_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM501_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room501 : public Room {
+public:
+ Room501() : Room() {}
+ ~Room501() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room504.cpp b/engines/m4/riddle/rooms/section5/room504.cpp
new file mode 100644
index 00000000000..7a01cf2fadc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room504.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 "m4/riddle/rooms/section5/room504.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room504::init() {
+}
+
+void Room504::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room504.h b/engines/m4/riddle/rooms/section5/room504.h
new file mode 100644
index 00000000000..808052538f9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room504.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM504_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM504_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room504 : public Room {
+public:
+ Room504() : Room() {}
+ ~Room504() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room506.cpp b/engines/m4/riddle/rooms/section5/room506.cpp
new file mode 100644
index 00000000000..a11f86e92c8
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room506.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 "m4/riddle/rooms/section5/room506.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room506::init() {
+}
+
+void Room506::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room506.h b/engines/m4/riddle/rooms/section5/room506.h
new file mode 100644
index 00000000000..cbe95d27a9e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room506.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM506_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM506_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room506 : public Room {
+public:
+ Room506() : Room() {}
+ ~Room506() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room507.cpp b/engines/m4/riddle/rooms/section5/room507.cpp
new file mode 100644
index 00000000000..c2c9921ef83
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room507.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 "m4/riddle/rooms/section5/room507.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room507::init() {
+}
+
+void Room507::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room507.h b/engines/m4/riddle/rooms/section5/room507.h
new file mode 100644
index 00000000000..8e600b11aec
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room507.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM507_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM507_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room507 : public Room {
+public:
+ Room507() : Room() {}
+ ~Room507() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room508.cpp b/engines/m4/riddle/rooms/section5/room508.cpp
new file mode 100644
index 00000000000..358f134adeb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room508.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 "m4/riddle/rooms/section5/room508.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room508::init() {
+}
+
+void Room508::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room508.h b/engines/m4/riddle/rooms/section5/room508.h
new file mode 100644
index 00000000000..3e7ae38d695
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room508.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM508_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM508_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room508 : public Room {
+public:
+ Room508() : Room() {}
+ ~Room508() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room509.cpp b/engines/m4/riddle/rooms/section5/room509.cpp
new file mode 100644
index 00000000000..7e65812549b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room509.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 "m4/riddle/rooms/section5/room509.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room509::init() {
+}
+
+void Room509::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room509.h b/engines/m4/riddle/rooms/section5/room509.h
new file mode 100644
index 00000000000..0b2ced7180c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room509.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM509_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM509_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room509 : public Room {
+public:
+ Room509() : Room() {}
+ ~Room509() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/room510.cpp b/engines/m4/riddle/rooms/section5/room510.cpp
new file mode 100644
index 00000000000..012734ab951
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room510.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 "m4/riddle/rooms/section5/room510.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room510::init() {
+}
+
+void Room510::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/room510.h b/engines/m4/riddle/rooms/section5/room510.h
new file mode 100644
index 00000000000..8d458a9ab30
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/room510.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_ROOM510_H
+#define M4_RIDDLE_ROOMS_SECTION5_ROOM510_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room510 : public Room {
+public:
+ Room510() : Room() {}
+ ~Room510() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section5/section5.cpp b/engines/m4/riddle/rooms/section5/section5.cpp
new file mode 100644
index 00000000000..fbf1e2a57d9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/section5.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 "m4/riddle/rooms/section5/section5.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section5::Section5() : Rooms::Section() {
+ add(501, &_room501);
+ add(504, &_room504);
+ add(506, &_room506);
+ add(507, &_room507);
+ add(508, &_room508);
+ add(509, &_room509);
+ add(510, &_room510);
+}
+
+void Section5::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section5/section5.h b/engines/m4/riddle/rooms/section5/section5.h
new file mode 100644
index 00000000000..45d35828f53
--- /dev/null
+++ b/engines/m4/riddle/rooms/section5/section5.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION5_H
+#define M4_RIDDLE_ROOMS_SECTION5_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section5/room501.h"
+#include "m4/riddle/rooms/section5/room504.h"
+#include "m4/riddle/rooms/section5/room506.h"
+#include "m4/riddle/rooms/section5/room507.h"
+#include "m4/riddle/rooms/section5/room508.h"
+#include "m4/riddle/rooms/section5/room509.h"
+#include "m4/riddle/rooms/section5/room510.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section5 : public Section {
+private:
+ Room501 _room501;
+ Room504 _room504;
+ Room506 _room506;
+ Room507 _room507;
+ Room508 _room508;
+ Room509 _room509;
+ Room510 _room510;
+
+public:
+ Section5();
+ virtual ~Section5() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room603.cpp b/engines/m4/riddle/rooms/section6/room603.cpp
new file mode 100644
index 00000000000..f618281c375
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room603.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 "m4/riddle/rooms/section6/room603.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room603::init() {
+}
+
+void Room603::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room603.h b/engines/m4/riddle/rooms/section6/room603.h
new file mode 100644
index 00000000000..a65ef6a0c4a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room603.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM603_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM603_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room603 : public Room {
+public:
+ Room603() : Room() {}
+ ~Room603() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room604.cpp b/engines/m4/riddle/rooms/section6/room604.cpp
new file mode 100644
index 00000000000..6f7dda4fc40
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room604.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 "m4/riddle/rooms/section6/room604.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room604::init() {
+}
+
+void Room604::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room604.h b/engines/m4/riddle/rooms/section6/room604.h
new file mode 100644
index 00000000000..5c4163b3fa7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room604.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM604_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM604_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room604 : public Room {
+public:
+ Room604() : Room() {}
+ ~Room604() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room605.cpp b/engines/m4/riddle/rooms/section6/room605.cpp
new file mode 100644
index 00000000000..90047e1002d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room605.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 "m4/riddle/rooms/section6/room605.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room605::init() {
+}
+
+void Room605::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room605.h b/engines/m4/riddle/rooms/section6/room605.h
new file mode 100644
index 00000000000..009e636a62a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room605.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM605_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM605_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room605 : public Room {
+public:
+ Room605() : Room() {}
+ ~Room605() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room607.cpp b/engines/m4/riddle/rooms/section6/room607.cpp
new file mode 100644
index 00000000000..90486338e88
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room607.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 "m4/riddle/rooms/section6/room607.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room607::init() {
+}
+
+void Room607::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room607.h b/engines/m4/riddle/rooms/section6/room607.h
new file mode 100644
index 00000000000..b5245a946e0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room607.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM607_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM607_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room607 : public Room {
+public:
+ Room607() : Room() {}
+ ~Room607() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room608.cpp b/engines/m4/riddle/rooms/section6/room608.cpp
new file mode 100644
index 00000000000..be82f7f085d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room608.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 "m4/riddle/rooms/section6/room608.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room608::init() {
+}
+
+void Room608::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room608.h b/engines/m4/riddle/rooms/section6/room608.h
new file mode 100644
index 00000000000..3e6ff45cdb6
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room608.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM608_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM608_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room608 : public Room {
+public:
+ Room608() : Room() {}
+ ~Room608() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room610.cpp b/engines/m4/riddle/rooms/section6/room610.cpp
new file mode 100644
index 00000000000..71a3c3aa4b0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room610.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 "m4/riddle/rooms/section6/room610.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room610::init() {
+}
+
+void Room610::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room610.h b/engines/m4/riddle/rooms/section6/room610.h
new file mode 100644
index 00000000000..5c438ebf26b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room610.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM610_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM610_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room610 : public Room {
+public:
+ Room610() : Room() {}
+ ~Room610() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room615.cpp b/engines/m4/riddle/rooms/section6/room615.cpp
new file mode 100644
index 00000000000..611b8cf79c5
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room615.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 "m4/riddle/rooms/section6/room615.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room615::init() {
+}
+
+void Room615::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room615.h b/engines/m4/riddle/rooms/section6/room615.h
new file mode 100644
index 00000000000..a1b92d9fbd4
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room615.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM615_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM615_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room615 : public Room {
+public:
+ Room615() : Room() {}
+ ~Room615() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room620.cpp b/engines/m4/riddle/rooms/section6/room620.cpp
new file mode 100644
index 00000000000..508d471d6bb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room620.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 "m4/riddle/rooms/section6/room620.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room620::init() {
+}
+
+void Room620::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room620.h b/engines/m4/riddle/rooms/section6/room620.h
new file mode 100644
index 00000000000..547ee2ef975
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room620.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM620_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM620_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room620 : public Room {
+public:
+ Room620() : Room() {}
+ ~Room620() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room621.cpp b/engines/m4/riddle/rooms/section6/room621.cpp
new file mode 100644
index 00000000000..8d6d469c362
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room621.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 "m4/riddle/rooms/section6/room621.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room621::init() {
+}
+
+void Room621::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room621.h b/engines/m4/riddle/rooms/section6/room621.h
new file mode 100644
index 00000000000..c3d70e97292
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room621.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM621_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM621_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room621 : public Room {
+public:
+ Room621() : Room() {}
+ ~Room621() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room622.cpp b/engines/m4/riddle/rooms/section6/room622.cpp
new file mode 100644
index 00000000000..474826a982f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room622.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 "m4/riddle/rooms/section6/room622.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room622::init() {
+}
+
+void Room622::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room622.h b/engines/m4/riddle/rooms/section6/room622.h
new file mode 100644
index 00000000000..e6f89d89cbc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room622.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM622_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM622_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room622 : public Room {
+public:
+ Room622() : Room() {}
+ ~Room622() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room623.cpp b/engines/m4/riddle/rooms/section6/room623.cpp
new file mode 100644
index 00000000000..0eb345d3573
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room623.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 "m4/riddle/rooms/section6/room623.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room623::init() {
+}
+
+void Room623::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room623.h b/engines/m4/riddle/rooms/section6/room623.h
new file mode 100644
index 00000000000..bf99b81c591
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room623.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM623_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM623_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room623 : public Room {
+public:
+ Room623() : Room() {}
+ ~Room623() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room624.cpp b/engines/m4/riddle/rooms/section6/room624.cpp
new file mode 100644
index 00000000000..c2aad3e4038
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room624.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 "m4/riddle/rooms/section6/room624.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room624::init() {
+}
+
+void Room624::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room624.h b/engines/m4/riddle/rooms/section6/room624.h
new file mode 100644
index 00000000000..f394ed3a2d9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room624.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM624_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM624_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room624 : public Room {
+public:
+ Room624() : Room() {}
+ ~Room624() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room625.cpp b/engines/m4/riddle/rooms/section6/room625.cpp
new file mode 100644
index 00000000000..8949b25670d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room625.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 "m4/riddle/rooms/section6/room625.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room625::init() {
+}
+
+void Room625::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room625.h b/engines/m4/riddle/rooms/section6/room625.h
new file mode 100644
index 00000000000..9183ae3c0ef
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room625.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM625_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM625_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room625 : public Room {
+public:
+ Room625() : Room() {}
+ ~Room625() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room626.cpp b/engines/m4/riddle/rooms/section6/room626.cpp
new file mode 100644
index 00000000000..772e352e7cc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room626.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 "m4/riddle/rooms/section6/room626.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room626::init() {
+}
+
+void Room626::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room626.h b/engines/m4/riddle/rooms/section6/room626.h
new file mode 100644
index 00000000000..7cc399ac7b4
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room626.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM626_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM626_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room626 : public Room {
+public:
+ Room626() : Room() {}
+ ~Room626() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room627.cpp b/engines/m4/riddle/rooms/section6/room627.cpp
new file mode 100644
index 00000000000..d6f2a4bf4d2
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room627.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 "m4/riddle/rooms/section6/room627.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room627::init() {
+}
+
+void Room627::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room627.h b/engines/m4/riddle/rooms/section6/room627.h
new file mode 100644
index 00000000000..f37547ffcfa
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room627.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM627_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM627_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room627 : public Room {
+public:
+ Room627() : Room() {}
+ ~Room627() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room628.cpp b/engines/m4/riddle/rooms/section6/room628.cpp
new file mode 100644
index 00000000000..366e98780ab
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room628.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 "m4/riddle/rooms/section6/room628.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room628::init() {
+}
+
+void Room628::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room628.h b/engines/m4/riddle/rooms/section6/room628.h
new file mode 100644
index 00000000000..ea2ee845315
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room628.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM628_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM628_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room628 : public Room {
+public:
+ Room628() : Room() {}
+ ~Room628() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room629.cpp b/engines/m4/riddle/rooms/section6/room629.cpp
new file mode 100644
index 00000000000..17ae37cbd03
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room629.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 "m4/riddle/rooms/section6/room629.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room629::init() {
+}
+
+void Room629::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room629.h b/engines/m4/riddle/rooms/section6/room629.h
new file mode 100644
index 00000000000..6c2524ab7ea
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room629.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM629_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM629_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room629 : public Room {
+public:
+ Room629() : Room() {}
+ ~Room629() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room630.cpp b/engines/m4/riddle/rooms/section6/room630.cpp
new file mode 100644
index 00000000000..1f6a8521e43
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room630.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 "m4/riddle/rooms/section6/room630.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room630::init() {
+}
+
+void Room630::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room630.h b/engines/m4/riddle/rooms/section6/room630.h
new file mode 100644
index 00000000000..152e8de3b9c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room630.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM630_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM630_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room630 : public Room {
+public:
+ Room630() : Room() {}
+ ~Room630() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room631.cpp b/engines/m4/riddle/rooms/section6/room631.cpp
new file mode 100644
index 00000000000..f70580401bc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room631.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 "m4/riddle/rooms/section6/room631.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room631::init() {
+}
+
+void Room631::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room631.h b/engines/m4/riddle/rooms/section6/room631.h
new file mode 100644
index 00000000000..4a4186c3988
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room631.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM631_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM631_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room631 : public Room {
+public:
+ Room631() : Room() {}
+ ~Room631() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room632.cpp b/engines/m4/riddle/rooms/section6/room632.cpp
new file mode 100644
index 00000000000..6f823d82461
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room632.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 "m4/riddle/rooms/section6/room632.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room632::init() {
+}
+
+void Room632::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room632.h b/engines/m4/riddle/rooms/section6/room632.h
new file mode 100644
index 00000000000..129290cd8f9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room632.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM632_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM632_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room632 : public Room {
+public:
+ Room632() : Room() {}
+ ~Room632() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room633.cpp b/engines/m4/riddle/rooms/section6/room633.cpp
new file mode 100644
index 00000000000..ee31e8c3376
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room633.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 "m4/riddle/rooms/section6/room633.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room633::init() {
+}
+
+void Room633::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room633.h b/engines/m4/riddle/rooms/section6/room633.h
new file mode 100644
index 00000000000..5130f28c25c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room633.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM633_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM633_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room633 : public Room {
+public:
+ Room633() : Room() {}
+ ~Room633() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room634.cpp b/engines/m4/riddle/rooms/section6/room634.cpp
new file mode 100644
index 00000000000..333bf946491
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room634.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 "m4/riddle/rooms/section6/room634.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room634::init() {
+}
+
+void Room634::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room634.h b/engines/m4/riddle/rooms/section6/room634.h
new file mode 100644
index 00000000000..2fe9e6d58ee
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room634.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM634_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM634_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room634 : public Room {
+public:
+ Room634() : Room() {}
+ ~Room634() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room635.cpp b/engines/m4/riddle/rooms/section6/room635.cpp
new file mode 100644
index 00000000000..1022a5ea13b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room635.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 "m4/riddle/rooms/section6/room635.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room635::init() {
+}
+
+void Room635::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room635.h b/engines/m4/riddle/rooms/section6/room635.h
new file mode 100644
index 00000000000..8a3cdc399cb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room635.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM635_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM635_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room635 : public Room {
+public:
+ Room635() : Room() {}
+ ~Room635() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room636.cpp b/engines/m4/riddle/rooms/section6/room636.cpp
new file mode 100644
index 00000000000..dc77b8b8abe
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room636.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 "m4/riddle/rooms/section6/room636.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room636::init() {
+}
+
+void Room636::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room636.h b/engines/m4/riddle/rooms/section6/room636.h
new file mode 100644
index 00000000000..4a86f7c3225
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room636.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM636_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM636_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room636 : public Room {
+public:
+ Room636() : Room() {}
+ ~Room636() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room637.cpp b/engines/m4/riddle/rooms/section6/room637.cpp
new file mode 100644
index 00000000000..af20d1a120f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room637.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 "m4/riddle/rooms/section6/room637.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room637::init() {
+}
+
+void Room637::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room637.h b/engines/m4/riddle/rooms/section6/room637.h
new file mode 100644
index 00000000000..9d4f160548c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room637.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM637_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM637_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room637 : public Room {
+public:
+ Room637() : Room() {}
+ ~Room637() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room638.cpp b/engines/m4/riddle/rooms/section6/room638.cpp
new file mode 100644
index 00000000000..0275e71e560
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room638.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 "m4/riddle/rooms/section6/room638.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room638::init() {
+}
+
+void Room638::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room638.h b/engines/m4/riddle/rooms/section6/room638.h
new file mode 100644
index 00000000000..ce09b387a7c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room638.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM638_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM638_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room638 : public Room {
+public:
+ Room638() : Room() {}
+ ~Room638() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room640.cpp b/engines/m4/riddle/rooms/section6/room640.cpp
new file mode 100644
index 00000000000..aa8674b6e64
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room640.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 "m4/riddle/rooms/section6/room640.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room640::init() {
+}
+
+void Room640::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room640.h b/engines/m4/riddle/rooms/section6/room640.h
new file mode 100644
index 00000000000..13e9e674e2c
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room640.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM640_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM640_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room640 : public Room {
+public:
+ Room640() : Room() {}
+ ~Room640() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room641.cpp b/engines/m4/riddle/rooms/section6/room641.cpp
new file mode 100644
index 00000000000..fac67eabe8a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room641.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 "m4/riddle/rooms/section6/room641.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room641::init() {
+}
+
+void Room641::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room641.h b/engines/m4/riddle/rooms/section6/room641.h
new file mode 100644
index 00000000000..ec1627fdb25
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room641.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM641_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM641_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room641 : public Room {
+public:
+ Room641() : Room() {}
+ ~Room641() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room642.cpp b/engines/m4/riddle/rooms/section6/room642.cpp
new file mode 100644
index 00000000000..7bf3ce59099
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room642.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 "m4/riddle/rooms/section6/room642.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room642::init() {
+}
+
+void Room642::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room642.h b/engines/m4/riddle/rooms/section6/room642.h
new file mode 100644
index 00000000000..1c121172bd9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room642.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM642_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM642_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room642 : public Room {
+public:
+ Room642() : Room() {}
+ ~Room642() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room643.cpp b/engines/m4/riddle/rooms/section6/room643.cpp
new file mode 100644
index 00000000000..5a8483d9bec
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room643.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 "m4/riddle/rooms/section6/room643.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room643::init() {
+}
+
+void Room643::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room643.h b/engines/m4/riddle/rooms/section6/room643.h
new file mode 100644
index 00000000000..17f50d8af5b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room643.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM643_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM643_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room643 : public Room {
+public:
+ Room643() : Room() {}
+ ~Room643() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room644.cpp b/engines/m4/riddle/rooms/section6/room644.cpp
new file mode 100644
index 00000000000..21b64dd415f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room644.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 "m4/riddle/rooms/section6/room644.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room644::init() {
+}
+
+void Room644::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room644.h b/engines/m4/riddle/rooms/section6/room644.h
new file mode 100644
index 00000000000..43f8cb6b608
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room644.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM644_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM644_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room644 : public Room {
+public:
+ Room644() : Room() {}
+ ~Room644() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room645.cpp b/engines/m4/riddle/rooms/section6/room645.cpp
new file mode 100644
index 00000000000..d859e106c5e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room645.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 "m4/riddle/rooms/section6/room645.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room645::init() {
+}
+
+void Room645::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room645.h b/engines/m4/riddle/rooms/section6/room645.h
new file mode 100644
index 00000000000..edb12f64631
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room645.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM645_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM645_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room645 : public Room {
+public:
+ Room645() : Room() {}
+ ~Room645() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room646.cpp b/engines/m4/riddle/rooms/section6/room646.cpp
new file mode 100644
index 00000000000..87a2c9378fe
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room646.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 "m4/riddle/rooms/section6/room646.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room646::init() {
+}
+
+void Room646::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room646.h b/engines/m4/riddle/rooms/section6/room646.h
new file mode 100644
index 00000000000..194aade8bdd
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room646.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM646_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM646_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room646 : public Room {
+public:
+ Room646() : Room() {}
+ ~Room646() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room647.cpp b/engines/m4/riddle/rooms/section6/room647.cpp
new file mode 100644
index 00000000000..ab29d1ff9aa
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room647.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 "m4/riddle/rooms/section6/room647.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room647::init() {
+}
+
+void Room647::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room647.h b/engines/m4/riddle/rooms/section6/room647.h
new file mode 100644
index 00000000000..bee302ce500
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room647.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM647_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM647_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room647 : public Room {
+public:
+ Room647() : Room() {}
+ ~Room647() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room648.cpp b/engines/m4/riddle/rooms/section6/room648.cpp
new file mode 100644
index 00000000000..2e3a753c5a5
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room648.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 "m4/riddle/rooms/section6/room648.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room648::init() {
+}
+
+void Room648::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room648.h b/engines/m4/riddle/rooms/section6/room648.h
new file mode 100644
index 00000000000..3dce08e9754
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room648.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM648_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM648_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room648 : public Room {
+public:
+ Room648() : Room() {}
+ ~Room648() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room649.cpp b/engines/m4/riddle/rooms/section6/room649.cpp
new file mode 100644
index 00000000000..03ec13003ff
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room649.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 "m4/riddle/rooms/section6/room649.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room649::init() {
+}
+
+void Room649::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room649.h b/engines/m4/riddle/rooms/section6/room649.h
new file mode 100644
index 00000000000..f0d6a07a957
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room649.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM649_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM649_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room649 : public Room {
+public:
+ Room649() : Room() {}
+ ~Room649() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room650.cpp b/engines/m4/riddle/rooms/section6/room650.cpp
new file mode 100644
index 00000000000..ca830a3c829
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room650.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 "m4/riddle/rooms/section6/room650.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room650::init() {
+}
+
+void Room650::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room650.h b/engines/m4/riddle/rooms/section6/room650.h
new file mode 100644
index 00000000000..56ce737b038
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room650.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM650_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM650_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room650 : public Room {
+public:
+ Room650() : Room() {}
+ ~Room650() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/room651.cpp b/engines/m4/riddle/rooms/section6/room651.cpp
new file mode 100644
index 00000000000..e5b4efca628
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room651.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 "m4/riddle/rooms/section6/room651.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room651::init() {
+}
+
+void Room651::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/room651.h b/engines/m4/riddle/rooms/section6/room651.h
new file mode 100644
index 00000000000..2909143cd4b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/room651.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_ROOM651_H
+#define M4_RIDDLE_ROOMS_SECTION6_ROOM651_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room651 : public Room {
+public:
+ Room651() : Room() {}
+ ~Room651() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section6/section6.cpp b/engines/m4/riddle/rooms/section6/section6.cpp
new file mode 100644
index 00000000000..f921ed2d687
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/section6.cpp
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section6/section6.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section6::Section6() : Rooms::Section() {
+ add(603, &_room603);
+ add(604, &_room604);
+ add(605, &_room605);
+ add(607, &_room607);
+ add(608, &_room608);
+ add(610, &_room610);
+ add(615, &_room615);
+ add(620, &_room620);
+ add(621, &_room621);
+ add(622, &_room622);
+ add(623, &_room623);
+ add(624, &_room624);
+ add(625, &_room625);
+ add(626, &_room626);
+ add(627, &_room627);
+ add(628, &_room628);
+ add(629, &_room629);
+ add(630, &_room630);
+ add(631, &_room631);
+ add(632, &_room632);
+ add(633, &_room633);
+ add(634, &_room634);
+ add(635, &_room635);
+ add(636, &_room636);
+ add(637, &_room637);
+ add(638, &_room638);
+ add(640, &_room640);
+ add(641, &_room641);
+ add(642, &_room642);
+ add(643, &_room643);
+ add(644, &_room644);
+ add(645, &_room645);
+ add(646, &_room646);
+ add(647, &_room647);
+ add(648, &_room648);
+ add(649, &_room649);
+ add(650, &_room650);
+ add(651, &_room651);
+}
+
+void Section6::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section6/section6.h b/engines/m4/riddle/rooms/section6/section6.h
new file mode 100644
index 00000000000..54c68ab9993
--- /dev/null
+++ b/engines/m4/riddle/rooms/section6/section6.h
@@ -0,0 +1,121 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION6_H
+#define M4_RIDDLE_ROOMS_SECTION6_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section6/room603.h"
+#include "m4/riddle/rooms/section6/room604.h"
+#include "m4/riddle/rooms/section6/room605.h"
+#include "m4/riddle/rooms/section6/room607.h"
+#include "m4/riddle/rooms/section6/room608.h"
+#include "m4/riddle/rooms/section6/room610.h"
+#include "m4/riddle/rooms/section6/room615.h"
+#include "m4/riddle/rooms/section6/room620.h"
+#include "m4/riddle/rooms/section6/room621.h"
+#include "m4/riddle/rooms/section6/room622.h"
+#include "m4/riddle/rooms/section6/room623.h"
+#include "m4/riddle/rooms/section6/room624.h"
+#include "m4/riddle/rooms/section6/room625.h"
+#include "m4/riddle/rooms/section6/room626.h"
+#include "m4/riddle/rooms/section6/room627.h"
+#include "m4/riddle/rooms/section6/room628.h"
+#include "m4/riddle/rooms/section6/room629.h"
+#include "m4/riddle/rooms/section6/room630.h"
+#include "m4/riddle/rooms/section6/room631.h"
+#include "m4/riddle/rooms/section6/room632.h"
+#include "m4/riddle/rooms/section6/room633.h"
+#include "m4/riddle/rooms/section6/room634.h"
+#include "m4/riddle/rooms/section6/room635.h"
+#include "m4/riddle/rooms/section6/room636.h"
+#include "m4/riddle/rooms/section6/room637.h"
+#include "m4/riddle/rooms/section6/room638.h"
+#include "m4/riddle/rooms/section6/room640.h"
+#include "m4/riddle/rooms/section6/room641.h"
+#include "m4/riddle/rooms/section6/room642.h"
+#include "m4/riddle/rooms/section6/room643.h"
+#include "m4/riddle/rooms/section6/room644.h"
+#include "m4/riddle/rooms/section6/room645.h"
+#include "m4/riddle/rooms/section6/room646.h"
+#include "m4/riddle/rooms/section6/room647.h"
+#include "m4/riddle/rooms/section6/room648.h"
+#include "m4/riddle/rooms/section6/room649.h"
+#include "m4/riddle/rooms/section6/room650.h"
+#include "m4/riddle/rooms/section6/room651.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section6 : public Section {
+private:
+ Room603 _room603;
+ Room604 _room604;
+ Room605 _room605;
+ Room607 _room607;
+ Room608 _room608;
+ Room610 _room610;
+ Room615 _room615;
+ Room620 _room620;
+ Room621 _room621;
+ Room622 _room622;
+ Room623 _room623;
+ Room624 _room624;
+ Room625 _room625;
+ Room626 _room626;
+ Room627 _room627;
+ Room628 _room628;
+ Room629 _room629;
+ Room630 _room630;
+ Room631 _room631;
+ Room632 _room632;
+ Room633 _room633;
+ Room634 _room634;
+ Room635 _room635;
+ Room636 _room636;
+ Room637 _room637;
+ Room638 _room638;
+ Room640 _room640;
+ Room641 _room641;
+ Room642 _room642;
+ Room643 _room643;
+ Room644 _room644;
+ Room645 _room645;
+ Room646 _room646;
+ Room647 _room647;
+ Room648 _room648;
+ Room649 _room649;
+ Room650 _room650;
+ Room651 _room651;
+
+public:
+ Section6();
+ virtual ~Section6() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room701.cpp b/engines/m4/riddle/rooms/section7/room701.cpp
new file mode 100644
index 00000000000..c678446ea4a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room701.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 "m4/riddle/rooms/section7/room701.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room701::init() {
+}
+
+void Room701::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room701.h b/engines/m4/riddle/rooms/section7/room701.h
new file mode 100644
index 00000000000..8420bd65578
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room701.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM701_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM701_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room701 : public Room {
+public:
+ Room701() : Room() {}
+ ~Room701() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room702.cpp b/engines/m4/riddle/rooms/section7/room702.cpp
new file mode 100644
index 00000000000..7d8aced7593
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room702.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 "m4/riddle/rooms/section7/room702.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room702::init() {
+}
+
+void Room702::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room702.h b/engines/m4/riddle/rooms/section7/room702.h
new file mode 100644
index 00000000000..eecfc45595e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room702.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM702_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM702_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room702 : public Room {
+public:
+ Room702() : Room() {}
+ ~Room702() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room703.cpp b/engines/m4/riddle/rooms/section7/room703.cpp
new file mode 100644
index 00000000000..db60eb67524
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room703.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 "m4/riddle/rooms/section7/room703.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room703::init() {
+}
+
+void Room703::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room703.h b/engines/m4/riddle/rooms/section7/room703.h
new file mode 100644
index 00000000000..a1ecc331b59
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room703.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM703_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM703_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room703 : public Room {
+public:
+ Room703() : Room() {}
+ ~Room703() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room704.cpp b/engines/m4/riddle/rooms/section7/room704.cpp
new file mode 100644
index 00000000000..a674c6eab8d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room704.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 "m4/riddle/rooms/section7/room704.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room704::init() {
+}
+
+void Room704::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room704.h b/engines/m4/riddle/rooms/section7/room704.h
new file mode 100644
index 00000000000..223e467a2f6
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room704.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM704_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM704_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room704 : public Room {
+public:
+ Room704() : Room() {}
+ ~Room704() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room705.cpp b/engines/m4/riddle/rooms/section7/room705.cpp
new file mode 100644
index 00000000000..add327508e0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room705.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 "m4/riddle/rooms/section7/room705.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room705::init() {
+}
+
+void Room705::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room705.h b/engines/m4/riddle/rooms/section7/room705.h
new file mode 100644
index 00000000000..641592cef3f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room705.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM705_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM705_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room705 : public Room {
+public:
+ Room705() : Room() {}
+ ~Room705() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room706.cpp b/engines/m4/riddle/rooms/section7/room706.cpp
new file mode 100644
index 00000000000..b4a05e21694
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room706.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 "m4/riddle/rooms/section7/room706.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room706::init() {
+}
+
+void Room706::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room706.h b/engines/m4/riddle/rooms/section7/room706.h
new file mode 100644
index 00000000000..15c1de2c0ed
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room706.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM706_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM706_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room706 : public Room {
+public:
+ Room706() : Room() {}
+ ~Room706() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room707.cpp b/engines/m4/riddle/rooms/section7/room707.cpp
new file mode 100644
index 00000000000..0cd2144505d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room707.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 "m4/riddle/rooms/section7/room707.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room707::init() {
+}
+
+void Room707::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room707.h b/engines/m4/riddle/rooms/section7/room707.h
new file mode 100644
index 00000000000..2d3c50bfbc7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room707.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM707_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM707_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room707 : public Room {
+public:
+ Room707() : Room() {}
+ ~Room707() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room709.cpp b/engines/m4/riddle/rooms/section7/room709.cpp
new file mode 100644
index 00000000000..20b9bb49ecf
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room709.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 "m4/riddle/rooms/section7/room709.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room709::init() {
+}
+
+void Room709::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room709.h b/engines/m4/riddle/rooms/section7/room709.h
new file mode 100644
index 00000000000..0f230bb22e3
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room709.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM709_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM709_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room709 : public Room {
+public:
+ Room709() : Room() {}
+ ~Room709() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room710.cpp b/engines/m4/riddle/rooms/section7/room710.cpp
new file mode 100644
index 00000000000..0bc1d2bbd6b
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room710.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 "m4/riddle/rooms/section7/room710.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room710::init() {
+}
+
+void Room710::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room710.h b/engines/m4/riddle/rooms/section7/room710.h
new file mode 100644
index 00000000000..f8458e2f48d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room710.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM710_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM710_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room710 : public Room {
+public:
+ Room710() : Room() {}
+ ~Room710() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/room711.cpp b/engines/m4/riddle/rooms/section7/room711.cpp
new file mode 100644
index 00000000000..2c55e30dc2f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room711.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 "m4/riddle/rooms/section7/room711.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room711::init() {
+}
+
+void Room711::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/room711.h b/engines/m4/riddle/rooms/section7/room711.h
new file mode 100644
index 00000000000..541d0159978
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/room711.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_ROOM711_H
+#define M4_RIDDLE_ROOMS_SECTION7_ROOM711_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room711 : public Room {
+public:
+ Room711() : Room() {}
+ ~Room711() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section7/section7.cpp b/engines/m4/riddle/rooms/section7/section7.cpp
new file mode 100644
index 00000000000..9d63e0a10df
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/section7.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 "m4/riddle/rooms/section7/section7.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+Section7::Section7() : Rooms::Section() {
+ add(701, &_room701);
+ add(702, &_room702);
+ add(703, &_room703);
+ add(704, &_room704);
+ add(705, &_room705);
+ add(706, &_room706);
+ add(707, &_room707);
+ add(709, &_room709);
+ add(710, &_room710);
+ add(711, &_room711);
+}
+
+void Section7::daemon() {
+ _G(kernel).continue_handling_trigger = true;
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section7/section7.h b/engines/m4/riddle/rooms/section7/section7.h
new file mode 100644
index 00000000000..1423a4dd56f
--- /dev/null
+++ b/engines/m4/riddle/rooms/section7/section7.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION7_H
+#define M4_RIDDLE_ROOMS_SECTION7_H
+
+#include "m4/riddle/rooms/section.h"
+#include "m4/riddle/rooms/section7/room701.h"
+#include "m4/riddle/rooms/section7/room702.h"
+#include "m4/riddle/rooms/section7/room703.h"
+#include "m4/riddle/rooms/section7/room704.h"
+#include "m4/riddle/rooms/section7/room705.h"
+#include "m4/riddle/rooms/section7/room706.h"
+#include "m4/riddle/rooms/section7/room707.h"
+#include "m4/riddle/rooms/section7/room709.h"
+#include "m4/riddle/rooms/section7/room710.h"
+#include "m4/riddle/rooms/section7/room711.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Section7 : public Section {
+private:
+ Room701 _room701;
+ Room702 _room702;
+ Room703 _room703;
+ Room704 _room704;
+ Room705 _room705;
+ Room706 _room706;
+ Room707 _room707;
+ Room709 _room709;
+ Room710 _room710;
+ Room711 _room711;
+
+public:
+ Section7();
+ virtual ~Section7() {}
+
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room801.cpp b/engines/m4/riddle/rooms/section8/room801.cpp
new file mode 100644
index 00000000000..67942382cd4
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room801.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 "m4/riddle/rooms/section8/room801.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room801::init() {
+}
+
+void Room801::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room801.h b/engines/m4/riddle/rooms/section8/room801.h
new file mode 100644
index 00000000000..2182ae25766
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room801.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM801_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM801_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room801 : public Room {
+public:
+ Room801() : Room() {}
+ ~Room801() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room802.cpp b/engines/m4/riddle/rooms/section8/room802.cpp
new file mode 100644
index 00000000000..45f321ba6bf
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room802.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 "m4/riddle/rooms/section8/room802.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room802::init() {
+}
+
+void Room802::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room802.h b/engines/m4/riddle/rooms/section8/room802.h
new file mode 100644
index 00000000000..55f5d506306
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room802.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM802_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM802_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room802 : public Room {
+public:
+ Room802() : Room() {}
+ ~Room802() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room803.cpp b/engines/m4/riddle/rooms/section8/room803.cpp
new file mode 100644
index 00000000000..857d21773a7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room803.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 "m4/riddle/rooms/section8/room803.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room803::init() {
+}
+
+void Room803::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room803.h b/engines/m4/riddle/rooms/section8/room803.h
new file mode 100644
index 00000000000..3e92a89eebb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room803.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM803_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM803_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room803 : public Room {
+public:
+ Room803() : Room() {}
+ ~Room803() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room804.cpp b/engines/m4/riddle/rooms/section8/room804.cpp
new file mode 100644
index 00000000000..d4e4a531a89
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room804.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 "m4/riddle/rooms/section8/room804.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room804::init() {
+}
+
+void Room804::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room804.h b/engines/m4/riddle/rooms/section8/room804.h
new file mode 100644
index 00000000000..463ebe92ed0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room804.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM804_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM804_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room804 : public Room {
+public:
+ Room804() : Room() {}
+ ~Room804() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room805.cpp b/engines/m4/riddle/rooms/section8/room805.cpp
new file mode 100644
index 00000000000..0fb456a58a0
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room805.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 "m4/riddle/rooms/section8/room805.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room805::init() {
+}
+
+void Room805::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room805.h b/engines/m4/riddle/rooms/section8/room805.h
new file mode 100644
index 00000000000..ab8822c0e1a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room805.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM805_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM805_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room805 : public Room {
+public:
+ Room805() : Room() {}
+ ~Room805() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room806.cpp b/engines/m4/riddle/rooms/section8/room806.cpp
new file mode 100644
index 00000000000..e9df4ea18aa
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room806.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 "m4/riddle/rooms/section8/room806.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room806::init() {
+}
+
+void Room806::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room806.h b/engines/m4/riddle/rooms/section8/room806.h
new file mode 100644
index 00000000000..ac99d9ec16d
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room806.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM806_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM806_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room806 : public Room {
+public:
+ Room806() : Room() {}
+ ~Room806() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room807.cpp b/engines/m4/riddle/rooms/section8/room807.cpp
new file mode 100644
index 00000000000..ce918c5ab17
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room807.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 "m4/riddle/rooms/section8/room807.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room807::init() {
+}
+
+void Room807::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room807.h b/engines/m4/riddle/rooms/section8/room807.h
new file mode 100644
index 00000000000..61ffda38a64
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room807.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM807_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM807_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room807 : public Room {
+public:
+ Room807() : Room() {}
+ ~Room807() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room808.cpp b/engines/m4/riddle/rooms/section8/room808.cpp
new file mode 100644
index 00000000000..7ab25cfd5bc
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room808.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 "m4/riddle/rooms/section8/room808.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room808::init() {
+}
+
+void Room808::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room808.h b/engines/m4/riddle/rooms/section8/room808.h
new file mode 100644
index 00000000000..8c469a3fbeb
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room808.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM808_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM808_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room808 : public Room {
+public:
+ Room808() : Room() {}
+ ~Room808() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room809.cpp b/engines/m4/riddle/rooms/section8/room809.cpp
new file mode 100644
index 00000000000..764ac657a4a
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room809.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 "m4/riddle/rooms/section8/room809.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room809::init() {
+}
+
+void Room809::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room809.h b/engines/m4/riddle/rooms/section8/room809.h
new file mode 100644
index 00000000000..ffb54119dc1
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room809.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM809_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM809_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room809 : public Room {
+public:
+ Room809() : Room() {}
+ ~Room809() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room810.cpp b/engines/m4/riddle/rooms/section8/room810.cpp
new file mode 100644
index 00000000000..8fc712d8cba
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room810.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 "m4/riddle/rooms/section8/room810.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room810::init() {
+}
+
+void Room810::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room810.h b/engines/m4/riddle/rooms/section8/room810.h
new file mode 100644
index 00000000000..0ff6c07f023
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room810.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM810_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM810_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room810 : public Room {
+public:
+ Room810() : Room() {}
+ ~Room810() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room811.cpp b/engines/m4/riddle/rooms/section8/room811.cpp
new file mode 100644
index 00000000000..6ecb76e83c9
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room811.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 "m4/riddle/rooms/section8/room811.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room811::init() {
+}
+
+void Room811::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room811.h b/engines/m4/riddle/rooms/section8/room811.h
new file mode 100644
index 00000000000..7d962f5ed8e
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room811.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM811_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM811_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room811 : public Room {
+public:
+ Room811() : Room() {}
+ ~Room811() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room814.cpp b/engines/m4/riddle/rooms/section8/room814.cpp
new file mode 100644
index 00000000000..0c3f4a021ae
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room814.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 "m4/riddle/rooms/section8/room814.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room814::init() {
+}
+
+void Room814::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room814.h b/engines/m4/riddle/rooms/section8/room814.h
new file mode 100644
index 00000000000..e72bbbd1bf7
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room814.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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 M4_RIDDLE_ROOMS_SECTION8_ROOM814_H
+#define M4_RIDDLE_ROOMS_SECTION8_ROOM814_H
+
+#include "m4/riddle/rooms/room.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+class Room814 : public Room {
+public:
+ Room814() : Room() {}
+ ~Room814() override {}
+
+ void init() override;
+ void daemon() override;
+};
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
+
+#endif
diff --git a/engines/m4/riddle/rooms/section8/room818.cpp b/engines/m4/riddle/rooms/section8/room818.cpp
new file mode 100644
index 00000000000..b5c5dd9a389
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room818.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 "m4/riddle/rooms/section8/room818.h"
+#include "m4/graphics/gr_series.h"
+#include "m4/riddle/vars.h"
+
+namespace M4 {
+namespace Riddle {
+namespace Rooms {
+
+void Room818::init() {
+}
+
+void Room818::daemon() {
+}
+
+} // namespace Rooms
+} // namespace Riddle
+} // namespace M4
diff --git a/engines/m4/riddle/rooms/section8/room818.h b/engines/m4/riddle/rooms/section8/room818.h
new file mode 100644
index 00000000000..634f8bfd5e3
--- /dev/null
+++ b/engines/m4/riddle/rooms/section8/room818.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
Commit: 1dc69762c5f474a06825a9fca69d4b1454c78267
https://github.com/scummvm/scummvm/commit/1dc69762c5f474a06825a9fca69d4b1454c78267
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added hyperwalk hotkey
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/adv_walk.h
engines/m4/gui/hotkeys.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index eab58ef6208..6702847ddba 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -295,14 +295,13 @@ static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, i
_G(globals)[GLB_TEMP_2] = y << 16;
_G(globals)[GLB_TEMP_3] = s;
- if (facing > 0 && facing < 13) {
- // If there is a facing to be set
- _G(globals)[GLB_TEMP_4] = directions[facing] << 16;
- sendWSMessage(747 << 16, 0, myWalker, 0, nullptr, 1);
- } else {
- sendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
- _G(player).waiting_for_walk = false; // lets parse code get called when there is no facing set (from scenedit)
- }
+ if (facing > 0 && facing < 13)
+ // WORKAROUND: The original's hyperwalk didn't work. By doing
+ // the facing set separately, this is fixed
+ ws_demand_facing(facing);
+
+ sendWSMessage(DEMAND_LOCATION << 16, 0, myWalker, 0, nullptr, 1);
+ _G(player).waiting_for_walk = false; // lets parse code get called when there is no facing set (from scenedit)
}
void ws_turn_to_face(machine *myWalker, int32 facing, int32 trigger) {
diff --git a/engines/m4/adv_r/adv_walk.h b/engines/m4/adv_r/adv_walk.h
index dc70dc20580..e37d45d137f 100644
--- a/engines/m4/adv_r/adv_walk.h
+++ b/engines/m4/adv_r/adv_walk.h
@@ -96,6 +96,8 @@ extern void ws_custom_walk(machine *myWalker, int32 finalFacing, int32 trigger,
#define adv_walker_unhide(ww) (ws_unhide_walker(ww))
extern bool adv_walker_path_exists(machine *myWalker, int32 x, int32 y);
+extern void adv_hyperwalk_to_final_destination(void *, void *);
+
} // End of namespace M4
#endif
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 61bbf42fa29..58ce76e9201 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -22,6 +22,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
#include "m4/platform/keys.h"
+#include "m4/adv_r/adv_walk.h"
#include "m4/vars.h"
namespace M4 {
@@ -115,6 +116,7 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_ALT_Q, exit_program);
AddSystemHotkey(KEY_CTRL_Q, exit_program);
AddSystemHotkey(KEY_SPACE, adv_hyperwalk_to_final_destination);
+ AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
if (_G(cheating_enabled)) {
adv_enable_system_hot_keys();
@@ -183,7 +185,7 @@ void Hotkeys::version_ok_button(void *a, void *b) {
}
void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
- warning("TODO: hotkey");
+ M4::adv_hyperwalk_to_final_destination(a, b);
}
void Hotkeys::f_io_report(void *, void *) {
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 2ff64b9c374..e1fae9624c3 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -117,7 +117,7 @@ public:
ConvDisplayData _cdd;
Rend_Globals _rend;
- bool _cheating_enabled = false;
+ bool _cheating_enabled = true;
bool _cheat_keys_enabled = false;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
Commit: c171921ef93f9881c093c4ae781f36cc69926140
https://github.com/scummvm/scummvm/commit/c171921ef93f9881c093c4ae781f36cc69926140
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add console command to automatically hyperwalk
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/console.cpp
engines/m4/console.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 6702847ddba..8e509920626 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -176,6 +176,9 @@ void ws_walk(machine *myWalker, int32 x, int32 y, GrBuff **, int16 trigger, int3
_G(completeWalk) = complete_walk;
ws_walkto_node(myWalker, myWalker->walkPath, true);
}
+
+ if (_G(hyperwalk))
+ adv_hyperwalk_to_final_destination(nullptr, nullptr);
}
bool adv_walker_path_exists(machine *myWalker, int32 x, int32 y) {
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 9201d4ea25b..7342b450bc5 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -30,6 +30,7 @@ Console::Console() : GUI::Debugger() {
registerCmd("room", WRAP_METHOD(Console, Cmd_room));
registerCmd("flag", WRAP_METHOD(Console, Cmd_flag));
registerCmd("item", WRAP_METHOD(Console, Cmd_item));
+ registerCmd("hyperwalk", WRAP_METHOD(Console, Cmd_hyperwalk));
}
Console::~Console() {
@@ -78,4 +79,15 @@ bool Console::Cmd_item(int argc, const char **argv) {
}
}
+bool Console::Cmd_hyperwalk(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("hyperwalk [on | off]\n");
+ } else {
+ _G(hyperwalk) = !strcmp(argv[1], "on");
+ debugPrintf("hyperwalk is now %s\n", _G(hyperwalk) ? "on" : "off");
+ }
+
+ return true;
+}
+
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index 7102d0f837c..ab6351b2e22 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -33,6 +33,8 @@ private:
bool Cmd_room(int argc, const char **argv);
bool Cmd_flag(int argc, const char **argv);
bool Cmd_item(int argc, const char **argv);
+ bool Cmd_hyperwalk(int argc, const char **argv);
+
public:
Console();
~Console() override;
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index e1fae9624c3..8fc6c8d7a06 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -187,6 +187,7 @@ public:
cursor_states _cursor_state = kARROW;
int _iPitch = 0;
int _click_x = 0, _click_y = 0;
+ bool _hyperwalk = false;
};
#define _G(X) (g_vars->_##X)
Commit: e5570a09fdb8c5d94439eb1668e6b2004445dc9b
https://github.com/scummvm/scummvm/commit/e5570a09fdb8c5d94439eb1668e6b2004445dc9b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Some room 102 cleanups
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index a6839ad2c5b..817c50e85d9 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -126,8 +126,8 @@ void Room102::init() {
hotspot_set_active("harry", false);
hotspot_set_active("harry ", false);
- _series1 = series_play("102seat", 2560, 0, -1, 100, -1, 100, 0, 0, 0, 0);
- _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1 = series_play("102seat", 0xa00, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
setup(5, 0);
break;
@@ -140,7 +140,7 @@ void Room102::init() {
kernel_trigger_dispatch_now(3);
++_G(flags)[V015];
- _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
hotspot_set_active("harry ", false);
break;
}
@@ -203,47 +203,47 @@ void Room102::daemon() {
case 1:
case 2:
case 3:
- series_play("102ha01", 2560, 1, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 1, 3, 4, 0, 100, 0, 0, 0, 0);
break;
case 6:
_val12 = 30;
- series_play("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 19, 19);
+ series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 19, 19);
break;
case 7:
_val12 = 31;
- series_play("102ha01", 2560, 2, 3, 10, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 20, 23);
break;
case 8:
_val12 = 24;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
break;
case 9:
_val12 = 25;
- series_play("102ha01", 2560, 0, 3, 7, 0, 100, 0, 0, 3, 4);
+ series_play("102ha01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 3, 4);
break;
case 10:
_val12 = 23;
- series_play("102ha01", 2560, 0, 3, 8, 0, 100, 0, 0, 46, 48);
+ series_play("102ha01", 0xa00, 0, 3, 8, 0, 100, 0, 0, 46, 48);
break;
default:
- series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 20:
_val12 = 20;
- series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
break;
case 21:
_val12 = 21;
- series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
break;
case 26:
_val11 = 27;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 8, 14);
break;
case 27:
@@ -253,24 +253,24 @@ void Room102::daemon() {
_val12 = 26;
kernel_trigger_dispatch_now(3);
} else {
- series_play("102ha01", 2560, 0, 3, 60, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 0xa00, 0, 3, 60, 0, 100, 0, 0, 14, 14);
}
break;
case 28:
_val11 = 29;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 8, 14);
break;
case 29:
setup(5);
_val11 = 32;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
break;
case 32:
series_unload(_index1);
- terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series1s);
_val11 = 33;
series_play("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
digi_preload_stream_breaks(STREAMS1);
@@ -285,8 +285,8 @@ void Room102::daemon() {
digi_stop(2);
_index2 = series_load("102ha03", -1);
_val11 = 34;
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 0, 4);
break;
case 34:
@@ -312,12 +312,12 @@ void Room102::daemon() {
if (_series3)
terminateMachineAndNull(_series3);
- _series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 24, 29);
+ _series3 = series_play("102ha01", 0xa00, 4, -1, 5, -1, 100, 0, 0, 24, 29);
} else {
terminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
}
break;
@@ -328,36 +328,36 @@ void Room102::daemon() {
_play1 = nullptr;
}
- _series3 = series_play("102ha01", 2560, 4, -1, 5, -1, 100, 0, 0, 31, 42);
+ _series3 = series_play("102ha01", 0xa00, 4, -1, 5, -1, 100, 0, 0, 31, 42);
} else {
terminateMachineAndNull(_series3);
_series3 = nullptr;
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
}
break;
case 22:
_val12 = 23;
- series_play("102ha01", 2560, 2, 3, 6, 0, 100, 0, 0, 44, 48);
+ series_play("102ha01", 0xa00, 2, 3, 6, 0, 100, 0, 0, 44, 48);
break;
case 23:
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 44, 46);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 44, 46);
break;
case 24:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
} else {
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
}
break;
@@ -365,13 +365,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
} else {
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
}
break;
@@ -379,13 +379,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 17) == 1) {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
} else {
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 14, 14);
}
} else {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
}
break;
@@ -393,13 +393,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
} else {
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
}
} else {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
}
break;
@@ -407,13 +407,13 @@ void Room102::daemon() {
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
} else {
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 20);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 20);
}
} else {
_val12 = 19;
- series_play("102ha01", 2560, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
}
break;
@@ -425,32 +425,32 @@ void Room102::daemon() {
if (!digi_play_state(2))
digi_play("102_030", 2, 255, -1);
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 4, 6);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 4, 6);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 6);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 4, 6);
break;
case 2:
if (!digi_play_state(2))
digi_play("102_031", 2, 255, -1);
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 7, 8);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 7, 8);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 7, 8);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 7, 8);
break;
case 3:
if (!digi_play_state(2))
digi_play("102_032", 2, 255, -1);
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 9, 11);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 9, 11);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 9, 11);
break;
case 4:
if (!digi_play_state(2))
digi_play("102_033", 2, 255, -1);
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 12, 15);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 12, 15);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 12, 15);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 12, 15);
break;
default:
@@ -467,8 +467,8 @@ void Room102::daemon() {
case 36:
_val12 = 36;
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 16);
break;
case 37:
@@ -522,8 +522,8 @@ void Room102::daemon() {
_val11 = 43;
_val12 = 43;
- series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 0, 4);
conv_load_and_prepare("conv06", 21, false);
conv_export_pointer_curr(&_val4, 0);
@@ -568,13 +568,13 @@ void Room102::daemon() {
}
_val13 = frame;
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, frame, frame);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, frame, frame);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, frame, frame);
} else {
_val13 = 35;
- series_play("102ha03", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 16);
- series_play("102ha03s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 16);
}
break;
@@ -582,37 +582,37 @@ void Room102::daemon() {
switch (_val11) {
case 20:
frame = imath_ranged_rand(8, 11);
- series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 21:
frame = imath_ranged_rand(12, 15);
- series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 43:
frame = imath_ranged_rand(4, 7);
- series_play("102ha05", 2560, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 2561, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 44:
_val11 = 45;
- series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 16, 24);
- series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 16, 24);
+ series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 24);
+ series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 24);
break;
case 45:
- series_play("102ha05", 2560, 0, 3, 6, 0, 100, 0, 0, 24, 24);
- series_play("102ha05s", 2561, 0, -1, 6, 0, 100, 0, 0, 24, 24);
+ series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 24, 24);
+ series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 24, 24);
break;
case 48:
_val11 = 49;
- series_play("102ha05", 2560, 2, 3, 6, 0, 100, 0, 0, 0, 3);
- series_play("102ha05s", 2561, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ series_play("102ha05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 3);
+ series_play("102ha05s", 0xa01, 2, -1, 6, 0, 100, 0, 0, 0, 3);
break;
case 49:
@@ -627,12 +627,12 @@ void Room102::daemon() {
series_unload(_index3);
_val13 = 65;
_val11 = 51;
- series_play_with_breaks(PLAY1, "102ha11", 2560, 3, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY1, "102ha11", 0xa00, 3, 3, 6, 100, 0, 0);
break;
case 51:
_index1 = series_load("102ha01", -1);
- series_play_with_breaks(PLAY2, "102ha06", 2560, 25, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY2, "102ha06", 0xa00, 25, 3, 6, 100, 0, 0);
hotspot_set_active("harry", true);
hotspot_set_active("harry ", false);
@@ -647,14 +647,14 @@ void Room102::daemon() {
switch (_val11) {
case 46:
terminateMachineAndNull(_series1);
- terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_series1s);
_val11 = 47;
- series_play_with_breaks(PLAY2, "102ha06", 2560, 3, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY2, "102ha06", 0xa00, 3, 3, 6, 100, 0, 0);
hotspot_set_active("harry", true);
break;
case 47:
- _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_index1 = series_load("102ha01", -1);
_val11 = 19;
_val12 = 19;
@@ -833,7 +833,7 @@ void Room102::daemon() {
break;
case 8:
- _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
break;
case 9:
@@ -929,7 +929,7 @@ void Room102::daemon() {
break;
case 25:
- _series2 = series_play("102seats", 2561, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ _series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_val12 = 19;
_val11 = 19;
kernel_trigger_dispatch_now(3);
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 3b67c2f1923..7fe7a932cec 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -46,7 +46,7 @@ private:
int _trigger = -1;
KernelTriggerType _triggerMode = KT_DAEMON;
machine *_series1 = nullptr;
- machine *_series2 = nullptr;
+ machine *_series1s = nullptr;
machine *_series3 = nullptr;
machine *_series4 = nullptr;
machine *_series5 = nullptr;
Commit: 5f4e0a6ecf62b893818262310a2fa7f0a98c7901
https://github.com/scummvm/scummvm/commit/5f4e0a6ecf62b893818262310a2fa7f0a98c7901
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Barbershop fixes
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 57c8055cdf5..76efd8aaf1d 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -135,6 +135,7 @@ void Room101::init() {
break;
case 102:
+ // Exiting barber shop
player_set_commands_allowed(false);
if (_G(flags)[V014]) {
_G(flags)[V014] = 0;
@@ -149,10 +150,11 @@ void Room101::init() {
}
ws_hide_walker(_G(my_walker));
- kernel_trigger_dispatch_now(10015);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 103:
+ // Returning from rooftop
player_set_commands_allowed(false);
ws_demand_facing(_G(my_walker), 1);
ws_demand_location(_G(my_walker), 197, 276);
@@ -163,21 +165,25 @@ void Room101::init() {
break;
case 104:
+ // From Town Hall
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 106:
+ // Leaving alley
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 135:
+ // From Old Bridge
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 142:
+ // From Vera's Diner
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 817c50e85d9..ea9ea6ecb33 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -1178,7 +1178,7 @@ void Room102::parser() {
} else if (player_said("exit") || player_said("gear", "main_street")) {
player_set_commands_allowed(false);
digi_preload("102_038");
- digi_play("103_038", 2, 255, 17);
+ digi_play("102_038", 2, 255, 17);
} else {
if (player_said("TAKE", "DOORWAY"))
_G(walker).wilbur_speech("102W003");
@@ -1375,7 +1375,7 @@ void Room102::flagAction(const char *name1, const char *name2) {
_G(walker).wilbur_speech(name1);
} else {
_G(kernel).trigger_mode = KT_PARSE;
- _G(walker).wilbur_speech(name1);
+ _G(walker).wilbur_speech(name1, 1);
player_set_commands_allowed(false);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 7475999635f..c87228543f5 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -138,13 +138,13 @@ void Room103::init() {
}
if (_G(flags)[V023]) {
- _series1 = series_play("103wi06", 0x500, 0, -1, 100);
+ _series1 = series_play("103wi06", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
} else {
- _series1 = series_play("103wi05", 0x500, 0, -1, 100);
+ _series1 = series_play("103wi05", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
}
- _series2 = series_play("103door", 0x800, 0, -1, 100);
- series_play("103vent", 0x100);
+ _series2 = series_play("103door", 0x800, 0, -1, 100, -1, 100, 0, 0, 0, 0);
+ series_play("103vent", 0x100, 0, -1, 6, -1, 100, 0, 0, 0, 3);
_val4 = 12;
kernel_trigger_dispatch_now(10);
Commit: bfee383ebd70b52a9bd6a172cad3ef060fa4cfd8
https://github.com/scummvm/scummvm/commit/bfee383ebd70b52a9bd6a172cad3ef060fa4cfd8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for Aunt Polly's Living Room
Changed paths:
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room171.h
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 783754b9d0f..4ef777aee0a 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_POLLY_ANIMATION = 5
+};
+
static const char *SAID[][4] = {
{ "AUNT POLLY", "171w001", "171w002", "171w002" },
{ "FRONT DOOR", "171w003", "171w002", nullptr },
@@ -179,10 +183,10 @@ void Room171::init() {
case 170:
player_set_commands_allowed(false);
- if (_G(flags)[V084] && _G(flags)[V085] && _G(flags)[V086]) {
+ if (_G(flags)[V083] && _G(flags)[V084] && _G(flags)[V085] && _G(flags)[V086]) {
loadSeries1();
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
while (!_val1) {
switch (imath_ranged_rand(1, 4)) {
@@ -190,16 +194,18 @@ void Room171::init() {
if (!_G(flags)[V083]) {
_val1 = 10019;
loadSeries2();
- _val2 = 5;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 5;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
case 2:
- _val1 = 10021;
- loadSeries3();
- digi_preload("171_002");
- digi_play_loop("171_002", 2);
+ if (!_G(flags)[V084]) {
+ _val1 = 10021;
+ loadSeries3();
+ digi_preload("171_002");
+ digi_play_loop("171_002", 2);
+ }
break;
case 3:
@@ -221,8 +227,8 @@ void Room171::init() {
if (!_G(flags)[V086]) {
_val1 = 10022;
loadSeries5();
- _val2 = 20;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 20;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
@@ -237,20 +243,20 @@ void Room171::init() {
if (!_G(flags)[V092]) {
if (_G(flags)[V086]) {
loadSeries1();
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
_val1 = 10022;
loadSeries5();
-kernel_trigger_dispatch_now(6);
+ kernel_trigger_dispatch_now(6);
}
}
break;
default:
loadSeries1();
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
}
}
@@ -266,7 +272,7 @@ kernel_trigger_dispatch_now(6);
if (_val1 == 10020 || _val1 == 10019) {
hotspot_set_active("PIANO STOOL ", true);
- intr_add_no_walk_rect(378, 300, 518, 354, 377, 355, _G(screenCodeBuff)->get_buffer());
+ intr_add_no_walk_rect(378, 300, 518, 354, 377, 355);
if (_val1 == 10020) {
series_show("171stool", 0x300);
@@ -283,6 +289,9 @@ kernel_trigger_dispatch_now(6);
series_show("171phone", 0x700);
switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
case 170:
ws_demand_location(84, 275, 3);
@@ -326,23 +335,24 @@ void Room171::daemon() {
break;
case 4:
- if (_val2 == 28 || _val2 == 36 || _val2 == 34 || _val2 == 33 ||
- _val2 == 38 || _val2 == 30) {
+ if (_pollyShould == 28 || _pollyShould == 36 || _pollyShould == 34 || _pollyShould == 33 ||
+ _pollyShould == 38 || _pollyShould == 30) {
digi_stop(2);
freeSeries();
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
- case 5:
- switch (_val2) {
+ case kCHANGE_POLLY_ANIMATION:
+ // Aunt Polly
+ switch (_pollyShould) {
case 5:
digi_play_loop("171_003", 2);
- _series.play("171ap01", 0x300);
+ _series.play("171ap01", 0x300, 0, -1, 6, -1);
break;
case 6:
- npc_say(conv_sound_to_play(), 10001, "171ap01n", 0x2ff);
+ npc_say(conv_sound_to_play(), 10001, "171ap01n", 0x2ff, false);
break;
case 7:
@@ -352,13 +362,13 @@ void Room171::daemon() {
break;
case 8:
- _val2 = 9;
+ _pollyShould = 9;
npc_say(conv_sound_to_play(), 5, "171ap02", 0x300, 1, 17, 22);
break;
case 9:
freeSeries();
- _val2 = 10;
+ _pollyShould = 10;
series_play_with_breaks(PLAY4, "171ap03", 0x300, 5, 3);
break;
@@ -368,8 +378,8 @@ void Room171::daemon() {
series_show("171stool", 0x300);
series_show("171stols", 0x301);
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 11:
@@ -383,35 +393,35 @@ void Room171::daemon() {
break;
case 13:
- _val2 = 14;
+ _pollyShould = 14;
npc_say(5, "171ap05", 0x800);
break;
case 14:
_G(flags)[V084] = 1;
_chair.terminate();
- _val2 = 26;
+ _pollyShould = 26;
series_play_with_breaks(PLAY6, "171ap06", 0x800, 5, 3);
break;
case 15:
terminateMachineAndNull(_lid);
- _val2 = 16;
- series_play_with_breaks(PLAY7, "171ap07", 0, 6, 2);
+ _pollyShould = 16;
+ series_play_with_breaks(PLAY7, "171ap07", 0, 5, 2);
break;
case 16:
- npc_say(10001, "171ap08");
+ npc_say(10001, "171ap08", 0, false);
break;
case 17:
freeSeries();
- _val2 = 18;
+ _pollyShould = 18;
series_play_with_breaks(PLAY8, "171ap09", 0, 5, 3);
break;
case 18:
- _val2 = 19;
+ _pollyShould = 19;
series_play_with_breaks(PLAY9, "171ap09", 0x301, 5, 3);
series_show("171plid", 0);
break;
@@ -419,8 +429,8 @@ void Room171::daemon() {
case 19:
_G(flags)[V085] = 1;
_chair.terminate();
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 20:
@@ -429,7 +439,7 @@ void Room171::daemon() {
case 21:
freeSeries();
- npc_say(10001, "171ap10", 0x700);
+ npc_say(10001, "171ap10", 0x700, true, 0, 6);
break;
case 22:
@@ -438,13 +448,13 @@ void Room171::daemon() {
break;
case 23:
- _val2 = 24;
- _series.play("171ap10", 0x700);
+ _pollyShould = 24;
+ _series.play("171ap10", 0x700, 0, -1, 6, -1, 100, 0, 0, 0, 6);
break;
case 24:
freeSeries();
- _val2 = 25;
+ _pollyShould = 25;
series_play_with_breaks(PLAY11, "171ap10", 0x700, 5, 3);
break;
@@ -452,8 +462,8 @@ void Room171::daemon() {
_G(flags)[V086] = 1;
_chair.terminate();
series_show("171phone", 0x700);
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 26:
@@ -463,27 +473,27 @@ void Room171::daemon() {
ws_walk(436, 288, 0, 10001, 2);
digi_play_loop("171_009", 2, 50);
- _series.play("171ap11", 0x8ff, 32, 4);
+ _series.play("171ap11", 0x8ff, 32, 4, 6, -1);
break;
case 28:
- _val2 = 29;
+ _pollyShould = 29;
npc_say(_digi1, 5, "171ap13", 0x8fe);
break;
case 29:
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
player_set_commands_allowed(true);
break;
case 30:
- _val2 = 32;
+ _pollyShould = 32;
series_play_with_breaks(PLAY15, "171ap16", 0x8ff, 5, 3);
break;
case 31:
- _val2 = 32;
+ _pollyShould = 32;
series_play_with_breaks(PLAY16, "171ap17", 0x8ff, 5, 3);
break;
@@ -497,18 +507,18 @@ void Room171::daemon() {
break;
case 34:
- _val2 = 35;
+ _pollyShould = 35;
npc_say(5, "171ap13", 0x8fe);
break;
case 35:
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
conv_resume_curr();
break;
case 36:
- _val2 = 26;
+ _pollyShould = 26;
series_play_with_breaks(PLAY12, "171ap12", 0x8ff, 5, 3);
break;
@@ -517,24 +527,26 @@ void Room171::daemon() {
break;
case 38:
- _val2 = 39;
+ _pollyShould = 39;
npc_say(5, "171ap13", 0x8fe);
break;
case 39:
+ freeSeries();
_chair.show("171chair", "171chars", 0x900);
if (_series3)
terminateMachineAndNull(_series3);
+ _pollyShould = 40;
series_play_with_breaks(PLAY14, "171ap15", 0x700, 5, 2, 8);
break;
case 40:
_chair.terminate();
_series3 = series_show("171pills", 0x700);
- _val2 = 26;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
conv_resume_curr();
break;
@@ -580,11 +592,11 @@ void Room171::daemon() {
_G(flags)[V299] = 0;
_flag1 = false;
player_set_commands_allowed(true);
- _val2 = 26;
+ _pollyShould = 26;
if (_series) {
freeSeries();
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
@@ -609,7 +621,7 @@ void Room171::daemon() {
_G(flags)[V087] = 1;
}
- _val2 = 28;
+ _pollyShould = 28;
break;
case 10001:
@@ -674,7 +686,7 @@ void Room171::parser() {
disable_player_commands_and_fade_init(1019);
} else {
player_set_commands_allowed(false);
- _val2 = 30;
+ _pollyShould = 30;
}
} else if (player_said("GEAR", "STAIRS")) {
@@ -692,7 +704,7 @@ void Room171::parser() {
} else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
player_set_commands_allowed(false);
_digi1 = "171p901";
- _val2 = 28;
+ _pollyShould = 28;
} else if (player_said("ROCKER")) {
if (player_said("LOOK AT")) {
@@ -785,21 +797,21 @@ void Room171::conv40() {
switch (node) {
case 6:
if (entry <= 0 || (entry == 6 || entry == 7))
- _val2 = 36;
+ _pollyShould = 36;
break;
case 7:
- _val2 = 36;
+ _pollyShould = 36;
break;
case 10:
if (entry == 0)
- _val2 = 36;
+ _pollyShould = 36;
break;
case 15:
if (entry == 1 || entry == 2 || entry == 5)
- _val2 = 36;
+ _pollyShould = 36;
break;
default:
@@ -811,96 +823,96 @@ void Room171::conv40() {
case 1:
switch (entry) {
case 0:
- _val2 = 6;
+ _pollyShould = 6;
break;
case 1:
- _val2 = 7;
+ _pollyShould = 7;
break;
case 2:
- _val2 = 8;
+ _pollyShould = 8;
break;
default:
break;
}
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
switch (entry) {
case 0:
- _val2 = 11;
+ _pollyShould = 11;
break;
case 1:
- _val2 = 12;
+ _pollyShould = 12;
break;
case 2:
- _val2 = 13;
+ _pollyShould = 13;
break;
default:
break;
}
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 3:
switch (entry) {
case 0:
- _val2 = 15;
+ _pollyShould = 15;
break;
case 1:
- _val2 = 17;
+ _pollyShould = 17;
break;
default:
break;
}
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 4:
switch (entry) {
case 0:
- _val2 = 21;
+ _pollyShould = 21;
break;
case 1:
- _val2 = 22;
+ _pollyShould = 22;
break;
default:
break;
}
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 5:
case 7:
- _val2 = 34;
+ _pollyShould = 34;
break;
case 6:
- _val2 = (entry == 6) ? 33 : 34;
+ _pollyShould = (entry == 6) ? 33 : 34;
break;
case 8:
switch (entry) {
case 0:
- _val2 = 33;
+ _pollyShould = 33;
break;
case 1:
- _val2 = 38;
+ _pollyShould = 38;
break;
default:
break;
}
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 9:
- _val2 = 34;
- kernel_trigger_dispatch_now(5);
+ _pollyShould = 34;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
default:
diff --git a/engines/m4/burger/rooms/section1/room171.h b/engines/m4/burger/rooms/section1/room171.h
index 64865721aa5..7a503ca30c4 100644
--- a/engines/m4/burger/rooms/section1/room171.h
+++ b/engines/m4/burger/rooms/section1/room171.h
@@ -56,7 +56,7 @@ private:
bool _flag1 = false;
bool _doorFlag = false;
int _val1 = 0;
- int _val2 = 0;
+ int _pollyShould = 0;
void loadSeries1();
void loadSeries2();
Commit: 249cb5f988f6016a6bc9eadc73941b1f7ac2d20d
https://github.com/scummvm/scummvm/commit/249cb5f988f6016a6bc9eadc73941b1f7ac2d20d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove deprecated sprite drawing code
Changed paths:
engines/m4/graphics/gr_sprite.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 81271a7aa76..1da8ffe7f46 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -92,10 +92,6 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
uint8 gr_sprite_draw(DrawRequest *drawReq) {
Buffer source;
-#if 0
- int32 leftOffset = 0, rightOffset = 0, YPos;
- uint8 bottomCut = 0;
-#endif
uint8 *shadowBuff = nullptr, *scaledBuff = nullptr;
Buffer afterScaled = { 0, 0, nullptr, 0, 0 };
@@ -168,126 +164,6 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
dst.draw(source, drawReq->x, drawReq->y, drawReq->scaleX > 0,
drawReq->srcDepth ? drawReq->depthCode : nullptr, drawReq->srcDepth);
-#if 0
- YPos = drawReq->y;
-
- // Check for clipping
- // If sprite is off edge of destination buffer, do something special
- if (Clipped) {
- if (-YPos >= source.h)
- goto truly_done;
-
- if (YPos >= drawReq->Dest->h)
- goto truly_done;
-
- if (-drawReq->x >= source.w)
- goto truly_done;
-
- if (drawReq->x >= drawReq->Dest->w)
- goto truly_done;
-
- // if clipped off top, scan into sprite
- if (YPos < 0) {
- if (Rle)
- source.data = SkipRLE_Lines(-YPos, source.data);
- else
- source.data += -YPos * source.stride;
-
- source.h += YPos;
- YPos = 0;
- }
-
- // Find out if we're losing pixels on left or right
- if (drawReq->x < 0)
- leftOffset = -drawReq->x;
-
- if (drawReq->x + source.w > drawReq->Dest->w)
- rightOffset = drawReq->x + source.w - drawReq->Dest->w;
-
- if (YPos + source.h > drawReq->Dest->h) {
- source.h -= YPos + source.h - drawReq->Dest->h;
- bottomCut = 1;
- }
- }
-
- // After all the necessary changes (scaling/shadow RLE expansion)
- if (Rle) {
- // Will be RLE_Draw
- if (ClipD)
- if (Depthed)
- if (Forward)
- RLE_DrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
- else
- RLE_DrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
- else
- if (Forward)
- RLE_DrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
- else
- RLE_DrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
- else
- if (Depthed)
- if (Forward)
- RLE_DrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
- else
- RLE_DrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
- else
- if (Forward)
- RLE_Draw(&source, drawReq->Dest, drawReq->x, YPos);
- else
- RLE_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
- } else if (Shadow) {
- // Will be Raw_SDraw
- if (ClipD)
- if (Depthed)
- if (Forward)
- Raw_SDrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
- else
- Raw_SDrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
- else
- if (Forward)
- Raw_SDrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
- else
- Raw_SDrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset, drawReq->Pal, drawReq->ICT);
- else
- if (Depthed)
- if (Forward)
- Raw_SDrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, drawReq->Pal, drawReq->ICT);
- else
- Raw_SDrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, drawReq->Pal, drawReq->ICT);
- else
- if (Forward)
- Raw_SDraw(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
- else
- Raw_SDrawRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->Pal, drawReq->ICT);
- } else {
- // Will be Raw_Draw
- if (ClipD)
- if (Depthed)
- if (Forward)
- Raw_DrawDepthOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
- else
- Raw_DrawDepthRevOffs(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode, leftOffset, rightOffset);
- else
- if (Forward)
- Raw_DrawOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
- else
- Raw_DrawRevOffs(&source, drawReq->Dest, drawReq->x, YPos, leftOffset, rightOffset);
- else
- if (Depthed)
- if (Forward)
- Raw_DrawDepth(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
- else
- Raw_DrawDepthRev(&source, drawReq->Dest, drawReq->x, YPos, drawReq->srcDepth, drawReq->depthCode);
- else
- if (Forward)
- Raw_Draw(&source, drawReq->Dest, drawReq->x, YPos);
- else
- Raw_DrawRev(&source, drawReq->Dest, drawReq->x, YPos);
- }
-
-truly_done:
-#endif
-
if (shadowBuff)
mem_free(shadowBuff);
Commit: 6a528f267d0ee41e324ee01f396e876b3819f2e9
https://github.com/scummvm/scummvm/commit/6a528f267d0ee41e324ee01f396e876b3819f2e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Experimental shadow rendering
Changed paths:
engines/m4/graphics/gr_sprite.cpp
engines/m4/graphics/gr_surface.cpp
engines/m4/graphics/gr_surface.h
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 1da8ffe7f46..271182a47e5 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -157,12 +157,10 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source = afterScaled;
}
- if ((drawReq->Src->encoding & SHADOW) != 0)
- warning("TODO: shadowed sprites drawing");
-
M4Surface dst(*drawReq->Dest);
dst.draw(source, drawReq->x, drawReq->y, drawReq->scaleX > 0,
- drawReq->srcDepth ? drawReq->depthCode : nullptr, drawReq->srcDepth);
+ drawReq->srcDepth ? drawReq->depthCode : nullptr, drawReq->srcDepth,
+ (drawReq->Src->encoding & SHADOW) != 0 ? drawReq->ICT : nullptr);
if (shadowBuff)
mem_free(shadowBuff);
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 43e0c9f1d2f..aad787333fb 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -102,11 +102,11 @@ void M4Surface::rleDraw(const byte *src, int x, int y) {
}
void M4Surface::draw(const Buffer &src, int x, int y, bool forwards,
- const byte *depthCodes, int srcDepth) {
+ const byte *depthCodes, int srcDepth, const byte *inverseColorTable) {
if ((src.encoding & 0x7f) == RLE8) {
// The standard case of RLE sprite drawing onto screen can directly
// use RLE decompression for performance
- if (forwards && !depthCodes && !depthCodes && x >= 0 && y >= 0 &&
+ if (forwards && !depthCodes && !inverseColorTable && x >= 0 && y >= 0 &&
(x + src.w) <= this->w && (y + src.h) <= this->h) {
rleDraw(src.data, x, y);
@@ -114,16 +114,16 @@ void M4Surface::draw(const Buffer &src, int x, int y, bool forwards,
// All other RLE drawing first decompresses the sprite, and then does
// the various clipping, reverse, etc. on that
M4Surface tmp(src.data, src.w, src.h);
- drawInner(tmp, depthCodes, x, y, forwards, srcDepth);
+ drawInner(tmp, depthCodes, x, y, forwards, srcDepth, inverseColorTable);
}
} else {
// Uncompressed images get passed to inner drawing
- drawInner(src, depthCodes, x, y, forwards, srcDepth);
+ drawInner(src, depthCodes, x, y, forwards, srcDepth, inverseColorTable);
}
}
void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
- int x, int y, bool forwards, int srcDepth) {
+ int x, int y, bool forwards, int srcDepth, const byte *inverseColorTable) {
assert((src.encoding & 0x7f) == NO_COMPRESS);
for (int srcY = 0; srcY < src.h; ++srcY, ++y) {
@@ -148,6 +148,9 @@ void M4Surface::drawInner(const Buffer &src, const byte *depthCodes,
byte v = *srcP;
byte depth = depthP ? *depthP & 0xf : 0;
if (destX >= 0 && v != 0 && (!depthP || depth == 0 || srcDepth < depth)) {
+ if (inverseColorTable)
+ v = inverseColorTable[v];
+
*destP = v;
}
diff --git a/engines/m4/graphics/gr_surface.h b/engines/m4/graphics/gr_surface.h
index 0ef36739065..d0628ab5efd 100644
--- a/engines/m4/graphics/gr_surface.h
+++ b/engines/m4/graphics/gr_surface.h
@@ -32,7 +32,7 @@ private:
DisposeAfterUse::Flag _disposeAfterUse = DisposeAfterUse::NO;
void drawInner(const Buffer &src, const byte *depthCodes, int x, int y,
- bool forwards, int srcDepth);
+ bool forwards, int srcDepth, const byte *inverseColorTable);
public:
M4Surface() : Buffer() {}
@@ -52,7 +52,8 @@ public:
* Main drawing
*/
void draw(const Buffer &src, int x, int y, bool forwards = true,
- const byte *depthCodes = nullptr, int srcDepth = -1);
+ const byte *depthCodes = nullptr, int srcDepth = -1,
+ const byte *inverseColorTable = nullptr);
};
} // namespace M4
Commit: 015f392491003f606a89b8e4cb9c9af430445732
https://github.com/scummvm/scummvm/commit/015f392491003f606a89b8e4cb9c9af430445732
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add extra guard for ICT being set for shadowed drawing
But it's weird.. no shadowed drawing seems to be triggered,
even when I hardcode playing a shadow series. Maybe they
had issues with it and disabled it being drawn somewhere
Changed paths:
engines/m4/graphics/gr_sprite.cpp
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 271182a47e5..48e65440cae 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -157,10 +157,13 @@ uint8 gr_sprite_draw(DrawRequest *drawReq) {
source = afterScaled;
}
+ bool shadow = (drawReq->Src->encoding & SHADOW) != 0;
+ assert(!shadow || drawReq->ICT);
+
M4Surface dst(*drawReq->Dest);
dst.draw(source, drawReq->x, drawReq->y, drawReq->scaleX > 0,
drawReq->srcDepth ? drawReq->depthCode : nullptr, drawReq->srcDepth,
- (drawReq->Src->encoding & SHADOW) != 0 ? drawReq->ICT : nullptr);
+ shadow ? drawReq->ICT : nullptr);
if (shadowBuff)
mem_free(shadowBuff);
Commit: 7f1abfa038eda53bed9a2465d7a7147e11db43cd
https://github.com/scummvm/scummvm/commit/7f1abfa038eda53bed9a2465d7a7147e11db43cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Barbershop fixes
Changed paths:
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index ea9ea6ecb33..790b2f53fba 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -29,6 +29,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_HARRY_ANIMATION = 3
+};
+
static const seriesStreamBreak STREAMS1[] = {
{ 40, nullptr, 1, 255, 12, 0, nullptr, 0 },
{ 57, nullptr, 1, 255, 1, 0, nullptr, 0 },
@@ -111,8 +115,8 @@ void Room102::init() {
_index1 = series_load("102ha01", -1);
_index2 = series_load("102ha03", -1);
_val11 = 35;
- _val12 = 35;
- kernel_trigger_dispatch_now(3);
+ _harryShould = 35;
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
_val13 = 58;
_val14 = 62;
@@ -136,8 +140,8 @@ void Room102::init() {
setup(0, 0);
_val11 = 19;
- _val12 = 19;
- kernel_trigger_dispatch_now(3);
+ _harryShould = 19;
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
++_G(flags)[V015];
_series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
@@ -174,11 +178,13 @@ void Room102::daemon() {
case 1:
conv_resume_curr();
break;
+
case 2:
- ws_unhide_walker(_G(my_walker));
+ ws_unhide_walker();
break;
- case 3:
- switch (_val12) {
+
+ case kCHANGE_HARRY_ANIMATION:
+ switch (_harryShould) {
case 19:
term_message(" mumble or change channel");
@@ -203,26 +209,26 @@ void Room102::daemon() {
case 1:
case 2:
case 3:
- series_play("102ha01", 0xa00, 1, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 1, 3, 4, 0, 100, 0, 0, 0, 2);
break;
case 6:
- _val12 = 30;
- series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 19, 19);
+ _harryShould = 30;
+ series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 16, 19);
break;
case 7:
- _val12 = 31;
+ _harryShould = 31;
series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 20, 23);
break;
case 8:
- _val12 = 24;
+ _harryShould = 24;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
break;
case 9:
- _val12 = 25;
+ _harryShould = 25;
series_play("102ha01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 3, 4);
break;
case 10:
- _val12 = 23;
+ _harryShould = 23;
series_play("102ha01", 0xa00, 0, 3, 8, 0, 100, 0, 0, 46, 48);
break;
default:
@@ -232,12 +238,12 @@ void Room102::daemon() {
break;
case 20:
- _val12 = 20;
+ _harryShould = 20;
series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
break;
case 21:
- _val12 = 21;
+ _harryShould = 21;
series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
break;
@@ -250,8 +256,8 @@ void Room102::daemon() {
if (player_commands_allowed() && !digi_play_state(1)) {
setup();
_val11 = 19;
- _val12 = 26;
- kernel_trigger_dispatch_now(3);
+ _harryShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else {
series_play("102ha01", 0xa00, 0, 3, 60, 0, 100, 0, 0, 14, 14);
}
@@ -272,9 +278,9 @@ void Room102::daemon() {
series_unload(_index1);
terminateMachineAndNull(_series1s);
_val11 = 33;
- series_play("102ha02s", 3841, 0, 11, 6, 0, 100, 0, 0, 0, 41);
+ series_play("102ha02s", 0xf01, 0, 11, 6, 0, 100, 0, 0, 0, 41);
digi_preload_stream_breaks(STREAMS1);
- series_stream_with_breaks(STREAMS1, "102ha02", 6, 3840, 3);
+ series_stream_with_breaks(STREAMS1, "102ha02", 6, 0xf00, 3);
break;
case 33:
@@ -285,14 +291,13 @@ void Room102::daemon() {
digi_stop(2);
_index2 = series_load("102ha03", -1);
_val11 = 34;
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
break;
case 34:
_val11 = 35;
- _val12 = 35;
- kernel_trigger_dispatch_now(3);
+ _harryShould = 35;
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
hotspot_set_active("harry", false);
hotspot_set_active("harry ", true);
conv_resume_curr();
@@ -316,7 +321,7 @@ void Room102::daemon() {
} else {
terminateMachineAndNull(_series3);
_series3 = nullptr;
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
}
break;
@@ -332,31 +337,31 @@ void Room102::daemon() {
} else {
terminateMachineAndNull(_series3);
_series3 = nullptr;
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
}
break;
case 22:
- _val12 = 23;
+ _harryShould = 23;
series_play("102ha01", 0xa00, 2, 3, 6, 0, 100, 0, 0, 44, 48);
break;
case 23:
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 44, 46);
break;
case 24:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
} else {
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
}
} else {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
}
break;
@@ -364,13 +369,13 @@ void Room102::daemon() {
case 25:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 4);
}
} else {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
}
break;
@@ -378,13 +383,13 @@ void Room102::daemon() {
case 26:
if (_val11 == 19) {
if (imath_ranged_rand(1, 17) == 1) {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
} else {
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 14, 14);
}
} else {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
}
break;
@@ -392,13 +397,13 @@ void Room102::daemon() {
case 30:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
} else {
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
}
} else {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
}
break;
@@ -406,13 +411,13 @@ void Room102::daemon() {
case 31:
if (_val11 == 19) {
if (imath_ranged_rand(1, 15) == 1) {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
} else {
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 20);
}
} else {
- _val12 = 19;
+ _harryShould = 19;
series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
}
break;
@@ -425,32 +430,28 @@ void Room102::daemon() {
if (!digi_play_state(2))
digi_play("102_030", 2, 255, -1);
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 6);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 4, 6);
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 6);
break;
case 2:
if (!digi_play_state(2))
digi_play("102_031", 2, 255, -1);
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 7, 8);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 7, 8);
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 7, 8);
break;
case 3:
if (!digi_play_state(2))
digi_play("102_032", 2, 255, -1);
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 9, 11);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 9, 11);
break;
case 4:
if (!digi_play_state(2))
digi_play("102_033", 2, 255, -1);
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 12, 15);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 12, 15);
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 12, 15);
break;
default:
@@ -466,7 +467,7 @@ void Room102::daemon() {
break;
case 36:
- _val12 = 36;
+ _harryShould = 36;
series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 16);
break;
@@ -475,7 +476,7 @@ void Room102::daemon() {
_val11 = 39;
_G(flags)[GLB_TEMP_5] = 2;
digi_preload_stream_breaks(STREAMS2);
- series_play("102ha09s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("102ha09s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS2, "102ha09", 6, 256, 3);
break;
@@ -483,20 +484,20 @@ void Room102::daemon() {
_val11 = 40;
_G(flags)[GLB_TEMP_5] = 1;
digi_preload_stream_breaks(STREAMS3);
- series_play("102ha10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS3, "102ha10", 6, 256, 3);
+ series_play("102ha10s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS3, "102ha10", 6, 0x100, 3);
break;
case 39:
digi_unload_stream_breaks(STREAMS2);
_val11 = 41;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 40:
digi_unload_stream_breaks(STREAMS3);
_val11 = 41;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 41:
@@ -507,7 +508,7 @@ void Room102::daemon() {
digi_preload_stream_breaks(STREAMS4);
series_play("102ha04s", 1024, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS4, "102ha04", 6, 768, 3);
+ series_stream_with_breaks(STREAMS4, "102ha04", 6, 0x300, 3);
break;
case 42:
@@ -520,10 +521,9 @@ void Room102::daemon() {
_index3 = series_load("102wi05", -1);
_index4 = series_load("102ha05", -1);
_val11 = 43;
- _val12 = 43;
+ _harryShould = 43;
- series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
- series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
conv_load_and_prepare("conv06", 21, false);
conv_export_pointer_curr(&_val4, 0);
@@ -567,14 +567,12 @@ void Room102::daemon() {
while ((frame = imath_ranged_rand(16, 21)) == _val3) {
}
- _val13 = frame;
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, frame, frame);
+ _val3 = frame;
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
} else {
- _val13 = 35;
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
- series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 16);
+ _harryShould = 35;
+ Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
}
break;
@@ -582,43 +580,36 @@ void Room102::daemon() {
switch (_val11) {
case 20:
frame = imath_ranged_rand(8, 11);
- series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
break;
case 21:
frame = imath_ranged_rand(12, 15);
- series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
break;
case 43:
frame = imath_ranged_rand(4, 7);
- series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
- series_play("102ha05s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
break;
case 44:
_val11 = 45;
- series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 24);
- series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 24);
+ Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 24);
break;
case 45:
- series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 24, 24);
- series_play("102ha05s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 24, 24);
+ Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 24, 24);
break;
case 48:
_val11 = 49;
- series_play("102ha05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 3);
- series_play("102ha05s", 0xa01, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ Series::series_play("102ha05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 3);
break;
case 49:
_val11 = 50;
- series_play("102ha05", 2818, 2, 3, 30, 0, 100, 0, 0, 8, 8);
- series_play("102ha05s", 2818, 2, -1, 30, 0, 100, 0, 0, 8, 8);
+ Series::series_play("102ha05", 0xb02, 2, 3, 30, 0, 100, 0, 0, 8, 8);
break;
case 50:
@@ -657,9 +648,9 @@ void Room102::daemon() {
_series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_index1 = series_load("102ha01", -1);
_val11 = 19;
- _val12 = 19;
+ _harryShould = 19;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
player_set_commands_allowed(true);
if (_G(flags)[V015] && !_G(flags)[V013])
@@ -672,8 +663,7 @@ void Room102::daemon() {
case 53:
_val11 = 54;
_index5 = series_load("102ha07", -1);
- series_play("102ha07", 3840, 0, 3, 10, 0, 100, 0, 0, 0, 7);
- series_play("102ha07s", 3841, 0, -1, 10, 0, 100, 0, 0, 0, 7);
+ Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, 0, 7);
if (_G(flags)[V013]) {
_play1 = "102h204";
@@ -686,8 +676,7 @@ void Room102::daemon() {
break;
case 54:
- series_play("102ha07", 3840, 0, 3, 30, 0, 100, 0, 0, 23, 23);
- series_play("102ha07s", 3841, 0, -1, 30, 0, 100, 0, 0, 23, 23);
+ Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 30, 0, 100, 0, 0, 23, 23);
if (_play1) {
digi_play(_play1, 1, 255, 10);
@@ -696,22 +685,20 @@ void Room102::daemon() {
break;
case 55:
- _val12 = 55;
- series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 30, 30);
- series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 30, 30);
+ _harryShould = 55;
+ Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 30, 30);
break;
case 56:
- _val12 = 56;
- series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 9, 10);
- series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 9, 10);
+ _harryShould = 56;
+ Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 9, 10);
break;
case 57:
series_unload(_index5);
_val11 = 46;
- series_play("102ha08s", 3841, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS5, "102ha08", 6, 3840, 3);
+ series_play("102ha08s", 0xf01, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS5, "102ha08", 6, 0xf00, 3);
break;
default:
@@ -721,8 +708,8 @@ void Room102::daemon() {
case 55:
if (_val11 == 55) {
- _series3 = series_play("102ha07", 3840, 4, -1, 6, -1, 100, 0, 0, 30, 33);
- _series6 = series_play("102ha07s", 3841, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+ _series3 = series_play("102ha07", 0xf00, 4, -1, 6, -1, 100, 0, 0, 30, 33);
+ _series6 = series_play("102ha07s", 0xf01, 4, -1, 6, -1, 100, 0, 0, 30, 33);
if (_play1) {
digi_play(_play1, 1, 255, 10);
@@ -733,16 +720,15 @@ void Room102::daemon() {
terminateMachineAndNull(_series3);
terminateMachineAndNull(_series6);
_series3 = nullptr;
- _val12 = 54;
- series_play("102ha07", 3840, 2, 3, 6, 0, 100, 0, 0, 30, 30);
- series_play("102ha07s", 3841, 2, -1, 6, 0, 100, 0, 0, 30, 30);
+ _harryShould = 54;
+ Series::series_play("102ha07", 0xf00, 2, 3, 6, 0, 100, 0, 0, 30, 30);
}
break;
case 56:
if (_val11 == 56) {
- _series3 = series_play("102ha07", 3840, 4, -1, 4, -1, 100, 0, 0, 11, 19);
- _series6 = series_play("102ha07s", 3841, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+ _series3 = series_play("102ha07", 0xf00, 4, -1, 4, -1, 100, 0, 0, 11, 19);
+ _series6 = series_play("102ha07s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 11, 19);
if (_play1) {
digi_play(_play1, 1, 255, 15);
@@ -752,9 +738,8 @@ void Room102::daemon() {
terminateMachineAndNull(_series3);
terminateMachineAndNull(_series6);
_series3 = nullptr;
- _val12 = 54;
- series_play("102ha07", 3840, 0, 3, 6, 0, 100, 0, 0, 20, 21);
- series_play("102ha07s", 3841, 0, -1, 6, 0, 100, 0, 0, 20, 21);
+ _harryShould = 54;
+ Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 20, 21);
}
break;
@@ -768,21 +753,22 @@ void Room102::daemon() {
case 59:
switch (_val13) {
case 58:
- _series4 = series_play("102wi05", 2816, 0, 4, 10, -1, 100, 0, 0, 0, 0);
- _series5 = series_play("102wi05s", 2817, 0, -1, 10, -1, 100, 0, 0, 0, 0);
+ _series4 = series_play("102wi05", 0xb00, 0, 4, 10, -1, 100, 0, 0, 0, 0);
+ _series5 = series_play("102wi05s", 0xb01, 0, -1, 10, -1, 100, 0, 0, 0, 0);
break;
case 60:
+ sub1();
frame = imath_ranged_rand(1, 5);
- series_play("102wi05", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
- series_play("102wi05s", 2817, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102wi05", 0xb00, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102wi05s", 0xb01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 63:
sub1();
- _val1 = 64;
+ _val14 = 64;
_val13 = 58;
- series_play_with_breaks(PLAY3, "102wi05", 2816, 4, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY3, "102wi05", 0xb00, 4, 3, 6, 100, 0, 0);
break;
default:
@@ -794,22 +780,22 @@ void Room102::daemon() {
case 62:
switch (_val13) {
case 58:
- _series4 = series_play("102wi03", 2816, 0, -1, 600, -1, 100, 0, 0, 2, 2);
- _series5 = series_play("102wi03s", 2816, 0, -1, 600, -1, 100, 0, 0, 2, 2);
+ _series4 = series_play("102wi03", 0xb00, 0, -1, 600, -1, 100, 0, 0, 2, 2);
+ _series5 = series_play("102wi03s", 0xb00, 0, -1, 600, -1, 100, 0, 0, 2, 2);
break;
case 60:
sub1();
frame = imath_ranged_rand(0, 5);
- _series4 = series_play("102wi03", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
- _series5 = series_play("102wi03s", 2816, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102wi03", 0xb00, 0, 4, 4, 0, 100, 0, 0, frame, frame);
+ series_play("102wi03s", 0xb00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
break;
case 61:
sub1();
_val13 = 60;
- series_play("102wi03", 2816, 1, 4, 6, 0, 100, 0, 0, 6, 9);
- series_play("102wi03s", 2816, 1, -1, 6, 0, 100, 0, 0, 6, 9);
+ series_play("102wi03", 0xb00, 1, 4, 6, 0, 100, 0, 0, 6, 9);
+ series_play("102wi03s", 0xb00, 1, -1, 6, 0, 100, 0, 0, 6, 9);
break;
default:
@@ -842,51 +828,50 @@ void Room102::daemon() {
case 10:
_val11 = 57;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 11:
- _series7 = series_play("102ha02s", 3841, 0, -1, 600, -1, 100, 0, 0, 40, 40);
+ _series7 = series_play("102ha02s", 0xf01, 0, -1, 600, -1, 100, 0, 0, 40, 40);
break;
case 12:
series_set_frame_rate(_stream1, 30000);
- ws_walk(_G(my_walker), 324, 341, 0, 13, 10, 1);
+ ws_walk(324, 341, 0, 13, 10, 1);
break;
case 13:
terminateMachineAndNull(_series7);
- series_play("102ha02s", 3841, 0, -1, 6, 0, 100, 0, 0, 42, -1);
+ series_play("102ha02s", 0xf01, 0, -1, 6, 0, 100, 0, 0, 42, -1);
series_set_frame_rate(_stream1, 6);
ws_OverrideCrunchTime(_stream1);
- ws_demand_location(_G(my_walker), 321, 343);
- ws_demand_facing(_G(my_walker), 4);
- ws_hide_walker(_G(my_walker));
+ ws_demand_location(321, 343, 4);
+ ws_hide_walker();
break;
case 14:
- ws_hide_walker(_G(my_walker));
+ ws_hide_walker();
break;
case 15:
_val11 = 54;
- kernel_trigger_dispatch_now(3);
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
case 16:
- ws_walk(_G(my_walker), 318, 343, 0, -1, 2, 1);
+ ws_walk(318, 343, 0, -1, 2, 1);
break;
case 17:
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
case 18:
_val8 = 1;
_val9 = 0;
_val11 = player_commands_allowed() && !digi_play_state(1) ? 26 : 19;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 19:
@@ -895,7 +880,7 @@ void Room102::daemon() {
case 21:
if (_G(flags)[V013]) {
- pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
} else {
player_set_commands_allowed(_flag1);
}
@@ -930,9 +915,9 @@ void Room102::daemon() {
case 25:
_series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
- _val12 = 19;
+ _harryShould = 19;
_val11 = 19;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
conv_resume_curr();
break;
@@ -956,7 +941,7 @@ void Room102::daemon() {
if (_G(flags)[V012] != 2)
player_set_commands_allowed(true);
_val11 = 19;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 1037:
@@ -980,18 +965,18 @@ void Room102::daemon() {
ws_demand_location(628, 325);
ws_demand_facing(9);
_G(wilbur_should) = 2;
- ws_walk(435, 329, 0, kCHANGE_WILBUR_ANIMATION, 9, 1);
+ ws_walk(435, 329, 0, kCHANGE_WILBUR_ANIMATION, 9);
break;
case 2:
if (_G(flags)[V012] == 2) {
_G(wilbur_should) = 3;
- _G(walker).wilbur_speech("102w003", kCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("102w003", kCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V012] == 0) {
_G(wilbur_should) = 5;
if (_G(flags)[V018]) {
- _G(walker).wilbur_speech("102w002", kCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("102w002", kCHANGE_WILBUR_ANIMATION);
} else {
queuePlay("102h001", kCHANGE_WILBUR_ANIMATION);
}
@@ -999,7 +984,7 @@ void Room102::daemon() {
break;
case 3:
- _G(walker).wilbur_speech("102w004", kCHANGE_WILBUR_ANIMATION);
+ wilbur_speech("102w004", kCHANGE_WILBUR_ANIMATION);
_G(wilbur_should) = 4;
break;
@@ -1025,8 +1010,8 @@ void Room102::daemon() {
}
} else {
_val11 = 19;
- kernel_trigger_dispatch_now(3);
- _G(walker).wilbur_speech("102w001", 28);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
+ wilbur_speech("102w001", 28);
_G(flags)[V018] = 1;
}
break;
@@ -1035,56 +1020,56 @@ void Room102::daemon() {
ws_hide_walker();
_G(wilbur_should) = 72;
digi_preload_stream_breaks(STREAMS6);
- series_play("102wi07s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi07", 6, 256, kCHANGE_WILBUR_ANIMATION);
+ series_play("102wi07s", 0xb00, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS6, "102wi07", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 72:
digi_unload_stream_breaks(STREAMS6);
ws_unhide_walker();
- _G(walker).wilbur_speech("102w011", 28);
+ wilbur_speech("102w011", 28);
break;
case 73:
ws_hide_walker();
_G(wilbur_should) = 74;
digi_preload_stream_breaks(STREAMS7);
- series_play("102wi06s", 2816, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi06", 6, 256, kCHANGE_WILBUR_ANIMATION);
+ series_play("102wi06s", 0xb00, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS7, "102wi06", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 74:
digi_unload_stream_breaks(STREAMS7);
ws_unhide_walker();
- _G(walker).wilbur_speech("102w011", 28);
+ wilbur_speech("102w011", 28);
break;
case 75:
ws_hide_walker();
_G(wilbur_should) = 76;
digi_preload_stream_breaks(STREAMS6);
- series_play("102wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS6, "102wi11", 6, 256, kCHANGE_WILBUR_ANIMATION);
+ series_play("102wi11s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS6, "102wi11", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 76:
digi_unload_stream_breaks(STREAMS6);
ws_unhide_walker();
- _G(walker).wilbur_speech("102w011", 28);
+ wilbur_speech("102w011", 28);
break;
case 77:
ws_hide_walker();
_G(wilbur_should) = 78;
digi_preload_stream_breaks(STREAMS7);
- series_play("102wi10s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- series_stream_with_breaks(STREAMS7, "102wi10", 6, 256, kCHANGE_WILBUR_ANIMATION);
+ series_play("102wi10s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_stream_with_breaks(STREAMS7, "102wi10", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 78:
digi_unload_stream_breaks(STREAMS7);
ws_unhide_walker();
- _G(walker).wilbur_speech("102w011", 28);
+ wilbur_speech("102w011", 28);
break;
case 79:
@@ -1097,7 +1082,7 @@ void Room102::daemon() {
if (!_G(flags)[V020])
digi_preload("102w008");
- series_play_with_breaks(PLAY4, "102wi09", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi09", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 80:
@@ -1123,7 +1108,7 @@ void Room102::daemon() {
terminateMachineAndNull(_laz2);
_G(flags)[V019] = 0;
_G(wilbur_should) = 83;
- series_play_with_breaks(PLAY4, "102wi08", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "102wi08", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 83:
@@ -1174,14 +1159,14 @@ void Room102::parser() {
conv_export_value_curr(_G(flags)[V016], 1);
conv_play_curr();
} else if (inv_player_has(_G(player).verb) && player_said("main street")) {
- _G(walker).wilbur_speech("102w015");
+ wilbur_speech("102w015");
} else if (player_said("exit") || player_said("gear", "main_street")) {
player_set_commands_allowed(false);
digi_preload("102_038");
digi_play("102_038", 2, 255, 17);
} else {
if (player_said("TAKE", "DOORWAY"))
- _G(walker).wilbur_speech("102W003");
+ wilbur_speech("102W003");
if (player_said("USE", "GO", "DOORWAY")) {
_G(wilbur_should) = 1;
@@ -1189,7 +1174,7 @@ void Room102::parser() {
}
if (player_said("USE", "GO", "FIRE ESCAPE")) {
- _G(walker).wilbur_speech("102W005");
+ wilbur_speech("102W005");
kernel_trigger_dispatch_now(1003);
}
@@ -1204,7 +1189,7 @@ void Room102::parser() {
queuePlay("102h005");
}
} else if (player_said("GEAR", "harry") || player_said("take", "harry")) {
- _G(walker).wilbur_speech("102w015");
+ wilbur_speech("102w015");
} else if (player_said("take", "hair wax") || player_said("take", "hair wax ")) {
if (_G(flags)[V012]) {
player_set_commands_allowed(false);
@@ -1230,7 +1215,7 @@ void Room102::parser() {
} else if (player_said("gear", "hair wax ") || player_said("gear", "hair wax ")) {
flagAction("102w012", "102h007");
} else if (player_said("take", "back room") || player_said("gear", "back room")) {
- _G(walker).wilbur_speech("102w015");
+ wilbur_speech("102w015");
} else if (player_said("enter", "back room")) {
if (_G(flags)[V012]) {
switch (_G(kernel).trigger) {
@@ -1257,7 +1242,7 @@ void Room102::parser() {
} else if (player_said("gear", "fish")) {
flagAction("102w026", "102h020");
} else if (player_said("gear", "bottles")) {
- _G(walker).wilbur_speech("102w029");
+ wilbur_speech("102w029");
} else if (player_said("take", "bottles")) {
if (_G(flags)[V012]) {
switch (_G(kernel).trigger) {
@@ -1268,7 +1253,7 @@ void Room102::parser() {
break;
case 1:
_G(kernel).trigger_mode = KT_PARSE;
- _G(walker).wilbur_speech("102w028");
+ wilbur_speech("102w028");
break;
default:
break;
@@ -1277,19 +1262,19 @@ void Room102::parser() {
player_set_commands_allowed(false);
}
} else if (player_said("take", "towels")) {
- _G(walker).wilbur_speech("102w2029");
+ wilbur_speech("102w2029");
} else if (player_said("gear", "towels")) {
flagAction("102w032", "102h025");
} else if (player_said("take", "mirror")) {
- _G(walker).wilbur_speech("102w015");
+ wilbur_speech("102w015");
} else if (player_said("gear", "mirror")) {
flagAction("102w034", "102h027");
} else if (player_said("take", "sink")) {
- _G(walker).wilbur_speech("102w037");
+ wilbur_speech("102w037");
} else if (player_said("gear", "sink")) {
flagAction("102w038", "102h029");
} else if (player_said("take", "stove")) {
- _G(walker).wilbur_speech("102w040");
+ wilbur_speech("102w040");
} else if (player_said("gear", "stove")) {
flagAction("102w041", "102h031");
} else if (player_said("harry") && inv_player_has(_G(player).verb) && !_G(flags)[V012]) {
@@ -1300,7 +1285,7 @@ void Room102::parser() {
case -1:
if (!_G(flags)[V012]) {
_G(kernel).trigger_mode = KT_PARSE;
- _G(walker).wilbur_speech("102w014");
+ wilbur_speech("102w014");
player_set_commands_allowed(false);
}
break;
@@ -1308,7 +1293,7 @@ void Room102::parser() {
queuePlay("102h009", 2, KT_PARSE);
break;
case 2:
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
kernel_timing_trigger(120, 3);
break;
@@ -1344,7 +1329,7 @@ void Room102::parser() {
queuePlay("102h014");
}
} else if (player_said("barber's chair")) {
- _G(walker).wilbur_speech("102W020");
+ wilbur_speech("102W020");
} else if (player_said("fish")) {
flagAction("102w023", "102h018");
} else if (player_said("bottles")) {
@@ -1372,10 +1357,10 @@ void Room102::flagAction(const char *name1, const char *name2) {
switch (_G(kernel).trigger) {
case -1:
if (_G(flags)[V012]) {
- _G(walker).wilbur_speech(name1);
+ wilbur_speech(name1);
} else {
_G(kernel).trigger_mode = KT_PARSE;
- _G(walker).wilbur_speech(name1, 1);
+ wilbur_speech(name1, 1);
player_set_commands_allowed(false);
}
break;
@@ -1490,12 +1475,12 @@ void Room102::queuePlay(const char *filename, int trigger, KernelTriggerType tri
_triggerMode = triggerMode;
player_set_commands_allowed(false);
- term_message("spleen %d %d %d %d", _val12, _val11, 19, 20);
+ term_message("spleen %d %d %d %d", _harryShould, _val11, 19, 20);
- if (_val12 == 20) {
+ if (_harryShould == 20) {
term_message("spleen2");
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
}
}
@@ -1503,10 +1488,10 @@ void Room102::freshen() {
if (_G(flags)[V012] == 2) {
player_set_commands_allowed(false);
_G(flags)[V012] = 0;
- _val12 = 54;
+ _harryShould = 54;
_val11 = 53;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
g_vars->getInterface()->freshen_sentence();
Section1::walk();
}
@@ -1525,7 +1510,7 @@ void Room102::conv04() {
if (node == 1 && entry == 0) {
_val11 = 26;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
player_update_info();
ws_walk(192, 327, 0, -1, 4);
} else if (node == 4 && entry == 0) {
@@ -1534,13 +1519,13 @@ void Room102::conv04() {
digi_preload("102_032");
digi_preload("102_033");
_val1 = 28;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else if ((node == 4 && entry == 1) || (node == 4 && entry == 2)) {
_val1 = 35;
conv_resume_curr();
} else {
_val1 = 19;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
conv_resume_curr();
}
} else if (who == 1) {
@@ -1647,7 +1632,7 @@ void Room102::conv06() {
if (node == 2) {
_val11 = 19;
_G(kernel).trigger_mode = KT_PARSE;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else if (node == 1 && entry == 4) {
_G(flags)[V014] = 1;
_val11 = 43;
@@ -1678,7 +1663,7 @@ void Room102::conv06() {
}
if (node == 2) {
- term_message("gonna_say_sheepdog %d %d", _val12, _val11);
+ term_message("gonna_say_sheepdog %d %d", _harryShould, _val11);
queuePlay(sound, 22, KT_PARSE);
_flag1 = true;
} else if (node == 1 && entry == 1) {
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 7fe7a932cec..da1e698df08 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -39,7 +39,7 @@ private:
int _val9 = 0;
uint32 _val10 = 99999;
int _val11 = 0;
- int _val12 = 0;
+ int _harryShould = 0;
int _val13 = 0;
int _val14 = 0;
int _val16 = 0;
Commit: 2ff2c349657ee87e9efb5bc367c66c042c79b659
https://github.com/scummvm/scummvm/commit/2ff2c349657ee87e9efb5bc367c66c042c79b659
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for Aunt Polly's house
Changed paths:
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room175.cpp
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 4ef777aee0a..ef6dd546d11 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -444,6 +444,7 @@ void Room171::daemon() {
case 22:
npc_say(5);
+ _pollyShould = 23;
series_play_with_breaks(PLAY10, "171ap10", 0x700, 5, 3);
break;
@@ -660,7 +661,7 @@ void Room171::pre_parser() {
player_walk_to(_G(click_x), 355);
}
- if (player_said("GEAR") && player_said("FRONT DOOR")) {
+ if (!player_said("GEAR") && player_said("FRONT DOOR")) {
player_set_facing_at(94, 281);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index d2129d80874..27b9445a882 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -63,6 +63,9 @@ static const seriesPlayBreak PLAY3[] = {
void Room175::init() {
switch (_G(game).previous_room) {
+ case RESTORING_GAME:
+ break;
+
case 171:
ws_demand_location(331, 272, 3);
_G(wilbur_should) = 1;
@@ -86,7 +89,7 @@ void Room175::init() {
digi_preload("175_001");
digi_play_loop("175_001", 2, 125);
- series_play("175fan", 0xf00);
+ series_play("175fan", 0xf00, 0, -1, 6, -1);
}
void Room175::daemon() {
@@ -115,6 +118,7 @@ void Room175::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
Commit: a541900c8ed93aab61c7074c42a622352310fb5d
https://github.com/scummvm/scummvm/commit/a541900c8ed93aab61c7074c42a622352310fb5d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Only say Home Sweet Home the first time
Changed paths:
engines/m4/burger/rooms/section1/room170.cpp
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index d880b9c268c..b48e2240e60 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -66,7 +66,7 @@ void Room170::init() {
digi_preload("100_001");
digi_play_loop("100_001", 3, 255);
- _firstTime = player_been_here(170);
+ _firstTime = !player_been_here(170);
series_show("170box", 0xa00);
switch (_G(game).previous_room) {
Commit: d1d2d3a0b14ef18f4023ed2d5edc044d485fa75e
https://github.com/scummvm/scummvm/commit/d1d2d3a0b14ef18f4023ed2d5edc044d485fa75e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Keep the player_info up to date, in case saving done via GMM
In the original, update_player_info is only called when the
mouse is moved. Since player_info is used on loading savegames
to place Wilbur within the restored scene, I had a problem with
making saves via the GMM immediately after entering scenes,
since in cases where the player is initially off-screen, they'd
likewise be offscreen in the restored save. By adding an update
to the main event loop, it ensures player_info is up to date
before the savegame is created.
Changed paths:
engines/m4/gui/gui_sys.cpp
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 8e5b71fe714..28a24e06f64 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -65,6 +65,10 @@ void gui_system_event_handler() {
// Allow pending events to be processed
g_events->process();
+ // WORKAROUND: Keep the player_info up to date, in case the game
+ // is saved directly via the GMM without moving the mouse
+ player_update_info();
+
// Deal with mouse events first..
_G(mouseX) = _G(MouseState).CursorColumn;
_G(mouseY) = _G(MouseState).CursorRow;
Commit: 61ebfb2013c3e7ad3fd5f6d38d7f39ba83369956
https://github.com/scummvm/scummvm/commit/61ebfb2013c3e7ad3fd5f6d38d7f39ba83369956
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove duplicate RESTORING_GAME constant
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room170.cpp
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room173.cpp
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room404.cpp
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/m4.cpp
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 76efd8aaf1d..154362a61c2 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -130,7 +130,7 @@ void Room101::init() {
door();
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
// Do nothing
break;
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 790b2f53fba..6a9466bb577 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -151,7 +151,7 @@ void Room102::init() {
_trigger = -1;
- if (_G(game).previous_room == RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
if (_G(flags)[V012] == 1) {
ws_demand_location(321, 343);
ws_demand_facing(4);
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index c87228543f5..f7c59aa2f2c 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -117,7 +117,7 @@ void Room103::init() {
_val3 = 0;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 101:
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index a924b00742c..8be13e8ebba 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -278,7 +278,7 @@ void Room105::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 104:
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 291dbfd6089..320c68bd0eb 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -164,7 +164,7 @@ void Room106::init() {
digi_play("106_102", 1, 255, 4);
break;
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 105975ef10c..7bc8c765f4e 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -71,7 +71,7 @@ void Room133_136::init() {
_G(kernel).call_daemon_every_loop = true;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 134:
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 216fd559e31..8b891e3a451 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -96,7 +96,7 @@ void Room135::init() {
digi_preload("135_004");
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 101:
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 87eda4c8110..0b0fbdabef8 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -81,7 +81,7 @@ void Room137::init() {
_flag3 = false;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
if (_G(flags)[V048])
_G(flags)[V048] = 1;
break;
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index a612bdf5ddf..13734a2e490 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -97,7 +97,7 @@ void Room138::init() {
digi_preload(NAMES[i]);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
if (_G(flags)[V048])
_G(flags)[V048] = 1;
break;
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index be2076ac012..668217130de 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -113,7 +113,7 @@ void Room139_144::init() {
preloadDigi();
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 139:
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 3674584e44e..7d3701a8f38 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -136,7 +136,7 @@ void Room141::preload() {
void Room141::init() {
digi_preload("144_001");
- if (_G(game).previous_room != RESTORING_GAME)
+ if (_G(game).previous_room != KERNEL_RESTORING_GAME)
player_set_commands_allowed(false);
if (!_G(flags)[V112]) {
@@ -181,7 +181,7 @@ void Room141::init() {
kernel_trigger_dispatch_now(7);
}
- if (_G(game).previous_room == RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
_series2 = series_play("141wave", 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
_val3 = 9;
_val4 = 9;
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index cf018242c8b..8c3d7c4841d 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -172,7 +172,7 @@ void Room142::init() {
digi_play_loop("142_004", 3, 255, -1);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
if (_G(flags)[V059]) {
ws_hide_walker();
_G(wilbur_should) = 2;
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 503ef222cbe..4e548adb273 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -140,7 +140,7 @@ void Room143::init() {
_G(kernel).call_daemon_every_loop = true;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 142:
@@ -288,7 +288,7 @@ void Room143::daemon() {
_digiTrigger = 15;
}
} else {
- wilbur_speech("143w506");
+ wilbur_speech("143w506", 16);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 3c65dc45c35..95c1949e2d4 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -213,7 +213,7 @@ void Room145::init() {
_state2 = 0;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 142:
diff --git a/engines/m4/burger/rooms/section1/room170.cpp b/engines/m4/burger/rooms/section1/room170.cpp
index b48e2240e60..e2c53e130e6 100644
--- a/engines/m4/burger/rooms/section1/room170.cpp
+++ b/engines/m4/burger/rooms/section1/room170.cpp
@@ -70,7 +70,7 @@ void Room170::init() {
series_show("170box", 0xa00);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
kernel_trigger_dispatch_now(1);
break;
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index ef6dd546d11..fb4a47ac149 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -289,7 +289,7 @@ void Room171::init() {
series_show("171phone", 0x700);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 170:
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index 4a98726c2f4..14e68a59217 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -93,7 +93,7 @@ static const seriesPlayBreak PLAY7[] = {
void Room172::init() {
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 171:
diff --git a/engines/m4/burger/rooms/section1/room173.cpp b/engines/m4/burger/rooms/section1/room173.cpp
index 6d78ad04a09..cc8d85c13b5 100644
--- a/engines/m4/burger/rooms/section1/room173.cpp
+++ b/engines/m4/burger/rooms/section1/room173.cpp
@@ -55,7 +55,7 @@ static const seriesPlayBreak PLAY2[] = {
void Room173::init() {
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 172:
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 3c8eebf812a..5a17ae3a662 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -67,7 +67,7 @@ static const seriesPlayBreak PLAY3[] = {
void Room174::init() {
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 175:
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index 27b9445a882..6286ab14207 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -63,7 +63,7 @@ static const seriesPlayBreak PLAY3[] = {
void Room175::init() {
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 171:
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index 4a449e98df2..3e93740bbb1 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -56,7 +56,7 @@ static const seriesPlayBreak PLAY1[] = {
void Room176::init() {
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 175:
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index c1007ece514..4ad05a9c0b3 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -200,7 +200,7 @@ void Room302::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 026271cce8c..5e82b3b7fd8 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -182,7 +182,7 @@ void Room303::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
if (_G(flags)[V117])
_timer = timer_read_60();
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index fcfa74a0773..40d474024cf 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -109,7 +109,7 @@ void Room304::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index 731ab22b10d..6ff37181ba0 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -83,7 +83,7 @@ void Room305::init() {
_series1 = series_show(_G(flags)[V134] ? "305genx" : "305gen", 0x200);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 335421033c9..ca53f6e46a4 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -99,7 +99,7 @@ void Room310::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 44e466d9d15..f9c757ac04c 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -193,7 +193,7 @@ void Room402::init() {
digi_preload("400_001");
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 406:
@@ -213,7 +213,7 @@ void Room402::init() {
hotspot_set_active("elmo", false);
hotspot_set_active("stolie", false);
- if (_G(game).previous_room != RESTORING_GAME) {
+ if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
_G(wilbur_should) = 5;
kernel_timing_trigger(120, kCHANGE_WILBUR_ANIMATION);
}
@@ -232,7 +232,7 @@ void Room402::init() {
kernel_trigger_dispatch_now(3);
if (_G(player).been_here_before) {
- if (_G(game).previous_room == RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
_val2 = 15;
} else {
_G(wilbur_should) = 5;
@@ -242,7 +242,7 @@ void Room402::init() {
} else {
_val2 = 15;
- if (_G(game).previous_room != RESTORING_GAME) {
+ if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
digi_preload_stream_breaks(SERIES1);
digi_preload_stream_breaks(SERIES2);
series_load("402dr06");
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
index dd05d206008..ae9107e1d4e 100644
--- a/engines/m4/burger/rooms/section4/room404.cpp
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -58,7 +58,7 @@ void Room404::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 406:
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index ad82c86b506..4b682bb222c 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -121,7 +121,7 @@ void Room405::init() {
pal_cycle_init(122, 127, 6);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(false);
ws_demand_location(199, 253, 4);
player_set_commands_allowed(true);
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index e8c14404594..dd6ae0d289b 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -433,7 +433,7 @@ void Room406::init() {
if (_G(flags)[V172] != 10026) {
loadSeries();
- if (_G(game).previous_room == RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
switch (_G(flags)[V172]) {
case 10023:
_val1 = 51;
@@ -463,7 +463,7 @@ void Room406::init() {
setHotspots1();
_val2 = 0;
- if (_G(game).previous_room != RESTORING_GAME) {
+ if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
if (player_been_here(406) || _G(flags)[V176]) {
if (_G(flags)[V172] != 10025 && _G(flags)[V172] != 10026) {
_val2 = 23;
@@ -503,7 +503,7 @@ void Room406::init() {
setupFish();
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
if (_G(flags)[V174] == 4003) {
ws_hide_walker();
_G(wilbur_should) = 7;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index d891caca28f..da89e1dddd8 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -183,7 +183,7 @@ void Room407::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
break;
case 402:
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index da6d37525dd..4cfed2b2414 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -273,7 +273,7 @@ void Room502::init() {
bool skip = false;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index fbddf9f73d8..83ff67fbc11 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -287,7 +287,7 @@ void Room503::init() {
_array1[_val2] = _array2[_val2] = -1;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 6b509d35c22..651c26822e5 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -230,7 +230,7 @@ void Room504::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index a215a90442d..67a207dfae0 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -86,7 +86,7 @@ void Room505::init() {
_G(flags)[V246] = 0;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index efa11f8aa19..b22bf8a83a0 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -145,7 +145,7 @@ void Room506::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index cf10e1f5d61..7d2fb6025d2 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -239,7 +239,7 @@ void Room507::init() {
_flag1 = _flag2 = false;
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index 1868d09fe7f..cf73fa5135f 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -115,7 +115,7 @@ void Room509::init() {
pal_cycle_init(109, 124, 6);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
if (inv_player_has("CHRISTMAS LIGHTS") || inv_player_has("CHRISTMAS LIGHTS ")) {
disable_player();
_G(wilbur_should) = 2;
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index aded78d919e..dc6d6af2676 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -367,7 +367,7 @@ void Room602::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
if (_G(flags)[V263]) {
_G(wilbur_should) = 11;
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 72b8d1d2cb2..7d510dd3e2e 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -211,7 +211,7 @@ void Room603::init() {
}
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index b2d39175cd6..14b267e045a 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -209,7 +209,7 @@ void Room604::init() {
kernel_trigger_dispatch_now(6014);
switch (_G(game).previous_room) {
- case RESTORING_GAME:
+ case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 26a3fd2cffa..50185fad778 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -85,7 +85,7 @@ void Sections::game_daemon_code() {
if (_G(kernel).trigger == 32001) {
_G(game).room_id = -1;
_G(game).section_id = -1;
- _G(game).previous_room = RESTORING_GAME;
+ _G(game).previous_room = KERNEL_RESTORING_GAME;
}
}
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index e2ee368cc8c..d87ff18d0bf 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -28,10 +28,6 @@
namespace M4 {
-enum {
- RESTORING_GAME = -2
-};
-
class Room {
public:
Room() {}
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index f935892a87b..ff8055dd232 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -82,7 +82,7 @@ Common::Error M4Engine::run() {
// Check for launcher savegame to load
if (ConfMan.hasKey("save_slot")) {
_G(kernel).restore_slot = ConfMan.getInt("save_slot");
- _G(game).previous_room = RESTORING_GAME;
+ _G(game).previous_room = KERNEL_RESTORING_GAME;
}
// Run game here
@@ -100,7 +100,7 @@ void M4Engine::m4_inflight() {
_G(kernel).going = true;
while (KEEP_PLAYING) {
- if (_G(game).previous_room == RESTORING_GAME) {
+ if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
midi_stop();
kernel_load_game(_G(kernel).restore_slot);
}
@@ -131,9 +131,9 @@ Common::Error M4Engine::loadGameState(int slot) {
// Don't load savegame immediately, just set the slot for the engine's
// kernel to take care of in the outer game loop
_G(kernel).restore_slot = slot;
- _G(game).new_room = RESTORING_GAME;
- _G(game).new_section = RESTORING_GAME;
- _G(game).previous_room = RESTORING_GAME;
+ _G(game).new_room = KERNEL_RESTORING_GAME;
+ _G(game).new_section = KERNEL_RESTORING_GAME;
+ _G(game).previous_room = KERNEL_RESTORING_GAME;
return Common::kNoError;
}
Commit: 19238b81f6d2707b4564d2353747bf6f4d94576d
https://github.com/scummvm/scummvm/commit/19238b81f6d2707b4564d2353747bf6f4d94576d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for Vera's Diner
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 4e548adb273..9b9d2d1a434 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_VERA_ANIMATION = 44
+};
+
const char *Room143::SAID[][4] = {
{ "VERA", "143W001", "999w011", "999w011" },
{ "BURL", nullptr, "999w011", "999w011" },
@@ -161,7 +165,7 @@ void Room143::init() {
_val1 = 8;
_val2 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
_val3 = 0;
_val4 = 6;
kernel_trigger_dispatch_now(43);
@@ -256,7 +260,7 @@ void Room143::daemon() {
case 7:
digi_play("143e600", 1, 255, 1);
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
case 8:
@@ -311,7 +315,7 @@ void Room143::daemon() {
case 15:
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -324,7 +328,7 @@ void Room143::daemon() {
case 17:
_val1 = 13;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
digi_play("143e503", 1, 255, 18);
break;
@@ -368,7 +372,7 @@ void Room143::daemon() {
_digiTrigger = 25;
_val6 = 30;
_val1 = 21;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
case 25:
@@ -385,7 +389,7 @@ void Room143::daemon() {
_digiTrigger = 7;
_val1 = 14;
_val6 = 31;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
case 28:
@@ -457,7 +461,7 @@ void Room143::daemon() {
_digiMode = KT_DAEMON;
_digiTrigger = 42;
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
case 42:
@@ -481,50 +485,54 @@ void Room143::daemon() {
}
break;
- case 44:
+ case kCHANGE_VERA_ANIMATION:
switch (_val2) {
case 8:
switch (_val1) {
case 8:
switch (imath_ranged_rand(1, 20)) {
case 1:
- series_play_with_breaks(PLAY5, "143ve02", 0xf00, 44, 2);
+ series_play_with_breaks(PLAY5, "143ve02", 0xf00, kCHANGE_VERA_ANIMATION, 2);
break;
case 2:
_val2 = 10;
- series_play("143ve03", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 3);
+ series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
default:
- series_play("143ve01", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 0);
+ series_play("143ve01", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 11:
_val2 = 10;
- series_play("143ve03", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 3);
+ series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
+ case 13:
+ case 14:
case 15:
_val2 = 13;
- Series::series_play("143ve14", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 8);
+ Series::series_play("143ve14", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 8);
break;
case 20:
_val1 = 8;
- series_play_with_breaks(PLAY6, "143ve07", 0xf00, 44, 3);
+ series_play_with_breaks(PLAY6, "143ve07", 0xf00, kCHANGE_VERA_ANIMATION, 3);
break;
+ case 21:
case 22:
_val2 = 21;
- Series::series_play("143ve08", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve08", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
+ case 25:
case 26:
_val2 = 27;
- series_play("143ve04", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 5);
+ series_play("143ve04", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
break;
default:
@@ -536,13 +544,13 @@ void Room143::daemon() {
if (_val1 == 8) {
if (imath_ranged_rand(1, 20) == 1) {
_val2 = 21;
- Series::series_play("143ve10", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 3);
+ Series::series_play("143ve10", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
} else {
- Series::series_play("143ve10", 0xf00, 0, 44, 10, 0, 100, 0, 0, 3, 3);
+ Series::series_play("143ve10", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
}
} else {
_val2 = 21;
- Series::series_play("143ve10", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 3);
+ Series::series_play("143ve10", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
}
break;
@@ -551,20 +559,20 @@ void Room143::daemon() {
case 8:
if (imath_ranged_rand(1, 20) == 1) {
_val2 = 8;
- series_play("143ve03", 0xf00, 2, 44, 10, 0, 100, 0, 0, 0, 3);
+ series_play("143ve03", 0xf00, 2, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
} else {
- series_play("143ve03", 0xf00, 0, 44, 10, 0, 100, 0, 0, 3, 3);
+ series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
}
break;
case 11:
_val2 = 11;
- series_play("143ve03", 0xf00, 0, 44, 4, 0, 100, 0, 0, 3, 3);
+ series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 4, 0, 100, 0, 0, 3, 3);
break;
default:
_val2 = 8;
- series_play("143ve03", 0xf00, 2, 44, 10, 0, 100, 0, 0, 0, 3);
+ series_play("143ve03", 0xf00, 2, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
break;
}
break;
@@ -576,45 +584,45 @@ void Room143::daemon() {
} else {
terminateMachineAndNull(_ve03);
_val2 = 10;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
case 13:
switch (_val1) {
case 13:
- Series::series_play("143ve15", 0xf00, 0, 44, 10, 0, 100, 0, 0, 4, 4);
+ Series::series_play("143ve15", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 4, 4);
break;
case 14:
_val2 = 14;
- Series::series_play("143ve17", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 2);
+ Series::series_play("143ve17", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
break;
case 15:
_val2 = (imath_ranged_rand(1, 2) == 1) ? 16 : 17;
- Series::series_play("143ve18", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143ve18", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 18:
_val1 = 19;
- Series::series_play("143ve16", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 1);
+ Series::series_play("143ve16", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 1);
break;
case 19:
terminateMachineAndNull(_plate);
_val1 = 13;
- Series::series_play("143ve16", 0xf00, 0, 44, 6, 0, 100, 0, 0, 2, 15);
+ Series::series_play("143ve16", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 15);
break;
case 21:
_val2 = 21;
- Series::series_play("143ve15", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve15", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
default:
_val2 = 10;
- Series::series_play("143ve19", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, -1);
+ Series::series_play("143ve19", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, -1);
break;
}
break;
@@ -628,7 +636,7 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 13;
- Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
break;
@@ -641,7 +649,7 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 13;
- Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 2);
+ Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
}
break;
@@ -654,7 +662,7 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 13;
- Series::series_play("143ve18", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
break;
@@ -663,31 +671,31 @@ void Room143::daemon() {
switch (_val1) {
case 15:
_val2 = 13;
- Series::series_play("143ve15", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve15", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 21:
if (imath_ranged_rand(1, 20) == 1) {
_val2 = 9;
- Series::series_play("143ve10", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 3);
+ Series::series_play("143ve10", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
} else {
- Series::series_play("143ve08", 0xf00, 0, 44, 10, 0, 100, 0, 0, 4, 4);
+ Series::series_play("143ve08", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 4, 4);
}
break;
case 22:
if (imath_ranged_rand(1, 2) == 1) {
_val2 = 23;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
} else {
_val2 = 24;
- Series::series_play("143ve11", 0xf00, 0, 44, 6, 0, 100, 0, 0, 2, 4);
+ Series::series_play("143ve11", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 4);
}
break;
default:
_val2 = 8;
- Series::series_play("143ve08", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve08", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
@@ -701,7 +709,7 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 21;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
@@ -714,24 +722,24 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 21;
- Series::series_play("143ve11", 0xf00, 2, 44, 6, 0, 100, 0, 0, 2, 4);
+ Series::series_play("143ve11", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 4);
}
break;
case 25:
switch (_val1) {
case 25:
- Series::series_play("143ve06", 0xf00, 0, 44, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143ve06", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 26:
_val2 = 26;
- Series::series_play("143ve06", 0xf00, 0, 44, 4, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143ve06", 0xf00, 0, kCHANGE_VERA_ANIMATION, 4, 0, 100, 0, 0, 0, 0);
break;
default:
_val2 = 28;
- Series::series_play("143ve05", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve05", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
@@ -745,18 +753,18 @@ void Room143::daemon() {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
_val2 = 25;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
case 27:
_val2 = 25;
- Series::series_play("143ve05", 0xf00, 0, 44, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("143ve05", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 28:
_val2 = 8;
- Series::series_play("143ve04", 0xf00, 2, 44, 6, 0, 100, 0, 0, 0, 5);
+ Series::series_play("143ve04", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
break;
default:
@@ -1050,7 +1058,7 @@ void Room143::daemon() {
case 5:
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -1138,7 +1146,7 @@ void Room143::daemon() {
}
void Room143::pre_parser() {
- if (player_said("outside") && player_said_any("exit", "gear", "look", "look at"))
+ if (player_said("outside") && !player_said_any("exit", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9, 0);
}
@@ -1191,7 +1199,7 @@ void Room143::parser() {
case 1:
player_set_commands_allowed(false);
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
default:
@@ -1212,7 +1220,7 @@ void Room143::parser() {
case 1:
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
digi_play("143e502", 1, 255, 1);
break;
@@ -1232,7 +1240,7 @@ void Room143::parser() {
case 1:
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -1254,7 +1262,7 @@ void Room143::parser() {
case 1:
_val1 = 13;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
digi_play("143e501", 1, 255, 2);
break;
@@ -1269,7 +1277,7 @@ void Room143::parser() {
case 3:
player_set_commands_allowed(true);
_val1 = 8;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
default:
@@ -1280,7 +1288,7 @@ void Room143::parser() {
wilbur_speech("143w004");
else
wilbur_speech("143w003");
- } if (!_G(walker).wilbur_said(SAID)) {
+ } else if (!_G(walker).wilbur_said(SAID)) {
return;
}
@@ -1327,7 +1335,7 @@ void Room143::conv35() {
_val1 = 8;
if (_val2 != 13) {
_G(kernel).trigger = KT_DAEMON;
- kernel_trigger_dispatch_now(44);
+ kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
}
Commit: 9f75e3217d34c8ed446ab9ddea5b646749781ee0
https://github.com/scummvm/scummvm/commit/9f75e3217d34c8ed446ab9ddea5b646749781ee0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix global parser list handling
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index a5f235978bd..13d969049ce 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -97,150 +97,46 @@ static const char *SAID1[][4] = {
};
static const char *GLOBAL_PARSER_LIST[] = {
- "DEED",
- "LOOK AT",
- "999w101",
- "WILBUR",
- "400w001",
- nullptr,
- "999w102",
- "Th-th-th-that's all folks...",
- "JAWZ O' LIFE",
- "LOOK AT",
- "999w103",
- "WILBUR",
- "400w001",
- nullptr,
- "999w104",
- "Th-th-th-that's all folks...",
- "CARROT JUICE",
- "JUG",
- "300w046",
- "JUG ",
- "300w046",
- "JUG",
- "300w046",
- "AUNT POLLY",
- "999w225",
- nullptr,
- "300w057",
- "Th-th-th-that's all folks...",
- "SPRING",
- "BROKEN MOUSE TRAP",
- "405w018",
- nullptr,
- nullptr,
- "Th-th-th-that's all folks...",
- "BOTTLE",
- "WATER",
- "999w224",
- "WILBUR",
- "300w077",
- nullptr,
- "300w078",
- "Th-th-th-that's all folks...",
- "WHISTLE",
- nullptr,
- "300w070",
- "Th-th-th-that's all folks...",
- "BLOCK OF ICE",
- "FLOOR",
- "999w003",
- "FLOOR ",
- "999w003",
- "MICROWAVE",
- "999w222",
- "WILBUR",
- "999w003",
- nullptr,
- "999w004",
- "Th-th-th-that's all folks...",
- "PANTYHOSE",
- "ENGINE",
- "999w223",
- nullptr,
- "999w008",
- "Th-th-th-that's all folks...",
- "AMPLIFIER",
- "WILBUR",
- "999w027",
- nullptr,
- "999w029",
- "Th-th-th-that's all folks...",
- "MONEY",
- "STOLIE",
- "999w205",
- nullptr,
- "999w206",
- ",Th-th-th-that's all folks...",
- ",BROKEN PUZ DISPENSER",
- "LOOK AT",
- "999w207",
- nullptr,
- "999w209",
- "Th-th-th-that's all folks...",
- "PUZ DISPENSER",
- "LOOK AT",
- "999w207",
- nullptr,
- "999w209",
- "Th-th-th-that's all folks...",
- "SPRING",
- "LOOK AT",
- "999w210",
- nullptr,
- "999w211",
- "Th-th-th-that's all folks...",
- "PHONE BILL",
- "LOOK AT",
- "999w212",
- "AUNT POLLY",
- "999w213",
- nullptr,
- "999w206",
- "Th-th-th-that's all folks...",
- "LAXATIVE",
- "LOOK AT",
- "999w214",
- "GEAR",
- "999w215",
- "WILBUR",
- "999w215",
- "PEGLEG",
- "999w216",
- "PEGLEG ",
- "999w216",
- "PEGLEG ",
- "999w216",
- "TRUFFLES",
- "999w217",
- "GERBILS",
- "999w218",
- "BORK",
- "999w219",
- "BORK ",
- "999w219",
- "BORK ",
- "999w219",
- "BORK ",
- "999w219",
- "BORK ",
- "999w219",
- nullptr,
- nullptr,
- "Th-th-th-that's all folks...",
- "KEYS",
- "LOOK AT",
- "999w220",
- "WILBUR",
- "999w206",
- nullptr,
- "999w221",
- "Th-th-th-that's all folks...",
- "WILBUR",
- nullptr,
- "999w012",
- "Th-th-th-that's all folks...",
+ "DEED", "LOOK AT", "999w101", "WILBUR", "400w001",
+ nullptr, "999w102", PARSER_ITEM_END,
+ "JAWZ O' LIFE", "LOOK AT", "999w103", "WILBUR", "400w001",
+ nullptr, "999w104", PARSER_ITEM_END,
+ "CARROT JUICE", "JUG", "300w046", "JUG ", "300w046",
+ "JUG", "300w046", "AUNT POLLY", "999w225",
+ nullptr, "300w057", PARSER_ITEM_END,
+ "SPRING", "BROKEN MOUSE TRAP", "405w018",
+ nullptr, nullptr, PARSER_ITEM_END,
+ "BOTTLE", "WATER", "999w224", "WILBUR", "300w077",
+ nullptr, "300w078", PARSER_ITEM_END,
+ "WHISTLE", nullptr, "300w070", PARSER_ITEM_END,
+ "BLOCK OF ICE", "FLOOR", "999w003", "FLOOR ", "999w003",
+ "MICROWAVE", "999w222", "WILBUR", "999w003",
+ nullptr, "999w004", PARSER_ITEM_END,
+ "PANTYHOSE", "ENGINE", "999w223",
+ nullptr, "999w008", PARSER_ITEM_END,
+ "AMPLIFIER", "WILBUR", "999w027",
+ nullptr, "999w029", PARSER_ITEM_END,
+ "MONEY", "STOLIE", "999w205",
+ nullptr, "999w206", PARSER_ITEM_END,
+ "BROKEN PUZ DISPENSER", "LOOK AT", "999w207",
+ nullptr, "999w209", PARSER_ITEM_END,
+ "PUZ DISPENSER", "LOOK AT", "999w207",
+ nullptr, "999w209", PARSER_ITEM_END,
+ "SPRING", "LOOK AT", "999w210",
+ nullptr, "999w211", PARSER_ITEM_END,
+ "PHONE BILL", "LOOK AT", "999w212", "AUNT POLLY", "999w213",
+ nullptr, "999w206", PARSER_ITEM_END,
+ "LAXATIVE", "LOOK AT", "999w214", "GEAR", "999w215",
+ "WILBUR", "999w215", "PEGLEG", "999w216",
+ "PEGLEG ", "999w216", "PEGLEG ", "999w216",
+ "TRUFFLES", "999w217", "GERBILS", "999w218",
+ "BORK", "999w219", "BORK ", "999w219",
+ "BORK ", "999w219", "BORK ", "999w219",
+ "BORK ", "999w219",
+ nullptr, nullptr, PARSER_ITEM_END,
+ "KEYS", "LOOK AT", "999w220", "WILBUR", "999w206",
+ nullptr, "999w221", PARSER_ITEM_END,
+ "WILBUR", nullptr, "999w012", PARSER_ITEM_END,
nullptr
};
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index 304aea5948c..d5867a79344 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -34,7 +34,7 @@ const char *Section4::PARSER[] = {
"400w001",
nullptr,
nullptr,
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"JAWZ O' LIFE",
"TAKE",
nullptr,
@@ -46,7 +46,7 @@ const char *Section4::PARSER[] = {
"400w001",
nullptr,
nullptr,
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"FISH",
"LOOK AT",
"400w100",
@@ -58,7 +58,7 @@ const char *Section4::PARSER[] = {
"400w101",
nullptr,
"400w102",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"DOG COLLAR",
"LOOK AT",
"400w103",
@@ -70,7 +70,7 @@ const char *Section4::PARSER[] = {
"400w104",
nullptr,
"400W105",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"HOOK",
"LOOK AT",
"400w106",
@@ -80,7 +80,7 @@ const char *Section4::PARSER[] = {
"400w001",
nullptr,
"400w107",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"RECORDS",
"LOOK AT",
"400w108",
@@ -90,7 +90,7 @@ const char *Section4::PARSER[] = {
"400w001",
nullptr,
"400w109",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"QUARTER",
"LOOK AT",
"400w110",
@@ -100,7 +100,7 @@ const char *Section4::PARSER[] = {
"400w001",
nullptr,
"400w111",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"DISC",
"LOOK AT",
"400w002",
@@ -108,7 +108,7 @@ const char *Section4::PARSER[] = {
"400w003",
nullptr,
"400w004",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"DISC ",
"LOOK AT",
"400w002",
@@ -116,7 +116,7 @@ const char *Section4::PARSER[] = {
"400w003",
nullptr,
"400w004",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
nullptr
};
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index cf19f1a6c4a..4e0f52a7970 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -69,7 +69,7 @@ const char *Section5::PARSER[] = {
nullptr,
nullptr,
"500w013",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"ROLLING PIN",
"LOOK AT",
"500w014",
@@ -95,7 +95,7 @@ const char *Section5::PARSER[] = {
"500w019",
nullptr,
"500w020",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"DIRTY SOCK",
"LOOK AT",
"500w021",
@@ -139,7 +139,7 @@ const char *Section5::PARSER[] = {
"500w027",
nullptr,
"500w028",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"RUBBER DUCKY",
"LOOK AT",
"500w029",
@@ -165,7 +165,7 @@ const char *Section5::PARSER[] = {
"500w030",
nullptr,
"500w043",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"SOAPY WATER",
"LOOK AT",
"500w044",
@@ -201,7 +201,7 @@ const char *Section5::PARSER[] = {
"500w059",
nullptr,
"500w060",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"KINDLING",
"LOOK AT",
"500w061",
@@ -223,7 +223,7 @@ const char *Section5::PARSER[] = {
"500w071",
nullptr,
"500w072",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"RUBBER GLOVES",
"LOOK AT",
"500w073",
@@ -241,7 +241,7 @@ const char *Section5::PARSER[] = {
"500w076",
nullptr,
"500w078"
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"CHRISTMAS LIGHTS",
"LOOK AT",
"500w080",
@@ -261,7 +261,7 @@ const char *Section5::PARSER[] = {
"500w090",
nullptr,
"500w091",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"CHRISTMAS LIGHTS ",
"LOOK AT",
"500w079",
@@ -279,7 +279,7 @@ const char *Section5::PARSER[] = {
"500w090",
nullptr,
"500w091",
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"BOTTLE",
"TAKE",
nullptr,
@@ -291,7 +291,7 @@ const char *Section5::PARSER[] = {
"507w037",
nullptr,
nullptr,
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
"AMPLIFIER",
"TAKE",
nullptr,
@@ -307,7 +307,7 @@ const char *Section5::PARSER[] = {
"999w028",
nullptr,
nullptr,
- "Th-th-th-that's all folks...",
+ PARSER_ITEM_END,
nullptr
};
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 94d583297e5..67b4d4ffbbd 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -350,29 +350,41 @@ void Walker::speech_random(int count, int trigger,
}
bool Walker::wilbur_parser(const char **list) {
- bool flag = true;
-
for (const char **curr = list; *curr; ++curr) {
if (player_said(*curr)) {
- for (; *curr; ++curr) {
- if (!player_said(*curr)) {
- ++curr;
- } else {
- if (!*++curr) {
- flag = 0;
- } else {
- wilbur_speech(*curr);
+ // Found section for the item
+ bool useDefault = true;
+ ++curr;
+ while (*curr) {
+ const char *action = *curr++;
+ const char *sound = *curr++;
+
+ if (player_said(action)) {
+ // Found the action on the item we want
+ if (sound) {
+ // Has a sound
+ wilbur_speech(sound);
return true;
+ } else {
+ // No sound for this
+ useDefault = false;
}
}
}
- if (*++curr && flag) {
- wilbur_speech(*curr);
+ // Check default fallback
+ const char *defaultSound = *++curr;
+ if (defaultSound && useDefault) {
+ wilbur_speech(defaultSound);
return true;
}
+
+ // Skip past the item end entry
+ ++curr;
+
} else {
- for (; !*curr || scumm_stricmp(*curr, "Th-th-th-that's all folks..."); ++curr) {
+ // Not the item we want, so skip the section
+ for (; !*curr || scumm_stricmp(*curr, PARSER_ITEM_END); ++curr) {
}
}
}
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 4ac5d1b44a2..efa174c30e7 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -29,6 +29,8 @@
namespace M4 {
namespace Burger {
+#define PARSER_ITEM_END "Th-th-th-that's all folks..."
+
struct WilburMatch {
const char *_word0;
const char *_word1;
Commit: 8aed7e84afc1e56f2efa31a4e9483cb7acb6872f
https://github.com/scummvm/scummvm/commit/8aed7e84afc1e56f2efa31a4e9483cb7acb6872f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Old Bridge fixes
Changed paths:
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room135.cpp
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 7bc8c765f4e..c81840a428f 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -123,6 +123,7 @@ void Room133_136::daemon() {
case 2:
_G(flags)[V298] = 1;
digi_play("136c001", 1, 255, 5, 136);
+ _val1 = 1;
kernel_trigger_dispatch_now(3);
break;
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 8b891e3a451..31c11f9d093 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -27,6 +27,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_ODIE_ANIMATION = 32
+};
+
static const char *SAID1[][4] = {
{ "OLD BRIDGE", "134W001", "134W002", "134W002" },
{ "NEW BRIDGE", "134W003", "134W002", "134W002" },
@@ -255,8 +259,8 @@ void Room135::daemon() {
break;
case 14:
- _series5 = series_play("135od07", 2560, 0, -1, 600, -1, 100, 0, 0, 0, 0);
- _series6 = series_play("135od07s", 2560, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _series5 = series_play("135od07", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _series6 = series_play("135od07s", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
ws_hide_walker();
series_play("135wi01", 1536, 0, 15, 6, 0, 100, 0, 0, 0, 14);
series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 0, 14);
@@ -271,8 +275,8 @@ void Room135::daemon() {
case 16:
terminateMachineAndNull(_series5);
terminateMachineAndNull(_series6);
- series_play("135od06", 2560, 0, 17, 6, 0, 100, 0, 0, 0, 4);
- series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ series_play("135od06", 0xa00, 0, 17, 6, 0, 100, 0, 0, 0, 4);
+ series_play("135od06s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 4);
break;
case 17:
@@ -281,16 +285,16 @@ void Room135::daemon() {
_val6 = 1;
_val5 = 1;
_G(flags)[V001]--;
- series_play("135od06", 2560, 0, 32, 6, 0, 100, 0, 0, 5, 13);
- series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 5, 13);
+ series_play("135od06", 0xa00, 0, 32, 6, 0, 100, 0, 0, 5, 13);
+ series_play("135od06s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 5, 13);
series_play("135wi01", 1536, 0, 9, 6, 0, 100, 0, 0, 14, 15);
series_play("135wi01s", 1536, 0, -1, 6, 0, 100, 0, 0, 14, 15);
conv_resume();
break;
case 18:
- series_play("135od17", 2560, 0, 19, 6, 0, 100, 0, 0, 0, 1);
- series_play("135od17s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 1);
+ series_play("135od17", 0xa00, 0, 19, 6, 0, 100, 0, 0, 0, 1);
+ series_play("135od17s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 1);
break;
case 19:
@@ -307,8 +311,8 @@ void Room135::daemon() {
_val5 = 1;
_val6 = 1;
inv_give_to_player("broken puz dispenser");
- series_play("135od17", 2560, 0, 32, 6, 0, 100, 0, 0, 2, 6);
- series_play("135od17s", 2560, 0, -1, 6, 0, 100, 0, 0, 2, 6);
+ series_play("135od17", 0xa00, 0, 32, 6, 0, 100, 0, 0, 2, 6);
+ series_play("135od17s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 2, 6);
series_play("135wi01", 1536, 2, 10, 6, 0, 100, 0, 0, 0, 14);
series_play("135wi01s", 1536, 2, -1, 6, 0, 100, 0, 0, 0, 14);
break;
@@ -375,7 +379,7 @@ void Room135::daemon() {
_val9 = 33;
break;
- case 32:
+ case kCHANGE_ODIE_ANIMATION:
switch (_val5) {
case 1:
switch (_val6) {
@@ -385,39 +389,39 @@ void Room135::daemon() {
_frame = imath_ranged_rand(0, 5);
}
- series_play("135od01", 2560, 0, 32, 60, 0, 100, 0, 0, _frame, _frame);
- series_play("135od01s", 2560, 0, -1, 60, 0, 100, 0, 0, _frame, _frame);
+ series_play("135od01", 0xa00, 0, kCHANGE_ODIE_ANIMATION, 60, 0, 100, 0, 0, _frame, _frame);
+ series_play("135od01s", 0xa00, 0, -1, 60, 0, 100, 0, 0, _frame, _frame);
break;
case 2:
frame = imath_ranged_rand(0, 8);
- series_play("135od03", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od03s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od03", 0xa00, 0, kCHANGE_ODIE_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od03s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
break;
case 3:
_val6 = 1;
- series_play_with_breaks(PLAY2, "135od04", 2560, 32, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY2, "135od04", 0xa00, kCHANGE_ODIE_ANIMATION, 3, 6, 100, 0, 0);
break;
case 4:
_val6 = 1;
- series_play_with_breaks(PLAY3, "1350d05", 2560, 32, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY3, "1350d05", 0xa00, kCHANGE_ODIE_ANIMATION, 3, 6, 100, 0, 0);
break;
case 5:
case 7:
_val5 = 5;
- series_play("135od08", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 11);
- series_play("135od08s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od08", 0xa00, 0, kCHANGE_ODIE_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od08s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 11);
break;
case 8:
_val6 = 11;
_val5 = 11;
- series_play("135od06", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 11);
- series_play("135od06s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od06", 0xa00, 0, kCHANGE_ODIE_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
+ series_play("135od06s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 11);
break;
case 9:
@@ -426,20 +430,21 @@ void Room135::daemon() {
case 10:
_val6 = 1;
- series_play("135od22", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 6);
- series_play("135od22s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 6);
+ series_play("135od22", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, 6);
+ series_play("135od22s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 6);
break;
+ case 11:
case 12:
_val5 = 11;
- series_play("135od04", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 3);
- series_play("135od04s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04", 0xa00, 0, kCHANGE_ODIE_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 3);
break;
case 22:
_val6 = 23;
- series_play("134od23", 2560, 0, 32, 6, 0, 100, 0, 0, 0, -1);
- series_play("134od23s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od23", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od23s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, -1);
break;
case 23:
@@ -449,22 +454,22 @@ void Room135::daemon() {
case 24:
_val6 = 25;
- series_play("134od24", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 36);
- series_play("134od24s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 36);
+ series_play("134od24", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, 36);
+ series_play("134od24s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 36);
break;
case 25:
terminateMachineAndNull(_play2);
_val6 = 26;
- series_play("134od24", 2560, 0, 32, 6, 0, 100, 0, 0, 37, -1);
- series_play("134od24s", 2560, 0, -1, 6, 0, 100, 0, 0, 37, -1);
+ series_play("134od24", 0xa00, 0, 32, 6, 0, 100, 0, 0, 37, -1);
+ series_play("134od24s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 37, -1);
break;
case 26:
_G(flags)[V039] = 1;
_val6 = 25;
- series_play("134od25", 2560, 0, 12, 6, 0, 100, 0, 0, 0, -1);
- series_play("134od25s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od25", 0xa00, 0, 12, 6, 0, 100, 0, 0, 0, -1);
+ series_play("134od25s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, -1);
break;
default:
@@ -475,8 +480,8 @@ void Room135::daemon() {
case 2:
if (_val6 == 2) {
frame = imath_ranged_rand(0, 5);
- series_play("135od05", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od05s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od05", 0xa00, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od05s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
} else {
_val5 = 1;
@@ -487,56 +492,56 @@ void Room135::daemon() {
case 5:
switch (_val6) {
case 5:
- series_play("135od09", 2560, 0, 32, 20, 0, 100, 0, 0, 0, 0);
- series_play("135od09s", 2560, 0, -1, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od09", 0xa00, 0, 32, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od09s", 0xa00, 0, -1, 20, 0, 100, 0, 0, 0, 0);
break;
case 7:
frame = imath_ranged_rand(0, 5);
- series_play("135od10", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od10s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od10", 0xa00, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od10s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
break;
default:
_val5 = 6;
- series_play("135od09", 2560, 0, 32, 10, 0, 100, 0, 0, 1, 3);
- series_play("135od09s", 2560, 0, -1, 10, 0, 100, 0, 0, 1, 3);
+ series_play("135od09", 0xa00, 0, 32, 10, 0, 100, 0, 0, 1, 3);
+ series_play("135od09s", 0xa00, 0, -1, 10, 0, 100, 0, 0, 1, 3);
break;
}
break;
case 6:
_val5 = 1;
- series_play("135od11", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 18);
- series_play("135od11s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 18);
+ series_play("135od11", 0xa00, 0, 32, 10, 0, 100, 0, 0, 0, 18);
+ series_play("135od11s", 0xa00, 0, -1, 10, 0, 100, 0, 0, 0, 18);
break;
case 11:
switch (_val6) {
case 11:
- series_play("135od12", 2560, 0, 32, 20, 0, 100, 0, 0, 0, 0);
- series_play("135od12s", 2560, 0, -1, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od12", 0xa00, 0, 32, 20, 0, 100, 0, 0, 0, 0);
+ series_play("135od12s", 0xa00, 0, -1, 20, 0, 100, 0, 0, 0, 0);
break;
case 12:
frame = imath_ranged_rand(0, 5);
- series_play("135od12", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od12s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od12", 0xa00, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od12s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
break;
case 14:
_val6 = 15;
- series_play("135od07", 2560, 0, 32, 6, 0, 100, 0, 0, 2, 4);
- series_play("135od07s", 2560, 0, -1, 6, 0, 100, 0, 0, 2, 4);
+ series_play("135od07", 0xa00, 0, 32, 6, 0, 100, 0, 0, 2, 4);
+ series_play("135od07s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 2, 4);
break;
case 15:
_val6 = 16;
_val5 = 16;
- series_play("135od13", 2560, 0, 32, 6, 0, 100, 0, 0, 1, 3);
- series_play("135od13s", 2560, 0, -1, 6, 0, 100, 0, 0, 1, 3);
+ series_play("135od13", 0xa00, 0, 32, 6, 0, 100, 0, 0, 1, 3);
+ series_play("135od13s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 1, 3);
if (_val11 == 0)
inv_move_object("puz dispenser", 135);
@@ -548,8 +553,8 @@ void Room135::daemon() {
default:
_val5 = 1;
- series_play("135od04", 2560, 2, 32, 6, 0, 100, 0, 0, 0, 3);
- series_play("135od04s", 2560, 2, -1, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04", 0xa00, 2, 32, 6, 0, 100, 0, 0, 0, 3);
+ series_play("135od04s", 0xa00, 2, -1, 6, 0, 100, 0, 0, 0, 3);
break;
}
break;
@@ -557,11 +562,11 @@ void Room135::daemon() {
case 16:
if (_val6 == 16) {
if (_val11 == 0) {
- series_play("135od18", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 14);
- series_play("135od18s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135od18", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, 14);
+ series_play("135od18s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 14);
} else if (_val11 == 1) {
- series_play("135od14", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 5);
- series_play("135od14s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ series_play("135od14", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, 5);
+ series_play("135od14s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 5);
}
} else {
_val5 = 17;
@@ -576,21 +581,21 @@ void Room135::daemon() {
break;
case 17:
- series_play("135od20", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 0);
- series_play("135od20s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od20", 0xa00, 0, 32, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od20s", 0xa00, 0, -1, 10, 0, 100, 0, 0, 0, 0);
break;
case 18:
frame = imath_ranged_rand(0, 5);
- series_play("135od20", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od20s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od20", 0xa00, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od20s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
break;
default:
_val5 = 1;
- series_play("135od21", 2560, 0, 32, 6, 0, 100, 0, 0, 0, 2);
- series_play("135od21s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 2);
+ series_play("135od21", 0xa00, 0, 32, 6, 0, 100, 0, 0, 0, 2);
+ series_play("135od21s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 2);
break;
}
break;
@@ -598,14 +603,14 @@ void Room135::daemon() {
case 19:
switch (_val6) {
case 19:
- series_play("135od16", 2560, 0, 32, 10, 0, 100, 0, 0, 0, 0);
- series_play("135od16s", 2560, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od16", 0xa00, 0, 32, 10, 0, 100, 0, 0, 0, 0);
+ series_play("135od16s", 0xa00, 0, -1, 10, 0, 100, 0, 0, 0, 0);
break;
case 20:
frame = imath_ranged_rand(0, 4);
- series_play("135od16", 2560, 0, 32, 4, 0, 100, 0, 0, frame, frame);
- series_play("135od16s", 2560, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od16", 0xa00, 0, 32, 4, 0, 100, 0, 0, frame, frame);
+ series_play("135od16s", 0xa00, 0, -1, 4, 0, 100, 0, 0, frame, frame);
loadDigi();
break;
@@ -718,20 +723,20 @@ void Room135::daemon() {
switch (_val8) {
case 27:
if (imath_ranged_rand(1, 15) == 1) {
- _series2 = series_play("135bb01", 2560, 0, 34, 6, 0, 100, 0, 0, 0, 11);
- _series3 = series_play("135bb01s", 2560, 0, -1, 6, 0, 100, 0, 0, 0, 11);
+ _series2 = series_play("135bb01", 0xa00, 0, 34, 6, 0, 100, 0, 0, 0, 11);
+ _series3 = series_play("135bb01s", 0xa00, 0, -1, 6, 0, 100, 0, 0, 0, 11);
if (player_commands_allowed())
digi_play("135_004", 2, 205, -1);
} else {
- _series2 = series_play("135bb01", 2560, 0, 34, 30, 0, 100, 0, 0, 0, 0);
- _series3 = series_play("135bb01s", 2560, 0, -1, 30, 0, 100, 0, 0, 0, 0);
+ _series2 = series_play("135bb01", 0xa00, 0, 34, 30, 0, 100, 0, 0, 0, 0);
+ _series3 = series_play("135bb01s", 0xa00, 0, -1, 30, 0, 100, 0, 0, 0, 0);
}
break;
case 28:
- _series2 = series_play("135bb01", 2560, 0, 34, 30, 0, 100, 0, 0, 0, 0);
- _series3 = series_play("135bb01s", 2560, 0, -1, 30, 0, 100, 0, 0, 0, 0);
+ _series2 = series_play("135bb01", 0xa00, 0, 34, 30, 0, 100, 0, 0, 0, 0);
+ _series3 = series_play("135bb01s", 0xa00, 0, -1, 30, 0, 100, 0, 0, 0, 0);
break;
default:
@@ -819,11 +824,11 @@ void Room135::parser() {
_val10 = 30;
kernel_trigger_dispatch_now(33);
} else if (inv_player_has(_G(player).verb) && player_said_any("fork in the road", "main street")) {
- _G(walker).wilbur_speech("135w002");
+ wilbur_speech("135w002");
} else if (lookFlag && player_said("baitbox")) {
- _G(walker).wilbur_speech(_G(flags)[V038] ? "135w004" : "135w003");
+ wilbur_speech(_G(flags)[V038] ? "135w004" : "135w003");
} else if (lookFlag && player_said("wrecked truck")) {
- _G(walker).wilbur_speech(_G(flags)[V038] ? "135w007" : "135w006");
+ wilbur_speech(_G(flags)[V038] ? "135w007" : "135w006");
} else if (player_said("take", "baitbox") || player_said("gear", "baitbox")) {
player_set_commands_allowed(false);
loadOdie();
@@ -876,14 +881,16 @@ void Room135::conv01() {
_val6 = 1;
}
} else if (who == 1) {
- if (!(node == 2 && entry == 2) &&
- !(node == 4 && node == 10) &&
- !(node == 6 && entry == 0) &&
- !(node == 2 && entry == 1) &&
- !(node == 7 && node == 0)) {
+ if ((node == 2 && entry == 0) || (node == 4) || (node == 10) ||
+ (node == 6 && entry == 0) || (node == 2 && entry == 1) ||
+ (node == 7 && entry == 0)) {
+ // Do nothing
+ } else {
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
}
}
+
+ conv_resume(conv_get_handle());
break;
default:
Commit: f88fad64ef8fc5f9543028f10f061b839835e0d6
https://github.com/scummvm/scummvm/commit/f88fad64ef8fc5f9543028f10f061b839835e0d6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More Old Bridge fixes
Changed paths:
engines/m4/burger/rooms/section1/room135.cpp
engines/m4/m4.cpp
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room135.cpp
index 31c11f9d093..4c073703f30 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room135.cpp
@@ -407,7 +407,7 @@ void Room135::daemon() {
case 4:
_val6 = 1;
- series_play_with_breaks(PLAY3, "1350d05", 0xa00, kCHANGE_ODIE_ANIMATION, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY3, "135od05", 0xa00, kCHANGE_ODIE_ANIMATION, 3, 6, 100, 0, 0);
break;
case 5:
@@ -869,7 +869,7 @@ void Room135::conv01() {
_flag1 = false;
}
- if ((node == 7 && !entry) || (node == 2 && !entry)) {
+ if ((node == 7 && entry == 0) || (node == 2 && entry == 0)) {
_val6 = 8;
} else if (node == 2 && entry == 3) {
_val6 = 13;
@@ -916,19 +916,17 @@ void Room135::conv01() {
_name1 = conv_sound_to_play();
}
} else if (who == 1) {
- if ((node == 2 && entry == 0) ||
- (node == 4) ||
- (node == 10) ||
- (node == 6 && entry == 0) ||
- (node == 7 && entry == 0)) {
+ if ((node == 2 && entry == 0) || (node == 4) || (node == 10) ||
+ (node == 6 && entry == 0) || (node == 7 && entry == 0)) {
_val6 = 11;
digi_play(conv_sound_to_play(), 1, 255, 35);
} else if ((node == 7 && entry == 1) || (node == 2 && entry == 1)) {
_val6 = 14;
} else {
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
- digi_play(conv_sound_to_play(), 1, 255, 35);
}
+
+ digi_play(conv_sound_to_play(), 1, 255, 35);
}
} else {
conv_resume();
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index ff8055dd232..2db90f79378 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -120,11 +120,11 @@ void M4Engine::m4_inflight() {
}
bool M4Engine::canLoadGameStateCurrently(Common::U32String *msg) {
- return g_vars && INTERFACE_VISIBLE;
+ return g_vars && INTERFACE_VISIBLE && player_commands_allowed();
}
bool M4Engine::canSaveGameStateCurrently(Common::U32String *msg) {
- return g_vars && INTERFACE_VISIBLE;
+ return g_vars && INTERFACE_VISIBLE && player_commands_allowed();
}
Common::Error M4Engine::loadGameState(int slot) {
Commit: 8f79736aa3d5a5ee62d5a012931e56692dd76a50
https://github.com/scummvm/scummvm/commit/8f79736aa3d5a5ee62d5a012931e56692dd76a50
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes getting haircut
Changed paths:
engines/m4/adv_r/adv_walk.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section1/room102.h
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 8e509920626..062e53c49d2 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -352,6 +352,7 @@ void ws_hide_walker(machine *myWalker) {
return;
}
+ _G(player).walker_visible = false;
sendWSMessage(PLAYER_HIDE << 16, 0, myWalker, 0, nullptr, 1);
}
@@ -361,6 +362,7 @@ void ws_unhide_walker(machine *myWalker) {
return;
}
+ _G(player).walker_visible = true;
sendWSMessage(PLAYER_UNHIDE << 16, 0, myWalker, 0, nullptr, 1);
}
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 6a9466bb577..9cab2717615 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -114,7 +114,7 @@ void Room102::init() {
case 1:
_index1 = series_load("102ha01", -1);
_index2 = series_load("102ha03", -1);
- _val11 = 35;
+ _harryMode = 35;
_harryShould = 35;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
@@ -139,7 +139,7 @@ void Room102::init() {
_index1 = series_load("102ha01", -1);
setup(0, 0);
- _val11 = 19;
+ _harryMode = 19;
_harryShould = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
++_G(flags)[V015];
@@ -188,99 +188,99 @@ void Room102::daemon() {
case 19:
term_message(" mumble or change channel");
- if (timer_read_60() > _val10 &&_val11 == 19 && player_commands_allowed() &&
+ if (timer_read_60() > _val10 &&_harryMode == 19 && player_commands_allowed() &&
!digi_play_state(1) && INTERFACE_VISIBLE) {
if (_val8) {
- _val11 = 26;
+ _harryMode = 26;
term_message("change channel");
} else {
digi_play(getDigi1(_G(flags)[GLB_TEMP_2]), 2, 255, 18);
_val9 = 1;
- _val11 = 20;
+ _harryMode = 20;
term_message("mumble");
}
}
term_message("!");
- switch (_val11) {
+ switch (_harryMode) {
case 19:
switch (imath_ranged_rand(1, 45)) {
case 1:
case 2:
case 3:
- series_play("102ha01", 0xa00, 1, 3, 4, 0, 100, 0, 0, 0, 2);
+ series_play("102ha01", 0xa00, 1, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 0, 2);
break;
case 6:
_harryShould = 30;
- series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 0xa00, 2, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, 16, 19);
break;
case 7:
_harryShould = 31;
- series_play("102ha01", 0xa00, 2, 3, 10, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 2, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, 20, 23);
break;
case 8:
_harryShould = 24;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 1, 1);
break;
case 9:
_harryShould = 25;
- series_play("102ha01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 3, 4);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 7, 0, 100, 0, 0, 3, 4);
break;
case 10:
_harryShould = 23;
- series_play("102ha01", 0xa00, 0, 3, 8, 0, 100, 0, 0, 46, 48);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 8, 0, 100, 0, 0, 46, 48);
break;
default:
- series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 20:
_harryShould = 20;
- series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 24, 24);
break;
case 21:
_harryShould = 21;
- series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 30, 30);
break;
case 26:
- _val11 = 27;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ _harryMode = 27;
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 8, 14);
break;
case 27:
if (player_commands_allowed() && !digi_play_state(1)) {
setup();
- _val11 = 19;
+ _harryMode = 19;
_harryShould = 26;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else {
- series_play("102ha01", 0xa00, 0, 3, 60, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 60, 0, 100, 0, 0, 14, 14);
}
break;
case 28:
- _val11 = 29;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 8, 14);
+ _harryMode = 29;
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 8, 14);
break;
case 29:
setup(5);
- _val11 = 32;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ _harryMode = 32;
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 15, 15);
break;
case 32:
series_unload(_index1);
terminateMachineAndNull(_series1s);
- _val11 = 33;
+ _harryMode = 33;
series_play("102ha02s", 0xf01, 0, 11, 6, 0, 100, 0, 0, 0, 41);
digi_preload_stream_breaks(STREAMS1);
- series_stream_with_breaks(STREAMS1, "102ha02", 6, 0xf00, 3);
+ _stream1 = series_stream_with_breaks(STREAMS1, "102ha02", 6, 0xf00, 3);
break;
case 33:
@@ -290,12 +290,12 @@ void Room102::daemon() {
kernel_trigger_dispatch_now(4);
digi_stop(2);
_index2 = series_load("102ha03", -1);
- _val11 = 34;
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ _harryMode = 34;
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 34:
- _val11 = 35;
+ _harryMode = 35;
_harryShould = 35;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
hotspot_set_active("harry", false);
@@ -309,7 +309,7 @@ void Room102::daemon() {
break;
case 20:
- if (_val11 == 20) {
+ if (_harryMode == 20) {
if (_play1) {
digi_play(_play1, 1, 255, 26);
_play1 = nullptr;
@@ -322,12 +322,12 @@ void Room102::daemon() {
terminateMachineAndNull(_series3);
_series3 = nullptr;
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 24, 24);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 24, 24);
}
break;
case 21:
- if (_val11 == 21) {
+ if (_harryMode == 21) {
if (_play1) {
digi_play(_play1, 1, 255, 26);
_play1 = nullptr;
@@ -338,7 +338,7 @@ void Room102::daemon() {
terminateMachineAndNull(_series3);
_series3 = nullptr;
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 4, 0, 100, 0, 0, 30, 30);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, 30, 30);
}
break;
@@ -349,109 +349,109 @@ void Room102::daemon() {
case 23:
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 44, 46);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 44, 46);
break;
case 24:
- if (_val11 == 19) {
+ if (_harryMode == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 1, 1);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 1, 1);
}
} else {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 0);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
break;
case 25:
- if (_val11 == 19) {
+ if (_harryMode == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 5, 7);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 4);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 4, 4);
}
} else {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 5, 7);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 5, 7);
}
break;
case 26:
- if (_val11 == 19) {
+ if (_harryMode == 19) {
if (imath_ranged_rand(1, 17) == 1) {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 15, 15);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 14, 14);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 14, 14);
}
} else {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 15, 15);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 15, 15);
}
break;
case 30:
- if (_val11 == 19) {
+ if (_harryMode == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 19);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 16);
}
} else {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 19);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 19);
}
break;
case 31:
- if (_val11 == 19) {
+ if (_harryMode == 19) {
if (imath_ranged_rand(1, 15) == 1) {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 20, 23);
} else {
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 20);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 20, 20);
}
} else {
_harryShould = 19;
- series_play("102ha01", 0xa00, 0, 3, 6, 0, 100, 0, 0, 20, 23);
+ series_play("102ha01", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 20, 23);
}
break;
case 35:
- switch (_val11) {
+ switch (_harryMode) {
case 35:
switch (imath_ranged_rand(1, 4)) {
case 1:
if (!digi_play_state(2))
digi_play("102_030", 2, 255, -1);
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 4, 6);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 4, 6);
break;
case 2:
if (!digi_play_state(2))
digi_play("102_031", 2, 255, -1);
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 7, 8);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 7, 8);
break;
case 3:
if (!digi_play_state(2))
digi_play("102_032", 2, 255, -1);
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 9, 11);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 9, 11);
break;
case 4:
if (!digi_play_state(2))
digi_play("102_033", 2, 255, -1);
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 12, 15);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 12, 15);
break;
default:
@@ -468,12 +468,12 @@ void Room102::daemon() {
case 36:
_harryShould = 36;
- series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 16);
series_play("102ha03s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 16, 16);
break;
case 37:
- _val11 = 39;
+ _harryMode = 39;
_G(flags)[GLB_TEMP_5] = 2;
digi_preload_stream_breaks(STREAMS2);
series_play("102ha09s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
@@ -481,7 +481,7 @@ void Room102::daemon() {
break;
case 38:
- _val11 = 40;
+ _harryMode = 40;
_G(flags)[GLB_TEMP_5] = 1;
digi_preload_stream_breaks(STREAMS3);
series_play("102ha10s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
@@ -490,20 +490,20 @@ void Room102::daemon() {
case 39:
digi_unload_stream_breaks(STREAMS2);
- _val11 = 41;
+ _harryMode = 41;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 40:
digi_unload_stream_breaks(STREAMS3);
- _val11 = 41;
+ _harryMode = 41;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
case 41:
_val13 = 65;
series_unload(_index2);
- _val11 = 42;
+ _harryMode = 42;
sub1();
digi_preload_stream_breaks(STREAMS4);
@@ -520,10 +520,10 @@ void Room102::daemon() {
_index3 = series_load("102wi05", -1);
_index4 = series_load("102ha05", -1);
- _val11 = 43;
+ _harryMode = 43;
_harryShould = 43;
- Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 4);
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
conv_load_and_prepare("conv06", 21, false);
conv_export_pointer_curr(&_val4, 0);
@@ -538,7 +538,7 @@ void Room102::daemon() {
break;
case 36:
- if (_val11 == 36) {
+ if (_harryMode == 36) {
if (!digi_play_state(2)) {
++_val6;
@@ -568,47 +568,47 @@ void Room102::daemon() {
}
_val3 = frame;
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
} else {
_harryShould = 35;
- Series::series_play("102ha03", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 16);
+ Series::series_play("102ha03", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 16);
}
break;
case 43:
- switch (_val11) {
+ switch (_harryMode) {
case 20:
frame = imath_ranged_rand(8, 11);
- Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 21:
frame = imath_ranged_rand(12, 15);
- Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 43:
frame = imath_ranged_rand(4, 7);
- Series::series_play("102ha05", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 44:
- _val11 = 45;
- Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 16, 24);
+ _harryMode = 45;
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 16, 24);
break;
case 45:
- Series::series_play("102ha05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 24, 24);
+ Series::series_play("102ha05", 0xa00, 0, kCHANGE_HARRY_ANIMATION, 6, 0, 100, 0, 0, 24, 24);
break;
case 48:
- _val11 = 49;
+ _harryMode = 49;
Series::series_play("102ha05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 3);
break;
case 49:
- _val11 = 50;
+ _harryMode = 50;
Series::series_play("102ha05", 0xb02, 2, 3, 30, 0, 100, 0, 0, 8, 8);
break;
@@ -617,7 +617,7 @@ void Room102::daemon() {
series_unload(_index4);
series_unload(_index3);
_val13 = 65;
- _val11 = 51;
+ _harryMode = 51;
series_play_with_breaks(PLAY1, "102ha11", 0xa00, 3, 3, 6, 100, 0, 0);
break;
@@ -635,11 +635,11 @@ void Room102::daemon() {
break;
case 54:
- switch (_val11) {
+ switch (_harryMode) {
case 46:
terminateMachineAndNull(_series1);
terminateMachineAndNull(_series1s);
- _val11 = 47;
+ _harryMode = 47;
series_play_with_breaks(PLAY2, "102ha06", 0xa00, 3, 3, 6, 100, 0, 0);
hotspot_set_active("harry", true);
break;
@@ -647,7 +647,7 @@ void Room102::daemon() {
case 47:
_series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_index1 = series_load("102ha01", -1);
- _val11 = 19;
+ _harryMode = 19;
_harryShould = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
@@ -661,16 +661,16 @@ void Room102::daemon() {
break;
case 53:
- _val11 = 54;
+ _harryMode = 54;
_index5 = series_load("102ha07", -1);
Series::series_play("102ha07", 0xf00, 0, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, 0, 7);
if (_G(flags)[V013]) {
_play1 = "102h204";
- _val11 = 56;
+ _harryMode = 56;
_G(flags)[V014] = 1;
} else {
- _val11 = 55;
+ _harryMode = 55;
_play1 = _G(flags)[V015] ? "102h203" : "102h201";
}
break;
@@ -696,7 +696,7 @@ void Room102::daemon() {
case 57:
series_unload(_index5);
- _val11 = 46;
+ _harryMode = 46;
series_play("102ha08s", 0xf01, 0, -1, 6, 0, 100, 0, 0, 0, -1);
series_stream_with_breaks(STREAMS5, "102ha08", 6, 0xf00, 3);
break;
@@ -707,7 +707,7 @@ void Room102::daemon() {
break;
case 55:
- if (_val11 == 55) {
+ if (_harryMode == 55) {
_series3 = series_play("102ha07", 0xf00, 4, -1, 6, -1, 100, 0, 0, 30, 33);
_series6 = series_play("102ha07s", 0xf01, 4, -1, 6, -1, 100, 0, 0, 30, 33);
@@ -726,7 +726,7 @@ void Room102::daemon() {
break;
case 56:
- if (_val11 == 56) {
+ if (_harryMode == 56) {
_series3 = series_play("102ha07", 0xf00, 4, -1, 4, -1, 100, 0, 0, 11, 19);
_series6 = series_play("102ha07s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 11, 19);
@@ -823,11 +823,11 @@ void Room102::daemon() {
break;
case 9:
- _val11 = 44;
+ _harryMode = 44;
break;
case 10:
- _val11 = 57;
+ _harryMode = 57;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
@@ -854,7 +854,7 @@ void Room102::daemon() {
break;
case 15:
- _val11 = 54;
+ _harryMode = 54;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
@@ -870,7 +870,7 @@ void Room102::daemon() {
case 18:
_val8 = 1;
_val9 = 0;
- _val11 = player_commands_allowed() && !digi_play_state(1) ? 26 : 19;
+ _harryMode = player_commands_allowed() && !digi_play_state(1) ? 26 : 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
@@ -887,7 +887,7 @@ void Room102::daemon() {
break;
case 23:
- _val11 = 36;
+ _harryMode = 36;
player_set_commands_allowed(false);
switch (imath_ranged_rand(1, 4)) {
@@ -910,19 +910,19 @@ void Room102::daemon() {
case 24:
player_set_commands_allowed(true);
- _val11 = 35;
+ _harryMode = 35;
break;
case 25:
_series1s = series_play("102seats", 0xa01, 0, -1, 100, -1, 100, 0, 0, 0, 0);
_harryShould = 19;
- _val11 = 19;
+ _harryMode = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
conv_resume_curr();
break;
case 26:
- _val11 = 19;
+ _harryMode = 19;
_val10 = timer_read_60() + 600;
if (_trigger != -1) {
@@ -940,7 +940,7 @@ void Room102::daemon() {
case 29:
if (_G(flags)[V012] != 2)
player_set_commands_allowed(true);
- _val11 = 19;
+ _harryMode = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
break;
@@ -1009,7 +1009,7 @@ void Room102::daemon() {
break;
}
} else {
- _val11 = 19;
+ _harryMode = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
wilbur_speech("102w001", 28);
_G(flags)[V018] = 1;
@@ -1153,6 +1153,8 @@ void Room102::parser() {
conv04();
} else if (player_said("conv05")) {
conv05();
+ } else if (player_said("conv06")) {
+ conv06();
} else if (player_said("talk to")) {
conv_load_and_prepare("conv04", 19, false);
conv_export_value_curr(_G(flags)[V017], 0);
@@ -1470,12 +1472,12 @@ void Room102::queuePlay(const char *filename, int trigger, KernelTriggerType tri
}
_play1 = filename;
- _val11 = 20;
+ _harryMode = 20;
_trigger = trigger;
_triggerMode = triggerMode;
player_set_commands_allowed(false);
- term_message("spleen %d %d %d %d", _harryShould, _val11, 19, 20);
+ term_message("spleen %d %d %d %d", _harryShould, _harryMode, 19, 20);
if (_harryShould == 20) {
term_message("spleen2");
@@ -1489,7 +1491,7 @@ void Room102::freshen() {
player_set_commands_allowed(false);
_G(flags)[V012] = 0;
_harryShould = 54;
- _val11 = 53;
+ _harryMode = 53;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
g_vars->getInterface()->freshen_sentence();
@@ -1509,7 +1511,7 @@ void Room102::conv04() {
_G(kernel).trigger_mode = KT_DAEMON;
if (node == 1 && entry == 0) {
- _val11 = 26;
+ _harryMode = 26;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
player_update_info();
ws_walk(192, 327, 0, -1, 4);
@@ -1518,13 +1520,13 @@ void Room102::conv04() {
digi_preload("102_031");
digi_preload("102_032");
digi_preload("102_033");
- _val1 = 28;
+ _harryMode = 28;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else if ((node == 4 && entry == 1) || (node == 4 && entry == 2)) {
- _val1 = 35;
+ _harryMode = 35;
conv_resume_curr();
} else {
- _val1 = 19;
+ _harryMode = 19;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
conv_resume_curr();
}
@@ -1544,7 +1546,7 @@ void Room102::conv04() {
} else if (sound) {
if (who <= 0) {
if ((node == 4 && entry == 1) || (node == 4 && entry == 2)) {
- _val11 = 36;
+ _harryMode = 36;
digi_play(sound, 1, 255, 22);
_G(flags)[V012] = 1;
} else {
@@ -1553,7 +1555,7 @@ void Room102::conv04() {
} else if (who == 1) {
player_update_info();
- if (_G(player_info).facing != 2) {
+ if (_G(player).walker_visible && _G(player_info).facing != 2) {
ws_walk(192, 327, 0, 7, 2);
} else if (node == 4 && entry == 1) {
digi_preload("04p0502", 102);
@@ -1584,23 +1586,22 @@ void Room102::conv05() {
if (who <= 0) {
if ((node == 1 && entry == 3) || (node == 3 && entry == 9) ||
(node == 5 && entry == 8) || (node == 2)) {
- _val11 = 41;
- conv_resume_curr();
+ _harryMode = 41;
} else if ((node == 1 && entry == 0) || (node == 3 && entry == 8) ||
(node == 5 && entry == 7)) {
- _val11 = _G(flags)[V019] ? 38 : 37;
- conv_resume_curr();
+ _harryMode = _G(flags)[V019] ? 38 : 37;
} else {
- _val11 = 55;
- conv_resume_curr();
+ _harryMode = 35;
}
} else if (who == 1) {
_val13 = 58;
- conv_resume_curr();
}
+
+ conv_resume_curr();
+
} else if (sound) {
if (who <= 0) {
- _val11 = 36;
+ _harryMode = 36;
} else if (who == 1) {
if ((node == 1 && entry == 1) || (node == 3 && entry == 0) ||
(node == 3 && entry == 3) || (node == 5 && entry == 3)) {
@@ -1630,14 +1631,14 @@ void Room102::conv06() {
if (_G(kernel).trigger == 22) {
if (who <= 0) {
if (node == 2) {
- _val11 = 19;
+ _harryMode = 19;
_G(kernel).trigger_mode = KT_PARSE;
kernel_trigger_dispatch_now(kCHANGE_HARRY_ANIMATION);
} else if (node == 1 && entry == 4) {
_G(flags)[V014] = 1;
- _val11 = 43;
+ _harryMode = 43;
} else if (node != 1 || entry != 1) {
- _val11 = 43;
+ _harryMode = 43;
}
conv_resume_curr();
@@ -1646,7 +1647,7 @@ void Room102::conv06() {
if (node == 1 && entry == 1) {
_val13 = 63;
} else if (node == 2) {
- _val11 = _G(flags)[GLB_TEMP_4] == 1 ? 49 : 48;
+ _harryMode = _G(flags)[GLB_TEMP_4] == 1 ? 49 : 48;
_val13 = 58;
} else {
_val13 = 58;
@@ -1663,7 +1664,7 @@ void Room102::conv06() {
}
if (node == 2) {
- term_message("gonna_say_sheepdog %d %d", _harryShould, _val11);
+ term_message("gonna_say_sheepdog %d %d", _harryShould, _harryMode);
queuePlay(sound, 22, KT_PARSE);
_flag1 = true;
} else if (node == 1 && entry == 1) {
@@ -1673,7 +1674,7 @@ void Room102::conv06() {
if (_G(flags)[GLB_TEMP_5] == 1)
_G(flags)[V021] = 10032;
} else if (node == 1 && entry == 4) {
- _val11 = 21;
+ _harryMode = 21;
_G(flags)[GLB_TEMP_4] = 2;
if (_G(flags)[GLB_TEMP_5] == 1)
@@ -1682,7 +1683,7 @@ void Room102::conv06() {
_G(flags)[V013] = 1;
_flag1 = false;
} else {
- _val11 = 20;
+ _harryMode = 20;
}
} else if (who == 1) {
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index da1e698df08..2c4872a708c 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -38,7 +38,7 @@ private:
int _val8 = 0;
int _val9 = 0;
uint32 _val10 = 99999;
- int _val11 = 0;
+ int _harryMode = 0;
int _harryShould = 0;
int _val13 = 0;
int _val14 = 0;
Commit: 8c853303c1b1e4110f4a2a67e04486afbba520a9
https://github.com/scummvm/scummvm/commit/8c853303c1b1e4110f4a2a67e04486afbba520a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting ice from ice box
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room142.cpp
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 1214db0664d..e85acd671a2 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -164,7 +164,7 @@ void Flags::reset1() {
(*this)[V112] = 0;
(*this)[V058] = 0;
- (*this)[V059] = 0;
+ (*this)[kIceBoxOpened] = 0;
(*this)[V245] = 10027;
inv_move_object("pantyhose", 142);
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index b0c0e44670a..cebc4e4c0dd 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -91,7 +91,7 @@ enum {
V056 = 56,
V057 = 57,
V058 = 58,
- V059 = 59,
+ kIceBoxOpened = 59,
V060 = 60,
V061 = 61,
V062 = 62,
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 8c3d7c4841d..798f76a687b 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -54,7 +54,7 @@ const WilburMatch Room142::MATCH[] = {
{ "LOOK AT", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
{ "GEAR", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
{ "LOOK AT", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
- { "GEAR", "ICE BOX", kCHANGE_WILBUR_ANIMATION, &_G(flags)[V059], 0, &Vars::_wilbur_should, 1 },
+ { "GEAR", "ICE BOX", kCHANGE_WILBUR_ANIMATION, &_G(flags)[kIceBoxOpened], 0, &Vars::_wilbur_should, 1 },
{ "TAKE", "FANBELT", kCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
{ "GEAR", "BACK DOOR", 6, nullptr, 0, nullptr, 0 },
WILBUR_MATCH_END
@@ -173,7 +173,7 @@ void Room142::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
- if (_G(flags)[V059]) {
+ if (_G(flags)[kIceBoxOpened]) {
ws_hide_walker();
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -239,7 +239,7 @@ void Room142::init() {
hotspot_set_active("TOUR BUS", true);
}
- if (!_G(flags)[V059]) {
+ if (!_G(flags)[kIceBoxOpened]) {
_series5 = series_show("142icedr", 0xe00);
hotspot_set_active("ICE", false);
}
@@ -417,7 +417,7 @@ void Room142::daemon() {
case 2:
player_set_commands_allowed(true);
- _G(flags)[V059] = 1;
+ _G(flags)[kIceBoxOpened] = 1;
hotspot_set_active("ICE", true);
_series6 = series_show("142wi04", 0xdff, 0, -1, -1, 3);
_series7 = series_show("142wi04s", 0xdfe, 0, -1, -1, 3);
@@ -437,7 +437,7 @@ void Room142::daemon() {
break;
case 4:
- _G(flags)[V059] = 0;
+ _G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xf00);
enable_player();
@@ -454,7 +454,7 @@ void Room142::daemon() {
break;
case 6:
- _G(flags)[V059] = 0;
+ _G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xe00);
enable_player();
@@ -470,7 +470,7 @@ void Room142::daemon() {
break;
case 8:
- _G(flags)[V059] = 0;
+ _G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xe00);
enable_player();
@@ -593,7 +593,7 @@ void Room142::daemon() {
void Room142::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (_G(flags)[V059]) {
+ if (_G(flags)[kIceBoxOpened]) {
_G(player).ready_to_walk = false;
_G(player).need_to_walk = false;
@@ -613,6 +613,7 @@ void Room142::pre_parser() {
} else if (inv_player_has("BLOCK_OF_ICE")) {
wilbur_speech("142w009");
} else {
+ _G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR")) {
Commit: 1e9d31e12174fb02cdcb592dc7f7292acfcdadf6
https://github.com/scummvm/scummvm/commit/1e9d31e12174fb02cdcb592dc7f7292acfcdadf6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup and fixes for abduction
Changed paths:
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 67b4d4ffbbd..5c213166a2d 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -287,46 +287,49 @@ void wilbur_abduct(int trigger) {
digi_preload("999_004");
if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
- player_update_info(_G(my_walker), &_G(player_info));
+ player_update_info();
switch (_G(player_info).facing) {
case 1:
case 2:
- series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
- series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
+ series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 3:
case 4:
case 5:
- series_play("999ab04", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
- series_play("999ab04s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
+ series_play("999ab04", _G(player_info).depth, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ series_play("999ab04s", _G(player_info).depth + 1, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 7:
case 8:
case 9:
- series_play("999ab08", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
- series_play("999ab08s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
+ series_play("999ab08", _G(player_info).depth, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ series_play("999ab08s", _G(player_info).depth + 1, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10:
case 11:
- series_play("999ab10", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
- series_play("999ab10s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
+ series_play("999ab10", _G(player_info).depth, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ series_play("999ab10s", _G(player_info).depth + 1, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
+
default:
- series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
- series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0, _G(player_info).scale,
- _G(player_info).x, _G(player_info).y);
+ series_play("999ab02", _G(player_info).depth, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
+ series_play("999ab02s", _G(player_info).depth + 1, 0, -1, 6, 0,
+ _G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
}
+
+ ws_hide_walker();
}
digi_play("999_004", 2, 255, -1);
@@ -335,6 +338,7 @@ void wilbur_abduct(int trigger) {
if (!_G(flags)[V154] || imath_rand_bool(5)) {
digi_preload("402w005z");
digi_play("402w005z", 1, 255, -1);
+ _G(flags)[V154] = 1;
}
}
Commit: 3683306a6bf9f6c6f89ef376e907eeb47697d1f6
https://github.com/scummvm/scummvm/commit/3683306a6bf9f6c6f89ef376e907eeb47697d1f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix crash during first test
First test is now completeable \o/
Changed paths:
engines/m4/gui/gui_sys.cpp
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 28a24e06f64..022f751bf31 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -67,7 +67,8 @@ void gui_system_event_handler() {
// WORKAROUND: Keep the player_info up to date, in case the game
// is saved directly via the GMM without moving the mouse
- player_update_info();
+ if (_G(my_walker) && _G(player).walker_in_this_scene &&_G(player).walker_visible)
+ player_update_info();
// Deal with mouse events first..
_G(mouseX) = _G(MouseState).CursorColumn;
Commit: 776db75997583b59a0b206c15bdd4f3c882c9e48
https://github.com/scummvm/scummvm/commit/776db75997583b59a0b206c15bdd4f3c882c9e48
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup and fixes for Astral cutscene
Changed paths:
engines/m4/burger/burger.h
engines/m4/burger/rooms/section2/room204.cpp
engines/m4/burger/rooms/section2/room207.cpp
engines/m4/burger/rooms/section2/room207.h
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index 1775be26b89..e648efac845 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -54,7 +54,6 @@ private:
bool saidofInterest() const;
void testDone();
- void handleTestDone();
void testDone1();
void testDone2();
void testDone3();
@@ -82,6 +81,8 @@ public:
void global_daemon() override;
void global_pre_parser() override;
void global_parser() override;
+
+ void handleTestDone();
};
} // namespace Burger
diff --git a/engines/m4/burger/rooms/section2/room204.cpp b/engines/m4/burger/rooms/section2/room204.cpp
index 7a9ae5d253c..6da2f619a5a 100644
--- a/engines/m4/burger/rooms/section2/room204.cpp
+++ b/engines/m4/burger/rooms/section2/room204.cpp
@@ -67,8 +67,7 @@ void Room204::init() {
void Room204::daemon() {
switch (_G(kernel).trigger) {
case 1:
- series_show("204as01", 0x100, 0, 2, 120, 0);
- series_show("204as01s", 0x101, 0, 2, 120, 0);
+ Series::series_show("204as01", 0x100, 0, 2, 120, 0);
break;
case 2:
@@ -76,8 +75,7 @@ void Room204::daemon() {
break;
case 3:
- series_show("204as01", 0x100, 0, 4, 60, 2);
- series_show("204as01s", 0x101, 0, -1, 60, 2);
+ Series::series_show("204as01", 0x100, 0, 4, 60, 2);
break;
case 4:
@@ -85,8 +83,7 @@ void Room204::daemon() {
break;
case 5:
- series_show("204as01", 0x100, 0, 6, 60, 14);
- series_show("204as01s", 0x101, 0, -1, 60, 14);
+ Series::series_show("204as01", 0x100, 0, 6, 60, 14);
break;
case 6:
@@ -94,8 +91,7 @@ void Room204::daemon() {
break;
case 7:
- series_show("204as01", 0x100, 0, 8, 15, 18);
- series_show("204as01s", 0x101, 0, -1, 15, 18);
+ Series::series_show("204as01", 0x100, 0, 8, 15, 18);
break;
case 8:
diff --git a/engines/m4/burger/rooms/section2/room207.cpp b/engines/m4/burger/rooms/section2/room207.cpp
index 6bc9fc4f89d..0bf7daa67f8 100644
--- a/engines/m4/burger/rooms/section2/room207.cpp
+++ b/engines/m4/burger/rooms/section2/room207.cpp
@@ -20,12 +20,17 @@
*/
#include "m4/burger/rooms/section2/room207.h"
+#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_ASTRAL_ANIMATION = 1
+};
+
const seriesPlayBreak Room207::PLAY1[] = {
{ 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
@@ -138,49 +143,48 @@ void Room207::init() {
void Room207::daemon() {
switch (_G(kernel).trigger) {
- case 1:
- switch (_val2) {
+ case kCHANGE_ASTRAL_ANIMATION:
+ switch (_astralMode) {
case 15:
- switch (_val1) {
+ switch (_astralShould) {
case 1:
- _val1 = 7;
+ _astralShould = 7;
_series1.play("207as03", 0x200, 4, -1, 6, -1, 100, 0, 0, 31, 34);
- digi_play(conv_sound_to_play(), 1, 255, 1);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
- _val1 = 10;
+ _astralShould = 10;
conv_resume_curr();
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
- _val2 = 16;
- _val1 = 8;
- series_play_with_breaks(PLAY4, "207as03", 0x200, 5, 1);
+ _astralMode = 16;
+ _astralShould = 8;
+ series_play_with_breaks(PLAY4, "207as03", 0x200, 5, kCHANGE_ASTRAL_ANIMATION);
break;
case 10:
- _val1 = getVal();
- series_show("207as03", 0x200, 0, 1, 30, 30);
- series_show("207as03s", 0x201, 0, -1, 30, 30);
+ _astralShould = getAstralShould();
+ Series::series_show("207as03", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 30);
break;
case 11:
- _val1 = 10;
- series_play_with_breaks(PLAY5, "207as03", 0x200, 1, 1);
+ _astralShould = 10;
+ series_play_with_breaks(PLAY5, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
- _val2 = 17;
- _val1 = 12;
- series_play_with_breaks(PLAY10, "207as04", 0x200, 1, 1);
+ _astralMode = 17;
+ _astralShould = 12;
+ series_play_with_breaks(PLAY10, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
- _val2 = 0;
- series_play_with_breaks(PLAY7, "207as03", 0x200, 1, 1);
+ _astralMode = 0;
+ series_play_with_breaks(PLAY7, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
@@ -189,45 +193,45 @@ void Room207::daemon() {
break;
case 16:
- switch (_val1) {
+ switch (_astralShould) {
case 1:
- _val1 = 7;
+ _astralShould = 7;
_series1.play("207as01", 0x200, 4, -1, 6, -1, 100, 0, 0, 26, 30);
- digi_play(conv_sound_to_play(), 1, 255, 1);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
- _val1 = 8;
+ _astralShould = 8;
conv_resume_curr();
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
- _val1 = getVal();
- _series1.show("207as01", 0x200, 0, 1, 30, 23);
+ _astralShould = getAstralShould();
+ _series1.show("207as01", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 23);
break;
case 9:
- _val1 = 8;
- series_play_with_breaks(PLAY2, "207as01", 0x200, 1, 1);
+ _astralShould = 8;
+ series_play_with_breaks(PLAY2, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 10:
- _val2 = 15;
- _val1 = 10;
- series_play_with_breaks(PLAY3, "207as03", 0x200, 1, 1);
+ _astralMode = 15;
+ _astralShould = 10;
+ series_play_with_breaks(PLAY3, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
- _val2 = 17;
- _val1 = 12;
- series_play_with_breaks(PLAY8, "207as04", 0x200, 1, 1);
+ _astralMode = 17;
+ _astralShould = 12;
+ series_play_with_breaks(PLAY8, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
- _val2 = 0;
- series_play_with_breaks(PLAY6, "207as03", 0x200, 1, 1);
+ _astralMode = 0;
+ series_play_with_breaks(PLAY6, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
@@ -236,41 +240,40 @@ void Room207::daemon() {
break;
case 17:
- switch (_val1) {
+ switch (_astralShould) {
case 1:
- _val1 = 7;
+ _astralShould = 7;
_series1.play("207as04", 0x200, 4, -1, 6, -1, 100, 0, 0, 0, 4);
- digi_play(conv_sound_to_play(), 1, 255, 1);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
- _val1 = 12;
+ _astralShould = 12;
conv_resume_curr();
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
- _val2 = 16;
- _val1 = 8;
+ _astralMode = 16;
+ _astralShould = 8;
series_play_with_breaks(PLAY9, "207as04", 0x200, 5, 1);
break;
case 10:
- _val2 = 15;
- _val1 = 10;
- series_play_with_breaks(PLAY11, "207as04", 0x200, 1, 1);
+ _astralMode = 15;
+ _astralShould = 10;
+ series_play_with_breaks(PLAY11, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
- _val1 = getVal();
- series_show("207as04", 0x200, 0, 1, 30, 0);
- series_show("207as04s", 0x201, 0, -1, 30, 0);
+ _astralShould = getAstralShould();
+ Series::series_show("207as04", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 0);
break;
case 13:
- _val2 = 15;
- series_play_with_breaks(PLAY11, "207as03", 0x200, 1, 1);
+ _astralMode = 15;
+ series_play_with_breaks(PLAY11, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
@@ -279,11 +282,11 @@ void Room207::daemon() {
break;
default:
- switch (_val1) {
+ switch (_astralShould) {
case 5:
- _val2 = 16;
- _val1 = 8;
- series_play_with_breaks(PLAY1, "207as01", 0x200, 1, 1);
+ _astralMode = 16;
+ _astralShould = 8;
+ series_play_with_breaks(PLAY1, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
@@ -303,10 +306,10 @@ void Room207::daemon() {
conv_play_curr();
_G(wilbur_should) = 4;
- _val2 = 0;
- _val1 = 5;
+ _astralMode = 0;
+ _astralShould = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 3:
@@ -324,13 +327,12 @@ void Room207::daemon() {
break;
case 5:
- series_play_with_breaks(PLAY12, "207as01", 0x200, 1, 1);
+ series_play_with_breaks(PLAY12, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 6:
_series1.terminate();
- series_show("207as03", 0x200, 0, -1, -1, 22);
- series_show("207as03s", 0x201, 0, -1, -1, 22);
+ Series::series_show("207as03", 0x200, 0, -1, -1, 22);
conv_resume_curr();
break;
@@ -339,6 +341,10 @@ void Room207::daemon() {
disable_player_commands_and_fade_init(8);
break;
+ case 8:
+ static_cast<Burger::BurgerEngine *>(g_engine)->handleTestDone();
+ break;
+
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
@@ -349,7 +355,7 @@ void Room207::daemon() {
} else {
_G(wilbur_should) = 2;
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
- _general1 = series_play("207wi01", 0x400, 4);
+ _general1 = series_play("207wi01", 0x400, 4, -1, 6, -1);
}
break;
@@ -361,12 +367,12 @@ void Room207::daemon() {
break;
case 3:
- _G(wilbur_should) = getShould();
+ _G(wilbur_should) = getWilburShould();
series_show("207wi01", 0x400, 0, kCHANGE_WILBUR_ANIMATION, 30, 0);
break;
case 4:
- _G(wilbur_should) = getShould();
+ _G(wilbur_should) = getWilburShould();
series_play("207wi01", 0x400, 1, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
break;
@@ -384,39 +390,39 @@ void Room207::daemon() {
void Room207::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (!player_said(_conv1)) {
+ if (player_said(_conv1)) {
handleConv();
_G(player).command_ready = false;
}
}
void Room207::handleConv() {
- int who = conv_whos_talking();
const char *sound = conv_sound_to_play();
+ int who = conv_whos_talking();
int node = conv_current_node();
int entry = conv_current_entry();
- if (!sound) {
+ if (sound) {
if (who == 1) {
_G(wilbur_should) = 1;
if (player_said("conv56") && node == 4)
- _val1 = 8;
+ _astralShould = 8;
if (node == 0 && entry == 1)
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, -1);
} else if (player_said("conv51") && node == 8) {
- _val1 = 13;
+ _astralShould = 13;
} else {
- _val1 = 1;
+ _astralShould = 1;
}
}
}
-int Room207::getVal() const {
+int Room207::getAstralShould() const {
int rand = imath_ranged_rand(1, 24);
- switch (_val2) {
+ switch (_astralMode) {
case 15:
switch (rand) {
case 1:
@@ -457,11 +463,11 @@ int Room207::getVal() const {
break;
default:
- return _val1;
+ return _astralShould;
}
}
-int Room207::getShould() const {
+int Room207::getWilburShould() const {
int rand = imath_ranged_rand(1, 8);
return (rand == 1) ? 4 : 3;
}
diff --git a/engines/m4/burger/rooms/section2/room207.h b/engines/m4/burger/rooms/section2/room207.h
index 75df01263f6..f6f8ad0f6f9 100644
--- a/engines/m4/burger/rooms/section2/room207.h
+++ b/engines/m4/burger/rooms/section2/room207.h
@@ -47,12 +47,12 @@ private:
const char *_conv1 = nullptr;
Series _series1;
machine *_general1 = nullptr;
- int _val1 = 0;
- int _val2 = 0;
+ int _astralShould = 0;
+ int _astralMode = 0;
void handleConv();
- int getVal() const;
- int getShould() const;
+ int getAstralShould() const;
+ int getWilburShould() const;
public:
Room207() : Room() {}
Commit: 3322e43b39eb1dcff836bf9062781c80fe7f20c1
https://github.com/scummvm/scummvm/commit/3322e43b39eb1dcff836bf9062781c80fe7f20c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix doing actions in gerbil cage
Changed paths:
engines/m4/burger/rooms/section6/room604.cpp
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 14b267e045a..52382a94d7e 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -694,6 +694,8 @@ void Room604::pre_parser() {
_G(player).command_ready = false;
}
+ return;
+ } else {
return;
}
Commit: b8fd9705bd22739c5c6a79df23db2768ee9dc597
https://github.com/scummvm/scummvm/commit/b8fd9705bd22739c5c6a79df23db2768ee9dc597
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix boingy boigny in test 2
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/section6.cpp
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index dc6d6af2676..6505255337a 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -352,7 +352,7 @@ void Room602::init() {
hotspot_set_active("EXIT", false);
}
- if (_G(flags)[V256] == 10028) {
+ if (_G(flags)[V245] == 10028) {
Section6::_state1 = 6002;
kernel_trigger_dispatch_now(6013);
}
@@ -744,6 +744,12 @@ void Room602::daemon() {
kernel_trigger_dispatch_now(6008);
break;
+ case 6001:
+ Section6::_state3 = 6002;
+ _sectionMachine1 = series_play("602mg01", 0xc00, 0, 6011, 8, 0, 100, 0, 0, 0, 67);
+ _sectionMachine2 = series_play("602mg01s", 0xc01, 0, -1, 8, 0, 100, 0, 0, 0, 67);
+ break;
+
case 6002:
Section6::_state4 = 4;
@@ -1229,12 +1235,6 @@ void Room602::daemon() {
}
break;
- case 6001:
- Section6::_state3 = 6002;
- series_play("602mg01", 0xc00, 0, 6011, 8, 0, 100, 0, 0, 0, 67);
- _sectionMachine2 = series_play("602mg01s", 0xc01, 0, -1, 8, 0, 100, 0, 0, 0, 67);
- break;
-
case 10001:
if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1 && _G(flags)[V256] == 0)
kernel_trigger_dispatch_now(3);
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index b565a92c5f2..22319d648b0 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -63,11 +63,11 @@ Section6::Section6() : Rooms::Section() {
void Section6::daemon() {
switch (_G(kernel).trigger) {
-
+ case 6003:
case 6004:
case 6005:
case 6006:
- _G(game).new_room = _G(kernel).trigger - 6000;
+ _G(game).new_room = _G(kernel).trigger - 6000 + 600;
break;
case 6008:
@@ -283,7 +283,7 @@ void Section6::daemon() {
}
_G(wilbur_should) = 6001;
- ws_walk(352, 276, 0, kCHANGE_WILBUR_ANIMATION, 9);
+ ws_walk(352, 276, nullptr, kCHANGE_WILBUR_ANIMATION, 9);
break;
case 6001:
Commit: 1fce62dc53a2cc8d9f64ced0384de37df1c096e0
https://github.com/scummvm/scummvm/commit/1fce62dc53a2cc8d9f64ced0384de37df1c096e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Gerbil wakeup fixes
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room604.cpp
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 6505255337a..9b4608bd54c 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -730,6 +730,9 @@ void Room602::daemon() {
term_message("Wilbur is safe");
Section6::_state3 = 51;
}
+
+ _G(kernel).continue_handling_trigger = true;
+ kernel_trigger_dispatch_now(6011);
}
break;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 52382a94d7e..0e792f5ba59 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -288,14 +288,14 @@ void Room604::daemon() {
kernel_trigger_dispatch_now(2);
break;
- case 6:
- _G(game).new_room = 603;
- break;
-
case 7:
_G(game).new_room = 602;
break;
+ case 8:
+ _G(game).new_room = 603;
+ break;
+
case 9:
_G(game).new_room = 612;
break;
@@ -713,11 +713,12 @@ void Room604::parser() {
if (_G(flags)[V243] == 6000) {
_G(wilbur_should) = 9;
- wilbur_speech(_G(flags)[V248] ? "604w013" : "604w011");
+ wilbur_speech(_G(flags)[V248] ? "604w013" : "604w011",
+ kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 13;
- wilbur_speech("604w005");
+ wilbur_speech("604w005", kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR", "TUBE ") || player_said("CLIMB IN", "TUBE ")) {
_G(flags)[V246] = 1;
Commit: a8ce3904e0b086b0a009a424bc0d58db7baf470d
https://github.com/scummvm/scummvm/commit/a8ce3904e0b086b0a009a424bc0d58db7baf470d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of flags used in time loop restarts
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section3/room307.cpp
engines/m4/burger/rooms/section4/section4.cpp
engines/m4/burger/rooms/section5/room513.cpp
engines/m4/burger/rooms/section6/room606.cpp
engines/m4/burger/rooms/section6/room610.cpp
engines/m4/burger/rooms/section8/room801.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 13d969049ce..3a575e65723 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -532,19 +532,19 @@ void BurgerEngine::testDone() {
}
void BurgerEngine::handleTestDone() {
- if (_G(flags)[V287]) {
+ if (_G(flags)[kFirstTestPassed]) {
testDone1();
- if (_G(flags)[V241]) {
+ if (_G(flags)[kSecondTestPassed]) {
testDone2();
- if (_G(flags)[V099]) {
+ if (_G(flags)[kThirdTestPassed]) {
testDone3();
- if (_G(flags)[V184]) {
+ if (_G(flags)[kFourthTestPassed]) {
testDone4();
- if (_G(flags)[V152]) {
+ if (_G(flags)[kFifthTestPassed]) {
testDone5();
_G(game).setRoom(701);
@@ -572,7 +572,7 @@ void BurgerEngine::handleTestDone() {
}
void BurgerEngine::testDone1() {
- _G(flags)[V287] = 1;
+ _G(flags)[kFirstTestPassed] = 1;
if (!_G(flags)[kNEURO_TEST_COUNTER])
_G(flags)[kNEURO_TEST_COUNTER]++;
}
@@ -581,7 +581,7 @@ void BurgerEngine::testDone2() {
if (!_G(flags)[V242])
_G(flags)[V242]++;
- _G(flags)[V241] = 1;
+ _G(flags)[kSecondTestPassed] = 1;
_G(flags)[V243] = 6007;
_G(flags)[V244] = 6004;
_G(flags)[V245] = 10031;
@@ -625,7 +625,7 @@ void BurgerEngine::testDone3() {
inv_move_object("CARROT JUICE", NOWHERE);
inv_give_to_player("BOTTLE");
- _G(flags)[V099] = 1;
+ _G(flags)[kThirdTestPassed] = 1;
_G(flags)[V101] = 1;
_G(flags)[V107] = 1;
_G(flags)[V108] = 1;
@@ -669,7 +669,7 @@ void BurgerEngine::testDone4() {
inv_move_object("GIZMO", NOWHERE);
inv_give_to_player("BOTTLE");
- _G(flags)[V184] = 1;
+ _G(flags)[kFourthTestPassed] = 1;
_G(flags)[V186] = 0;
_G(flags)[V195] = 1;
_G(flags)[V196] = 0;
@@ -701,7 +701,7 @@ void BurgerEngine::testDone5() {
if (!_G(flags)[V153])
_G(flags)[V153]++;
- _G(flags)[V152] = 1;
+ _G(flags)[kFifthTestPassed] = 1;
_G(flags)[V157] = 1;
_G(flags)[V158] = 1;
_G(flags)[V159] = 1;
@@ -762,19 +762,19 @@ void BurgerEngine::wilburTeleported() {
if (_G(executing) != WHOLE_GAME) {
_G(game).setRoom(604);
} else {
- if (_G(flags)[V152]) {
+ if (_G(flags)[kFifthTestPassed]) {
testDone5();
kernel_trigger_dispatch_now(10033);
- } else if (_G(flags)[V184] && !_G(flags)[V153]) {
+ } else if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153]) {
testDone4();
_G(game).setRoom(207);
- } else if (_G(flags)[V099] && !_G(flags)[V185]) {
+ } else if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185]) {
testDone3();
_G(game).setRoom(207);
- } else if (_G(flags)[V241] && !_G(flags)[V100]) {
+ } else if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100]) {
testDone2();
_G(game).setRoom(207);
- } else if (_G(flags)[V287] && !_G(flags)[V242]) {
+ } else if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242]) {
testDone1();
_G(game).setRoom(204);
} else {
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index e85acd671a2..ad3c0c7d0ef 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -344,32 +344,32 @@ void Flags::conv_reset_all() {
const char *Flags::getConvName() {
const char *conv = nullptr;
- if (_G(flags)[V287] && !_G(flags)[V242])
+ if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242])
conv = "conv51";
- if (_G(flags)[V242] == 5 && _G(flags)[V241] == 0 && !player_been_here(612)) {
+ if (_G(flags)[V242] == 5 && _G(flags)[kSecondTestPassed] == 0 && !player_been_here(612)) {
if (_G(flags)[V248])
conv = "conv52";
else
--_G(flags)[V242];
}
- if (_G(flags)[V241] && !_G(flags)[V100])
+ if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100])
conv = "conv53";
- if (_G(flags)[V100] == 5 && !_G(flags)[V099] && !player_been_here(310) &&
+ if (_G(flags)[V100] == 5 && !_G(flags)[kThirdTestPassed] && !player_been_here(310) &&
!player_been_here(311) && !player_been_here(312) && !player_been_here(313) &&
!player_been_here(314) && !player_been_here(315) && !player_been_here(316) &&
!player_been_here(317) && !player_been_here(318) && !player_been_here(319))
conv = "conv54";
- if (_G(flags)[V099] && !_G(flags)[V185])
+ if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185])
conv = "conv55";
- if (_G(flags)[V185] == 5 && !_G(flags)[V184])
+ if (_G(flags)[V185] == 5 && !_G(flags)[kFourthTestPassed])
conv = "conv56";
- if (_G(flags)[V184] && !_G(flags)[V153])
+ if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153])
conv = "conv57";
if (_G(flags)[V153] == 5)
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index cebc4e4c0dd..2aae00abed0 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -131,13 +131,13 @@ enum {
V096 = 96,
V097 = 97,
V098 = 98,
- V099 = 99,
+ kThirdTestPassed = 99,
V100 = 100,
V101 = 101,
- ROOM101_FLAG13 = 102,
- ROOM101_FLAG14 = 103,
- ROOM101_FLAG15 = 104,
+ kGetRidOfPerkins = 102,
+ kNeedToFindBurger = 103,
+ kAmplifyMySenses = 104,
V105 = 105,
V106 = 106,
V107 = 107,
@@ -185,7 +185,7 @@ enum {
kMineRoomIndex = 149,
V150 = 150,
V151 = 151,
- V152 = 152,
+ kFifthTestPassed = 152,
V153 = 153,
V154 = 154,
V155 = 155,
@@ -217,7 +217,7 @@ enum {
V181 = 181,
V182 = 182,
V183 = 183,
- V184 = 184,
+ kFourthTestPassed = 184,
V185 = 185,
V186 = 186,
V187 = 187,
@@ -275,7 +275,7 @@ enum {
V238 = 238,
V239 = 239,
V240 = 240,
- V241 = 241,
+ kSecondTestPassed = 241,
V242 = 242,
V243 = 243,
V244 = 244,
@@ -321,10 +321,10 @@ enum {
V284 = 284,
V285 = 285,
V286 = 286,
- V287 = 287,
+ kFirstTestPassed = 287,
kNEURO_TEST_COUNTER = 288,
- ROOM101_FLAG9 = 289,
- ROOM101_FLAG7 = 290,
+ kGerbilsAreNasty = 289,
+ kKnowHowToNukeGerbils = 290,
V291 = 291,
V292 = 292,
digestability = 293,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 154362a61c2..e0ed9fb67b5 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -189,11 +189,12 @@ void Room101::init() {
break;
default:
+ // Have been beamed down
ws_demand_location(_G(my_walker), 320, 271);
ws_demand_facing(_G(my_walker), 5);
if (_G(game).previous_section > 1) {
- if (_G(flags)[V287]) {
+ if (_G(flags)[kFirstTestPassed]) {
ws_demand_location(_G(my_walker), 280, 309);
ws_demand_facing(_G(my_walker), 8);
player_set_commands_allowed(false);
@@ -252,7 +253,8 @@ void Room101::daemon() {
break;
case 6:
- if (!_G(flags)[V287]) {
+ if (!_G(flags)[kFirstTestPassed]) {
+ // No tests passed yet
uint idx = _G(flags)[kNEURO_TEST_COUNTER];
assert(idx < 8);
@@ -263,38 +265,48 @@ void Room101::daemon() {
_G(walker).wilbur_speech(NAMES[idx], 23);
- } else if (!_G(flags)[V241]) {
+ } else if (!_G(flags)[kSecondTestPassed]) {
+ // Second test failed
if (_G(flags)[V242] <= 1) {
+ // Oh well, at least I passed the first test
_G(walker).wilbur_speech("101w520", 7);
- } else if (_G(flags)[V249] && !_G(flags)[ROOM101_FLAG7]) {
+ } else if (_G(flags)[V249] && !_G(flags)[kKnowHowToNukeGerbils]) {
+ // I know how to nuke those mutant gerbils
_G(walker).wilbur_speech("101w522", 7);
- _G(flags)[ROOM101_FLAG7] = 1;
+ _G(flags)[kKnowHowToNukeGerbils] = 1;
- } else if (_G(flags)[V248] && !_G(flags)[ROOM101_FLAG9]) {
+ } else if (_G(flags)[V248] && !_G(flags)[kGerbilsAreNasty]) {
+ // Those mutant gerbils are nasty
_G(walker).wilbur_speech("101w521", 7);
- _G(flags)[ROOM101_FLAG9] = 1;
+ _G(flags)[kGerbilsAreNasty] = 1;
} else {
+ // Sigh...
_G(walker).wilbur_speech("101w524", 7);
}
- } else if (!_G(flags)[V099]) {
+ } else if (!_G(flags)[kThirdTestPassed]) {
+ // Third test failed
if (_G(flags)[V100] <= 1) {
_G(walker).wilbur_speech("101w530", 7);
- } else if (!_G(flags)[V113] && !_G(flags)[ROOM101_FLAG13]) {
+ } else if (!_G(flags)[V113] && !_G(flags)[kGetRidOfPerkins]) {
+ // Need to get rid of Perkins
_G(walker).wilbur_speech("101w531", 7);
- _G(flags)[ROOM101_FLAG13] = 1;
- } else if (_G(flags)[V113] && !_G(flags)[ROOM101_FLAG14]) {
+ _G(flags)[kGetRidOfPerkins] = 1;
+ } else if (_G(flags)[V113] && !_G(flags)[kNeedToFindBurger]) {
+ // Gotten rid of Perkins, need to find burger
_G(walker).wilbur_speech("101w533", 7);
- _G(flags)[ROOM101_FLAG14] = 1;
+ _G(flags)[kNeedToFindBurger] = 1;
} else if (_G(flags)[V113] && _G(flags)[V100] >= 5 &&
- !_G(flags)[ROOM101_FLAG15]) {
+ !_G(flags)[kAmplifyMySenses]) {
+ // Amplify my senses? Hmmm..
_G(walker).wilbur_speech("101w534", 7);
- _G(flags)[ROOM101_FLAG15] = 1;
+ _G(flags)[kAmplifyMySenses] = 1;
} else {
_G(walker).wilbur_speech("101w532", 7);
}
- } else if (!_G(flags)[V184]) {
+ } else if (!_G(flags)[kFourthTestPassed]) {
+ // Fourth test failed
switch (_G(flags)[V185]) {
case 0:
case 1:
@@ -312,7 +324,8 @@ void Room101::daemon() {
}
break;
}
- } else if (!_G(flags)[V152]) {
+ } else if (!_G(flags)[kFifthTestPassed]) {
+ // Fifth test failed
switch (_G(flags)[V153]) {
case 0:
case 1:
@@ -334,11 +347,11 @@ void Room101::daemon() {
loadSounds();
ws_hide_walker(_G(my_walker));
- if (_G(flags)[V241] || _G(flags)[V184])
+ if (_G(flags)[kSecondTestPassed] || _G(flags)[kFourthTestPassed])
series_load("101wi13s", -1, nullptr);
- if (_G(flags)[V099])
+ if (_G(flags)[kThirdTestPassed])
series_load("101wi12s", -1, nullptr);
- if (_G(flags)[V152])
+ if (_G(flags)[kFifthTestPassed])
series_load("101wi11s", -1, nullptr);
_machine1 = series_play("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
@@ -352,7 +365,7 @@ void Room101::daemon() {
case 9:
daemon9();
- if (_G(flags)[V241] || _G(flags)[V250] ||
+ if (_G(flags)[kSecondTestPassed] || _G(flags)[V250] ||
_G(flags)[V280] || _G(flags)[V002]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -372,8 +385,8 @@ void Room101::daemon() {
case 12:
daemon12();
- if (_G(flags)[V241]) {
- if (_G(flags)[V099] || _G(flags)[V112] ||
+ if (_G(flags)[kSecondTestPassed]) {
+ if (_G(flags)[kThirdTestPassed] || _G(flags)[V112] ||
_G(flags)[V080] || _G(flags)[V126]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
@@ -394,7 +407,7 @@ void Room101::daemon() {
case 15:
daemon15();
- if (_G(flags)[V099] && (_G(flags)[V184] || _G(flags)[V220])) {
+ if (_G(flags)[kThirdTestPassed] && (_G(flags)[kFourthTestPassed] || _G(flags)[V220])) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 16);
@@ -413,8 +426,8 @@ void Room101::daemon() {
case 18:
daemon18();
- if (_G(flags)[V184]) {
- if (_G(flags)[V152] || _G(flags)[V220]) {
+ if (_G(flags)[kFourthTestPassed]) {
+ if (_G(flags)[kFifthTestPassed] || _G(flags)[V220]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 19);
@@ -750,10 +763,10 @@ void Room101::daemon9() {
}
void Room101::daemon12() {
- if (_G(flags)[V250] || _G(flags)[V241])
+ if (_G(flags)[V250] || _G(flags)[kSecondTestPassed])
inv_give_to_player("BLOCK OF ICE");
- if (_G(flags)[V280] || _G(flags)[V241])
+ if (_G(flags)[V280] || _G(flags)[kSecondTestPassed])
inv_give_to_player("PANTYHOSE");
if (_G(flags)[V002]) {
@@ -767,7 +780,7 @@ void Room101::daemon12() {
}
void Room101::daemon15() {
- if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[V099]) {
+ if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[kThirdTestPassed]) {
inv_give_to_player("PHONE BILL");
inv_give_to_player("WHISTLE");
_G(flags)[V079] = 0;
@@ -777,7 +790,7 @@ void Room101::daemon15() {
_G(flags)[V080] = 0;
}
- if (_G(flags)[V126] || _G(flags)[V099]) {
+ if (_G(flags)[V126] || _G(flags)[kThirdTestPassed]) {
inv_give_to_player("CARROT JUICE");
_G(flags)[V088] = 1;
_G(flags)[V091] = 1;
@@ -786,7 +799,7 @@ void Room101::daemon15() {
_G(flags)[V091] = 0;
}
- if (_G(flags)[V113] || _G(flags)[V099]) {
+ if (_G(flags)[V113] || _G(flags)[kThirdTestPassed]) {
_G(flags).set_boonsville_time(6001);
_G(flags)[V000] = 1002;
_G(flags)[V001] = 0;
@@ -808,12 +821,12 @@ void Room101::daemon15() {
_G(flags)[V063] = 0;
_G(flags)[V092] = 0;
- if (_G(flags)[V099])
+ if (_G(flags)[kThirdTestPassed])
_G(flags).set_boonsville_time(6600);
}
void Room101::daemon18() {
- if (_G(flags)[V220] || _G(flags)[V184]) {
+ if (_G(flags)[V220] || _G(flags)[kFourthTestPassed]) {
inv_give_to_player("laxative");
inv_give_to_player("amplifier");
_G(flags)[V067] = 1;
@@ -823,7 +836,7 @@ void Room101::daemon18() {
}
void Room101::daemon20() {
- if (_G(flags)[V177] || _G(flags)[V152]) {
+ if (_G(flags)[V177] || _G(flags)[kFifthTestPassed]) {
inv_move_object("KEYS", 138);
inv_give_to_player("JAWZ O' LIFE");
_G(flags)[V046] = 0;
diff --git a/engines/m4/burger/rooms/section3/room307.cpp b/engines/m4/burger/rooms/section3/room307.cpp
index 074cfd78c19..085da05eb70 100644
--- a/engines/m4/burger/rooms/section3/room307.cpp
+++ b/engines/m4/burger/rooms/section3/room307.cpp
@@ -45,7 +45,7 @@ const seriesPlayBreak Room307::PLAY1[] = {
void Room307::init() {
- _G(flags)[V099] = 1;
+ _G(flags)[kThirdTestPassed] = 1;
ws_demand_location(418, 309, 9);
ws_hide_walker();
digi_preload("307_001");
diff --git a/engines/m4/burger/rooms/section4/section4.cpp b/engines/m4/burger/rooms/section4/section4.cpp
index d5867a79344..4f77d63c0c9 100644
--- a/engines/m4/burger/rooms/section4/section4.cpp
+++ b/engines/m4/burger/rooms/section4/section4.cpp
@@ -226,7 +226,7 @@ void Section4::poof(int trigger) {
bool Section4::checkOrderWindow() {
if (_G(flags)[V168] && _G(flags)[V181] && _G(flags)[V176] && _G(flags)[V159]) {
player_set_commands_allowed(false);
- _G(flags)[V152] = 1;
+ _G(flags)[kFifthTestPassed] = 1;
disable_player_commands_and_fade_init(k10027);
return true;
} else {
diff --git a/engines/m4/burger/rooms/section5/room513.cpp b/engines/m4/burger/rooms/section5/room513.cpp
index e4389771dce..e08e2b326cb 100644
--- a/engines/m4/burger/rooms/section5/room513.cpp
+++ b/engines/m4/burger/rooms/section5/room513.cpp
@@ -49,7 +49,7 @@ void Room513::preload() {
}
void Room513::init() {
- _G(flags)[V184] = 1;
+ _G(flags)[kFourthTestPassed] = 1;
kernel_trigger_dispatch_now(1);
}
diff --git a/engines/m4/burger/rooms/section6/room606.cpp b/engines/m4/burger/rooms/section6/room606.cpp
index d847e825460..9ad595cca3d 100644
--- a/engines/m4/burger/rooms/section6/room606.cpp
+++ b/engines/m4/burger/rooms/section6/room606.cpp
@@ -55,9 +55,9 @@ void Room606::daemon() {
case 1:
digi_preload("606x001", 606);
digi_preload("606w003a", 606);
- digi_preload("606x003b", 606);
- digi_preload("606x003c", 606);
- digi_preload("606x003d", 606);
+ digi_preload("606w003b", 606);
+ digi_preload("606w003c", 606);
+ digi_preload("606w003d", 606);
_state1 = imath_ranged_rand(0, 3);
series_stream_with_breaks(SERIES1, "606laser", 8, 1, 6007);
break;
diff --git a/engines/m4/burger/rooms/section6/room610.cpp b/engines/m4/burger/rooms/section6/room610.cpp
index 4863203a58e..92cf3795b88 100644
--- a/engines/m4/burger/rooms/section6/room610.cpp
+++ b/engines/m4/burger/rooms/section6/room610.cpp
@@ -70,7 +70,7 @@ void Room610::preload() {
}
void Room610::init() {
- _G(flags)[V241] = 1;
+ _G(flags)[kSecondTestPassed] = 1;
_G(kernel).suppress_fadeup = 1;
kernel_trigger_dispatch_now(1);
}
diff --git a/engines/m4/burger/rooms/section8/room801.cpp b/engines/m4/burger/rooms/section8/room801.cpp
index d046d41310a..270371dce36 100644
--- a/engines/m4/burger/rooms/section8/room801.cpp
+++ b/engines/m4/burger/rooms/section8/room801.cpp
@@ -511,7 +511,7 @@ void Room801::daemon() {
break;
case 36:
- _G(flags)[V287] = 1;
+ _G(flags)[kFirstTestPassed] = 1;
adv_kill_digi_between_rooms(1);
kernel_trigger_dispatch_now(k10027);
break;
Commit: a41a432ca0a16e362ad54e2896605f154b738bac
https://github.com/scummvm/scummvm/commit/a41a432ca0a16e362ad54e2896605f154b738bac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix destroyed gerbil wreckage display
Changed paths:
engines/m4/burger/rooms/section6/room602.cpp
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 9b4608bd54c..074c0c07509 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -463,7 +463,7 @@ void Room602::daemon() {
if (_series1)
series_unload(_series1);
- _series8 = series_play("612mot02", 0x600, 0, -1, 0);
+ _series8 = series_play("612mot02", 0x600, 0, -1, 0, -1);
hotspot_set_active("PAW", true);
hotspot_set_active("MOTOR", true);
hotspot_set_active("MOTOR ", false);
Commit: 1b54a7e2a474305a2838283814b50e88ae150ef4
https://github.com/scummvm/scummvm/commit/1b54a7e2a474305a2838283814b50e88ae150ef4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix grasshoppers disappearing
Changed paths:
engines/m4/burger/rooms/section6/section6.cpp
diff --git a/engines/m4/burger/rooms/section6/section6.cpp b/engines/m4/burger/rooms/section6/section6.cpp
index 22319d648b0..93d1b996f03 100644
--- a/engines/m4/burger/rooms/section6/section6.cpp
+++ b/engines/m4/burger/rooms/section6/section6.cpp
@@ -129,9 +129,9 @@ void Section6::daemon() {
case 6002:
term_message("Ga-boingy boingy boingy boing!");
- _series1 = series_play("602hop_1", 0xa80, 0, -1, 0);
- _series2 = series_play("602hop_2", 0x780, 0, -1, 0);
- _series3 = series_play("602hop_3", 0x400, 0, -1, 0);
+ _series1 = series_play("602hop_1", 0xa80, 0, -1, 0, -1);
+ _series2 = series_play("602hop_2", 0x780, 0, -1, 0, -1);
+ _series3 = series_play("602hop_3", 0x400, 0, -1, 0, -1);
break;
default:
Commit: d91e21dccb51c88c2a18ded2ccace3fe9a0b6825
https://github.com/scummvm/scummvm/commit/d91e21dccb51c88c2a18ded2ccace3fe9a0b6825
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for motor and opening gerbil cage door
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section6/room602.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 3a575e65723..b8dd58a5c43 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -592,7 +592,7 @@ void BurgerEngine::testDone2() {
_G(flags)[V250] = 1;
_G(flags)[V251] = 1;
_G(flags)[V255] = 1;
- _G(flags)[V256] = 2;
+ _G(flags)[kGerbilCageDoor] = 2;
_G(flags)[V257] = -140;
_G(flags)[V258] = 0;
_G(flags)[V259] = 1;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index ad3c0c7d0ef..d6a16e70452 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -205,7 +205,7 @@ void Flags::reset2() {
(*this)[V245] = 10027;
(*this)[V246] = 0;
(*this)[V255] = 0;
- (*this)[V256] = 0;
+ (*this)[kGerbilCageDoor] = 0;
(*this)[V257] = 0;
(*this)[V258] = 0;
(*this)[V263] = 0;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 2aae00abed0..676830894fe 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -290,7 +290,7 @@ enum {
V253 = 253,
V254 = 254,
V255 = 255,
- V256 = 256,
+ kGerbilCageDoor = 256,
V257 = 257,
V258 = 258,
V259 = 259,
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 074c0c07509..168ca5c1e68 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -181,10 +181,10 @@ const seriesPlayBreak Room602::PLAY14[] = {
const seriesPlayBreak Room602::PLAY15[] = {
{ 0, 6, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 1 },
- { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 2 },
- { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[V256], 3 },
- { 7, -1, "602_009", 2, 255, -1, 0, 0, &Flags::_flags[V256], 0 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[kGerbilCageDoor], 1 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[kGerbilCageDoor], 2 },
+ { 7, -1, nullptr, 0, 0, -1, 0, 0, &Flags::_flags[kGerbilCageDoor], 3 },
+ { 7, -1, "602_009", 2, 255, -1, 0, 0, &Flags::_flags[kGerbilCageDoor], 0 },
PLAY_BREAK_END
};
@@ -257,7 +257,7 @@ Room602::Room602() : Section6Room() {
void Room602::init() {
player_set_commands_allowed(false);
- _G(flags)[V256] = 0;
+ _G(flags)[V246] = 0;
_series1 = 0;
if (_G(game).room_id == 612) {
@@ -321,29 +321,29 @@ void Room602::init() {
_G(kernel).call_daemon_every_loop = true;
if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1) {
- _series2 = series_play("612wheel", 0x5ff);
+ _series2 = series_play("612wheel", 0x5ff, 0, -1, 0, -1);
} else if (_G(game).room_id == 502) {
- _series2 = series_show("602wheel", 0x6ff);
+ _series2 = series_show("602wheel", 0x6ff, 0, -1, -1, 0);
} else {
- _series2 = series_show("612wheel", 0x6ff);
+ _series2 = series_show("612wheel", 0x6ff, 0, -1, -1, 0);
}
_series3 = series_show("602door", 0xf00, 1, -1, -1, 0, 100,
_G(flags)[V257] / 21, _G(flags)[V257]);
- if (_G(flags)[V256] == 1) {
+ if (_G(flags)[kGerbilCageDoor] == 1) {
_val3 = 63;
kernel_trigger_dispatch_now(2);
}
- if (_G(flags)[V256] == 3) {
+ if (_G(flags)[kGerbilCageDoor] == 3) {
_val3 = 64;
kernel_trigger_dispatch_now(2);
}
- if (_G(flags)[V256]) {
+ if (_G(flags)[kGerbilCageDoor]) {
hotspot_set_active("DOOR", false);
hotspot_set_active("EXIT", true);
@@ -484,7 +484,7 @@ void Room602::daemon() {
case 57:
_G(flags)[V279] = 2;
- _series8 = series_play("612mot03", 0x600, 0, -1, 0);
+ _series8 = series_play("612mot03", 0x600, 0, -1, 0, -1);
inv_move_object("PANTYHOSE", NOWHERE);
_G(flags)[V278] = 0;
@@ -552,7 +552,7 @@ void Room602::daemon() {
break;
case 62:
- _G(flags)[V256] = 1;
+ _G(flags)[kGerbilCageDoor] = 1;
_G(flags)[V258] = 55;
_G(flags)[V257] = 0;
_val3 = 63;
@@ -568,7 +568,7 @@ void Room602::daemon() {
_series3 = series_show("602door", 0xf00, 0, 2, 6, 0, 100,
-_G(flags)[V257] / 21, _G(flags)[V257]);
_G(flags)[V257] -= _G(flags)[V258] >> 5;
- _G(flags)[V256] = 1;
+ _G(flags)[kGerbilCageDoor] = 1;
if (_G(flags)[V257] + 140 >= 20) {
_G(flags)[V258] += 3;
@@ -578,7 +578,7 @@ void Room602::daemon() {
_G(flags)[V258] = 0;
}
} else {
- _G(flags)[V256] = 2;
+ _G(flags)[kGerbilCageDoor] = 2;
_val3 = 48;
terminateMachineAndNull(_series3);
_series3 = series_show("602door", 0xf00, 0, -1, -1, 0, 100,
@@ -592,7 +592,7 @@ void Room602::daemon() {
case 64:
if (_G(flags)[V257] > 0) {
digi_play("602_007", 2);
- _G(flags)[V256] = 0;
+ _G(flags)[kGerbilCageDoor] = 0;
_G(flags)[V257] = 0;
_val3 = 48;
@@ -601,7 +601,7 @@ void Room602::daemon() {
} else {
_G(flags)[V257] -= _G(flags)[V258] >> 5;
- _G(flags)[V256] = 3;
+ _G(flags)[kGerbilCageDoor] = 3;
_G(flags)[V258] -= 40;
terminateMachineAndNull(_series3);
@@ -620,13 +620,13 @@ void Room602::daemon() {
case 3:
_G(flags)[V258] = 40;
- _G(flags)[V256] = 1;
+ _G(flags)[kGerbilCageDoor] = 1;
_val3 = 63;
kernel_trigger_dispatch_now(2);
terminateMachineAndNull(_series2);
_series2 = series_play(_G(game).room_id == 602 ? "602wheel" : "612wheel",
- 0x5ff, 0, -1, 0);
+ 0x5ff, 0, -1, 0, -1);
hotspot_set_active("DOOR", false);
hotspot_set_active("EXIT", true);
break;
@@ -687,7 +687,7 @@ void Room602::daemon() {
case 11:
_val3 = 64;
- _G(flags)[V256] = 3;
+ _G(flags)[kGerbilCageDoor] = 3;
kernel_timing_trigger(1, 2);
break;
@@ -1149,7 +1149,7 @@ void Room602::daemon() {
_G(wilbur_should) = 10001;
player_set_commands_allowed(true);
ws_unhide_walker();
- wilbur_speech("612w065");
+ wilbur_speech("612w065", kCHANGE_WILBUR_ANIMATION);
break;
case 35:
@@ -1160,8 +1160,8 @@ void Room602::daemon() {
case 37:
_G(wilbur_should) = 23;
- player_set_commands_allowed(true);
- wilbur_speech("612w064");
+ player_set_commands_allowed(false);
+ wilbur_speech("612w064", kCHANGE_WILBUR_ANIMATION);
break;
case 38:
@@ -1191,13 +1191,13 @@ void Room602::daemon() {
_G(wilbur_should) = 10001;
player_set_commands_allowed(true);
ws_unhide_walker();
- wilbur_speech("612w057");
+ wilbur_speech("612w057", kCHANGE_WILBUR_ANIMATION);
break;
case 42:
player_set_commands_allowed(false);
ws_unhide_walker();
- wilbur_speech("602w033");
+ wilbur_speech("602w033", 5);
break;
case 43:
@@ -1227,7 +1227,7 @@ void Room602::daemon() {
break;
case 47:
- if (!_G(flags)[V256]) {
+ if (!_G(flags)[kGerbilCageDoor]) {
player_set_commands_allowed(false);
ws_demand_location(191, 277, 3);
ws_hide_walker();
@@ -1239,7 +1239,7 @@ void Room602::daemon() {
break;
case 10001:
- if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1 && _G(flags)[V256] == 0)
+ if (_G(flags)[V277] == 6003 && _G(flags)[V278] == 1 && _G(flags)[kGerbilCageDoor] == 0)
kernel_trigger_dispatch_now(3);
_G(kernel).continue_handling_trigger = true;
@@ -1338,7 +1338,7 @@ void Room602::pre_parser() {
if (_G(flags)[V277] == 6002 || _G(flags)[V277] == 6003) {
if (_G(flags)[V255] == 1) {
_G(wilbur_should) = 39;
- player_hotspot_walk_override(200, 21, 3, kCHANGE_WILBUR_ANIMATION);
+ player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 26;
player_hotspot_walk_override(200, 321, 3, kCHANGE_WILBUR_ANIMATION);
@@ -1348,8 +1348,8 @@ void Room602::pre_parser() {
_G(wilbur_should) = 26;
player_hotspot_walk_override(314, 319, 3, kCHANGE_WILBUR_ANIMATION);
}
- } else if ((player_said("GEAR", "MOTOR ") || player_said("PANTYHOSE", "MOTOR ")) &&
- _G(flags)[V277] != 6002) {
+ } else if ((player_said("PANTYHOSE", "MOTOR") || player_said("PANTYHOSE", "MOTOR ")) &&
+ _G(flags)[V277] == 6002) {
_G(wilbur_should) = 37;
if (_G(flags)[V278]) {
player_hotspot_walk_override(313, 319, 3, kCHANGE_WILBUR_ANIMATION);
@@ -1359,6 +1359,8 @@ void Room602::pre_parser() {
} else {
return;
}
+
+ _G(player).command_ready = false;
}
void Room602::parser() {
Commit: a1256198d74406f0635f23ae7f0cb519c1965bef
https://github.com/scummvm/scummvm/commit/a1256198d74406f0635f23ae7f0cb519c1965bef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix various compilation warnings
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/other.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/room304.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room608.cpp
engines/m4/burger/rooms/section7/room706.cpp
engines/m4/burger/rooms/section9/room971.cpp
engines/m4/burger/walker.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index b8dd58a5c43..5e058423443 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -340,6 +340,7 @@ void BurgerEngine::global_daemon() {
ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
_G(walker).wilbur_poof();
kernel_trigger_dispatch_now(kSET_COMMANDS_ALLOWED);
+ break;
case kSET_COMMANDS_ALLOWED:
player_set_commands_allowed(true);
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 6b795602f23..299fb31e6d2 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -647,8 +647,8 @@ void menu_DrawButton(void *theItem, void *theMenu, int32 x, int32 y, int32, int3
// If the button is a textbutton, write in the text
if ((myButton->buttonType == BTN_TYPE_SL_TEXT) && (myButton->prompt)) {
//write in the special tag
- Common::sprintf_s(tempStr, 32, "%02ld", myItem->tag - 1000 + _GM(firstSlotIndex));
- /* Common::sprintf_s(tempStr, "%02ld", myButton->specialTag); */
+ Common::sprintf_s(tempStr, 32, "%02d", myItem->tag - 1000 + _GM(firstSlotIndex));
+ /* Common::sprintf_s(tempStr, "%02d", myButton->specialTag); */
gr_font_set(_GM(menuFont));
gr_font_write(myBuff, tempStr, x + 4, y + 1, 0, -1);
gr_font_write(myBuff, myButton->prompt, x + 26, y + 1, 0, -1);
@@ -1701,7 +1701,7 @@ void menu_DrawTextField(void *theItem, void *theMenu, int32 x, int32 y, int32, i
//write in the special tag
gr_font_set_color(TEXT_COLOR_NORM_FOREGROUND);
- Common::sprintf_s(tempStr, 64, "%02ld", myText->specialTag);
+ Common::sprintf_s(tempStr, 64, "%02d", myText->specialTag);
gr_font_set(_GM(menuFont));
gr_font_write(myBuff, tempStr, x + 4, y + 1, 0, -1);
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
index 2e04ffe3adc..1e7629df122 100644
--- a/engines/m4/burger/other.cpp
+++ b/engines/m4/burger/other.cpp
@@ -35,7 +35,7 @@ void other_resurrect_player() {
KernelTriggerType old_mode;
if (!g_engine->autosaveExists())
- error(FL, 'Burg', "Couldn't resume game");
+ error_show(FL, 'Burg', "Couldn't resume game");
_G(kernel).restore_slot = 0;
old_mode = _G(kernel).trigger_mode;
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index 3e93740bbb1..4fa6363a316 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -97,6 +97,7 @@ void Room176::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 2d890299a45..2652b38737c 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -351,6 +351,7 @@ void Mine::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section3/room304.cpp b/engines/m4/burger/rooms/section3/room304.cpp
index 40d474024cf..5c4d19c6f40 100644
--- a/engines/m4/burger/rooms/section3/room304.cpp
+++ b/engines/m4/burger/rooms/section3/room304.cpp
@@ -200,11 +200,13 @@ void Room304::daemon() {
_G(wilbur_should) = 10001;
_G(flags)[V129] = 1;
wilbur_speech("304w001");
+ break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 4cfed2b2414..3db86d78959 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -789,6 +789,7 @@ void Room502::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index 651c26822e5..a3c56becdf0 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -590,6 +590,7 @@ void Room504::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
case kCALLED_EACH_LOOP:
player_update_info();
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 168ca5c1e68..5c64e09c5b2 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -1249,6 +1249,7 @@ void Room602::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
case kCALLED_EACH_LOOP:
if (_G(player).walker_in_this_scene) {
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index 0e792f5ba59..f9237224d00 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -635,6 +635,7 @@ void Room604::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
+ break;
case kCALLED_EACH_LOOP:
player_update_info();
diff --git a/engines/m4/burger/rooms/section6/room608.cpp b/engines/m4/burger/rooms/section6/room608.cpp
index b0ba6fb1752..9f2765fc168 100644
--- a/engines/m4/burger/rooms/section6/room608.cpp
+++ b/engines/m4/burger/rooms/section6/room608.cpp
@@ -93,7 +93,11 @@ void Room608::daemon() {
series_stream_with_breaks(SERIES2, "608burnt", 6, 1, 1);
break;
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 411000c8582..9f64bc51cb5 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -533,6 +533,7 @@ void Room706::daemon() {
default:
break;
}
+ break;
default:
_G(kernel).continue_handling_trigger = true;
diff --git a/engines/m4/burger/rooms/section9/room971.cpp b/engines/m4/burger/rooms/section9/room971.cpp
index d9ba827fa6d..0d75f575eb6 100644
--- a/engines/m4/burger/rooms/section9/room971.cpp
+++ b/engines/m4/burger/rooms/section9/room971.cpp
@@ -497,6 +497,9 @@ void Room971::daemon() {
_G(game).new_room = 903;
player_set_commands_allowed(false);
break;
+
+ default:
+ break;
}
break;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 5c213166a2d..8d30a13a358 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -163,7 +163,7 @@ machine *Walker::walk_initialize_walker() {
// initialize with bogus data (this is for the real walker)
s = _G(globals)[GLB_MIN_SCALE] + FixedMul((400 << 16) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]);
- _G(globals)[GLB_TEMP_4] = -320 << 16;
+ _G(globals)[GLB_TEMP_4] = static_cast<uint32>(-320) << 16;
_G(globals)[GLB_TEMP_5] = 400 << 16;
_G(globals)[GLB_TEMP_6] = s;
_G(globals)[GLB_TEMP_7] = 3 << 16; // facing
Commit: 07e04bf8304fe35f1f2cb6281e40d8b9af4e9fae
https://github.com/scummvm/scummvm/commit/07e04bf8304fe35f1f2cb6281e40d8b9af4e9fae
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: More compiler warning fixes
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/adv_walk.cpp
engines/m4/adv_r/chunk_ops.cpp
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv_io.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/fileio/fstream.cpp
engines/m4/fileio/sys_file.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_sys.cpp
engines/m4/mem/res.cpp
engines/m4/wscript/ws_cruncher.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 04eb31042e0..896da437abf 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -110,13 +110,13 @@ static int32 count_catalog_items() {
}
static int compare_catalog_entries_for_sort(const void *n1, const void *n2) {
- const char *entry1 = *(const char **)n1;
+ const char *entry1 = *(const char * const *)n1;
if (convert_intel16(*(const short *)&entry1[2]) == _T_ROOM)
entry1 = &entry1[6];
else
entry1 = &entry1[4];
- const char *entry2 = *(const char **)n2;
+ const char *entry2 = *(const char * const *)n2;
if (convert_intel16(*(const short *)&entry2[2]) == _T_ROOM)
entry2 = &entry2[6];
else
@@ -259,7 +259,7 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
}
static int compare_catalog_entries_for_search(const void *n1, const void *n2) {
- const char *cat_entry = *(const char **)n2;
+ const char *cat_entry = *(const char * const *)n2;
if (convert_intel16(*(const short *)&cat_entry[2]) == _T_ROOM)
cat_entry = &cat_entry[6];
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index a1acac6a1fb..b2af2227982 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -196,7 +196,6 @@ GrBuff *load_codes(SysFile *code_file) {
if (!code_file)
return nullptr;
- int buffer_size;
int16 x_size, y_size;
char *bufferHandle;
@@ -208,7 +207,7 @@ GrBuff *load_codes(SysFile *code_file) {
x_size = convert_intel16(x_size);
y_size = convert_intel16(y_size);
- buffer_size = (int)(x_size * y_size);
+ //int buffer_size = (int)(x_size * y_size);
GrBuff *temp = new GrBuff(x_size, y_size);
if (!temp) {
diff --git a/engines/m4/adv_r/adv_walk.cpp b/engines/m4/adv_r/adv_walk.cpp
index 062e53c49d2..1c52e63d0b0 100644
--- a/engines/m4/adv_r/adv_walk.cpp
+++ b/engines/m4/adv_r/adv_walk.cpp
@@ -284,7 +284,6 @@ void ws_demand_location(machine *myWalker, int32 x, int32 y, int facing) {
}
static void ws_demand_location_and_facing(machine *myWalker, int32 x, int32 y, int32 facing) {
- const int8 directions[13] = { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9 };
frac16 s;
if ((!myWalker) || (!myWalker->myAnim8)) {
@@ -514,7 +513,6 @@ void adv_get_walker_destination(machine *my_walker, int32 *x, int32 *y, int32 *f
void adv_hyperwalk_to_final_destination(void *, void *) {
int32 x, y;
int32 facing;
- int8 directions[11] = { 1, 2, 3, 4, 5, 7, 8, 9, 10, 11 };
_G(i_just_hyperwalked) = true;
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index 9b78bb11e62..fe1953dafec 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -352,7 +352,7 @@ lnode_chunk *get_lnode(Conv *c, long cSize) {
}
static void swap_node(node_chunk *n) {
- int i = 0, j = 0;
+ int i = 0;
long *L = nullptr;
n->tag = convert_intel32(n->tag);
@@ -360,13 +360,12 @@ static void swap_node(node_chunk *n) {
n->size = convert_intel32(n->size);
n->num_entries = convert_intel32(n->num_entries);
- j = sizeof(long);
+ //int j = sizeof(long);
L = (long *)n; //was &n
- L += 4; // *sizeof( long ); //was sizeof node_chunk
+ L += 4; // *sizeof( long );
for (i = 0; i < n->num_entries; i++) {
L[i] = convert_intel32(L[i]);
}
- //
}
node_chunk *get_node(Conv *c, long cSize) {
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index 2bddca88722..e8002751ddc 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -534,6 +534,7 @@ static void find_true_ent(int entry_num, Conv *c) {
//fprintf( conv_fp, "FALL_CHUNK 1.\n" );
fall = get_fall(c, sub_ent);
+ assert(fall);
//do this to skip the fall chunk and all will be fine.
ent += sizeof(long); //was get_long, sizeof( fall_chunk )
@@ -733,6 +734,7 @@ static void conv_start(Conv *c) {
case DECL_CHUNK:
decl = get_decl(c, ent);
+ assert(decl);
break;
default:
@@ -812,6 +814,7 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
//or skip to the first offset.
fall = get_fall(c, sub_ent);
+ assert(fall);
//do this to skip the fall chunk and all will be fine.
ent += sizeof(long); //was get_long, sizeof( fall_chunk )
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 0726a24e6e7..6879fda6edd 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -333,6 +333,7 @@ void find_and_set_conv_name(Conv *c) {
switch (tag) {
case CONV_CHUNK:
conv = get_conv(c, ent);
+ assert(conv);
set_conv_name(get_string(c, c->myCNode + ent + sizeof(conv_chunk)));
break;
@@ -355,19 +356,19 @@ static void conv_save_state(Conv *c) {
long myCNode = c->myCNode;
char fname[9];
- short num_decls = 0;
- short num_entries = 0;
+ int32 num_decls = 0;
+ int32 num_entries = 0;
c->myCNode = 0;
- while (ent < c->chunkSize)
- {
- conv_chunk *conv; // declared here for the benefit of Watcom 10.0's initializers.
+ while (ent < c->chunkSize) {
+ conv_chunk *conv;
conv_ops_get_entry(ent, &next, &tag, c);
switch (tag) {
case CONV_CHUNK:
conv = get_conv(c, ent);
+ assert(conv);
cstrncpy(fname, get_string(c, c->myCNode + ent + sizeof(conv_chunk)), 8);
fname[8] = '\0';
break;
@@ -898,6 +899,7 @@ int conv_get_text(long offset, long size, Conv *c) {
case TEXT_CHUNK:
result = 1;
text = get_text(c, i);
+ assert(text);
text_len = conv_ops_text_strlen(get_string(c, c->myCNode + i + sizeof(text_chunk)));
_G(cdd).snd_files[_G(cdd).num_txt_ents] = get_string(c, c->myCNode + i + sizeof(text_chunk));
_G(cdd).text[_G(cdd).num_txt_ents] = get_string(c, c->myCNode + i + sizeof(text_chunk) + text_len);
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 299fb31e6d2..7467ab1da59 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -313,7 +313,6 @@ void item_Destroy(void *theItem) {
void menu_DrawMsg(void *theItem, void *theMenu, int32 x, int32 y, int32, int32) {
menuItem *myItem = (menuItem *)theItem;
guiMenu *myMenu = (guiMenu *)theMenu;
- menuItemMsg *myMsg = nullptr;
Buffer *myBuff = nullptr;
Buffer *backgroundBuff = nullptr;
Sprite *mySprite = nullptr;
@@ -335,7 +334,7 @@ void menu_DrawMsg(void *theItem, void *theMenu, int32 x, int32 y, int32, int32)
}
// Get the button info and select the sprite
- myMsg = (menuItemMsg *)myItem->itemInfo;
+ //myMsg = (menuItemMsg *)myItem->itemInfo;
switch (myItem->tag) {
case SL_TAG_SAVE_LABEL:
mySprite = _GM(menuSprites)[SL_SAVE_LABEL];
diff --git a/engines/m4/fileio/fstream.cpp b/engines/m4/fileio/fstream.cpp
index 60fb4a50819..3a91e839f1b 100644
--- a/engines/m4/fileio/fstream.cpp
+++ b/engines/m4/fileio/fstream.cpp
@@ -408,7 +408,7 @@ void f_stream_Close(strmRequest *myStream) {
}
void f_stream_Process(int32 numToProcess) {
- strmRequest *myStream, *firstProcessStream;
+ strmRequest *myStream;
int32 buffEndBytesAvail = 0, buffStartBytesAvail = 0;
int32 bytesRead, bytesAvail, nextReadSize;
bool buffWrap, useBlockSizeArray;
@@ -420,7 +420,6 @@ void f_stream_Process(int32 numToProcess) {
}
// Loop through until either the end of the list of requests, or we've serviced the "numToProcess"
- firstProcessStream = _G(firstStream);
myStream = _G(firstStream);
while (myStream && (numToProcess > 0)) {
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index fdb69995aa2..3deb2a67b79 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -227,18 +227,17 @@ void SysFile::open_write() {
}
Common::String SysFile::get_last_string(const Common::String &src) {
- int len, j, k, l;
+ int len, j, k;
len = src.size();
Common::String result;
for (j = len - 1; j >= 0; j--) {
- if (src[j] == '\\' || src[j] == ':') // back for DOS, colon for Mac
+ if (src[j] == '\\' || src[j] == ':')
break;
}
if (j >= 0) {
- l = 0;
for (k = j + 1; k < len; k++)
result += src[k];
return result;
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index cbb5861d23e..2e49f15e9de 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -483,7 +483,7 @@ void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scrnY, int
void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
int32 x, y, r, g, b, i;
- uint8 *inverse_palette, pixel, *tempPtr;
+ uint8 *inverse_palette, *tempPtr;
frac16 fracPercent;
RGB8 *pal;
uint8 luminancePal[256];
@@ -527,7 +527,7 @@ void krn_ChangeBufferLuminance(Buffer *target, int32 percent) {
for (x = 0; x < target->stride; x++) {
*tempPtr = luminancePal[*tempPtr];
tempPtr++;
- pixel = *tempPtr;
+ //pixel = *tempPtr;
}
}
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index e5de9f85c35..6ae505544f6 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -767,7 +767,6 @@ char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag) {
}
void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
- ScreenContext *myScreen;
int32 status;
if ((!i) && (!d))
@@ -778,7 +777,7 @@ void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
return;
Item_empty_list(i);
- myScreen = vmng_screen_find((void *)d, &status);
+ (void)vmng_screen_find((void *)d, &status);
Dialog_Refresh_Item(d, i, i->tag);
}
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 0838092ddd6..715910466fa 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -401,13 +401,10 @@ static int32 item_string_write(Buffer *target, char *myStr, int32 x, int32 y, in
}
static void CorrectItemWidthHeight(Item *item, int32 fontHeight) {
- char tempStr[2];
- int32 tempWidth, tempHeight, minWidth, minHeight;
+ int32 tempWidth, tempHeight, minWidth, minHeight;
- if (!item) return;
-
- tempStr[0] = '~';
- tempStr[1] = '\0';
+ if (!item)
+ return;
switch (item->type) {
case LISTBOX:
@@ -966,7 +963,8 @@ bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType
} else changed = false;
} else changed = false;
} else if ((yOffset >= (scrollUpHeight + _G(items).buttonHeight)) && (yOffset < myItem->thumbY)) {
- if ((scrollType & PAGEABLE) && ((myItem->status & AREA_PRESSED) == 0) || (myItem->status & PU_PRESSED)) {
+ if ((scrollType & PAGEABLE) && (
+ (myItem->status & AREA_PRESSED) == 0 || (myItem->status & PU_PRESSED))) {
myItem->status = PU_PRESSED;
for (i = 0; i < myItem->listView - 1; i++) {
if (myItem->viewTop->prev) {
@@ -1395,7 +1393,7 @@ bool Item_TextEdit(Item *myItem, int32 parm1) {
bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
int32 x1, y1, x2, y2;
int32 listboxContentX2, fontHeight, viewCount, temp;
- char myChar, *beginBlock, *endBlock, tempStr[2];
+ char myChar, *beginBlock, *endBlock;
ListItem *myList;
Buffer pictBuff;
const Buffer *tempBuff;
@@ -1406,14 +1404,12 @@ bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
if (!i)
return false;
-
- tempStr[0] = '~';
- tempStr[1] = '\0';
x1 = i->x;
y1 = i->y;
x2 = x1 + i->w - 1;
y2 = y1 + i->h - 1;
- if ((x1 < 0) || (y1 < 0) || (x2 >= scrBuf->w) || (y2 >= scrBuf->h)) return false;
+ if ((x1 < 0) || (y1 < 0) || (x2 >= scrBuf->w) || (y2 >= scrBuf->h))
+ return false;
currFont = gr_font_get();
if (i->myFont != currFont)
@@ -1581,9 +1577,14 @@ bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType) {
myList = myList->next;
}
break;
+
+ default:
+ break;
}
+
if (i->myFont != currFont)
gr_font_set(currFont);
+
return true;
}
diff --git a/engines/m4/gui/gui_sys.cpp b/engines/m4/gui/gui_sys.cpp
index 022f751bf31..6c193b6de7f 100644
--- a/engines/m4/gui/gui_sys.cpp
+++ b/engines/m4/gui/gui_sys.cpp
@@ -76,7 +76,7 @@ void gui_system_event_handler() {
newMouseEvent = mouse_get_event();
- if (newMouseEvent != _MS_no_event) { //We have a mouse event
+ if (newMouseEvent != _ME_no_event) { //We have a mouse event
gui_mouse_refresh();
_G(oldX) = _G(mouseX);
_G(oldY) = _G(mouseY);
@@ -154,7 +154,7 @@ void gui_system_event_handler() {
_G(currScreen) = false;
Dialog_KeyMouseCollision();
if (myHotkey->callback) {
- (myHotkey->callback)((void *)parm1, (void *)myScreen->scrnContent);
+ (myHotkey->callback)((void *)static_cast<intptr>(parm1), (void *)myScreen->scrnContent);
}
} else myHotkey = myHotkey->next;
}
@@ -172,7 +172,7 @@ void gui_system_event_handler() {
_G(currScreen) = false;
Dialog_KeyMouseCollision();
if (myHotkey->callback) {
- (myHotkey->callback)((void *)parm1, nullptr);
+ (myHotkey->callback)((void *)static_cast<intptr>(parm1), nullptr);
}
} else myHotkey = myHotkey->next;
}
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index d099470f880..e4fcc0be3a0 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -59,7 +59,7 @@ Resources::Entry *Resources::findAndSetResEntry(const Common::String &resourceNa
while ((_resources[hash_val].Flags & FULLY_BUFFERED)
&& !resName.equalsIgnoreCase(_resources[hash_val].name)) {
// if we searched every entry to no avail:
- if ((hash_val = ++hash_val & (HASHSIZE - 1)) == orig_hash_val)
+ if ((hash_val = (hash_val + 1) & (HASHSIZE - 1)) == orig_hash_val)
goto test4;
}
@@ -69,7 +69,7 @@ test4:
hash_val = orig_hash_val;
while (!(_resources[hash_val].Flags & MARKED_PURGE))
// if we searched every entry to no avail:
- if ((hash_val = ++hash_val & (HASHSIZE - 1)) == orig_hash_val) {
+ if ((hash_val = (hash_val + 1) & (HASHSIZE - 1)) == orig_hash_val) {
error("Out of resource space");
}
@@ -176,7 +176,7 @@ void Resources::rtoss(const Common::String &resourceName) {
/* check if resource is in resource table */
if (_resources[hash_val].Flags) {
while (_resources[hash_val].Flags && !lowerName.equals(_resources[hash_val].name))
- hash_val = ++hash_val & (HASHSIZE - 1);
+ hash_val = (hash_val + 1) & (HASHSIZE - 1);
resEntry = &_resources[hash_val];
}
diff --git a/engines/m4/wscript/ws_cruncher.cpp b/engines/m4/wscript/ws_cruncher.cpp
index 6d842a3b7fa..04a92ab579a 100644
--- a/engines/m4/wscript/ws_cruncher.cpp
+++ b/engines/m4/wscript/ws_cruncher.cpp
@@ -287,7 +287,7 @@ bool ws_ChangeAnim8Program(machine *m, int32 newSequHash) {
}
void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8) {
- EOSreq *tempEOSreq, *prevEOSreq;
+ EOSreq *tempEOSreq;
// Make sure the cruncher has been initialized
VERIFY_INTIALIZED("ws_RemoveAnim8FromCruncher()");
@@ -297,7 +297,6 @@ void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8) {
// In case we are crunching the current list of EOS requests, remove any for this machine
tempEOSreq = _GWS(EOSreqList);
- prevEOSreq = nullptr;
while (tempEOSreq && (tempEOSreq->myAnim8 != myAnim8)) {
tempEOSreq = tempEOSreq->next;
}
Commit: 274151c233319d95da1cb0356d398cd9b67d0591
https://github.com/scummvm/scummvm/commit/274151c233319d95da1cb0356d398cd9b67d0591
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of conv structures
Changed paths:
engines/m4/adv_r/chunk_ops.cpp
engines/m4/adv_r/conv.h
engines/m4/adv_r/conv_io.cpp
engines/m4/adv_r/conv_io.h
engines/m4/burger/vars.cpp
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index fe1953dafec..f319c907de6 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -27,8 +27,8 @@
namespace M4 {
-long conv_ops_text_strlen(char *s) {
- long len = 0;
+int32 conv_ops_text_strlen(char *s) {
+ int32 len = 0;
len = strlen(s) + 1; // Added +1 for null char.
if ((len % 4) == 0)
@@ -38,7 +38,7 @@ long conv_ops_text_strlen(char *s) {
return len;
}
-void conv_ops_unknown_chunk(long tag, const char *s) {
+void conv_ops_unknown_chunk(int32 tag, const char *s) {
char *tag_name = nullptr;
tag_name = (char *)&tag;
@@ -49,9 +49,9 @@ void conv_ops_unknown_chunk(long tag, const char *s) {
/*
* Find an entry and auto-advance the pointer past it.
*/
-char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
- long num_blocks = 0;
- long j = 0, k = 0;
+char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
+ int32 num_blocks = 0;
+ int32 j = 0, k = 0;
lnode_chunk *L;
node_chunk *N;
text_chunk *T;
@@ -64,7 +64,7 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
}
outChunk = &(c->conv[c->myCNode]);
- *tag = *(long *)&outChunk[i];
+ *tag = *(int32 *)&outChunk[i];
if (_GC(swap))
*tag = convert_intel32(*tag);
@@ -104,10 +104,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
k = sizeof(lnode_chunk);
if (_GC(swap)) {
- j = convert_intel32(L->num_entries) * sizeof(long);
+ j = convert_intel32(L->num_entries) * sizeof(int32);
j = convert_intel32(j);
} else {
- j = L->num_entries * sizeof(long);
+ j = L->num_entries * sizeof(int32);
}
break;
@@ -118,10 +118,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
k = sizeof(node_chunk);
if (_GC(swap)) {
- j = convert_intel32(N->num_entries) * sizeof(long);
+ j = convert_intel32(N->num_entries) * sizeof(int32);
j = convert_intel32(j);
} else {
- j = N->num_entries * sizeof(long); //was +=
+ j = N->num_entries * sizeof(int32); //was +=
}
break;
@@ -157,10 +157,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
k = sizeof(w_reply_chunk);
if (_GC(swap)) {
- j = convert_intel32(W->num_replies) * (2 * sizeof(long)); //was +=
+ j = convert_intel32(W->num_replies) * (2 * sizeof(int32)); //was +=
j = convert_intel32(j);
} else {
- j = W->num_replies * (2 * sizeof(long)); //was +=
+ j = W->num_replies * (2 * sizeof(int32)); //was +=
}
break;
@@ -170,10 +170,10 @@ char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
k = sizeof(w_reply_chunk);
if (_GC(swap)) {
- j = convert_intel32(W->num_replies) * (2 * sizeof(long)); //was +=
+ j = convert_intel32(W->num_replies) * (2 * sizeof(int32)); //was +=
j = convert_intel32(j);
} else {
- j = W->num_replies * (2 * sizeof(long)); //was +=
+ j = W->num_replies * (2 * sizeof(int32)); //was +=
}
break;
@@ -237,7 +237,7 @@ static void swap_assign(assign_chunk *a) {
a->opnd1 = convert_intel32(a->opnd1);
}
-assign_chunk *get_asgn(Conv *c, long cSize) {
+assign_chunk *get_asgn(Conv *c, int32 cSize) {
char *s = nullptr;
assign_chunk *a = nullptr;
@@ -260,7 +260,7 @@ static void swap_c_asgn(c_assign_chunk *c) {
c->opnd1 = convert_intel32(c->opnd1);
}
-c_assign_chunk *get_c_asgn(Conv *c, long cSize) {
+c_assign_chunk *get_c_asgn(Conv *c, int32 cSize) {
char *s = nullptr;
c_assign_chunk *c_a = nullptr;
@@ -276,7 +276,7 @@ static void swap_conv(conv_chunk *c) {
c->size = convert_intel32(c->size);
}
-conv_chunk *get_conv(Conv *c, long cSize) {
+conv_chunk *get_conv(Conv *c, int32 cSize) {
char *s = nullptr;
conv_chunk *c_v = nullptr;
@@ -291,10 +291,10 @@ static void swap_decl(decl_chunk *d) {
d->tag = convert_intel32(d->tag);
d->val = convert_intel32(d->val);
d->flags = convert_intel32(d->flags);
- //long = convert_intel32( *addr );
+ //int32 = convert_intel32( *addr );
}
-decl_chunk *get_decl(Conv *c, long cSize) {
+decl_chunk *get_decl(Conv *c, int32 cSize) {
char *s = nullptr;
decl_chunk *d = nullptr;
@@ -311,7 +311,7 @@ static void swap_fall(fall_chunk *l) {
l->index = convert_intel32(l->index);
}
-fall_chunk *get_fall(Conv *c, long cSize) {
+fall_chunk *get_fall(Conv *c, int32 cSize) {
char *s = nullptr;
fall_chunk *f = nullptr;
@@ -324,7 +324,7 @@ fall_chunk *get_fall(Conv *c, long cSize) {
static void swap_lnode(lnode_chunk *l) {
int i = 0;
- long *L = nullptr;
+ int32 *L = nullptr;
l->tag = convert_intel32(l->tag);
l->hash = convert_intel32(l->hash);
@@ -332,15 +332,15 @@ static void swap_lnode(lnode_chunk *l) {
l->entry_num = convert_intel32(l->entry_num);
l->num_entries = convert_intel32(l->num_entries);
- L = (long *)l; //was &l
- L += 5; // *sizeof( long );
+ L = (int32 *)l; //was &l
+ L += 5; // *sizeof( int32 );
for (i = 0; i < l->num_entries; i++) {
L[i] = convert_intel32(L[i]);
}
//
}
-lnode_chunk *get_lnode(Conv *c, long cSize) {
+lnode_chunk *get_lnode(Conv *c, int32 cSize) {
char *s = nullptr;
lnode_chunk *l = nullptr;
@@ -353,29 +353,27 @@ lnode_chunk *get_lnode(Conv *c, long cSize) {
static void swap_node(node_chunk *n) {
int i = 0;
- long *L = nullptr;
+ int32 *L = nullptr;
n->tag = convert_intel32(n->tag);
n->hash = convert_intel32(n->hash);
n->size = convert_intel32(n->size);
n->num_entries = convert_intel32(n->num_entries);
- //int j = sizeof(long);
- L = (long *)n; //was &n
- L += 4; // *sizeof( long );
+ L = (int32 *)(n + 1);
+
for (i = 0; i < n->num_entries; i++) {
L[i] = convert_intel32(L[i]);
}
}
-node_chunk *get_node(Conv *c, long cSize) {
+node_chunk *get_node(Conv *c, int32 cSize) {
char *s = nullptr;
node_chunk *n = nullptr;
s = &(c->conv[c->myCNode]);
n = (node_chunk *)&s[cSize];
- //swap_node( n );
return n;
}
@@ -385,7 +383,7 @@ static void swap_entry(entry_chunk *e) {
e->status = convert_intel32(e->status);
}
-entry_chunk *get_entry(Conv *c, long cSize) {
+entry_chunk *get_entry(Conv *c, int32 cSize) {
char *s = nullptr;
entry_chunk *e = nullptr;
@@ -396,15 +394,7 @@ entry_chunk *get_entry(Conv *c, long cSize) {
return e;
}
-#if 0
-static void swap_hash_entry(entry_chunk *e) {
- e->tag = convert_intel32(e->tag);
- e->size = convert_intel32(e->size);
- e->status = convert_intel32(e->status);
-}
-#endif
-
-entry_chunk *get_hash_entry(Conv *c, long cSize) {
+entry_chunk *get_hash_entry(Conv *c, int32 cSize) {
char *s = nullptr;
entry_chunk *e = nullptr;
@@ -420,7 +410,7 @@ static void swap_text(text_chunk *t) {
t->size = convert_intel32(t->size);
}
-text_chunk *get_text(Conv *c, long cSize) {
+text_chunk *get_text(Conv *c, int32 cSize) {
char *s = nullptr;
text_chunk *t = nullptr;
@@ -436,7 +426,7 @@ static void swap_mesg(mesg_chunk *m) {
m->size = convert_intel32(m->size);
}
-mesg_chunk *get_mesg(Conv *c, long cSize) {
+mesg_chunk *get_mesg(Conv *c, int32 cSize) {
char *s = nullptr;
mesg_chunk *m = nullptr;
@@ -452,7 +442,7 @@ static void swap_reply(reply_chunk *r) {
r->index = convert_intel32(r->index);
}
-reply_chunk *get_reply(Conv *c, long cSize) {
+reply_chunk *get_reply(Conv *c, int32 cSize) {
char *s = nullptr;
reply_chunk *r = nullptr;
@@ -471,7 +461,7 @@ static void swap_c_reply(c_reply_chunk *c) {
c->index = convert_intel32(c->index);
}
-c_reply_chunk *get_c_reply(Conv *c, long cSize) {
+c_reply_chunk *get_c_reply(Conv *c, int32 cSize) {
char *s = nullptr;
c_reply_chunk *c_r = nullptr;
@@ -487,14 +477,13 @@ static void swap_w_reply(w_reply_chunk *c) {
c->num_replies = convert_intel32(c->num_replies);
}
-w_reply_chunk *get_w_reply(Conv *c, long cSize) {
+w_reply_chunk *get_w_reply(Conv *c, int32 cSize) {
char *s = nullptr;
w_reply_chunk *w = nullptr;
s = &(c->conv[c->myCNode]);
w = (w_reply_chunk *)&s[cSize];
- //swap_w_reply( w );
return w;
}
@@ -503,7 +492,7 @@ static void swap_w_entry(w_entry_chunk *w) {
w->index = convert_intel32(w->index);
}
-w_entry_chunk *get_w_entry(Conv *c, long cSize) {
+w_entry_chunk *get_w_entry(Conv *c, int32 cSize) {
char *s = nullptr;
w_entry_chunk *w = nullptr;
@@ -519,7 +508,7 @@ static void swap_goto(goto_chunk *g) {
g->index = convert_intel32(g->index);
}
-goto_chunk *get_goto(Conv *c, long cSize) {
+goto_chunk *get_goto(Conv *c, int32 cSize) {
char *s = nullptr;
goto_chunk *g = nullptr;
@@ -538,7 +527,7 @@ static void swap_c_goto(c_goto_chunk *c) {
c->index = convert_intel32(c->index);
}
-c_goto_chunk *get_c_goto(Conv *c, long cSize) {
+c_goto_chunk *get_c_goto(Conv *c, int32 cSize) {
char *s = nullptr;
c_goto_chunk *cg = nullptr;
@@ -554,7 +543,7 @@ static void swap_misc(misc_chunk *m) {
m->index = convert_intel32(m->index);
}
-misc_chunk *get_misc(Conv *c, long cSize) {
+misc_chunk *get_misc(Conv *c, int32 cSize) {
char *s = nullptr;
misc_chunk *m = nullptr;
@@ -575,7 +564,7 @@ static void swap_c_misc(c_misc_chunk *c) {
c->index = convert_intel32(c->index);
}
-c_misc_chunk *get_c_misc(Conv *c, long cSize) {
+c_misc_chunk *get_c_misc(Conv *c, int32 cSize) {
char *s = nullptr;
c_misc_chunk *cm = nullptr;
@@ -587,23 +576,23 @@ c_misc_chunk *get_c_misc(Conv *c, long cSize) {
}
#if 0
-static void swap_long(long *l) {
+static void swap_long(int32 *l) {
*l = convert_intel32(*l);
}
#endif
-long get_long(Conv *c, long cSize) {
+int32 get_long(Conv *c, int32 cSize) {
char *s = nullptr;
- long *l = nullptr;
+ int32 *l = nullptr;
s = &(c->conv[c->myCNode]);
- l = (long *)&s[cSize];
+ l = (int32 *)&s[cSize];
//swap_long( l );
return *l;
}
-char *get_string(Conv *c, long cSize) {
+char *get_string(Conv *c, int32 cSize) {
char *s = nullptr;
char *c_s = nullptr;
@@ -612,7 +601,7 @@ char *get_string(Conv *c, long cSize) {
return c_s;
}
-int conv_ops_cond_successful(long l_op, long op, long r_op) {
+int conv_ops_cond_successful(int32 l_op, int32 op, int32 r_op) {
switch (op) {
case PERCENT:
return l_op % r_op;
@@ -645,7 +634,7 @@ int conv_ops_cond_successful(long l_op, long op, long r_op) {
return 0;
}
-long conv_ops_process_asgn(long val, long oprtr, long opnd) {
+int32 conv_ops_process_asgn(int32 val, int32 oprtr, int32 opnd) {
switch (oprtr) {
case PPLUS:
val += opnd;
@@ -679,9 +668,9 @@ long conv_ops_process_asgn(long val, long oprtr, long opnd) {
}
void conv_swap_words(Conv *c) {
- long ent = 0, tag = 0, next;
- long ent_old = 0;
- long tempEnt = 0;
+ int32 ent = 0, tag = 0, next;
+ int32 ent_old = 0;
+ int32 tempEnt = 0;
int x = 0;
conv_chunk *conv = nullptr;
diff --git a/engines/m4/adv_r/conv.h b/engines/m4/adv_r/conv.h
index b54295b6dad..7b7d5720170 100644
--- a/engines/m4/adv_r/conv.h
+++ b/engines/m4/adv_r/conv.h
@@ -47,51 +47,51 @@ namespace M4 {
//from: prochunk.h
-#define C_ASGN_CHUNK ((long) ('C' << 24) | ('A' << 16) | ('S' << 8) | 'N')
+#define C_ASGN_CHUNK ((int32) ('C' << 24) | ('A' << 16) | ('S' << 8) | 'N')
-#define ASGN_CHUNK ((long) ('A' << 24) | ('S' << 16) | ('G' << 8) | 'N')
+#define ASGN_CHUNK ((int32) ('A' << 24) | ('S' << 16) | ('G' << 8) | 'N')
-#define HIDE_CHUNK ((long) ('H' << 24) | ('I' << 16) | ('D' << 8) | 'E')
-#define UHID_CHUNK ((long) ('U' << 24) | ('H' << 16) | ('I' << 8) | 'D')
-#define DSTR_CHUNK ((long) ('D' << 24) | ('S' << 16) | ('T' << 8) | 'R')
-#define CHDE_CHUNK ((long) ('C' << 24) | ('H' << 16) | ('D' << 8) | 'E')
-#define CUHD_CHUNK ((long) ('C' << 24) | ('U' << 16) | ('H' << 8) | 'D')
-#define CDST_CHUNK ((long) ('D' << 24) | ('D' << 16) | ('T' << 8) | 'S')
+#define HIDE_CHUNK ((int32) ('H' << 24) | ('I' << 16) | ('D' << 8) | 'E')
+#define UHID_CHUNK ((int32) ('U' << 24) | ('H' << 16) | ('I' << 8) | 'D')
+#define DSTR_CHUNK ((int32) ('D' << 24) | ('S' << 16) | ('T' << 8) | 'R')
+#define CHDE_CHUNK ((int32) ('C' << 24) | ('H' << 16) | ('D' << 8) | 'E')
+#define CUHD_CHUNK ((int32) ('C' << 24) | ('U' << 16) | ('H' << 8) | 'D')
+#define CDST_CHUNK ((int32) ('D' << 24) | ('D' << 16) | ('T' << 8) | 'S')
-#define CONV_CHUNK ((long) ('C' << 24) | ('O' << 16) | ('N' << 8) | 'V')
-#define DECL_CHUNK ((long) ('D' << 24) | ('E' << 16) | ('C' << 8) | 'L')
+#define CONV_CHUNK ((int32) ('C' << 24) | ('O' << 16) | ('N' << 8) | 'V')
+#define DECL_CHUNK ((int32) ('D' << 24) | ('E' << 16) | ('C' << 8) | 'L')
-#define FALL_CHUNK ((long) ('F' << 24) | ('A' << 16) | ('L' << 8) | 'L')
-#define LNODE_CHUNK ((long) ('L' << 24) | ('N' << 16) | ('O' << 8) | 'D')
-#define NODE_CHUNK ((long) ('N' << 24) | ('O' << 16) | ('D' << 8) | 'E')
-#define ENTRY_CHUNK ((long) ('E' << 24) | ('T' << 16) | ('R' << 8) | 'Y')
-#define TEXT_CHUNK ((long) ('T' << 24) | ('E' << 16) | ('X' << 8) | 'T')
+#define FALL_CHUNK ((int32) ('F' << 24) | ('A' << 16) | ('L' << 8) | 'L')
+#define LNODE_CHUNK ((int32) ('L' << 24) | ('N' << 16) | ('O' << 8) | 'D')
+#define NODE_CHUNK ((int32) ('N' << 24) | ('O' << 16) | ('D' << 8) | 'E')
+#define ENTRY_CHUNK ((int32) ('E' << 24) | ('T' << 16) | ('R' << 8) | 'Y')
+#define TEXT_CHUNK ((int32) ('T' << 24) | ('E' << 16) | ('X' << 8) | 'T')
//reply
-#define REPLY_CHUNK ((long) ('R' << 24) | ('P' << 16) | ('L' << 8) | 'Y')
-#define WEIGHT_REPLY_CHUNK ((long) ('W' << 24) | ('R' << 16) | ('P' << 8) | 'L')
-#define WEIGHT_PREPLY_CHUNK ((long) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L')
-#define COND_REPLY_CHUNK ((long) ('C' << 24) | ('R' << 16) | ('P' << 8) | 'L')
+#define REPLY_CHUNK ((int32) ('R' << 24) | ('P' << 16) | ('L' << 8) | 'Y')
+#define WEIGHT_REPLY_CHUNK ((int32) ('W' << 24) | ('R' << 16) | ('P' << 8) | 'L')
+#define WEIGHT_PREPLY_CHUNK ((int32) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L')
+#define COND_REPLY_CHUNK ((int32) ('C' << 24) | ('R' << 16) | ('P' << 8) | 'L')
-#define MESSAGE_CHUNK ((long) ('M' << 24) | ('E' << 16) | ('S' << 8) | 'G')
+#define MESSAGE_CHUNK ((int32) ('M' << 24) | ('E' << 16) | ('S' << 8) | 'G')
// goto
-#define GOTO_CHUNK ((long) ('G' << 24) | ('O' << 16) | ('T' << 8) | 'O')
-#define EXIT_GOTO_CHUNK ((long) ('E' << 24) | ('X' << 16) | ('I' << 8) | 'T')
-#define COND_GOTO_CHUNK ((long) ('C' << 24) | ('C' << 16) | ('G' << 8) | 'O')
+#define GOTO_CHUNK ((int32) ('G' << 24) | ('O' << 16) | ('T' << 8) | 'O')
+#define EXIT_GOTO_CHUNK ((int32) ('E' << 24) | ('X' << 16) | ('I' << 8) | 'T')
+#define COND_GOTO_CHUNK ((int32) ('C' << 24) | ('C' << 16) | ('G' << 8) | 'O')
+
+#define COND_EXIT_GOTO_CHUNK ((int32) ('C' << 24) | ('E' << 16) | ('G' << 8) | 'O')
-#define COND_EXIT_GOTO_CHUNK ((long) ('C' << 24) | ('E' << 16) | ('G' << 8) | 'O')
-// from: chunkhed.h
struct Conv {
- long chunkSize;
+ int32 chunkSize;
char *conv;
- long myCNode;
- long exit_now;
- long node_hash;
+ int32 myCNode;
+ int32 exit_now;
+ int32 node_hash;
- long mode;
- long c_entry_num;
+ int32 mode;
+ int32 c_entry_num;
};
struct ConvDisplayData {
@@ -104,124 +104,128 @@ struct ConvDisplayData {
int player_choice;
};
+#include "common/pack-start.h" // START STRUCT PACKING
+
struct conv_chunk {
- long tag;
- long size;
-};
+ int32 tag;
+ int32 size;
+} PACKED_STRUCT;
struct decl_chunk {
- long tag;
- long val;
- long flags;
- long *addr;
-};
+ int32 tag;
+ int32 val;
+ int32 flags;
+ int32 *addr;
+} PACKED_STRUCT;
struct fall_chunk {
- long tag;
- long val;
- long index;
-};
+ int32 tag;
+ int32 val;
+ int32 index;
+} PACKED_STRUCT;
struct node_chunk {
- long tag;
- long hash;
- long size;
- long num_entries;
-};
+ int32 tag;
+ int32 hash;
+ int32 size;
+ int32 num_entries;
+} PACKED_STRUCT;
struct lnode_chunk {
- long tag;
- long hash;
- long size;
- long entry_num;
- long num_entries;
-};
+ int32 tag;
+ int32 hash;
+ int32 size;
+ int32 entry_num;
+ int32 num_entries;
+} PACKED_STRUCT;
struct entry_chunk {
- long tag;
- long size;
- long status;
-};
+ int32 tag;
+ int32 size;
+ int32 status;
+} PACKED_STRUCT;
struct text_chunk {
- long tag;
- long size;
-};
+ int32 tag;
+ int32 size;
+} PACKED_STRUCT;
struct mesg_chunk {
- long tag;
- long size;
-};
+ int32 tag;
+ int32 size;
+} PACKED_STRUCT;
struct reply_chunk {
- long tag;
- long index; // Where the message is located.
-};
+ int32 tag;
+ int32 index; // Where the message is located.
+} PACKED_STRUCT;
struct c_reply_chunk {
- long tag;
- long op_l;
- long op;
- long op_r;
- long index; // Where the message is located.
-};
+ int32 tag;
+ int32 op_l;
+ int32 op;
+ int32 op_r;
+ int32 index; // Where the message is located.
+} PACKED_STRUCT;
struct w_reply_chunk {
- long tag;
- long num_replies;
-};
+ int32 tag;
+ int32 num_replies;
+} PACKED_STRUCT;
struct w_entry_chunk {
- long weight;
- long index; // Where the message is located.
-};
+ int32 weight;
+ int32 index; // Where the message is located.
+} PACKED_STRUCT;
struct goto_chunk {
- long tag;
- long index; // Where the node is located.
-};
+ int32 tag;
+ int32 index; // Where the node is located.
+} PACKED_STRUCT;
struct c_goto_chunk {
- long tag;
- long opnd1; // Where the decl is located.
- long op;
- long opnd2; // Integer value.
- long index; // Where the node is located.
-};
+ int32 tag;
+ int32 opnd1; // Where the decl is located.
+ int32 op;
+ int32 opnd2; // Integer value.
+ int32 index; // Where the node is located.
+} PACKED_STRUCT;
struct misc_chunk {
- long tag;
- long index; // Where the entry is located.
-};
+ int32 tag;
+ int32 index; // Where the entry is located.
+} PACKED_STRUCT;
struct c_misc_chunk {
- long tag;
+ int32 tag;
- long c_op_l; // Where the decl is located.
- long c_op;
- long c_op_r; // Integer value.
+ int32 c_op_l; // Where the decl is located.
+ int32 c_op;
+ int32 c_op_r; // Integer value.
- long index; // Where the entry is located.
-};
+ int32 index; // Where the entry is located.
+} PACKED_STRUCT;
struct assign_chunk {
- long tag;
- long index; // Where the decl is located.
- long op;
- long opnd1; // Integer value.
-};
+ int32 tag;
+ int32 index; // Where the decl is located.
+ int32 op;
+ int32 opnd1; // Integer value.
+} PACKED_STRUCT;
struct c_assign_chunk {
- long tag;
+ int32 tag;
- long c_op_l; // Where the decl is located.
- long c_op;
- long c_op_r; // Integer value.
+ int32 c_op_l; // Where the decl is located.
+ int32 c_op;
+ int32 c_op_r; // Integer value.
- long index; // Where the decl is located.
- long op;
- long opnd1; // Integer value.
-};
+ int32 index; // Where the decl is located.
+ int32 op;
+ int32 opnd1; // Integer value.
+} PACKED_STRUCT;
+
+#include "common/pack-end.h" // END STRUCT PACKING
/**
"xxxxxxxx" means the size you have calculated a conversation box to be,
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 6879fda6edd..9c002107102 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -126,7 +126,7 @@ void conv_play(Conv *c) {
conv_go(c);
}
-long conv_current_node() {
+int32 conv_current_node() {
if (conv_get_handle())
return conv_get_handle()->node_hash;
return 0;
@@ -173,7 +173,7 @@ int conv_toggle_flags(entry_chunk *entry) {
return entry->status;
}
-long conv_get_decl_val(decl_chunk *decl) {
+int32 conv_get_decl_val(decl_chunk *decl) {
switch (decl->flags) {
case DECL_POINTER:
return *decl->addr;
@@ -183,7 +183,7 @@ long conv_get_decl_val(decl_chunk *decl) {
}
}
-void conv_set_decl_val(decl_chunk *decl, long val) {
+void conv_set_decl_val(decl_chunk *decl, int32 val) {
switch (decl->flags) {
case DECL_POINTER:
decl->val = val;
@@ -196,10 +196,10 @@ void conv_set_decl_val(decl_chunk *decl, long val) {
}
}
-void conv_export_value(Conv *c, long val, int index) {
- long ent = 0, tag = 0, next;
+void conv_export_value(Conv *c, int32 val, int index) {
+ int32 ent = 0, tag = 0, next;
decl_chunk *decl;
- long ent_old = 0;
+ int32 ent_old = 0;
int i = 0;
if (!c)
@@ -229,14 +229,14 @@ void conv_export_value(Conv *c, long val, int index) {
c->myCNode = ent_old;
}
-void conv_export_value_curr(long val, int index) {
+void conv_export_value_curr(int32 val, int index) {
conv_export_value(conv_get_handle(), val, index);
}
-void conv_export_pointer(Conv *c, long *val, int index) {
- long ent = 0, tag = 0, next;
+void conv_export_pointer(Conv *c, int32 *val, int index) {
+ int32 ent = 0, tag = 0, next;
decl_chunk *decl;
- long ent_old = 0;
+ int32 ent_old = 0;
int i = 0;
if (!c)
@@ -267,7 +267,7 @@ void conv_export_pointer(Conv *c, long *val, int index) {
c->myCNode = ent_old;
}
-void conv_export_pointer_curr(long *val, int index) {
+void conv_export_pointer_curr(int32 *val, int index) {
conv_export_pointer(conv_get_handle(), val, index);
}
@@ -289,9 +289,9 @@ void conv_init(Conv *c) {
}
}
-static long find_state(char *s, char *c, int file_size) {
+static int32 find_state(char *s, char *c, int file_size) {
char name[9];
- long size = 0, offset = 0;
+ int32 size = 0, offset = 0;
////fprintf( conv_fp, "find_state %s\n", s );
while (offset < file_size) {
@@ -322,7 +322,7 @@ handled:
}
void find_and_set_conv_name(Conv *c) {
- long ent = 0, tag = 0, next = 0;
+ int32 ent = 0, tag = 0, next = 0;
conv_chunk *conv;
c->myCNode = 0;
@@ -350,10 +350,10 @@ static void conv_save_state(Conv *c) {
// the number of ENTRY_CHUNKs affects the amt_to_write
// also extract fname from the CONV_CHUNK
- long amt_to_write = 3 * sizeof(int32); // mystery padding
- long ent = 0;
- long next, tag; // receive conv_ops_get_entry results
- long myCNode = c->myCNode;
+ int32 amt_to_write = 3 * sizeof(int32); // mystery padding
+ int32 ent = 0;
+ int32 next, tag; // receive conv_ops_get_entry results
+ int32 myCNode = c->myCNode;
char fname[9];
int32 num_decls = 0;
@@ -395,9 +395,9 @@ static void conv_save_state(Conv *c) {
//-------------------------------------------------------------------------------
// if consave.dat exists, read it in
- long file_size = 0;
- long offset = -1;
- long prev_size = 0;
+ int32 file_size = 0;
+ int32 offset = -1;
+ int32 prev_size = 0;
char *conv_save_buff = nullptr;
bool overwrite_file = false;
@@ -467,18 +467,18 @@ static void conv_save_state(Conv *c) {
memcpy(&conv_save_buff[offset], &num_entries, sizeof(int32));
offset += sizeof(int32);
- long size = 3 * sizeof(int32);
+ int32 size = 3 * sizeof(int32);
// fill in all the entries themselves
- long e_flags = 0;
+ int32 e_flags = 0;
short flag_index = 0;
// short flag_num = 0;
ent = 0;
c->myCNode = 0;
- long val = 0;
+ int32 val = 0;
entry_chunk *entry = nullptr;
while (ent < c->chunkSize)
@@ -557,17 +557,17 @@ static void conv_save_state(Conv *c) {
}
static Conv *conv_restore_state(Conv *c) {
- long ent = 0;
- long tag, next, offset;
+ int32 ent = 0;
+ int32 tag, next, offset;
entry_chunk *entry;
decl_chunk *decl;
- long num_decls = 0, num_entries = 0;
+ int32 num_decls = 0, num_entries = 0;
short flag_num = 0, flag_index = 0;
- long val;
- long e_flags = 0;
- long myCNode;
+ int32 val;
+ int32 e_flags = 0;
+ int32 myCNode;
char fname[9];
int dont_update_ents = 0;
@@ -741,7 +741,7 @@ static void conv_set_disp_default(void) {
Conv *conv_load(const char *filename, int x1, int y1, int32 myTrigger, bool want_box) {
Conv *convers = nullptr;
- long cSize = 0;
+ int32 cSize = 0;
char fullpathname[MAX_FILENAME_SIZE];
void *bufferHandle;
@@ -885,8 +885,8 @@ void conv_unload() {
// only called if node is visible.
// gets the TEXT chunks inside a node.
-int conv_get_text(long offset, long size, Conv *c) {
- long i = offset, tag, next, text_len, text_width;
+int conv_get_text(int32 offset, int32 size, Conv *c) {
+ int32 i = offset, tag, next, text_len, text_width;
text_chunk *text;
int result = 0;
diff --git a/engines/m4/adv_r/conv_io.h b/engines/m4/adv_r/conv_io.h
index d8a55a82982..96b1b66b9cb 100644
--- a/engines/m4/adv_r/conv_io.h
+++ b/engines/m4/adv_r/conv_io.h
@@ -59,7 +59,7 @@ struct Converstation_Globals {
char conv_name[16];
Conv *globConv = nullptr;
bool playerCommAllowed = false;
- long myFinalTrigger = 0;
+ int32 myFinalTrigger = 0;
bool interface_was_visible = false; // to remember to turn it back on
int restore_conv = 1;
int ent = 0;
@@ -117,12 +117,12 @@ extern const char *get_conv_name();
extern const char *conv_sound_to_play();
extern int32 conv_whos_talking();
-extern long conv_get_decl_val(decl_chunk *decl);
-extern void conv_set_decl_val(decl_chunk *decl, long val);
-extern void conv_export_value(Conv *c, long val, int index);
-extern void conv_export_value_curr(long val, int index);
-extern void conv_export_pointer(Conv *c, long *val, int index);
-extern void conv_export_pointer_curr(long *val, int index);
+extern int32 conv_get_decl_val(decl_chunk *decl);
+extern void conv_set_decl_val(decl_chunk *decl, int32 val);
+extern void conv_export_value(Conv *c, int32 val, int index);
+extern void conv_export_value_curr(int32 val, int index);
+extern void conv_export_pointer(Conv *c, int32 *val, int index);
+extern void conv_export_pointer_curr(int32 *val, int index);
extern void conv_set_font_spacing(int32 h, int32 v);
extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
@@ -142,12 +142,12 @@ extern void conv_set_event(int e);
extern int conv_is_event_ready();
extern void conv_swap_words(Conv *c);
-extern long conv_current_node();
+extern int32 conv_current_node();
extern int32 conv_current_entry();
extern int conv_toggle_flags(entry_chunk *entry);
extern int ok_status(entry_chunk *entry);
-extern int conv_get_text(long offset, long size, Conv *c);
+extern int conv_get_text(int32 offset, int32 size, Conv *c);
extern void cdd_init();
} // End of namespace M4
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 33262e64561..1bcc31bff40 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,6 +110,8 @@ void Vars::main_cold_data_init() {
break;
}
+ _game.setRoom(610); //***DEBUG****
+
font_set_colors(2, 1, 3);
}
Commit: da518ab7e58c1bd7b7ef98154c8d2e27b8d9ac07
https://github.com/scummvm/scummvm/commit/da518ab7e58c1bd7b7ef98154c8d2e27b8d9ac07
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further changes of long to int32
Changed paths:
engines/m4/adv_r/chunk_ops.h
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv_io.cpp
engines/m4/burger/core/play_break.h
engines/m4/burger/core/stream_break.h
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room102.h
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room103.h
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room302.h
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room503.h
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room504.h
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room506.h
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room507.h
engines/m4/burger/rooms/section5/room508.cpp
engines/m4/burger/rooms/section5/room508.h
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room509.h
engines/m4/burger/rooms/section5/room511.cpp
engines/m4/burger/rooms/section5/room511.h
engines/m4/burger/rooms/section5/room512.cpp
engines/m4/burger/rooms/section5/room512.h
engines/m4/burger/rooms/section6/room602.cpp
engines/m4/burger/rooms/section6/room602.h
engines/m4/burger/rooms/section6/room603.cpp
engines/m4/burger/rooms/section6/room603.h
engines/m4/burger/rooms/section6/room604.cpp
engines/m4/burger/rooms/section6/room604.h
engines/m4/burger/rooms/section6/room606.cpp
engines/m4/burger/rooms/section6/room606.h
engines/m4/burger/rooms/section6/room608.cpp
engines/m4/burger/rooms/section6/room608.h
engines/m4/burger/rooms/section6/room609.cpp
engines/m4/burger/rooms/section6/room609.h
engines/m4/burger/rooms/section6/room610.cpp
engines/m4/burger/rooms/section6/room610.h
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.h
engines/m4/console.cpp
engines/m4/mem/res.h
engines/m4/riddle/flags.cpp
engines/m4/riddle/flags.h
diff --git a/engines/m4/adv_r/chunk_ops.h b/engines/m4/adv_r/chunk_ops.h
index 0a9f9fc773d..5baa8877b63 100644
--- a/engines/m4/adv_r/chunk_ops.h
+++ b/engines/m4/adv_r/chunk_ops.h
@@ -63,31 +63,31 @@ namespace M4 {
#define DOT 446
#define CNE 448
-extern conv_chunk *get_conv(Conv *c, long cSize);
-extern entry_chunk *get_entry(Conv *c, long cSize);
-extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
-extern void conv_ops_unknown_chunk(long tag, const char *s);
-extern decl_chunk *get_decl(Conv *c, long cSize);
-extern char *get_string(Conv *c, long cSize);
-extern text_chunk *get_text(Conv *c, long cSize);
-extern long conv_ops_text_strlen(char *s);
-extern c_assign_chunk *get_c_asgn(Conv *c, long cSize);
-extern int conv_ops_cond_successful(long l_op, long op, long r_op);
-extern long conv_ops_process_asgn(long val, long oprtr, long opnd);
-extern assign_chunk *get_asgn(Conv *c, long cSize);
-extern misc_chunk *get_misc(Conv *c, long cSize);
-extern entry_chunk *get_hash_entry(Conv *c, long cSize);
-extern c_misc_chunk *get_c_misc(Conv *c, long cSize);
-extern c_goto_chunk *get_c_goto(Conv *c, long cSize);
-extern goto_chunk *get_goto(Conv *c, long cSize);
-extern reply_chunk *get_reply(Conv *c, long cSize);
-extern lnode_chunk *get_lnode(Conv *c, long cSize);
-extern node_chunk *get_node(Conv *c, long cSize);
-extern fall_chunk *get_fall(Conv *c, long cSize);
-extern long get_long(Conv *c, long cSize);
-extern c_reply_chunk *get_c_reply(Conv *c, long cSize);
-extern w_reply_chunk *get_w_reply(Conv *c, long cSize);
-extern w_entry_chunk *get_w_entry(Conv *c, long cSize);
+extern conv_chunk *get_conv(Conv *c, int32 cSize);
+extern entry_chunk *get_entry(Conv *c, int32 cSize);
+extern char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c);
+extern void conv_ops_unknown_chunk(int32 tag, const char *s);
+extern decl_chunk *get_decl(Conv *c, int32 cSize);
+extern char *get_string(Conv *c, int32 cSize);
+extern text_chunk *get_text(Conv *c, int32 cSize);
+extern int32 conv_ops_text_strlen(char *s);
+extern c_assign_chunk *get_c_asgn(Conv *c, int32 cSize);
+extern int conv_ops_cond_successful(int32 l_op, int32 op, int32 r_op);
+extern int32 conv_ops_process_asgn(int32 val, int32 oprtr, int32 opnd);
+extern assign_chunk *get_asgn(Conv *c, int32 cSize);
+extern misc_chunk *get_misc(Conv *c, int32 cSize);
+extern entry_chunk *get_hash_entry(Conv *c, int32 cSize);
+extern c_misc_chunk *get_c_misc(Conv *c, int32 cSize);
+extern c_goto_chunk *get_c_goto(Conv *c, int32 cSize);
+extern goto_chunk *get_goto(Conv *c, int32 cSize);
+extern reply_chunk *get_reply(Conv *c, int32 cSize);
+extern lnode_chunk *get_lnode(Conv *c, int32 cSize);
+extern node_chunk *get_node(Conv *c, int32 cSize);
+extern fall_chunk *get_fall(Conv *c, int32 cSize);
+extern int32 get_long(Conv *c, int32 cSize);
+extern c_reply_chunk *get_c_reply(Conv *c, int32 cSize);
+extern w_reply_chunk *get_w_reply(Conv *c, int32 cSize);
+extern w_entry_chunk *get_w_entry(Conv *c, int32 cSize);
} // End of namespace M4
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index e8002751ddc..4d88972e374 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -35,10 +35,10 @@ namespace M4 {
// Get next node pointer
// Process declarations
// Get message text
-static void conv_exec_entry(long offset, Conv *c) {
- long i = offset, entry_count;
- long l_op, r_op;
- long tag, next;
+static void conv_exec_entry(int32 offset, Conv *c) {
+ int32 i = offset, entry_count;
+ int32 l_op, r_op;
+ int32 tag, next;
goto_chunk *go;
c_goto_chunk *c_goto;
@@ -252,12 +252,12 @@ static void conv_exec_entry(long offset, Conv *c) {
}
}
-static int conv_get_mesg(long offset, long is_valid, Conv *c) {
- long i = offset, entry_count;
- long l_op, r_op;
- long x, y, s_offset = 0, cSize;
- long tag, next;
- long text_len;
+static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
+ int32 i = offset, entry_count;
+ int32 l_op, r_op;
+ int32 x, y, s_offset = 0, cSize;
+ int32 tag, next;
+ int32 text_len;
int sum, result = 0;
entry_chunk *entry;
@@ -495,10 +495,10 @@ static void find_true_ent(int entry_num, Conv *c) {
lnode_chunk *lnode = nullptr;
entry_chunk *entry = nullptr;
fall_chunk *fall = nullptr;
- long offset = 0, ent = 0, n = 0;
- long next = 0, tag = 0, num_ents = 0;
+ int32 offset = 0, ent = 0, n = 0;
+ int32 next = 0, tag = 0, num_ents = 0;
int i = 0;
- long sub_ent = 0;
+ int32 sub_ent = 0;
int result = 1;
for (;;) {
@@ -537,7 +537,7 @@ static void find_true_ent(int entry_num, Conv *c) {
assert(fall);
//do this to skip the fall chunk and all will be fine.
- ent += sizeof(long); //was get_long, sizeof( fall_chunk )
+ ent += sizeof(int32); //was get_long, sizeof( fall_chunk )
n++; //don't increment i.
break;
@@ -569,7 +569,7 @@ static void find_true_ent(int entry_num, Conv *c) {
//fprintf( conv_fp, "find_true_ent _GC(ent)++\n" );
_GC(ent)++;
- ent += sizeof(long);
+ ent += sizeof(int32);
}
}
@@ -581,7 +581,7 @@ static int conv_get_node_text(Conv *c) {
entry_chunk *entry = nullptr;
fall_chunk *fall = nullptr;
- long ent = 0, offset = 0, tag, next, num_ents = 0;
+ int32 ent = 0, offset = 0, tag, next, num_ents = 0;
int i = 0, num_vis = 0, result = 0;
_G(cdd).num_txt_ents = 0;
@@ -623,10 +623,10 @@ static int conv_get_node_text(Conv *c) {
ent = get_long(c, offset);
entry = get_entry(c, offset + ent);
- offset += sizeof(long);
+ offset += sizeof(int32);
}
- offset -= sizeof(long);
+ offset -= sizeof(int32);
// Set sound file name instead.?
if ((entry->status != 0) && (num_ents != 0) && ok_status(entry)) {
@@ -670,7 +670,7 @@ static int conv_get_node_text(Conv *c) {
fall = get_fall(c, offset + ent);
}
- offset += sizeof(long);
+ offset += sizeof(int32);
}
if (fall) {
@@ -700,7 +700,7 @@ void conv_shutdown(void) {
// Simplify me.
static void conv_start(Conv *c) {
- long ok = 1, ent = 0, tag = 0, next;
+ int32 ok = 1, ent = 0, tag = 0, next;
decl_chunk *decl;
switch (c->exit_now) {
@@ -774,10 +774,10 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
lnode_chunk *lnode = nullptr;
entry_chunk *entry = nullptr;
fall_chunk *fall = nullptr;
- long offset = 0, ent = 0, is_valid = 0, n = 0;
- long next = 0, tag = 0, num_ents = 0;
+ int32 offset = 0, ent = 0, is_valid = 0, n = 0;
+ int32 next = 0, tag = 0, num_ents = 0;
int i = 0;
- long sub_ent = 0;
+ int32 sub_ent = 0;
int result = 1;
//int changed = 0;
@@ -817,7 +817,7 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
assert(fall);
//do this to skip the fall chunk and all will be fine.
- ent += sizeof(long); //was get_long, sizeof( fall_chunk )
+ ent += sizeof(int32); //was get_long, sizeof( fall_chunk )
n++; //don't increment i.
break;
@@ -842,11 +842,11 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
is_valid = 1;
}
- ent += sizeof(long);
+ ent += sizeof(int32);
n++;
}
- ent -= sizeof(long);
+ ent -= sizeof(int32);
if (is_valid) {
switch (mode) {
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 9c002107102..2def6a91e8d 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -570,7 +570,6 @@ static Conv *conv_restore_state(Conv *c) {
int32 myCNode;
char fname[9];
- int dont_update_ents = 0;
int file_size = 0;
char *conv_save_buff = nullptr;
@@ -643,14 +642,14 @@ static Conv *conv_restore_state(Conv *c) {
switch (tag) {
case LNODE_CHUNK:
if (myCNode == ent) {
- dont_update_ents = 1;
+ //dont_update_ents = 1;
} else {
- dont_update_ents = 0;
+ //dont_update_ents = 0;
}
break;
case NODE_CHUNK:
- dont_update_ents = 0;
+ //dont_update_ents = 0;
break;
case ENTRY_CHUNK:
diff --git a/engines/m4/burger/core/play_break.h b/engines/m4/burger/core/play_break.h
index a3d7f963935..55821964b17 100644
--- a/engines/m4/burger/core/play_break.h
+++ b/engines/m4/burger/core/play_break.h
@@ -38,7 +38,7 @@ struct seriesPlayBreak {
int32 trigger;
uint32 flags;
int32 loopCount;
- long *variable;
+ int32 *variable;
int32 value;
};
diff --git a/engines/m4/burger/core/stream_break.h b/engines/m4/burger/core/stream_break.h
index 5d3db27b425..40f8bee847f 100644
--- a/engines/m4/burger/core/stream_break.h
+++ b/engines/m4/burger/core/stream_break.h
@@ -36,7 +36,7 @@ struct seriesStreamBreak {
int32 volume;
int32 trigger;
uint32 flags;
- const long *variable;
+ const int32 *variable;
int32 value;
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index d6a16e70452..847bb9c23bc 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -55,7 +55,7 @@ static const BoonsvilleRec ARRAY[] = {
{ 0, 0, nullptr }
};
-long Flags::_flags[FLAGS_COUNT];
+int32 Flags::_flags[FLAGS_COUNT];
Flags::Flags() {
Common::fill(_flags, _flags + FLAGS_COUNT, 0);
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 676830894fe..0a0d8249145 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -553,7 +553,7 @@ enum {
class Flags {
public:
- static long _flags[FLAGS_COUNT];
+ static int32 _flags[FLAGS_COUNT];
public:
Flags();
@@ -584,7 +584,7 @@ public:
size_t size() const {
return FLAGS_COUNT;
}
- long &operator[](uint idx) {
+ int32 &operator[](uint idx) {
assert(idx < FLAGS_COUNT);
return _flags[idx];
}
diff --git a/engines/m4/burger/rooms/section1/room102.h b/engines/m4/burger/rooms/section1/room102.h
index 2c4872a708c..d91ea50be32 100644
--- a/engines/m4/burger/rooms/section1/room102.h
+++ b/engines/m4/burger/rooms/section1/room102.h
@@ -32,7 +32,7 @@ class Room102 : public Room {
private:
int _val1 = 0;
int _val3 = -1;
- long _val4 = 0;
+ int32 _val4 = 0;
int _val5 = 0;
int _val6 = 0;
int _val8 = 0;
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index f7c59aa2f2c..0fbe668ac10 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -109,7 +109,7 @@ static const seriesPlayBreak PLAY4[] = {
PLAY_BREAK_END
};
-long Room103::_val0 = 0;
+int32 Room103::_val0 = 0;
void Room103::init() {
_flag1 = false;
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
index d4c32ac0edd..dc3010545d0 100644
--- a/engines/m4/burger/rooms/section1/room103.h
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -34,7 +34,7 @@ class Room103 : public Room {
static const seriesStreamBreak SERIES3[];
static const seriesStreamBreak SERIES4[];
private:
- static long _val0;
+ static int32 _val0;
bool _flag1 = false;
int _val2 = 0;
int _val3 = 0;
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 320c68bd0eb..6c5c8a6f882 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -120,8 +120,8 @@ const seriesPlayBreak Room106::PLAY7[] = {
PLAY_BREAK_END
};
-long Room106::_val1;
-long Room106::_val3;
+int32 Room106::_val1;
+int32 Room106::_val3;
void Room106::preload() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index b814ec7e3ce..72b9d1aca72 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -40,9 +40,9 @@ class Room106 : public Room {
static const seriesPlayBreak PLAY7[];
private:
const char *_digi1 = nullptr;
- static long _val1;
+ static int32 _val1;
int _val2 = 0;
- static long _val3;
+ static int32 _val3;
void setHotspots();
void loadSeries();
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 798f76a687b..2eb338824b0 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -157,9 +157,9 @@ const seriesPlayBreak Room142::PLAY14[] = {
};
-long Room142::_val1;
-long Room142::_val2;
-long Room142::_val3;
+int32 Room142::_val1;
+int32 Room142::_val2;
+int32 Room142::_val3;
Room142::Room142() : Room() {
_val1 = 0;
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 0c0299a1d82..3de773cd024 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -58,9 +58,9 @@ private:
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
int _volume = 0;
- static long _val1;
- static long _val2;
- static long _val3;
+ static int32 _val1;
+ static int32 _val2;
+ static int32 _val3;
int _val4 = 0;
void checkAction();
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 95c1949e2d4..6eac8ce8828 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -197,9 +197,9 @@ const seriesPlayBreak Room145::PLAY23[] = {
PLAY_BREAK_END
};
-long Room145::_state1;
-long Room145::_state2;
-long Room145::_state3;
+int32 Room145::_state1;
+int32 Room145::_state2;
+int32 Room145::_state3;
Room145::Room145() : Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 8963f5b3797..b4e46d979cf 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -56,9 +56,9 @@ private:
static const seriesPlayBreak PLAY21[];
static const seriesPlayBreak PLAY22[];
static const seriesPlayBreak PLAY23[];
- static long _state1;
- static long _state2;
- static long _state3;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
noWalkRect *_walk1 = nullptr;
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 2652b38737c..2f5bdd62f47 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -428,7 +428,7 @@ int Mine::getTreasureDistance() const {
}
void Mine::mine_travel_link(int16 takeLink) {
- long &mineRoomIndex = _G(flags)[kMineRoomIndex];
+ int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
_mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
_entranceDoor = _mineRoomInfo.door[takeLink]; // Get which door to enter from in new room
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index 4ad05a9c0b3..83a5a63c5d5 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -160,7 +160,7 @@ const seriesPlayBreak Room302::PLAY13[] = {
PLAY_BREAK_END
};
-long Room302::_state1;
+int32 Room302::_state1;
Room302::Room302() : Section3Room() {
diff --git a/engines/m4/burger/rooms/section3/room302.h b/engines/m4/burger/rooms/section3/room302.h
index 1d431a598a1..40435373e3c 100644
--- a/engines/m4/burger/rooms/section3/room302.h
+++ b/engines/m4/burger/rooms/section3/room302.h
@@ -47,7 +47,7 @@ private:
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
- static long _state1;
+ static int32 _state1;
machine *_series1 = nullptr;
Series _series2;
machine *_series3 = nullptr;
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index ca53f6e46a4..7281d420122 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -74,7 +74,7 @@ const seriesPlayBreak Room310::PLAY6[] = {
{ 52, 56, "300_001", 2, 255, -1, 0, 0, nullptr, 0 },
};
-long Room310::_state1;
+int32 Room310::_state1;
Room310::Room310() : Mine() {
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index ca49af81d01..e4e60fd0a4c 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -37,7 +37,7 @@ private:
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
- static long _state1;
+ static int32 _state1;
Series _series1;
machine *_series2 = nullptr;
noWalkRect *_walk1 = nullptr;
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index dd6ae0d289b..a32d301c43a 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -411,10 +411,10 @@ const seriesPlayBreak Room406::PLAY36[] = {
{ 5, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
};
-long Room406::_state1;
-long Room406::_state2;
-long Room406::_state3;
-long Room406::_state4;
+int32 Room406::_state1;
+int32 Room406::_state2;
+int32 Room406::_state3;
+int32 Room406::_state4;
Room406::Room406() : Section4Room() {
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index 68da686d903..4cac75e449c 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -70,10 +70,10 @@ private:
static const seriesPlayBreak PLAY34[];
static const seriesPlayBreak PLAY35[];
static const seriesPlayBreak PLAY36[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
Series _coll;
Series _gate;
Series _mg03;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index da89e1dddd8..f615a57d527 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -146,7 +146,7 @@ const seriesPlayBreak Room407::PLAY18[] = {
PLAY_BREAK_END
};
-long Room407::_state1;
+int32 Room407::_state1;
Room407::Room407() : Section4Room() {
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index f20513717f1..db6923bad32 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -51,7 +51,7 @@ private:
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
static const seriesPlayBreak PLAY18[];
- static long _state1;
+ static int32 _state1;
Series _vp02;
Series _dz;
int _dzS1 = 0, _dzS2 = 0;
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 3db86d78959..808ddcfbd49 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -249,10 +249,10 @@ const seriesPlayBreak Room502::PLAY17[] = {
PLAY_BREAK_END
};
-long Room502::_state1;
-long Room502::_state2;
-long Room502::_state3;
-long Room502::_state4;
+int32 Room502::_state1;
+int32 Room502::_state2;
+int32 Room502::_state3;
+int32 Room502::_state4;
Room502::Room502() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index 9d0baa01512..53d86ddf95c 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -49,10 +49,10 @@ private:
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
private:
static const BorkPoint BORK_TABLE[];
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 83ff67fbc11..49a60c8744b 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -263,12 +263,12 @@ const seriesPlayBreak Room503::PLAY24[] = {
PLAY_BREAK_END
};
-long Room503::_state1;
-long Room503::_state2;
-long Room503::_state3;
-long Room503::_state4;
-long Room503::_state5;
-long Room503::_state6;
+int32 Room503::_state1;
+int32 Room503::_state2;
+int32 Room503::_state3;
+int32 Room503::_state4;
+int32 Room503::_state5;
+int32 Room503::_state6;
Room503::Room503() : Section5Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section5/room503.h b/engines/m4/burger/rooms/section5/room503.h
index ce061abf463..eea0204295a 100644
--- a/engines/m4/burger/rooms/section5/room503.h
+++ b/engines/m4/burger/rooms/section5/room503.h
@@ -55,12 +55,12 @@ private:
static const seriesPlayBreak PLAY22[];
static const seriesPlayBreak PLAY23[];
static const seriesPlayBreak PLAY24[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
- static long _state5;
- static long _state6;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
+ static int32 _state5;
+ static int32 _state6;
int16 _array1[5];
int16 _array2[5];
int _val2 = 0;
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index a3c56becdf0..a7736464686 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -178,11 +178,11 @@ const seriesPlayBreak Room504::PLAY16[] = {
PLAY_BREAK_END
};
-long Room504::_state1;
-long Room504::_state2;
-long Room504::_state3;
-long Room504::_state4;
-long Room504::_state5;
+int32 Room504::_state1;
+int32 Room504::_state2;
+int32 Room504::_state3;
+int32 Room504::_state4;
+int32 Room504::_state5;
Room504::Room504() : Section5Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
index 76741c0f674..3af1c60a991 100644
--- a/engines/m4/burger/rooms/section5/room504.h
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -47,11 +47,11 @@ private:
static const seriesPlayBreak PLAY14[];
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
- static long _state5;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
+ static int32 _state5;
bool _flag1 = false;
int _val1 = 0;
int _val2 = 0;
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index b22bf8a83a0..b13134f00cd 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -112,8 +112,8 @@ const seriesPlayBreak Room506::PLAY6[] = {
};
-long Room506::_state1;
-long Room506::_state2;
+int32 Room506::_state1;
+int32 Room506::_state2;
Room506::Room506() : Section5Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
index 76a93b0d9ef..33695e88aec 100644
--- a/engines/m4/burger/rooms/section5/room506.h
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -38,8 +38,8 @@ private:
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
- static long _state1;
- static long _state2;
+ static int32 _state1;
+ static int32 _state2;
noWalkRect *_walk1 = nullptr;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index 7d2fb6025d2..17824d18176 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -212,11 +212,11 @@ const seriesPlayBreak Room507::PLAY18[] = {
PLAY_BREAK_END
};
-long Room507::_state1;
-long Room507::_state2;
-long Room507::_state3;
-long Room507::_state4;
-long Room507::_state5;
+int32 Room507::_state1;
+int32 Room507::_state2;
+int32 Room507::_state3;
+int32 Room507::_state4;
+int32 Room507::_state5;
Room507::Room507() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
index 35cd5cc8ddc..7962d09ff07 100644
--- a/engines/m4/burger/rooms/section5/room507.h
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -49,11 +49,11 @@ private:
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
static const seriesPlayBreak PLAY18[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
- static long _state5;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
+ static int32 _state5;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
index 9e666c026f2..6f5cfe0949e 100644
--- a/engines/m4/burger/rooms/section5/room508.cpp
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -140,10 +140,10 @@ const seriesPlayBreak Room508::PLAY12[] = {
PLAY_BREAK_END
};
-long Room508::_state1;
-long Room508::_state2;
-long Room508::_state3;
-long Room508::_state4;
+int32 Room508::_state1;
+int32 Room508::_state2;
+int32 Room508::_state3;
+int32 Room508::_state4;
Room508::Room508() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room508.h b/engines/m4/burger/rooms/section5/room508.h
index ea498cc8143..3e86acbc368 100644
--- a/engines/m4/burger/rooms/section5/room508.h
+++ b/engines/m4/burger/rooms/section5/room508.h
@@ -43,10 +43,10 @@ private:
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
- static long _state1;
- static long _state2;
- static long _state3;
- static long _state4;
+ static int32 _state1;
+ static int32 _state2;
+ static int32 _state3;
+ static int32 _state4;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index cf73fa5135f..f60e08c7703 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -101,8 +101,8 @@ const seriesPlayBreak Room509::PLAY8[] = {
static const RGB8 PALETTE[1] = { { 0x6E, 0x46, 0x1E } };
-long Room509::_state1;
-long Room509::_state2;
+int32 Room509::_state1;
+int32 Room509::_state2;
Room509::Room509() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
index 4b1b70f829b..dbf6a7a85ff 100644
--- a/engines/m4/burger/rooms/section5/room509.h
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -39,8 +39,8 @@ private:
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
- static long _state1;
- static long _state2;
+ static int32 _state1;
+ static int32 _state2;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
int _val1 = 0;
diff --git a/engines/m4/burger/rooms/section5/room511.cpp b/engines/m4/burger/rooms/section5/room511.cpp
index a78ca66fa84..5e4e0352d3b 100644
--- a/engines/m4/burger/rooms/section5/room511.cpp
+++ b/engines/m4/burger/rooms/section5/room511.cpp
@@ -41,7 +41,7 @@ const seriesStreamBreak Room511::SERIES1[] = {
STREAM_BREAK_END
};
-long Room511::_state1;
+int32 Room511::_state1;
Room511::Room511() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room511.h b/engines/m4/burger/rooms/section5/room511.h
index 4d0bc6f91f8..4bc345660bc 100644
--- a/engines/m4/burger/rooms/section5/room511.h
+++ b/engines/m4/burger/rooms/section5/room511.h
@@ -31,7 +31,7 @@ namespace Rooms {
class Room511 : public Section5Room {
private:
static const seriesStreamBreak SERIES1[];
- static long _state1;
+ static int32 _state1;
int _val1 = 0;
public:
diff --git a/engines/m4/burger/rooms/section5/room512.cpp b/engines/m4/burger/rooms/section5/room512.cpp
index 502878fcefb..698c4c06804 100644
--- a/engines/m4/burger/rooms/section5/room512.cpp
+++ b/engines/m4/burger/rooms/section5/room512.cpp
@@ -40,7 +40,7 @@ const seriesStreamBreak Room512::SERIES1[] = {
STREAM_BREAK_END
};
-long Room512::_state1;
+int32 Room512::_state1;
Room512::Room512() : Section5Room() {
diff --git a/engines/m4/burger/rooms/section5/room512.h b/engines/m4/burger/rooms/section5/room512.h
index 528f93c4194..5e0171d5acf 100644
--- a/engines/m4/burger/rooms/section5/room512.h
+++ b/engines/m4/burger/rooms/section5/room512.h
@@ -31,7 +31,7 @@ namespace Rooms {
class Room512 : public Section5Room {
private:
static const seriesStreamBreak SERIES1[];
- static long _state1;
+ static int32 _state1;
public:
Room512();
diff --git a/engines/m4/burger/rooms/section6/room602.cpp b/engines/m4/burger/rooms/section6/room602.cpp
index 5c64e09c5b2..fc755bc5611 100644
--- a/engines/m4/burger/rooms/section6/room602.cpp
+++ b/engines/m4/burger/rooms/section6/room602.cpp
@@ -247,8 +247,8 @@ const seriesPlayBreak Room602::PLAY22[] = {
PLAY_BREAK_END
};
-long Room602::_test1;
-long Room602::_test2;
+int32 Room602::_test1;
+int32 Room602::_test2;
Room602::Room602() : Section6Room() {
_gerbilTable = GERBIL;
diff --git a/engines/m4/burger/rooms/section6/room602.h b/engines/m4/burger/rooms/section6/room602.h
index f253e26179f..b6262a26801 100644
--- a/engines/m4/burger/rooms/section6/room602.h
+++ b/engines/m4/burger/rooms/section6/room602.h
@@ -54,6 +54,8 @@ class Room602 : public Section6Room {
static const seriesPlayBreak PLAY22[];
private:
+ static int32 _test1;
+ static int32 _test2;
noWalkRect *_walk1 = nullptr;
int _series1 = 0;
machine *_series2 = nullptr;
@@ -69,8 +71,6 @@ private:
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
- static long _test1;
- static long _test2;
public:
Room602();
diff --git a/engines/m4/burger/rooms/section6/room603.cpp b/engines/m4/burger/rooms/section6/room603.cpp
index 7d510dd3e2e..4f88aec89e7 100644
--- a/engines/m4/burger/rooms/section6/room603.cpp
+++ b/engines/m4/burger/rooms/section6/room603.cpp
@@ -168,7 +168,7 @@ const seriesPlayBreak Room603::PLAY15[] = {
PLAY_BREAK_END
};
-long Room603::_state1;
+int32 Room603::_state1;
Room603::Room603() : Section6Room() {
_gerbilTable = GERBIL;
diff --git a/engines/m4/burger/rooms/section6/room603.h b/engines/m4/burger/rooms/section6/room603.h
index 8e686c45ef6..329a850d0ad 100644
--- a/engines/m4/burger/rooms/section6/room603.h
+++ b/engines/m4/burger/rooms/section6/room603.h
@@ -47,7 +47,7 @@ private:
static const seriesPlayBreak PLAY14[];
static const seriesPlayBreak PLAY15[];
- static long _state1;
+ static int32 _state1;
private:
machine *_series1 = nullptr;
int _series2 = 0;
diff --git a/engines/m4/burger/rooms/section6/room604.cpp b/engines/m4/burger/rooms/section6/room604.cpp
index f9237224d00..60542e62655 100644
--- a/engines/m4/burger/rooms/section6/room604.cpp
+++ b/engines/m4/burger/rooms/section6/room604.cpp
@@ -146,7 +146,7 @@ const seriesPlayBreak Room604::PLAY12[] = {
PLAY_BREAK_END
};
-long Room604::_state1;
+int32 Room604::_state1;
Room604::Room604() : Section6Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room604.h b/engines/m4/burger/rooms/section6/room604.h
index c0d939ec795..8f8aec69942 100644
--- a/engines/m4/burger/rooms/section6/room604.h
+++ b/engines/m4/burger/rooms/section6/room604.h
@@ -42,7 +42,7 @@ private:
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
- static long _state1;
+ static int32 _state1;
private:
machine *_series1 = nullptr;
diff --git a/engines/m4/burger/rooms/section6/room606.cpp b/engines/m4/burger/rooms/section6/room606.cpp
index 9ad595cca3d..081356f45f1 100644
--- a/engines/m4/burger/rooms/section6/room606.cpp
+++ b/engines/m4/burger/rooms/section6/room606.cpp
@@ -36,7 +36,7 @@ const seriesStreamBreak Room606::SERIES1[] = {
STREAM_BREAK_END
};
-long Room606::_state1;
+int32 Room606::_state1;
Room606::Room606() : Section6Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room606.h b/engines/m4/burger/rooms/section6/room606.h
index 822beeaf588..ea2d8740585 100644
--- a/engines/m4/burger/rooms/section6/room606.h
+++ b/engines/m4/burger/rooms/section6/room606.h
@@ -31,7 +31,7 @@ namespace Rooms {
class Room606 : public Section6Room {
private:
static const seriesStreamBreak SERIES1[];
- static long _state1;
+ static int32 _state1;
public:
Room606();
~Room606() override {}
diff --git a/engines/m4/burger/rooms/section6/room608.cpp b/engines/m4/burger/rooms/section6/room608.cpp
index 9f2765fc168..93cf64af1dd 100644
--- a/engines/m4/burger/rooms/section6/room608.cpp
+++ b/engines/m4/burger/rooms/section6/room608.cpp
@@ -45,7 +45,7 @@ const seriesStreamBreak Room608::SERIES2[] = {
STREAM_BREAK_END
};
-long Room608::_state1;
+int32 Room608::_state1;
Room608::Room608() : Section6Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room608.h b/engines/m4/burger/rooms/section6/room608.h
index 2471285287c..c82e6aedae9 100644
--- a/engines/m4/burger/rooms/section6/room608.h
+++ b/engines/m4/burger/rooms/section6/room608.h
@@ -32,7 +32,7 @@ class Room608 : public Section6Room {
private:
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
- static long _state1;
+ static int32 _state1;
public:
Room608();
~Room608() override {}
diff --git a/engines/m4/burger/rooms/section6/room609.cpp b/engines/m4/burger/rooms/section6/room609.cpp
index 0767ea280c4..583de7b20a9 100644
--- a/engines/m4/burger/rooms/section6/room609.cpp
+++ b/engines/m4/burger/rooms/section6/room609.cpp
@@ -36,7 +36,7 @@ const seriesStreamBreak Room609::SERIES1[] = {
STREAM_BREAK_END
};
-long Room609::_state1;
+int32 Room609::_state1;
Room609::Room609() : Section6Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room609.h b/engines/m4/burger/rooms/section6/room609.h
index 6d82f59def0..29ad6eccfc7 100644
--- a/engines/m4/burger/rooms/section6/room609.h
+++ b/engines/m4/burger/rooms/section6/room609.h
@@ -31,7 +31,7 @@ namespace Rooms {
class Room609 : public Section6Room {
private:
static const seriesStreamBreak SERIES1[];
- static long _state1;
+ static int32 _state1;
public:
Room609();
~Room609() override {}
diff --git a/engines/m4/burger/rooms/section6/room610.cpp b/engines/m4/burger/rooms/section6/room610.cpp
index 92cf3795b88..ae12ac07a64 100644
--- a/engines/m4/burger/rooms/section6/room610.cpp
+++ b/engines/m4/burger/rooms/section6/room610.cpp
@@ -59,7 +59,7 @@ const seriesStreamBreak Room610::SERIES1[] = {
STREAM_BREAK_END
};
-long Room610::_state1;
+int32 Room610::_state1;
Room610::Room610() : Section6Room() {
_state1 = 0;
diff --git a/engines/m4/burger/rooms/section6/room610.h b/engines/m4/burger/rooms/section6/room610.h
index 307602c9f70..672caf3afa7 100644
--- a/engines/m4/burger/rooms/section6/room610.h
+++ b/engines/m4/burger/rooms/section6/room610.h
@@ -31,7 +31,7 @@ namespace Rooms {
class Room610 : public Section6Room {
private:
static const seriesStreamBreak SERIES1[];
- static long _state1;
+ static int32 _state1;
public:
Room610();
~Room610() override {}
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 1bcc31bff40..c90de203d22 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -38,7 +38,7 @@ namespace Burger {
Vars *g_vars;
const char *GAME_MODES[4] = { "WHOLE_GAME", "INTERACTIVE_DEMO", "MAGAZINE_DEMO", "WHOLE_GAME" };
-long Vars::_wilbur_should = 0;
+int32 Vars::_wilbur_should = 0;
/**
* Structure for accented character replacement
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 150b391f9ee..c53018da419 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -85,7 +85,7 @@ protected:
public:
// These are defined as statics because they're referenced in data arrays
- static long _wilbur_should;
+ static int32 _wilbur_should;
public:
Burger::Flags _flags;
GameMode _executing = WHOLE_GAME;
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index efa174c30e7..99b29893783 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -35,9 +35,9 @@ struct WilburMatch {
const char *_word0;
const char *_word1;
int _trigger;
- const long *_testVariable;
+ const int32 *_testVariable;
int _testValue;
- long *_newVariable;
+ int32 *_newVariable;
int _newValue;
};
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 7342b450bc5..b0d37d9d8f4 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -56,7 +56,7 @@ bool Console::Cmd_flag(int argc, const char **argv) {
debugPrintf("Not Orion Burger\n");
} else if (argc == 2) {
int flagNum = atol(argv[1]);
- debugPrintf("Flag %d = %ld\n", flagNum, Burger::g_vars->_flags[flagNum]);
+ debugPrintf("Flag %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
} else if (argc == 3) {
int flagNum = atol(argv[1]);
int flagVal = atol(argv[2]);
diff --git a/engines/m4/mem/res.h b/engines/m4/mem/res.h
index c38f54cec48..7f99e58db44 100644
--- a/engines/m4/mem/res.h
+++ b/engines/m4/mem/res.h
@@ -34,8 +34,8 @@ class Resources {
struct Entry {
Common::String name;
MemHandle RHandle = nullptr;
- size_t BufferSize = 0;
- uint32 Size = 0;
+ int32 BufferSize = 0;
+ int32 Size = 0;
byte Flags = 0;
};
private:
diff --git a/engines/m4/riddle/flags.cpp b/engines/m4/riddle/flags.cpp
index 73e779b6406..f79ee507634 100644
--- a/engines/m4/riddle/flags.cpp
+++ b/engines/m4/riddle/flags.cpp
@@ -28,7 +28,7 @@
namespace M4 {
namespace Riddle {
-long Flags::_flags[FLAGS_COUNT];
+int32 Flags::_flags[FLAGS_COUNT];
Flags::Flags() {
reset();
diff --git a/engines/m4/riddle/flags.h b/engines/m4/riddle/flags.h
index 110c81dddfd..c5827542a9e 100644
--- a/engines/m4/riddle/flags.h
+++ b/engines/m4/riddle/flags.h
@@ -553,7 +553,7 @@ enum {
class Flags {
public:
- static long _flags[FLAGS_COUNT];
+ static int32 _flags[FLAGS_COUNT];
public:
Flags();
@@ -566,7 +566,7 @@ public:
size_t size() const {
return FLAGS_COUNT;
}
- long &operator[](uint idx) {
+ int32 &operator[](uint idx) {
assert(idx < FLAGS_COUNT);
return _flags[idx];
}
Commit: ab7dcb8eae488a42f28d2bb97b2ba22cbb26c736
https://github.com/scummvm/scummvm/commit/ab7dcb8eae488a42f28d2bb97b2ba22cbb26c736
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect failed to fseek messages
Changed paths:
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index 3deb2a67b79..aefa77e5bc5 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -551,7 +551,7 @@ bool SysFile::seek(uint32 pos) {
Common::SeekableReadStream *rs = dynamic_cast<Common::SeekableReadStream *>(curr_hag_record->hag_fp);
assert(rs);
- if (rs->seek(curr_hash_record.offset + pos - curr_hag_record->hag_pos, SEEK_CUR))
+ if (!rs->seek(curr_hash_record.offset + pos - curr_hag_record->hag_pos, SEEK_CUR))
term_message("fail to fseek");
last_head_pos = rs->pos();
Commit: 9e6aa1320cf6242f0901c78ee2f43a346b66cd95
https://github.com/scummvm/scummvm/commit/9e6aa1320cf6242f0901c78ee2f43a346b66cd95
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix incorrect starting frame index for animations
This fixes animations on Linux which uses 64-bit ints
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 87cb76e852c..01ce598d497 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1706,7 +1706,7 @@ bool ws_OpenSSstream(SysFile *sysFile, Anim8 *anim8) {
// Automatically set some of the sequence registers
celsPtr = myCCB->streamSSHeader;
numSprites = celsPtr[CELS_COUNT];
- myRegs[IDX_CELS_INDEX] = (uint)-0x10000;
+ myRegs[IDX_CELS_INDEX] = -(1 << 16); // First frame inc will make it 0
myRegs[IDX_CELS_COUNT] = numSprites << 16;
myRegs[IDX_CELS_FRAME_RATE] = celsPtr[CELS_FRAME_RATE] << 16;
Commit: f4cf30eea6ca3def801f1f49235cd6bec6aeaff0
https://github.com/scummvm/scummvm/commit/f4cf30eea6ca3def801f1f49235cd6bec6aeaff0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Valgrind mem fixes
Changed paths:
engines/m4/gui/gui_vmng_core.cpp
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 572d3346e05..572daf79dc9 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -266,7 +266,7 @@ ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer) {
const byte *srcP = srcBuffer->data + (y1 * srcBuffer->stride) + x1;
- g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY, x2 - x1 + 1, y2 - y1 + 1);
+ g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY, x2 - x1, y2 - y1);
g_system->updateScreen();
}
Commit: 7627334188f54c5e5cbe09d2f0ec7ba72f51e5c6
https://github.com/scummvm/scummvm/commit/7627334188f54c5e5cbe09d2f0ec7ba72f51e5c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Change tt reading parameters from long to int32
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/graphics/gr_buff.cpp
engines/m4/platform/tile/tile_read.cpp
engines/m4/platform/tile/tile_read.h
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index b2af2227982..5df0c7bc44f 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -230,10 +230,10 @@ GrBuff *load_codes(SysFile *code_file) {
}
bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette) {
- Buffer *out;
+ int32 num_x_tiles, num_y_tiles, tile_x, tile_y, file_x, file_y, x_end, y_end;
int i, j;
- int count = 0;
- long num_x_tiles, num_y_tiles, tile_x, tile_y, file_x, file_y, x_end, y_end;
+ int32 count = 0;
+ Buffer *out;
tt_read_header(pic_file, &file_x, &file_y,
&num_x_tiles, &num_y_tiles, &tile_x, &tile_y, palette);
@@ -245,21 +245,22 @@ bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette) {
Buffer *theBuff = (**loadBuffer).get_buffer();
- for (i = 0; i < num_y_tiles; i++)
- for (j = 0; j < num_x_tiles; j++)
- {
+ for (i = 0; i < num_y_tiles; i++) {
+ for (j = 0; j < num_x_tiles; j++) {
out = tt_read(pic_file, count, tile_x, tile_y);
count++;
- if (out && (out->data))
- {
+
+ if (out && (out->data)) {
x_end = imath_min(file_x, (1 + j) * tile_x);
y_end = imath_min(file_y, (1 + i) * tile_y);
gr_buffer_rect_copy_2(out, theBuff, 0, 0, j * tile_x, i * tile_y, x_end, y_end);
mem_free(out->data);
}
+
if (out)
mem_free(out);
}
+ }
(**loadBuffer).release();
return true;
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 71b961b3b94..5a471f30e54 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -182,6 +182,11 @@ bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
if ((w < 1) || (h < 1))
return true;
+ const byte *s1 = from->data;
+ const byte *s2 = from->data + from->stride * from->h;
+ const byte *d1 = to->data;
+ const byte *d2 = to->data + to->stride * to->h;
+
// initialize pointers
const byte *src = gr_buffer_pointer(from, sx, sy);
byte *dest = gr_buffer_pointer(to, dx, dy);
@@ -192,8 +197,12 @@ bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
// copy one to d'other
int i;
- for (i = 0; i < h; i++, dest += dIncr, src += sIncr)
+ for (i = 0; i < h; i++, dest += dIncr, src += sIncr) {
+ assert(src >= s1 && (src + w) <= s2);
+ assert(dest >= d1 && (dest + w) <= d2);
+
memmove(dest, src, w);
+ }
return true;
}
diff --git a/engines/m4/platform/tile/tile_read.cpp b/engines/m4/platform/tile/tile_read.cpp
index a6e27399a35..2bf8f6a6cfe 100644
--- a/engines/m4/platform/tile/tile_read.cpp
+++ b/engines/m4/platform/tile/tile_read.cpp
@@ -23,13 +23,12 @@
#include "m4/core/errors.h"
#include "m4/graphics/gr_buff.h"
#include "m4/mem/memman.h"
-//include "m4/vars.h"
namespace M4 {
-void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
- long *num_x_tiles, long *num_y_tiles, long *tile_x, long *tile_y, RGB8 *pal) {
- long value;
+void tt_read_header(SysFile *ifp, int32 *file_x, int32 *file_y,
+ int32 *num_x_tiles, int32 *num_y_tiles, int32 *tile_x, int32 *tile_y, RGB8 *pal) {
+ int32 value;
uint8 buf[4];
int i;
byte *byte_ptr;
@@ -103,8 +102,8 @@ void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
}
}
-Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y) {
- long tile_size;
+Buffer *tt_read(SysFile *ifp, int index, int32 tile_x, int32 tile_y) {
+ int32 tile_size;
int offset;
Buffer *out;
void *bufferHandle;
diff --git a/engines/m4/platform/tile/tile_read.h b/engines/m4/platform/tile/tile_read.h
index 1906501a4bc..1549fff4d48 100644
--- a/engines/m4/platform/tile/tile_read.h
+++ b/engines/m4/platform/tile/tile_read.h
@@ -31,15 +31,15 @@ namespace M4 {
/**
* Gets some information about a tt file
*/
-extern void tt_read_header(SysFile *ifp, long *file_x, long *file_y,
- long *num_x_tiles, long *num_y_tiles, long *tile_x, long *tile_y, RGB8 *pal);
+extern void tt_read_header(SysFile *ifp, int32 *file_x, int32 *file_y,
+ int32 *num_x_tiles, int32 *num_y_tiles, int32 *tile_x, int32 *tile_y, RGB8 *pal);
/**
* Returns a pointer to an initialized buffer containing the image data.
* If an error occurs, out.x contains the error number while out.y is zero,
* and out.data is nullptr.
*/
-extern Buffer *tt_read(SysFile *ifp, int index, long tile_x, long tile_y);
+extern Buffer *tt_read(SysFile *ifp, int index, int32 tile_x, int32 tile_y);
} // End of namespace M4
Commit: a9699c4320173ce8fe6aeb5c348dc7a1f523f5a6
https://github.com/scummvm/scummvm/commit/a9699c4320173ce8fe6aeb5c348dc7a1f523f5a6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix memory overrun in buffer rect copy
Changed paths:
engines/m4/adv_r/adv_file.cpp
engines/m4/graphics/gr_buff.cpp
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index 5df0c7bc44f..a8e4fd8268d 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -253,7 +253,8 @@ bool load_background(SysFile *pic_file, GrBuff **loadBuffer, RGB8 *palette) {
if (out && (out->data)) {
x_end = imath_min(file_x, (1 + j) * tile_x);
y_end = imath_min(file_y, (1 + i) * tile_y);
- gr_buffer_rect_copy_2(out, theBuff, 0, 0, j * tile_x, i * tile_y, x_end, y_end);
+ gr_buffer_rect_copy_2(out, theBuff, 0, 0, j * tile_x, i * tile_y,
+ x_end - (j * tile_x), y_end - (i * tile_y));
mem_free(out->data);
}
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 5a471f30e54..52e1a739c61 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -182,11 +182,6 @@ bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
if ((w < 1) || (h < 1))
return true;
- const byte *s1 = from->data;
- const byte *s2 = from->data + from->stride * from->h;
- const byte *d1 = to->data;
- const byte *d2 = to->data + to->stride * to->h;
-
// initialize pointers
const byte *src = gr_buffer_pointer(from, sx, sy);
byte *dest = gr_buffer_pointer(to, dx, dy);
@@ -196,13 +191,8 @@ bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
int32 dIncr = to->stride;
// copy one to d'other
- int i;
- for (i = 0; i < h; i++, dest += dIncr, src += sIncr) {
- assert(src >= s1 && (src + w) <= s2);
- assert(dest >= d1 && (dest + w) <= d2);
-
+ for (int i = 0; i < h; i++, dest += dIncr, src += sIncr)
memmove(dest, src, w);
- }
return true;
}
Commit: 252eed30a2ce0684ab4367e30c84a117b530c52b
https://github.com/scummvm/scummvm/commit/252eed30a2ce0684ab4367e30c84a117b530c52b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Properly free inventory on shutdown
Changed paths:
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/burger/inventory.h
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 802f2324720..f6472e749ff 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -33,6 +33,15 @@ namespace M4 {
// TODO: Move more stuff into InventoryBase class
static char *inv_get_name(const Common::String &itemName);
+InventoryBase::~InventoryBase() {
+ for (int i = 0; i < _tail; i++) {
+ mem_free(_objects[i]->name);
+ mem_free(_objects[i]->verbs);
+
+ mem_free_to_stash((void *)_objects[i], _G(inv_obj_mem_type));
+ }
+}
+
void InventoryBase::syncGame(Common::Serializer &s) {
char invName[MAX_NAME_LENGTH];
uint32 inv_size, scene;
@@ -66,7 +75,6 @@ void InventoryBase::syncGame(Common::Serializer &s) {
}
}
-
bool inv_init(int32 num_objects) {
term_message("Fluffing up the backpack", nullptr);
int i;
@@ -86,14 +94,6 @@ bool inv_init(int32 num_objects) {
return true;
}
-void inv_shutdown() {
- int i;
-
- for (i = 0; i < _G(inventory)->_tail; i++) {
- mem_free_to_stash((void *)_G(inventory)->_objects[i], _G(inv_obj_mem_type));
- }
-}
-
bool inv_register_thing(const Common::String &itemName, const Common::String &itemVerbs,
int32 scene, int32 cel, int32 cursor) {
char *s_name = mem_strdup(itemName.c_str());
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index be073b10949..820c168bf0b 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -40,7 +40,7 @@ struct InventoryBase {
int32 _tail = 0;
InventoryBase() {}
- virtual ~InventoryBase() {}
+ virtual ~InventoryBase();
void syncGame(Common::Serializer &s);
@@ -54,11 +54,6 @@ struct InventoryBase {
*/
extern bool inv_init(int32 num_objects);
-/**
- * Shutdown the system
- */
-extern void inv_shutdown();
-
/**
* Register things during init of the game
* @param itemName Name of the object as it should appear as a sentence is built
diff --git a/engines/m4/burger/inventory.h b/engines/m4/burger/inventory.h
index d566220d5da..85b7a185455 100644
--- a/engines/m4/burger/inventory.h
+++ b/engines/m4/burger/inventory.h
@@ -44,6 +44,7 @@ public:
Common::Array<InventoryItem> _items;
public:
void init();
+ virtual ~Inventory() {}
void add(const Common::String &name, const Common::String &verbs, int32 sprite, int32 cursor) override;
void set_scroll(int32 scroll) override;
Commit: f0a608b5f4fdf7e3075ca90df3728920073c04b2
https://github.com/scummvm/scummvm/commit/f0a608b5f4fdf7e3075ca90df3728920073c04b2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Ignore copying empty rects to screen
Changed paths:
engines/m4/gui/gui_vmng_core.cpp
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 572daf79dc9..26a622c9d31 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -265,6 +265,9 @@ ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
}
void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer) {
+ if (x1 == x2 || y1 == y2)
+ return;
+
const byte *srcP = srcBuffer->data + (y1 * srcBuffer->stride) + x1;
g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY, x2 - x1, y2 - y1);
g_system->updateScreen();
Commit: 68bc80d576929e291c141284dd6250bd444a9304
https://github.com/scummvm/scummvm/commit/68bc80d576929e291c141284dd6250bd444a9304
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix mismatched malloc/free
Changed paths:
engines/m4/platform/sound/digi.cpp
diff --git a/engines/m4/platform/sound/digi.cpp b/engines/m4/platform/sound/digi.cpp
index 93223ec1a32..7142d6b5d7a 100644
--- a/engines/m4/platform/sound/digi.cpp
+++ b/engines/m4/platform/sound/digi.cpp
@@ -51,7 +51,7 @@ void Digi::unload_sounds() {
_mixer->stopAll();
for (auto it = _sounds.begin(); it != _sounds.end(); ++it)
- delete it->_value._data;
+ free(it->_value._data);
_sounds.clear();
}
@@ -94,7 +94,7 @@ void Digi::unload(const Common::String &name) {
}
// Delete the sound entry
- delete _sounds[name]._data;
+ free(_sounds[name]._data);
_sounds.erase(name);
}
}
Commit: 67210b01a12b947cc8a59191923ecb720902beec
https://github.com/scummvm/scummvm/commit/67210b01a12b947cc8a59191923ecb720902beec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixed memory overrun on palette backups
Changed paths:
engines/m4/burger/vars.cpp
engines/m4/graphics/gr_pal.cpp
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index c90de203d22..91d11fdb860 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -110,8 +110,6 @@ void Vars::main_cold_data_init() {
break;
}
- _game.setRoom(610); //***DEBUG****
-
font_set_colors(2, 1, 3);
}
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 36933bd48df..71d3c048ab0 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -172,11 +172,11 @@ void gr_pal_reset_ega_colors(RGB8 *pal) {
}
void gr_backup_palette() {
- Common::copy(_G(master_palette), _G(master_palette) + 768, _G(backup_palette));
+ Common::copy(_G(master_palette), _G(master_palette) + 256, _G(backup_palette));
}
void gr_restore_palette() {
- Common::copy(_G(backup_palette), _G(backup_palette) + 768, _G(master_palette));
+ Common::copy(_G(backup_palette), _G(backup_palette) + 256, _G(master_palette));
}
void pal_mirror_colours(int first_color, int last_color, RGB8 *pal) {
Commit: ced447378cd0d6f32940f623428a9958201036e3
https://github.com/scummvm/scummvm/commit/ced447378cd0d6f32940f623428a9958201036e3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for failing test 3 and loop reset
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section3/room301.cpp
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index e0ed9fb67b5..f1a5adf13f6 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -30,34 +30,34 @@ namespace Burger {
namespace Rooms {
static const seriesStreamBreak STREAM_BREAKS1[] = {
- { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 16, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ { 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 5, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 14, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 16, nullptr, 1, 255, 11, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS2[] = {
- { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 6, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 17, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 24, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 26, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ { 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 6, nullptr, 2, 255, 5, 0, nullptr, 0 },
+ { 17, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 24, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 26, nullptr, 1, 255, 14, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS3[] = {
- { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 5, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 14, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 16, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ { 0, 0, 2, 255, 4, 0, nullptr, 0 },
+ { 5, 0, 2, 255, 4, 0, nullptr, 0 },
+ { 14, 0, 2, 255, 4, 0, nullptr, 0 },
+ { 16, 0, 1, 255, 17, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS4[] = {
- { 0, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 7, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 13, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ { 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 7, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 13, nullptr, 1, 255, 20, 0, nullptr, 0 },
STREAM_BREAK_END
};
@@ -68,10 +68,10 @@ static const seriesStreamBreak STREAM_BREAKS5[] = {
};
static const seriesStreamBreak STREAM_BREAKS6[] = {
- { 9, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 19, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 28, nullptr, 2, 255, -1, 0, nullptr, 0 },
- { 32, nullptr, 1, 255, -1, 0, nullptr, 0 },
+ { 9, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 19, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 28, nullptr, 2, 255, 4, 0, nullptr, 0 },
+ { 32, nullptr, 1, 255, 8, 0, nullptr, 0 },
STREAM_BREAK_END
};
@@ -238,6 +238,7 @@ void Room101::daemon() {
break;
case 2:
+ // Finished gathering items from past tests
digi_stop(2);
unloadSounds();
player_set_commands_allowed(true);
@@ -354,8 +355,8 @@ void Room101::daemon() {
if (_G(flags)[kFifthTestPassed])
series_load("101wi11s", -1, nullptr);
- _machine1 = series_play("101wi14s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAM_BREAKS6, "101wi14", 6, 256, 2);
+ _machine1 = series_play("101wi14s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS6, "101wi14", 6, 0x100, 2);
break;
case 8:
@@ -374,8 +375,8 @@ void Room101::daemon() {
break;
case 10:
- _machine1 = series_play("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAM_BREAKS1, "101wi13", 6, 256, 2);
+ _machine1 = series_play("101wi13s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS1, "101wi13", 6, 0x100, 2);
break;
case 11:
@@ -396,8 +397,8 @@ void Room101::daemon() {
break;
case 13:
- _machine1 = series_play("101wi12s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAM_BREAKS2, "101wi12", 6, 256, 2);
+ _machine1 = series_play("101wi12s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS2, "101wi12", 6, 0x100, 2);
break;
case 14:
@@ -415,8 +416,8 @@ void Room101::daemon() {
break;
case 16:
- _machine1 = series_play("101wi13s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAM_BREAKS3, "101wi13", 6, 256, 2);
+ _machine1 = series_play("101wi13s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS3, "101wi13", 6, 0x100, 2);
break;
case 17:
@@ -436,8 +437,8 @@ void Room101::daemon() {
break;
case 19:
- _machine1 = series_play("101wi11s", 257, 0, -1, 6, 0, 100, 0, 0, 0, -1);
- _machine2 = series_stream_with_breaks(STREAM_BREAKS4, "101wi11", 6, 256, 2);
+ _machine1 = series_play("101wi11s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
+ _machine2 = series_stream_with_breaks(STREAM_BREAKS4, "101wi11", 6, 0x100, 2);
break;
case 20:
@@ -522,7 +523,7 @@ void Room101::daemon() {
case 6:
_G(wilbur_should) = 7;
- series_play_with_breaks(PLAY_BREAKS1, "101wi05", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS1, "101wi05", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 7:
@@ -544,7 +545,7 @@ void Room101::daemon() {
case 10:
_G(wilbur_should) = 11;
- series_play_with_breaks(PLAY_BREAKS3, "101wi02", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS3, "101wi02", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 11:
@@ -597,7 +598,7 @@ void Room101::daemon() {
case 20:
_G(wilbur_should) = 21;
- series_play_with_breaks(PLAY_BREAKS4, "101wi04", 256, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
+ series_play_with_breaks(PLAY_BREAKS4, "101wi04", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 21:
@@ -606,8 +607,8 @@ void Room101::daemon() {
break;
case 22:
- series_play("101wi04", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
- series_play("101wi04s", 256, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ series_play("101wi04", 0x100, 0, -1, 10, -1, 100, 0, -53, 16, 16);
+ series_play("101wi04s", 0x100, 0, -1, 10, -1, 100, 0, -53, 16, 16);
break;
default:
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index ef482725bf3..55ba1e4a69a 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -156,7 +156,7 @@ void Room301::daemon() {
case 5:
pal_fade_set_start(0);
pal_cycle_stop();
- kernel_timing_trigger(6, 8);
+ kernel_timing_trigger(6, 6);
break;
case 6:
Commit: f1829d16e2ab563268601476d784b28f4c7c0fa9
https://github.com/scummvm/scummvm/commit/f1829d16e2ab563268601476d784b28f4c7c0fa9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix width/height calc for copying rects to screen
Changed paths:
engines/m4/gui/gui_vmng_core.cpp
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 26a622c9d31..0e7c020a0d0 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -265,11 +265,9 @@ ScreenContext *vmng_screen_find(void *scrnContent, int32 *status) {
}
void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2, int32 y2, Buffer *srcBuffer) {
- if (x1 == x2 || y1 == y2)
- return;
-
const byte *srcP = srcBuffer->data + (y1 * srcBuffer->stride) + x1;
- g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY, x2 - x1, y2 - y1);
+ g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY,
+ x2 - x1 + 1, y2 - y1 + 1);
g_system->updateScreen();
}
Commit: 3a301add0a8221eabf8fa964350b61266a9eaae4
https://github.com/scummvm/scummvm/commit/3a301add0a8221eabf8fa964350b61266a9eaae4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix moving sign
Changed paths:
engines/m4/burger/rooms/section1/room133_136.cpp
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index c81840a428f..a43f1df7a97 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -244,7 +244,7 @@ void Room133_136::daemon() {
player_set_commands_allowed(true);
setupSign();
setupSignWalkAreas();
- wilbur_speech("136w0004");
+ wilbur_speech("136w004");
break;
case kCHANGE_WILBUR_ANIMATION:
Commit: 16f032b5e771bad587ae3a584586d35dff420610
https://github.com/scummvm/scummvm/commit/16f032b5e771bad587ae3a584586d35dff420610
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for buying island deed
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 8be13e8ebba..5a29b6fe588 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -795,7 +795,7 @@ void Room105::daemon() {
break;
case 49:
- _val4 = 50;
+ _val3 = 50;
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 9);
break;
@@ -1213,13 +1213,18 @@ void Room105::daemon() {
case 34:
_series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 23, 23);
+ ws_hide_walker();
series_play_with_breaks(PLAY28, "105wi03", 0x200, 46, 3, 6, 100, 40, 0);
break;
+ case 35:
+ terminateMachineAndNull(_series8);
+ _series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 24, 24);
+ break;
case 36:
terminateMachineAndNull(_series8);
- _series8 = series_play("105ag07", 0xe00, 0, -1, 600, -1, 100, 0, 0, 24, 24);
+ _series8 = series_play("105ag07", 0xe00, 0, 37, 6, 0, 100, 0, 0, 25, 29);
break;
case 37:
@@ -1233,6 +1238,7 @@ void Room105::daemon() {
case 39:
_series8 = series_play("105ag08", 0xe00, 0, -1, 600, -1, 100, 0, 0, 6, 6);
+ ws_hide_walker();
series_play_with_breaks(PLAY24, "105wi02", 0x200, 40, 3, 6, 100, 40, 0);
break;
@@ -1358,6 +1364,10 @@ void Room105::parser() {
if (_G(flags)[V112]) {
wilbur_speech("105w011");
} else {
+ player_set_commands_allowed(false);
+ _G(flags)[V298] = 1;
+ loadAssets4();
+ ws_hide_walker();
series_play_with_breaks(PLAY22, "105wi01", 0xa00, 18, 3);
}
} else if (player_said("GEAR", "mayor's office")) {
Commit: 21e2232fc77d1ec4342dd4ea7afed4eae566ac48
https://github.com/scummvm/scummvm/commit/21e2232fc77d1ec4342dd4ea7afed4eae566ac48
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Clarify Burl flags
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 847bb9c23bc..c7dd6dfec26 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -37,11 +37,11 @@ struct BoonsvilleRec {
static const BoonsvilleRec ARRAY[] = {
{ 600, -1, "After getting neuro stuff" },
{ 2400, -1, "After getting survival stuff" },
- { 6000, 10028, "Burl enters town" },
+ { 6000, kBurlEntersTown, "Burl enters town" },
{ 6600, -1, "After getting sensory stuff" },
- { 9600, 10029, "Burl gets fed" },
+ { 9600, kBurlGetsFed, "Burl gets fed" },
{ 19200, -1, "After getting language stuff" },
- { 13200, 10030, "Burl stops eating" },
+ { 13200, kBurlStopsEating, "Burl stops eating" },
{ 22800, -1, "After getting logic stuff" },
{ 15000, 10031, "Burl leaves town" },
{ 18600, 10031, "Band enters town" },
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index a43f1df7a97..0e19cd79d46 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -265,7 +265,7 @@ void Room133_136::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index 668217130de..bfbfdf695cb 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -373,14 +373,14 @@ void Room139_144::daemon() {
}
break;
- case k10028:
+ case kBurlEntersTown:
if (!_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
Section1::updateDisablePlayer();
kernel_timing_trigger(1, 3);
} else {
- kernel_timing_trigger(60, k10028);
+ kernel_timing_trigger(60, kBurlEntersTown);
}
break;
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 9b9d2d1a434..1984f5b71a7 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -1074,7 +1074,7 @@ void Room143::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
@@ -1096,7 +1096,7 @@ void Room143::daemon() {
}
break;
- case 10029:
+ case kBurlGetsFed:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
@@ -1105,11 +1105,11 @@ void Room143::daemon() {
intr_freshen_sentence();
Section1::walk();
} else {
- kernel_timing_trigger(60, 10029);
+ kernel_timing_trigger(60, kBurlGetsFed);
}
break;
- case 10030:
+ case kBurlStopsEating:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
@@ -1119,7 +1119,7 @@ void Room143::daemon() {
}
break;
- case 10031:
+ case kBurlLeavesTown:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index f95f9835376..4e126b11478 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -239,22 +239,22 @@ void Section1::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
- case 10028:
+ case kBurlEntersTown:
_G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1003;
break;
- case 10029:
+ case kBurlGetsFed:
if (!_G(flags)[kRoadOpened])
_G(flags)[V063] = 1;
break;
- case 10030:
+ case kBurlStopsEating:
if (_G(flags)[kRoadOpened])
_G(flags)[V063] = 0;
break;
- case 10031:
+ case kBurlLeavesTown:
if (_G(flags)[kRoadOpened])
_G(flags)[V000] = 1004;
break;
- case 10032:
+ case k10032:
_G(flags)[V058] = 1;
break;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index c53018da419..69bcadd3cda 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -66,7 +66,11 @@ enum global_triggers {
kTELEPROTED1 = 10024,
kTELEPROTED2 = 10025,
k10027 = 10027,
- k10028 = 10028,
+ kBurlEntersTown = 10028,
+ kBurlGetsFed = 10029,
+ kBurlStopsEating = 10030,
+ kBurlLeavesTown = 10031,
+ k10032 = 10032,
kCALLED_EACH_LOOP = 32764,
Commit: 62798f29470262fd4479d4fb719f57b13724f32e
https://github.com/scummvm/scummvm/commit/62798f29470262fd4479d4fb719f57b13724f32e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for Boonsville event tracking
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/vars.h
engines/m4/riddle/rooms/section.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 5e058423443..6fc4070ad1f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -199,9 +199,9 @@ void BurgerEngine::global_daemon() {
release_trigger_digi_check();
break;
- case 10007:
+ case kAdvanceTime:
_G(flags).advance_boonsville_time_and_check_schedule(300);
- kernel_timing_trigger(300, 10007);
+ kernel_timing_trigger(300, kAdvanceTime);
break;
case kNPC_SPEECH_FINISHED:
@@ -323,12 +323,12 @@ void BurgerEngine::global_daemon() {
}
break;
- case 10017:
+ case kAdvanceHour:
if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
_G(player).walker_in_this_scene && _G(player).walker_visible)
sendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
- kernel_timing_trigger(imath_ranged_rand(900, 1800), 10017);
+ kernel_timing_trigger(imath_ranged_rand(900, 1800), kAdvanceHour);
break;
case kSET_FACING:
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index c7dd6dfec26..f52c18af2ac 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -28,13 +28,13 @@
namespace M4 {
namespace Burger {
-struct BoonsvilleRec {
+struct BoonsvilleEvent {
int32 _time;
int32 _trigger;
const char *_text;
};
-static const BoonsvilleRec ARRAY[] = {
+static const BoonsvilleEvent EVENTS[] = {
{ 600, -1, "After getting neuro stuff" },
{ 2400, -1, "After getting survival stuff" },
{ 6000, kBurlEntersTown, "Burl enters town" },
@@ -73,7 +73,7 @@ void Flags::reset() {
int32 Flags::get_boonsville_time_and_display(bool showTime) {
if (showTime) {
- int time = (*this)[BOONSVILLE_TIME];
+ int time = (*this)[kBoonsvilleTime];
int seconds = time % 60;
time /= 60;
int minutes = time % 60;
@@ -82,18 +82,18 @@ int32 Flags::get_boonsville_time_and_display(bool showTime) {
term_message("Boonsville time: %d:%d:%d", time, minutes, seconds);
}
- return (*this)[BOONSVILLE_TIME];
+ return (*this)[kBoonsvilleTime];
}
void Flags::set_boonsville_time(int32 time) {
- (*this)[BOONSVILLE_TIME] = time;
- (*this)[BOONSVILLE_TIME2] = time - 1;
+ (*this)[kBoonsvilleTime] = time;
+ (*this)[kBoonsvillePriorTime] = time - 1;
}
bool Flags::advance_boonsville_time_and_check_schedule(int32 time) {
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
- (*this)[BOONSVILLE_TIME2] = (*this)[BOONSVILLE_TIME];
- (*this)[BOONSVILLE_TIME] = time;
+ (*this)[kBoonsvillePriorTime] = (*this)[kBoonsvilleTime];
+ (*this)[kBoonsvilleTime] += time;
return dispatch_scheduled_boonsville_time_trigger(
get_boonsville_time_and_display());
} else {
@@ -106,9 +106,9 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
_G(kernel).trigger_mode = KT_DAEMON;
bool result = false;
- for (const BoonsvilleRec *rec = ARRAY; rec->_time; ++rec) {
- if ((int32)(*this)[BOONSVILLE_TIME2] > rec->_time &&
- rec->_time <= (int32)(*this)[BOONSVILLE_TIME]) {
+ for (const BoonsvilleEvent *rec = EVENTS; rec->_time; ++rec) {
+ if ((int32)(*this)[kBoonsvillePriorTime] > rec->_time &&
+ rec->_time <= (int32)(*this)[kBoonsvilleTime]) {
result = true;
term_message("Time for: %s", rec->_text);
schedule_boonsville_time();
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 0a0d8249145..8c7bbd2368f 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -343,8 +343,8 @@ enum {
V305 = 305,
V306 = 306,
V307 = 307,
- BOONSVILLE_TIME = 308,
- BOONSVILLE_TIME2 = 309,
+ kBoonsvilleTime = 308,
+ kBoonsvillePriorTime = 309,
V310 = 310,
V311 = 311,
V312 = 312,
diff --git a/engines/m4/burger/rooms/section.cpp b/engines/m4/burger/rooms/section.cpp
index fa288fcea78..0c49f35f690 100644
--- a/engines/m4/burger/rooms/section.cpp
+++ b/engines/m4/burger/rooms/section.cpp
@@ -122,8 +122,8 @@ void Section::global_room_init() {
}
}
- kernel_timing_trigger(900, 10017, nullptr);
- kernel_timing_trigger(300, 10017, nullptr);
+ kernel_timing_trigger(900, kAdvanceHour, nullptr);
+ kernel_timing_trigger(300, kAdvanceTime, nullptr);
}
void Section::init_series_players() {
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 4e126b11478..3b5834aa94a 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -222,7 +222,8 @@ void Section1::daemon() {
series_unload(_series1);
kernel_trigger_dispatch_now(_trigger);
break;
- case 10007:
+
+ case kAdvanceTime:
if (_G(flags)[V012] == 2) {
term_message(" Harry watches tv at: %d", _G(flags)[GLB_TEMP_3]);
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 69bcadd3cda..470f205e97b 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -52,6 +52,7 @@ enum global_triggers {
kSERIES_PLAY_BREAK_1 = 10004,
kSERIES_PLAY_BREAK_2 = 10005,
kRELEASE_TRIGGER_DIGI_CHECK = 10006, // Used only by release_trigger_digi_check() in global.cpp
+ kAdvanceTime = 10007,
kNPC_SPEECH_STARTED = 10010, // NPC talk started
kNPC_SPEECH_FINISHED = 10011, // NPC talk finished
@@ -59,6 +60,7 @@ enum global_triggers {
kWILBURS_SPEECH_FINISHED = 10014,
kWILBURS_SPEECH_START = 10015,
kCHANGE_WILBUR_ANIMATION = 10016,
+ kAdvanceHour = 10017,
kSET_FACING = 10018,
kSET_DEST = 10019,
kSET_COMMANDS_ALLOWED = 10020,
diff --git a/engines/m4/riddle/rooms/section.cpp b/engines/m4/riddle/rooms/section.cpp
index 34b1cb8b984..efd80c4b18e 100644
--- a/engines/m4/riddle/rooms/section.cpp
+++ b/engines/m4/riddle/rooms/section.cpp
@@ -124,7 +124,7 @@ void Section::global_room_init() {
}
kernel_timing_trigger(900, 10017, nullptr);
- kernel_timing_trigger(300, 10017, nullptr);
+ kernel_timing_trigger(300, 10007, nullptr);
#endif
}
Commit: 4124a957a627ab644c316e14ef4caad8c6967693
https://github.com/scummvm/scummvm/commit/4124a957a627ab644c316e14ef4caad8c6967693
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Boonsville event fixes, truck crash cutscene
Changed paths:
A engines/m4/burger/rooms/section1/room134_135.cpp
A engines/m4/burger/rooms/section1/room134_135.h
R engines/m4/burger/rooms/section1/room135.cpp
R engines/m4/burger/rooms/section1/room135.h
engines/m4/burger/flags.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/core/term.cpp
engines/m4/module.mk
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index f52c18af2ac..b204f9b40c5 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -107,8 +107,8 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
bool result = false;
for (const BoonsvilleEvent *rec = EVENTS; rec->_time; ++rec) {
- if ((int32)(*this)[kBoonsvillePriorTime] > rec->_time &&
- rec->_time <= (int32)(*this)[kBoonsvilleTime]) {
+ if ((*this)[kBoonsvilleTime] >= rec->_time &&
+ (*this)[kBoonsvillePriorTime] < rec->_time) {
result = true;
term_message("Time for: %s", rec->_text);
schedule_boonsville_time();
@@ -121,7 +121,32 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
}
void Flags::schedule_boonsville_time() {
- error("TODO: Flags::schedule_boonsville_time()");
+ int theTime = get_boonsville_time_and_display();
+ int hours = theTime / 216000;
+ int minutes = (theTime % 216000) / 3600;
+ int seconds = (theTime % 3600) / 60;
+ bool flag = false;
+
+ term_message("************ Schedule ************");
+
+ for (const auto& te : EVENTS) {
+ int teHours = te._time / 216000;
+ int teMinutes = (te._time % 216000) / 3600;
+ int teSeconds = (te._time % 3600) / 60;
+
+ if (te._time <= theTime) {
+ term_message("done %1d:%2d:%2d %s", teHours, teMinutes, teSeconds, te._text);
+ } else {
+ if (!flag) {
+ term_message("------> %1d:%2d:%2d Current time", hours, minutes, seconds);
+ flag = true;
+ }
+
+ term_message("pending %1d:%2d:%2d %s", teHours, teMinutes, teSeconds, te._text);
+ }
+ }
+
+ term_message("************************************");
}
void Flags::reset1() {
diff --git a/engines/m4/burger/rooms/section1/room135.cpp b/engines/m4/burger/rooms/section1/room134_135.cpp
similarity index 98%
rename from engines/m4/burger/rooms/section1/room135.cpp
rename to engines/m4/burger/rooms/section1/room134_135.cpp
index 4c073703f30..df62b1a8ef4 100644
--- a/engines/m4/burger/rooms/section1/room135.cpp
+++ b/engines/m4/burger/rooms/section1/room134_135.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/rooms/section1/room135.h"
+#include "m4/burger/rooms/section1/room134_135.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
@@ -87,7 +87,7 @@ static const seriesPlayBreak PLAY3[] = {
PLAY_BREAK_END
};
-void Room135::init() {
+void Room134_135::init() {
_volume = 255;
_val2 = 0;
_odieLoaded = false;
@@ -159,7 +159,7 @@ void Room135::init() {
}
}
-void Room135::daemon() {
+void Room134_135::daemon() {
int frame;
switch (_G(kernel).trigger) {
@@ -785,7 +785,7 @@ void Room135::daemon() {
}
}
-void Room135::pre_parser() {
+void Room134_135::pre_parser() {
if (player_said("fork in the road") && player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9);
@@ -796,7 +796,7 @@ void Room135::pre_parser() {
player_hotspot_walk_override(308, 249, 10, -1);
}
-void Room135::parser() {
+void Room134_135::parser() {
bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
@@ -851,7 +851,7 @@ void Room135::parser() {
_G(player).command_ready = false;
}
-void Room135::conv01() {
+void Room134_135::conv01() {
_G(kernel).trigger_mode = KT_PARSE;
int who = conv_whos_talking();
int node = conv_current_node();
@@ -934,7 +934,7 @@ void Room135::conv01() {
}
}
-void Room135::conv02() {
+void Room134_135::conv02() {
_G(kernel).trigger_mode = KT_PARSE;
int who = conv_whos_talking();
@@ -953,7 +953,7 @@ void Room135::conv02() {
}
}
-void Room135::conv03() {
+void Room134_135::conv03() {
_G(kernel).trigger_mode = KT_PARSE;
if (_G(kernel).trigger == 35) {
@@ -998,7 +998,7 @@ void Room135::conv03() {
}
}
-void Room135::loadOdie() {
+void Room134_135::loadOdie() {
static const char *NAMES[30] = {
"135od05", "135od05s", "135od06", "135od06s", "135od04",
"135od04s", "135od08", "135od08s", "135od09", "135od09s",
@@ -1016,7 +1016,7 @@ void Room135::loadOdie() {
}
}
-void Room135::loadDigi() {
+void Room134_135::loadDigi() {
if (_name1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_name1, 1, 255, 35);
diff --git a/engines/m4/burger/rooms/section1/room135.h b/engines/m4/burger/rooms/section1/room134_135.h
similarity index 90%
rename from engines/m4/burger/rooms/section1/room135.h
rename to engines/m4/burger/rooms/section1/room134_135.h
index 269671229ec..d4aed3e78e1 100644
--- a/engines/m4/burger/rooms/section1/room135.h
+++ b/engines/m4/burger/rooms/section1/room134_135.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_BURGER_ROOMS_SECTION1_ROOM135_H
-#define M4_BURGER_ROOMS_SECTION1_ROOM135_H
+#ifndef M4_BURGER_ROOMS_SECTION1_ROOM134_135_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM134_135_H
#include "m4/burger/rooms/room.h"
@@ -28,7 +28,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-class Room135 : public Room {
+class Room134_135 : public Room {
private:
int _volume = 0;
int _val2 = 0;
@@ -63,8 +63,8 @@ private:
void loadDigi();
public:
- Room135() : Room() {}
- ~Room135() override {}
+ Room134_135() : Room() {}
+ ~Room134_135() override {}
void init() override;
void daemon() override;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 3b5834aa94a..105590b0605 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -38,7 +38,8 @@ Section1::Section1() : Rooms::Section() {
add(106, &_room106);
add(120, &_room120);
add(133, &_room133_136);
- add(135, &_room135);
+ add(134, &_room134_135);
+ add(135, &_room134_135);
add(136, &_room133_136);
add(137, &_room137);
add(138, &_room138);
@@ -199,7 +200,7 @@ void Section1::daemon() {
_series2 = series_load("110bu02", -1, _G(master_palette));
_state1 = 2;
kernel_trigger_dispatch_now(1033);
- digi_play("110bu03", 1, 255, 1034);
+ digi_play("100b003", 1, 255, 1034);
break;
case 1033:
if (_state1 == 2) {
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 2a051e59438..6deb5c850af 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -32,7 +32,7 @@
#include "m4/burger/rooms/section1/room106.h"
#include "m4/burger/rooms/section1/room120.h"
#include "m4/burger/rooms/section1/room133_136.h"
-#include "m4/burger/rooms/section1/room135.h"
+#include "m4/burger/rooms/section1/room134_135.h"
#include "m4/burger/rooms/section1/room137.h"
#include "m4/burger/rooms/section1/room138.h"
#include "m4/burger/rooms/section1/room139_144.h"
@@ -67,7 +67,7 @@ private:
Room106 _room106;
Room120 _room120;
Room133_136 _room133_136;
- Room135 _room135;
+ Room134_135 _room134_135;
Room137 _room137;
Room138 _room138;
Room139_144 _room139_144;
diff --git a/engines/m4/core/term.cpp b/engines/m4/core/term.cpp
index 174a07304a1..0990892184d 100644
--- a/engines/m4/core/term.cpp
+++ b/engines/m4/core/term.cpp
@@ -66,7 +66,7 @@ void Term::message(const char *fmt, ...) {
void Term::vmessage(const char *fmt, va_list va) {
if (_mode != MEMORY_MODE) {
Common::String msg = Common::String::vformat(fmt, va);
- debug("%s\n", msg.c_str());
+ debug("%s", msg.c_str());
if (_file) {
_file->writeString(msg);
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 1fd46b7107d..4916b1f3b3a 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -97,7 +97,7 @@ MODULE_OBJS = \
burger/rooms/section1/room106.o \
burger/rooms/section1/room120.o \
burger/rooms/section1/room133_136.o \
- burger/rooms/section1/room135.o \
+ burger/rooms/section1/room134_135.o \
burger/rooms/section1/room137.o \
burger/rooms/section1/room138.o \
burger/rooms/section1/room139_144.o \
Commit: b94100e3907a4c0d773fabd96b2f3c8ce613b983
https://github.com/scummvm/scummvm/commit/b94100e3907a4c0d773fabd96b2f3c8ce613b983
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix speaking to Aunt Polly
Changed paths:
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/graphics/gr_series.h
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index fb4a47ac149..2b515a0e599 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -352,13 +352,13 @@ void Room171::daemon() {
break;
case 6:
- npc_say(conv_sound_to_play(), 10001, "171ap01n", 0x2ff, false);
+ npc_say(conv_sound_to_play(), kRESUME_CONVERSATION, "171ap01n", 0x2ff, false);
break;
case 7:
digi_stop(2);
freeSeries();
- series_play_with_breaks(PLAY3, "171ap02", 0x300, 10001, 3);
+ series_play_with_breaks(PLAY3, "171ap02", 0x300, kRESUME_CONVERSATION, 3);
break;
case 8:
@@ -383,18 +383,18 @@ void Room171::daemon() {
break;
case 11:
- npc_say(10001);
+ npc_say(kRESUME_CONVERSATION);
break;
case 12:
digi_stop(2);
npc_say();
- series_play_with_breaks(PLAY5, "171ap04", 0x800, 10001, 3);
+ series_play_with_breaks(PLAY5, "171ap04", 0x800, kRESUME_CONVERSATION, 3);
break;
case 13:
_pollyShould = 14;
- npc_say(5, "171ap05", 0x800);
+ npc_say(kCHANGE_POLLY_ANIMATION, "171ap05", 0x800);
break;
case 14:
@@ -407,22 +407,22 @@ void Room171::daemon() {
case 15:
terminateMachineAndNull(_lid);
_pollyShould = 16;
- series_play_with_breaks(PLAY7, "171ap07", 0, 5, 2);
+ series_play_with_breaks(PLAY7, "171ap07", 0, kCHANGE_POLLY_ANIMATION, 2);
break;
case 16:
- npc_say(10001, "171ap08", 0, false);
+ npc_say(kRESUME_CONVERSATION, "171ap08", 0, false);
break;
case 17:
freeSeries();
_pollyShould = 18;
- series_play_with_breaks(PLAY8, "171ap09", 0, 5, 3);
+ series_play_with_breaks(PLAY8, "171ap09", 0, kCHANGE_POLLY_ANIMATION, 3);
break;
case 18:
_pollyShould = 19;
- series_play_with_breaks(PLAY9, "171ap09", 0x301, 5, 3);
+ series_play_with_breaks(PLAY9, "171ap09", 0x301, kCHANGE_POLLY_ANIMATION, 3);
series_show("171plid", 0);
break;
@@ -439,13 +439,13 @@ void Room171::daemon() {
case 21:
freeSeries();
- npc_say(10001, "171ap10", 0x700, true, 0, 6);
+ npc_say(kRESUME_CONVERSATION, "171ap10", 0x700, true, 0, 6);
break;
case 22:
npc_say(5);
_pollyShould = 23;
- series_play_with_breaks(PLAY10, "171ap10", 0x700, 5, 3);
+ series_play_with_breaks(PLAY10, "171ap10", 0x700, kCHANGE_POLLY_ANIMATION, 3);
break;
case 23:
@@ -471,15 +471,16 @@ void Room171::daemon() {
player_update_info();
if (_flag1 && (_G(player_info).x != 436 || _G(player_info).y != 288))
- ws_walk(436, 288, 0, 10001, 2);
+ ws_walk(436, 288, 0, kRESUME_CONVERSATION, 2);
digi_play_loop("171_009", 2, 50);
- _series.play("171ap11", 0x8ff, 32, 4, 6, -1);
+ _series[0] = series_play("171ap11", 0x8ff, 32, 4, 6, -1);
+ _series[1] = series_play("171ap11", 0x900, 0, -1, 6, -1);
break;
case 28:
_pollyShould = 29;
- npc_say(_digi1, 5, "171ap13", 0x8fe);
+ npc_say(_digi1, kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 29:
@@ -490,7 +491,7 @@ void Room171::daemon() {
case 30:
_pollyShould = 32;
- series_play_with_breaks(PLAY15, "171ap16", 0x8ff, 5, 3);
+ series_play_with_breaks(PLAY15, "171ap16", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 31:
@@ -504,12 +505,12 @@ void Room171::daemon() {
break;
case 33:
- npc_say(10001, "171ap13", 0x8fe);
+ npc_say(kRESUME_CONVERSATION, "171ap13", 0x8fe);
break;
case 34:
_pollyShould = 35;
- npc_say(5, "171ap13", 0x8fe);
+ npc_say(kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 35:
@@ -520,16 +521,16 @@ void Room171::daemon() {
case 36:
_pollyShould = 26;
- series_play_with_breaks(PLAY12, "171ap12", 0x8ff, 5, 3);
+ series_play_with_breaks(PLAY12, "171ap12", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 37:
- series_play_with_breaks(PLAY13, "171ap14", 0x8ff, 5, 3);
+ series_play_with_breaks(PLAY13, "171ap14", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 38:
_pollyShould = 39;
- npc_say(5, "171ap13", 0x8fe);
+ npc_say(kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 39:
@@ -540,7 +541,7 @@ void Room171::daemon() {
terminateMachineAndNull(_series3);
_pollyShould = 40;
- series_play_with_breaks(PLAY14, "171ap15", 0x700, 5, 2, 8);
+ series_play_with_breaks(PLAY14, "171ap15", 0x700, kCHANGE_POLLY_ANIMATION, 2, 8);
break;
case 40:
@@ -610,7 +611,7 @@ void Room171::daemon() {
case 2:
disable_player();
- _G(wilbur_should) = 10001;
+ _G(wilbur_should) = kRESUME_CONVERSATION;
series_play_with_breaks(PLAY2, "171wi02", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5, 100, 0, -3);
break;
@@ -625,7 +626,7 @@ void Room171::daemon() {
_pollyShould = 28;
break;
- case 10001:
+ case kRESUME_CONVERSATION:
ws_unhide_walker();
if (_G(flags)[V092] || _G(flags)[V086])
@@ -793,7 +794,7 @@ void Room171::conv40() {
return;
if (who == 1) {
- wilbur_speech(conv_sound_to_play(), 10001);
+ wilbur_speech(conv_sound_to_play(), kRESUME_CONVERSATION);
switch (node) {
case 6:
@@ -887,11 +888,6 @@ void Room171::conv40() {
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
- case 5:
- case 7:
- _pollyShould = 34;
- break;
-
case 6:
_pollyShould = (entry == 6) ? 33 : 34;
break;
@@ -917,6 +913,7 @@ void Room171::conv40() {
break;
default:
+ _pollyShould = 34;
break;
}
}
diff --git a/engines/m4/graphics/gr_series.h b/engines/m4/graphics/gr_series.h
index 1a841456496..33fcd90a759 100644
--- a/engines/m4/graphics/gr_series.h
+++ b/engines/m4/graphics/gr_series.h
@@ -73,6 +73,10 @@ struct Series {
return _series != nullptr;
}
+ machine *&operator[](uint idx) {
+ return (idx == 0) ? _series : _seriesS;
+ }
+
frac16 *regs() const {
return _series->myAnim8->myRegs;
}
Commit: 727f5f3217845aeb38cbc2232bdf5c8064a67b14
https://github.com/scummvm/scummvm/commit/727f5f3217845aeb38cbc2232bdf5c8064a67b14
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes and cleanups for room 172
Changed paths:
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room172.h
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index 14e68a59217..bcb3ce3b8a5 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_POLLY_ANIMATION = 1
+};
+
static const char *SAID[][4] = {
{ "AUNT POLLY", "172w001", "172w002", "172w002" },
{ "PARLOUR", "172w002", nullptr, nullptr },
@@ -99,25 +103,25 @@ void Room172::init() {
case 171:
if (!_G(flags)[V092] && !_G(flags)[V091]) {
player_set_commands_allowed(false);
- series_load("172aplt");
- series_load("172aplts");
+ series_load("172ap1t");
+ series_load("172ap1ts");
series_load("172ap02t");
digi_preload("172p906");
- _val1 = 4;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 4;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
ws_demand_location(300, 325, 3);
- ws_walk(368, 359, 0, -1, 2);
+ ws_walk(368, 359, nullptr, -1, 2);
} else {
ws_demand_location(11, 296, 3);
- ws_walk(156, 297, 0, -1, -1);
+ ws_walk(156, 297, nullptr, -1, -1);
}
break;
case 173:
ws_demand_location(171, 254, 3);
- ws_walk(250, 270, 0, -1, -1);
+ ws_walk(250, 270, nullptr, -1, -1);
break;
default:
@@ -128,8 +132,8 @@ void Room172::init() {
hotspot_set_active("AUNT POLLY", false);
if (_G(flags)[V092]) {
- _val1 = 15;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 15;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
_walk1 = intr_add_no_walk_rect(357, 311, 639, 353, 356, 354);
hotspot_set_active("AUNT POLLY", true);
} else {
@@ -141,46 +145,47 @@ void Room172::init() {
inv_player_has("SOAPY WATER")) {
hotspot_set_active("CARROT JUICE ", false);
} else {
- _series3.show("172jug", 0x700);
+ _jug.show("172jug", 0x700);
}
}
void Room172::daemon() {
switch (_G(kernel).trigger) {
- case 1:
- switch (_val1) {
+ case kCHANGE_POLLY_ANIMATION:
+ switch (_pollyShould) {
case 4:
- _val1 = 5;
- series_play_with_breaks(PLAY2, "172ap01", 0x600, 1, 3, 8);
- digi_play("172p906", 2, 255, 1);
+ _pollyShould = 5;
+ series_play_with_breaks(PLAY2, "172ap01", 0x600, kCHANGE_POLLY_ANIMATION, 3, 8);
+ digi_play("172p906", 2, 255, kCHANGE_POLLY_ANIMATION);
break;
case 5:
_G(flags)[V092] = 1;
hotspot_set_active("AUNT POLLY", true);
- _val1 = 7;
+ _pollyShould = 7;
_series5.play("172ap1t", 0x400, 4, -1, 6);
break;
case 6:
freeSeries5();
- _val1 = 8;
- npc_say("172p907", 1, "172ap1t", 0x400, true);
+ _pollyShould = 8;
+ npc_say("172p907", kCHANGE_POLLY_ANIMATION, "172ap1t", 0x400, true);
break;
case 7:
digi_unload("172p906");
freeSeries5();
_series5.show("172ap1t", 0x400);
- wilbur_speech("172w902", 1);
+ _pollyShould = 6;
+ wilbur_speech("172w902", kCHANGE_POLLY_ANIMATION);
break;
case 8:
_G(flags)[V091] = true;
terminateMachineAndNull(_series1);
terminateMachineAndNull(_series1s);
- _val1 = 9;
- series_play_with_breaks(PLAY3, "172ap02", 0x400, 1, 3, 8);
+ _pollyShould = 9;
+ series_play_with_breaks(PLAY3, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 9:
@@ -191,14 +196,14 @@ void Room172::daemon() {
case 10:
freeSeries7();
- _val1 = 11;
- series_play_with_breaks(PLAY4, "172ap02", 0x400, 1, 3, 8);
+ _pollyShould = 11;
+ series_play_with_breaks(PLAY4, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 11:
freeSeries7();
- _val1 = 14;
- npc_say(conv_sound_to_play(), 1, "172ap02", 0x400, 1, 31, 35);
+ _pollyShould = 14;
+ npc_say(kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
case 12:
@@ -206,8 +211,8 @@ void Room172::daemon() {
_G(flags)[V298] = 1;
freeSeries7();
_series5.terminate();
- _val1 = 15;
- npc_say(conv_sound_to_play(), 1, "172ap02", 0x400, 1, 31, 35);
+ _pollyShould = 15;
+ npc_say(kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
case 13:
@@ -230,8 +235,8 @@ void Room172::daemon() {
case 16:
freeSeries7();
- _val1 = 17;
- series_play_with_breaks(PLAY6, "172ap02", 0x400, 1, 3, 8);
+ _pollyShould = 17;
+ series_play_with_breaks(PLAY6, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 17:
@@ -240,8 +245,8 @@ void Room172::daemon() {
_series1 = series_show("172fud2", 0x700);
_series1s = series_show("172fuds", 0x701);
intr_remove_no_walk_rect(_walk1);
- _val1 = 18;
- series_play_with_breaks(PLAY7, "172ap03", 0x600, 1, 3, 8);
+ _pollyShould = 18;
+ series_play_with_breaks(PLAY7, "172ap03", 0x600, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 18:
@@ -255,7 +260,7 @@ void Room172::daemon() {
break;
case 2:
- _series3.terminate();
+ _jug.terminate();
break;
case 3:
@@ -273,13 +278,13 @@ void Room172::daemon() {
if (_G(flags)[V092]) {
freeSeries7();
- _val1 = 15;
+ _pollyShould = 15;
} else {
_G(flags)[V088] = 1;
- _val1 = 16;
+ _pollyShould = 16;
}
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
_G(flags)[V298] = 0;
_G(flags)[V299] = 0;
break;
@@ -288,8 +293,8 @@ void Room172::daemon() {
switch (_G(wilbur_should)) {
case 1:
_convName = _G(flags)[V087] ? "172p903" : "172p902";
- _val1 = 12;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
@@ -346,8 +351,8 @@ void Room172::parser() {
} else if (player_said("TAKE", "CARROT JUICE ")) {
if (_G(flags)[V092]) {
_convName = "172p950";
- _val1 = 12;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -360,8 +365,8 @@ void Room172::parser() {
kernel_trigger_dispatch_now(3);
} else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
_convName = imath_rand_bool(2) ? "172p901" : "172904";
- _val1 = 12;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else if (player_said("MICROWAVE")) {
parserAction("172w004");
} else if (player_said("GEAR", "REFRIGERATOR")) {
@@ -375,8 +380,8 @@ void Room172::parser() {
} else if (player_said("TAKE", "JUICER")) {
if (_G(flags)[V092]) {
_convName = imath_rand_bool(2) ? "172p905a" : "172p905b";
- _val1 = 12;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
wilbur_speech("172w033");
}
@@ -390,8 +395,8 @@ void Room172::parser() {
void Room172::parserAction(const char *name) {
if (_G(flags)[V092]) {
_convName = "172p950";
- _val1 = 12;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
wilbur_speech(name);
}
@@ -428,22 +433,22 @@ void Room172::conv41() {
switch (node) {
case 0:
- _val1 = 4;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 4;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
switch (entry) {
case 0:
- _val1 = 10;
- kernel_trigger_dispatch_now(1);
+ _pollyShould = 10;
+ kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 1:
freeSeries7();
_G(flags)[V092] = 0;
- _val1 = 14;
- npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ _pollyShould = 14;
+ npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
default:
@@ -453,14 +458,14 @@ void Room172::conv41() {
case 3:
freeSeries7();
- _val1 = 13;
- npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ _pollyShould = 13;
+ npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
default:
freeSeries7();
- _val1 = 14;
- npc_say(sound, 1, "172ap02", 0x400, 1, 31, 35);
+ _pollyShould = 14;
+ npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
}
}
diff --git a/engines/m4/burger/rooms/section1/room172.h b/engines/m4/burger/rooms/section1/room172.h
index 8304834083d..63ab51f492c 100644
--- a/engines/m4/burger/rooms/section1/room172.h
+++ b/engines/m4/burger/rooms/section1/room172.h
@@ -32,13 +32,13 @@ class Room172 : public Room {
private:
machine *_series1 = nullptr;
machine *_series1s = nullptr;
- Series _series3;
+ Series _jug;
machine *_series4 = nullptr;
Series _series5;
machine *_series7 = nullptr;
noWalkRect *_walk1 = nullptr;
const char *_convName = nullptr;
- int _val1 = 0;
+ int _pollyShould = 0;
void loadSeries7();
void freeSeries5() {
Commit: 08891640f03c040567c18f353f74733234bb0bea
https://github.com/scummvm/scummvm/commit/08891640f03c040567c18f353f74733234bb0bea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Make term_message display on debug level 1
Changed paths:
engines/m4/core/term.cpp
diff --git a/engines/m4/core/term.cpp b/engines/m4/core/term.cpp
index 0990892184d..8be8075753c 100644
--- a/engines/m4/core/term.cpp
+++ b/engines/m4/core/term.cpp
@@ -66,7 +66,7 @@ void Term::message(const char *fmt, ...) {
void Term::vmessage(const char *fmt, va_list va) {
if (_mode != MEMORY_MODE) {
Common::String msg = Common::String::vformat(fmt, va);
- debug("%s", msg.c_str());
+ debugN(1, "%s", msg.c_str());
if (_file) {
_file->writeString(msg);
Commit: 27176a7abe5b747023af653ff70ab2d41ae4a6d9
https://github.com/scummvm/scummvm/commit/27176a7abe5b747023af653ff70ab2d41ae4a6d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for room 172
Changed paths:
engines/m4/burger/rooms/section1/room172.cpp
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index bcb3ce3b8a5..e2cb36ad391 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -163,7 +163,7 @@ void Room172::daemon() {
_G(flags)[V092] = 1;
hotspot_set_active("AUNT POLLY", true);
_pollyShould = 7;
- _series5.play("172ap1t", 0x400, 4, -1, 6);
+ _series5.play("172ap1t", 0x400, 4, -1, 6, -1);
break;
case 6:
@@ -212,7 +212,7 @@ void Room172::daemon() {
freeSeries7();
_series5.terminate();
_pollyShould = 15;
- npc_say(kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
+ npc_say(_convName, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
case 13:
Commit: 9a365ccffca6d6d35d88e3e1d58ee8a45c4f7c98
https://github.com/scummvm/scummvm/commit/9a365ccffca6d6d35d88e3e1d58ee8a45c4f7c98
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of room 139 burl
Changed paths:
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room139_144.h
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index bfbfdf695cb..02936b3f867 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_BURL_ANIMATION = 9
+};
+
static const char *SAID1[][4] = {
{ "ISLAND", nullptr, "999w011", "999w011" },
{ "ROCK", "144W004", "999w011", "999w011" },
@@ -119,8 +123,8 @@ void Room139_144::init() {
case 139:
player_set_commands_allowed(false);
ws_demand_location(470, 269, 8);
- _val3 = 1;
- _val4 = 3;
+ _burlShould = 1;
+ _burlMode = 3;
kernel_trigger_dispatch_now(9);
break;
@@ -139,8 +143,8 @@ void Room139_144::init() {
}
if (_G(game).previous_room != 139 && _G(flags)[V000] == 1002) {
- _val3 = _val4 = 3;
- kernel_trigger_dispatch_now(9);
+ _burlShould = _burlMode = 3;
+ kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
}
if (_G(flags)[V112]) {
@@ -184,7 +188,7 @@ void Room139_144::daemon() {
case 6:
player_set_commands_allowed(true);
- _val3 = 3;
+ _burlShould = 3;
break;
case 7:
@@ -202,25 +206,25 @@ void Room139_144::daemon() {
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1013);
break;
- case 9:
- switch (_val4) {
+ case kCHANGE_BURL_ANIMATION:
+ switch (_burlMode) {
case 3:
- switch (_val3) {
+ switch (_burlShould) {
case 1:
- _val3 = 2;
+ _burlShould = 2;
series_play("144bu01s", 0x301, 0, -1, 8);
digi_preload("144b003d");
digi_preload_stream_breaks(SERIES2);
- series_stream_with_breaks(SERIES2, "144bu01", 8, 0x300, 9);
+ series_stream_with_breaks(SERIES2, "144bu01", 8, 0x300, kCHANGE_BURL_ANIMATION);
break;
case 2:
digi_unload_stream_breaks(SERIES2);
player_set_commands_allowed(true);
randomDigi();
- _val3 = 3;
+ _burlShould = 3;
- series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
break;
@@ -236,7 +240,7 @@ void Room139_144::daemon() {
break;
case 3:
- _val3 = 41;
+ _burlShould = 41;
break;
case 4:
@@ -252,25 +256,25 @@ void Room139_144::daemon() {
switch (imath_ranged_rand(1, 4)) {
case 1:
randomDigi();
- series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 16, 24);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 16, 24);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 16, 24);
break;
case 2:
randomDigi();
- series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 26, 35);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 26, 35);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 26, 35);
break;
case 3:
randomDigi();
- series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 37, 40);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 37, 40);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 37, 40);
break;
case 4:
- _val3 = 7;
- series_play("144bu06", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 12);
+ _burlShould = 7;
+ series_play("144bu06", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 12);
series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 12);
break;
@@ -278,7 +282,7 @@ void Room139_144::daemon() {
break;
}
} else {
- series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, _val2, _val2);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, _val2, _val2);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, _val2, _val2);
}
break;
@@ -286,14 +290,14 @@ void Room139_144::daemon() {
case 4:
case 5:
digi_play("144b002", 2);
- series_play("144bu06", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 2);
+ series_play("144bu06", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
break;
case 7:
digi_change_volume(2, 0);
- _val4 = 7;
- series_play("144bu07", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 2);
+ _burlMode = 7;
+ series_play("144bu07", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
series_play("144bu07s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
break;
@@ -303,32 +307,32 @@ void Room139_144::daemon() {
break;
case 4:
- switch (_val3) {
+ switch (_burlShould) {
case 4:
- series_play("144bu08", 0x300, 0, 9, 10, 0, 100, 0, 0, 3, 3);
+ series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
series_play("144bu08s", 0x301, 0, -1, 10, 0, 100, 0, 0, 3, 3);
break;
case 5:
- _val4 = 5;
- series_play("144bu08", 0x300, 0, 9, 4, 0, 100, 0, 0, 4, 7);
+ _burlMode = 5;
+ series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, 4, 7);
series_play("144bu08s", 0x301, 0, -1, 4, 0, 100, 0, 0, 4, 7);
break;
default:
digi_play("144b002", 2);
- _val4 = 3;
- _val3 = 2;
- series_play("144bu08", 0x300, 2, 9, 7, 0, 100, 0, 0, 0, 3);
+ _burlMode = 3;
+ _burlShould = 2;
+ series_play("144bu08", 0x300, 2, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 0, 3);
break;
}
break;
case 5:
- if (_val3 == 5) {
+ if (_burlShould == 5) {
frame = imath_ranged_rand(0, 2);
- series_play("144bu09", 0x300, 0, 9, 4, 0, 100, 0, 0, frame, frame);
+ series_play("144bu09", 0x300, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
series_play("144bu09s", 0x301, 0, -1, 4, 0, 100, 0, 0, frame, frame);
if (_digi1) {
@@ -337,33 +341,33 @@ void Room139_144::daemon() {
_digi1 = nullptr;
}
} else {
- _val4 = 4;
- series_play("144bu08", 0x300, 2, 9, 7, 0, 100, 0, 0, 4, 7);
+ _burlMode = 4;
+ series_play("144bu08", 0x300, 2, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 4, 7);
series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 4, 7);
}
break;
case 6:
- _val4 = 4;
- series_play("144bu08", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 3);
+ _burlMode = 4;
+ series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
series_play("144bu08s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 3);
break;
case 7:
- if (_val3 == 7) {
+ if (_burlShould == 7) {
if (imath_ranged_rand(1, 10) == 1) {
randomDigi();
- _val4 = 3;
- _val3 = 3;
- series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ _burlMode = 3;
+ _burlShould = 3;
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
} else {
- series_play("144bu03", 0x300, 0, 9, 10, 0, 100, 0, 0, 0, 0);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 0, 0);
}
} else {
- _val4 = 3;
- series_play("144bu03", 0x300, 0, 9, 7, 0, 100, 0, 0, 0, 15);
+ _burlMode = 3;
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
}
break;
@@ -466,7 +470,7 @@ void Room139_144::conv31() {
if (_G(kernel).trigger == 1) {
if (who <= 0) {
- _val3 = 4;
+ _burlShould = 4;
conv_resume();
} else if (who == 1) {
conv_resume();
@@ -474,7 +478,7 @@ void Room139_144::conv31() {
}
} else if (conv_sound_to_play()) {
if (who <= 0) {
- _val3 = 5;
+ _burlShould = 5;
_digi1 = conv_sound_to_play();
} else if (who == 1) {
wilbur_speech(conv_sound_to_play(), 1);
diff --git a/engines/m4/burger/rooms/section1/room139_144.h b/engines/m4/burger/rooms/section1/room139_144.h
index 100ac103920..b9fa2c12d1a 100644
--- a/engines/m4/burger/rooms/section1/room139_144.h
+++ b/engines/m4/burger/rooms/section1/room139_144.h
@@ -34,8 +34,8 @@ private:
const char *_digi1 = nullptr;
int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
- int _val4 = 0;
+ int _burlShould = 0;
+ int _burlMode = 0;
void preloadDigi();
void randomDigi();
Commit: 3fec936cc412f7b8d40524207e63b3f0bb99e3e9
https://github.com/scummvm/scummvm/commit/3fec936cc412f7b8d40524207e63b3f0bb99e3e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix random action in room 139/144
Changed paths:
engines/m4/burger/rooms/section1/room139_144.cpp
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index 02936b3f867..403f591dfff 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -240,7 +240,7 @@ void Room139_144::daemon() {
break;
case 3:
- _burlShould = 41;
+ _val2 = 41;
break;
case 4:
Commit: 0e86e4542d3a01eab6b20be055cc8c042c872fec
https://github.com/scummvm/scummvm/commit/0e86e4542d3a01eab6b20be055cc8c042c872fec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup Truffles daemon code in room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 7d3701a8f38..35751abc735 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_TRUFFLES_ANIMATION = 6
+};
+
static const char *SAID[][4] = {
{ "TRUFFLES", "141W002", "141W003", "141W003" },
{ "ISLAND", "141W004", "141W003", "141W003" },
@@ -183,8 +187,8 @@ void Room141::init() {
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
_series2 = series_play("141wave", 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
- _val3 = 9;
- _val4 = 9;
+ _trufflesMode = 9;
+ _trufflesShould = 9;
_val5 = 52;
_val6 = 52;
@@ -193,12 +197,12 @@ void Room141::init() {
_val6 = 50;
if (_G(flags)[V112]) {
- _val3 = 1;
- _val4 = 8;
+ _trufflesMode = 1;
+ _trufflesShould = 8;
} else {
- _val3 = 1;
- _val4 = 1;
- _val7 = 0;
+ _trufflesMode = 1;
+ _trufflesShould = 1;
+ _trufflesFrame = 0;
}
}
@@ -212,11 +216,12 @@ void Room141::daemon() {
switch (_G(kernel).trigger) {
case 1:
+ _flag2 = true;
digi_play("141_002", 2, 200, 2);
break;
case 2:
- digi_play_loop("141_003", 2, 200);
+ digi_play_loop("141_003", 2, 200, -1);
break;
case 3:
@@ -224,7 +229,7 @@ void Room141::daemon() {
break;
case 4:
- _val8 = 0;
+ _flag2 = false;
break;
case 5:
@@ -232,45 +237,39 @@ void Room141::daemon() {
player_set_commands_allowed(true);
break;
- case 6:
- switch (_val3) {
+ case kCHANGE_TRUFFLES_ANIMATION:
+ switch (_trufflesMode) {
case 1:
- switch (_val4) {
+ switch (_trufflesShould) {
case 1:
_flag1 = true;
if (imath_ranged_rand(1, 8) == 1) {
- _val3 = 2;
- _val7 = 0;
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 1, 1);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 1, 1);
-
+ _trufflesMode = 2;
+ _trufflesFrame = 0;
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 1, 1);
} else {
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
}
break;
case 5:
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
_val2 = 42;
break;
case 6:
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 7:
digi_play("140t002", 2, 255, 11);
- series_play("140tr02", 0xa00, 0, 6, 8, 0, 100, 0, 0, 0, 4);
- series_play("140tr02s", 0xa01, 0, -1, 8, 0, 100, 0, 0, 0, 4);
+ Series::series_play("140tr02", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 8, 0, 100, 0, 0, 0, 4);
break;
case 8:
- _val3 = 9;
- _val4 = 9;
+ _trufflesMode = 9;
+ _trufflesShould = 9;
series_play_with_breaks(PLAY1, "140tr03", 0xa00, 6, 3, 6, 100, 0, 0);
break;
@@ -280,86 +279,76 @@ void Room141::daemon() {
break;
case 2:
- if (_val4 == 1) {
+ if (_trufflesShould == 1) {
playRandom();
if (imath_ranged_rand(1, 3) == 1) {
- if (--_val7 <= 1)
- _val7 = 3;
+ if (--_trufflesFrame <= 1)
+ _trufflesFrame = 3;
} else {
- if (++_val7 >= 6) {
- _val7 = 5;
- _val3 = 4;
+ if (++_trufflesFrame >= 6) {
+ _trufflesFrame = 5;
+ _trufflesMode = 4;
}
- if (_val7 < 1)
- _val7 = 1;
+ if (_trufflesFrame < 1)
+ _trufflesFrame = 1;
}
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, _val7, _val7);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, _val7, _val7);
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, _trufflesFrame, _trufflesFrame);
} else {
- _val3 = 4;
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 6, 6);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 6, 6);
+ _trufflesMode = 4;
+ Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 6, 6);
}
break;
case 3:
- if (_val4 == 1) {
+ if (_trufflesShould == 1) {
if (imath_ranged_rand(1, 15) == 1) {
digi_stop(2);
- _val3 = 1;
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ _trufflesMode = 1;
+ Series::series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
} else {
playRandom();
frame = imath_ranged_rand(7, 8);
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, frame, frame);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, frame, frame);
}
} else {
digi_stop(2);
- _val3 = 1;
- series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr01s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ _trufflesMode = 1;
+ Series::series_play("140tr01", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
}
break;
case 4:
- _val3 = 3;
- series_play("140tr01", 0xa00, 0, 6, 6, 0, 100, 0, 0, 9, 11);
- series_play("140tr01s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 9, 11);
+ _trufflesMode = 3;
+ Series::series_play("140tr01", 0xa00, 0, 6, 6, 0, 100, 0, 0, 9, 11);
break;
case 7:
- if (_val4 == 7) {
+ if (_trufflesShould == 7) {
frame = imath_ranged_rand(5, 6);
- series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
- series_play("140tr02s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
} else {
- series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
- series_play("140tr02s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ Series::series_play("140tr02", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
}
break;
case 9:
- switch (_val4) {
+ switch (_trufflesShould) {
case 10:
digi_play("140t002", 2, 255, 12);
- _val3 = 10;
- series_play("140tr06", 0xa00, 0, 6, 8, 0, 100, 0, 0, 0, 4);
- series_play("140tr06s", 0xa01, 0, -1, 8, 0, 100, 0, 0, 0, 4);
+ _trufflesMode = 10;
+ Series::series_play("140tr06", 0xa00, 0, 6, 8, 0, 100, 0, 0, 0, 4);
break;
case 12:
digi_play(Common::String::format("140t004%c", 'a' + imath_ranged_rand(0, 3)).c_str(),
2, 255, 10);
- _val3 = 12;
- series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, 0, 3);
- series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 0, 3);
+ _trufflesMode = 12;
+ Series::series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, 0, 3);
if (player_said("gear", "dock") || player_said("try to dock")) {
kernel_timing_trigger(90, 16);
@@ -370,62 +359,53 @@ void Room141::daemon() {
if (imath_ranged_rand(1, 10) == 1) {
_flag1 = true;
playRandom();
- _val3 = 11;
- series_play("140tr05", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 2);
- series_play("140tr05s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 2);
+ _trufflesMode = 11;
+ Series::series_play("140tr05", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION,10, 0, 100, 0, 0, 0, 2);
} else {
- series_play("140tr04", 0xa00, 0, 6, 10, 0, 100, 0, 0, 0, 0);
- series_play("140tr04s", 0xa01, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140tr04", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
}
break;
}
break;
case 10:
- if (_val4 == 10) {
+ if (_trufflesShould == 10) {
frame = imath_ranged_rand(5, 6);
- series_play("140tr06", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
- series_play("140tr06s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140tr06", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 7, 0, 100, 0, 0, frame, frame);
} else {
- series_play("140tr06", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
- series_play("140tr06s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ Series::series_play("140tr06", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 7, 0, 100, 0, 0, 7, 8);
}
break;
case 11:
- if (_val4 == 11) {
+ if (_trufflesShould == 11) {
if (imath_ranged_rand(1, 10) == 1) {
- if (!_val8)
+ if (!_flag2)
digi_stop(2);
- _val3 = 9;
- series_play("140tr05", 0xa00, 2, 6, 10, 0, 100, 0, 0, 0, 2);
- series_play("140tr05s", 0xa01, 2, -1, 10, 0, 100, 0, 0, 0, 2);
+ _trufflesMode = 9;
+ Series::series_play("140tr05", 0xa00, 2, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 2);
} else {
playRandom();
frame = imath_ranged_rand(3, 5);
- series_play("140tr05", 0xa00, 0, 6, 10, 0, 100, 0, 0, frame, frame);
- series_play("140tr05s", 0xa01, 0, -1, 10, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140tr05", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION,10, 0, 100, 0, 0, frame, frame);
}
} else {
- _val3 = 9;
- series_play("140tr05", 0xa00, 2, 6, 7, 0, 100, 0, 0, 0, 2);
- series_play("140tr05s", 0xa01, 2, -1, 7, 0, 100, 0, 0, 0, 2);
+ _trufflesMode = 9;
+ Series::series_play("140tr05", 0xa00, 2, kCHANGE_TRUFFLES_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
}
break;
case 12:
- if (_val4 == 12) {
+ if (_trufflesShould == 12) {
frame = imath_ranged_rand(4, 6);
- series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, frame, frame);
- series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140tr07", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 7, 0, 100, 0, 0, frame, frame);
} else {
- _val3 = 9;
- series_play("140tr07", 0xa00, 0, 6, 7, 0, 100, 0, 0, 7, 8);
- series_play("140tr07s", 0xa01, 0, -1, 7, 0, 100, 0, 0, 7, 8);
+ _trufflesMode = 9;
+ Series::series_play("140tr07", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 7, 0, 100, 0, 0, 7, 8);
}
break;
@@ -657,7 +637,7 @@ void Room141::daemon() {
case 42:
_val2 = 40;
- _val4 = 6;
+ _trufflesShould = 6;
series_play_with_breaks(PLAY5, "140pe20", 0x500, 7, 3, 6, 100, 0, 0);
break;
@@ -719,14 +699,14 @@ void Room141::daemon() {
switch (_val6) {
case 50:
_val6 = 51;
- _val8 = 1;
+ _flag2 = 1;
digi_preload_stream_breaks(&SERIES4[0]);
series_stream_with_breaks(&SERIES4[0], _G(flags)[V000] == 1002 ? "141wi01" : "140wi01",
6, 0xf00, 8);
break;
case 51:
- _val8 = 0;
+ _flag2 = 0;
_series2 = series_play(_G(flags)[V000] == 1002 ? "141wave" : "140wave",
0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
_val6 = 52;
@@ -755,7 +735,7 @@ void Room141::daemon() {
case 55:
terminateMachineAndNull(_series2);
- _val8 = 1;
+ _flag2 = 1;
series_stream_with_breaks(SERIES3, _G(flags)[V000] == 1002 ? "141wi03" : "140wi03",
10, 0xf00, 18);
@@ -763,7 +743,7 @@ void Room141::daemon() {
case 56:
terminateMachineAndNull(_series2);
- _val8 = 1;
+ _flag2 = 1;
series_stream_with_breaks(SERIES3, _G(flags)[V000] == 1002 ? "141wi03" : "140wi03",
6, 0xf00, 18);
@@ -830,19 +810,19 @@ void Room141::daemon() {
break;
case 10:
- _val4 = 9;
+ _trufflesShould = 9;
if (!player_said("gear", "dock") && !player_said("try to dock"))
_G(walker).wilbur_said(SAID);
break;
case 11:
- _val4 = 1;
+ _trufflesShould = 1;
_val2 = 27;
conv_resume_curr();
break;
case 12:
- _val4 = 9;
+ _trufflesShould = 9;
break;
case 13:
@@ -861,11 +841,11 @@ void Room141::daemon() {
break;
case 14:
- _val4 = 7;
+ _trufflesShould = 7;
break;
case 15:
- _val4 = 10;
+ _trufflesShould = 10;
break;
case 16:
@@ -910,7 +890,7 @@ void Room141::parser() {
_val6 = 62;
} else if (player_said("gear", "dock") || player_said("try to dock")) {
- _val4 = 12;
+ _trufflesShould = 12;
} else if (inv_player_has(_G(player).verb) &&
player_said_any("cabin", "garden", "trough", "sign")) {
@@ -921,7 +901,7 @@ void Room141::parser() {
} else if (player_said("take") && !inv_player_has(_G(player).noun)) {
if (player_said("trough") || player_said("sign")) {
- _val4 = 12;
+ _trufflesShould = 12;
} else if (!_G(walker).wilbur_said(SAID)) {
goto check_exit;
@@ -930,7 +910,7 @@ void Room141::parser() {
} else if (player_said("gear") && !inv_player_has(_G(player).noun)) {
if (player_said("cabin") || player_said("garden") ||
player_said("trough") || player_said("sign")) {
- _val4 = 12;
+ _trufflesShould = 12;
} else if (!_G(walker).wilbur_said(SAID)) {
goto check_exit;
@@ -967,7 +947,7 @@ void Room141::conv20() {
} else if (node == 15 && entry == 1) {
_val2 = 43;
} else if (node == 16) {
- _val4 = 5;
+ _trufflesShould = 5;
} else if (node != 0) {
if (node == 20 && (entry == 2 || entry == 3)) {
_val2 = 40;
@@ -977,7 +957,7 @@ void Room141::conv20() {
} else if (node == 20 && entry == 6) {
_val2 = 38;
} else if (node == 20 && entry == 7) {
- _val4 = 8;
+ _trufflesShould = 8;
_val2 = 32;
} else if (node == 20 && entry == 8) {
_val2 = 45;
@@ -1078,7 +1058,7 @@ void Room141::conv20() {
}
void Room141::playRandom() {
- if (_flag1 && !_val8) {
+ if (_flag1 && !_flag2) {
_flag1 = false;
digi_play(Common::String::format("140t001%c", 'a' + imath_ranged_rand(0, 5)).c_str(),
2, 100, 9);
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index e318a4bd319..79f0fb4db03 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -34,13 +34,13 @@ private:
machine *_series2 = nullptr;
int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
- int _val4 = 0;
+ int _trufflesMode = 0;
+ int _trufflesShould = 0;
int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
- int _val8 = 0;
+ int _trufflesFrame = 0;
bool _flag1 = false;
+ bool _flag2 = false;
void conv20();
void playRandom();
Commit: be5866be22dc1bf4406d8eafd2a2944bf27dc2ec
https://github.com/scummvm/scummvm/commit/be5866be22dc1bf4406d8eafd2a2944bf27dc2ec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of Elmo daemon code in room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 35751abc735..7d635637186 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -29,7 +29,8 @@ namespace Burger {
namespace Rooms {
enum {
- kCHANGE_TRUFFLES_ANIMATION = 6
+ kCHANGE_TRUFFLES_ANIMATION = 6,
+ kCHANGE_ELMO_ANIMATION = 7
};
static const char *SAID[][4] = {
@@ -180,8 +181,8 @@ void Room141::init() {
digi_preload("20n01013", 140);
digi_preload("20n01014", 140);
- _val1 = 14;
- _val2 = 14;
+ _elmoMode = 14;
+ _elmoShould = 14;
kernel_trigger_dispatch_now(7);
}
@@ -255,7 +256,7 @@ void Room141::daemon() {
case 5:
Series::series_play("140tr01", 0xa00, 0, kCHANGE_TRUFFLES_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
- _val2 = 42;
+ _elmoShould = 42;
break;
case 6:
@@ -414,28 +415,27 @@ void Room141::daemon() {
}
break;
- case 7:
- switch (_val1) {
+ case kCHANGE_ELMO_ANIMATION:
+ switch (_elmoMode) {
case 14:
- switch (_val2) {
+ switch (_elmoShould) {
case 14:
- series_play("140pe01", 0xa00, 0, 7, 6, 0, 100, 0, 0, 1, 1);
- series_play("140pe01s", 0xa01, 0, -1, 6, 0, 100, 0, 0, 1, 1);
+ Series::series_play("140pe01", 0xa00, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 1, 1);
break;
case 15:
- _val2 = 16;
- series_play_with_breaks(PLAY2, "140pe01", 0x500, 7, 3);
+ _elmoShould = 16;
+ series_play_with_breaks(PLAY2, "140pe01", 0x500, kCHANGE_ELMO_ANIMATION, 3);
break;
case 16:
- _val2 = 17;
- series_play_with_breaks(PLAY3, "140pe02", 0x500, 7, 3);
+ _elmoShould = 17;
+ series_play_with_breaks(PLAY3, "140pe02", 0x500, kCHANGE_ELMO_ANIMATION, 3);
break;
case 17:
- _val2 = _val1 = 18;
- kernel_trigger_dispatch_now(7);
+ _elmoShould = _elmoMode = 18;
+ kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
conv_resume_curr();
break;
@@ -445,120 +445,103 @@ void Room141::daemon() {
break;
case 18:
- switch (_val2) {
+ switch (_elmoShould) {
case 18:
- series_play("140pe03", 0x500, 0, 7, 10, 0, 100, 0, 0, 0, 0);
- series_play("140pe03s", 0x501, 0, -1, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140pe03", 0x500, 0, kCHANGE_ELMO_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 19:
- series_play("140pe05", 0x500, 0, 7, 6, 0, 100, 0, 0, 1, 1);
- series_play("140pe05s", 0x501, 0, -1, 6, 0, 100, 0, 0, 1, 1);
+ Series::series_play("140pe05", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 1, 1);
break;
case 20:
frame = imath_ranged_rand(0, 4);
- series_play("140pe04", 0x500, 0, 7, 5, 0, 100, 0, 0, frame, frame);
- series_play("140pe04s", 0x501, 0, -1, 5, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140pe04", 0x500, 0, kCHANGE_ELMO_ANIMATION, 5, 0, 100, 0, 0, frame, frame);
break;
case 21:
- _val2 = 22;
- series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 3);
- series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 3);
+ _elmoShould = 22;
+ Series::series_play("140pe06", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
case 22:
- _val2 = 23;
- series_play("140pe06", 0x500, 0, 7, 50, 0, 100, 0, 0, 3, 3);
- series_play("140pe06s", 0x501, 0, -1, 50, 0, 100, 0, 0, 3, 3);
+ _elmoShould = 23;
+ Series::series_play("140pe06", 0x500, 0, kCHANGE_ELMO_ANIMATION, 50, 0, 100, 0, 0, 3, 3);
break;
case 23:
- _val2 = 18;
- series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 5, 7);
- series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 5, 7);
+ _elmoShould = 18;
+ Series::series_play("140pe06", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 5, 7);
break;
case 24:
- _val2 = 24;
- series_play("140pe06", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 5);
- series_play("140pe06s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ _elmoShould = 24;
+ Series::series_play("140pe06", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
kernel_timing_trigger(60, 19);
break;
case 25:
- _val2 = 26;
- series_play("140pe08", 0x500, 0, 7, 3, 0, 100, 0, 0, 0, 7);
- series_play("140pe08s", 0x501, 0, -1, 3, 0, 100, 0, 0, 0, 7);
+ _elmoShould = 26;
+ Series::series_play("140pe08", 0x500, 0, kCHANGE_ELMO_ANIMATION, 3, 0, 100, 0, 0, 0, 7);
break;
case 26:
- _val1 = _val2 = 27;
- series_play("140pe08", 0x500, 0, 7, 10, 0, 100, 0, 0, 10, 10);
- series_play("140pe08s", 0x501, 0, -1, 10, 0, 100, 0, 0, 10, 10);
+ _elmoMode = _elmoShould = 27;
+ Series::series_play("140pe08", 0x500, 0, kCHANGE_ELMO_ANIMATION, 10, 0, 100, 0, 0, 10, 10);
conv_resume_curr();
break;
default:
- _val1 = 27;
- series_play("140pe08", 0x500, 0, 7, 3, 0, 100, 0, 0, 0, 7);
- series_play("140pe08s", 0x501, 0, -1, 3, 0, 100, 0, 0, 0, 7);
+ _elmoMode = 27;
+ Series::series_play("140pe08", 0x500, 0, kCHANGE_ELMO_ANIMATION, 3, 0, 100, 0, 0, 0, 7);
break;
}
break;
case 24:
- if (_val2 == 24) {
+ if (_elmoShould == 24) {
if (imath_ranged_rand(1, 8) == 1) {
digi_play("140_003", 1, 200);
- series_play("140pe07", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 5);
- series_play("140pe07s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 5);
+ Series::series_play("140pe07", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
} else {
- series_play("140pe03", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
- series_play("140pe03s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140pe03", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
}
break;
case 27:
- switch (_val2) {
+ switch (_elmoShould) {
case 18:
case 19:
case 20:
case 24:
case 39:
- _val1 = 18;
- series_play("140pe15", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
- series_play("140pe15s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ _elmoMode = 18;
+ Series::series_play("140pe15", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 27:
- series_play("140pe08", 0x500, 0, 7, 10, 0, 100, 0, 0, 10, 10);
- series_play("140pe08s", 0x501, 0, -1, 10, 0, 100, 0, 0, 10, 10);
+ Series::series_play("140pe08", 0x500, 0, kCHANGE_ELMO_ANIMATION, 10, 0, 100, 0, 0, 10, 10);
break;
case 28:
frame = imath_ranged_rand(8, 10);
- series_play("140pe08", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
- series_play("140pe08s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140pe08", 0x500, 0, kCHANGE_ELMO_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 29:
- _val1 = 29;
- series_play("140pe11", 0x500, 0, 7, 4, 0, 100, 0, 0, 0, 3);
- series_play("140pe11s", 0x501, 0, -1, 4, 0, 100, 0, 0, 0, 3);
+ _elmoMode = 29;
+ Series::series_play("140pe11", 0x500, 0, kCHANGE_ELMO_ANIMATION, 4, 0, 100, 0, 0, 0, 3);
break;
case 31:
- series_play("140pe14", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
- series_play("140pe14s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ Series::series_play("140pe14", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 32:
series_load("141pe24");
terminateMachineAndNull(_series1);
- _val2 = 33;
+ _elmoShould = 33;
digi_preload("141_002");
digi_preload("141_003");
@@ -569,116 +552,104 @@ void Room141::daemon() {
break;
case 33:
- _val2 = 45;
- _val1 = 45;
- series_play("141pe24", 0xf00, 0, 7, 6, 0, 100, 0, 0, 0, 0);
+ _elmoShould = 45;
+ _elmoMode = 45;
+ series_play("141pe24", 0xf00, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
conv_resume_curr();
break;
case 34:
- _val2 = 35;
- series_play("140pe13", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
- series_play("140pe13s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ _elmoShould = 35;
+ series_play("140pe13", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 35:
- _val2 = 36;
- series_play("140pe13", 0x500, 0, 7, 120, 0, 100, 0, 0, 1, 1);
- series_play("140pe13s", 0x501, 0, -1, 120, 0, 100, 0, 0, 1, 1);
+ _elmoShould = 36;
+ Series::series_play("140pe13", 0x500, 0, kCHANGE_ELMO_ANIMATION, 120, 0, 100, 0, 0, 1, 1);
conv_resume_curr();
break;
case 36:
- _val2 = 27;
- series_play("140pe13", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
- series_play("140pe13s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ _elmoShould = 27;
+ Series::series_play("140pe13", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
conv_resume_curr();
break;
default:
- _val1 = 40;
- series_play("140pe16", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 40);
- series_play("140pe16s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ _elmoMode = 40;
+ Series::series_play("140pe16", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 40);
break;
}
break;
case 29:
- if (_val2 == 29) {
+ if (_elmoShould == 29) {
frame = imath_ranged_rand(4, 6);
- series_play("140pe11", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
- series_play("140pe11s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140pe11", 0x500, 0, kCHANGE_ELMO_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
} else {
- _val1 = 27;
- series_play("140pe11", 0x500, 0, 7, 6, 0, 100, 0, 0, 7, 9);
- series_play("140pe11s", 0x501, 0, -1, 6, 0, 100, 0, 0, 7, 9);
+ _elmoMode = 27;
+ Series::series_play("140pe11", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 7, 9);
}
break;
case 40:
- switch(_val2) {
+ switch(_elmoShould) {
case 38:
- series_play("140pe17", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
- series_play("140pe17s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140pe17", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
conv_resume_curr();
break;
case 40:
- series_play("140pe17", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 0);
- series_play("140pe17s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("140pe17", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 41:
frame = imath_ranged_rand(0, 4);
- series_play("140pe18", 0x500, 0, 7, 4, 0, 100, 0, 0, frame, frame);
- series_play("140pe18s", 0x501, 0, -1, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("140pe18", 0x500, 0, kCHANGE_ELMO_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 42:
- _val2 = 40;
+ _elmoShould = 40;
_trufflesShould = 6;
- series_play_with_breaks(PLAY5, "140pe20", 0x500, 7, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY5, "140pe20", 0x500, kCHANGE_ELMO_ANIMATION, 3, 6, 100, 0, 0);
break;
case 43:
- _val2 = 40;
- series_play("140pe19", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 7);
- series_play("140pe19s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 7);
+ _elmoShould = 40;
+ Series::series_play("140pe19", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 44:
- _val1 = _val2 = 27;
- series_play("140pe21", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 4);
- series_play("140pe21s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ _elmoMode = _elmoShould = 27;
+ Series::series_play("140pe21", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
default:
- _val2 = 27;
- series_play("140pe21", 0x500, 0, 7, 6, 0, 100, 0, 0, 0, 4);
- series_play("140pe21s", 0x501, 0, -1, 6, 0, 100, 0, 0, 0, 4);
+ _elmoShould = 27;
+ Series::series_play("140pe21", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
case 45:
- switch (_val2) {
+ switch (_elmoShould) {
case 45:
- series_play("141pe24", 0xf00, 0, 7, 10, 0, 100, 0, 0, 0, 3);
+ series_play("141pe24", 0xf00, 0, kCHANGE_ELMO_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
break;
case 46:
frame = imath_ranged_rand(0, 3);
- series_play("141pe24", 0xf00, 0, 7, 6, 0, 100, 0, 0, frame, frame);
+ series_play("141pe24", 0xf00, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
break;
case 47:
- _val2 = 45;
- series_play_with_breaks(PLAY4, "140pe25", 0x500, 7, 3, 6, 100, 0, 0);
+ _elmoShould = 45;
+ series_play_with_breaks(PLAY4, "140pe25", 0x500, kCHANGE_ELMO_ANIMATION, 3, 6, 100, 0, 0);
break;
case 48:
- _val2 = 49;
+ _elmoShould = 49;
digi_preload_stream_breaks(SERIES2);
series_stream_with_breaks(SERIES2, "141pe26", 6, 0x100, 7);
_G(flags)[V112] = 1;
@@ -817,7 +788,7 @@ void Room141::daemon() {
case 11:
_trufflesShould = 1;
- _val2 = 27;
+ _elmoShould = 27;
conv_resume_curr();
break;
@@ -826,7 +797,7 @@ void Room141::daemon() {
break;
case 13:
- _val2 = 15;
+ _elmoShould = 15;
conv_load_and_prepare("conv20", 22);
conv_export_value_curr(1, _G(flags)[V000] == 1002 ? 1 : 0);
conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 2);
@@ -945,33 +916,33 @@ void Room141::conv20() {
if (node == 4 && entry == 0) {
conv_resume_curr();
} else if (node == 15 && entry == 1) {
- _val2 = 43;
+ _elmoShould = 43;
} else if (node == 16) {
_trufflesShould = 5;
} else if (node != 0) {
if (node == 20 && (entry == 2 || entry == 3)) {
- _val2 = 40;
+ _elmoShould = 40;
conv_resume_curr();
} else if (node == 20 && entry == 1) {
- _val2 = 43;
+ _elmoShould = 43;
} else if (node == 20 && entry == 6) {
- _val2 = 38;
+ _elmoShould = 38;
} else if (node == 20 && entry == 7) {
_trufflesShould = 8;
- _val2 = 32;
+ _elmoShould = 32;
} else if (node == 20 && entry == 8) {
- _val2 = 45;
+ _elmoShould = 45;
conv_resume_curr();
} else if (node == 20 && entry == 9) {
- _val2 = 48;
+ _elmoShould = 48;
conv_resume_curr();
} else if (node == 6 && entry == 1) {
- _val2 = 27;
+ _elmoShould = 27;
conv_resume_curr();
} else if (node == 4 && (entry == 0 || entry == 4)) {
- _val2 = 25;
+ _elmoShould = 25;
} else if (node == 6 && entry == 3) {
- _val2 = 31;
+ _elmoShould = 31;
_val6 = 55;
conv_resume_curr();
} else if (node == 7 ||
@@ -982,7 +953,7 @@ void Room141::conv20() {
(node == 10 && entry == 1) ||
(node == 9)) {
digi_preload("140_003");
- _val2 = 24;
+ _elmoShould = 24;
conv_resume_curr();
} else if ((node == 4 && (entry == 2 || entry == 5 || entry == 10 || entry == 11)) ||
@@ -990,11 +961,11 @@ void Room141::conv20() {
(node == 18 && entry == 1) ||
(node == 19 && (entry == 2 || entry == 3))) {
_val6 = 55;
- _val2 = (_val1 == 27 || _val1 == 40) ? 27 : 18;
+ _elmoShould = (_elmoMode == 27 || _elmoMode == 40) ? 27 : 18;
conv_resume_curr();
} else {
- _val2 = (_val1 == 27 || _val1 == 40) ? 27 : 18;
+ _elmoShould = (_elmoMode == 27 || _elmoMode == 40) ? 27 : 18;
conv_resume_curr();
}
@@ -1006,10 +977,10 @@ void Room141::conv20() {
} else if (node == 20 && entry == 5) {
_val6 = 58;
} else if ((node == 6 && entry == 1) || (node == 8 && entry == 3)) {
- _val2 = 25;
+ _elmoShould = 25;
_val6 = 52;
} else if ((node == 4 && entry == 0) || (node == 20 && entry == 0)) {
- _val2 = 21;
+ _elmoShould = 21;
_val6 = 52;
} else {
_val6 = (node == 14) ? 55 : 52;
@@ -1023,27 +994,27 @@ void Room141::conv20() {
if (node != 0) {
if (node == 1 || node == 2) {
- _val2 = 20;
+ _elmoShould = 20;
digi_unload("20n01011");
digi_unload("20n01012");
digi_unload("20n01013");
digi_unload("20n01014");
} else if (node == 6 && entry == 1) {
- _val2 = 28;
+ _elmoShould = 28;
} else if (node == 20 && entry == 4) {
- _val2 = 28;
+ _elmoShould = 28;
} else if (node == 20 && (entry == 2 || entry == 3 || entry == 7)) {
- _val2 = 41;
+ _elmoShould = 41;
} else if (node == 20 && (entry == 8 || entry == 9)) {
- _val2 = 46;
+ _elmoShould = 46;
} else if (node == 13 || node == 16) {
- _val2 = 41;
+ _elmoShould = 41;
} else if (node == 11 && entry == 5) {
- _val2 = 20;
+ _elmoShould = 20;
} else if (node == 6 && (entry == 2 || entry == 3)) {
- _val2 = 28;
+ _elmoShould = 28;
} else {
- _val2 = (_val1 == 27) ? 28 : 20;
+ _elmoShould = (_elmoMode == 27) ? 28 : 20;
}
}
} else if (who == 1) {
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 79f0fb4db03..1a54a49ee3c 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -32,8 +32,8 @@ class Room141 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
- int _val1 = 0;
- int _val2 = 0;
+ int _elmoMode = 0;
+ int _elmoShould = 0;
int _trufflesMode = 0;
int _trufflesShould = 0;
int _val5 = 0;
Commit: e6399a2844a39483767189b842497a2039e8b829
https://github.com/scummvm/scummvm/commit/e6399a2844a39483767189b842497a2039e8b829
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of Wilbur daemon code in room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
engines/m4/burger/rooms/section1/room141.h
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 7d635637186..4ffad9f1fcd 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -30,7 +30,8 @@ namespace Rooms {
enum {
kCHANGE_TRUFFLES_ANIMATION = 6,
- kCHANGE_ELMO_ANIMATION = 7
+ kCHANGE_ELMO_ANIMATION = 7,
+ kCHANGE_WILBUR_ANIMATION = 8
};
static const char *SAID[][4] = {
@@ -190,12 +191,12 @@ void Room141::init() {
_series2 = series_play("141wave", 0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
_trufflesMode = 9;
_trufflesShould = 9;
- _val5 = 52;
- _val6 = 52;
+ _wilburMode = 52;
+ _wilburShould = 52;
} else {
- _val5 = 52;
- _val6 = 50;
+ _wilburMode = 52;
+ _wilburShould = 50;
if (_G(flags)[V112]) {
_trufflesMode = 1;
@@ -207,8 +208,8 @@ void Room141::init() {
}
}
- kernel_trigger_dispatch_now(8);
- kernel_trigger_dispatch_now(6);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
+ kernel_trigger_dispatch_now(kCHANGE_TRUFFLES_ANIMATION);
digi_play_loop("144_001", 3, 180);
}
@@ -234,7 +235,7 @@ void Room141::daemon() {
break;
case 5:
- _val6 = 52;
+ _wilburShould = 52;
player_set_commands_allowed(true);
break;
@@ -664,23 +665,23 @@ void Room141::daemon() {
}
break;
- case 8:
- switch (_val5) {
+ case kCHANGE_WILBUR_ANIMATION:
+ switch (_wilburMode) {
case 52:
- switch (_val6) {
+ switch (_wilburShould) {
case 50:
- _val6 = 51;
+ _wilburShould = 51;
_flag2 = 1;
digi_preload_stream_breaks(&SERIES4[0]);
series_stream_with_breaks(&SERIES4[0], _G(flags)[V000] == 1002 ? "141wi01" : "140wi01",
- 6, 0xf00, 8);
+ 6, 0xf00, kCHANGE_WILBUR_ANIMATION);
break;
case 51:
_flag2 = 0;
_series2 = series_play(_G(flags)[V000] == 1002 ? "141wave" : "140wave",
0xf00, 0, -1, 10, -1, 100, 0, 0, 0, 3);
- _val6 = 52;
+ _wilburShould = 52;
kernel_trigger_dispatch_now(8);
if (_G(flags)[V112])
@@ -689,19 +690,19 @@ void Room141::daemon() {
case 52:
series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
- 0x200, 0, 8, 30, 0, 100, 0, 0, 0, 0);
+ 0x200, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 0, 0);
break;
case 53:
frame = imath_ranged_rand(0, 4);
series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
- 0x200, 0, 8, 4, 0, 100, 0, 0, frame, frame);
+ 0x200, 0, kCHANGE_WILBUR_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 54:
- _val6 = 52;
+ _wilburShould = 52;
series_play(_G(flags)[V000] == 1002 ? "141wi02" : "140wi02",
- 0x200, 0, 8, 6, 0, 100, 0, 0, 9, 11);
+ 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 9, 11);
break;
case 55:
@@ -721,32 +722,32 @@ void Room141::daemon() {
break;
case 57:
- _val6 = 52;
- series_play_with_breaks(PLAY7, "141wi02", 0x200, 8, 2, 7, 100, 0, 0);
+ _wilburShould = 52;
+ series_play_with_breaks(PLAY7, "141wi02", 0x200, kCHANGE_WILBUR_ANIMATION, 2, 7, 100, 0, 0);
break;
case 58:
digi_preload("100_023");
- _val6 = 59;
- series_play("141wi05", 0x200, 0, 8, 6, 0, 100, 0, 0, 0, 12);
+ _wilburShould = 59;
+ series_play("141wi05", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 12);
break;
case 59:
- _val6 = 60;
- series_play("141wi05", 0x200, 0, 8, 6, 0, 100, 0, 0, 13, 18);
+ _wilburShould = 60;
+ series_play("141wi05", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 13, 18);
digi_play("100_023", 2, 255);
break;
case 60:
digi_stop(2);
- _val5 = _val6 = 58;
+ _wilburMode = _wilburShould = 58;
kernel_trigger_dispatch_now(8);
conv_resume_curr();
break;
case 62:
- _val6 = 52;
- series_play_with_breaks(PLAY6, "141wi06", 0x200, 8, 2, 6, 100, 0, 0);
+ _wilburShould = 52;
+ series_play_with_breaks(PLAY6, "141wi06", 0x200, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
default:
@@ -755,18 +756,18 @@ void Room141::daemon() {
break;
case 58:
- if (_val6 == 58) {
- series_play("141wi05", 0x200, 0, 8, 10, 0, 100, 0, 0, 18, 18);
+ if (_wilburShould == 58) {
+ series_play("141wi05", 0x200, 0, kCHANGE_WILBUR_ANIMATION, 10, 0, 100, 0, 0, 18, 18);
} else {
- _val5 = 61;
- series_play("141wi05", 0x200, 2, 8, 6, 0, 100, 0, 0, 0, 18);
+ _wilburMode = 61;
+ series_play("141wi05", 0x200, 2, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 18);
digi_play("100_023", 2, 255);
}
break;
case 61:
- _val5 = 52;
- kernel_trigger_dispatch_now(8);
+ _wilburMode = 52;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
digi_stop(2);
digi_unload("100_023");
break;
@@ -832,7 +833,7 @@ void Room141::daemon() {
break;
case 19:
- _val6 = 56;
+ _wilburShould = 56;
break;
case 20:
@@ -841,7 +842,7 @@ void Room141::daemon() {
case kWILBUR_SPEECH_STARTED:
_G(kernel).continue_handling_trigger = 1;
- _val6 = 53;
+ _wilburShould = 53;
break;
default:
@@ -858,7 +859,7 @@ void Room141::parser() {
} else if (player_said("whistle") && player_said_any("GEAR", "WILBUR")) {
player_set_commands_allowed(false);
- _val6 = 62;
+ _wilburShould = 62;
} else if (player_said("gear", "dock") || player_said("try to dock")) {
_trufflesShould = 12;
@@ -895,7 +896,7 @@ void Room141::parser() {
check_exit:
if (player_said("exit") || (player_said("hanlon's point") && lookFlag)) {
player_set_commands_allowed(false);
- _val6 = 55;
+ _wilburShould = 55;
} else {
return;
@@ -943,7 +944,7 @@ void Room141::conv20() {
_elmoShould = 25;
} else if (node == 6 && entry == 3) {
_elmoShould = 31;
- _val6 = 55;
+ _wilburShould = 55;
conv_resume_curr();
} else if (node == 7 ||
(node == 4 && (entry == 1 || entry == 6 || entry == 7 || entry == 9)) ||
@@ -960,7 +961,7 @@ void Room141::conv20() {
(node == 15 && entry == 5) ||
(node == 18 && entry == 1) ||
(node == 19 && (entry == 2 || entry == 3))) {
- _val6 = 55;
+ _wilburShould = 55;
_elmoShould = (_elmoMode == 27 || _elmoMode == 40) ? 27 : 18;
conv_resume_curr();
@@ -972,25 +973,25 @@ void Room141::conv20() {
}
} else if (who == 1) {
if (node == 20 && entry == 1) {
- _val6 = 57;
+ _wilburShould = 57;
conv_resume_curr();
} else if (node == 20 && entry == 5) {
- _val6 = 58;
+ _wilburShould = 58;
} else if ((node == 6 && entry == 1) || (node == 8 && entry == 3)) {
_elmoShould = 25;
- _val6 = 52;
+ _wilburShould = 52;
} else if ((node == 4 && entry == 0) || (node == 20 && entry == 0)) {
_elmoShould = 21;
- _val6 = 52;
+ _wilburShould = 52;
} else {
- _val6 = (node == 14) ? 55 : 52;
+ _wilburShould = (node == 14) ? 55 : 52;
conv_resume_curr();
}
}
} else if (conv_sound_to_play()) {
if (who <= 0) {
if (node == 20 && entry == 7)
- _val6 = 52;
+ _wilburShould = 52;
if (node != 0) {
if (node == 1 || node == 2) {
@@ -1018,7 +1019,7 @@ void Room141::conv20() {
}
}
} else if (who == 1) {
- _val6 = 53;
+ _wilburShould = 53;
}
digi_play(conv_sound_to_play(), 1, 255, 21, 140);
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room141.h
index 1a54a49ee3c..dce002491ca 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room141.h
@@ -36,8 +36,8 @@ private:
int _elmoShould = 0;
int _trufflesMode = 0;
int _trufflesShould = 0;
- int _val5 = 0;
- int _val6 = 0;
+ int _wilburMode = 0;
+ int _wilburShould = 0;
int _trufflesFrame = 0;
bool _flag1 = false;
bool _flag2 = false;
Commit: eac8fd892da2a716b61744fe48103c25e8689c30
https://github.com/scummvm/scummvm/commit/eac8fd892da2a716b61744fe48103c25e8689c30
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add missing conv_resume_curr calls in room 141
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 4ffad9f1fcd..974b995c2c2 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -473,6 +473,7 @@ void Room141::daemon() {
case 23:
_elmoShould = 18;
Series::series_play("140pe06", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 5, 7);
+ conv_resume_curr();
break;
case 24:
@@ -619,6 +620,7 @@ void Room141::daemon() {
case 43:
_elmoShould = 40;
Series::series_play("140pe19", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
+ conv_resume_curr();
break;
case 44:
Commit: 2544b08e7dd8106cfa0fe19ba76c31306c4e962f
https://github.com/scummvm/scummvm/commit/2544b08e7dd8106cfa0fe19ba76c31306c4e962f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix for Elmo deed conversation
Changed paths:
engines/m4/burger/rooms/section1/room141.cpp
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room141.cpp
index 974b995c2c2..5c57f7fb282 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room141.cpp
@@ -579,7 +579,7 @@ void Room141::daemon() {
default:
_elmoMode = 40;
- Series::series_play("140pe16", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 40);
+ Series::series_play("140pe16", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
@@ -629,7 +629,7 @@ void Room141::daemon() {
break;
default:
- _elmoShould = 27;
+ _elmoMode = 27;
Series::series_play("140pe21", 0x500, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
Commit: 371c881d53d6bf4d138d040d531ede8654184ddf
https://github.com/scummvm/scummvm/commit/371c881d53d6bf4d138d040d531ede8654184ddf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Finally solve the abyssal performance once and for all
The vmng_refresh_video originally called updateScreen, but
it turns out the original calls that method way too often.
And as a result, ScummVM performance was completely shot.
Moving the updateScreen call to the outer game loop finally
resolved the problem.
Changed paths:
engines/m4/core/rooms.cpp
engines/m4/gui/gui_vmng_core.cpp
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 50185fad778..20decc0402a 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -327,6 +327,10 @@ void Sections::game_control_cycle() {
_cameraShiftAmount -= screen->x1;
}
}
+
+ // Ensure the screen is updated
+ g_system->updateScreen();
+ g_system->delayMillis(10);
}
_GI().cancel_sentence();
diff --git a/engines/m4/gui/gui_vmng_core.cpp b/engines/m4/gui/gui_vmng_core.cpp
index 0e7c020a0d0..b31b67f5a2c 100644
--- a/engines/m4/gui/gui_vmng_core.cpp
+++ b/engines/m4/gui/gui_vmng_core.cpp
@@ -268,7 +268,6 @@ void vmng_refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x2,
const byte *srcP = srcBuffer->data + (y1 * srcBuffer->stride) + x1;
g_system->copyRectToScreen(srcP, srcBuffer->stride, scrnX, scrnY,
x2 - x1 + 1, y2 - y1 + 1);
- g_system->updateScreen();
}
ScreenContext *ExtractScreen(void *scrnContent, int32 status) {
Commit: 9a48a137da1803e9d0529fa43abf3ef664971a7d
https://github.com/scummvm/scummvm/commit/9a48a137da1803e9d0529fa43abf3ef664971a7d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further removal of redundant updateScreen calls
Changed paths:
engines/m4/graphics/gr_pal.cpp
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 71d3c048ab0..ef9af255b6f 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -80,7 +80,6 @@ void gr_pal_set_RGB8(RGB8 *entry, int r, int g, int b) {
void gr_pal_set_range(RGB8 *pal, int first_color, int num_colors) {
g_system->getPaletteManager()->setPalette((const byte *)pal + first_color * 3,
first_color, num_colors);
- g_system->updateScreen();
}
void gr_pal_set_range(int first_color, int num_colors) {
@@ -89,7 +88,6 @@ void gr_pal_set_range(int first_color, int num_colors) {
void gr_pal_set_entry(int32 index, RGB8 *entry) {
g_system->getPaletteManager()->setPalette((const byte *)entry, index, 1);
- g_system->updateScreen();
}
void gr_pal_clear_range(RGB8 *palette, int first_color, int last_color) {
Commit: 3625b6610961a1f08d7205d43a52e036f86f32a3
https://github.com/scummvm/scummvm/commit/3625b6610961a1f08d7205d43a52e036f86f32a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix going to shack backyard
Changed paths:
engines/m4/burger/rooms/section3/room302.cpp
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index 83a5a63c5d5..cca86eab871 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -526,7 +526,7 @@ void Room302::daemon() {
}
void Room302::pre_parser() {
- if (player_said_any("BACKYARD", "BACKYARD ") && player_said_any("LOOK AT", "GEAR", "ENTER"))
+ if (player_said_any("BACKYARD", "BACKYARD ") && !player_said_any("LOOK AT", "GEAR", "ENTER"))
player_set_facing_hotspot();
}
Commit: a62f24cc92571ceec0b54bd534080d00381e475a
https://github.com/scummvm/scummvm/commit/a62f24cc92571ceec0b54bd534080d00381e475a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix picking up moonshine jug
Changed paths:
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/burger/rooms/section3/room303.h
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 5e82b3b7fd8..2758aec53b6 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -508,7 +508,7 @@ void Room303::doDaemon(int trigger) {
}
_val6 = _G(flags)[V122] ? 33 : 31;
- _val9 = 10;
+ _triggers[1] = 10;
series_play_with_breaks(PLAY1, "303wi4b", 0x100, 1, 3);
break;
@@ -520,7 +520,7 @@ void Room303::doDaemon(int trigger) {
kernel_trigger_dispatch_now(11);
_val6 = 34;
- _val9 = 10;
+ _triggers[1] = 10;
_val8 = (_val5 > 0 && _val5 < 15) ? 28 : 29;
series_play_with_breaks(PLAY3, "303wi4b", 0x100, 1, 3);
break;
@@ -531,8 +531,8 @@ void Room303::doDaemon(int trigger) {
kernel_trigger_dispatch_now(11);
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
+ _triggers[1] = 10;
_val6 = 34;
- _val9 = 10;
series_play_with_breaks(PLAY4, "303wi4a", 0x100, 1, 3);
break;
@@ -543,7 +543,7 @@ void Room303::doDaemon(int trigger) {
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
_val6 = _G(flags)[V122] ? 32 : 30;
- _val9 = 10;
+ _triggers[1] = 10;
series_play_with_breaks(PLAY5, "303wi4a", 0x100, 1, 3);
break;
diff --git a/engines/m4/burger/rooms/section3/room303.h b/engines/m4/burger/rooms/section3/room303.h
index fc797e3f717..4eba3ae9870 100644
--- a/engines/m4/burger/rooms/section3/room303.h
+++ b/engines/m4/burger/rooms/section3/room303.h
@@ -62,7 +62,6 @@ private:
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
- int _val9 = 0;
void frontYard();
void doDaemon(int trigger);
Commit: 60636a5f721a021f71991270dfcdb4d9f1109aa3
https://github.com/scummvm/scummvm/commit/60636a5f721a021f71991270dfcdb4d9f1109aa3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for distilling carrot juice
Changed paths:
engines/m4/burger/rooms/section3/room303.cpp
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 2758aec53b6..645032c39ff 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -141,7 +141,7 @@ void Room303::init() {
if (_G(flags)[V117]) {
_series2 = series_load("303ft_on");
- _series3 = series_play("303ft_on", 0xd00);
+ _series3 = series_play("303ft_on", 0xd00, 0, -1, 0, -1);
_val3 = 2;
} else {
_series2 = series_load("303ft");
@@ -643,10 +643,10 @@ void Room303::pre_parser() {
player_hotspot_walk_override(409, 312, 3, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else {
- if (player_said("FRONT YARD") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
+ if (player_said("FRONT YARD") && !player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
player_set_facing_hotspot();
- if (player_said("FRONT YARD ") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
+ if (player_said("FRONT YARD ") && !player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
player_set_facing_hotspot();
}
}
Commit: 821e4b2140494e835c22c2267ce6e85f4f3f5a01
https://github.com/scummvm/scummvm/commit/821e4b2140494e835c22c2267ce6e85f4f3f5a01
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix clearing long inventory item names
Changed paths:
engines/m4/burger/gui/interface.cpp
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index 36b1dc63010..a54320e3e61 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -84,7 +84,7 @@ void Interface::show() {
void Interface::setup() {
_interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
_inventory = new GUI::Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
- _textField = new TextField(200, 1, 450, 21);
+ _textField = new TextField(200, 1, 470, 21);
_btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5, INTERFACE_SPRITES);
_btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8, INTERFACE_SPRITES);
_btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2, INTERFACE_SPRITES);
Commit: db2f883b7a4c762667fc0240e26231810358de26
https://github.com/scummvm/scummvm/commit/db2f883b7a4c762667fc0240e26231810358de26
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cellar fixes
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section3/room305.cpp
engines/m4/burger/rooms/section3/section3.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 6fc4070ad1f..f7be99d14d9 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -247,7 +247,7 @@ void BurgerEngine::global_daemon() {
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10012;
- series_play_with_breaks(PLAY_BREAKS2, "999wbj", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
+ series_play_with_breaks(PLAY_BREAKS2, "999wcj", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10005:
@@ -643,7 +643,7 @@ void BurgerEngine::testDone3() {
_G(flags)[V121] = 3003;
_G(flags)[V122] = 1;
_G(flags)[V123] = 1;
- _G(flags)[V124] = 1;
+ _G(flags)[kDrunkCarrotJuice] = 1;
_G(flags)[V129] = 1;
_G(flags)[V130] = 1;
_G(flags)[V134] = 1;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index b204f9b40c5..4d1b29e9563 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -260,13 +260,13 @@ void Flags::reset3() {
inv_move_object("BURGER MORSEL", NOWHERE);
(*this)[V117] = 0;
- (*this)[V124] = 0;
+ (*this)[kDrunkCarrotJuice] = 0;
(*this)[V118] = 3001;
(*this)[V119] = 0;
(*this)[V120] = 0;
(*this)[V121] = 3001;
(*this)[V122] = 0;
- (*this)[V124] = 0;
+ (*this)[kDrunkCarrotJuice] = 0;
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 8c7bbd2368f..261403561d2 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -157,7 +157,7 @@ enum {
V121 = 121,
V122 = 122,
V123 = 123,
- V124 = 124,
+ kDrunkCarrotJuice = 124,
V125 = 125,
V126 = 126,
V127 = 127,
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 2f5bdd62f47..1575ad60488 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -152,18 +152,47 @@ void Mine::preload() {
_G(player).shadow_type = 0;
}
-void Mine::daemon() {
- switch (_G(kernel).trigger) {
- case 301: {
- const EntranceInfo &ei = ENTRANCE_INFO[_presentSceneID][_entranceDoor];
- ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
+void Mine::init() {
+ setupDigi();
+
+ if (_G(flags)[V111]) {
+ for (int i = 0; i < 6; ++i)
+ digi_preload(Common::String::format("300t001%c", 'a' + i));
+ }
+
+ _fade_down_rect_active = false;
+ set_palette_brightness(30);
+ _G(kernel).call_daemon_every_loop = true;
+ _mineCtr = 0;
+
+ switch (_G(game).previous_room) {
+ case KERNEL_RESTORING_GAME:
+ player_set_commands_allowed(true);
+ break;
+
+ default:
+ player_set_commands_allowed(false);
+ ws_demand_location(-50, 200);
+ kernel_trigger_dispatch_now(301);
break;
}
+ const int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
+ _mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
+ _presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
+}
+
+void Mine::daemon() {
+ switch (_G(kernel).trigger) {
+ case 301:
case 302: {
- const EntranceInfo &ei = ENTRANCE_INFO[_mineRoomInfo.roomNumber][_entranceDoor];
- ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
+ const EntranceInfo &ei = ENTRANCE_INFO[_presentSceneID][_entranceDoor];
+
+ if (_G(kernel).trigger == 301)
+ ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
+
player_set_commands_allowed(false);
+ ws_walk(ei.home_x, ei.home_y, nullptr, 303, ei.home_facing);
break;
}
@@ -329,30 +358,30 @@ void Mine::daemon() {
}
break;
- case kCALLED_EACH_LOOP:
- if (_fade_down_rect_active) {
- player_update_info();
-
- if (_G(player_info).x >= _fade_down_rect.x1 &&
- _G(player_info).x <= _fade_down_rect.x2 &&
- _G(player_info).y >= _fade_down_rect.y1 &&
- _G(player_info).y <= _fade_down_rect.y2) {
- if (player_commands_allowed()) {
- pal_fade_set_start(100);
- pal_fade_init(_G(kernel).first_fade, 255, 0, 40, -1);
- }
-
- player_set_commands_allowed(false);
- }
- }
- break;
-
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
+ case kCALLED_EACH_LOOP:
+ if (_fade_down_rect_active) {
+ player_update_info();
+
+ if (_G(player_info).x >= _fade_down_rect.x1 &&
+ _G(player_info).x <= _fade_down_rect.x2 &&
+ _G(player_info).y >= _fade_down_rect.y1 &&
+ _G(player_info).y <= _fade_down_rect.y2) {
+ if (player_commands_allowed()) {
+ pal_fade_set_start(100);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 40, -1);
+ }
+
+ player_set_commands_allowed(false);
+ }
+ }
+ break;
+
default:
_G(kernel).continue_handling_trigger = true;
break;
@@ -361,6 +390,7 @@ void Mine::daemon() {
void Mine::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
+ _fade_down_rect_active = false;
if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
if (_G(click_y) > 300)
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index 169eeba51e1..b301f0805d4 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -121,6 +121,7 @@ public:
virtual ~Mine() {}
void preload() override;
+ void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index 6ff37181ba0..5458e953f40 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -187,7 +187,7 @@ void Room305::daemon() {
break;
case 108:
- mine_travel_link(FRONT);
+ mine_travel_link(BACK);
break;
default:
@@ -220,7 +220,7 @@ void Room305::parser() {
} else if (player_said("ENTER", "MINE") || player_said("ENTER", "DARKNESS")) {
player_set_commands_allowed(false);
- if (!_G(flags)[V124]) {
+ if (!_G(flags)[kDrunkCarrotJuice]) {
player_set_commands_allowed(true);
wilbur_speech("305w004");
} else {
@@ -229,7 +229,7 @@ void Room305::parser() {
if (_G(flags)[V137]) {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
- wilbur_speech("305w005");
+ wilbur_speech("305w005", kCHANGE_WILBUR_ANIMATION);
}
}
} else if (player_said("DISTILLED CARROT JUICE", "GENERATOR")) {
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index 0a484987ab3..c80f9db8b1a 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -103,7 +103,7 @@ void Section3::daemon() {
switch (_G(wilbur_should)) {
case 3001:
player_update_info();
- _G(flags)[V124] = 1;
+ _G(flags)[kDrunkCarrotJuice] = 1;
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 3002;
Commit: 04991494dc0a1668ed0e1ca1554c1673b62d40fe
https://github.com/scummvm/scummvm/commit/04991494dc0a1668ed0e1ca1554c1673b62d40fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix entering mine from cellar
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/burger/rooms/section3/room305.cpp
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 261403561d2..ee5a0b8f0f6 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -170,7 +170,7 @@ enum {
V134 = 134,
V135 = 135,
V136 = 136,
- V137 = 137,
+ kEnteredMine = 137,
V138 = 138,
V139 = 139,
V140 = 140,
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 1575ad60488..81eaced2910 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -132,6 +132,8 @@ const Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 0, 639, 270 // 319
};
+int16 Mine::_entranceDoor;
+
void MineRoom::clear() {
roomNumber = 0;
scene_id = 0;
@@ -165,6 +167,10 @@ void Mine::init() {
_G(kernel).call_daemon_every_loop = true;
_mineCtr = 0;
+ const int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
+ _mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
+ _presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
+
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
@@ -176,10 +182,6 @@ void Mine::init() {
kernel_trigger_dispatch_now(301);
break;
}
-
- const int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
- _mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
- _presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
}
void Mine::daemon() {
@@ -209,8 +211,8 @@ void Mine::daemon() {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(game).room_id != 305) {
- if (!_G(flags)[V137]) {
- _G(flags)[V137] = 1;
+ if (!_G(flags)[kEnteredMine]) {
+ _G(flags)[kEnteredMine] = 1;
_G(wilbur_should) = _G(flags)[V111] ? 402 : 401;
} else if (!imath_rand_bool(3)) {
_G(wilbur_should) = 10002;
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index b301f0805d4..b1f0cd7ec6a 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -96,7 +96,7 @@ private:
int _mineCtr = 0;
int16 _presentSceneID = 0;
- int16 _entranceDoor = FRONT;
+ static int16 _entranceDoor; // Shared between cellar and mine room classes
MineRoom _mineRoomInfo;
bool _fade_down_rect_active = false; // True if a fade down should occurr when walker in the fade_down_rect
Rectangle _fade_down_rect; // If the walker is in his rectum and its active, turn off the lights
diff --git a/engines/m4/burger/rooms/section3/room305.cpp b/engines/m4/burger/rooms/section3/room305.cpp
index 5458e953f40..ebcf08fbbf7 100644
--- a/engines/m4/burger/rooms/section3/room305.cpp
+++ b/engines/m4/burger/rooms/section3/room305.cpp
@@ -72,7 +72,7 @@ void Room305::init() {
pal_cycle_init(96, 111, 6, -1, -1);
_G(flags)[kMineRoomIndex] = 0;
- if (_G(flags)[V134] && !_G(flags)[V135] && !_G(flags)[V137]) {
+ if (_G(flags)[V134] && !_G(flags)[V135] && !_G(flags)[kEnteredMine]) {
hotspot_set_active("DARKNESS", true);
hotspot_set_active("MINE", false);
} else {
@@ -178,7 +178,7 @@ void Room305::daemon() {
case 106:
_G(wilbur_should) = 10001;
- wilbur_speech(_G(flags)[V137] ? "305w013" : "305w012", kCHANGE_WILBUR_ANIMATION);
+ wilbur_speech(_G(flags)[kEnteredMine] ? "305w013" : "305w012", kCHANGE_WILBUR_ANIMATION);
break;
case 107:
@@ -226,7 +226,7 @@ void Room305::parser() {
} else {
_G(wilbur_should) = 108;
- if (_G(flags)[V137]) {
+ if (_G(flags)[kEnteredMine]) {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("305w005", kCHANGE_WILBUR_ANIMATION);
Commit: 82231ce3e6cf00c3a7c90d99d0acb295c5fe3f5b
https://github.com/scummvm/scummvm/commit/82231ce3e6cf00c3a7c90d99d0acb295c5fe3f5b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix movement through mine
Changed paths:
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/mine.h
engines/m4/core/rooms.cpp
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 81eaced2910..12b33b35962 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -322,6 +322,7 @@ void Mine::daemon() {
default:
if (!_G(flags)[V111] && _G(flags)[V144]) {
+ // Truffles is too far away
wilbur_speech("300w061");
} else if (!_G(flags)[V148]) {
_G(flags)[V148] = 1;
@@ -345,16 +346,20 @@ void Mine::daemon() {
default:
break;
}
+
+ _previousDistance = _treasureDistance;
} else {
_treasureDistance = getTreasureDistance();
- if (_treasureDistance < _treasureThreshold) {
+ if (_treasureDistance < _previousDistance) {
wilbur_speech("300w068");
- } else if (_treasureDistance == _treasureThreshold) {
+ } else if (_treasureDistance == _previousDistance) {
wilbur_speech("300w067");
} else {
wilbur_speech("300w066");
}
+
+ _previousDistance = _treasureDistance;
}
break;
}
diff --git a/engines/m4/burger/rooms/section3/mine.h b/engines/m4/burger/rooms/section3/mine.h
index b1f0cd7ec6a..2832f4bc745 100644
--- a/engines/m4/burger/rooms/section3/mine.h
+++ b/engines/m4/burger/rooms/section3/mine.h
@@ -104,7 +104,7 @@ private:
int _random1 = 0;
int _random2 = 0;
int _treasureDistance = 0;
- int _treasureThreshold = 0;
+ int _previousDistance = 0;
int getTreasureDistance() const;
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 20decc0402a..2b88fce6854 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -269,7 +269,7 @@ void Sections::get_walker() {
void Sections::game_control_cycle() {
int32 status;
- while (_G(game).new_room == _G(game).room_id && _G(kernel).going) {
+ while (_G(game).new_room == _G(game).room_id && _G(kernel).going && !_G(kernel).force_restart) {
krn_pal_game_task();
ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &status);
Commit: 111013aaefc7cd2f84879820169d3c2b89bad755
https://github.com/scummvm/scummvm/commit/111013aaefc7cd2f84879820169d3c2b89bad755
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for Truffles animations
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section3/mine.cpp
engines/m4/burger/rooms/section3/room302.cpp
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
engines/m4/burger/rooms/section3/section3.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index f7be99d14d9..62f39c638a0 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -632,7 +632,7 @@ void BurgerEngine::testDone3() {
_G(flags)[V108] = 1;
_G(flags)[V109] = 1;
_G(flags)[V110] = 1;
- _G(flags)[V111] = 1;
+ _G(flags)[kTrufflesInMine] = 1;
_G(flags)[V112] = 1;
_G(flags)[V115] = 5;
_G(flags)[V116] = 1;
@@ -648,7 +648,7 @@ void BurgerEngine::testDone3() {
_G(flags)[V130] = 1;
_G(flags)[V134] = 1;
_G(flags)[V140] = 1;
- _G(flags)[V144] = 1;
+ _G(flags)[kTrufflesRanAway] = 1;
_G(flags)[V145] = 1;
}
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 4d1b29e9563..0f9851c96aa 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -256,7 +256,7 @@ void Flags::reset3() {
}
(*this)[V107] = 0;
- (*this)[V111] = 0;
+ (*this)[kTrufflesInMine] = 0;
inv_move_object("BURGER MORSEL", NOWHERE);
(*this)[V117] = 0;
@@ -276,7 +276,7 @@ void Flags::reset3() {
(*this)[V134] = 0;
(*this)[V140] = 0;
- (*this)[V144] = 0;
+ (*this)[kTrufflesRanAway] = 0;
(*this)[V145] = 0;
}
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index ee5a0b8f0f6..4a4d83388b7 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -144,7 +144,7 @@ enum {
V108 = 108,
V109 = 109,
V110 = 110,
- V111 = 111,
+ kTrufflesInMine = 111,
V112 = 112,
V113 = 113,
V114 = 114,
@@ -177,7 +177,7 @@ enum {
V141 = 141,
V142 = 142,
V143 = 143,
- V144 = 144,
+ kTrufflesRanAway = 144,
V145 = 145,
V146 = 146,
V147 = 147,
diff --git a/engines/m4/burger/rooms/section3/mine.cpp b/engines/m4/burger/rooms/section3/mine.cpp
index 12b33b35962..94e749ab33d 100644
--- a/engines/m4/burger/rooms/section3/mine.cpp
+++ b/engines/m4/burger/rooms/section3/mine.cpp
@@ -157,7 +157,7 @@ void Mine::preload() {
void Mine::init() {
setupDigi();
- if (_G(flags)[V111]) {
+ if (_G(flags)[kTrufflesInMine]) {
for (int i = 0; i < 6; ++i)
digi_preload(Common::String::format("300t001%c", 'a' + i));
}
@@ -213,10 +213,10 @@ void Mine::daemon() {
} else if (_G(game).room_id != 305) {
if (!_G(flags)[kEnteredMine]) {
_G(flags)[kEnteredMine] = 1;
- _G(wilbur_should) = _G(flags)[V111] ? 402 : 401;
+ _G(wilbur_should) = _G(flags)[kTrufflesInMine] ? 402 : 401;
} else if (!imath_rand_bool(3)) {
_G(wilbur_should) = 10002;
- } else if (!_G(flags)[V111]) {
+ } else if (!_G(flags)[kTrufflesInMine]) {
_G(wilbur_should) = 404;
} else {
_G(wilbur_should) = inv_player_has("WHISTLE") ? 406 : 405;
@@ -244,7 +244,7 @@ void Mine::daemon() {
break;
default:
- if (_G(flags)[V111] && !_G(flags)[V144])
+ if (_G(flags)[kTrufflesInMine] && !_G(flags)[kTrufflesRanAway])
kernel_timing_trigger(15, 305);
break;
}
@@ -306,22 +306,22 @@ void Mine::daemon() {
switch (_G(game).room_id) {
case 305:
- if (_G(flags)[V111]) {
+ if (_G(flags)[kTrufflesInMine]) {
_G(flags)[V002] = 1;
wilbur_speech("300w060");
}
break;
case 310:
- if (_G(flags)[V111] && !_G(flags)[V144]) {
- _G(flags)[V144] = 1;
+ if (_G(flags)[kTrufflesInMine] && !_G(flags)[kTrufflesRanAway]) {
+ _G(flags)[kTrufflesRanAway] = 1;
} else {
wilbur_speech("300w069");
}
break;
default:
- if (!_G(flags)[V111] && _G(flags)[V144]) {
+ if (!_G(flags)[kTrufflesInMine] && _G(flags)[kTrufflesRanAway]) {
// Truffles is too far away
wilbur_speech("300w061");
} else if (!_G(flags)[V148]) {
diff --git a/engines/m4/burger/rooms/section3/room302.cpp b/engines/m4/burger/rooms/section3/room302.cpp
index cca86eab871..3d82f190f1f 100644
--- a/engines/m4/burger/rooms/section3/room302.cpp
+++ b/engines/m4/burger/rooms/section3/room302.cpp
@@ -170,7 +170,7 @@ Room302::Room302() : Section3Room() {
void Room302::init() {
setupDigi();
- if (!_G(flags)[V111]) {
+ if (!_G(flags)[kTrufflesInMine]) {
static const char *NAMES[12] = {
"302t001a", "302t001b", "302t001c", "302t001d", "302t001e",
"302t001f", "302t001g", "302t001h", "302t002", "302t003",
@@ -183,7 +183,7 @@ void Room302::init() {
player_set_commands_allowed(false);
pal_cycle_init(112, 127, 6, -1, -1);
- if (_G(flags)[V111]) {
+ if (_G(flags)[kTrufflesInMine]) {
hotspot_set_active("TRUFFLES", false);
} else if (_G(flags)[V112]) {
series_load("302tr01");
@@ -350,7 +350,7 @@ void Room302::daemon() {
case 28:
hotspot_set_active("truffles", false);
- _G(flags)[V111] = 1;
+ _G(flags)[kTrufflesInMine] = 1;
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
series_play_with_breaks(PLAY8, "302tr01", 0x900, -1, 3);
@@ -507,7 +507,7 @@ void Room302::daemon() {
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
- if (_G(flags)[V111]) {
+ if (_G(flags)[kTrufflesInMine]) {
_G(flags)[V002] = 1;
wilbur_speech("300w059");
}
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 7281d420122..3cd423e1e16 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -26,6 +26,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_TRUFFLES_ANIMATION = 3
+};
+
const char *Room310::SAID[][4] = {
{ "TUNNEL", "310w002", "310w003", nullptr },
{ "PROBE", "310w004", nullptr, nullptr },
@@ -55,23 +59,28 @@ const seriesPlayBreak Room310::PLAY2[] = {
{ 10, 16, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 17, 21, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 2, 0, -1, 2048, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
const seriesPlayBreak Room310::PLAY3[] = {
{ 15, 29, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
const seriesPlayBreak Room310::PLAY4[] = {
{ 6, -1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
const seriesPlayBreak Room310::PLAY5[] = {
{ 30, 36, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 37, 51, "300_002", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
const seriesPlayBreak Room310::PLAY6[] = {
{ 52, 56, "300_001", 2, 255, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
int32 Room310::_state1;
@@ -90,10 +99,10 @@ void Room310::init() {
_val1 = 7;
kernel_trigger_dispatch_now(1);
- if (!_G(flags)[V144] && _G(flags)[V111]) {
+ if (!_G(flags)[kTrufflesRanAway] && _G(flags)[kTrufflesInMine]) {
_walk1 = intr_add_no_walk_rect(360, 265, 515, 293, 359, 294);
- _val2 = 12;
- kernel_trigger_dispatch_now(3);
+ _trufflesShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_TRUFFLES_ANIMATION);
} else {
hotspot_set_active("TRUFFLES", false);
}
@@ -155,19 +164,19 @@ void Room310::daemon() {
case 2:
_series1.terminate();
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_TRUFFLES_ANIMATION);
break;
- case 3:
- switch (_val2) {
+ case kCHANGE_TRUFFLES_ANIMATION:
+ switch (_trufflesShould) {
case 12:
- _series1.show("310tr01", 0xb00);
- _val2 = (imath_ranged_rand(1, 4) == 1) ? 13 : 12;
+ _series1.show("310tr01", 0xb00, 0, -1, -1, 18);
+ _trufflesShould = (imath_ranged_rand(1, 4) == 1) ? 13 : 12;
kernel_timing_trigger(30, 2);
break;
case 13:
- _val2 = 12;
+ _trufflesShould = 12;
_val1 = 8;
series_play_with_breaks(PLAY1, "310tr01", 0xb00, 3, 3);
_state1 = imath_ranged_rand(1, 4);
@@ -177,16 +186,23 @@ void Room310::daemon() {
term_message("Truffles goes to snarl at Wilbur!");
_G(flags)[V145] = 1;
_G(wilbur_should) = 4;
- _val2 = 15;
+ _trufflesShould = 15;
series_play_with_breaks(PLAY2, "310tr02", 0xb00, 3, 3);
_state1 = imath_ranged_rand(1, 4);
break;
case 15:
player_set_commands_allowed(true);
- wilbur_speech(_G(flags)[V142] ? "310w007" : "310w006");
- _val2 = 12;
- kernel_trigger_dispatch_now(12);
+
+ if (!_G(flags)[V142]) {
+ _G(flags)[V142] = 1;
+ wilbur_speech("310w006");
+ } else {
+ wilbur_speech("310w007");
+ }
+
+ _trufflesShould = 12;
+ kernel_trigger_dispatch_now(kCHANGE_TRUFFLES_ANIMATION);
break;
case 16:
@@ -194,7 +210,7 @@ void Room310::daemon() {
hotspot_set_active("TRUFFLES", false);
hotspot_set_active("GROUND ", false);
intr_remove_no_walk_rect(_walk1);
- series_play("310tr04", 0xb00);
+ series_play("310tr03", 0xb00);
break;
default:
@@ -203,7 +219,7 @@ void Room310::daemon() {
break;
case 10008:
- _val2 = 16;
+ _trufflesShould = 16;
break;
case kCHANGE_WILBUR_ANIMATION:
@@ -275,11 +291,11 @@ void Room310::daemon() {
void Room310::pre_parser() {
Mine::pre_parser();
- if (player_said("GEAR", "PROBE") && (!_G(flags)[V111] || _G(flags)[V144] == 1)) {
+ if (player_said("GEAR", "PROBE") && (!_G(flags)[kTrufflesInMine] || _G(flags)[kTrufflesRanAway] == 1)) {
_G(wilbur_should) = 6;
player_hotspot_walk_override(293, 288, 3, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
- } else if (!_G(flags)[V144]) {
+ } else if (!_G(flags)[kTrufflesRanAway]) {
HotSpotRec *hotspot = hotspot_which(_G(click_x), _G(click_y));
assert(hotspot);
@@ -300,12 +316,12 @@ void Room310::parser() {
// Already handled
} else if (player_said("GEAR", "PROBE") || player_said("TAKE", "PROBE")) {
term_message("truffles in mine %d truffles ran away %d",
- _G(flags)[V111], _G(flags)[V144]);
+ _G(flags)[kTrufflesInMine], _G(flags)[kTrufflesRanAway]);
- if (_G(flags)[V111] == 1 && !_G(flags)[V144]) {
+ if (_G(flags)[kTrufflesInMine] == 1 && !_G(flags)[kTrufflesRanAway]) {
term_message("Wilbur pissed off truffles!");
player_set_commands_allowed(false);
- _val2 = 14;
+ _trufflesShould = 14;
}
} else if (player_said("LOOK AT", "TRUFFLES")) {
_G(wilbur_should) = 5;
@@ -313,6 +329,8 @@ void Room310::parser() {
} else {
return;
}
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index e4e60fd0a4c..8b506d45674 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -42,7 +42,7 @@ private:
machine *_series2 = nullptr;
noWalkRect *_walk1 = nullptr;
int _val1 = 0;
- int _val2 = 0;
+ int _trufflesShould = 0;
protected:
const char *getDigi() override {
diff --git a/engines/m4/burger/rooms/section3/section3.cpp b/engines/m4/burger/rooms/section3/section3.cpp
index c80f9db8b1a..940112060eb 100644
--- a/engines/m4/burger/rooms/section3/section3.cpp
+++ b/engines/m4/burger/rooms/section3/section3.cpp
@@ -95,7 +95,7 @@ void Section3::daemon() {
break;
case 10008:
- if (!_G(flags)[V111])
+ if (!_G(flags)[kTrufflesInMine])
kernel_timing_trigger(15, 3008);
break;
@@ -127,7 +127,7 @@ void Section3::daemon() {
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
- if (_G(flags)[V111]) {
+ if (_G(flags)[kTrufflesInMine]) {
_G(flags)[V002] = 1;
wilbur_speech("300w060");
}
Commit: 4b0c945abea9ee3c6a91b506a68b6e9b055dc6cb
https://github.com/scummvm/scummvm/commit/4b0c945abea9ee3c6a91b506a68b6e9b055dc6cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Test 3 is now completeable
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section3/room310.cpp
engines/m4/burger/rooms/section3/room310.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 62f39c638a0..51a2200a7f1 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -743,7 +743,7 @@ void BurgerEngine::wilburTeleported() {
case 5:
if (_G(flags)[V185] < MAX_INT)
- _G(flags)[V100]++;
+ _G(flags)[V185]++;
break;
case 6:
diff --git a/engines/m4/burger/rooms/section3/room310.cpp b/engines/m4/burger/rooms/section3/room310.cpp
index 3cd423e1e16..5df956fc56d 100644
--- a/engines/m4/burger/rooms/section3/room310.cpp
+++ b/engines/m4/burger/rooms/section3/room310.cpp
@@ -27,6 +27,7 @@ namespace Burger {
namespace Rooms {
enum {
+ kCHANGE_PROBE_ANIMATION = 1,
kCHANGE_TRUFFLES_ANIMATION = 3
};
@@ -96,8 +97,8 @@ void Room310::init() {
set_palette_brightness(48, 127, 30);
digi_preload("601_007");
- _val1 = 7;
- kernel_trigger_dispatch_now(1);
+ _probeShould = 7;
+ kernel_trigger_dispatch_now(kCHANGE_PROBE_ANIMATION);
if (!_G(flags)[kTrufflesRanAway] && _G(flags)[kTrufflesInMine]) {
_walk1 = intr_add_no_walk_rect(360, 265, 515, 293, 359, 294);
@@ -130,31 +131,33 @@ void Room310::daemon() {
_G(kernel).continue_handling_trigger = false;
switch (_G(kernel).trigger) {
- case 1:
- switch (_val1) {
+ case kCHANGE_PROBE_ANIMATION:
+ switch (_probeShould) {
case 7:
_series2 = series_play("310prob", 0xb00, 0, -1, 6, -1, 100, 0, 0, 0, 17);
break;
case 8:
- _val1 = 7;
+ _probeShould = 7;
terminateMachineAndNull(_series2);
- series_play_with_breaks(PLAY3, "310prob", 0xb00, 1, 2);
+ series_play_with_breaks(PLAY3, "310prob", 0xb00, kCHANGE_PROBE_ANIMATION, 2);
break;
case 9:
- _val1 = 10;
+ _probeShould = 10;
terminateMachineAndNull(_series2);
- series_play_with_breaks(PLAY5, "310prob", 0xb00, 1, 2);
+ series_play_with_breaks(PLAY5, "310prob", 0xb00, kCHANGE_PROBE_ANIMATION, 2);
break;
case 10:
- _val1 = 11;
- series_play_with_breaks(PLAY6, "310prob", 0xb00, 1, 2, 3);
+ _probeShould = 11;
+ series_play_with_breaks(PLAY6, "310prob", 0xb00, kCHANGE_PROBE_ANIMATION, 2, 3);
break;
case 11:
series_show("310prob", 0xb00, 0, -1, -1, 60);
+ _G(wilbur_should) = 2;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
@@ -177,7 +180,7 @@ void Room310::daemon() {
case 13:
_trufflesShould = 12;
- _val1 = 8;
+ _probeShould = 8;
series_play_with_breaks(PLAY1, "310tr01", 0xb00, 3, 3);
_state1 = imath_ranged_rand(1, 4);
break;
@@ -227,8 +230,8 @@ void Room310::daemon() {
case 1:
ws_hide_walker();
_general.play("310wi01", 0xb00, 16, -1, 6, 0, 100, 0, 0, 0, 5);
- _val1 = 9;
- kernel_trigger_dispatch_now(1);
+ _probeShould = 9;
+ kernel_trigger_dispatch_now(kCHANGE_PROBE_ANIMATION);
break;
case 2:
diff --git a/engines/m4/burger/rooms/section3/room310.h b/engines/m4/burger/rooms/section3/room310.h
index 8b506d45674..af846753779 100644
--- a/engines/m4/burger/rooms/section3/room310.h
+++ b/engines/m4/burger/rooms/section3/room310.h
@@ -41,7 +41,7 @@ private:
Series _series1;
machine *_series2 = nullptr;
noWalkRect *_walk1 = nullptr;
- int _val1 = 0;
+ int _probeShould = 0;
int _trufflesShould = 0;
protected:
Commit: 7b2311e2e6d773b933191e99bd448c953b26f963
https://github.com/scummvm/scummvm/commit/7b2311e2e6d773b933191e99bd448c953b26f963
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting laxative
Changed paths:
engines/m4/burger/rooms/section1/room174.cpp
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index 5a17ae3a662..ba0491b9641 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -135,7 +135,7 @@ void Room174::daemon() {
break;
case 4:
- disable_player();
+ enable_player();
inv_give_to_player("LAXATIVE");
hotspot_set_active("LAXATIVE ", false);
break;
Commit: b42165a2244924923b0c173fae1e4d6c5eebe632
https://github.com/scummvm/scummvm/commit/b42165a2244924923b0c173fae1e4d6c5eebe632
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for band arriving
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 0f9851c96aa..56a3d223c71 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -43,8 +43,8 @@ static const BoonsvilleEvent EVENTS[] = {
{ 19200, -1, "After getting language stuff" },
{ 13200, kBurlStopsEating, "Burl stops eating" },
{ 22800, -1, "After getting logic stuff" },
- { 15000, 10031, "Burl leaves town" },
- { 18600, 10031, "Band enters town" },
+ { 15000, kBurlLeavesTown, "Burl leaves town" },
+ { 18600, kBandEntersTown, "Band enters town" },
{ 33600, 10022, "Abduction time" },
{ 55200, 10023, "Nero timeout" },
{ 166800, 10023, "Survival timeout" },
@@ -188,7 +188,7 @@ void Flags::reset1() {
inv_move_object("keys", 138);
(*this)[V112] = 0;
- (*this)[V058] = 0;
+ (*this)[kTourBusAtDiner] = 0;
(*this)[kIceBoxOpened] = 0;
(*this)[V245] = 10027;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 4a4d83388b7..27c10360ef7 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -90,7 +90,7 @@ enum {
V055 = 55,
V056 = 56,
V057 = 57,
- V058 = 58,
+ kTourBusAtDiner = 58,
kIceBoxOpened = 59,
V060 = 60,
V061 = 61,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index f1a5adf13f6..1618d248710 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -816,7 +816,7 @@ void Room101::daemon15() {
_G(flags)[V039] = 0;
_G(flags)[kRoadOpened] = 0;
- _G(flags)[V058] = 0;
+ _G(flags)[kTourBusAtDiner] = 0;
}
_G(flags)[V063] = 0;
@@ -831,7 +831,7 @@ void Room101::daemon18() {
inv_give_to_player("laxative");
inv_give_to_player("amplifier");
_G(flags)[V067] = 1;
- _G(flags)[V058] = 1;
+ _G(flags)[kTourBusAtDiner] = 1;
_G(flags).set_boonsville_time(19200);
}
}
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 2eb338824b0..48b686b273b 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -52,8 +52,8 @@ static const char *SAID[][4] = {
const WilburMatch Room142::MATCH[] = {
{ "GEAR", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
{ "LOOK AT", "PARKING LOT", 9, &_G(flags)[V000], 1003, &_val1, 18 },
- { "GEAR", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
- { "LOOK AT", "PARKING LOT", 5, &_G(flags)[V058], 0, &_val2, 13 },
+ { "GEAR", "PARKING LOT", 5, &_G(flags)[kTourBusAtDiner], 0, &_val2, 13 },
+ { "LOOK AT", "PARKING LOT", 5, &_G(flags)[kTourBusAtDiner], 0, &_val2, 13 },
{ "GEAR", "ICE BOX", kCHANGE_WILBUR_ANIMATION, &_G(flags)[kIceBoxOpened], 0, &Vars::_wilbur_should, 1 },
{ "TAKE", "FANBELT", kCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
{ "GEAR", "BACK DOOR", 6, nullptr, 0, nullptr, 0 },
@@ -234,7 +234,7 @@ void Room142::init() {
hotspot_set_active("TOUR BUS", false);
- if (_G(flags)[V058]) {
+ if (_G(flags)[kTourBusAtDiner]) {
_series4 = series_show("142ba01", 0xf00, 0, -1, -1, 21);
hotspot_set_active("TOUR BUS", true);
}
@@ -495,7 +495,7 @@ void Room142::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (!_G(flags)[kRoadOpened]) {
if (_series2) {
terminateMachineAndNull(_series2);
@@ -503,7 +503,7 @@ void Room142::daemon() {
}
if (_series4) {
terminateMachineAndNull(_series4);
- _G(flags)[V058] = 0;
+ _G(flags)[kTourBusAtDiner] = 0;
}
_G(flags)[V000] = 1003;
@@ -529,7 +529,7 @@ void Room142::daemon() {
}
break;
- case 10031:
+ case kBurlLeavesTown:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
@@ -557,19 +557,19 @@ void Room142::daemon() {
_val1 = 19;
series_play_with_breaks(PLAY8, "142bu03", 0xd00, 9, 3);
} else {
- kernel_timing_trigger(15, 10031);
+ kernel_timing_trigger(15, kBurlLeavesTown);
}
}
break;
- case 10032:
+ case kBandEntersTown:
if (_series2) {
terminateMachineAndNull(_series2);
_G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1004;
}
- if (!_G(flags)[V058]) {
- _G(flags)[V058] = 1;
+ if (!_G(flags)[kTourBusAtDiner]) {
+ _G(flags)[kTourBusAtDiner] = 1;
digi_preload("142_006");
digi_play("142_006", 3, 255, 4);
series_play_with_breaks(PLAY14, "142ba01", 0xf00, -1, 2);
@@ -639,7 +639,7 @@ void Room142::pre_parser() {
checkAction();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
- } else if (player_said("PARKING LOT") && _G(flags)[V058]) {
+ } else if (player_said("PARKING LOT") && _G(flags)[kTourBusAtDiner]) {
checkAction();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
@@ -689,7 +689,7 @@ void Room142::checkAction() {
if (player_said_any("GEAR", "LOOK AT", "GO TO")) {
if (player_said("MAIN STREET")) {
_actionType = 1;
- } else if (_G(flags)[V058] && (player_said("PARKING LOT") ||
+ } else if (_G(flags)[kTourBusAtDiner] && (player_said("PARKING LOT") ||
player_said("GO TO", "TOUR BUS"))) {
_actionType = 2;
}
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 6eac8ce8828..ec418c80a5d 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -588,7 +588,7 @@ void Room145::daemon() {
break;
case 2:
- playRandomDigi2();
+ playRandomDigi1();
break;
default:
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 105590b0605..2764dc131f6 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -249,15 +249,15 @@ void Section1::daemon() {
_G(flags)[V063] = 1;
break;
case kBurlStopsEating:
- if (_G(flags)[kRoadOpened])
+ if (!_G(flags)[kRoadOpened])
_G(flags)[V063] = 0;
break;
case kBurlLeavesTown:
- if (_G(flags)[kRoadOpened])
+ if (!_G(flags)[kRoadOpened])
_G(flags)[V000] = 1004;
break;
- case k10032:
- _G(flags)[V058] = 1;
+ case kBandEntersTown:
+ _G(flags)[kTourBusAtDiner] = 1;
break;
default:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 470f205e97b..7a198db12ff 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -72,7 +72,7 @@ enum global_triggers {
kBurlGetsFed = 10029,
kBurlStopsEating = 10030,
kBurlLeavesTown = 10031,
- k10032 = 10032,
+ kBandEntersTown = 10032,
kCALLED_EACH_LOOP = 32764,
Commit: 2443aa0716cb6792618f7b3d51918b46e26227b5
https://github.com/scummvm/scummvm/commit/2443aa0716cb6792618f7b3d51918b46e26227b5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of room 145 daemon
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index ec418c80a5d..e3d87634c52 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -28,6 +28,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_DRUMZ_ANIMATION = 2,
+ kCHANGE_ROXY_ANIMATION = 4,
+ kCHANGE_VIPE_ANIMATION = 5
+};
const char *Room145::SAID[][4] = {
{ "TOUR BUS", "145w001", "145w002", "145w003" },
{ "INSTRUMENTS", "145w005", "145w006", "145w006" },
@@ -234,20 +239,20 @@ void Room145::init() {
} else {
loadDrum();
_walk1 = intr_add_no_walk_rect(140, 295, 240, 325, 139, 326);
- _val1 = 19;
- kernel_trigger_dispatch_now(2);
+ _drumzState = 19;
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
}
loadRx();
_walk2 = intr_add_no_walk_rect(423, 308, 540, 340, 541, 341);
_val2 = 101;
- _val3 = 33;
- kernel_trigger_dispatch_now(4);
+ _roxyState = 33;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
_walk3 = intr_add_no_walk_rect(341, 326, 480, 365, 481, 366);
- _val4 = 43;
- kernel_trigger_dispatch_now(5);
+ _vipeState = 43;
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
if (inv_player_has("AMPLIFIER")) {
hotspot_set_active("AMPLIFIER ", false);
@@ -293,23 +298,23 @@ void Room145::daemon() {
}
break;
- case 2:
- switch (_val1) {
+ case kCHANGE_DRUMZ_ANIMATION:
+ switch (_drumzState) {
case 19:
if (!digi_play_state(2))
digi_play_loop("145_003", 2, 125, -1);
- _val1 = getRandomState();
+ _drumzState = getRandomState();
series_play_with_breaks(PLAY5, "145dz01", 0xa01, 2, 3);
break;
case 20:
- _val1 = 23;
+ _drumzState = 23;
series_play_with_breaks(PLAY6, "145dz02", 0xa01, 2, 3);
break;
case 21:
- _val1 = 23;
+ _drumzState = 23;
series_play_with_breaks(PLAY7, "145dz03", 0xa01, 2, 3);
break;
@@ -317,18 +322,18 @@ void Room145::daemon() {
if (!_state2)
digi_stop(2);
- _val1 = 23;
+ _drumzState = 23;
series_play_with_breaks(PLAY8, "145dz04", 0xa01, 2, 3);
break;
case 23:
kernel_trigger_dispatch_now(10001);
- _val1 = getRandomState();
+ _drumzState = getRandomState();
kernel_trigger_dispatch_now(2);
break;
case 24:
- _val1 = getRandomState();
+ _drumzState = getRandomState();
series_play_with_breaks(PLAY9, "145dz05", 0xa01, 2, 3);
break;
@@ -336,19 +341,19 @@ void Room145::daemon() {
if (!_state2)
digi_stop(2);
- _val1 = getRandomState();
+ _drumzState = getRandomState();
series_play_with_breaks(PLAY10, "145dz06", 0xa01, 2, 3);
break;
case 26:
- _val1 = 27;
+ _drumzState = 27;
series_play_with_breaks(PLAY11, "145dz05", 0xa01, 2, 3);
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 27:
- _val1 = getRandomState();
+ _drumzState = getRandomState();
series_play_with_breaks(PLAY12, "145dz06", 0xa01, 2, 3);
break;
@@ -357,7 +362,7 @@ void Room145::daemon() {
digi_stop(2);
_G(wilbur_should) = 5;
- _val1 = 29;
+ _drumzState = 29;
series_play_with_breaks(PLAY13, "145dz08", 0xa01, 2, 3);
break;
@@ -377,37 +382,37 @@ void Room145::daemon() {
}
break;
- case 4:
- _val5 = _val3;
+ case kCHANGE_ROXY_ANIMATION:
+ _val5 = _roxyState;
- switch (_val3) {
+ switch (_roxyState) {
case 30:
_rx.terminate();
- _val3 = 31;
+ _roxyState = 31;
series_play_with_breaks(PLAY15, "145rx01", 0x900, 4, 3, 6, 100, 0, 0);
break;
case 31:
_duration = imath_ranged_rand(180, 360);
- _val3 = 32;
+ _roxyState = 32;
_rx.show("145rx01", 0x900, 0, 4, _duration);
break;
case 32:
_rx.terminate();
- _val3 = 33;
+ _roxyState = 33;
series_play_with_breaks(PLAY16, "145rx01", 0x900, 4, 3);
break;
case 33:
if (_val2 == 101) {
_duration = imath_ranged_rand(180, 360);
- _val3 = 30;
+ _roxyState = 30;
_rx.show("145rx01", 0x900, 0, 4, _duration, 3);
} else if (_val2 == 17) {
playRandomDigi2();
} else {
- _val3 = 35;
+ _roxyState = 35;
kernel_trigger_dispatch_now(4);
}
break;
@@ -416,7 +421,7 @@ void Room145::daemon() {
digi_unload(_digiName2);
_state2 = 0;
_val2 = 101;
- _val3 = 33;
+ _roxyState = 33;
kernel_trigger_dispatch_now(4);
break;
@@ -424,15 +429,15 @@ void Room145::daemon() {
switch (_val2) {
case 0:
player_set_commands_allowed(false);
- _val3 = 36;
+ _roxyState = 36;
break;
case 15:
- _val3 = 37;
+ _roxyState = 37;
break;
case 100:
- _val3 = 40;
+ _roxyState = 40;
break;
default:
@@ -445,13 +450,13 @@ void Room145::daemon() {
case 36:
kernel_trigger_dispatch_now(9);
- _val3 = 40;
+ _roxyState = 40;
kernel_trigger_dispatch_now(4);
break;
case 37:
_state2 = 1;
- _val3 = 38;
+ _roxyState = 38;
series_play_with_breaks(PLAY18, "145rx04", 0x900, 4, 3);
break;
@@ -483,13 +488,13 @@ void Room145::daemon() {
digi_preload(_digiName1);
digi_play(_digiName1, 2, 125, -1);
- _val3 = 42;
+ _roxyState = 42;
kernel_timing_trigger(120, 4);
break;
case 39:
_rx.terminate();
- _val3 = 40;
+ _roxyState = 40;
kernel_trigger_dispatch_now(4);
kernel_trigger_dispatch_now(10001);
break;
@@ -501,7 +506,7 @@ void Room145::daemon() {
case 41:
_val2 = 101;
_rx.terminate();
- _val3 = 33;
+ _roxyState = 33;
series_play_with_breaks(PLAY19, "145rx02", 0x900, 4, 3);
break;
@@ -509,7 +514,7 @@ void Room145::daemon() {
digi_unload(_digiName1);
_state2 = 0;
_rx.terminate();
- _val3 = 41;
+ _roxyState = 41;
series_play_with_breaks(PLAY20, "145rx06", 0x900, 4, 3);
break;
@@ -518,11 +523,11 @@ void Room145::daemon() {
}
break;
- case 5:
- switch (_val4) {
+ case kCHANGE_VIPE_ANIMATION:
+ switch (_vipeState) {
case 39:
_vp.terminate();
- _val4 = 40;
+ _vipeState = 40;
kernel_trigger_dispatch_now(5);
kernel_trigger_dispatch_now(10001);
break;
@@ -544,7 +549,7 @@ void Room145::daemon() {
_val2 = 100;
resetRoxy();
_vp.terminate();
- _val4 = 45;
+ _vipeState = 45;
series_play_with_breaks(PLAY21, "145vp02", 0x300, 5, 3);
} else {
kernel_timing_trigger(15, 5);
@@ -552,19 +557,19 @@ void Room145::daemon() {
break;
case 45:
- _val4 = 46;
+ _vipeState = 46;
series_play_with_breaks(PLAY22, "145vp06", 0x300, 5, 3);
break;
case 46:
kernel_trigger_dispatch_now(8);
- _val4 = 40;
+ _vipeState = 40;
kernel_trigger_dispatch_now(5);
break;
case 47:
_vp.terminate();
- _val4 = 43;
+ _vipeState = 43;
series_play_with_breaks(PLAY23, "145vp02", 0x300, 5, 3);
break;
@@ -628,16 +633,16 @@ void Room145::daemon() {
break;
case 11:
- _val4 = 47;
+ _vipeState = 47;
kernel_trigger_dispatch_now(5);
- _val3 = 41;
+ _roxyState = 41;
kernel_trigger_dispatch_now(4);
break;
case 12:
_G(flags)[V073] = 1;
player_set_commands_allowed(true);
- _val3 = 41;
+ _roxyState = 41;
kernel_trigger_dispatch_now(4);
break;
@@ -650,7 +655,7 @@ void Room145::daemon() {
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
- _val1 = 26;
+ _drumzState = 26;
break;
case 2:
@@ -669,7 +674,7 @@ void Room145::daemon() {
break;
case 4:
- _val1 = 28;
+ _drumzState = 28;
break;
case 5:
@@ -707,7 +712,7 @@ void Room145::daemon() {
if (_state2) {
kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
} else {
- _val4 = 44;
+ _vipeState = 44;
kernel_trigger_dispatch_now(5);
}
break;
@@ -872,23 +877,23 @@ void Room145::conv23() {
case 2:
switch (entry) {
case 0:
- _val1 = 20;
+ _drumzState = 20;
break;
case 1:
- _val1 = 21;
+ _drumzState = 21;
break;
case 2:
case 3:
- _val1 = 22;
+ _drumzState = 22;
break;
case 4:
- _val1 = 21;
+ _drumzState = 21;
break;
case 5:
- _val1 = 20;
+ _drumzState = 20;
break;
case 6:
- _val1 = 20;
+ _drumzState = 20;
break;
case 7:
conv_resume_curr();
@@ -899,7 +904,7 @@ void Room145::conv23() {
break;
case 5:
- _val1 = 20;
+ _drumzState = 20;
break;
default:
@@ -911,14 +916,14 @@ void Room145::conv23() {
void Room145::loadVp4() {
_vp.terminate();
- _val4 = 39;
+ _vipeState = 39;
digi_play(conv_sound_to_play(), 1, 255, 5);
_vp.play("145vp04", 0x300, 4, -1);
}
void Room145::loadRx4() {
_rx.terminate();
- _val3 = 39;
+ _roxyState = 39;
digi_play(conv_sound_to_play(), 1, 255, 4);
_rx.play("145rx04", 0x900, 4, -1);
}
@@ -947,13 +952,13 @@ void Room145::resetRoxy() {
switch (_val5) {
case 31:
_rx.terminate();
- _val3 = 32;
+ _roxyState = 32;
kernel_trigger_dispatch_now(4);
break;
case 33:
_rx.terminate();
- _val3 = 33;
+ _roxyState = 33;
kernel_trigger_dispatch_now(4);
break;
@@ -980,9 +985,9 @@ void Room145::playRandomDigi2() {
"145r917", "145r918", "145r919"
};
- _digiName1 = NAMES[imath_ranged_rand(0, 12)];
- _val3 = 34;
- digi_preload(_digiName1);
+ _digiName2 = NAMES[imath_ranged_rand(0, 12)];
+ _roxyState = 34;
+ digi_preload(_digiName2);
npc_say(_digiName2, 4, "145rx01", 0x900, 1, 3, 7, 2);
}
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index b4e46d979cf..71b1138936a 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -69,10 +69,10 @@ private:
const char *_digiName2 = nullptr;
bool _flag1 = false;
int _duration = 0;
- int _val1 = 0;
+ int _drumzState = 0;
int _val2 = 0;
- int _val3 = 0;
- int _val4 = 0;
+ int _roxyState = 0;
+ int _vipeState = 0;
int _val5 = 0;
void loadDrum();
Commit: c726373a491ac3d4253ee91478dd63dbc2805869
https://github.com/scummvm/scummvm/commit/c726373a491ac3d4253ee91478dd63dbc2805869
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further room 145 daemon cleanup
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index e3d87634c52..1410a44730c 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -31,8 +31,12 @@ namespace Rooms {
enum {
kCHANGE_DRUMZ_ANIMATION = 2,
kCHANGE_ROXY_ANIMATION = 4,
- kCHANGE_VIPE_ANIMATION = 5
+ kCHANGE_VIPE_ANIMATION = 5,
+ kSPEAK_TO_VIPE = 8,
+ kSPEAK_TO_ROXY = 9,
+ kSPEAK_TO_DRUMZ = 10
};
+
const char *Room145::SAID[][4] = {
{ "TOUR BUS", "145w001", "145w002", "145w003" },
{ "INSTRUMENTS", "145w005", "145w006", "145w006" },
@@ -246,7 +250,7 @@ void Room145::init() {
loadRx();
_walk2 = intr_add_no_walk_rect(423, 308, 540, 340, 541, 341);
- _val2 = 101;
+ _roxyTalkTo = 101;
_roxyState = 33;
kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
@@ -304,18 +308,18 @@ void Room145::daemon() {
if (!digi_play_state(2))
digi_play_loop("145_003", 2, 125, -1);
- _drumzState = getRandomState();
- series_play_with_breaks(PLAY5, "145dz01", 0xa01, 2, 3);
+ _drumzState = getRandomDrumzState();
+ series_play_with_breaks(PLAY5, "145dz01", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 20:
_drumzState = 23;
- series_play_with_breaks(PLAY6, "145dz02", 0xa01, 2, 3);
+ series_play_with_breaks(PLAY6, "145dz02", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 21:
_drumzState = 23;
- series_play_with_breaks(PLAY7, "145dz03", 0xa01, 2, 3);
+ series_play_with_breaks(PLAY7, "145dz03", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 22:
@@ -323,38 +327,38 @@ void Room145::daemon() {
digi_stop(2);
_drumzState = 23;
- series_play_with_breaks(PLAY8, "145dz04", 0xa01, 2, 3);
+ series_play_with_breaks(PLAY8, "145dz04", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 23:
kernel_trigger_dispatch_now(10001);
- _drumzState = getRandomState();
- kernel_trigger_dispatch_now(2);
+ _drumzState = getRandomDrumzState();
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
break;
case 24:
- _drumzState = getRandomState();
- series_play_with_breaks(PLAY9, "145dz05", 0xa01, 2, 3);
+ _drumzState = getRandomDrumzState();
+ series_play_with_breaks(PLAY9, "145dz05", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 25:
if (!_state2)
digi_stop(2);
- _drumzState = getRandomState();
- series_play_with_breaks(PLAY10, "145dz06", 0xa01, 2, 3);
+ _drumzState = getRandomDrumzState();
+ series_play_with_breaks(PLAY10, "145dz06", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 26:
_drumzState = 27;
- series_play_with_breaks(PLAY11, "145dz05", 0xa01, 2, 3);
+ series_play_with_breaks(PLAY11, "145dz05", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 27:
- _drumzState = getRandomState();
- series_play_with_breaks(PLAY12, "145dz06", 0xa01, 2, 3);
+ _drumzState = getRandomDrumzState();
+ series_play_with_breaks(PLAY12, "145dz06", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 28:
@@ -363,7 +367,7 @@ void Room145::daemon() {
_G(wilbur_should) = 5;
_drumzState = 29;
- series_play_with_breaks(PLAY13, "145dz08", 0xa01, 2, 3);
+ series_play_with_breaks(PLAY13, "145dz08", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 29:
@@ -389,7 +393,7 @@ void Room145::daemon() {
case 30:
_rx.terminate();
_roxyState = 31;
- series_play_with_breaks(PLAY15, "145rx01", 0x900, 4, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY15, "145rx01", 0x900, kCHANGE_ROXY_ANIMATION, 3, 6, 100, 0, 0);
break;
case 31:
@@ -401,32 +405,32 @@ void Room145::daemon() {
case 32:
_rx.terminate();
_roxyState = 33;
- series_play_with_breaks(PLAY16, "145rx01", 0x900, 4, 3);
+ series_play_with_breaks(PLAY16, "145rx01", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
case 33:
- if (_val2 == 101) {
+ if (_roxyTalkTo == 101) {
_duration = imath_ranged_rand(180, 360);
_roxyState = 30;
- _rx.show("145rx01", 0x900, 0, 4, _duration, 3);
- } else if (_val2 == 17) {
+ _rx.show("145rx01", 0x900, 0, kCHANGE_ROXY_ANIMATION, _duration, 3);
+ } else if (_roxyTalkTo == 17) {
playRandomDigi2();
} else {
_roxyState = 35;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
}
break;
case 34:
digi_unload(_digiName2);
_state2 = 0;
- _val2 = 101;
+ _roxyTalkTo = 101;
_roxyState = 33;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 35:
- switch (_val2) {
+ switch (_roxyTalkTo) {
case 0:
player_set_commands_allowed(false);
_roxyState = 36;
@@ -445,19 +449,19 @@ void Room145::daemon() {
break;
}
- series_play_with_breaks(PLAY17, "145rx02", 0x900, 4, 3);
+ series_play_with_breaks(PLAY17, "145rx02", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
case 36:
- kernel_trigger_dispatch_now(9);
+ kernel_trigger_dispatch_now(kSPEAK_TO_ROXY);
_roxyState = 40;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 37:
_state2 = 1;
_roxyState = 38;
- series_play_with_breaks(PLAY18, "145rx04", 0x900, 4, 3);
+ series_play_with_breaks(PLAY18, "145rx04", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
case 38:
@@ -489,13 +493,13 @@ void Room145::daemon() {
digi_preload(_digiName1);
digi_play(_digiName1, 2, 125, -1);
_roxyState = 42;
- kernel_timing_trigger(120, 4);
+ kernel_timing_trigger(120, kCHANGE_ROXY_ANIMATION);
break;
case 39:
_rx.terminate();
_roxyState = 40;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
kernel_trigger_dispatch_now(10001);
break;
@@ -504,10 +508,10 @@ void Room145::daemon() {
break;
case 41:
- _val2 = 101;
+ _roxyTalkTo = 101;
_rx.terminate();
_roxyState = 33;
- series_play_with_breaks(PLAY19, "145rx02", 0x900, 4, 3);
+ series_play_with_breaks(PLAY19, "145rx02", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
case 42:
@@ -515,7 +519,7 @@ void Room145::daemon() {
_state2 = 0;
_rx.terminate();
_roxyState = 41;
- series_play_with_breaks(PLAY20, "145rx06", 0x900, 4, 3);
+ series_play_with_breaks(PLAY20, "145rx06", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
default:
@@ -528,7 +532,7 @@ void Room145::daemon() {
case 39:
_vp.terminate();
_vipeState = 40;
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
kernel_trigger_dispatch_now(10001);
break;
@@ -545,12 +549,12 @@ void Room145::daemon() {
player_set_commands_allowed(true);
_flag1 = true;
- if (_val2 == 101) {
- _val2 = 100;
+ if (_roxyTalkTo == 101) {
+ _roxyTalkTo = 100;
resetRoxy();
_vp.terminate();
_vipeState = 45;
- series_play_with_breaks(PLAY21, "145vp02", 0x300, 5, 3);
+ series_play_with_breaks(PLAY21, "145vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
} else {
kernel_timing_trigger(15, 5);
}
@@ -558,7 +562,7 @@ void Room145::daemon() {
case 45:
_vipeState = 46;
- series_play_with_breaks(PLAY22, "145vp06", 0x300, 5, 3);
+ series_play_with_breaks(PLAY22, "145vp06", 0x300, kCHANGE_VIPE_ANIMATION, 3);
break;
case 46:
@@ -570,7 +574,7 @@ void Room145::daemon() {
case 47:
_vp.terminate();
_vipeState = 43;
- series_play_with_breaks(PLAY23, "145vp02", 0x300, 5, 3);
+ series_play_with_breaks(PLAY23, "145vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
break;
default:
@@ -584,11 +588,11 @@ void Room145::daemon() {
break;
case 7:
- if (!digi_play_state(1) && !_flag1 && _val2 == 101) {
+ if (!digi_play_state(1) && !_flag1 && _roxyTalkTo == 101) {
switch (imath_ranged_rand(1, 3)) {
case 1:
_state3 = imath_ranged_rand(1, 6);
- _val2 = 15;
+ _roxyTalkTo = 15;
resetRoxy();
break;
@@ -597,7 +601,7 @@ void Room145::daemon() {
break;
default:
- _val2 = 17;
+ _roxyTalkTo = 17;
resetRoxy();
break;
}
@@ -606,7 +610,7 @@ void Room145::daemon() {
kernel_timing_trigger(imath_ranged_rand(600, 900), 7);
break;
- case 8:
+ case kSPEAK_TO_VIPE:
conv_load_and_prepare("conv21", 11);
conv_export_pointer_curr(&_G(flags)[V068], 0);
conv_export_pointer_curr(&_G(flags)[V069], 1);
@@ -616,12 +620,12 @@ void Room145::daemon() {
conv_play_curr();
break;
- case 9:
+ case kSPEAK_TO_ROXY:
conv_load_and_prepare("conv22", 12);
conv_export_pointer_curr(&_G(flags)[V073], 0);
break;
- case 10:
+ case kSPEAK_TO_DRUMZ:
player_set_commands_allowed(false);
conv_load_and_prepare("conv23", 13);
conv_export_value_curr(_G(flags)[V068], 0);
@@ -634,16 +638,16 @@ void Room145::daemon() {
case 11:
_vipeState = 47;
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
_roxyState = 41;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 12:
_G(flags)[V073] = 1;
player_set_commands_allowed(true);
_roxyState = 41;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 13:
@@ -713,15 +717,15 @@ void Room145::daemon() {
kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
} else {
_vipeState = 44;
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
}
break;
case 11:
player_set_commands_allowed(false);
- if (_val2 == 101) {
- _val2 = 0;
+ if (_roxyTalkTo == 101) {
+ _roxyTalkTo = 0;
resetRoxy();
} else {
kernel_timing_trigger(15, kCHANGE_WILBUR_ANIMATION);
@@ -737,8 +741,6 @@ void Room145::daemon() {
_G(kernel).continue_handling_trigger = true;
break;
}
-
- // TODO
}
void Room145::pre_parser() {
@@ -937,7 +939,7 @@ void Room145::loadSeries1() {
series_load("145dz08s");
}
-int Room145::getRandomState() const {
+int Room145::getRandomDrumzState() const {
switch (imath_ranged_rand(1, 10)) {
case 1:
return 24;
@@ -953,13 +955,13 @@ void Room145::resetRoxy() {
case 31:
_rx.terminate();
_roxyState = 32;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 33:
_rx.terminate();
_roxyState = 33;
- kernel_trigger_dispatch_now(4);
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
default:
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 71b1138936a..6977ff2830a 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -70,7 +70,7 @@ private:
bool _flag1 = false;
int _duration = 0;
int _drumzState = 0;
- int _val2 = 0;
+ int _roxyTalkTo = 0;
int _roxyState = 0;
int _vipeState = 0;
int _val5 = 0;
@@ -83,7 +83,7 @@ private:
void loadVp4();
void loadRx4();
void loadSeries1();
- int getRandomState() const;
+ int getRandomDrumzState() const;
void resetRoxy();
void playRandomDigi1();
void playRandomDigi2();
Commit: 77058f3a5a46de0cf4e9a93f697e76c33dd7b75b
https://github.com/scummvm/scummvm/commit/77058f3a5a46de0cf4e9a93f697e76c33dd7b75b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for talking to band members
Changed paths:
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room145.cpp
engines/m4/burger/rooms/section1/room145.h
engines/m4/burger/rooms/section4/room407.cpp
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 27c10360ef7..13a14e33cf5 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -99,7 +99,7 @@ enum {
V064 = 64,
V065 = 65,
V066 = 66,
- V067 = 67,
+ kDrumzFled = 67,
V068 = 68,
V069 = 69,
V070 = 70,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 1618d248710..137a75cfe74 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -830,7 +830,7 @@ void Room101::daemon18() {
if (_G(flags)[V220] || _G(flags)[kFourthTestPassed]) {
inv_give_to_player("laxative");
inv_give_to_player("amplifier");
- _G(flags)[V067] = 1;
+ _G(flags)[kDrumzFled] = 1;
_G(flags)[kTourBusAtDiner] = 1;
_G(flags).set_boonsville_time(19200);
}
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index 1410a44730c..eadfeddbd00 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -55,7 +55,7 @@ const WilburMatch Room145::MATCH[] = {
{ "TALK", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 11 },
{ "AMPLIFIER", "ROXY", 1, 0, 0, &_state1, 15 },
{ nullptr, "ROXY", 1, 0, 0, &_state1, 17 },
- { "TALK" , "DRUMZ", 10, 0, 0, 0, 0 },
+ { "TALK" , "DRUMZ", kSPEAK_TO_DRUMZ, 0, 0, 0, 0 },
{ "LAXATIVE" , "DRUMZ", 10016, 0, 0, &Vars::_wilbur_should, 3 },
{ nullptr, "DRUMZ", 1, 0, 0, &_state1, 16 },
{ "TALK" , "VIPE", 10016, 0, 0, &Vars::_wilbur_should, 10 },
@@ -63,8 +63,8 @@ const WilburMatch Room145::MATCH[] = {
{ nullptr, "VIPE", 1, 0, 0, &_state1, 16 },
{ "AMPLIFIER" , "INSTRUMENTS", 1, 0, 0, &_state1, 13 },
{ nullptr, "INSTRUMENTS", 1, 0, 0, &_state1, 14 },
- { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[V067], 0, &Vars::_wilbur_should, 1 },
- { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[V067], 1, &Vars::_wilbur_should, 8 },
+ { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[kDrumzFled], 0, &Vars::_wilbur_should, 1 },
+ { "TAKE", "AMPLIFIER ", 10016, &Flags::_flags[kDrumzFled], 1, &Vars::_wilbur_should, 8 },
{ nullptr, "AMPLIFIER ", 1, 0, 0, &_state1, 14 },
{ nullptr, "MAP", 1, 0, 0, &_state1, 18 },
WILBUR_MATCH_END
@@ -237,7 +237,7 @@ void Room145::init() {
kernel_timing_trigger(600, 7);
- if (_G(flags)[V067]) {
+ if (_G(flags)[kDrumzFled]) {
series_show("145drum", 0xa01);
hotspot_set_active("DRUMZ", false);
} else {
@@ -374,7 +374,7 @@ void Room145::daemon() {
hotspot_set_active("DRUMZ", false);
intr_remove_no_walk_rect(_walk1);
- _G(flags)[V067] = 1;
+ _G(flags)[kDrumzFled] = 1;
series_play_with_breaks(PLAY14, "145dz08", 0, -1, 3);
series_show("145drum", 0xa01);
_G(wilbur_should) = 6;
@@ -391,7 +391,7 @@ void Room145::daemon() {
switch (_roxyState) {
case 30:
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 31;
series_play_with_breaks(PLAY15, "145rx01", 0x900, kCHANGE_ROXY_ANIMATION, 3, 6, 100, 0, 0);
break;
@@ -399,11 +399,11 @@ void Room145::daemon() {
case 31:
_duration = imath_ranged_rand(180, 360);
_roxyState = 32;
- _rx.show("145rx01", 0x900, 0, 4, _duration);
+ _roxy.show("145rx01", 0x900, 0, 4, _duration);
break;
case 32:
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 33;
series_play_with_breaks(PLAY16, "145rx01", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
@@ -412,7 +412,7 @@ void Room145::daemon() {
if (_roxyTalkTo == 101) {
_duration = imath_ranged_rand(180, 360);
_roxyState = 30;
- _rx.show("145rx01", 0x900, 0, kCHANGE_ROXY_ANIMATION, _duration, 3);
+ _roxy.show("145rx01", 0x900, 0, kCHANGE_ROXY_ANIMATION, _duration, 3);
} else if (_roxyTalkTo == 17) {
playRandomDigi2();
} else {
@@ -465,7 +465,7 @@ void Room145::daemon() {
break;
case 38:
- _rx.show("145rx04", 0x900);
+ _roxy.show("145rx04", 0x900);
switch (_state3) {
case 1:
@@ -497,19 +497,19 @@ void Room145::daemon() {
break;
case 39:
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 40;
kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
kernel_trigger_dispatch_now(10001);
break;
case 40:
- _rx.show("145rx04", 0x900);
+ _roxy.show("145rx04", 0x900);
break;
case 41:
_roxyTalkTo = 101;
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 33;
series_play_with_breaks(PLAY19, "145rx02", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
@@ -517,7 +517,7 @@ void Room145::daemon() {
case 42:
digi_unload(_digiName1);
_state2 = 0;
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 41;
series_play_with_breaks(PLAY20, "145rx06", 0x900, kCHANGE_ROXY_ANIMATION, 3);
break;
@@ -530,19 +530,19 @@ void Room145::daemon() {
case kCHANGE_VIPE_ANIMATION:
switch (_vipeState) {
case 39:
- _vp.terminate();
+ _viper.terminate();
_vipeState = 40;
kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
kernel_trigger_dispatch_now(10001);
break;
case 40:
- _vp.show("145vp04", 0x300);
+ _viper.show("145vp04", 0x300);
break;
case 43:
player_set_commands_allowed(true);
- _vp.show("145vp02", 0x300);
+ _viper.show("145vp02", 0x300);
break;
case 44:
@@ -552,11 +552,11 @@ void Room145::daemon() {
if (_roxyTalkTo == 101) {
_roxyTalkTo = 100;
resetRoxy();
- _vp.terminate();
+ _viper.terminate();
_vipeState = 45;
series_play_with_breaks(PLAY21, "145vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
} else {
- kernel_timing_trigger(15, 5);
+ kernel_timing_trigger(15, kCHANGE_VIPE_ANIMATION);
}
break;
@@ -566,13 +566,13 @@ void Room145::daemon() {
break;
case 46:
- kernel_trigger_dispatch_now(8);
+ kernel_trigger_dispatch_now(kSPEAK_TO_VIPE);
_vipeState = 40;
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
break;
case 47:
- _vp.terminate();
+ _viper.terminate();
_vipeState = 43;
series_play_with_breaks(PLAY23, "145vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
break;
@@ -623,6 +623,7 @@ void Room145::daemon() {
case kSPEAK_TO_ROXY:
conv_load_and_prepare("conv22", 12);
conv_export_pointer_curr(&_G(flags)[V073], 0);
+ conv_play_curr();
break;
case kSPEAK_TO_DRUMZ:
@@ -746,7 +747,7 @@ void Room145::daemon() {
void Room145::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (!_G(flags)[V067] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
+ if (!_G(flags)[kDrumzFled] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
_G(player).walk_y >= 295 && _G(player).walk_y <= 325)
player_walk_to(139, 326);
@@ -818,7 +819,7 @@ void Room145::conv21() {
case 2:
case 7:
case 12:
- loadVp4();
+ viperSpeaking();
break;
case 3:
@@ -827,22 +828,22 @@ void Room145::conv21() {
case 6:
case 8:
case 11:
- loadRx4();
+ roxySpeaking();
break;
case 9:
if (entry <= 0) {
- loadRx4();
+ roxySpeaking();
} else if (entry == 2) {
- loadVp4();
+ viperSpeaking();
}
break;
case 10:
if (entry <= 0) {
- loadVp4();
+ viperSpeaking();
} else if (entry == 1) {
- loadRx4();
+ roxySpeaking();
}
break;
@@ -861,7 +862,7 @@ void Room145::conv22() {
if (who == 1)
wilbur_speech(sound, 10001);
else
- loadRx4();
+ roxySpeaking();
}
}
@@ -916,18 +917,18 @@ void Room145::conv23() {
}
}
-void Room145::loadVp4() {
- _vp.terminate();
+void Room145::viperSpeaking() {
+ _viper.terminate();
_vipeState = 39;
digi_play(conv_sound_to_play(), 1, 255, 5);
- _vp.play("145vp04", 0x300, 4, -1);
+ _viper.play("145vp04", 0x300, 4, -1., 6, -1);
}
-void Room145::loadRx4() {
- _rx.terminate();
+void Room145::roxySpeaking() {
+ _roxy.terminate();
_roxyState = 39;
digi_play(conv_sound_to_play(), 1, 255, 4);
- _rx.play("145rx04", 0x900, 4, -1);
+ _roxy.play("145rx04", 0x900, 4, -1, 6, -1);
}
void Room145::loadSeries1() {
@@ -953,13 +954,13 @@ int Room145::getRandomDrumzState() const {
void Room145::resetRoxy() {
switch (_val5) {
case 31:
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 32;
kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 33:
- _rx.terminate();
+ _roxy.terminate();
_roxyState = 33;
kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
diff --git a/engines/m4/burger/rooms/section1/room145.h b/engines/m4/burger/rooms/section1/room145.h
index 6977ff2830a..2c0042893fe 100644
--- a/engines/m4/burger/rooms/section1/room145.h
+++ b/engines/m4/burger/rooms/section1/room145.h
@@ -63,8 +63,8 @@ private:
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
machine *_amplifier = nullptr;
- Series _vp;
- Series _rx;
+ Series _viper;
+ Series _roxy;
const char *_digiName1 = nullptr;
const char *_digiName2 = nullptr;
bool _flag1 = false;
@@ -80,8 +80,8 @@ private:
void conv21();
void conv22();
void conv23();
- void loadVp4();
- void loadRx4();
+ void viperSpeaking();
+ void roxySpeaking();
void loadSeries1();
int getRandomDrumzState() const;
void resetRoxy();
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index f615a57d527..0742f09d5a1 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -579,7 +579,7 @@ void Room407::daemon() {
void Room407::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (!_G(flags)[V067] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
+ if (!_G(flags)[kDrumzFled] && _G(player).walk_x >= 140 && _G(player).walk_x <= 240 &&
_G(player).walk_y >= 295 && _G(player).walk_y <= 325)
player_walk_to(139, 326);
Commit: 163233d6208b08af2b4e5eb0ef29d683a0a4ca36
https://github.com/scummvm/scummvm/commit/163233d6208b08af2b4e5eb0ef29d683a0a4ca36
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting amplifier
Changed paths:
engines/m4/burger/rooms/section1/room145.cpp
diff --git a/engines/m4/burger/rooms/section1/room145.cpp b/engines/m4/burger/rooms/section1/room145.cpp
index eadfeddbd00..f51ae91903d 100644
--- a/engines/m4/burger/rooms/section1/room145.cpp
+++ b/engines/m4/burger/rooms/section1/room145.cpp
@@ -707,6 +707,7 @@ void Room145::daemon() {
break;
case 9:
+ enable_player();
hotspot_set_active("AMPLIFIER ", false);
inv_give_to_player("AMPLIFIER");
break;
@@ -734,6 +735,7 @@ void Room145::daemon() {
break;
default:
+ _G(kernel).continue_handling_trigger = true;
break;
}
break;
Commit: dc2a3045262d6fa8096ddfd5b1825027a244121b
https://github.com/scummvm/scummvm/commit/dc2a3045262d6fa8096ddfd5b1825027a244121b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix climbing stairs in test 4, stairs bork enum
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room502.h
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room510.cpp
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5_room.cpp
engines/m4/burger/rooms/section5/section5_room.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 51a2200a7f1..d21347c919f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -677,7 +677,7 @@ void BurgerEngine::testDone4() {
_G(flags)[V197] = 1;
_G(flags)[V198] = 1;
_G(flags)[V199] = 1;
- _G(flags)[V200] = 5003;
+ _G(flags)[kStairsBorkState] = 5003;
_G(flags)[kBORK_STATE] = 16;
_G(flags)[V204] = 5003;
_G(flags)[V205] = 1;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 56a3d223c71..d8a7d4a899e 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -287,7 +287,7 @@ void Flags::reset4() {
(*this)[V197] = 0;
(*this)[V198] = 0;
(*this)[V199] = 0;
- (*this)[V200] = 5000;
+ (*this)[kStairsBorkState] = 5000;
inv_move_object("KINDLING", 502);
inv_move_object("BURNING KINDLING", 502);
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 13a14e33cf5..1ce8974f76f 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -234,7 +234,7 @@ enum {
V198 = 198,
V199 = 199,
- V200 = 200,
+ kStairsBorkState = 200,
V201 = 201,
V202 = 202,
kBORK_STATE = 203,
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index e3fda55806a..6bf48a4f8ef 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -138,7 +138,7 @@ static void gizmo_digi_daemon(int trigger) {
break;
case 5005:
- if (_G(flags)[V200] == 5003)
+ if (_G(flags)[kStairsBorkState] == 5003)
gizmo_digi_play("510w019", 255, _GIZMO(roomFlags)[13]);
else
gizmo_digi_play("510w018", 255, _GIZMO(roomFlags)[12]);
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index 808ddcfbd49..d76e47e10ca 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -27,6 +27,12 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kBORK_ON_FAN = 5000,
+ kBORK_SLIDING_DOWN = 5001,
+ kBORK_CLIMBING_STAIRS = 5002
+};
+
const Section5Room::BorkPoint Room502::BORK_TABLE[] = {
{ 386, 44 }, { 368, 62 }, { 343, 80 }, { 314, 109 }, { 298, 123 },
{ 279, 143 }, { 255, 166 }, { 255, 166 }, { 252, 166 }, { 249, 168 },
@@ -329,7 +335,7 @@ void Room502::init() {
void Room502::daemon() {
switch (_G(kernel).trigger) {
case 1:
- pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val6);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _destTrigger);
break;
case 5:
@@ -414,7 +420,7 @@ void Room502::daemon() {
break;
case 8:
- if (_G(flags)[V200] == 5001) {
+ if (_G(flags)[kStairsBorkState] == kBORK_SLIDING_DOWN) {
player_update_info();
if (_G(player_info).x < 242 && _G(player_info).y < 265) {
@@ -490,10 +496,10 @@ void Room502::daemon() {
break;
case 11:
- if (_G(flags)[V200] != 5003) {
+ if (_G(flags)[kStairsBorkState] != 5003) {
player_update_info();
- if ((_G(player_info).x < 242 || _G(player_info).y > 265) &&
+ if ((_G(player_info).x > 242 || _G(player_info).y > 265) &&
!_flag1 && !digi_play_state(1)) {
_flag1 = true;
loadSeries3();
@@ -516,9 +522,9 @@ void Room502::daemon() {
break;
case 27:
- _G(flags)[V200] = 5000;
+ _G(flags)[kStairsBorkState] = kBORK_ON_FAN;
_G(flags)[V186] = 0;
- _walker1.terminate();
+ _borkStairs.terminate();
_val7 = imath_rand_bool(3) ? 29 : 28;
kernel_timing_trigger(imath_ranged_rand(240, 360), 11);
@@ -527,48 +533,48 @@ void Room502::daemon() {
case 28:
_val8 = 0;
kernel_trigger_dispatch_now(14);
- _G(flags)[V200] = 5001;
+ _G(flags)[kStairsBorkState] = kBORK_SLIDING_DOWN;
_G(flags)[V186] = 1;
kernel_trigger_dispatch_now(8);
_val4 = 32;
- _walker1.play("502bkst", 0xc00, 16, 13, 6, 0, 100, 0, 0, 0, 8);
+ _borkStairs.play("502bkst", 0xc00, 16, 13, 6, 0, 100, 0, 0, 0, 8);
break;
case 29:
_val8 = 0;
kernel_trigger_dispatch_now(14);
- _G(flags)[V200] = 5001;
+ _G(flags)[kStairsBorkState] = kBORK_SLIDING_DOWN;
_G(flags)[V186] = 1;
kernel_trigger_dispatch_now(8);
_val4 = 30;
- _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 0, 8);
+ _borkStairs.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 0, 8);
break;
case 30:
kernel_trigger_dispatch_now(22);
_val4 = 31;
- _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 9, 18);
+ _borkStairs.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 9, 18);
break;
case 31:
_val8 = 1;
kernel_trigger_dispatch_now(14);
_val4 = 32;
- _walker1.play("502bkst", 0xc00, 0, 13, 6, 2, 100, 0, 0, 19, 22);
+ _borkStairs.play("502bkst", 0xc00, 0, 13, 6, 2, 100, 0, 0, 19, 22);
break;
case 32:
digi_stop(2);
digi_unload("502_007");
- _walker1.terminate();
+ _borkStairs.terminate();
_val4 = 33;
- _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 23, 32);
+ _borkStairs.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 23, 32);
break;
case 33:
- _G(flags)[V200] = 5002;
+ _G(flags)[kStairsBorkState] = kBORK_CLIMBING_STAIRS;
_val4 = 20;
- _walker1.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 33, 44);
+ _borkStairs.play("502bkst", 0xc00, 0, 13, 6, 0, 100, 0, 0, 33, 44);
digi_preload("502_006");
digi_play("502_006", 2);
break;
@@ -662,7 +668,7 @@ void Room502::daemon() {
break;
case 21:
- if ((_G(flags)[V200] == 5000 || _G(flags)[V200] == 5003) &&
+ if ((_G(flags)[kStairsBorkState] == 5000 || _G(flags)[kStairsBorkState] == 5003) &&
!_flag1 && !digi_play_state(1)) {
_flag1 = true;
kernel_trigger_dispatch_now(22);
@@ -678,7 +684,7 @@ void Room502::daemon() {
break;
case 23:
- if (_G(flags)[V200] == 5000 || _G(flags)[V200] == 5003)
+ if (_G(flags)[kStairsBorkState] == 5000 || _G(flags)[kStairsBorkState] == 5003)
_flag1 = false;
_series2 = series_show("502spark", 0xc00);
@@ -706,7 +712,7 @@ void Room502::daemon() {
ws_demand_location(237, 235);
player_set_commands_allowed(false);
ws_hide_walker();
- _val6 = 5009;
+ _destTrigger = 5009;
series_play_with_breaks(PLAY1, "502wi02", 0xc01, 1, 3, 5);
break;
@@ -751,10 +757,10 @@ void Room502::daemon() {
break;
case 9:
- if (_G(flags)[V200] == 5003) {
+ if (_G(flags)[kStairsBorkState] == 5003) {
_G(wilbur_should) = 10001;
} else {
- _G(flags)[V200] = 5003;
+ _G(flags)[kStairsBorkState] = 5003;
_val2 = 19;
_G(wilbur_should) = 1;
}
@@ -806,14 +812,14 @@ void Room502::pre_parser() {
void Room502::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- bool railing = player_said("RAILING") && _G(flags)[V200] == 5003;
+ bool railing = player_said("RAILING") && _G(flags)[kStairsBorkState] == 5003;
bool takeKindling = player_said("KINDLING ") && player_said("TAKE");
bool gearKindling = player_said("KINDLING ") && player_said("GEAR");
bool fireplace = player_said("FIREPLACE") && _G(flags)[V198] != 0;
if (player_said("LOOK AT", "FRONT DOOR") && _G(flags)[V195]) {
wilbur_speech("502w004");
- } else if (player_said("LOOK AT STAIRS") && _G(flags)[V200] == 5003) {
+ } else if (player_said("LOOK AT STAIRS") && _G(flags)[kStairsBorkState] == 5003) {
wilbur_speech("502w008");
} else if (railing && player_said("LOOK AT")) {
wilbur_speech("502w015");
@@ -837,7 +843,7 @@ void Room502::parser() {
wilbur_speech("502w025");
} else if (fireplace && player_said("RUBBER DUCK")) {
wilbur_speech("502w030");
- } else if (player_said("GEAR", "WINDOW") && _G(flags)[V200] == 5003) {
+ } else if (player_said("GEAR", "WINDOW") && _G(flags)[kStairsBorkState] == 5003) {
wilbur_speech("502w026");
} else if ((player_said("LOOK AT") || player_said("GEAR")) &&
player_said("PHONE JACK") && _G(flags)[V197] != 0) {
@@ -850,7 +856,7 @@ void Room502::parser() {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR")) {
- _val6 = 5007;
+ _destTrigger = 5007;
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 3;
@@ -939,7 +945,7 @@ void Room502::setup1() {
}
void Room502::setup2() {
- if (_G(flags)[V200] == 5003) {
+ if (_G(flags)[kStairsBorkState] == 5003) {
_val5 = 36;
kernel_trigger_dispatch_now(17);
kernel_trigger_dispatch_now(18);
diff --git a/engines/m4/burger/rooms/section5/room502.h b/engines/m4/burger/rooms/section5/room502.h
index 53d86ddf95c..d7ecd3b172b 100644
--- a/engines/m4/burger/rooms/section5/room502.h
+++ b/engines/m4/burger/rooms/section5/room502.h
@@ -64,7 +64,7 @@ private:
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
- int _val6 = 0;
+ int _destTrigger = 0;
int _val7 = 0;
int _val8 = 0;
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 67a207dfae0..40f923a0e31 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -126,7 +126,7 @@ void Room505::init() {
break;
}
- if (_G(flags)[V200] == 5003) {
+ if (_G(flags)[kStairsBorkState] == 5003) {
kernel_trigger_dispatch_now(7);
} else {
series_load("505bk01");
@@ -149,7 +149,7 @@ void Room505::daemon() {
break;
case 2:
- if (_G(flags)[V200] == 5000) {
+ if (_G(flags)[kStairsBorkState] == 5000) {
player_update_info();
if (_G(player_info).y > 280 && _G(player_info).y < 300) {
@@ -177,16 +177,16 @@ void Room505::daemon() {
switch (_val1) {
case 4:
_G(flags)[186] = 0;
- _walker1.terminate();
+ _borkStairs.terminate();
_val3 = 5;
kernel_timing_trigger(imath_ranged_rand(240, 360), 3);
break;
case 5:
_G(flags)[V186] = 1;
- _G(flags)[V200] = 5000;
+ _G(flags)[kStairsBorkState] = 5000;
_val1 = 6;
- _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 0, 2);
+ _borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 0, 2);
break;
case 6:
@@ -194,28 +194,28 @@ void Room505::daemon() {
kernel_trigger_dispatch_now(5);
kernel_trigger_dispatch_now(2);
_val1 = 7;
- _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 3, 9);
+ _borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 3, 9);
break;
case 7:
terminateMachineAndNull(_series1);
_val1 = 8;
- _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 10, 24);
+ _borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 10, 24);
_val4 = 1;
kernel_trigger_dispatch_now(5);
break;
case 8:
_val1 = 9;
- _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 25, 24);
+ _borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 25, 24);
_val4 = 2;
kernel_trigger_dispatch_now(5);
break;
case 9:
- _G(flags)[V200] = 5001;
+ _G(flags)[kStairsBorkState] = 5001;
_val1 = 4;
- _walker1.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 27, 31);
+ _borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 27, 31);
_val4 = 3;
kernel_trigger_dispatch_now(5);
break;
@@ -300,9 +300,9 @@ void Room505::pre_parser() {
void Room505::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- bool railingFlag = player_said("RAILING") && _G(flags)[V200] == 5003;
+ bool railingFlag = player_said("RAILING") && _G(flags)[kStairsBorkState] == 5003;
- if (player_said("LOOK AT", "STAIRS") && _G(flags)[V200] == 5003) {
+ if (player_said("LOOK AT", "STAIRS") && _G(flags)[kStairsBorkState] == 5003) {
wilbur_speech("505w002");
} else if (railingFlag && player_said("LOOK AT")) {
wilbur_speech("505w005");
diff --git a/engines/m4/burger/rooms/section5/room510.cpp b/engines/m4/burger/rooms/section5/room510.cpp
index e5ce47139fc..fbe2a2e6db5 100644
--- a/engines/m4/burger/rooms/section5/room510.cpp
+++ b/engines/m4/burger/rooms/section5/room510.cpp
@@ -172,7 +172,7 @@ void Room510::parser() {
wilbur_speech("510w017");
}
} else if (player_said("PURPLE BUTTON")) {
- wilbur_speech(_G(flags)[V200] != 5003 ? "510w018" : "510w019");
+ wilbur_speech(_G(flags)[kStairsBorkState] != 5003 ? "510w018" : "510w019");
} else if (player_said("PINK BUTTON")) {
wilbur_speech("510w020");
} else {
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 4e0f52a7970..3c9d3532790 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -564,7 +564,7 @@ void Section5::takeGizmo(RGB8 *pal) {
}
bool Section5::checkFlags() {
- return _G(flags)[V197] && _G(flags)[V200] == 5003 &&
+ return _G(flags)[V197] && _G(flags)[kStairsBorkState] == 5003 &&
_G(flags)[V210] == 5002 && _G(flags)[V218] == 5003 &&
_G(flags)[V223] == 2 && _G(flags)[V227] != 0;
}
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index 78bfafdb036..11190eefb93 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -80,12 +80,12 @@ void Section5Room::init() {
HotSpotRec *Section5Room::custom_hotspot_which(int32 x, int32 y) {
HotSpotRec *hotspot = Rooms::Room::custom_hotspot_which(x, y);
- if (hotspot != nullptr || _G(flags)[V186] == 0 || !_walker1 ||
+ if (hotspot != nullptr || _G(flags)[V186] == 0 || !_borkStairs ||
(_G(game).room_id != 502 && _G(game).room_id != 505))
return hotspot;
assert(_borkTable);
- int index = _walker1.regs()[IDX_CELS_INDEX];
+ int index = _borkStairs.regs()[IDX_CELS_INDEX];
int x1 = _borkTable[index]._x;
int y1 = _borkTable[index]._y;
int total = (x - x1) * (x - x1) + (y - y1) * (y - y1);
diff --git a/engines/m4/burger/rooms/section5/section5_room.h b/engines/m4/burger/rooms/section5/section5_room.h
index 8599b821361..32c90ae30d6 100644
--- a/engines/m4/burger/rooms/section5/section5_room.h
+++ b/engines/m4/burger/rooms/section5/section5_room.h
@@ -35,7 +35,7 @@ protected:
int16 _y;
};
const BorkPoint *_borkTable = nullptr;
- Series _walker1;
+ Series _borkStairs;
HotSpotRec _borkHotspot;
int _borkThreshold = 0;
bool _initFlag = false;
Commit: 3ffb132795e2ec8422df4facca695c405dd0f841
https://github.com/scummvm/scummvm/commit/3ffb132795e2ec8422df4facca695c405dd0f841
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room change fixes for Aunt Polly's house
Changed paths:
engines/m4/burger/rooms/section1/room171.cpp
engines/m4/burger/rooms/section1/room172.cpp
engines/m4/burger/rooms/section1/room174.cpp
engines/m4/burger/rooms/section1/room175.cpp
engines/m4/burger/rooms/section1/room176.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room503.cpp
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room506.h
engines/m4/burger/rooms/section5/room507.cpp
diff --git a/engines/m4/burger/rooms/section1/room171.cpp b/engines/m4/burger/rooms/section1/room171.cpp
index 2b515a0e599..acc7efeefd8 100644
--- a/engines/m4/burger/rooms/section1/room171.cpp
+++ b/engines/m4/burger/rooms/section1/room171.cpp
@@ -665,7 +665,7 @@ void Room171::pre_parser() {
if (!player_said("GEAR") && player_said("FRONT DOOR")) {
player_set_facing_at(94, 281);
- } else if (player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
+ } else if (!player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
player_set_facing_at(601, 296);
} else if (player_said("GEAR", "FRONT DOOR")) {
diff --git a/engines/m4/burger/rooms/section1/room172.cpp b/engines/m4/burger/rooms/section1/room172.cpp
index e2cb36ad391..8ce766d82c4 100644
--- a/engines/m4/burger/rooms/section1/room172.cpp
+++ b/engines/m4/burger/rooms/section1/room172.cpp
@@ -328,7 +328,7 @@ void Room172::pre_parser() {
_G(player).walk_y >= 311 && _G(player).walk_y <= 353)
player_hotspot_walk_override(356, 332, 3);
- if (player_said_any("GEAR", "LOOK AT")) {
+ if (!player_said_any("GEAR", "LOOK AT")) {
if (player_said("PARLOUR"))
player_set_facing_at(84, 300);
diff --git a/engines/m4/burger/rooms/section1/room174.cpp b/engines/m4/burger/rooms/section1/room174.cpp
index ba0491b9641..380389624eb 100644
--- a/engines/m4/burger/rooms/section1/room174.cpp
+++ b/engines/m4/burger/rooms/section1/room174.cpp
@@ -153,7 +153,7 @@ void Room174::daemon() {
}
void Room174::pre_parser() {
- if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT"))
+ if (player_said("HALLWAY") && !player_said_any("GEAR", "LOOK AT"))
player_set_facing_at(522, 287);
}
diff --git a/engines/m4/burger/rooms/section1/room175.cpp b/engines/m4/burger/rooms/section1/room175.cpp
index 6286ab14207..faddbc4c993 100644
--- a/engines/m4/burger/rooms/section1/room175.cpp
+++ b/engines/m4/burger/rooms/section1/room175.cpp
@@ -127,15 +127,13 @@ void Room175::daemon() {
}
void Room175::pre_parser() {
- if (player_said_any("GEAR", "LOOK AT")) {
+ if (!player_said_any("GEAR", "LOOK AT")) {
if (player_said("BATHROOM"))
player_set_facing_at(194, 301);
if (player_said("WILBUR'S ROOM"))
player_set_facing_at(126, 343);
}
-
-
}
void Room175::parser() {
diff --git a/engines/m4/burger/rooms/section1/room176.cpp b/engines/m4/burger/rooms/section1/room176.cpp
index 4fa6363a316..b1e31bfb131 100644
--- a/engines/m4/burger/rooms/section1/room176.cpp
+++ b/engines/m4/burger/rooms/section1/room176.cpp
@@ -106,7 +106,7 @@ void Room176::daemon() {
}
void Room176::pre_parser() {
- if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT"))
+ if (player_said("HALLWAY") && !player_said_any("GEAR", "LOOK AT"))
player_set_facing_at(487, 238);
}
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index d76e47e10ca..cf6139a3c38 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -806,7 +806,7 @@ void Room502::daemon() {
void Room502::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (player_said("KITCHEN") && player_said_any("LOOK AT", "GEAR"))
+ if (player_said("KITCHEN") && !player_said_any("LOOK AT", "GEAR"))
player_set_facing_hotspot();
}
diff --git a/engines/m4/burger/rooms/section5/room503.cpp b/engines/m4/burger/rooms/section5/room503.cpp
index 49a60c8744b..336d08a869e 100644
--- a/engines/m4/burger/rooms/section5/room503.cpp
+++ b/engines/m4/burger/rooms/section5/room503.cpp
@@ -891,10 +891,10 @@ void Room503::pre_parser() {
}
}
- if (player_said("PARLOUR") && player_said_any("ENTER", "LOOK AT", "GEAR"))
+ if (player_said("PARLOUR") && !player_said_any("ENTER", "LOOK AT", "GEAR"))
player_set_facing_hotspot();
- if (player_said("BASEMENT") && player_said_any("ENTER", "LOOK AT", "GEAR"))
+ if (player_said("BASEMENT") && !player_said_any("ENTER", "LOOK AT", "GEAR"))
player_set_facing_hotspot();
return;
}
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index a7736464686..e65e4c8d775 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -630,7 +630,7 @@ void Room504::daemon() {
void Room504::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (player_said("STAIRS") && player_said_any("CLIMB", "GEAR"))
+ if (player_said("STAIRS") && !player_said_any("CLIMB", "GEAR"))
player_set_facing_hotspot();
}
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 40f923a0e31..3dcf20e026d 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -293,8 +293,8 @@ void Room505::daemon() {
void Room505::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if ((player_said("WILBUR'S ROOM") || player_said("BATHROOM") || player_said("AUNT POLLY'S ROOM")) &&
- player_said_any("ENTER", "LOOK AT", "GEAR"))
+ if (player_said_any("WILBUR'S ROOM", "BATHROOM", "AUNT POLLY'S ROOM") &&
+ !player_said_any("ENTER", "LOOK AT", "GEAR"))
player_set_facing_hotspot();
}
@@ -330,6 +330,8 @@ void Room505::parser() {
} else {
return;
}
+
+ _G(player).command_ready = false;
}
} // namespace Rooms
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index b13134f00cd..8f658683028 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -210,7 +210,7 @@ void Room506::daemon() {
break;
case 3:
- pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val3);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _destTrigger);
break;
case 4:
@@ -381,7 +381,7 @@ void Room506::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
- _val3 = 5012;
+ _destTrigger = 5012;
kernel_timing_trigger(180, 3);
series_play_with_breaks(PLAY1, "506wi01", 0x800, -1, 3);
break;
@@ -426,7 +426,7 @@ void Room506::daemon() {
player_set_commands_allowed(false);
ws_hide_walker();
- _val3 = 5006;
+ _destTrigger = 5006;
_triggers[0] = 3;
_triggers[1] = kCHANGE_WILBUR_ANIMATION;
_G(wilbur_should) = 8;
@@ -459,7 +459,7 @@ void Room506::pre_parser() {
_G(wilbur_should) = 7;
player_hotspot_walk_override(409, 311, 4, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
- } else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
+ } else if (player_said("HALLWAY") && !player_said_any("LEAVE", "LOOK AT", "GEAR")) {
player_set_facing_hotspot();
}
}
@@ -489,7 +489,7 @@ void Room506::parser() {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("HALLWAY") && player_said_any("LEAVE", "LOOK AT", "GEAR")) {
- _val3 = 5009;
+ _destTrigger = 5009;
kernel_trigger_dispatch_now(3);
} else {
return;
diff --git a/engines/m4/burger/rooms/section5/room506.h b/engines/m4/burger/rooms/section5/room506.h
index 33695e88aec..1785dd4d400 100644
--- a/engines/m4/burger/rooms/section5/room506.h
+++ b/engines/m4/burger/rooms/section5/room506.h
@@ -48,7 +48,7 @@ private:
int _loopCount = 0;
int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
+ int _destTrigger = 0;
int _val4 = 0;
void loadSeries();
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index 17824d18176..cc40058700b 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -676,7 +676,7 @@ void Room507::daemon() {
void Room507::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT", "ENTER"))
+ if (player_said("HALLWAY") && !player_said_any("GEAR", "LOOK AT", "ENTER"))
player_set_facing_hotspot();
}
Commit: 2cd2071ecc944ca47c9ad9a384910acf53b3fa45
https://github.com/scummvm/scummvm/commit/2cd2071ecc944ca47c9ad9a384910acf53b3fa45
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix entering bathroom
Changed paths:
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
engines/m4/burger/rooms/section5/room507.cpp
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 3dcf20e026d..59fbfd24113 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -145,7 +145,7 @@ void Room505::init() {
void Room505::daemon() {
switch (_G(kernel).trigger) {
case 1:
- pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _val2);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, 30, _destTrigger);
break;
case 2:
@@ -268,7 +268,7 @@ void Room505::daemon() {
case 2:
player_set_commands_allowed(false);
ws_hide_walker();
- _val2 = 5006;
+ _destTrigger = 5006;
kernel_timing_trigger(30, 1);
series_play_with_breaks(PLAY2, "505wi02", 0xc00, -1, 3);
break;
@@ -311,13 +311,13 @@ void Room505::parser() {
} else if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("WILBUR'S ROOM") && player_said_any("GEAR", "ENTER", "LOOK AT")) {
- _val2 = 5010;
+ _destTrigger = 5010;
kernel_trigger_dispatch_now(1);
- } else if (player_said("LOOK AT", "BATHROOM") && player_said("GEAR", "BATHROOM")) {
- _val2 = 5011;
+ } else if (player_said("LOOK AT", "BATHROOM") || player_said("GEAR", "BATHROOM")) {
+ _destTrigger = 5011;
kernel_trigger_dispatch_now(1);
} else if (player_said("LOOK AT", "AUNT POLLY'S ROOM") || player_said("GEAR", "AUNT POLLY'S ROOM")) {
- _val2 = 5013;
+ _destTrigger = 5013;
kernel_trigger_dispatch_now(1);
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 2;
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index 49bd2a9d3ad..1b542e2e8ac 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -36,7 +36,7 @@ private:
static const seriesPlayBreak PLAY2[];
char _bork[8], _lookAt[8];
int _val1 = 0;
- int _val2 = 0;
+ int _destTrigger = 0;
int _val3 = 0;
int _val4 = 0;
machine *_series1 = nullptr;
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index cc40058700b..b7043e86cc4 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -245,10 +245,12 @@ void Room507::init() {
case 505:
ws_demand_location(610, 280, 1);
+ player_set_commands_allowed(true);
if (player_been_here(507)) {
ws_walk(343, 323, nullptr, -1);
} else {
+ // There's a bork in my tub
_val1 = 12;
ws_walk(343, 323, nullptr, 3);
}
@@ -540,7 +542,7 @@ void Room507::daemon() {
break;
case 10:
- _series2 = series_show("5070flush", 0xf00);
+ _series2 = series_show("507flush", 0xf00);
break;
case 11:
Commit: c04545484e65889fd21734e90b08b082b705e89f
https://github.com/scummvm/scummvm/commit/c04545484e65889fd21734e90b08b082b705e89f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for stairs bork
Changed paths:
engines/m4/burger/rooms/section5/room505.cpp
engines/m4/burger/rooms/section5/room505.h
engines/m4/burger/rooms/section5/room507.cpp
engines/m4/burger/rooms/section5/room507.h
diff --git a/engines/m4/burger/rooms/section5/room505.cpp b/engines/m4/burger/rooms/section5/room505.cpp
index 59fbfd24113..11fb9d67981 100644
--- a/engines/m4/burger/rooms/section5/room505.cpp
+++ b/engines/m4/burger/rooms/section5/room505.cpp
@@ -28,10 +28,10 @@ namespace Burger {
namespace Rooms {
const char *Room505::SAID[][4] = {
- { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
- { "BATHROOM", nullptr, "500w001", nullptr },
+ { "WILBUR'S ROOM", nullptr, "500w001", nullptr },
+ { "BATHROOM", nullptr, "500w001", nullptr },
{ "AUNT POLLY'S ROOM", nullptr, "500w001", nullptr },
- { "STAIRS", nullptr, "505w001", "500w001" },
+ { "STAIRS", "505w001", "500w001", nullptr },
{ "STAIRWAY BORK", "505w003", "500w002", "500w002" },
{ "RAILING", "505w004", nullptr, "505w006" },
{ "WINDOW", "500w003", nullptr, "500w004" },
@@ -132,7 +132,7 @@ void Room505::init() {
series_load("505bk01");
series_load("505bk01s");
_borkTable = BORK;
- _val1 = 7;
+ _borkState = 7;
_G(flags)[V186] = 1;
kernel_trigger_dispatch_now(4);
kernel_trigger_dispatch_now(2);
@@ -166,7 +166,7 @@ void Room505::daemon() {
player_update_info();
if (_G(player_info).y > 300) {
- _val1 = _val3;
+ _borkState = _val3;
kernel_trigger_dispatch_now(4);
} else {
kernel_timing_trigger(15, 3);
@@ -174,9 +174,9 @@ void Room505::daemon() {
break;
case 4:
- switch (_val1) {
+ switch (_borkState) {
case 4:
- _G(flags)[186] = 0;
+ _G(flags)[V186] = 0;
_borkStairs.terminate();
_val3 = 5;
kernel_timing_trigger(imath_ranged_rand(240, 360), 3);
@@ -185,7 +185,7 @@ void Room505::daemon() {
case 5:
_G(flags)[V186] = 1;
_G(flags)[kStairsBorkState] = 5000;
- _val1 = 6;
+ _borkState = 6;
_borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 0, 2);
break;
@@ -193,20 +193,20 @@ void Room505::daemon() {
_val4 = 0;
kernel_trigger_dispatch_now(5);
kernel_trigger_dispatch_now(2);
- _val1 = 7;
+ _borkState = 7;
_borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 3, 9);
break;
case 7:
terminateMachineAndNull(_series1);
- _val1 = 8;
+ _borkState = 8;
_borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 10, 24);
_val4 = 1;
kernel_trigger_dispatch_now(5);
break;
case 8:
- _val1 = 9;
+ _borkState = 9;
_borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 25, 24);
_val4 = 2;
kernel_trigger_dispatch_now(5);
@@ -214,7 +214,7 @@ void Room505::daemon() {
case 9:
_G(flags)[kStairsBorkState] = 5001;
- _val1 = 4;
+ _borkState = 4;
_borkStairs.play("505bk01", 0xbff, 0, 4, 6, 0, 100, 0, 0, 27, 31);
_val4 = 3;
kernel_trigger_dispatch_now(5);
diff --git a/engines/m4/burger/rooms/section5/room505.h b/engines/m4/burger/rooms/section5/room505.h
index 1b542e2e8ac..2457891cea7 100644
--- a/engines/m4/burger/rooms/section5/room505.h
+++ b/engines/m4/burger/rooms/section5/room505.h
@@ -35,7 +35,7 @@ private:
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
char _bork[8], _lookAt[8];
- int _val1 = 0;
+ int _borkState = 0;
int _destTrigger = 0;
int _val3 = 0;
int _val4 = 0;
diff --git a/engines/m4/burger/rooms/section5/room507.cpp b/engines/m4/burger/rooms/section5/room507.cpp
index b7043e86cc4..37650cd5226 100644
--- a/engines/m4/burger/rooms/section5/room507.cpp
+++ b/engines/m4/burger/rooms/section5/room507.cpp
@@ -415,7 +415,7 @@ void Room507::daemon() {
case 19:
_val2 = 24;
_triggers[0] = 6;
- _val7 = 1;
+ _itemNum = 1;
_val8 = 11;
_state1 = imath_ranged_rand(1, 2);
_state2 = imath_ranged_rand(1, 2);
@@ -546,7 +546,7 @@ void Room507::daemon() {
break;
case 11:
- switch (_val7) {
+ switch (_itemNum) {
case 0:
inv_give_to_player("RUBBER DUCKY");
terminateMachineAndNull(_series1);
@@ -592,7 +592,7 @@ void Room507::daemon() {
case 2:
player_set_commands_allowed(false);
ws_hide_walker();
- _val7 = 0;
+ _itemNum = 0;
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY2, "507wi01", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
@@ -632,7 +632,7 @@ void Room507::daemon() {
case 8:
_G(flags)[V224] = 1;
- _val7 = 2;
+ _itemNum = 2;
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY4, "507wi04", 0x8ff, 11, 3);
break;
@@ -659,6 +659,7 @@ void Room507::daemon() {
case 11:
player_set_commands_allowed(false);
ws_hide_walker();
+ _itemNum = 3;
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY8, "507wi06", 0xd00, kCHANGE_WILBUR_ANIMATION, 3);
break;
diff --git a/engines/m4/burger/rooms/section5/room507.h b/engines/m4/burger/rooms/section5/room507.h
index 7962d09ff07..59d119d4977 100644
--- a/engines/m4/burger/rooms/section5/room507.h
+++ b/engines/m4/burger/rooms/section5/room507.h
@@ -68,7 +68,7 @@ private:
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
+ int _itemNum = 0;
int _val8 = 0;
int _val9 = 0;
Commit: 4fcf23ed067d9094553c94169e5a116aace6604a
https://github.com/scummvm/scummvm/commit/4fcf23ed067d9094553c94169e5a116aace6604a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix destroying stairs bork
Changed paths:
engines/m4/burger/rooms/section5/room502.cpp
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index cf6139a3c38..d88d1a27163 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -401,7 +401,7 @@ void Room502::daemon() {
case 17:
player_set_commands_allowed(true);
_G(wilbur_should) = 10001;
- wilbur_speech("502w010");
+ wilbur_speech("502w010", kCHANGE_WILBUR_ANIMATION);
break;
case 18:
@@ -411,7 +411,7 @@ void Room502::daemon() {
case 19:
_val4 = 34;
- wilbur_speech("500w047");
+ wilbur_speech("500w047", 13);
break;
default:
Commit: 2a581e87c31a91c12dbc19ec2a307b01d18c0d4e
https://github.com/scummvm/scummvm/commit/2a581e87c31a91c12dbc19ec2a307b01d18c0d4e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting dirty sock
Changed paths:
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room504.h
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index e65e4c8d775..c50a36f04eb 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -224,7 +224,7 @@ void Room504::init() {
kernel_trigger_dispatch_now(9);
if (inv_object_is_here("DIRTY SOCK") && _G(flags)[V210] != 5002) {
- _series1 = series_show("504SOCK", 0xf00);
+ _sock = series_show("504SOCK", 0xf00);
} else {
hotspot_set_active("DIRTY SOCK ", false);
}
@@ -457,15 +457,15 @@ void Room504::daemon() {
break;
case 10:
- switch (_val7) {
+ switch (_sockState) {
case 36:
- terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_sock);
hotspot_set_active("DIRTY SOCK ", false);
inv_give_to_player("DIRTY SOCK");
break;
case 37:
- _series1 = series_show("504SOCK", 0xf00);
+ _sock = series_show("504SOCK", 0xf00);
hotspot_set_active("DIRTY SOCK ", true);
inv_move_object("DIRTY SOCK", NOWHERE);
break;
@@ -512,6 +512,7 @@ void Room504::daemon() {
case 5:
_G(wilbur_should) = 10001;
+ _sockState = 36;
player_set_commands_allowed(false);
ws_hide_walker();
series_play_with_breaks(PLAY8, "504wi06", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
diff --git a/engines/m4/burger/rooms/section5/room504.h b/engines/m4/burger/rooms/section5/room504.h
index 3af1c60a991..ebe5a7956f5 100644
--- a/engines/m4/burger/rooms/section5/room504.h
+++ b/engines/m4/burger/rooms/section5/room504.h
@@ -59,9 +59,9 @@ private:
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
- int _val7 = 0;
+ int _sockState = 0;
int _val8 = 0;
- machine *_series1 = nullptr;
+ machine *_sock = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
machine *_series3s = nullptr;
Commit: cc10f51de2a296d147dce2510737b846a49ce5e1
https://github.com/scummvm/scummvm/commit/cc10f51de2a296d147dce2510737b846a49ce5e1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Minor inventory scrolling fix
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 3ecaa3b0d90..a6eee5f13df 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -587,7 +587,7 @@ bool Inventory::need_left() const {
}
bool Inventory::need_right() const {
- if ((_num_cells - _scroll - MAX_BUTTONS) > 0)
+ if ((_num_cells - _scroll - MAX_INVENTORY) > 0)
return true;
return false;
@@ -680,6 +680,8 @@ void Inventory::draw(GrBuff *myBuffer) {
for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_INVENTORY); cell_iter++) {
int16 left = (int16)(_x1 + cell_pos_x(cell_iter));
int16 top = (int16)(_y1 + cell_pos_y(cell_iter));
+ int16 leftOffset = left + _cell_w;
+ int16 topOffset = top + _cell_h;
if (_must_redraw1 == cell_iter || _must_redraw2 == cell_iter || _must_redraw_all) {
// This does the button update....
@@ -688,7 +690,7 @@ void Inventory::draw(GrBuff *myBuffer) {
// Draw icon here
gr_color_set(__BLACK);
- gr_buffer_rect_fill(myBuff, left, top, _cell_w + 1, _cell_h + 1);
+ gr_buffer_rect_fill(myBuff, left, top, leftOffset - left, topOffset - top);
series_show_frame(_sprite, _items[cell_iter + _scroll]._cell, myBuff,
left + (_cell_w - 31) / 2, top + (_cell_h - 31) / 2);
@@ -705,7 +707,7 @@ void Inventory::draw(GrBuff *myBuffer) {
}
// Draw inventory slot frames
- for (cell_iter = 0; cell_iter < 9; ++cell_iter) {
+ for (cell_iter = 0; cell_iter < MAX_INVENTORY; ++cell_iter) {
series_show_frame(_sprite, 67, myBuff, cell_iter * 39 + 188, 22);
series_show_frame(_sprite, 68, myBuff, cell_iter * 39 + 188, 92);
}
Commit: 4536a983bc376fb01e2003d75260b1530e6c2bfd
https://github.com/scummvm/scummvm/commit/4536a983bc376fb01e2003d75260b1530e6c2bfd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Test 4 is now completable
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/core/play_break.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section5/room502.cpp
engines/m4/burger/rooms/section5/room504.cpp
engines/m4/burger/rooms/section5/room506.cpp
engines/m4/burger/rooms/section5/room508.cpp
engines/m4/burger/rooms/section5/room508.h
engines/m4/burger/rooms/section5/room509.cpp
engines/m4/burger/rooms/section5/room509.h
engines/m4/burger/rooms/section5/section5.cpp
engines/m4/burger/rooms/section5/section5_room.cpp
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index d21347c919f..2328351cdff 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -675,7 +675,7 @@ void BurgerEngine::testDone4() {
_G(flags)[V195] = 1;
_G(flags)[V196] = 0;
_G(flags)[V197] = 1;
- _G(flags)[V198] = 1;
+ _G(flags)[kFireplaceHasFire] = 1;
_G(flags)[V199] = 1;
_G(flags)[kStairsBorkState] = 5003;
_G(flags)[kBORK_STATE] = 16;
diff --git a/engines/m4/burger/core/play_break.cpp b/engines/m4/burger/core/play_break.cpp
index ad1f2ccc401..1583fdfa5df 100644
--- a/engines/m4/burger/core/play_break.cpp
+++ b/engines/m4/burger/core/play_break.cpp
@@ -140,8 +140,9 @@ int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name, fr
if (!(_G(seriesPlayers)[slot].in_use)) break;
}
- if (slot >= MAX_SERIES_PLAYERS) { // no free slots
- term_message("**** all _G(seriesPlayers)s are in use!");
+ if (slot >= MAX_SERIES_PLAYERS) {
+ // No free slots
+ term_message("**** all seriesPlayers are in use!");
return -1;
}
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index d8a7d4a899e..8641857efba 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -285,7 +285,7 @@ void Flags::reset4() {
(*this)[V234] = 0;
(*this)[V196] = 0;
(*this)[V197] = 0;
- (*this)[V198] = 0;
+ (*this)[kFireplaceHasFire] = 0;
(*this)[V199] = 0;
(*this)[kStairsBorkState] = 5000;
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index 1ce8974f76f..ee91f1c397a 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -231,7 +231,7 @@ enum {
V195 = 195,
V196 = 196,
V197 = 197,
- V198 = 198,
+ kFireplaceHasFire = 198,
V199 = 199,
kStairsBorkState = 200,
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index f9c757ac04c..0a4db6758e4 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -1313,8 +1313,8 @@ void Room402::freePe2() {
void Room402::loadPe3() {
if (_pe03 == -1) {
- _pe03 = series_load("403pe03");
- _pe03s = series_load("403pe03s");
+ _pe03 = series_load("402pe03");
+ _pe03s = series_load("402pe03s");
}
}
@@ -1328,8 +1328,8 @@ void Room402::freePe3() {
void Room402::loadPe4() {
if (_pe04 == -1) {
- _pe04 = series_load("404pe04");
- _pe04s = series_load("404pe04s");
+ _pe04 = series_load("402pe04");
+ _pe04s = series_load("402pe04s");
}
}
diff --git a/engines/m4/burger/rooms/section5/room502.cpp b/engines/m4/burger/rooms/section5/room502.cpp
index d88d1a27163..da87c1ad4e0 100644
--- a/engines/m4/burger/rooms/section5/room502.cpp
+++ b/engines/m4/burger/rooms/section5/room502.cpp
@@ -325,7 +325,7 @@ void Room502::init() {
series_show("502logs", 0xc00);
- if (_G(flags)[V198])
+ if (_G(flags)[kFireplaceHasFire])
kernel_trigger_dispatch_now(19);
_flag1 = true;
@@ -658,9 +658,9 @@ void Room502::daemon() {
break;
case 19:
- _G(flags)[V198] = 1;
+ _G(flags)[kFireplaceHasFire] = 1;
digi_play_loop("500_002", 3, 125);
- series_play("502fire", 0xc00, 4);
+ series_play("502fire", 0xc00, 4, -1, 6, -1);
break;
case 20:
@@ -815,7 +815,7 @@ void Room502::parser() {
bool railing = player_said("RAILING") && _G(flags)[kStairsBorkState] == 5003;
bool takeKindling = player_said("KINDLING ") && player_said("TAKE");
bool gearKindling = player_said("KINDLING ") && player_said("GEAR");
- bool fireplace = player_said("FIREPLACE") && _G(flags)[V198] != 0;
+ bool fireplace = player_said("FIREPLACE") && _G(flags)[kFireplaceHasFire] != 0;
if (player_said("LOOK AT", "FRONT DOOR") && _G(flags)[V195]) {
wilbur_speech("502w004");
@@ -827,14 +827,14 @@ void Room502::parser() {
wilbur_speech("502w017");
} else if (takeKindling && inv_player_has("kindling")) {
wilbur_speech("502w019");
- } else if (takeKindling && _G(flags)[V198]) {
+ } else if (takeKindling && _G(flags)[kFireplaceHasFire]) {
wilbur_speech("502w020");
} else if (gearKindling && inv_player_has("KINDLING")) {
wilbur_speech("502w022");
- } else if (gearKindling && _G(flags)[V198]) {
+ } else if (gearKindling && _G(flags)[kFireplaceHasFire]) {
wilbur_speech("502w020");
} else if (player_said("KINDLING") && player_said("FIREPLACE")) {
- wilbur_speech(_G(flags)[V198] ? "500w063" : "500w062");
+ wilbur_speech(_G(flags)[kFireplaceHasFire] ? "500w063" : "500w062");
} else if (player_said("KINDLING") && player_said("WIRES")) {
wilbur_speech("500w065");
} else if (fireplace && player_said("LOOK AT")) {
@@ -868,7 +868,7 @@ void Room502::parser() {
_val3 = 26;
++_state4;
} else if (player_said("TAKE", "KINDLING ")) {
- if (!_G(flags)[V198] && !inv_player_has("KINDLING")) {
+ if (!_G(flags)[kFireplaceHasFire] && !inv_player_has("KINDLING")) {
_G(wilbur_should) = 10;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
diff --git a/engines/m4/burger/rooms/section5/room504.cpp b/engines/m4/burger/rooms/section5/room504.cpp
index c50a36f04eb..750da8935b4 100644
--- a/engines/m4/burger/rooms/section5/room504.cpp
+++ b/engines/m4/burger/rooms/section5/room504.cpp
@@ -203,7 +203,7 @@ void Room504::init() {
hotspot_set_active("BORK GUTS", true);
} else {
_val1 = 25;
- kernel_trigger_dispatch_now(25);
+ kernel_trigger_dispatch_now(5);
_G(kernel).call_daemon_every_loop = true;
hotspot_set_active("BORK GUTS", false);
hotspot_set_active("BORK", true);
diff --git a/engines/m4/burger/rooms/section5/room506.cpp b/engines/m4/burger/rooms/section5/room506.cpp
index 8f658683028..f113b65ac2f 100644
--- a/engines/m4/burger/rooms/section5/room506.cpp
+++ b/engines/m4/burger/rooms/section5/room506.cpp
@@ -451,6 +451,8 @@ void Room506::daemon() {
}
void Room506::pre_parser() {
+ _G(kernel).trigger_mode = KT_DAEMON;
+
if (player_said("AMPLIFIER", "TELEVISION") && _G(flags)[V218] != 5003) {
_G(wilbur_should) = 4;
player_hotspot_walk_override(456, 245, 8, kCHANGE_WILBUR_ANIMATION);
@@ -484,7 +486,7 @@ void Room506::parser() {
player_set_commands_allowed(false);
_val2 = 15;
++_state2;
- } else if (player_said_any("ROOF", "WINDOW") && !player_said_any("ENTER", "GEAR") &&
+ } else if (player_said_any("ROOF", "WINDOW") && player_said_any("ENTER", "GEAR") &&
_G(flags)[V219]) {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
diff --git a/engines/m4/burger/rooms/section5/room508.cpp b/engines/m4/burger/rooms/section5/room508.cpp
index 6f5cfe0949e..ff5a5c555cf 100644
--- a/engines/m4/burger/rooms/section5/room508.cpp
+++ b/engines/m4/burger/rooms/section5/room508.cpp
@@ -27,6 +27,17 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kWILBUR_SPEECH = 1,
+ kCHANGE_BORK_ANIMATION = 2
+};
+
+enum {
+ kSPEECH_DESTROYING_ROOF = 10,
+ kSPEECH_WONT_LET_ME = 11,
+ kSPEECH_BORK_DESTROYED = 12
+};
+
const char *Room508::SAID[][4] = {
{ "WILBUR'S ROOM", nullptr, "500w001", nullptr },
{ "BORK", "508w003", "500w002", "500w002" },
@@ -169,18 +180,18 @@ void Room508::init() {
_state3 = 0;
_val2 = 0;
- if (_G(flags)[V198] == 1) {
+ if (_G(flags)[kFireplaceHasFire] == 1) {
_series1 = series_play("508SMOKE", 0x500, 0, -1, 6, -1);
hotspot_set_active("BORK", false);
if (!_G(flags)[V227]) {
- _val3 = 18;
- kernel_trigger_dispatch_now(2);
+ _borkState = 18;
+ kernel_trigger_dispatch_now(kCHANGE_BORK_ANIMATION);
}
} else {
loadSeries();
setup();
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_BORK_ANIMATION);
}
if (inv_player_has("CHRISTMAS LIGHTS") || inv_player_has("CHRISTMAS LIGHTS ")) {
@@ -204,9 +215,9 @@ void Room508::init() {
player_set_commands_allowed(true);
_G(wilbur_should) = 1;
- if (!player_been_here(508) && !_G(flags)[V198]) {
+ if (!player_been_here(508) && !_G(flags)[kFireplaceHasFire]) {
_flag2 = true;
- _val6 = 10;
+ _speechNum = kSPEECH_DESTROYING_ROOF;
}
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -234,15 +245,15 @@ void Room508::init() {
void Room508::daemon() {
switch (_G(kernel).trigger) {
- case 1:
- switch (_val6) {
- case 10:
+ case kWILBUR_SPEECH:
+ switch (_speechNum) {
+ case kSPEECH_DESTROYING_ROOF:
wilbur_speech("508w001");
break;
- case 11:
+ case kSPEECH_WONT_LET_ME:
wilbur_speech("508w001z");
break;
- case 12:
+ case kSPEECH_BORK_DESTROYED:
wilbur_speech("508w002");
break;
default:
@@ -250,12 +261,12 @@ void Room508::daemon() {
}
break;
- case 2:
- switch (_val3) {
+ case kCHANGE_BORK_ANIMATION:
+ switch (_borkState) {
case 14:
setup();
_state1 = imath_ranged_rand(1, 4);
- series_play_with_breaks(PLAY7, "508BK01", 0x200, 2, 3);
+ series_play_with_breaks(PLAY7, "508BK01", 0x200, kCHANGE_BORK_ANIMATION, 3);
if (_G(flags)[V228] == 0 && _G(flags)[V223] == 0 && _val2 > 3) {
kernel_trigger_dispatch_now(3);
@@ -267,32 +278,32 @@ void Room508::daemon() {
case 15:
setup();
_state1 = imath_ranged_rand(1, 4);
- series_play_with_breaks(PLAY8, "508BK02", 0x200, 2, 3);
+ series_play_with_breaks(PLAY8, "508BK02", 0x200, kCHANGE_BORK_ANIMATION, 3);
break;
case 16:
setup();
_state1 = imath_ranged_rand(1, 2);
_state2 = imath_ranged_rand(1, 4);
- series_play_with_breaks(PLAY9, "508BK03", 0x200, 2, 3);
+ series_play_with_breaks(PLAY9, "508BK03", 0x200, kCHANGE_BORK_ANIMATION, 3);
break;
case 17:
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
++_state3;
- _val6 = 11;
+ _speechNum = 11;
setup();
if (_state3 == 3)
- _val3 = 19;
+ _borkState = 19;
_state1 = imath_ranged_rand(1, 3);
- series_play_with_breaks(PLAY10, "508BK04", 0x200, 2, 3, 6);
+ series_play_with_breaks(PLAY10, "508BK04", 0x200, kCHANGE_BORK_ANIMATION, 3, 6);
break;
case 18:
- _val6 = 12;
+ _speechNum = kSPEECH_BORK_DESTROYED;
_G(flags)[V227] = 1;
hotspot_set_active("BORK", false);
@@ -401,12 +412,12 @@ void Room508::daemon() {
case 4:
if (_flag2) {
_flag2 = false;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kWILBUR_SPEECH);
}
_G(wilbur_should) = 4;
if (!_flag1) {
- kernel_trigger_dispatch_now(1);
+ player_set_commands_allowed(true);
_flag1 = true;
}
@@ -689,7 +700,7 @@ void Room508::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("LOOK AT") && player_said_any("CHIMNEY", "CHIMNEY POTS") &&
- _G(flags)[V198]) {
+ _G(flags)[kFireplaceHasFire]) {
wilbur_speech("508w013");
} else if (player_said("RUBBER DUCKY", "BORK")) {
wilbur_speech("500w042");
@@ -697,6 +708,16 @@ void Room508::parser() {
wilbur_speech("500w069");
} else if (_G(walker).wilbur_said(SAID)) {
// Already handled
+ } else if (player_said("TAKE", "CHRISTMAS LIGHTS ")) {
+ player_set_commands_allowed(false);
+
+ if (_G(flags)[V227]) {
+ _flag1 = false;
+ _G(wilbur_should) = 3;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
+ } else {
+ _borkState = 17;
+ }
} else if (player_said("HOLE") && player_said_any("CHRISTMAS LIGHTS ", "CHRISTMAS LIGHTS")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 7;
@@ -735,13 +756,13 @@ void Room508::setup() {
switch (imath_ranged_rand(0, 3)) {
case 0:
case 1:
- _val3 = 14;
+ _borkState = 14;
break;
case 2:
- _val3 = 15;
+ _borkState = 15;
break;
case 3:
- _val3 = 16;
+ _borkState = 16;
break;
default:
break;
diff --git a/engines/m4/burger/rooms/section5/room508.h b/engines/m4/burger/rooms/section5/room508.h
index 3e86acbc368..4d01be47f2c 100644
--- a/engines/m4/burger/rooms/section5/room508.h
+++ b/engines/m4/burger/rooms/section5/room508.h
@@ -53,10 +53,10 @@ private:
machine *_series4 = nullptr;
int _val1 = 0;
int _val2 = 0;
- int _val3 = 0;
+ int _borkState = 0;
int _val4 = 0;
int _val5 = 0;
- int _val6 = 0;
+ int _speechNum = 0;
bool _flag1 = false;
bool _flag2 = false;
bool _flag3 = false;
diff --git a/engines/m4/burger/rooms/section5/room509.cpp b/engines/m4/burger/rooms/section5/room509.cpp
index f60e08c7703..1b1e56aaadc 100644
--- a/engines/m4/burger/rooms/section5/room509.cpp
+++ b/engines/m4/burger/rooms/section5/room509.cpp
@@ -163,12 +163,12 @@ void Room509::init() {
series_load("509wi07");
series_load("509wi08");
- series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
+ _lights = series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
} else {
hotspot_set_active("CHRISTMAS LIGHTS ", false);
}
- _series2 = series_show("509wire", 0x900);
+ _wire = series_show("509wire", 0x900);
_initFlag = true;
Section5Room::init();
@@ -254,8 +254,9 @@ void Room509::daemon() {
ws_hide_walker();
_G(wilbur_should) = 2;
- terminateMachineAndNull(_series1);
- series_play_with_breaks(PLAY1, (_G(flags)[V212] == 5000) ? "509wi03" : "509wi01");
+ terminateMachineAndNull(_lights);
+ series_play_with_breaks(PLAY1, (_G(flags)[V212] == 5000) ? "509wi03" : "509wi01",
+ 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
@@ -291,7 +292,7 @@ void Room509::daemon() {
case 5:
player_set_commands_allowed(false);
- terminateMachineAndNull(_series2);
+ terminateMachineAndNull(_wire);
if (_G(flags)[V212] == 5000) {
if (_G(flags)[V234]) {
@@ -312,7 +313,7 @@ void Room509::daemon() {
_val5 = 2;
hotspot_set_active("CHRISTMAS LIGHTS ", true);
_G(wilbur_should) = 8;
- series_play_with_breaks(PLAY6, "609wi08", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
+ series_play_with_breaks(PLAY6, "509wi08", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 7:
@@ -332,8 +333,8 @@ void Room509::daemon() {
inv_move_object("CHRISTMAS LIGHTS", NOWHERE);
inv_move_object("CHRISTMAS LIGHTS ", NOWHERE);
hotspot_set_active("CHRISTMAS LIGHTS ", true);
- _series2 = series_show("509wire", 0x900);
- _series1 = series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
+ _wire = series_show("509wire", 0x900);
+ _lights = series_show((_G(flags)[V212] == 5000) ? "509lgt02" : "509lgt01", 0xc00);
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
@@ -409,9 +410,9 @@ void Room509::daemon() {
_G(kernel).trigger_mode = KT_PARSE;
if (_G(flags)[V212] == 5000) {
- _series1 = series_show("509lgt02", 0xc00);
+ _lights = series_show("509lgt02", 0xc00);
} else {
- _series1 = series_show("509lgt01", 0xc00);
+ _lights = series_show("509lgt01", 0xc00);
}
ws_unhide_walker();
diff --git a/engines/m4/burger/rooms/section5/room509.h b/engines/m4/burger/rooms/section5/room509.h
index dbf6a7a85ff..ffdbcf5e592 100644
--- a/engines/m4/burger/rooms/section5/room509.h
+++ b/engines/m4/burger/rooms/section5/room509.h
@@ -41,8 +41,8 @@ private:
static const seriesPlayBreak PLAY8[];
static int32 _state1;
static int32 _state2;
- machine *_series1 = nullptr;
- machine *_series2 = nullptr;
+ machine *_lights = nullptr;
+ machine *_wire = nullptr;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
diff --git a/engines/m4/burger/rooms/section5/section5.cpp b/engines/m4/burger/rooms/section5/section5.cpp
index 3c9d3532790..d43271ac028 100644
--- a/engines/m4/burger/rooms/section5/section5.cpp
+++ b/engines/m4/burger/rooms/section5/section5.cpp
@@ -491,7 +491,7 @@ void Section5::daemon() {
_G(wilbur_should) = 5002;
player_update_info();
series_play_with_breaks(PLAY1, "503wi07", _G(player_info).depth,
- kCHANGE_WILBUR_ANIMATION, 3, _G(player_info).scale,
+ kCHANGE_WILBUR_ANIMATION, 3, 6, _G(player_info).scale,
_G(player_info).x, _G(player_info).y);
break;
diff --git a/engines/m4/burger/rooms/section5/section5_room.cpp b/engines/m4/burger/rooms/section5/section5_room.cpp
index 11190eefb93..9f6ee7115e3 100644
--- a/engines/m4/burger/rooms/section5/section5_room.cpp
+++ b/engines/m4/burger/rooms/section5/section5_room.cpp
@@ -52,7 +52,7 @@ void Section5Room::init() {
switch (_G(game).room_id) {
case 502:
- if (_G(flags)[V198])
+ if (_G(flags)[kFireplaceHasFire])
Section5::_digiName = "500_002";
break;
Commit: 07792876a611e8b648e8205bc2752f993c238bb0
https://github.com/scummvm/scummvm/commit/07792876a611e8b648e8205bc2752f993c238bb0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix room poofing in test 5
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/section4_room.cpp
engines/m4/burger/rooms/section4/section4_room.h
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index 2328351cdff..a973e07c97c 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -336,7 +336,7 @@ void BurgerEngine::global_daemon() {
_G(player_trigger));
break;
- case kSET_DEST:
+ case kPOOF:
ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
_G(walker).wilbur_poof();
kernel_trigger_dispatch_now(kSET_COMMANDS_ALLOWED);
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index 4b682bb222c..c4c1ac66898 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -130,13 +130,13 @@ void Room405::init() {
case 406:
player_set_commands_allowed(false);
ws_demand_location(413, 356, 10);
- setDest();
+ poofArrive();
break;
default:
player_set_commands_allowed(false);
ws_demand_location(241, 266, 4);
- setDest();
+ poofArrive();
break;
}
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index a32d301c43a..7b509cf00d5 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -471,7 +471,7 @@ void Room406::init() {
}
} else {
_val2 = 22;
- kernel_trigger_dispatch_now(22);
+ kernel_trigger_dispatch_now(1);
}
}
@@ -513,7 +513,7 @@ void Room406::init() {
case 402:
ws_demand_location(44, 310);
- setDest();
+ poofArrive();
break;
case 404:
@@ -523,7 +523,7 @@ void Room406::init() {
case 405:
ws_demand_location(460, 346);
- setDest();
+ poofArrive();
break;
default:
@@ -554,6 +554,8 @@ void Room406::daemon() {
default:
break;
}
+
+ kernel_timing_trigger(15, 2);
break;
case 23:
@@ -612,6 +614,8 @@ void Room406::daemon() {
default:
break;
}
+
+ _val2 = 0;
break;
case 5:
@@ -883,10 +887,10 @@ void Room406::daemon() {
_val1 = 55;
break;
case 3:
- _val3 = 53;
+ _val1 = 53;
break;
case 4:
- _val4 = 54;
+ _val1 = 54;
break;
default:
break;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 0742f09d5a1..7c5809ee875 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -188,12 +188,12 @@ void Room407::init() {
case 402:
ws_demand_location(43, 302);
- setDest();
+ poofArrive();
break;
case 405:
ws_demand_location(578, 296);
- setDest();
+ poofArrive();
break;
default:
diff --git a/engines/m4/burger/rooms/section4/section4_room.cpp b/engines/m4/burger/rooms/section4/section4_room.cpp
index 2987ab7f746..eabde8c67b0 100644
--- a/engines/m4/burger/rooms/section4/section4_room.cpp
+++ b/engines/m4/burger/rooms/section4/section4_room.cpp
@@ -27,7 +27,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-void Section4Room::setDest(int ticks) {
+void Section4Room::poofArrive(int ticks) {
player_set_commands_allowed(false);
player_update_info();
@@ -36,7 +36,7 @@ void Section4Room::setDest(int ticks) {
ws_demand_location(-100, _G(player_dest_y));
ws_unhide_walker();
- kernel_timing_trigger(ticks, kSET_DEST);
+ kernel_timing_trigger(ticks, kPOOF);
}
void Section4Room::poof(int trigger) {
diff --git a/engines/m4/burger/rooms/section4/section4_room.h b/engines/m4/burger/rooms/section4/section4_room.h
index 3d5fea8d8ed..9891117d046 100644
--- a/engines/m4/burger/rooms/section4/section4_room.h
+++ b/engines/m4/burger/rooms/section4/section4_room.h
@@ -30,7 +30,7 @@ namespace Rooms {
class Section4Room : public Room {
protected:
- void setDest(int ticks = 120);
+ void poofArrive(int ticks = 120);
void poof(int trigger);
public:
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 7a198db12ff..1c3833f9c60 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -62,7 +62,7 @@ enum global_triggers {
kCHANGE_WILBUR_ANIMATION = 10016,
kAdvanceHour = 10017,
kSET_FACING = 10018,
- kSET_DEST = 10019,
+ kPOOF = 10019,
kSET_COMMANDS_ALLOWED = 10020,
kUNPOOF = 10021,
kTELEPROTED1 = 10024,
Commit: 3a84f7df682c4beadaa10b8b658d88c1b1173ddb
https://github.com/scummvm/scummvm/commit/3a84f7df682c4beadaa10b8b658d88c1b1173ddb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for talking to Stolie
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 0a4db6758e4..444c17891ba 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -437,6 +437,7 @@ void Room402::daemon() {
_stolie.play("402dr08", 0x300, 0, 2, 6, 0, 100, 0, 0, 72, 75);
break;
+ case 45:
case 46:
freeStolie();
_stolieSet = true;
@@ -623,7 +624,7 @@ void Room402::daemon() {
case 47:
loadPe3();
_series2Set = true;
- Series::series_play("402pe03", 0x100, 0, -1, 6, -1, 100, 0, 0, 15, 15);
+ _series2.play("402pe03", 0x100, 0, -1, 6, -1, 100, 0, 0, 15, 15);
break;
default:
@@ -902,7 +903,7 @@ void Room402::parser() {
case 1:
_digiName = "402s006";
_newMode = KT_PARSE;
- _val1 = 2;
+ _digiTrigger = 2;
freeStolie();
_val2 = 45;
break;
@@ -948,6 +949,8 @@ void Room402::parser() {
} else if (player_said("TALK TO", "stolie")) {
player_set_commands_allowed(false);
conv_load_and_prepare("conv84", 1);
+ conv_export_pointer_curr(&Flags::_flags[V157], 0);
+ conv_play_curr();
} else if (player_said("TALK TO", "elmo")) {
if (_G(flags)[V158]) {
switch (_G(kernel).trigger) {
@@ -992,7 +995,7 @@ void Room402::parser() {
case 1:
_digiName = "402p501";
_newMode = KT_PARSE;
- _val1 = 2;
+ _digiTrigger = 2;
_val3 = 45;
break;
@@ -1019,7 +1022,7 @@ void Room402::parser() {
freeDr2();
_digiName = "402p902";
_newMode = KT_PARSE;
- _val1 = 2;
+ _digiTrigger = 2;
_val3 = 45;
break;
@@ -1027,14 +1030,14 @@ void Room402::parser() {
_val3 = 41;
_digiName = "402s007";
_newMode = KT_PARSE;
- _val1 = 3;
+ _digiTrigger = 3;
_val2 = 40;
break;
case 3:
_digiName = "402s008";
_newMode = KT_PARSE;
- _val1 = 4;
+ _digiTrigger = 4;
freeStolie();
freeDr2();
_val2 = 46;
@@ -1051,7 +1054,7 @@ void Room402::parser() {
case 5:
_digiName = "402s009";
_newMode = KT_PARSE;
- _val1 = 6;
+ _digiTrigger = 6;
_val2 = 45;
break;
@@ -1135,7 +1138,7 @@ void Room402::conv84() {
if (who <= 0) {
_digiName = sound;
_newMode = KT_PARSE;
- _val1 = 6;
+ _digiTrigger = 6;
if (node == 1 && entry == 0)
kernel_timing_trigger(180, 21);
@@ -1205,7 +1208,8 @@ void Room402::conv84() {
void Room402::playDigiName() {
if (_digiName) {
_G(kernel).trigger_mode = _newMode;
- digi_play(_digiName, 1, 255, _val1);
+ digi_play(_digiName, 1, 255, _digiTrigger);
+ _digiName = nullptr;
}
}
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index 441e2c6fa5a..a3590c00fe6 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -66,7 +66,7 @@ private:
int _pe04 = -1, _pe04s = -1;
int _wi01 = -1, _wi01s = -1;
int _wi02 = -1, _wi02s = -1;
- int _val1 = 0;
+ int _digiTrigger = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
Commit: 337aab572edc0c60f998dde1d6e4e91995ff931e
https://github.com/scummvm/scummvm/commit/337aab572edc0c60f998dde1d6e4e91995ff931e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Talking to Elmo fix
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index 444c17891ba..b237656aeff 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -957,7 +957,7 @@ void Room402::parser() {
case -1:
player_set_commands_allowed(false);
_G(kernel).trigger_mode = KT_PARSE;
- wilbur_speech("402w501");
+ wilbur_speech("402w501", 1);
break;
case 1:
@@ -989,7 +989,7 @@ void Room402::parser() {
case -1:
player_set_commands_allowed(false);
_G(kernel).trigger_mode = KT_PARSE;
- wilbur_speech("402w501");
+ wilbur_speech("402w501", 1);
break;
case 1:
Commit: bdd0a8ec82cc63774aa69f4516ee4f28dc8a2aa0
https://github.com/scummvm/scummvm/commit/bdd0a8ec82cc63774aa69f4516ee4f28dc8a2aa0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of Stolie/Elmo code in room 402
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index b237656aeff..b85d5852206 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -27,6 +27,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_STOLIE_ANIMATION = 2,
+ kCHANGE_ELMO_ANIMATION = 3
+};
+
const char *Room402::SAID[][4] = {
{ "bench", "402w006", nullptr, "402w007" },
{ "force field", "400w005", nullptr, "400w001" },
@@ -227,9 +232,9 @@ void Room402::init() {
digi_preload(NAMES[i]);
loadPe1();
- _val5 = 15;
- _val3 = 15;
- kernel_trigger_dispatch_now(3);
+ _elmoMode = 15;
+ _elmoShould = 15;
+ kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
if (_G(player).been_here_before) {
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
@@ -257,8 +262,8 @@ void Room402::init() {
}
}
- _val6 = 15;
- kernel_trigger_dispatch_now(2);
+ _stolieMode = 15;
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
}
digi_play_loop("400_001", 3, 175);
@@ -271,17 +276,17 @@ void Room402::daemon() {
case 1:
_val2 = 15;
if (_stolieSet)
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
- _val3 = 15;
+ _elmoShould = 15;
if (_series2Set)
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
player_set_commands_allowed(true);
break;
- case 2:
- switch (_val6) {
+ case kCHANGE_STOLIE_ANIMATION:
+ switch (_stolieMode) {
case 6:
freeDr8();
_wi02 = series_load("402wi02");
@@ -294,13 +299,13 @@ void Room402::daemon() {
switch (_val2) {
case 7:
loadDr8();
- _stolie.play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 75, 75);
+ _stolie.play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 75, 75);
break;
case 8:
- _val6 = 45;
+ _stolieMode = 45;
loadDr8();
- _stolie.play("402dr08", 0x300, 2, 2, 6, 0, 100, 0, 0, 72, 75);
+ _stolie.play("402dr08", 0x300, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 72, 75);
break;
@@ -312,36 +317,36 @@ void Room402::daemon() {
case 15:
switch (_val2) {
case 6:
- _val6 = 6;
+ _stolieMode = 6;
loadDr1();
- Series::series_play("402dr01", 0x300, 0, 2, 6, 0, 100, 0, 0, 0, 7);
+ Series::series_play("402dr01", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 8:
digi_unload_stream_breaks(SERIES1);
_val2 = 11;
- series_play_with_breaks(PLAY2, "402dr06", 0x300, 2, 3);
+ series_play_with_breaks(PLAY2, "402dr06", 0x300, kCHANGE_STOLIE_ANIMATION, 3);
break;
case 10:
_val2 = 8;
digi_preload("402_003");
series_play_with_breaks(PLAY1, "402DR10s", 0x300, -1, 2);
- series_stream_with_breaks(SERIES1, "402dr10", 6, 0x300, 2);
+ series_stream_with_breaks(SERIES1, "402dr10", 6, 0x300, kCHANGE_STOLIE_ANIMATION);
break;
case 11:
_val2 = 12;
loadPe4();
series_play_with_breaks(PLAY3, "402DR11s", 0x301, -1, 2);
- series_stream_with_breaks(SERIES2, "402dr11", 6, 0x300, 2);
+ series_stream_with_breaks(SERIES2, "402dr11", 6, 0x300, kCHANGE_STOLIE_ANIMATION);
break;
case 12:
digi_unload_stream_breaks(SERIES2);
_val2 = 13;
loadDr1();
- Series::series_play("402dr01", 0x300, 0, 2, 6, 0, 100, 0, 0, 3, -1);
+ Series::series_play("402dr01", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 3, -1);
break;
case 13:
@@ -353,32 +358,32 @@ void Room402::daemon() {
case 15:
loadDr8();
- series_play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+ series_play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
series_play("402dr08s", 0x301, 0, -1, 60, 0, 100, 0, 0, 0, 0);
break;
case 16:
- Series::series_play("402dr12", 0x300, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+ Series::series_play("402dr12", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
break;
case 40:
- _val6 = 39;
+ _stolieMode = 39;
loadDr1();
- _stolie.play("402dr01", 0x300, 0, 2, 6);
+ _stolie.play("402dr01", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6);
break;
case 45:
case 47:
- _val6 = 48;
+ _stolieMode = 48;
playRandom1();
loadDr8();
- Series::series_play("402dr08", 0x300, 0, 2, 5, 0, 100, 0, 0, 0, 8);
+ Series::series_play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 5, 0, 100, 0, 0, 0, 8);
break;
case 46:
- _val6 = 45;
+ _stolieMode = 45;
freeDr8();
- series_play_with_breaks(PLAY16, "402dr08", 0x300, 2, 3, 5);
+ series_play_with_breaks(PLAY16, "402dr08", 0x300, kCHANGE_STOLIE_ANIMATION, 3, 5);
break;
default:
@@ -397,16 +402,16 @@ void Room402::daemon() {
case 40:
freeStolie();
- _val6 = 40;
+ _stolieMode = 40;
loadDr2();
- series_play("402dr02", 0x300, 4, 2, 6, 0, 100, 0, 0, 0, 2);
+ series_play("402dr02", 0x300, 4, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
series_play("402dr02s", 0x301, 4, -1, 6, 0, 100, 0, 0, 0, 2);
playDigiName();
break;
default:
freeStolie();
- _val6 = 15;
+ _stolieMode = 15;
loadDr1();
series_play("402dr01", 0x300, 2, 2, 6);
series_play("402dr01s", 0x301, 2, -1, 6);
@@ -422,9 +427,9 @@ void Room402::daemon() {
_stolie.play("402dr02", 0x300, 4, -1, 6, -1, 100, 0, 0, 3, 5);
} else {
freeStolie();
- _val6 = 39;
+ _stolieMode = 39;
loadDr2();
- Series::series_play("402dr02", 0x300, 0, 2, 6, 0, 100, 0, 0, 6, 12);
+ Series::series_play("402dr02", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 6, 12);
}
break;
@@ -432,9 +437,9 @@ void Room402::daemon() {
switch (_val2) {
case 7:
freeStolie();
- _val6 = 7;
+ _stolieMode = 7;
loadDr8();
- _stolie.play("402dr08", 0x300, 0, 2, 6, 0, 100, 0, 0, 72, 75);
+ _stolie.play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 72, 75);
break;
case 45:
@@ -449,28 +454,28 @@ void Room402::daemon() {
case 47:
freeStolie();
loadDr8();
- Series::series_play("402dr08", 0x300, 0, 2, 60, 0, 100, 0, 0, 67, 67);
+ Series::series_play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 67, 67);
break;
default:
freeStolie();
- _val6 = 49;
+ _stolieMode = 49;
loadDr8();
- Series::series_play("402dr08", 0x300, 2, 2, 5, 0, 100, 0, 0, 64, 66);
+ Series::series_play("402dr08", 0x300, 2, kCHANGE_STOLIE_ANIMATION, 5, 0, 100, 0, 0, 64, 66);
break;
}
break;
case 48:
- _val6 = 45;
+ _stolieMode = 45;
loadDr8();
- Series::series_play("402dr08", 0x300, 0, 2, 6, 0, 100, 0, 0, 64, 66);
+ Series::series_play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 64, 66);
break;
case 49:
- _val6 = 15;
+ _stolieMode = 15;
loadDr8();
- Series::series_play("402dr08", 0x300, 2, 2, 6, 0, 100, 0, 0, 0, 8);
+ Series::series_play("402dr08", 0x300, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 8);
break;
default:
@@ -478,34 +483,34 @@ void Room402::daemon() {
}
break;
- case 3:
- switch (_val5) {
+ case kCHANGE_ELMO_ANIMATION:
+ switch (_elmoMode) {
case 15:
- switch (_val3) {
+ switch (_elmoShould) {
case 15:
if (imath_ranged_rand(1, 7) == 1) {
- _val5 = 17;
+ _elmoMode = 17;
loadPe2();
- Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 0, 3);
+ Series::series_play("402pe02", 0x100, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
playRandom2();
} else {
loadPe2();
- Series::series_play("402pe02", 0x100, 0, 3, 60, 0, 100, 0, 0, 7, 7);
+ Series::series_play("402pe02", 0x100, 0, kCHANGE_ELMO_ANIMATION, 60, 0, 100, 0, 0, 7, 7);
}
break;
case 20:
- _val3 = 21;
- series_play_with_breaks(PLAY12, "402pe01", 0x100, 3, 3);
+ _elmoShould = 21;
+ series_play_with_breaks(PLAY12, "402pe01", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 21:
loadPe1();
- _series2.show("402pe01", 0x100, 0, 3, 30, 9);
+ _series2.show("402pe01", 0x100, 0, kCHANGE_ELMO_ANIMATION, 30, 9);
break;
case 27:
- _val3 = 28;
+ _elmoShould = 28;
_series2Set = true;
kernel_trigger_dispatch_now(27);
@@ -516,26 +521,26 @@ void Room402::daemon() {
case 28:
freeSeries2();
freePe4();
- _val3 = 29;
- series_play_with_breaks(PLAY7, "402pe04", 0x100, 3, 3);
+ _elmoShould = 29;
+ series_play_with_breaks(PLAY7, "402pe04", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 29:
- _val3 = 30;
+ _elmoShould = 30;
loadPe4();
_series2.play("402pe04", 0x100, 1, -1, 12, -1, 100, 0, 0, 19, 21);
break;
case 30:
- _val3 = 20;
+ _elmoShould = 20;
freeSeries2();
freePe4();
- series_play_with_breaks(PLAY11, "402pe04", 0x100, 3, 3);
+ series_play_with_breaks(PLAY11, "402pe04", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 34:
- _val3 = 43;
- series_play_with_breaks(PLAY15, "402pe05", 0x100, 3, 3);
+ _elmoShould = 43;
+ series_play_with_breaks(PLAY15, "402pe05", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 23:
@@ -543,7 +548,7 @@ void Room402::daemon() {
case 45:
case 47:
loadPe1();
- _val5 = 45;
+ _elmoMode = 45;
_series2.play("402pe01", 0x100, 0, 3, 5, 0, 100, 0, 0, 0, -1);
break;
@@ -553,41 +558,41 @@ void Room402::daemon() {
break;
case 17:
- if (_val3 == 15) {
+ if (_elmoShould == 15) {
if (imath_ranged_rand(1, 7) == 1) {
- _val5 = 15;
+ _elmoMode = 15;
loadPe2();
- Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 4, 7);
+ Series::series_play("402pe02", 0x100, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 4, 7);
playRandom2();
} else {
loadPe2();
- Series::series_play("402pe02", 0x100, 0, 3, 60, 0, 100, 0, 0, 3, 3);
+ Series::series_play("402pe02", 0x100, 0, kCHANGE_ELMO_ANIMATION, 60, 0, 100, 0, 0, 3, 3);
}
} else {
- _val5 = 15;
+ _elmoMode = 15;
loadPe2();
- Series::series_play("402pe02", 0x100, 0, 3, 6, 0, 100, 0, 0, 4, 7);
+ Series::series_play("402pe02", 0x100, 0, kCHANGE_ELMO_ANIMATION, 6, 0, 100, 0, 0, 4, 7);
}
break;
case 45:
- switch (_val3) {
+ switch (_elmoShould) {
case 23:
- _val3 = 24;
+ _elmoShould = 24;
freePe4();
- series_play_with_breaks(PLAY4, "402pe04", 0x100, 3, 3);
+ series_play_with_breaks(PLAY4, "402pe04", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 24:
- _val3 = 25;
- series_play_with_breaks(PLAY5, "402pe4n", 0x100, 3, 3);
+ _elmoShould = 25;
+ series_play_with_breaks(PLAY5, "402pe4n", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 25:
- _val3 = 27;
- _val5 = 15;
+ _elmoShould = 27;
+ _elmoMode = 15;
freePe4();
- series_play_with_breaks(PLAY6, "402pe04", 0x100, 3, 3);
+ series_play_with_breaks(PLAY6, "402pe04", 0x100, kCHANGE_ELMO_ANIMATION, 3);
break;
case 41:
@@ -598,7 +603,7 @@ void Room402::daemon() {
break;
case 42:
- Series::series_play("402pe01", 0x100, 0, 3, 60, 0, 100, 0, 0, 9, 9);
+ Series::series_play("402pe01", 0x100, 0, kCHANGE_ELMO_ANIMATION, 60, 0, 100, 0, 0, 9, 9);
break;
case 45:
@@ -617,7 +622,7 @@ void Room402::daemon() {
}
loadPe3();
- Series::series_play("402pe03", 0x100, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("402pe03", 0x100, 0, kCHANGE_ELMO_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
playDigiName();
break;
@@ -631,8 +636,8 @@ void Room402::daemon() {
freeSeries2();
freePe3();
loadPe1();
- _val5 = 15;
- _series2.play("402pe01", 0x100, 2, 3, 5, 0, 100, 0, 0, 0, -1);
+ _elmoMode = 15;
+ _series2.play("402pe01", 0x100, 2, kCHANGE_ELMO_ANIMATION, 5, 0, 100, 0, 0, 0, -1);
break;
}
break;
@@ -662,7 +667,7 @@ void Room402::daemon() {
break;
case 9:
- _val3 = 23;
+ _elmoShould = 23;
break;
case 11:
@@ -699,7 +704,7 @@ void Room402::daemon() {
_wi01s = series_load("402wi01s");
ws_hide_walker();
- _val3 = 15;
+ _elmoShould = 15;
series_play("402wi01", 0x100, 0, 16, 5, 0, 100, 0, 0, 0, 16);
series_play("402wi01s", 0x101, 0, -1, 5, 0, 100, 0, 0, 0, 16);
break;
@@ -746,7 +751,7 @@ void Room402::daemon() {
break;
case 22:
- _val3 = 42;
+ _elmoShould = 42;
break;
case 25:
@@ -792,9 +797,9 @@ void Room402::daemon() {
break;
case 32:
- _val3 = 41;
- _val5 = 45;
- kernel_trigger_dispatch_now(3);
+ _elmoShould = 41;
+ _elmoMode = 45;
+ kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
break;
case 33:
@@ -824,8 +829,8 @@ void Room402::daemon() {
case 37:
freeDr1();
_val2 = 15;
- _val6 = 15;
- kernel_trigger_dispatch_now(2);
+ _stolieMode = 15;
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -910,7 +915,7 @@ void Room402::parser() {
case 2:
_val2 = 15;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
kernel_trigger_dispatch_now(1);
break;
@@ -939,7 +944,7 @@ void Room402::parser() {
break;
case 1:
- _val3 = 15;
+ _elmoShould = 15;
kernel_trigger_dispatch_now(1);
break;
@@ -977,7 +982,7 @@ void Room402::parser() {
break;
case 2:
- _val3 = 15;
+ _elmoShould = 15;
player_set_commands_allowed(true);
break;
@@ -996,12 +1001,12 @@ void Room402::parser() {
_digiName = "402p501";
_newMode = KT_PARSE;
_digiTrigger = 2;
- _val3 = 45;
+ _elmoShould = 45;
break;
case 2:
_G(flags)[V158] = 1;
- _val3 = 15;
+ _elmoShould = 15;
player_set_commands_allowed(true);
break;
@@ -1023,11 +1028,11 @@ void Room402::parser() {
_digiName = "402p902";
_newMode = KT_PARSE;
_digiTrigger = 2;
- _val3 = 45;
+ _elmoShould = 45;
break;
case 2:
- _val3 = 41;
+ _elmoShould = 41;
_digiName = "402s007";
_newMode = KT_PARSE;
_digiTrigger = 3;
@@ -1041,12 +1046,12 @@ void Room402::parser() {
freeStolie();
freeDr2();
_val2 = 46;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
break;
case 4:
_val2 = 47;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
wilbur_speech("402w903");
break;
@@ -1060,7 +1065,7 @@ void Room402::parser() {
case 6:
_val2 = 47;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
wilbur_speech("402w904");
break;
@@ -1094,17 +1099,17 @@ void Room402::conv84() {
if (node == 3 && entry == 1) {
_val2 = 47;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 1 && entry == 1) {
_val2 = 39;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 9 && entry == 0) {
_val2 = 39;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
term_message("--------------------------------");
} else if (node == 9 && entry == 2) {
_val2 = 15;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
term_message("HHHHHHHHHHHHHHHHHH");
} else if ((node == 1 && entry == 6) ||
(node == 2 && entry == 0) ||
@@ -1115,11 +1120,11 @@ void Room402::conv84() {
(node == 6 && entry == 3) ||
(node == 8 && entry == 1) ||
(node == 9 && entry == 1)) {
- _val3 = 47;
+ _elmoShould = 47;
} else {
term_message("xxxxxxxxxxxxxxxxxxxxx");
_val2 = 47;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
}
conv_resume(conv_get_handle());
@@ -1127,9 +1132,9 @@ void Room402::conv84() {
break;
case 21:
- _val3 = 47;
+ _elmoShould = 47;
- if (_val5 == 45)
+ if (_elmoMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
break;
@@ -1149,25 +1154,25 @@ void Room402::conv84() {
if (!(node == 9 && entry == 1))
_val2 = 7;
- if (_val6 == 45)
+ if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
}
if (node == 3 && entry == 1) {
_val2 = 40;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 6 && entry == 2) {
_val2 = 40;
} else if ((node == 1 && entry == 1) || (node == 9 && entry == 0)) {
_val2 = 40;
- if (_val6 == 45)
+ if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
} else if (node == 9 && entry == 2) {
_val2 = 40;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if ((node == 1 && entry == 6) ||
(node == 2 && entry == 0) ||
(node == 3 && entry == 0) ||
@@ -1177,23 +1182,23 @@ void Room402::conv84() {
(node == 6 && entry == 3) ||
(node == 8 && entry == 1) ||
(node == 9 && entry == 1)) {
- _val3 = 45;
+ _elmoShould = 45;
- if (_val5 == 45) {
+ if (_elmoMode == 45) {
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
}
} else {
_val2 = 45;
- if (_val6 == 45)
+ if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
}
} else if (who == 1) {
if ((node == 1 && entry == 1) || (node == 1 && entry == 3)) {
_val2 = 39;
- if (_val6 == 45)
+ if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
}
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index a3590c00fe6..e8355119ee4 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -68,10 +68,10 @@ private:
int _wi02 = -1, _wi02s = -1;
int _digiTrigger = 0;
int _val2 = 0;
- int _val3 = 0;
+ int _elmoShould = 0;
int _val4 = 0;
- int _val5 = 0;
- int _val6 = 0;
+ int _elmoMode = 0;
+ int _stolieMode = 0;
void conv84();
void playDigiName();
Commit: 6d69093943dec9edb3f5777894b30c122fb3e680
https://github.com/scummvm/scummvm/commit/6d69093943dec9edb3f5777894b30c122fb3e680
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further Stolie talk fix
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room402.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index b85d5852206..a6928c89c0a 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -238,14 +238,14 @@ void Room402::init() {
if (_G(player).been_here_before) {
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
- _val2 = 15;
+ _stolieShould = 15;
} else {
_G(wilbur_should) = 5;
kernel_timing_trigger(120, kCHANGE_WILBUR_ANIMATION);
- _val2 = 15;
+ _stolieShould = 15;
}
} else {
- _val2 = 15;
+ _stolieShould = 15;
if (_G(game).previous_room != KERNEL_RESTORING_GAME) {
digi_preload_stream_breaks(SERIES1);
@@ -256,7 +256,7 @@ void Room402::init() {
series_load("402pe4n");
series_load("402pe4ns");
- _val2 = 16;
+ _stolieShould = 16;
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
@@ -274,7 +274,7 @@ void Room402::daemon() {
switch (_G(kernel).trigger) {
case 1:
- _val2 = 15;
+ _stolieShould = 15;
if (_stolieSet)
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
@@ -296,7 +296,7 @@ void Room402::daemon() {
break;
case 7:
- switch (_val2) {
+ switch (_stolieShould) {
case 7:
loadDr8();
_stolie.play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 75, 75);
@@ -315,7 +315,7 @@ void Room402::daemon() {
break;
case 15:
- switch (_val2) {
+ switch (_stolieShould) {
case 6:
_stolieMode = 6;
loadDr1();
@@ -324,19 +324,19 @@ void Room402::daemon() {
case 8:
digi_unload_stream_breaks(SERIES1);
- _val2 = 11;
+ _stolieShould = 11;
series_play_with_breaks(PLAY2, "402dr06", 0x300, kCHANGE_STOLIE_ANIMATION, 3);
break;
case 10:
- _val2 = 8;
+ _stolieShould = 8;
digi_preload("402_003");
series_play_with_breaks(PLAY1, "402DR10s", 0x300, -1, 2);
series_stream_with_breaks(SERIES1, "402dr10", 6, 0x300, kCHANGE_STOLIE_ANIMATION);
break;
case 11:
- _val2 = 12;
+ _stolieShould = 12;
loadPe4();
series_play_with_breaks(PLAY3, "402DR11s", 0x301, -1, 2);
series_stream_with_breaks(SERIES2, "402dr11", 6, 0x300, kCHANGE_STOLIE_ANIMATION);
@@ -344,7 +344,7 @@ void Room402::daemon() {
case 12:
digi_unload_stream_breaks(SERIES2);
- _val2 = 13;
+ _stolieShould = 13;
loadDr1();
Series::series_play("402dr01", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 3, -1);
break;
@@ -366,6 +366,7 @@ void Room402::daemon() {
Series::series_play("402dr12", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
break;
+ case 39:
case 40:
_stolieMode = 39;
loadDr1();
@@ -392,7 +393,7 @@ void Room402::daemon() {
break;
case 39:
- switch (_val2) {
+ switch (_stolieShould) {
case 39:
freeStolie();
_stolieSet = true;
@@ -420,7 +421,7 @@ void Room402::daemon() {
break;
case 40:
- if (_val2 == 40) {
+ if (_stolieShould == 40) {
freeStolie();
_stolieSet = true;
loadDr2();
@@ -434,7 +435,7 @@ void Room402::daemon() {
break;
case 45:
- switch (_val2) {
+ switch (_stolieShould) {
case 7:
freeStolie();
_stolieMode = 7;
@@ -745,7 +746,7 @@ void Room402::daemon() {
case 20:
if (++_val4 == 2) {
_val4 = 0;
- _val2 = 6;
+ _stolieShould = 6;
ws_walk(316, 354, 0, -1, 2);
}
break;
@@ -828,7 +829,7 @@ void Room402::daemon() {
case 37:
freeDr1();
- _val2 = 15;
+ _stolieShould = 15;
_stolieMode = 15;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
player_set_commands_allowed(true);
@@ -850,7 +851,7 @@ void Room402::daemon() {
case 3:
ws_unhide_walker();
_G(walker).wilbur_poof();
- _val2 = 10;
+ _stolieShould = 10;
kernel_timing_trigger(30, 22);
break;
@@ -910,11 +911,11 @@ void Room402::parser() {
_newMode = KT_PARSE;
_digiTrigger = 2;
freeStolie();
- _val2 = 45;
+ _stolieShould = 45;
break;
case 2:
- _val2 = 15;
+ _stolieShould = 15;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
kernel_trigger_dispatch_now(1);
break;
@@ -1036,7 +1037,7 @@ void Room402::parser() {
_digiName = "402s007";
_newMode = KT_PARSE;
_digiTrigger = 3;
- _val2 = 40;
+ _stolieShould = 40;
break;
case 3:
@@ -1045,12 +1046,12 @@ void Room402::parser() {
_digiTrigger = 4;
freeStolie();
freeDr2();
- _val2 = 46;
+ _stolieShould = 46;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
break;
case 4:
- _val2 = 47;
+ _stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
wilbur_speech("402w903");
@@ -1060,11 +1061,11 @@ void Room402::parser() {
_digiName = "402s009";
_newMode = KT_PARSE;
_digiTrigger = 6;
- _val2 = 45;
+ _stolieShould = 45;
break;
case 6:
- _val2 = 47;
+ _stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
wilbur_speech("402w904");
@@ -1098,17 +1099,17 @@ void Room402::conv84() {
_G(kernel).trigger_mode = KT_DAEMON;
if (node == 3 && entry == 1) {
- _val2 = 47;
+ _stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 1 && entry == 1) {
- _val2 = 39;
+ _stolieShould = 39;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 9 && entry == 0) {
- _val2 = 39;
+ _stolieShould = 39;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
term_message("--------------------------------");
} else if (node == 9 && entry == 2) {
- _val2 = 15;
+ _stolieShould = 15;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
term_message("HHHHHHHHHHHHHHHHHH");
} else if ((node == 1 && entry == 6) ||
@@ -1123,7 +1124,7 @@ void Room402::conv84() {
_elmoShould = 47;
} else {
term_message("xxxxxxxxxxxxxxxxxxxxx");
- _val2 = 47;
+ _stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
}
@@ -1152,25 +1153,25 @@ void Room402::conv84() {
(node == 1 && entry == 6) ||
(node == 9 && entry == 1)) {
if (!(node == 9 && entry == 1))
- _val2 = 7;
+ _stolieShould = 7;
if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
}
if (node == 3 && entry == 1) {
- _val2 = 40;
+ _stolieShould = 40;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if (node == 6 && entry == 2) {
- _val2 = 40;
+ _stolieShould = 40;
} else if ((node == 1 && entry == 1) || (node == 9 && entry == 0)) {
- _val2 = 40;
+ _stolieShould = 40;
if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
} else if (node == 9 && entry == 2) {
- _val2 = 40;
+ _stolieShould = 40;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
} else if ((node == 1 && entry == 6) ||
@@ -1189,14 +1190,14 @@ void Room402::conv84() {
kernel_trigger_dispatch_now(kCHANGE_ELMO_ANIMATION);
}
} else {
- _val2 = 45;
+ _stolieShould = 45;
if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
}
} else if (who == 1) {
if ((node == 1 && entry == 1) || (node == 1 && entry == 3)) {
- _val2 = 39;
+ _stolieShould = 39;
if (_stolieMode == 45)
_G(kernel).trigger_mode = KT_DAEMON;
diff --git a/engines/m4/burger/rooms/section4/room402.h b/engines/m4/burger/rooms/section4/room402.h
index e8355119ee4..4492c7d78bb 100644
--- a/engines/m4/burger/rooms/section4/room402.h
+++ b/engines/m4/burger/rooms/section4/room402.h
@@ -67,7 +67,7 @@ private:
int _wi01 = -1, _wi01s = -1;
int _wi02 = -1, _wi02s = -1;
int _digiTrigger = 0;
- int _val2 = 0;
+ int _stolieShould = 0;
int _elmoShould = 0;
int _val4 = 0;
int _elmoMode = 0;
Commit: f2d397788cfe642657312bd738b511181b10d1c8
https://github.com/scummvm/scummvm/commit/f2d397788cfe642657312bd738b511181b10d1c8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Yet more Stolie talk fixes
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index a6928c89c0a..c9aff875f34 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -296,21 +296,13 @@ void Room402::daemon() {
break;
case 7:
- switch (_stolieShould) {
- case 7:
+ if (_stolieShould == 7) {
loadDr8();
_stolie.play("402dr08", 0x300, 0, kCHANGE_STOLIE_ANIMATION, 60, 0, 100, 0, 0, 75, 75);
- break;
-
- case 8:
+ } else {
_stolieMode = 45;
loadDr8();
_stolie.play("402dr08", 0x300, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 72, 75);
- break;
-
-
- default:
- break;
}
break;
@@ -1092,6 +1084,7 @@ void Room402::conv84() {
int entry = conv_current_entry();
int node = conv_current_node();
const char *sound = conv_sound_to_play();
+ _G(kernel).trigger_mode = KT_PARSE;
switch (_G(kernel).trigger) {
case 6:
@@ -1204,7 +1197,7 @@ void Room402::conv84() {
}
_G(kernel).trigger_mode = KT_DAEMON;
- wilbur_speech(sound, 10001);
+ wilbur_speech(sound, kRESUME_CONVERSATION);
}
}
break;
Commit: 0743bab06f7aa4bcebc16f64eadeac26c4a64f74
https://github.com/scummvm/scummvm/commit/0743bab06f7aa4bcebc16f64eadeac26c4a64f74
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting Jawz O' Life
Initially when I was debugging the scene, there was a
problem with the trunk hotspot being incorrectly placed.
Because of this, for the fun of it, I implemented a
workaround to allow using the keys directly on the patrol
car itself. Then I later realized I was simply disabling
the wrong hotspot during room setup. But after fixing,
I've decided to leave the alternate action as it is just
for the heck of it.
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room133_136.cpp
engines/m4/burger/rooms/section1/room134_135.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 137a75cfe74..0e1a3b7964a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -176,6 +176,7 @@ void Room101::init() {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
+ case 134:
case 135:
// From Old Bridge
_G(wilbur_should) = 4;
diff --git a/engines/m4/burger/rooms/section1/room133_136.cpp b/engines/m4/burger/rooms/section1/room133_136.cpp
index 0e19cd79d46..0eda2d0cdf2 100644
--- a/engines/m4/burger/rooms/section1/room133_136.cpp
+++ b/engines/m4/burger/rooms/section1/room133_136.cpp
@@ -288,11 +288,11 @@ void Room133_136::pre_parser() {
player_hotspot_walk_override(246, 247, 8);
if (player_said("old bridge") &&
- player_said_any("enter", "gear", "look", "look at"))
+ !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(3);
if (player_said("town limits") &&
- player_said_any("enter", "gear", "look", "look at"))
+ !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9);
if (player_said("enter", "construction"))
diff --git a/engines/m4/burger/rooms/section1/room134_135.cpp b/engines/m4/burger/rooms/section1/room134_135.cpp
index df62b1a8ef4..a1067a80fb7 100644
--- a/engines/m4/burger/rooms/section1/room134_135.cpp
+++ b/engines/m4/burger/rooms/section1/room134_135.cpp
@@ -786,10 +786,10 @@ void Room134_135::daemon() {
}
void Room134_135::pre_parser() {
- if (player_said("fork in the road") && player_said_any("enter", "gear", "look", "look at"))
+ if (player_said("fork in the road") && !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9);
- if (player_said("main street") && player_said_any("enter", "gear", "look", "look at"))
+ if (player_said("main street") && !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(3);
if (player_said("take", "baitbox") || player_said("gear", "baitbox"))
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 0b0fbdabef8..c7fa870b9cd 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -116,7 +116,8 @@ void Room137::init() {
break;
}
- _series1 = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _door = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ jawz();
const char *NAMES[18] = {
"137_020", "137_021", "137_022", "137_023", "137_024", "137_025",
@@ -315,7 +316,7 @@ void Room137::daemon() {
break;
case 30:
- terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_door);
_mode2 = 31;
series_play("137dp03", 0x700, 0, 2, 8, 0, 100, 0, 0, 0, 14);
digi_play("137_003", 1, 255);
@@ -408,7 +409,7 @@ void Room137::daemon() {
break;
case 9:
- terminateMachineAndNull(_series1);
+ terminateMachineAndNull(_door);
if (_G(flags)[V046]) {
terminateMachineAndNull(_series3);
@@ -462,7 +463,7 @@ void Room137::daemon() {
case 13:
jawz();
- _series1 = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
+ _door = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
_G(walker).reset_walker_sprites();
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "137dt01", 0, 0xf00, -1);
@@ -584,6 +585,7 @@ void Room137::daemon() {
case 6:
ws_hide_walker();
+ _G(wilbur_should) = 9;
player_set_commands_allowed(false);
series_load("137jaws");
series_play_with_breaks(PLAY1, "137wi02", 0x100, kCHANGE_WILBUR_ANIMATION,
@@ -663,6 +665,14 @@ void Room137::daemon() {
}
}
+void Room137::pre_parser() {
+ if (player_said("KEYS", "PATROL CAR")) {
+ // Convenience added for ScummVM, using keys on the patrol car is
+ // the same as using the keys on the trunk specifically
+ player_hotspot_walk_override(500, 355, 10);
+ }
+}
+
void Room137::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
@@ -681,7 +691,7 @@ void Room137::parser() {
} else {
wilbur_speech(inv_object_is_here("JAWZ O' LIFE") ? "137w006" : "137w007");
}
- } else if (player_said("keys", "trunk")) {
+ } else if (player_said("keys", "trunk") || player_said("keys", "patrol car")) {
_G(wilbur_should) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -768,7 +778,7 @@ void Room137::jawz() {
} else {
_series3 = series_play("137tr02", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
hotspot_set_active("keys", false);
- hotspot_set_active("trunk", false);
+ hotspot_set_active("trunk ", false);
hotspot_set_active("jawz o' life", false);
}
}
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 1904344acaf..2ab0bf09394 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -39,7 +39,7 @@ private:
int _mode3 = 0;
int _mode4 = 0;
const char *_digi1 = nullptr;
- machine *_series1 = nullptr;
+ machine *_door = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
@@ -55,6 +55,7 @@ public:
void init() override;
void daemon() override;
+ void pre_parser() override;
void parser() override;
};
Commit: a11ab1a84e2986e4d37e0fb84bb089271276837f
https://github.com/scummvm/scummvm/commit/a11ab1a84e2986e4d37e0fb84bb089271276837f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of police in room 137
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index c7fa870b9cd..97468319ab8 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -28,6 +28,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_SHERRIF_ANIMATION = 1,
+ kCHANGE_DEPUTY_ANIMATION = 2
+};
+
static const char *SAID[][4] = {
{ "PATROL CAR", "137W002", "137W003", "137W004" },
{ "TRUNK", nullptr, "137W008", "137W008" },
@@ -143,7 +148,7 @@ void Room137::init() {
}
_mode2 = 27;
- kernel_trigger_dispatch_now(2);
+ kernel_trigger_dispatch_now(kCHANGE_DEPUTY_ANIMATION);
}
void Room137::daemon() {
@@ -172,59 +177,59 @@ void Room137::daemon() {
}
switch (_G(kernel).trigger) {
- case 1:
- switch (_mode4) {
+ case kCHANGE_SHERRIF_ANIMATION:
+ switch (_sherrifMode) {
case 5:
- switch (_mode3) {
+ switch (_sherrifShould) {
case 10:
- _mode3 = 11;
- series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ _sherrifShould = 11;
+ series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 11:
- _mode3 = 12;
- series_play("137sh07", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ _sherrifShould = 12;
+ series_play("137sh07", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 12:
sub2();
- _mode3 = 22;
- _mode4 = 10;
- kernel_trigger_dispatch_now(1);
+ _sherrifShould = 22;
+ _sherrifMode = 10;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 14:
- _mode3 = 15;
- series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ _sherrifShould = 15;
+ series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 15:
sub2();
- _mode4 = 14;
- _mode3 = 22;
- kernel_trigger_dispatch_now(1);
+ _sherrifMode = 14;
+ _sherrifShould = 22;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 17:
- _mode3 = 18;
- series_play("137sh01", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 17);
+ _sherrifShould = 18;
+ series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 18:
- _mode3 = 19;
- series_play("137sh07", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ _sherrifShould = 19;
+ series_play("137sh07", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 19:
- _mode3 = 20;
- series_play("137sh09", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 8);
+ _sherrifShould = 20;
+ series_play("137sh09", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 20:
sub2();
- _mode3 = 22;
- _mode4 = 17;
- kernel_trigger_dispatch_now(1);
+ _sherrifShould = 22;
+ _sherrifMode = 17;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
default:
@@ -233,9 +238,9 @@ void Room137::daemon() {
break;
case 13:
- if (_mode3 == 23) {
+ if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 6);
- series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+ series_play("137sh08", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
@@ -243,15 +248,15 @@ void Room137::daemon() {
_digi1 = nullptr;
}
} else {
- _mode4 = 10;
- series_play("137sh08", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ _sherrifMode = 10;
+ series_play("137sh08", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
case 16:
- if (_mode3 == 23) {
+ if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 8);
- series_play("137sh03", 0x800, 0, 1, 6, 0, 100, 0, 0);
+ series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
@@ -259,20 +264,20 @@ void Room137::daemon() {
_digi1 = nullptr;
}
} else {
- _mode4 = 14;
- series_play("137sh03", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ _sherrifMode = 14;
+ series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
case 17:
- switch (_mode3) {
+ switch (_sherrifShould) {
case 22:
- series_play("137sh09", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+ series_play("137sh09", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 23:
- _mode4 = 21;
- series_play("137sh10", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
+ _sherrifMode = 21;
+ series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
default:
@@ -281,9 +286,9 @@ void Room137::daemon() {
break;
case 21:
- if (_mode3 == 23) {
+ if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 5);
- series_play("137sh10", 0x800, 0, 1, 6, 0, 100, 0, 0, frame, frame);
+ series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
@@ -291,8 +296,8 @@ void Room137::daemon() {
_digi1 = nullptr;
}
} else {
- _mode4 = 17;
- series_play("137sh10", 0x800, 0, 1, 8, 0, 100, 0, 0, 0, 0);
+ _sherrifMode = 17;
+ series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
@@ -301,31 +306,31 @@ void Room137::daemon() {
}
break;
- case 2:
+ case kCHANGE_DEPUTY_ANIMATION:
switch (_mode2) {
case 27:
switch (_mode1) {
case 27:
sub1();
- kernel_timing_trigger(10, 2);
+ kernel_timing_trigger(10, kCHANGE_DEPUTY_ANIMATION);
break;
case 29:
_mode1 = 30;
- series_play("137dp02", 0x700, 0, 2, 8, 0, 100, 0, 0, 0, 7);
+ series_play("137dp02", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 7);
break;
case 30:
terminateMachineAndNull(_door);
_mode2 = 31;
- series_play("137dp03", 0x700, 0, 2, 8, 0, 100, 0, 0, 0, 14);
+ series_play("137dp03", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 14);
digi_play("137_003", 1, 255);
break;
case 34:
sub1();
_mode1 = 29;
- series_play("137dp01", 0x700, 0, 2, 60, 0, 100, 0, 0, 6, 6);
+ series_play("137dp01", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 6, 6);
break;
default:
@@ -336,25 +341,25 @@ void Room137::daemon() {
case 31:
if (imath_ranged_rand(1, 20) == 1) {
_mode2 = 32;
- series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 0, 0);
+ series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
} else {
- series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 7, 7);
+ series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 7, 7);
}
break;
case 32:
if (imath_ranged_rand(1, 20) == 1) {
_mode2 = 33;
- series_play("137dp04", 0x700, 0, 2, imath_ranged_rand(60, 90),
+ series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, imath_ranged_rand(60, 90),
0, 100, 0, 0, 0, 5);
} else {
- series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 0, 0);
+ series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
}
break;
case 33:
_mode2 = 31;
- series_play("137dp04", 0x700, 0, 2, 10, 0, 100, 0, 0, 6, 7);
+ series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 6, 7);
break;
default:
@@ -376,15 +381,15 @@ void Room137::daemon() {
if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] == 4)
_mode1 = 30;
- _mode4 = 5;
- _mode3 = 10;
+ _sherrifMode = 5;
+ _sherrifShould = 10;
if (_G(player_info).y > 308) {
- _mode3 = 14;
+ _sherrifShould = 14;
ws_walk(307, 349, 0, -1, 2);
}
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 6:
@@ -392,16 +397,16 @@ void Room137::daemon() {
break;
case 7:
- _mode4 = 5;
- _mode3 = 14;
+ _sherrifMode = 5;
+ _sherrifShould = 14;
unloadAssets();
if (_G(player_info).y < 308)
- _mode3 = 10;
+ _sherrifShould = 10;
if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] != 4)
_mode1 = 30;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 8:
@@ -422,13 +427,13 @@ void Room137::daemon() {
break;
case 10:
- switch (_mode3) {
+ switch (_sherrifShould) {
case 22:
series_play("137sh08", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
break;
case 23:
- _mode4 = 13;
+ _sherrifMode = 13;
series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
break;
@@ -471,7 +476,7 @@ void Room137::daemon() {
break;
case 14:
- switch (_mode3) {
+ switch (_sherrifShould) {
case 22:
if (imath_ranged_rand(1, 30) == 2) {
series_play("137sh04", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 14);
@@ -481,12 +486,12 @@ void Room137::daemon() {
break;
case 23:
- _mode4 = 16;
+ _sherrifMode = 16;
series_play("137sh03", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
break;
case 24:
- _mode3 = 23;
+ _sherrifShould = 23;
series_play("137sh05", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 17);
if (_digi1) {
@@ -496,14 +501,14 @@ void Room137::daemon() {
break;
case 25:
- _mode3 = 26;
+ _sherrifShould = 26;
series_play("137sh06", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 23);
break;
case 26:
conv_resume_curr();
- _mode3 = 22;
- kernel_trigger_dispatch_now(1);
+ _sherrifShould = 22;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
default:
@@ -732,9 +737,9 @@ void Room137::conv15() {
if (_G(kernel).trigger == 14) {
if (who <= 0) {
if (node == 7) {
- _mode3 = 25;
+ _sherrifShould = 25;
} else {
- _mode3 = 22;
+ _sherrifShould = 22;
conv_resume_curr();
}
} else if (who == 1) {
@@ -744,7 +749,7 @@ void Room137::conv15() {
if (who <= 0) {
if (node == 3 || node == 9 || node == 12 || node == 13 || node == 19 || node == 11)
_flag3 = true;
- _mode3 = (node == 20 && entry == 1) || (node == 21 && entry == 1) ? 24 : 23;
+ _sherrifShould = (node == 20 && entry == 1) || (node == 21 && entry == 1) ? 24 : 23;
_digi1 = conv_sound_to_play();
} else if (who == 1) {
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 2ab0bf09394..04ae4214f64 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -36,8 +36,8 @@ private:
int _volume = 255;
int _mode1 = 0;
int _mode2 = 0;
- int _mode3 = 0;
- int _mode4 = 0;
+ int _sherrifShould = 0;
+ int _sherrifMode = 0;
const char *_digi1 = nullptr;
machine *_door = nullptr;
machine *_series2 = nullptr;
Commit: 0c3099a7216519ccf266c0669314b98eef87ba3d
https://github.com/scummvm/scummvm/commit/0c3099a7216519ccf266c0669314b98eef87ba3d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Police fix in room 137
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 97468319ab8..31c9f8ef9a5 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -141,13 +141,13 @@ void Room137::init() {
}
if (_G(flags)[V048] < 200) {
- _mode1 = 27;
+ _deputyShould = 27;
} else {
- _mode1 = _G(flags)[V047] == 2 || _G(flags)[V047] == 3 || _G(flags)[V047] == 4 ? 34 : 27;
+ _deputyShould = _G(flags)[V047] == 2 || _G(flags)[V047] == 3 || _G(flags)[V047] == 4 ? 34 : 27;
digi_play("137_003", 1);
}
- _mode2 = 27;
+ _deputyMode = 27;
kernel_trigger_dispatch_now(kCHANGE_DEPUTY_ANIMATION);
}
@@ -237,6 +237,22 @@ void Room137::daemon() {
}
break;
+ case 10:
+ switch (_sherrifShould) {
+ case 22:
+ series_play("137sh08", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 23:
+ _sherrifMode = 13;
+ series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case 13:
if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 6);
@@ -307,29 +323,29 @@ void Room137::daemon() {
break;
case kCHANGE_DEPUTY_ANIMATION:
- switch (_mode2) {
+ switch (_deputyMode) {
case 27:
- switch (_mode1) {
+ switch (_deputyShould) {
case 27:
sub1();
kernel_timing_trigger(10, kCHANGE_DEPUTY_ANIMATION);
break;
case 29:
- _mode1 = 30;
+ _deputyShould = 30;
series_play("137dp02", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 7);
break;
case 30:
terminateMachineAndNull(_door);
- _mode2 = 31;
+ _deputyMode = 31;
series_play("137dp03", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 14);
digi_play("137_003", 1, 255);
break;
case 34:
sub1();
- _mode1 = 29;
+ _deputyShould = 29;
series_play("137dp01", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 6, 6);
break;
@@ -340,7 +356,7 @@ void Room137::daemon() {
case 31:
if (imath_ranged_rand(1, 20) == 1) {
- _mode2 = 32;
+ _deputyMode = 32;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
} else {
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 7, 7);
@@ -349,7 +365,7 @@ void Room137::daemon() {
case 32:
if (imath_ranged_rand(1, 20) == 1) {
- _mode2 = 33;
+ _deputyMode = 33;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, imath_ranged_rand(60, 90),
0, 100, 0, 0, 0, 5);
} else {
@@ -358,7 +374,7 @@ void Room137::daemon() {
break;
case 33:
- _mode2 = 31;
+ _deputyMode = 31;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 6, 7);
break;
@@ -379,7 +395,7 @@ void Room137::daemon() {
unloadAssets();
if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] == 4)
- _mode1 = 30;
+ _deputyShould = 30;
_sherrifMode = 5;
_sherrifShould = 10;
@@ -404,7 +420,7 @@ void Room137::daemon() {
if (_G(player_info).y < 308)
_sherrifShould = 10;
if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] != 4)
- _mode1 = 30;
+ _deputyShould = 30;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
@@ -426,22 +442,6 @@ void Room137::daemon() {
Section1::updateWalker(227, 309, 11, 13);
break;
- case 10:
- switch (_sherrifShould) {
- case 22:
- series_play("137sh08", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
- break;
-
- case 23:
- _sherrifMode = 13;
- series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
- break;
-
- default:
- break;
- }
- break;
-
case 11:
if (_G(player_info).y >= 300) {
digi_preload_stream_breaks(SERIES1);
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 04ae4214f64..0e67580e4d0 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -34,8 +34,8 @@ private:
bool _flag2 = false;
bool _flag3 = false;
int _volume = 255;
- int _mode1 = 0;
- int _mode2 = 0;
+ int _deputyShould = 0;
+ int _deputyMode = 0;
int _sherrifShould = 0;
int _sherrifMode = 0;
const char *_digi1 = nullptr;
Commit: ef51a6a071ace3dbe50aa3f23ef97089133e04a8
https://github.com/scummvm/scummvm/commit/ef51a6a071ace3dbe50aa3f23ef97089133e04a8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for freeing mayor
Changed paths:
engines/m4/burger/rooms/section4/room402.cpp
engines/m4/burger/rooms/section4/room406.cpp
engines/m4/burger/rooms/section4/room406.h
engines/m4/core/rooms.h
diff --git a/engines/m4/burger/rooms/section4/room402.cpp b/engines/m4/burger/rooms/section4/room402.cpp
index c9aff875f34..b4060b3a3bb 100644
--- a/engines/m4/burger/rooms/section4/room402.cpp
+++ b/engines/m4/burger/rooms/section4/room402.cpp
@@ -291,8 +291,7 @@ void Room402::daemon() {
freeDr8();
_wi02 = series_load("402wi02");
_wi02s = series_load("402wi02s");
- series_play("402dr04", 0x300, 0, 11, 6, 0, 100, 0, 0, 0, 25);
- series_play("420dr04s", 0x301, 0, -1, 6, 0, 100, 0, 0, 0, 25);
+ Series::series_play("402dr04", 0x300, 0, 11, 6, 0, 100, 0, 0, 0, 25);
break;
case 7:
@@ -1012,7 +1011,7 @@ void Room402::parser() {
case -1:
player_set_commands_allowed(false);
_G(kernel).trigger_mode = KT_PARSE;
- wilbur_speech(_G(flags)[V157] ? "402w902" : "402w502");
+ wilbur_speech(_G(flags)[V157] ? "402w902" : "402w502", 1);
break;
case 1:
@@ -1046,7 +1045,7 @@ void Room402::parser() {
_stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
- wilbur_speech("402w903");
+ wilbur_speech("402w903", 5);
break;
case 5:
@@ -1060,7 +1059,7 @@ void Room402::parser() {
_stolieShould = 47;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
- wilbur_speech("402w904");
+ wilbur_speech("402w904", 7);
break;
case 7:
diff --git a/engines/m4/burger/rooms/section4/room406.cpp b/engines/m4/burger/rooms/section4/room406.cpp
index 7b509cf00d5..c718768e9e6 100644
--- a/engines/m4/burger/rooms/section4/room406.cpp
+++ b/engines/m4/burger/rooms/section4/room406.cpp
@@ -20,6 +20,7 @@
*/
#include "m4/burger/rooms/section4/room406.h"
+#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/burger/burger.h"
@@ -27,6 +28,11 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_MAYOR_ANIMATION = 11,
+ kCHANGE_DOG_ANIMATION = 12
+};
+
const char *Room406::SAID[][4] = {
{ "PEGLEG", "406w003", "406w005", "406w005" },
{ "PEGLEG ", "406w003", "406w005", "406w005" },
@@ -409,6 +415,7 @@ const seriesPlayBreak Room406::PLAY36[] = {
{ 2, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 5, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 5, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ PLAY_BREAK_END
};
int32 Room406::_state1;
@@ -436,26 +443,26 @@ void Room406::init() {
if (_G(game).previous_room == KERNEL_RESTORING_GAME) {
switch (_G(flags)[V172]) {
case 10023:
- _val1 = 51;
+ _dogShould = 51;
break;
case 10024:
- _val1 = 58;
+ _dogShould = 58;
break;
case 10025:
- _val1 = 64;
+ _dogShould = 64;
break;
default:
break;
}
- if (_G(flags)[V172] == 10026)
- kernel_trigger_dispatch_now(12);
+ if (_G(flags)[V172] != 10026)
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val1 = imath_ranged_rand(1, 2) == 1 ? 49 : 50;
+ _dogShould = imath_ranged_rand(1, 2) == 1 ? 49 : 50;
if (_G(flags)[V172] == 10025) {
- _val1 = 64;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 64;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
}
}
@@ -539,15 +546,15 @@ void Room406::daemon() {
switch (_val2) {
case 22:
- switch (_val1) {
+ switch (_dogShould) {
case 49:
_state2 = imath_ranged_rand(1, 7);
- _val1 = 51;
+ _dogShould = 51;
series_play_with_breaks(PLAY20, "406dg06", 0x701, 12, 3);
break;
case 50:
- _val1 = 51;
+ _dogShould = 51;
series_play_with_breaks(PLAY21, "406dg07", 0x701, 12, 3);
break;
@@ -559,7 +566,7 @@ void Room406::daemon() {
break;
case 23:
- switch (_val1) {
+ switch (_dogShould) {
case 49:
_state2 = imath_ranged_rand(1, 7);
series_play_with_breaks(PLAY20, "406dg06", 0x701, 2, 3);
@@ -604,8 +611,8 @@ void Room406::daemon() {
break;
case 23:
- _val1 = 51;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 51;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
kernel_timing_trigger(300, 9);
_state4 = 23;
ws_turn_to_face(calc_facing(415, 234), 8);
@@ -739,12 +746,12 @@ void Room406::daemon() {
break;
case 46:
- _val5 = 68;
+ _mayorShould = 68;
wilbur_speech("406w901", 11);
break;
case 47:
- _val5 = 71;
+ _mayorShould = 71;
_state1 = 80;
wilbur_speech("406w902", 11);
break;
@@ -772,42 +779,45 @@ void Room406::daemon() {
_flag3 = true;
break;
- case 11:
- switch (_val5) {
+ case kCHANGE_MAYOR_ANIMATION:
+ switch (_mayorShould) {
case 68:
- _val5 = 69;
- digi_play("406g002", 1, 255, 11);
+ _mayorShould = 69;
+ digi_play("406g002", 1, 255, kCHANGE_MAYOR_ANIMATION);
break;
case 69:
- _val5 = 70;
- series_play_with_breaks(PLAY11, "406mg01", 0x5ff, 11, 3);
+ _mayorShould = 70;
+ series_play_with_breaks(PLAY11, "406mg01", 0x5ff, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 70:
_state1 = 79;
- _val5 = 71;
- series_play_with_breaks(PLAY12, "406mg03", 0x5ff, 11, 3);
+ _mayorShould = 71;
+ series_play_with_breaks(PLAY12, "406mg03", 0x5ff, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 71:
_mg03.terminate();
switch (_state1) {
+ case 79:
+ _mayorShould = 72;
+ break;
case 80:
- _val5 = 73;
+ _mayorShould = 73;
break;
case 81:
- _val5 = 74;
+ _mayorShould = 74;
break;
case 82:
- _val5 = 72;
+ _mayorShould = 72;
break;
default:
break;
}
- series_play_with_breaks(PLAY13, "406mg04", 0x5ff, 11, 3);
+ series_play_with_breaks(PLAY13, "406mg04", 0x5ff, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 72:
@@ -817,32 +827,32 @@ void Room406::daemon() {
break;
case 73:
- _val5 = 71;
+ _mayorShould = 71;
_state1 = 81;
- series_play_with_breaks(PLAY14, "406mg05", 0x5ff, 11, 3);
+ series_play_with_breaks(PLAY14, "406mg05", 0x5ff, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 74:
- _val1 = 67;
+ _dogShould = 67;
_mg03.show("406mg03", 0x5ff, 0, -1, -1, 14);
break;
case 75:
_mg03.terminate();
- _val5 = 76;
+ _mayorShould = 76;
series_play_with_breaks(PLAY15,
_G(flags)[V171] == 4000 ? "406mg06" : "406mg07",
- 0x5ff, 11, 3);
+ 0x5ff, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 76:
_val6 = 85;
- _val5 = 77;
+ _mayorShould = 77;
if (_G(flags)[V171] == 4000)
- series_play_with_breaks(PLAY16, "405mg06", 0x6fe, 11, 3);
+ series_play_with_breaks(PLAY16, "406mg06", 0x6fe, kCHANGE_MAYOR_ANIMATION, 3);
else
- series_play_with_breaks(PLAY17, "405mg07", 0x6fe, 11, 3);
+ series_play_with_breaks(PLAY17, "406mg07", 0x6fe, kCHANGE_MAYOR_ANIMATION, 3);
break;
case 77:
@@ -853,8 +863,8 @@ void Room406::daemon() {
_G(flags)[V171] = 4001;
setHotspots1();
- _val5 = 78;
- series_play_with_breaks(PLAY18, "406mgpof", 0x6fe, 11, 2);
+ _mayorShould = 78;
+ series_play_with_breaks(PLAY18, "406mgpof", 0x6fe, kCHANGE_MAYOR_ANIMATION, 2);
_val6 = 77;
kernel_trigger_dispatch_now(15);
break;
@@ -869,45 +879,45 @@ void Room406::daemon() {
}
break;
- case 12:
- switch (_val1) {
+ case kCHANGE_DOG_ANIMATION:
+ switch (_dogShould) {
case 51:
_G(flags)[V172] = 10023;
setHotspots1();
if (_G(flags)[V173]) {
- _val1 = 62;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 62;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
switch (imath_ranged_rand(1, 4)) {
case 1:
- _val1 = 51;
+ _dogShould = 51;
break;
case 2:
- _val1 = 55;
+ _dogShould = 55;
break;
case 3:
- _val1 = 53;
+ _dogShould = 53;
break;
case 4:
- _val1 = 54;
+ _dogShould = 54;
break;
default:
break;
}
- Series::series_show("406dg15", 0x701, 0, 12, 120, 0);
+ Series::series_show("406dg15", 0x701, 0, kCHANGE_DOG_ANIMATION, 120, 0);
}
break;
case 53:
_state2 = imath_ranged_rand(1, 7);
- _val1 = 51;
+ _dogShould = 51;
if (!digi_play_state(1) && !digi_play_state(2)) {
- series_play_with_breaks(PLAY23, "406dg08", 0x701, 12, 3);
+ series_play_with_breaks(PLAY23, "406dg08", 0x701, kCHANGE_DOG_ANIMATION, 3);
} else {
- kernel_trigger_dispatch_now(12);
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
@@ -915,45 +925,45 @@ void Room406::daemon() {
if (!digi_play_state(1) && !digi_play_state(2)) {
_G(flags)[V172] = 10024;
_state2 = imath_ranged_rand(1, 3);
- _val1 = 58;
- series_play_with_breaks(PLAY24, "406dg10", 0x701, 12, 3);
+ _dogShould = 58;
+ series_play_with_breaks(PLAY24, "406dg10", 0x701, kCHANGE_DOG_ANIMATION, 3);
} else {
- _val1 = 51;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 51;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
case 55:
_state2 = imath_ranged_rand(1, 6);
- _val1 = 51;
+ _dogShould = 51;
if (!digi_play_state(1) && !digi_play_state(2)) {
- series_play_with_breaks(PLAY22, "406dg16", 0x701, 12, 3);
+ series_play_with_breaks(PLAY22, "406dg16", 0x701, kCHANGE_DOG_ANIMATION, 3);
} else {
- kernel_trigger_dispatch_now(12);
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
case 56:
_state2 = imath_ranged_rand(1, 6);
- _val1 = 58;
+ _dogShould = 58;
if (!digi_play_state(1) && !digi_play_state(2)) {
- series_play_with_breaks(PLAY22, "406dg12", 0x701, 12, 3);
+ series_play_with_breaks(PLAY22, "406dg12", 0x701, kCHANGE_DOG_ANIMATION, 3);
} else {
- kernel_trigger_dispatch_now(12);
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
case 57:
if ((!digi_play_state(1) && !digi_play_state(2)) || _G(flags)[V173]) {
_state2 = imath_ranged_rand(1, 3);
- _val1 = 51;
+ _dogShould = 51;
_G(flags)[V172] = 10023;
- series_play_with_breaks(PLAY25, "406dg14", 0x701, 12, 3);
+ series_play_with_breaks(PLAY25, "406dg14", 0x701, kCHANGE_DOG_ANIMATION, 3);
} else {
- _val1 = 58;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 58;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
@@ -962,44 +972,44 @@ void Room406::daemon() {
setHotspots1();
if (_G(flags)[V173]) {
- _val1 = 57;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 57;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
switch (imath_ranged_rand(1, 3)) {
case 1:
- _val1 = 58;
+ _dogShould = 58;
break;
case 2:
- _val1 = 57;
+ _dogShould = 57;
break;
case 3:
- _val1 = 56;
+ _dogShould = 56;
break;
default:
break;
}
- Series::series_show("406dg11", 0x701, 0, 12, 120);
+ Series::series_show("406dg11", 0x701, 0, kCHANGE_DOG_ANIMATION, 120);
}
break;
case 59:
_state2 = imath_ranged_rand(1, 6);
- _val1 = 54;
- series_play_with_breaks(PLAY26, "406dg09", 0x701, 12, 3);
+ _dogShould = 54;
+ series_play_with_breaks(PLAY26, "406dg09", 0x701, kCHANGE_DOG_ANIMATION, 3);
break;
case 60:
_state2 = imath_ranged_rand(1, 6);
- _val1 = 56;
- series_play_with_breaks(PLAY27, "406dg13", 0x701, 12, 3);
+ _dogShould = 56;
+ series_play_with_breaks(PLAY27, "406dg13", 0x701, kCHANGE_DOG_ANIMATION, 3);
break;
case 61:
_state2 = imath_ranged_rand(1, 6);
- _val1 = 64;
+ _dogShould = 64;
series_play_with_breaks(PLAY28,
- _G(flags)[V171] == 4000 ? "406dg04" : "406dg05", 0x6fe, 12, 3);
+ _G(flags)[V171] == 4000 ? "406dg04" : "406dg05", 0x6fe, kCHANGE_DOG_ANIMATION, 3);
break;
case 62:
@@ -1010,37 +1020,38 @@ void Room406::daemon() {
series_unload(_fishS);
_state2 = imath_ranged_rand(1, 4);
_state3 = imath_ranged_rand(1, 4);
- _val1 = 63;
- series_play_with_breaks(PLAY29, "406dg01", 0x6fe, 12, 3);
+ _dogShould = 63;
+ series_play_with_breaks(PLAY29, "406dg01", 0x6fe, kCHANGE_DOG_ANIMATION, 3);
break;
case 63:
setupFish();
setHotspots1();
- kernel_trigger_dispatch_now(12);
+ _dogShould = 64;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
hotspot_set_active("HOLE", false);
break;
case 64:
- _val1 = imath_ranged_rand(1, 3) == 1 ? 66 : 64;
+ _dogShould = imath_ranged_rand(1, 3) == 1 ? 66 : 64;
_state2 = imath_ranged_rand(1, 6);
if (digi_play_state(2) || _flag3)
_state2 = 0;
_seriesName = _G(flags)[V171] == 4000 ? "406dg02" : "406dg03";
- series_play_with_breaks(PLAY30, _seriesName, 0x6fe, 12, 3, 10);
+ series_play_with_breaks(PLAY30, _seriesName, 0x6fe, kCHANGE_DOG_ANIMATION, 3, 10);
break;
case 65:
_G(wilbur_should) = 21;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
- _val1 = 64;
- kernel_trigger_dispatch_now(12);
+ _dogShould = 64;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
break;
case 66:
- _val1 = 64;
+ _dogShould = 64;
_state2 = imath_ranged_rand(1, 5);
if (!digi_play_state(1) && !digi_play_state(2)) {
@@ -1050,14 +1061,14 @@ void Room406::daemon() {
_seriesName = _G(flags)[V171] == 4000 ? "406dg02" : "406dg03";
series_play_with_breaks(PLAY[imath_ranged_rand(0, 5)],
- _seriesName, 0x6fe, 12, 3);
+ _seriesName, 0x6fe, kCHANGE_DOG_ANIMATION, 3);
} else {
- kernel_trigger_dispatch_now(12);
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
}
break;
case 67:
- _val5 = 75;
+ _mayorShould = 75;
kernel_trigger_dispatch_now(11);
break;
@@ -1102,9 +1113,9 @@ void Room406::daemon() {
inv_move_object("FISH", NOWHERE);
if (_G(flags)[V172] == 10024)
- _val1 = 57;
+ _dogShould = 57;
if (_G(flags)[V172] == 10023)
- _val1 = 62;
+ _dogShould = 62;
break;
case 85:
@@ -1170,6 +1181,7 @@ void Room406::daemon() {
break;
case 7:
+ player_set_commands_allowed(true);
_general.show("406wi04", 0x4fd);
inv_give_to_player("HOOK");
_G(flags)[V174] = 4003;
@@ -1289,7 +1301,7 @@ void Room406::daemon() {
case 20:
player_set_commands_allowed(false);
_G(flags)[V171] = 4002;
- _val1 = 65;
+ _dogShould = 65;
break;
case 21:
@@ -1307,13 +1319,13 @@ void Room406::daemon() {
case 10008:
switch (_G(flags)[V172]) {
case 10023:
- _val1 = 59;
+ _dogShould = 59;
break;
case 10024:
- _val1 = 60;
+ _dogShould = 60;
break;
case 10025:
- _val1 = 61;
+ _dogShould = 61;
break;
default:
break;
@@ -1349,7 +1361,12 @@ void Room406::pre_parser() {
(player_said("HOOK") && player_said_any("YARD", "YARD "))) {
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
+ } else {
+ g_engine->parse_player_command_now();
}
+
+ _G(player).command_ready = false;
+
} else if (player_said("GATE") && _G(flags)[V172] == 10025) {
player_hotspot_walk_override(280, 296, 2);
} else if (player_said("GEAR") && player_said_any("WINCH", "LEVER", "LEVER ") && _G(flags)[V175]) {
@@ -1361,9 +1378,11 @@ void Room406::pre_parser() {
} else if (player_said("GEAR", "DISC")) {
_val4 = 4007;
player_hotspot_walk_override(44, 310, -1, 5);
+ _G(player).command_ready = false;
} else if (player_said("GEAR", "DISC ")) {
_val4 = 4007;
player_hotspot_walk_override(460, 346, -1, 5);
+ _G(player).command_ready = false;
} else if (player_said("LOOK AT") && player_said_any("JAIL CELL", "JAIL CELL ") && _G(flags)[V174] == 4004) {
if (!_flag1) {
parseJail();
@@ -1372,6 +1391,8 @@ void Room406::pre_parser() {
if (player_said("LOOK AT", "JAIL CELL"))
player_hotspot_walk_override(173, 302, 10);
}
+
+ _G(player).command_ready = false;
} else {
if (_G(flags)[V174] == 4002) {
if (_G(player).walk_x >= 180 && _G(player).walk_x <= 309 &&
@@ -1411,11 +1432,7 @@ void Room406::pre_parser() {
(_hotspot->feet_y == 0x7fff && _G(click_y) > tabooAreaY(_G(click_x))))
player_walk_to(_hotspot->feet_x, tabooAreaY(_hotspot->feet_x) + 1);
}
-
- return;
}
-
- _G(player).command_ready = false;
}
void Room406::parser() {
@@ -1432,12 +1449,12 @@ void Room406::loadSeries() {
}
if (_G(flags)[V172] == 10023 || _G(flags)[V172] == 10024) {
- if (_val1 == 49) {
+ if (_dogShould == 49) {
series_load("406dg06");
series_load("406dg06s");
}
- if (_val1 == 50) {
+ if (_dogShould == 50) {
series_load("406dg07");
series_load("406dg07s");
}
@@ -1524,8 +1541,8 @@ void Room406::setHotspots3() {
break;
case 4001:
- hotspot_set_active("HOOK ", true);
- hotspot_set_active("CHAIN ", true);
+ hotspot_set_active("HOOK ", true);
+ hotspot_set_active("CHAIN ", true);
hotspot_set_active("LEVER ", true);
break;
diff --git a/engines/m4/burger/rooms/section4/room406.h b/engines/m4/burger/rooms/section4/room406.h
index 4cac75e449c..1558c80b33e 100644
--- a/engines/m4/burger/rooms/section4/room406.h
+++ b/engines/m4/burger/rooms/section4/room406.h
@@ -96,11 +96,11 @@ private:
bool _flag2 = false;
bool _flag3 = false;
int _ticks = 0;
- int _val1 = 0;
+ int _dogShould = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
- int _val5 = 0;
+ int _mayorShould = 0;
int _val6 = 0;
int _val7 = 0;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index d87ff18d0bf..1e96f120e55 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -93,7 +93,6 @@ private:
void get_walker();
void game_control_cycle();
- void parse_player_command_now();
protected:
Common::Array<Section *> _sections;
@@ -108,6 +107,7 @@ public:
void global_section_constructor();
void section_room_constructor();
void game_daemon_code();
+ void parse_player_command_now();
void section_init() {
_activeSection->init();
Commit: 927579d234fbd557b8d57adf9123355386615db0
https://github.com/scummvm/scummvm/commit/927579d234fbd557b8d57adf9123355386615db0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of npc constants in room 407
Changed paths:
engines/m4/burger/rooms/section4/room404.cpp
engines/m4/burger/rooms/section4/room405.cpp
engines/m4/burger/rooms/section4/room405.h
engines/m4/burger/rooms/section4/room407.cpp
engines/m4/burger/rooms/section4/room407.h
diff --git a/engines/m4/burger/rooms/section4/room404.cpp b/engines/m4/burger/rooms/section4/room404.cpp
index ae9107e1d4e..67618127b71 100644
--- a/engines/m4/burger/rooms/section4/room404.cpp
+++ b/engines/m4/burger/rooms/section4/room404.cpp
@@ -117,12 +117,15 @@ void Room404::daemon() {
}
void Room404::pre_parser() {
- if (player_said("IMPOUND YARD") && !player_said("EXIT") &&
- !player_said("LOOK AT") && !player_said("GEAR")) {
- player_hotspot_walk_override(320, 346, 5);
- } else {
- player_set_commands_allowed(false);
- kernel_trigger_dispatch_now(1);
+ _G(kernel).trigger_mode = KT_DAEMON;
+
+ if (player_said("IMPOUND YARD")) {
+ if (!player_said_any("EXIT", "LOOK AT", "GEAR")) {
+ player_hotspot_walk_override(320, 346, 5);
+ } else {
+ player_set_commands_allowed(false);
+ kernel_trigger_dispatch_now(1);
+ }
}
}
@@ -132,18 +135,20 @@ void Room404::parser() {
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("IMPOUND YARD")) {
- if (player_said("TAKE", "QUARTER ")) {
- _G(wilbur_should) = 1;
- kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
- } else if (player_said("TOILET")) {
- wilbur_speech("404w004");
- } else if (player_said("BARS")) {
- wilbur_speech("404w013");
+ if (player_said_any("EXIT", "LOOK AT", "GEAR")) {
+ kernel_trigger_dispatch_now(4005);
} else {
- return;
+ wilbur_speech("400w001");
}
- } else if (player_said("EXIT") || player_said("LOOK AT") || player_said("GEAR")) {
- kernel_trigger_dispatch_now(4005);
+ } else if (player_said("TAKE", "QUARTER ")) {
+ _G(wilbur_should) = 1;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
+ } else if (player_said("TOILET")) {
+ wilbur_speech("404w004");
+ } else if (player_said("BARS")) {
+ wilbur_speech("404w013");
+ } else {
+ return;
}
_G(player).command_ready = false;
diff --git a/engines/m4/burger/rooms/section4/room405.cpp b/engines/m4/burger/rooms/section4/room405.cpp
index c4c1ac66898..3af5df5dbef 100644
--- a/engines/m4/burger/rooms/section4/room405.cpp
+++ b/engines/m4/burger/rooms/section4/room405.cpp
@@ -27,6 +27,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_VIPE_ANIMATION = 15
+};
+
const char *Room405::SAID[][4] = {
{ "VIPE", nullptr, "400W001", "400W001" },
{ "GUITAR", "405w003", nullptr, nullptr },
@@ -146,9 +150,9 @@ void Room405::init() {
hotspot_set_active("vipe", false);
hotspot_set_active("guitar", false);
} else {
- _val1 = 39;
- _val2 = 39;
- kernel_trigger_dispatch_now(15);
+ _vipeShould = 39;
+ _vipeMode = 39;
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
}
if (inv_object_is_here("records")) {
@@ -192,12 +196,12 @@ void Room405::daemon() {
case 1:
case 4:
player_set_commands_allowed(true);
- _val1 = 39;
+ _vipeShould = 39;
break;
case 2:
player_set_commands_allowed(false);
- _val1 = 49;
+ _vipeShould = 49;
break;
case 3:
@@ -240,93 +244,93 @@ void Room405::daemon() {
digi_play("405v513", 1, 255);
break;
- case 15:
- switch (_val2) {
+ case kCHANGE_VIPE_ANIMATION:
+ switch (_vipeMode) {
case 39:
- switch (_val1) {
+ switch (_vipeShould) {
case 39:
if (imath_ranged_rand(1, 20) == 1) {
- _val2 = 42;
- Series::series_play("405vp03", 0x900, 0, 15, 6, 0, 100, 0, 0, 0, 4);
+ _vipeMode = 42;
+ Series::series_play("405vp03", 0x900, 0, kCHANGE_VIPE_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
} else {
- Series::series_play("405vp01", 0x900, 0, 15, 60, 0, 100, 0, 0, 0, 0);
+ Series::series_play("405vp01", 0x900, 0, kCHANGE_VIPE_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
}
break;
case 40:
frame = imath_ranged_rand(0, 5);
- Series::series_play("405vp02", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("405vp02", 0x900, 0, kCHANGE_VIPE_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
playDigi2();
break;
default:
- _val2 = 42;
- Series::series_play("405vp03", 0x900, 0, 15, 6, 0, 100, 0, 0, 0, 4);
+ _vipeMode = 42;
+ Series::series_play("405vp03", 0x900, 0, kCHANGE_VIPE_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
case 41:
- if (_val1 == 39) {
+ if (_vipeShould == 39) {
if (imath_ranged_rand(1, 10) == 1) {
- Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 5, 6);
+ Series::series_play("405vp07", 0x900, 0, kCHANGE_VIPE_ANIMATION, 10, 0, 100, 0, 0, 5, 6);
} else {
- Series::series_play("405vp07", 0x900, 2, 15, 60, 0, 100, 0, 0, 4, 4);
+ Series::series_play("405vp07", 0x900, 2, kCHANGE_VIPE_ANIMATION, 60, 0, 100, 0, 0, 4, 4);
}
} else {
- _val2 = 42;
- Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 5, 6);
+ _vipeMode = 42;
+ Series::series_play("405vp07", 0x900, 0, kCHANGE_VIPE_ANIMATION, 10, 0, 100, 0, 0, 5, 6);
}
break;
case 42:
- switch (_val1) {
+ switch (_vipeShould) {
case 39:
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val2 = 39;
- Series::series_play("405vp03", 0x900, 2, 15, 10, 0, 100, 0, 0, 0, 4);
+ _vipeMode = 39;
+ Series::series_play("405vp03", 0x900, 2, kCHANGE_VIPE_ANIMATION, 10, 0, 100, 0, 0, 0, 4);
break;
case 2:
- _val2 = 41;
- Series::series_play("405vp07", 0x900, 0, 15, 10, 0, 100, 0, 0, 0, 4);
+ _vipeMode = 41;
+ Series::series_play("405vp07", 0x900, 0, kCHANGE_VIPE_ANIMATION, 10, 0, 100, 0, 0, 0, 4);
break;
default:
- Series::series_play("405vp03", 0x900, 0, 15, 60, 0, 100, 0, 0, 4, 4);
+ Series::series_play("405vp03", 0x900, 0, kCHANGE_VIPE_ANIMATION, 60, 0, 100, 0, 0, 4, 4);
break;
}
break;
case 43:
- Series::series_play("405vp03", 0x900, 0, 15, 60, 0, 100, 0, 0, 4, 4);
+ Series::series_play("405vp03", 0x900, 0, kCHANGE_VIPE_ANIMATION, 60, 0, 100, 0, 0, 4, 4);
break;
case 44:
frame = imath_ranged_rand(0, 5);
- Series::series_play("405vp05", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("405vp05", 0x900, 0, kCHANGE_VIPE_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
playDigi2();
break;
case 45:
frame = imath_ranged_rand(0, 6);
- Series::series_play("405vp06", 0x900, 0, 15, 4, 0, 100, 0, 0, frame, frame);
+ Series::series_play("405vp06", 0x900, 0, kCHANGE_VIPE_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 49:
digi_preload("999_003");
_vpoof = series_load("405vpoof");
- _val1 = 50;
- Series::series_play("405vp13", 0x900, 0, 15, 7, 0, 100, 0, 0, 0, 16);
+ _vipeShould = 50;
+ Series::series_play("405vp13", 0x900, 0, kCHANGE_VIPE_ANIMATION, 7, 0, 100, 0, 0, 0, 16);
break;
case 50:
- _val1 = 51;
+ _vipeShould = 51;
Series::series_play("405vp13", 0x900, 0, -1, 7, 0, 100, 0, 0, 17, 18);
_G(flags)[V166] = 1;
digi_play("999_003", 1, 255);
- series_play("405vpoof", 0x500, 0, 15, 7, 0, 70, 40, 40, 0, -1);
+ series_play("405vpoof", 0x500, 0, kCHANGE_VIPE_ANIMATION, 7, 0, 70, 40, 40, 0, -1);
_val5 = 2;
kernel_trigger_dispatch_now(16);
break;
@@ -343,59 +347,81 @@ void Room405::daemon() {
break;
case 46:
- switch (_val1) {
+ switch (_vipeShould) {
case 47:
- Series::series_play("405vp10", 0x900, 0, 15, 60, 0, 100, 0, 0, 5, 5);
+ Series::series_play("405vp10", 0x900, 0, kCHANGE_VIPE_ANIMATION, 60, 0, 100, 0, 0, 5, 5);
break;
case 48:
frame = imath_ranged_rand(0, 6);
- Series::series_play("405vp11", 0x900, 0, 15, 5, 0, 100, 0, 0, frame, frame);
+ Series::series_play("405vp11", 0x900, 0, kCHANGE_VIPE_ANIMATION, 5, 0, 100, 0, 0, frame, frame);
playDigi2();
break;
case 49:
- _val2 = 42;
- kernel_trigger_dispatch_now(15);
+ _vipeMode = 42;
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
break;
}
break;
- default:
- break;
- }
- break;
-
- case 16:
- switch (_val5) {
- case 1:
- _cat.terminate();
- _val5 = 3;
- series_play_with_breaks(PLAY3, "405cat", 0, 16, 3, 9, 100, 0, 0);
+ case 47:
+ switch (_vipeShould) {
+ case 47:
+ Series::series_play("405vp10", 0x900, 0, kCHANGE_VIPE_ANIMATION,
+ 60, 0, 100, 0, 0, 5, 5);
break;
- case 2:
- _cat.terminate();
- _val5 = 3;
- series_play_with_breaks(PLAY4, "405cat", 0, 16, 3, 6, 100, 0, 0);
+ case 48:
+ frame = imath_ranged_rand(0, 6);
+ Series::series_play("405vp11", 0x900, 0, kCHANGE_VIPE_ANIMATION,
+ 5, 0, 100, 0, 0, frame, frame);
+ playDigi2();
break;
- case 3:
- _cat.show("405cat", 0);
+ case 49:
+ _vipeMode = 42;
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
break;
default:
break;
}
+ default:
break;
+ }
+ break;
+
+ case 16:
+ switch (_val5) {
+ case 1:
+ _cat.terminate();
+ _val5 = 3;
+ series_play_with_breaks(PLAY3, "405cat", 0, 16, 3, 9, 100, 0, 0);
+ break;
+
+ case 2:
+ _cat.terminate();
+ _val5 = 3;
+ series_play_with_breaks(PLAY4, "405cat", 0, 16, 3, 6, 100, 0, 0);
+ break;
+
+ case 3:
+ _cat.show("405cat", 0);
+ break;
+
+ default:
+ break;
+ }
+ break;
case 17:
switch (_val4) {
case 4:
switch (_val3) {
case 4:
- switch (imath_ranged_rand(1, 15)) {
+ switch (imath_ranged_rand(1, kCHANGE_VIPE_ANIMATION)) {
case 1:
series_play_with_breaks(PLAY1, "405ve02", 0xf00, 17, 2);
break;
@@ -497,12 +523,12 @@ void Room405::daemon() {
break;
case 14:
- _val3 = 15;
+ _val3 = kCHANGE_VIPE_ANIMATION;
digi_preload("405_009");
series_play_with_breaks(PLAY2, "405ve16", 0x100, 17, 3);
break;
- case 15:
+ case kCHANGE_VIPE_ANIMATION:
_val3 = 9;
kernel_trigger_dispatch_now(17);
break;
@@ -694,7 +720,7 @@ void Room405::daemon() {
break;
case 22:
- pal_fade_init(15, 255, 100, 0, -1);
+ pal_fade_init(kCHANGE_VIPE_ANIMATION, 255, 100, 0, -1);
break;
case 23:
@@ -737,8 +763,8 @@ void Room405::daemon() {
break;
case 28:
- _val2 = 47;
- Series::series_play("405vp10", 0x900, 0, 15, 7, 0, 100, 0, 0, 0, 5);
+ _vipeMode = 47;
+ Series::series_play("405vp10", 0x900, 0, kCHANGE_VIPE_ANIMATION, 7, 0, 100, 0, 0, 0, 5);
break;
case 29:
@@ -761,11 +787,11 @@ void Room405::daemon() {
case 25:
disable_player();
_G(wilbur_should) = 26;
- Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
+ Series::series_play("405wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, kCHANGE_VIPE_ANIMATION);
break;
case 26:
- _vp03.play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, 15, 15);
+ _vp03.play("405wi01", 0x100, 0, -1, 600, -1, 100, 0, 0, kCHANGE_VIPE_ANIMATION, kCHANGE_VIPE_ANIMATION);
startConv89();
break;
@@ -836,7 +862,7 @@ void Room405::daemon() {
case 37:
_G(wilbur_should) = 38;
gr_backup_palette();
- pal_fade_init(_G(kernel).first_fade, 255, 0, 15, kCHANGE_WILBUR_ANIMATION);
+ pal_fade_init(_G(kernel).first_fade, 255, 0, kCHANGE_VIPE_ANIMATION, kCHANGE_WILBUR_ANIMATION);
break;
case 38:
@@ -984,7 +1010,7 @@ void Room405::parser() {
case 4:
term_message("spat 4");
- _eu02 = series_play("405eu02", 0xf00, 0, -1, 600, -1, 100, 0, 0, 15, 15);
+ _eu02 = series_play("405eu02", 0xf00, 0, -1, 600, -1, 100, 0, 0, kCHANGE_VIPE_ANIMATION, kCHANGE_VIPE_ANIMATION);
break;
default:
@@ -1058,12 +1084,12 @@ void Room405::conv86() {
if (_G(kernel).trigger == 18) {
if (who <= 0) {
- if (_val2 == 39)
- _val1 = 39;
- else if (_val2 == 47)
- _val1 = 47;
+ if (_vipeMode == 39)
+ _vipeShould = 39;
+ else if (_vipeMode == 47)
+ _vipeShould = 47;
else
- _val1 = 43;
+ _vipeShould = 43;
conv_resume();
} else if (who == 1) {
@@ -1074,12 +1100,12 @@ void Room405::conv86() {
}
} else if (sound) {
if (who <= 0) {
- if (_val2 == 39)
- _val1 = 40;
- else if (_val2 == 47)
- _val1 = 48;
+ if (_vipeMode == 39)
+ _vipeShould = 40;
+ else if (_vipeMode == 47)
+ _vipeShould = 48;
else
- _val1 = 44;
+ _vipeShould = 44;
_digiName = sound;
} else if (who == 1) {
@@ -1105,12 +1131,12 @@ void Room405::conv89() {
if (_G(kernel).trigger == 18) {
if (who <= 0) {
- if (_val2 == 39)
- _val1 = 39;
- else if (_val2 == 47)
- _val1 = 47;
+ if (_vipeMode == 39)
+ _vipeShould = 39;
+ else if (_vipeMode == 47)
+ _vipeShould = 47;
else
- _val1 = 43;
+ _vipeShould = 43;
conv_resume();
} else if (who == 1) {
@@ -1122,15 +1148,15 @@ void Room405::conv89() {
} else if (sound) {
if (who <= 0) {
if ((node == 1 && entry == 0) || (node == 2 && entry == 0)) {
- _val1 = 44;
+ _vipeShould = 44;
} else if ((node == 1 && entry == 1) || (node == 2 && entry == 1)) {
- _val1 = 48;
- } else if (_val2 == 39) {
- _val1 = 40;
- } else if (_val2 == 47) {
- _val1 = 48;
+ _vipeShould = 48;
+ } else if (_vipeMode == 39) {
+ _vipeShould = 40;
+ } else if (_vipeMode == 47) {
+ _vipeShould = 48;
} else {
- _val1 = 44;
+ _vipeShould = 44;
}
_digiName = sound;
@@ -1155,7 +1181,7 @@ void Room405::conv90() {
if (_G(kernel).trigger == 18) {
if (who <= 0) {
- _val1 = 39;
+ _vipeShould = 39;
conv_resume();
} else if (who == 1) {
if (_G(player).walker_visible)
@@ -1165,7 +1191,7 @@ void Room405::conv90() {
}
} else if (sound) {
if (who <= 0) {
- _val1 = 44;
+ _vipeShould = 44;
_digiName = sound;
} else if (who == 1) {
if (_G(player).walker_visible)
@@ -1188,7 +1214,7 @@ void Room405::conv91() {
if (_G(kernel).trigger == 18) {
if (who <= 0) {
- _val1 = 39;
+ _vipeShould = 39;
conv_resume();
} else if (who == 1) {
if (_G(player).walker_visible)
@@ -1198,7 +1224,7 @@ void Room405::conv91() {
}
} else if (sound) {
if (who <= 0) {
- _val1 = 44;
+ _vipeShould = 44;
_digiName = sound;
} else if (who == 1) {
if (_G(player).walker_visible)
diff --git a/engines/m4/burger/rooms/section4/room405.h b/engines/m4/burger/rooms/section4/room405.h
index af9160fd1f3..518addccbef 100644
--- a/engines/m4/burger/rooms/section4/room405.h
+++ b/engines/m4/burger/rooms/section4/room405.h
@@ -50,8 +50,8 @@ private:
int32 _vpoof = -1;
KernelTriggerType _newMode = (KernelTriggerType)0;
int _volume = 0;
- int _val1 = 0;
- int _val2 = 0;
+ int _vipeShould = 0;
+ int _vipeMode = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index 7c5809ee875..f1fcab79ac5 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -26,6 +26,13 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kWILBUR_SPEECH = 4,
+ kCHANGE_DRUMZ_ANIMATION = 7,
+ kCHANGE_ROXY_ANIMATION = 8,
+ kCHANGE_VIPE_ANIMATION = 9
+};
+
const char *Room407::SAID[][4] = {
{ "TOUR BUS", "407w001", "407w002", "407w003" },
{ "ROXY", nullptr, "400w001", "400w001" },
@@ -37,16 +44,16 @@ const char *Room407::SAID[][4] = {
const WilburMatch Room407::MATCH[] = {
{ "TALK", "DRUMZ", 11, 0, 0, nullptr, 0 },
- { "AMPLIFIER", "DRUMZ", 4, 0, 0, &_state1, 4 },
- { nullptr, "DRUMZ", 4, 0, 0, &_state1, 7 },
+ { "AMPLIFIER", "DRUMZ", 4, 0, 0, &_speechNum, 4 },
+ { nullptr, "DRUMZ", 4, 0, 0, &_speechNum, 7 },
{ "LOOK AT", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 1 },
{ "TALK", "ROXY", 10016, 0, 0, &Vars::_wilbur_should, 2 },
- { "AMPLIFIER", "ROXY", 4, 0, 0, &_state1, 4 },
- { "DOG COLLAR", "ROXY", 4, 0, 0, &_state1, 5 },
- { nullptr, "ROXY", 4, 0, 0, &_state1, 6 },
- { "AMPLIFIER", "INSTRUMENTS", 4, 0, 0, &_state1, 8 },
- { nullptr, "INSTRUMENTS", 4, 0, 0, &_state1, 9 },
- { nullptr, "TOUR BUS", 4, 0, 0, &_state1, 3 },
+ { "AMPLIFIER", "ROXY", 4, 0, 0, &_speechNum, 4 },
+ { "DOG COLLAR", "ROXY", 4, 0, 0, &_speechNum, 5 },
+ { nullptr, "ROXY", 4, 0, 0, &_speechNum, 6 },
+ { "AMPLIFIER", "INSTRUMENTS", 4, 0, 0, &_speechNum, 8 },
+ { nullptr, "INSTRUMENTS", 4, 0, 0, &_speechNum, 9 },
+ { nullptr, "TOUR BUS", 4, 0, 0, &_speechNum, 3 },
{ nullptr, nullptr, -1, 0, 0, nullptr, 0 }
};
@@ -146,11 +153,11 @@ const seriesPlayBreak Room407::PLAY18[] = {
PLAY_BREAK_END
};
-int32 Room407::_state1;
+int32 Room407::_speechNum;
Room407::Room407() : Section4Room() {
- _state1 = 0;
+ _speechNum = 0;
}
void Room407::init() {
@@ -172,11 +179,11 @@ void Room407::init() {
} else {
loadSeries();
_walk1 = intr_add_no_walk_rect(140, 295, 240, 325, 139, 326);
- _val2 = 10;
- kernel_trigger_dispatch_now(7);
+ _drumzShould = 10;
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
- _val3 = 22;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 22;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
if (_G(flags)[V171] == 4003)
_vp02.show("407vp02", 0x300);
@@ -222,8 +229,8 @@ void Room407::daemon() {
}
break;
- case 4:
- switch (_state1) {
+ case kWILBUR_SPEECH:
+ switch (_speechNum) {
case 3:
wilbur_speech("400w001");
break;
@@ -251,12 +258,16 @@ void Room407::daemon() {
break;
case 5:
- _val2 = 17;
+ _drumzShould = 17;
if (_val4) {
kernel_timing_trigger(120, 7);
} else {
- _digiName = Common::String::format("407r902%c", 'a' + imath_ranged_rand(1, 25));
+ int rnd = imath_ranged_rand(1, 25);
+ if (rnd >= 16)
+ _digiName = "407r902a";
+ else
+ _digiName = Common::String::format("407r902%c", 'a' + imath_ranged_rand(1, 25));
_flag1 = true;
digi_preload(_digiName);
@@ -269,42 +280,42 @@ void Room407::daemon() {
kernel_trigger_dispatch_now(7);
break;
- case 7:
- switch (_val2) {
+ case kCHANGE_DRUMZ_ANIMATION:
+ switch (_drumzShould) {
case 10:
if (!digi_play_state(2))
digi_play_loop("407_001", 2);
- _val2 = getRandomState();
- series_play_with_breaks(PLAY1, "407dz01", 0xa01, 7, 3);
+ _drumzShould = getRandomState();
+ series_play_with_breaks(PLAY1, "407dz01", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 11:
- _val2 = 14;
- series_play_with_breaks(PLAY2, "407dz02", 0xa01, 7, 3);
+ _drumzShould = 14;
+ series_play_with_breaks(PLAY2, "407dz02", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 12:
- _val2 = 14;
- series_play_with_breaks(PLAY3, "407dz03", 0xa01, 7, 3);
+ _drumzShould = 14;
+ series_play_with_breaks(PLAY3, "407dz03", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 13:
digi_stop(2);
- _val2 = 14;
- series_play_with_breaks(PLAY4, "407dz04", 0xa01, 7, 3);
+ _drumzShould = 14;
+ series_play_with_breaks(PLAY4, "407dz04", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 14:
- _val2 = getRandomState();
- kernel_trigger_dispatch_now(7);
+ _drumzShould = getRandomState();
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
kernel_trigger_dispatch_now(10001);
break;
case 15:
digi_stop(2);
- _val2 = getRandomState();
- series_play_with_breaks(PLAY5, "407dz05", 0xa01, 7, 3);
+ _drumzShould = getRandomState();
+ series_play_with_breaks(PLAY5, "407dz05", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 16:
@@ -318,15 +329,15 @@ void Room407::daemon() {
case 17:
_flag1 = false;
freeDz();
- _val2 = getRandomState();
- series_play_with_breaks(PLAY6, "407dz06", 0xa01, 7, 3);
+ _drumzShould = getRandomState();
+ series_play_with_breaks(PLAY6, "407dz06", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 18:
_flag1 = false;
freeDz();
- _val2 = 19;
- series_play_with_breaks(PLAY6, "407dz06", 0xa01, 7, 3);
+ _drumzShould = 19;
+ series_play_with_breaks(PLAY6, "407dz06", 0xa01, kCHANGE_DRUMZ_ANIMATION, 3);
break;
case 19:
@@ -334,7 +345,7 @@ void Room407::daemon() {
digi_play_loop("407_001", 2);
conv88();
- kernel_trigger_dispatch_now(7);
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
break;
case 20:
@@ -353,8 +364,8 @@ void Room407::daemon() {
}
break;
- case 8:
- switch (_val3) {
+ case kCHANGE_ROXY_ANIMATION:
+ switch (_roxyShould) {
case 22:
_rx = series_show("407rx02", 0x901);
break;
@@ -364,13 +375,13 @@ void Room407::daemon() {
switch (_val4) {
case 1:
- _val3 = 26;
+ _roxyShould = 26;
break;
case 2:
- _val3 = 24;
+ _roxyShould = 24;
break;
case 3:
- _val3 = 27;
+ _roxyShould = 27;
break;
default:
break;
@@ -390,46 +401,46 @@ void Room407::daemon() {
case 26:
terminateMachineAndNull(_rx);
- _val3 = 30;
- series_play_with_breaks(PLAY9, "407rx04", 0x901, 8, 2);
+ _roxyShould = 30;
+ series_play_with_breaks(PLAY9, "407rx04", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 27:
- _val3 = 28;
- series_play_with_breaks(PLAY8, "407rx04", 0x901, 8, 2);
+ _roxyShould = 28;
+ series_play_with_breaks(PLAY8, "407rx04", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 28:
- _val3 = 29;
- series_play_with_breaks(PLAY10, "407rx02", 0x901, 8, 2);
+ _roxyShould = 29;
+ series_play_with_breaks(PLAY10, "407rx02", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 29:
- _val3 = 22;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 22;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
kernel_trigger_dispatch_now(1);
break;
case 30:
- _val3 = 31;
- series_play_with_breaks(PLAY11, "407rx06", 0x901, 8, 2);
+ _roxyShould = 31;
+ series_play_with_breaks(PLAY11, "407rx06", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 31:
- _val5 = 36;
- kernel_trigger_dispatch_now(9);
- _val3 = 32;
- series_play_with_breaks(PLAY12, "407rx08", 0x901, 8, 2);
+ _vipeShould = 36;
+ kernel_trigger_dispatch_now(kCHANGE_VIPE_ANIMATION);
+ _roxyShould = 32;
+ series_play_with_breaks(PLAY12, "407rx08", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 32:
- _val3 = 33;
- series_play_with_breaks(PLAY13, "407rx08", 0x901, 8, 2);
+ _roxyShould = 33;
+ series_play_with_breaks(PLAY13, "407rx08", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 33:
- _val3 = 34;
- series_play_with_breaks(PLAY14, "407rx09", 0x901, 8, 2);
+ _roxyShould = 34;
+ series_play_with_breaks(PLAY14, "407rx09", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 34:
@@ -443,31 +454,31 @@ void Room407::daemon() {
}
break;
- case 9:
- switch (_val5) {
+ case kCHANGE_VIPE_ANIMATION:
+ switch (_vipeShould) {
case 35:
_vp02.show("407vp02", 0x300);
_val4 = 1;
- _val3 = 23;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 23;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 36:
_vp02.terminate();
- _val5 = 37;
- series_play_with_breaks(PLAY16, "407vp02", 0x300, 9, 3);
+ _vipeShould = 37;
+ series_play_with_breaks(PLAY16, "407vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
break;
case 37:
- _val5 = 39;
- series_play_with_breaks(PLAY17, "407vp03", 0x300, 9, 3);
+ _vipeShould = 39;
+ series_play_with_breaks(PLAY17, "407vp03", 0x300, kCHANGE_VIPE_ANIMATION, 3);
break;
case 38:
_vp02.terminate();
- _val2 = 20;
- _val5 = 35;
- series_play_with_breaks(PLAY15, "407vp02", 0x300, 9, 3);
+ _drumzShould = 20;
+ _vipeShould = 35;
+ series_play_with_breaks(PLAY15, "407vp02", 0x300, kCHANGE_VIPE_ANIMATION, 3);
player_set_facing_at(412, 336);
break;
@@ -507,8 +518,8 @@ void Room407::daemon() {
_G(flags)[V299] = 0;
_G(flags)[V180] = 1;
terminateMachineAndNull(_rx);
- _val3 = 28;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 28;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 13:
@@ -519,8 +530,8 @@ void Room407::daemon() {
case 14:
_G(flags)[V298] = 0;
- _val2 = 21;
- _val5 = 40;
+ _drumzShould = 21;
+ _vipeShould = 40;
series_play_with_breaks(PLAY18, "407poof", 0x2ff, 4008, 2);
_G(flags)[V181] = 1;
break;
@@ -532,13 +543,13 @@ void Room407::daemon() {
if (_flag1) {
digi_stop(2);
- _val2 = 17;
- kernel_trigger_dispatch_now(7);
+ _drumzShould = 17;
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
}
_val4 = 3;
- _val3 = 20;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 20;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
case 2:
@@ -546,13 +557,13 @@ void Room407::daemon() {
if (_flag1) {
digi_stop(2);
- _val2 = 17;
- kernel_trigger_dispatch_now(7);
+ _drumzShould = 17;
+ kernel_trigger_dispatch_now(kCHANGE_DRUMZ_ANIMATION);
}
_val4 = 2;
- _val3 = 23;
- kernel_trigger_dispatch_now(8);
+ _roxyShould = 23;
+ kernel_trigger_dispatch_now(kCHANGE_ROXY_ANIMATION);
break;
default:
@@ -563,8 +574,8 @@ void Room407::daemon() {
case kSET_COMMANDS_ALLOWED:
if (!_G(flags)[V181] && _G(flags)[V171] == 4003) {
- _val5 = 38;
- kernel_timing_trigger(60, 9);
+ _vipeShould = 38;
+ kernel_timing_trigger(60, kCHANGE_VIPE_ANIMATION);
} else {
player_set_commands_allowed(true);
}
@@ -648,23 +659,23 @@ void Room407::conv88() {
if (who == 1) {
wilbur_speech(sound, 10001);
} else if (_flag1) {
- _val2 = 18;
+ _drumzShould = 18;
} else if (node == 1) {
switch (entry) {
case 0:
case 2:
case 4:
- _val2 = 13;
+ _drumzShould = 13;
break;
case 1:
- _val2 = 12;
+ _drumzShould = 12;
break;
case 3:
case 5:
- _val2 = 11;
+ _drumzShould = 11;
break;
case 6:
- _val2 = 10;
+ _drumzShould = 10;
conv_resume_curr();
break;
default:
@@ -694,8 +705,8 @@ void Room407::freeDz() {
void Room407::playConvSound() {
terminateMachineAndNull(_rx);
- _val3 = 25;
- digi_play(conv_sound_to_play(), 1, 255, 8);
+ _roxyShould = 25;
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ROXY_ANIMATION);
_rx = series_play("407rx04", 0x901, 4, -1, 6, -1);
}
diff --git a/engines/m4/burger/rooms/section4/room407.h b/engines/m4/burger/rooms/section4/room407.h
index db6923bad32..39259b32269 100644
--- a/engines/m4/burger/rooms/section4/room407.h
+++ b/engines/m4/burger/rooms/section4/room407.h
@@ -51,7 +51,7 @@ private:
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
static const seriesPlayBreak PLAY18[];
- static int32 _state1;
+ static int32 _speechNum;
Series _vp02;
Series _dz;
int _dzS1 = 0, _dzS2 = 0;
@@ -60,10 +60,10 @@ private:
Common::String _digiName;
bool _flag1 = false;
int _val1 = 0;
- int _val2 = 0;
- int _val3 = 0;
+ int _drumzShould = 0;
+ int _roxyShould = 0;
int _val4 = 0;
- int _val5 = 0;
+ int _vipeShould = 0;
int _digiTrigger = 0;
void loadSeries();
Commit: 0d531f63a4d0552b6f2619b2cea1bf1421578d56
https://github.com/scummvm/scummvm/commit/0d531f63a4d0552b6f2619b2cea1bf1421578d56
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Test 5 now completable
Changed paths:
engines/m4/burger/rooms/section4/room407.cpp
diff --git a/engines/m4/burger/rooms/section4/room407.cpp b/engines/m4/burger/rooms/section4/room407.cpp
index f1fcab79ac5..91fff762e78 100644
--- a/engines/m4/burger/rooms/section4/room407.cpp
+++ b/engines/m4/burger/rooms/section4/room407.cpp
@@ -367,6 +367,7 @@ void Room407::daemon() {
case kCHANGE_ROXY_ANIMATION:
switch (_roxyShould) {
case 22:
+ _val4 = 0;
_rx = series_show("407rx02", 0x901);
break;
@@ -386,6 +387,8 @@ void Room407::daemon() {
default:
break;
}
+
+ series_play_with_breaks(PLAY7, "407rx02", 0x901, kCHANGE_ROXY_ANIMATION, 2);
break;
case 24:
Commit: acbfbe7a0ce62eb11396d79dd647016cd26b1026
https://github.com/scummvm/scummvm/commit/acbfbe7a0ce62eb11396d79dd647016cd26b1026
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix talking to Flumix in room 702
Changed paths:
engines/m4/burger/rooms/section7/room702.cpp
engines/m4/burger/rooms/section7/room702.h
diff --git a/engines/m4/burger/rooms/section7/room702.cpp b/engines/m4/burger/rooms/section7/room702.cpp
index 8c8dde4083f..ddbaddb3044 100644
--- a/engines/m4/burger/rooms/section7/room702.cpp
+++ b/engines/m4/burger/rooms/section7/room702.cpp
@@ -27,6 +27,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_FLUMIX_ANIMATION = 5
+};
+
static const char *SAID[][4] = {
{ "DOOR", nullptr, "702W002", nullptr },
{ "FLUMIX", "702w001z", "702W002", "702W002" },
@@ -45,7 +49,7 @@ void Room702::init() {
pal_fade_set_start(0);
_flag1 = false;
_flag2 = false;
- _val1 = 1;
+ _flumixMode = 1;
_series1 = series_load("702FLT01");
_series2 = series_load("702FLX02");
@@ -72,7 +76,7 @@ void Room702::daemon() {
_G(wilbur_should) = 10;
digi_play_loop("700_001", 3, 50, -1, 700);
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_FLUMIX_ANIMATION);
kernel_trigger_dispatch_now(6);
_G(flags)[V298] = 1;
pal_fade_init(0, 255, 100, 30, -1);
@@ -86,32 +90,32 @@ void Room702::daemon() {
case 3:
_G(flumix_should) = 4;
pal_fade_init(_G(kernel).first_fade, 255, 0, 90, -1);
- kernel_timing_trigger(30, 5);
+ kernel_timing_trigger(30, kCHANGE_FLUMIX_ANIMATION);
break;
case 4:
_G(game).new_room = 706;
break;
- case 5:
- switch (_val1) {
+ case kCHANGE_FLUMIX_ANIMATION:
+ switch (_flumixMode) {
case 1:
switch (_G(flumix_should)) {
case 3:
- _val1 = 2;
+ _flumixMode = 2;
break;
case 4:
if (_flag1)
- terminateMachineAndNull(_series10);
+ terminateMachineAndNull(_flumix);
- _series10 = series_play("702FLX02", 0, 0, 4);
+ _flumix = series_play("702FLX02", 0, 0, 4);
break;
case 5:
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
- _series10 = series_play("702C1FL2", 0, 2, 5);
+ _flumix = series_play("702C1FL2", 0, 2, kCHANGE_FLUMIX_ANIMATION);
if (imath_ranged_rand(0, 1) == 1) {
digi_play("702F003B", 2, 100);
@@ -121,9 +125,9 @@ void Room702::daemon() {
break;
case 6:
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
- _series10 = series_play("702C1FL3", 0, 1, 5);
+ _flumix = series_play("702C1FL3", 0, 1, kCHANGE_FLUMIX_ANIMATION);
if (imath_ranged_rand(0, 1) == 1) {
digi_play("702F003B", 2, 100);
@@ -133,9 +137,9 @@ void Room702::daemon() {
break;
case 7:
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
- _series10 = series_play("702C1FL2", 0, 0, 5);
+ _flumix = series_play("702C1FL2", 0, 0, kCHANGE_FLUMIX_ANIMATION);
if (imath_ranged_rand(0, 1) == 1) {
digi_play("702F003B", 2, 100);
@@ -145,16 +149,16 @@ void Room702::daemon() {
break;
case 8:
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
- _series10 = series_play("702C1FL1", 0, 0, 5);
+ _flumix = series_play("702C1FL1", 0, 0, kCHANGE_FLUMIX_ANIMATION);
digi_play("702F003B", 2, 120);
break;
case 9:
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
_flag1 = true;
- _series10 = series_play("702FLT01", 0, 0, 5, 60);
+ _flumix = series_play("702FLT01", 0, 0, kCHANGE_FLUMIX_ANIMATION, 60);
break;
default:
@@ -166,25 +170,25 @@ void Room702::daemon() {
switch (_G(flumix_should)) {
case 3:
if (_flag1)
- terminateMachineAndNull(_series10);
+ terminateMachineAndNull(_flumix);
_flag1 = true;
_G(flumix_should) = 21;
- _series10 = series_play("702FLT01", 0, 4);
+ _flumix = series_play("702FLT01", 0, 4, -1, 6, -1);
digi_play(conv_sound_to_play(), 1, 255, 5);
break;
case 21:
- terminateMachineAndNull(_series10);
+ terminateMachineAndNull(_flumix);
_flag1 = false;
- _G(flumix_should) = getRoomVal();
+ _G(flumix_should) = getFlumixShould();
kernel_trigger_dispatch_now(5);
conv_resume_curr();
break;
default:
- _val1 = 1;
+ _flumixMode = 1;
kernel_trigger_dispatch_now(5);
break;
}
@@ -228,6 +232,10 @@ void Room702::daemon() {
break;
}
break;
+
+ default:
+ _G(kernel).continue_handling_trigger = true;
+ break;
}
}
@@ -264,7 +272,7 @@ void Room702::conv82() {
if (conv_sound_to_play()) {
if (who <= 0) {
_G(flumix_should) = 3;
- kernel_trigger_dispatch_now(5);
+ kernel_trigger_dispatch_now(kCHANGE_FLUMIX_ANIMATION);
} else if (who == 1) {
wilbur_speech(conv_sound_to_play(), 10001);
@@ -272,7 +280,7 @@ void Room702::conv82() {
}
}
-int Room702::getRoomVal() {
+int Room702::getFlumixShould() {
switch (imath_ranged_rand(1, 12)) {
case 1:
case 2:
diff --git a/engines/m4/burger/rooms/section7/room702.h b/engines/m4/burger/rooms/section7/room702.h
index c661eb2f9ff..2884b4633dc 100644
--- a/engines/m4/burger/rooms/section7/room702.h
+++ b/engines/m4/burger/rooms/section7/room702.h
@@ -36,15 +36,15 @@ private:
int _series4 = -1;
int _series5 = -1;
int _series6 = -1;
- machine *_series10 = nullptr;
+ machine *_flumix = nullptr;
machine *_series11 = nullptr;
bool _flag1 = false;
bool _flag2 = false;
- int _val1 = 0;
+ int _flumixMode = 0;
int _val2 = 0;
void conv82();
- int getRoomVal();
+ int getFlumixShould();
public:
Room702() : Room() {
Commit: 06554f0f80346c79137571ed7c2dd8d000546827
https://github.com/scummvm/scummvm/commit/06554f0f80346c79137571ed7c2dd8d000546827
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Endgame fixes
Changed paths:
engines/m4/burger/rooms/section7/room706.cpp
diff --git a/engines/m4/burger/rooms/section7/room706.cpp b/engines/m4/burger/rooms/section7/room706.cpp
index 9f64bc51cb5..26736928eec 100644
--- a/engines/m4/burger/rooms/section7/room706.cpp
+++ b/engines/m4/burger/rooms/section7/room706.cpp
@@ -395,7 +395,7 @@ void Room706::daemon() {
digi_unload_stream_breaks(SERIES8);
digi_preload_stream_breaks(SERIES9);
digi_preload("707D_007");
- series_stream_with_breaks(SERIES9, "70D", 6, 1, 28);
+ series_stream_with_breaks(SERIES9, "707D", 6, 1, 28);
pal_fade_init(0, 255, 100, 30, -1);
break;
@@ -411,7 +411,7 @@ void Room706::daemon() {
case 30:
digi_unload_stream_breaks(SERIES9);
- digi_preload("909B_005");
+ digi_preload("709B_005");
digi_preload_stream_breaks(SERIES10);
series_stream_with_breaks(SERIES10, "709B", 6, 1, 31);
pal_fade_init(0, 255, 100, 31, -1);
Commit: e9bb9c543c5732a19eb2102887b960f7975e531e
https://github.com/scummvm/scummvm/commit/e9bb9c543c5732a19eb2102887b960f7975e531e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added savegame version number
Changed paths:
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 2db90f79378..5201f0d4653 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -41,6 +41,8 @@
namespace M4 {
+#define SAVEGAME_VERSION 1
+
M4Engine *g_engine;
M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc) : Engine(syst),
@@ -151,6 +153,7 @@ Common::Error M4Engine::loadGameStateDoIt(int slot) {
// We're now at data section, handle it
Common::Serializer s(save, nullptr);
+ s.setVersion(1);
Common::Error result = syncGame(s);
delete save;
@@ -184,6 +187,23 @@ Common::InSaveFile *M4Engine::getOriginalSave(int slot) const {
return nullptr;
}
+Common::Error M4Engine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
+ stream->writeByte(SAVEGAME_VERSION);
+
+ Common::Serializer s(nullptr, stream);
+ return syncGame(s);
+}
+
+Common::Error M4Engine::loadGameStream(Common::SeekableReadStream *stream) {
+ byte version = stream->readByte();
+ if (version > SAVEGAME_VERSION)
+ error("Tried to load unsupported savegame version");
+
+ Common::Serializer s(stream, nullptr);
+ s.setVersion(version);
+ return syncGame(s);
+}
+
Common::Error M4Engine::syncGame(Common::Serializer &s) {
if (s.isSaving())
_G(kernel).pause = false;
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index a1e5cf55bf2..dcd20c6504e 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -119,14 +119,9 @@ public:
virtual void syncFlags(Common::Serializer &s) = 0;
- 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 saveGameStream(Common::WriteStream* stream, bool isAutosave = false) override;
+
+ Common::Error loadGameStream(Common::SeekableReadStream* stream) override;
/**
* Returns true if an autosave exists
Commit: 42f248388d8b195f36e3ba12b593afd3c903569f
https://github.com/scummvm/scummvm/commit/42f248388d8b195f36e3ba12b593afd3c903569f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixing hotkeys matching, in progress version dialog
Changed paths:
engines/m4/burger/hotkeys.cpp
engines/m4/burger/hotkeys.h
engines/m4/gui/gui_dialog.h
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
engines/m4/platform/events.cpp
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 5f5400630e6..247cd9261c0 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -24,13 +24,23 @@
#include "m4/burger/gui/game_menu.h"
#include "m4/gui/gui_sys.h"
#include "m4/adv_r/other.h"
+#include "m4/platform/keys.h"
namespace M4 {
namespace Burger {
+Dialog *Hotkeys::_versionDialog;
+
+Hotkeys::Hotkeys() {
+ _versionDialog = nullptr;
+}
+
void Hotkeys::add_hot_keys() {
M4::Hotkeys::add_hot_keys();
+ AddSystemHotkey(KEY_ALT_V, show_version);
+ AddSystemHotkey(KEY_CTRL_V, show_version);
+
AddSystemHotkey('t', t_cb);
AddSystemHotkey('u', u_cb);
AddSystemHotkey('l', l_cb);
@@ -134,5 +144,30 @@ void Hotkeys::a_cb(void *, void *) {
g_vars->_interface.a_cb();
}
+void Hotkeys::show_version(void *a, void *b) {
+ if (!_versionDialog) {
+ gr_font_set(_G(font_tiny));
+ _versionDialog = DialogCreateAbsolute(190, 35, 510, 105, 242);
+ Dialog_Add_Button(_versionDialog, 115, 52, " OK ", version_ok_button, 1);
+ Dialog_Add_Message(_versionDialog, 10, 5, "Orion Burger", 1);
+ Dialog_Add_Message(_versionDialog, 10, 15,
+ Common::String::format("Game Version %s - %s ",
+ "Nudibranchs", "May 7, 1996").c_str(), 2);
+ Dialog_Add_Message(_versionDialog, 10, 15,
+ Common::String::format("M4 Library Version %s - %s ",
+ "v1.400 OB", "January 21, 1996").c_str(), 3);
+ Dialog_Add_Message(_versionDialog, 10, 35,
+ "Copyright (c) 1996 by Sanctuary Woods Multimedia Corporation", 4);
+
+ Dialog_Configure(_versionDialog, 1, 1, 1);
+ vmng_screen_show(_versionDialog);
+ }
+}
+
+void Hotkeys::version_ok_button(void *a, void *b) {
+ DialogDestroy(_versionDialog);
+ _versionDialog = nullptr;
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index f016ba66615..daee9ab0c74 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -30,18 +30,30 @@ namespace M4 {
namespace Burger {
struct Hotkeys : public M4::Hotkeys {
+private:
+ static Dialog *_versionDialog;
+
+private:
static void t_cb(void *, void *);
static void u_cb(void *, void *);
static void l_cb(void *, void *);
static void a_cb(void *, void *);
/**
- * Called when the Escape key is pressed
+ * Show version dialog
*/
- static void escape_key_pressed(void *, void *);
+ static void show_version(void *a, void *b);
+ static void version_ok_button(void *a, void *b);
+public:
+ Hotkeys();
virtual ~Hotkeys() {}
+ /**
+ * Called when the Escape key is pressed
+ */
+ static void escape_key_pressed(void *, void *);
+
void add_hot_keys() override;
void toggle_through_cursors() override;
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index bec5acdfb29..3b2d667d59e 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -75,7 +75,7 @@ extern void gui_dialog_shutdown();
extern Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrnFlags);
extern Dialog *DialogCreate(M4Rect *r, uint32 scrnFlags);
extern void vmng_Dialog_Destroy(Dialog *d); //used only by viewmgr.cpp **DO NOT USE
-extern void DialogDestroy(Dialog *d, M4Rect *r);
+extern void DialogDestroy(Dialog *d, M4Rect *r = nullptr);
extern void Dialog_Refresh(Dialog *d);
extern void Dialog_Refresh_All();
extern void Dialog_Resize(Dialog *d, int32 newW, int32 newH);
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 58ce76e9201..d42b7105b6f 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -21,6 +21,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
+#include "m4/gui/gui_vmng_core.h"
#include "m4/platform/keys.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/vars.h"
@@ -109,8 +110,6 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_F2, cb_F2);
AddSystemHotkey(KEY_F3, cb_F3);
- AddSystemHotkey(KEY_ALT_V, show_version);
- AddSystemHotkey(KEY_CTRL_V, show_version);
AddSystemHotkey(KEY_ALT_X, exit_program);
AddSystemHotkey(KEY_CTRL_X, exit_program);
AddSystemHotkey(KEY_ALT_Q, exit_program);
@@ -176,14 +175,6 @@ void Hotkeys::cb_F3(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::show_version(void *a, void *b) {
- warning("TODO: hotkey");
-}
-
-void Hotkeys::version_ok_button(void *a, void *b) {
- warning("TODO: hotkey");
-}
-
void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
M4::adv_hyperwalk_to_final_destination(a, b);
}
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 95d61927cae..f0f7d2cceba 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -24,6 +24,7 @@
#define M4_GUI_HOTKEYS_H
#include "m4/m4_types.h"
+#include "m4/gui/gui_dialog.h"
namespace M4 {
@@ -35,8 +36,6 @@ public:
static void exit_program(void *, void *);
static void cb_F2(void *, void *);
static void cb_F3(void *, void *);
- static void show_version(void *a, void *b);
- static void version_ok_button(void *a, void *b);
static void adv_hyperwalk_to_final_destination(void *a, void *b);
static void capture_wrap(void *, void *);
static void debug_memory_next_column(void *, void *);
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index 727c3c8f7e8..95215b48728 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -219,8 +219,7 @@ bool Events::util_kbd_check(int32 *parm1) {
return false;
Common::KeyState ks = _pendingKeys.pop();
- *parm1 = ks.keycode | (ks.flags << 16);
-
+ *parm1 = ks.keycode | ((ks.flags & 0xf) << 16);
return true;
}
Commit: 433d757f3bd7e0536892d6be7213ff8c592a0e2a
https://github.com/scummvm/scummvm/commit/433d757f3bd7e0536892d6be7213ff8c592a0e2a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix cutscene of Burl arriving at diner
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
engines/m4/burger/rooms/section1/room142.h
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 48b686b273b..52fe7405d7c 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -253,9 +253,9 @@ void Room142::daemon() {
terminateMachineAndNull(_series1);
if (_G(player_info.y) < 285) {
- Section1::updateWalker(adjustY(_G(player_info).y), 285, 9, 2);
+ Section1::updateWalker(getRoadEdgeX(_G(player_info).y), 285, 9, 2);
} else {
- Section1::updateWalker(adjustY(_G(player_info).y), _G(player_info).y, 9, 2);
+ Section1::updateWalker(getRoadEdgeX(_G(player_info).y), _G(player_info).y, 9, 2);
}
break;
@@ -513,12 +513,14 @@ void Room142::daemon() {
digi_preload("100_013");
digi_play("100_013", 3, 155);
Section1::updateDisablePlayer();
- preloadAssets2();
+ preloadAssets2();
- if (adjustY(_G(player_info).y) > _G(player_info).x ||
+ if (getRoadEdgeX(_G(player_info).y) > _G(player_info).x ||
(_G(player_info).x < 298 && _G(player_info).y < 285)) {
+ // Get off the road
kernel_timing_trigger(240, 1);
} else {
+ // Not on road, so show truck arriving
kernel_timing_trigger(240, 3);
}
} else {
diff --git a/engines/m4/burger/rooms/section1/room142.h b/engines/m4/burger/rooms/section1/room142.h
index 3de773cd024..230c17b8a6d 100644
--- a/engines/m4/burger/rooms/section1/room142.h
+++ b/engines/m4/burger/rooms/section1/room142.h
@@ -69,8 +69,14 @@ private:
void preloadAssets2();
void triggerParser();
void play015();
- int adjustY(int val) const {
- return (int)((double)val * -1.428571428571429);
+
+ /**
+ * Gets the X position for the edge of the road, given a Y pos.
+ * Used for the cutscene where Burl arrives, to determine whether
+ * he honks the horn at Wilbur to get off the road
+ */
+ int getRoadEdgeX(int y) const {
+ return (int)((double)(-y + 126) * -1.428571428571429);
}
public:
Commit: e47891b0d75cacd579168965a9c51dc8101335f2
https://github.com/scummvm/scummvm/commit/e47891b0d75cacd579168965a9c51dc8101335f2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix type of returned current color
Changed paths:
engines/m4/graphics/gr_buff.cpp
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 52e1a739c61..74e9e7ff85a 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -204,7 +204,7 @@ bool gr_buffer_rect_copy(Buffer *from, Buffer *to, int32 x, int32 y, int32 w, in
int32 gr_buffer_rect_fill(Buffer *target, int32 x1, int32 y1, int32 w, int32 h) {
int32 i;
uint8 *start;
- char color = gr_color_get_current();
+ byte color = gr_color_get_current();
// if no data, bad.
if (!target || !target->data)
Commit: a0b7a5d61dc292349726e66be5890d65e7d6cfdf
https://github.com/scummvm/scummvm/commit/a0b7a5d61dc292349726e66be5890d65e7d6cfdf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix display of version dialog
Changed paths:
engines/m4/burger/hotkeys.cpp
engines/m4/graphics/gr_pal.cpp
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 247cd9261c0..a920a64db05 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -153,7 +153,7 @@ void Hotkeys::show_version(void *a, void *b) {
Dialog_Add_Message(_versionDialog, 10, 15,
Common::String::format("Game Version %s - %s ",
"Nudibranchs", "May 7, 1996").c_str(), 2);
- Dialog_Add_Message(_versionDialog, 10, 15,
+ Dialog_Add_Message(_versionDialog, 10, 25,
Common::String::format("M4 Library Version %s - %s ",
"v1.400 OB", "January 21, 1996").c_str(), 3);
Dialog_Add_Message(_versionDialog, 10, 35,
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index ef9af255b6f..923d8d93cf3 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -28,7 +28,7 @@
namespace M4 {
-static const uint8 EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+byte EGAcolors[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
uint8 gr_pal_get_ega_color(uint8 myColor) {
return EGAcolors[myColor];
@@ -145,7 +145,6 @@ void gr_pal_interface(RGB8 *fixpal) {
}
void gr_pal_reset_ega_colors(RGB8 *pal) {
-#ifdef TODO
EGAcolors[0] = gr_pal_find_best_match(pal, 0, 0, 0); //__BLACK
EGAcolors[1] = gr_pal_find_best_match(pal, 0, 0, 255); //__BLUE
EGAcolors[2] = gr_pal_find_best_match(pal, 0, 255, 0); //__GREEN
@@ -162,11 +161,6 @@ void gr_pal_reset_ega_colors(RGB8 *pal) {
EGAcolors[13] = gr_pal_find_best_match(pal, 84, 0, 0); //__PINK
EGAcolors[14] = gr_pal_find_best_match(pal, 0, 84, 84); //__YELLOW
EGAcolors[15] = gr_pal_find_best_match(pal, 255, 255, 255); //__WHITE
-#else
- // TODO: See if this is really needed. It's better if we can keep the
- // array as constexpr, since arrays use it's constexpr accessor method
- warning("TODO: gr_pal_reset_ega_colors");
-#endif
}
void gr_backup_palette() {
Commit: 587986be7d56e35d6c85ba2db1363d85c78fcdca
https://github.com/scummvm/scummvm/commit/587986be7d56e35d6c85ba2db1363d85c78fcdca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add debug player movement hotkeys
Changed paths:
engines/m4/burger/gui/game_menu.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
engines/m4/platform/events.cpp
engines/m4/platform/events.h
engines/m4/riddle/rooms/section9/room901.cpp
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 7467ab1da59..9bf74ca9921 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -3314,8 +3314,8 @@ void cb_SaveLoad_Load(void *, void *theMenu) {
// See if we need to reset the ESC, F2, and F3 hotkeys
if (_GM(gameMenuFromMain)) {
AddSystemHotkey(KEY_ESCAPE, Burger::Hotkeys::escape_key_pressed);
- AddSystemHotkey(KEY_F2, M4::Hotkeys::cb_F2);
- AddSystemHotkey(KEY_F3, M4::Hotkeys::cb_F3);
+ AddSystemHotkey(KEY_F2, M4::Hotkeys::saveGame);
+ AddSystemHotkey(KEY_F3, M4::Hotkeys::loadGame);
}
// Start the restore process
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index d42b7105b6f..3e207932b8e 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -29,7 +29,7 @@
namespace M4 {
void Hotkeys::restore_hot_keys() {
- AddSystemHotkey(KEY_HOME, capture_wrap);
+ AddSystemHotkey(KEY_HOME, saveScreenshot);
AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
AddSystemHotkey(KEY_PAGE_DOWN, debug_memory_prev_column);
AddSystemHotkey(KEY_END, debug_memory_last_column);
@@ -107,8 +107,8 @@ void Hotkeys::disable_hot_keys() {
}
void Hotkeys::add_hot_keys() {
- AddSystemHotkey(KEY_F2, cb_F2);
- AddSystemHotkey(KEY_F3, cb_F3);
+ AddSystemHotkey(KEY_F2, saveGame);
+ AddSystemHotkey(KEY_F3, loadGame);
AddSystemHotkey(KEY_ALT_X, exit_program);
AddSystemHotkey(KEY_CTRL_X, exit_program);
@@ -117,6 +117,8 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_SPACE, adv_hyperwalk_to_final_destination);
AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
+ restore_hot_keys();
+
if (_G(cheating_enabled)) {
adv_enable_system_hot_keys();
}
@@ -125,7 +127,7 @@ void Hotkeys::add_hot_keys() {
void Hotkeys::adv_enable_system_hot_keys() {
term_message("System Cheats On");
- AddSystemHotkey(KEY_HOME, capture_wrap);
+ AddSystemHotkey(KEY_HOME, saveScreenshot);
AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
AddSystemHotkey(KEY_PAGE_DOWN, debug_memory_prev_column);
AddSystemHotkey(KEY_END, debug_memory_last_column);
@@ -167,11 +169,11 @@ void Hotkeys::exit_program(void *, void *) {
_G(kernel).going = false;
}
-void Hotkeys::cb_F2(void *, void *) {
+void Hotkeys::saveGame(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::cb_F3(void *, void *) {
+void Hotkeys::loadGame(void *, void *) {
warning("TODO: hotkey");
}
@@ -183,8 +185,8 @@ void Hotkeys::f_io_report(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::capture_wrap(void *, void *) {
- warning("TODO: hotkey");
+void Hotkeys::saveScreenshot(void *, void *) {
+ g_system->saveScreenshot();
}
void Hotkeys::debug_memory_next_column(void *, void *) {
@@ -199,34 +201,43 @@ void Hotkeys::debug_memory_last_column(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::player_step_up(void *, void *) {}
+void Hotkeys::player_step_up(void *, void *) {
+ player_step(0, -1);
+}
void Hotkeys::player_step_down(void *, void *) {
- warning("TODO: hotkey");
+ player_step(0, 1);
}
void Hotkeys::player_step_left(void *, void *) {
- warning("TODO: hotkey");
+ player_step(-1, 0);
}
void Hotkeys::player_step_right(void *, void *) {
- warning("TODO: hotkey");
+ player_step(1, 0);
}
void Hotkeys::player_jump_up(void *, void *) {
- warning("TODO: hotkey");
+ player_step(0, -50);
}
void Hotkeys::player_jump_down(void *, void *) {
- warning("TODO: hotkey");
+ player_step(0, 50);
}
void Hotkeys::player_jump_left(void *, void *) {
- warning("TODO: hotkey");
+ player_step(-50, 0);
}
void Hotkeys::player_jump_right(void *, void *) {
- warning("TODO: hotkey");
+ player_step(50, 0);
+}
+
+void Hotkeys::player_step(int xDelta, int yDelta) {
+ player_update_info();
+ _G(player_info).x += xDelta;
+ _G(player_info).y += yDelta;
+ ws_demand_location(_G(player_info).x, _G(player_info).y);
}
void Hotkeys::term_next_mode(void *, void *) {
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index f0f7d2cceba..cc85dec4af0 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -29,15 +29,10 @@
namespace M4 {
struct Hotkeys {
-protected:
- virtual void adv_enable_system_hot_keys();
-
-public:
+private:
static void exit_program(void *, void *);
- static void cb_F2(void *, void *);
- static void cb_F3(void *, void *);
static void adv_hyperwalk_to_final_destination(void *a, void *b);
- static void capture_wrap(void *, void *);
+ static void saveScreenshot(void *, void *);
static void debug_memory_next_column(void *, void *);
static void debug_memory_prev_column(void *, void *);
static void debug_memory_last_column(void *, void *);
@@ -46,11 +41,11 @@ public:
static void player_step_down(void *, void *);
static void player_step_left(void *, void *);
static void player_step_right(void *, void *);
-
static void player_jump_up(void *, void *);
static void player_jump_down(void *, void *);
static void player_jump_left(void *, void *);
static void player_jump_right(void *, void *);
+ static void player_step(int xDelta, int yDelta);
static void term_next_mode(void *, void *);
@@ -74,6 +69,9 @@ public:
static void paint_walk_codes(void *, void *);
static void pal_override(void *, void *);
+protected:
+ virtual void adv_enable_system_hot_keys();
+
public:
virtual ~Hotkeys() {}
@@ -81,6 +79,9 @@ public:
void disable_hot_keys();
void restore_hot_keys();
+ static void saveGame(void *, void *);
+ static void loadGame(void *, void *);
+
virtual void toggle_through_cursors() = 0;
};
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index 95215b48728..b3d721784a8 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -219,6 +219,9 @@ bool Events::util_kbd_check(int32 *parm1) {
return false;
Common::KeyState ks = _pendingKeys.pop();
+ if (is_mod_key(ks))
+ return false;
+
*parm1 = ks.keycode | ((ks.flags & 0xf) << 16);
return true;
}
diff --git a/engines/m4/platform/events.h b/engines/m4/platform/events.h
index 80a08cfc635..f784957d28d 100644
--- a/engines/m4/platform/events.h
+++ b/engines/m4/platform/events.h
@@ -92,6 +92,16 @@ private:
*/
void handleKeyboardEvent(const Common::Event &ev);
+ /**
+ * Tells if key event refers to one of the mod-keys
+ */
+ inline bool is_mod_key(const Common::KeyState &ks) {
+ return ks.keycode == Common::KEYCODE_LCTRL || ks.keycode == Common::KEYCODE_RCTRL ||
+ ks.keycode == Common::KEYCODE_LALT || ks.keycode == Common::KEYCODE_RALT ||
+ ks.keycode == Common::KEYCODE_LSHIFT || ks.keycode == Common::KEYCODE_RSHIFT ||
+ ks.keycode == Common::KEYCODE_MODE;
+ }
+
public:
Events();
~Events();
diff --git a/engines/m4/riddle/rooms/section9/room901.cpp b/engines/m4/riddle/rooms/section9/room901.cpp
index 0f9438d2dbf..c6060a5099b 100644
--- a/engines/m4/riddle/rooms/section9/room901.cpp
+++ b/engines/m4/riddle/rooms/section9/room901.cpp
@@ -82,8 +82,8 @@ void Room901::daemon() {
case 7:
case 56:
AddSystemHotkey(KEY_ESCAPE, Hotkeys::escape_key_pressed);
- AddSystemHotkey(KEY_F2, Hotkeys::cb_F2);
- AddSystemHotkey(KEY_F3, Hotkeys::cb_F3);
+ AddSystemHotkey(KEY_F2, Hotkeys::saveGame);
+ AddSystemHotkey(KEY_F3, Hotkeys::loadGame);
_G(game).setRoom(494);
break;
Commit: aea678d19dd81c9d39af00647555d58db21bf01f
https://github.com/scummvm/scummvm/commit/aea678d19dd81c9d39af00647555d58db21bf01f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add camera shift debug hotkeys
Changed paths:
engines/m4/gui/hotkeys.cpp
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 3e207932b8e..747a83efb3d 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -21,7 +21,7 @@
#include "m4/gui/hotkeys.h"
#include "m4/gui/gui_sys.h"
-#include "m4/gui/gui_vmng_core.h"
+#include "m4/gui/gui_vmng.h"
#include "m4/platform/keys.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/vars.h"
@@ -245,19 +245,23 @@ void Hotkeys::term_next_mode(void *, void *) {
}
void Hotkeys::camera_step_left(void *, void *) {
- warning("TODO: hotkey");
+ ScreenContext *sc = vmng_screen_find(_G(gameDrawBuff), nullptr);
+ MoveScreenDelta(sc, 10, 0);
}
void Hotkeys::camera_step_right(void *, void *) {
- warning("TODO: hotkey");
+ ScreenContext *sc = vmng_screen_find(_G(gameDrawBuff), nullptr);
+ MoveScreenDelta(sc, -10, 0);
}
void Hotkeys::camera_jump_left(void *, void *) {
- warning("TODO: hotkey");
+ ScreenContext *sc = vmng_screen_find(_G(gameDrawBuff), nullptr);
+ MoveScreenDelta(sc, 100, 0);
}
void Hotkeys::camera_jump_right(void *, void *) {
- warning("TODO: hotkey");
+ ScreenContext *sc = vmng_screen_find(_G(gameDrawBuff), nullptr);
+ MoveScreenDelta(sc, -100, 0);
}
void Hotkeys::toggle_inv_visible(void *, void *) {
Commit: 6ef405e708ee59b2331654ff89c7d618425ece0b
https://github.com/scummvm/scummvm/commit/6ef405e708ee59b2331654ff89c7d618425ece0b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Only encode Ctrl and Alt in key events
Changed paths:
engines/m4/platform/events.cpp
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index b3d721784a8..d167e5611f7 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -222,7 +222,7 @@ bool Events::util_kbd_check(int32 *parm1) {
if (is_mod_key(ks))
return false;
- *parm1 = ks.keycode | ((ks.flags & 0xf) << 16);
+ *parm1 = ks.keycode | ((ks.flags & (Common::KBD_CTRL | Common::KBD_ALT)) << 16);
return true;
}
Commit: 2ce38209de78884ab7311664bc49ce867aa2a681
https://github.com/scummvm/scummvm/commit/2ce38209de78884ab7311664bc49ce867aa2a681
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added original debug teleport dialog
Changed paths:
engines/m4/burger/hotkeys.cpp
engines/m4/console.cpp
engines/m4/console.h
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_dialog.h
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index a920a64db05..2ec83a70673 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -31,7 +31,7 @@ namespace Burger {
Dialog *Hotkeys::_versionDialog;
-Hotkeys::Hotkeys() {
+Hotkeys::Hotkeys() : M4::Hotkeys() {
_versionDialog = nullptr;
}
@@ -148,15 +148,15 @@ void Hotkeys::show_version(void *a, void *b) {
if (!_versionDialog) {
gr_font_set(_G(font_tiny));
_versionDialog = DialogCreateAbsolute(190, 35, 510, 105, 242);
- Dialog_Add_Button(_versionDialog, 115, 52, " OK ", version_ok_button, 1);
- Dialog_Add_Message(_versionDialog, 10, 5, "Orion Burger", 1);
- Dialog_Add_Message(_versionDialog, 10, 15,
+ _versionDialog->addButton(115, 52, " OK ", version_ok_button, 1);
+ _versionDialog->addMessage(10, 5, "Orion Burger", 1);
+ _versionDialog->addMessage(10, 15,
Common::String::format("Game Version %s - %s ",
"Nudibranchs", "May 7, 1996").c_str(), 2);
- Dialog_Add_Message(_versionDialog, 10, 25,
+ _versionDialog->addMessage(10, 25,
Common::String::format("M4 Library Version %s - %s ",
"v1.400 OB", "January 21, 1996").c_str(), 3);
- Dialog_Add_Message(_versionDialog, 10, 35,
+ _versionDialog->addMessage(10, 35,
"Copyright (c) 1996 by Sanctuary Woods Multimedia Corporation", 4);
Dialog_Configure(_versionDialog, 1, 1, 1);
@@ -165,7 +165,7 @@ void Hotkeys::show_version(void *a, void *b) {
}
void Hotkeys::version_ok_button(void *a, void *b) {
- DialogDestroy(_versionDialog);
+ _versionDialog->destroy();
_versionDialog = nullptr;
}
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index b0d37d9d8f4..8d0b9f9c575 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -26,50 +26,45 @@
namespace M4 {
Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
- registerCmd("room", WRAP_METHOD(Console, Cmd_room));
- registerCmd("flag", WRAP_METHOD(Console, Cmd_flag));
- registerCmd("item", WRAP_METHOD(Console, Cmd_item));
- registerCmd("hyperwalk", WRAP_METHOD(Console, Cmd_hyperwalk));
+ registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
+ registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
+ registerCmd("item", WRAP_METHOD(Console, cmdItem));
+ registerCmd("hyperwalk", WRAP_METHOD(Console, cmdHyperwalk));
}
Console::~Console() {
}
-bool Console::Cmd_test(int argc, const char **argv) {
- debugPrintf("Test\n");
- return true;
-}
-
-bool Console::Cmd_room(int argc, const char **argv) {
+bool Console::cmdTeleport(int argc, const char **argv) {
if (argc == 2) {
_G(game).setRoom(atol(argv[1]));
+ _G(kernel).teleported_in = true;
return false;
} else {
- debugPrintf("room <room number>]\n");
+ debugPrintf("teleport <room number>]\n");
return true;
}
}
-bool Console::Cmd_flag(int argc, const char **argv) {
+bool Console::cmdGlobal(int argc, const char **argv) {
if (!Burger::g_vars) {
debugPrintf("Not Orion Burger\n");
} else if (argc == 2) {
int flagNum = atol(argv[1]);
- debugPrintf("Flag %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
+ debugPrintf("Global %d = %d\n", flagNum, Burger::g_vars->_flags[flagNum]);
} else if (argc == 3) {
int flagNum = atol(argv[1]);
int flagVal = atol(argv[2]);
Burger::g_vars->_flags[flagNum] = flagVal;
- debugPrintf("Flag set\n");
+ debugPrintf("Global set\n");
} else {
- debugPrintf("Flag <num> [<value>]\n");
+ debugPrintf("Global <num> [<value>]\n");
}
return true;
}
-bool Console::Cmd_item(int argc, const char **argv) {
+bool Console::cmdItem(int argc, const char **argv) {
if (argc == 2) {
inv_give_to_player(argv[1]);
return false;
@@ -79,7 +74,7 @@ bool Console::Cmd_item(int argc, const char **argv) {
}
}
-bool Console::Cmd_hyperwalk(int argc, const char **argv) {
+bool Console::cmdHyperwalk(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("hyperwalk [on | off]\n");
} else {
diff --git a/engines/m4/console.h b/engines/m4/console.h
index ab6351b2e22..b39b9d21343 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -29,11 +29,11 @@ namespace M4 {
class Console : public GUI::Debugger {
private:
- bool Cmd_test(int argc, const char **argv);
- bool Cmd_room(int argc, const char **argv);
- bool Cmd_flag(int argc, const char **argv);
- bool Cmd_item(int argc, const char **argv);
- bool Cmd_hyperwalk(int argc, const char **argv);
+ bool cmdTest(int argc, const char **argv);
+ bool cmdTeleport(int argc, const char **argv);
+ bool cmdGlobal(int argc, const char **argv);
+ bool cmdItem(int argc, const char **argv);
+ bool cmdHyperwalk(int argc, const char **argv);
public:
Console();
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 6ae505544f6..9350b4ad289 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -43,6 +43,79 @@ static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY);
static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen);
+void Dialog::destroy() {
+ DialogDestroy(this);
+}
+
+void Dialog::refresh() {
+ Dialog_Refresh(this);
+}
+
+void Dialog::resize(int32 newW, int32 newH) {
+ Dialog_Resize(this, newW, newH);
+}
+
+void Dialog::configure(int32 defaultTag, int32 returnTag, int32 cancelTag) {
+ Dialog_Configure(this, defaultTag, returnTag, cancelTag);
+}
+
+void Dialog::setDefault(int32 tag) {
+ Dialog_SetDefault(this, tag);
+}
+
+bool Dialog::setPressed(int32 tag) {
+ return Dialog_SetPressed(this, tag);
+}
+
+void Dialog::show() {
+ vmng_screen_show(this);
+}
+
+bool Dialog::addMessage(int32 x, int32 y, const char *prompt, int32 tag) {
+ return Dialog_Add_Message(this, x, y, prompt, tag);
+}
+
+bool Dialog::addPicture(int32 x, int32 y, Buffer *myBuff, int32 tag) {
+ return Dialog_Add_Picture(this, x, y, myBuff, tag);
+}
+
+bool Dialog::addButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
+ return Dialog_Add_Button(this, x, y, prompt, cb, tag);
+}
+
+bool Dialog::addRepeatButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
+ return Dialog_Add_RepeatButton(this, x, y, prompt, cb, tag);
+}
+
+bool Dialog::addList(int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag) {
+ return Dialog_Add_List(this, x1, y1, x2, y2, cb, tag);
+}
+
+bool Dialog::addTextField(int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
+ return Dialog_Add_TextField(this, x1, y1, x2, defaultPrompt, cb, tag, fieldLength);
+}
+
+void Dialog::registerTextField() {
+ Dialog_RegisterTextField(this);
+}
+
+Item *Dialog::getItem(int32 tag) {
+ return Dialog_Get_Item(this, tag);
+}
+
+void Dialog::changeItemPrompt(const char *newPrompt, Item *myItem, int32 tag) {
+ Dialog_Change_Item_Prompt(this, newPrompt, myItem, tag);
+}
+
+bool Dialog::removeItem(Item *myItem, int32 tag) {
+ return Dialog_Remove_Item(this, myItem, tag);
+}
+
+void Dialog::refreshItem(Item *myItem, int32 tag) {
+ Dialog_Refresh_Item(this, myItem, tag);
+}
+
+
bool gui_dialog_init() {
_GD(listboxSearchStr)[0] = '\0';
return true;
@@ -227,7 +300,7 @@ bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2,
}
bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2,
- char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
+ const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
Item *myItem;
if ((myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, 0, defaultPrompt, tag, TEXTFIELD, cb, fieldLength)) == nullptr) {
return false;
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index 3b2d667d59e..25ea4fc2982 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -42,6 +42,33 @@ struct Dialog {
Item *listBottom;
Item *cancel_item, *return_item, *default_item;
GrBuff *dlgBuffer;
+
+ // General support methods
+ void destroy();
+ void refresh();
+ void resize(int32 newW, int32 newH);
+ void configure(int32 defaultTag, int32 returnTag, int32 cancelTag);
+ void setDefault(int32 tag);
+ bool setPressed(int32 tag);
+ void show();
+
+ // Add methods
+ bool addMessage(int32 x, int32 y, const char *prompt, int32 tag);
+ bool addPicture(int32 x, int32 y, Buffer *myBuff, int32 tag);
+ bool addButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
+ bool addRepeatButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
+ bool addList(int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
+
+ // Item Fields
+ Item *getItem(int32 tag);
+ void changeItemPrompt(const char *newPrompt, Item *myItem, int32 tag);
+ bool removeItem(Item *myItem, int32 tag);
+ void refreshItem(Item *myItem, int32 tag);
+
+ // Text Fields
+ bool addTextField(int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
+ void registerTextField();
+
};
struct TextScrn {
@@ -97,8 +124,8 @@ extern bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *pro
//LIST TYPE SUPPORT
extern bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
extern bool Dialog_Add_DirList(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag, char *myDir, char *myTypes);
-extern bool Dialog_Change_DirList(Dialog *d, Item *myItem, char *myDir, char *myTypes);
-extern bool Dialog_Add_List_Item(Dialog *d, Item *myItem, char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh);
+extern bool Dialog_Change_DirList(Dialog *d, Item *myItem, const char *myDir, const char *myTypes);
+extern bool Dialog_Add_List_Item(Dialog *d, Item *myItem, const char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh);
extern bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag);
extern bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh);
extern void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag);
@@ -112,7 +139,7 @@ extern void Dialog_GetPrevListItem(Dialog *d);
extern void Dialog_GetNextListItem(Dialog *d);
//TEXTFIELD TYPE SUPPORT
-extern bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
+extern bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
extern void Dialog_RegisterTextField(Dialog *d);
//HOTKEY SUPPORT
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 747a83efb3d..fbc97c186cc 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -28,6 +28,12 @@
namespace M4 {
+Dialog *Hotkeys::_teleportDialog;
+
+Hotkeys::Hotkeys() {
+ _teleportDialog = nullptr;
+}
+
void Hotkeys::restore_hot_keys() {
AddSystemHotkey(KEY_HOME, saveScreenshot);
AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
@@ -305,7 +311,32 @@ void Hotkeys::scale_editor_toggle(void *, void *) {
}
void Hotkeys::teleport(void *, void *) {
- warning("TODO: hotkey");
+ if (!_teleportDialog) {
+ gr_font_set(_G(font_tiny));
+ _teleportDialog = DialogCreateAbsolute(260, 150, 385, 200, 61);
+ _teleportDialog->addButton(60, 30, " Teleport ", teleportOk, 1);
+ _teleportDialog->addButton(10, 30, " Cancel ", teleportCancel, 2);
+ _teleportDialog->addTextField(100, 10, gr_font_string_width("MMMM") + 100,
+ "---", nullptr, 3, 3);
+ _teleportDialog->addMessage(10, 12, "Teleport where?", 4);
+ _teleportDialog->configure(3, 1, 2);
+ _teleportDialog->show();
+ pal_override(nullptr, nullptr);
+ }
+}
+
+void Hotkeys::teleportOk(void *, void *) {
+ Item *textField = _teleportDialog->getItem(3);
+ _G(game).setRoom(atoi(textField->prompt));
+ _G(kernel).teleported_in = true;
+
+ _teleportDialog->destroy();
+ _teleportDialog = nullptr;
+}
+
+void Hotkeys::teleportCancel(void *, void *) {
+ _teleportDialog->destroy();
+ _teleportDialog = nullptr;
}
void Hotkeys::paint_walk_codes(void *, void *) {
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index cc85dec4af0..a0309b36a70 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -29,6 +29,9 @@
namespace M4 {
struct Hotkeys {
+private:
+ static Dialog *_teleportDialog;
+
private:
static void exit_program(void *, void *);
static void adv_hyperwalk_to_final_destination(void *a, void *b);
@@ -65,7 +68,11 @@ private:
static void dbg_pal_toggle(void *, void *);
static void f_io_report(void *, void *);
static void scale_editor_toggle(void *, void *);
+
static void teleport(void *, void *);
+ static void teleportOk(void *, void *);
+ static void teleportCancel(void *, void *);
+
static void paint_walk_codes(void *, void *);
static void pal_override(void *, void *);
@@ -73,6 +80,7 @@ protected:
virtual void adv_enable_system_hot_keys();
public:
+ Hotkeys();
virtual ~Hotkeys() {}
virtual void add_hot_keys();
Commit: 59a4a0fb126a85c239d1da72137181d2b95710b0
https://github.com/scummvm/scummvm/commit/59a4a0fb126a85c239d1da72137181d2b95710b0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added debug walk codes
Changed paths:
engines/m4/gui/hotkeys.cpp
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index fbc97c186cc..fa568b46de3 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -340,7 +340,22 @@ void Hotkeys::teleportCancel(void *, void *) {
}
void Hotkeys::paint_walk_codes(void *, void *) {
- warning("TODO: hotkey");
+ Buffer *bgBuff = _G(game_bgBuff)->get_buffer();
+ Buffer *drawBuff = _G(gameDrawBuff)->get_buffer();
+
+ for (int yp = 0; yp < bgBuff->h; ++yp) {
+ const byte *bgLine = gr_buffer_pointer(bgBuff, 0, yp);
+ byte *drawLine = gr_buffer_pointer(drawBuff, 0, yp);
+
+ for (int xp = 0; xp < bgBuff->w; ++xp, ++bgLine, ++drawLine) {
+ if (*bgLine & 0x10)
+ *drawLine = gr_pal_get_ega_color(1);
+ }
+ }
+
+ _G(game_bgBuff)->release();
+ _G(gameDrawBuff)->release();
+ RestoreScreens(0, 0, 639, 479);
}
void Hotkeys::pal_override(void *, void *) {
Commit: bbd4e19b00d26f50502f5a297dfd5091a02c5da9
https://github.com/scummvm/scummvm/commit/bbd4e19b00d26f50502f5a297dfd5091a02c5da9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added scale editor toggle mapped to Alt+E
The original used Alt+S, but that's reserved by ScummVM for
taking screenshots. I'm aware that no-one may ever use any
of these debug keys, but I think it's important for posterity
to have them implemented, as it may give insights into how
the engine and games were originally developed.
Changed paths:
engines/m4/adv_r/adv_scale.cpp
engines/m4/adv_r/adv_scale.h
engines/m4/gui/hotkeys.cpp
diff --git a/engines/m4/adv_r/adv_scale.cpp b/engines/m4/adv_r/adv_scale.cpp
index ac85716d6ff..0b4095c4366 100644
--- a/engines/m4/adv_r/adv_scale.cpp
+++ b/engines/m4/adv_r/adv_scale.cpp
@@ -124,7 +124,7 @@ void scale_editor_cancel() {
_G(editors_in_use) &= ~kScaleEditor;
}
-void scale_editor_toggle(void *, void *) {
+void scale_editor_toggle() {
if (_G(editors_in_use) & kScaleEditor)
scale_editor_cancel();
else {
diff --git a/engines/m4/adv_r/adv_scale.h b/engines/m4/adv_r/adv_scale.h
index 8a1a76502a4..21e7fc3ffa6 100644
--- a/engines/m4/adv_r/adv_scale.h
+++ b/engines/m4/adv_r/adv_scale.h
@@ -40,7 +40,7 @@ struct ADVScale_Globals {
extern void scale_editor_draw();
extern void scale_editor_cancel();
-extern void scale_editor_toggle(void *, void *);
+extern void scale_editor_toggle();
} // End of namespace M4
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index fa568b46de3..efe61fc94cd 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -60,14 +60,14 @@ void Hotkeys::restore_hot_keys() {
//AddSystemHotkey( KEY_ALT_B, toggle_inv_visible);
AddSystemHotkey(KEY_ALT_C, toggle_commands_allowed);
AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
+ AddSystemHotkey(KEY_ALT_E, scale_editor_toggle); // Was Alt-S, but ScummVM reserves that
AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
AddSystemHotkey(KEY_ALT_G, change_global_var);
AddSystemHotkey(KEY_ALT_I, cb_MouseDialog);
- AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects); // was O
+ AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects);
AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
AddSystemHotkey(KEY_ALT_R, f_io_report);
- AddSystemHotkey(KEY_ALT_S, scale_editor_toggle);
AddSystemHotkey(KEY_ALT_T, teleport);
AddSystemHotkey(KEY_ALT_W, paint_walk_codes);
AddSystemHotkey(KEY_ALT_Z, pal_override);
@@ -158,14 +158,14 @@ void Hotkeys::adv_enable_system_hot_keys() {
AddSystemHotkey(KEY_ALT_B, toggle_inv_visible);
AddSystemHotkey(KEY_ALT_C, toggle_commands_allowed);
AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
+ AddSystemHotkey(KEY_ALT_E, scale_editor_toggle); // Was Alt-S, but ScummVM reserves that
AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
AddSystemHotkey(KEY_ALT_G, change_global_var);
AddSystemHotkey(KEY_ALT_I, (HotkeyCB)cb_MouseDialog);
- AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects); // was O
+ AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects);
AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
AddSystemHotkey(KEY_ALT_R, f_io_report);
- AddSystemHotkey(KEY_ALT_S, scale_editor_toggle);
AddSystemHotkey(KEY_ALT_T, teleport);
AddSystemHotkey(KEY_ALT_W, paint_walk_codes);
AddSystemHotkey(KEY_ALT_Z, pal_override);
@@ -188,7 +188,7 @@ void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
}
void Hotkeys::f_io_report(void *, void *) {
- warning("TODO: hotkey");
+ // IO file list not available in ScummVM
}
void Hotkeys::saveScreenshot(void *, void *) {
@@ -307,7 +307,7 @@ void Hotkeys::dbg_pal_toggle(void *, void *) {
}
void Hotkeys::scale_editor_toggle(void *, void *) {
- warning("TODO: hotkey");
+ M4::scale_editor_toggle();
}
void Hotkeys::teleport(void *, void *) {
@@ -359,7 +359,9 @@ void Hotkeys::paint_walk_codes(void *, void *) {
}
void Hotkeys::pal_override(void *, void *) {
- warning("TODO: hotkey");
+ gr_pal_interface(_G(master_palette));
+ gr_pal_set(_G(master_palette));
+ Dialog_Refresh_All();
}
} // End of namespace M4
Commit: 3777e442b1e1af66e3f5c94213df1ec960a85b50
https://github.com/scummvm/scummvm/commit/3777e442b1e1af66e3f5c94213df1ec960a85b50
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix engine noise when truck leaves Vera's
Changed paths:
engines/m4/burger/rooms/section1/room142.cpp
diff --git a/engines/m4/burger/rooms/section1/room142.cpp b/engines/m4/burger/rooms/section1/room142.cpp
index 52fe7405d7c..c533c4ec8a9 100644
--- a/engines/m4/burger/rooms/section1/room142.cpp
+++ b/engines/m4/burger/rooms/section1/room142.cpp
@@ -388,7 +388,7 @@ void Room142::daemon() {
if (_volume > 0) {
term_message("fading truck noise, current volume = %d", _volume);
digi_change_volume(1, _volume);
- kernel_timing_trigger(6, 10);
+ kernel_timing_trigger(6, 11);
} else {
digi_stop(1);
digi_stop(2);
Commit: 89a0f7df9c1b883905accc1071fe965b2885fc4f
https://github.com/scummvm/scummvm/commit/89a0f7df9c1b883905accc1071fe965b2885fc4f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove duplicate hotkey cheat stuff
Changed paths:
engines/m4/core/param.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
engines/m4/vars.cpp
engines/m4/vars.h
diff --git a/engines/m4/core/param.cpp b/engines/m4/core/param.cpp
index d8d9f444468..ba1601a79eb 100644
--- a/engines/m4/core/param.cpp
+++ b/engines/m4/core/param.cpp
@@ -50,7 +50,6 @@ void parse_all_flags() {
_G(kernel).track_open_close = ConfMan.hasKey("FILECOUNT");
_G(kernel).start_up_with_dbg_ws = ConfMan.hasKey("W");
_G(kernel).use_debug_monitor = ConfMan.hasKey("H");
- _G(cheat_keys_enabled) = ConfMan.hasKey("!");
if (ConfMan.hasKey("M"))
_G(mem_to_alloc) = ConfMan.getInt("M");
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index efe61fc94cd..5c7fea24d7b 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -34,45 +34,6 @@ Hotkeys::Hotkeys() {
_teleportDialog = nullptr;
}
-void Hotkeys::restore_hot_keys() {
- AddSystemHotkey(KEY_HOME, saveScreenshot);
- AddSystemHotkey(KEY_PAGE_UP, debug_memory_next_column);
- AddSystemHotkey(KEY_PAGE_DOWN, debug_memory_prev_column);
- AddSystemHotkey(KEY_END, debug_memory_last_column);
-
- AddSystemHotkey(KEY_ALT_UP, player_step_up);
- AddSystemHotkey(KEY_ALT_DOWN, player_step_down);
- AddSystemHotkey(KEY_ALT_LEFT, player_step_left);
- AddSystemHotkey(KEY_ALT_RIGHT, player_step_right);
-
- AddSystemHotkey(KEY_CTRL_UP, player_jump_up);
- AddSystemHotkey(KEY_CTRL_DOWN, player_jump_down);
- AddSystemHotkey(KEY_CTRL_LEFT, player_jump_left);
- AddSystemHotkey(KEY_CTRL_RIGHT, player_jump_right);
-
- AddSystemHotkey(KEY_F4, term_next_mode);
-
- AddSystemHotkey('[', camera_step_left);
- AddSystemHotkey(']', camera_step_right);
- AddSystemHotkey('{', camera_jump_left);
- AddSystemHotkey('}', camera_jump_right);
-
- //AddSystemHotkey( KEY_ALT_B, toggle_inv_visible);
- AddSystemHotkey(KEY_ALT_C, toggle_commands_allowed);
- AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
- AddSystemHotkey(KEY_ALT_E, scale_editor_toggle); // Was Alt-S, but ScummVM reserves that
- AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
- AddSystemHotkey(KEY_ALT_G, change_global_var);
- AddSystemHotkey(KEY_ALT_I, cb_MouseDialog);
- AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects);
- AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
- AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
- AddSystemHotkey(KEY_ALT_R, f_io_report);
- AddSystemHotkey(KEY_ALT_T, teleport);
- AddSystemHotkey(KEY_ALT_W, paint_walk_codes);
- AddSystemHotkey(KEY_ALT_Z, pal_override);
-}
-
void Hotkeys::disable_hot_keys() {
RemoveSystemHotkey(KEY_HOME);
RemoveSystemHotkey(KEY_PAGE_UP);
@@ -123,8 +84,6 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_SPACE, adv_hyperwalk_to_final_destination);
AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
- restore_hot_keys();
-
if (_G(cheating_enabled)) {
adv_enable_system_hot_keys();
}
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index a0309b36a70..bdea14003a8 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -85,7 +85,6 @@ public:
virtual void add_hot_keys();
void disable_hot_keys();
- void restore_hot_keys();
static void saveGame(void *, void *);
static void loadGame(void *, void *);
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index b415a38a759..c378b30a28d 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -42,7 +42,6 @@ Vars *g_vars;
Vars::Vars() : _digi(g_engine->_mixer) {
g_vars = this;
- _cheating_enabled = gDebugLevel > 0;
Common::fill(_sizeMem, _sizeMem + _MEMTYPE_LIMIT, 0);
Common::fill(_requests, _requests + _MEMTYPE_LIMIT, 0);
@@ -92,7 +91,7 @@ bool Vars::init() {
grab_fonts();
gr_font_set(_font_inter);
- if (_cheat_keys_enabled) {
+ if (_cheating_enabled) {
if (!dbg_ws_init(_kernel.start_up_with_dbg_ws, _font_tiny_prop, _globals))
error_show(FL, 'DWIF', "cheat system");
}
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index 8fc6c8d7a06..d9008e09435 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -118,7 +118,7 @@ public:
Rend_Globals _rend;
bool _cheating_enabled = true;
- bool _cheat_keys_enabled = false;
+
Font *_system_font = nullptr;
Font *_font_line = nullptr;
Font *_font_tiny_prop = nullptr;
Commit: 492276ccc56f15eaeb89d545e06e57076018e858
https://github.com/scummvm/scummvm/commit/492276ccc56f15eaeb89d545e06e57076018e858
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added mouse pos dialog toggle
Changed paths:
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 5c7fea24d7b..2d3c83320bf 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -120,7 +120,7 @@ void Hotkeys::adv_enable_system_hot_keys() {
AddSystemHotkey(KEY_ALT_E, scale_editor_toggle); // Was Alt-S, but ScummVM reserves that
AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
AddSystemHotkey(KEY_ALT_G, change_global_var);
- AddSystemHotkey(KEY_ALT_I, (HotkeyCB)cb_MouseDialog);
+ AddSystemHotkey(KEY_ALT_I, toggleInfoDialog);
AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects);
AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
AddSystemHotkey(KEY_ALT_P, dbg_pal_toggle);
@@ -249,8 +249,15 @@ void Hotkeys::change_global_var(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::cb_MouseDialog(void *, void *) {
- warning("TODO: hotkey");
+void Hotkeys::toggleInfoDialog(void *, void *) {
+ if (!_G(showMousePos)) {
+ vmng_screen_show(_G(mousePosDialog));
+ _G(showMousePos) = true;
+ pal_override();
+ } else {
+ vmng_screen_hide(_G(mousePosDialog));
+ _G(showMousePos) = false;
+ }
}
void Hotkeys::other_cheat_with_inventory_objects(void *, void *) {
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index bdea14003a8..48f471a55f3 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -62,7 +62,7 @@ private:
static void debug_memory_dumpcore_to_disk(void *, void *);
static void dbg_mem_set_search(void *, void *);
static void change_global_var(void *, void *);
- static void cb_MouseDialog(void *, void *);
+ static void toggleInfoDialog(void *, void *);
static void other_cheat_with_inventory_objects(void *, void *); // was O
static void debug_memory_toggle(void *, void *);
static void dbg_pal_toggle(void *, void *);
@@ -74,7 +74,7 @@ private:
static void teleportCancel(void *, void *);
static void paint_walk_codes(void *, void *);
- static void pal_override(void *, void *);
+ static void pal_override(void *a = nullptr, void *b = nullptr);
protected:
virtual void adv_enable_system_hot_keys();
Commit: 03e27b5fff45bb65f27c3c6272b61906f1d26134
https://github.com/scummvm/scummvm/commit/03e27b5fff45bb65f27c3c6272b61906f1d26134
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added global variable change dialog
Changed paths:
engines/m4/gui/hotkeys.cpp
engines/m4/gui/hotkeys.h
engines/m4/vars.h
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 2d3c83320bf..0fed8eb111e 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -24,13 +24,20 @@
#include "m4/gui/gui_vmng.h"
#include "m4/platform/keys.h"
#include "m4/adv_r/adv_walk.h"
-#include "m4/vars.h"
+#include "m4/burger/burger.h"
+#include "m4/burger/vars.h"
+#include "m4/riddle/riddle.h"
+#include "m4/riddle/vars.h"
namespace M4 {
+Dialog *Hotkeys::_changeGlobalDialog;
+int Hotkeys::_globalToChange;
Dialog *Hotkeys::_teleportDialog;
Hotkeys::Hotkeys() {
+ _globalToChange = 0;
+ _changeGlobalDialog = nullptr;
_teleportDialog = nullptr;
}
@@ -84,9 +91,7 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_SPACE, adv_hyperwalk_to_final_destination);
AddSystemHotkey('f', adv_hyperwalk_to_final_destination);
- if (_G(cheating_enabled)) {
- adv_enable_system_hot_keys();
- }
+ adv_enable_system_hot_keys();
}
void Hotkeys::adv_enable_system_hot_keys() {
@@ -119,7 +124,7 @@ void Hotkeys::adv_enable_system_hot_keys() {
AddSystemHotkey(KEY_ALT_D, debug_memory_dumpcore_to_disk);
AddSystemHotkey(KEY_ALT_E, scale_editor_toggle); // Was Alt-S, but ScummVM reserves that
AddSystemHotkey(KEY_ALT_F, dbg_mem_set_search);
- AddSystemHotkey(KEY_ALT_G, change_global_var);
+ AddSystemHotkey(KEY_ALT_G, changeGlobal);
AddSystemHotkey(KEY_ALT_I, toggleInfoDialog);
AddSystemHotkey(KEY_ALT_B, other_cheat_with_inventory_objects);
AddSystemHotkey(KEY_ALT_M, debug_memory_toggle);
@@ -245,8 +250,62 @@ void Hotkeys::dbg_mem_set_search(void *, void *) {
warning("TODO: hotkey");
}
-void Hotkeys::change_global_var(void *, void *) {
- warning("TODO: hotkey");
+void Hotkeys::changeGlobal(void *, void *) {
+ if (!_changeGlobalDialog) {
+ gr_font_set(_G(font_tiny));
+ _changeGlobalDialog = DialogCreateAbsolute(250, 120, 450, 220, 242);
+ _changeGlobalDialog->addButton(60, 40, " Change Global Variable ",
+ changeGlobalChange, 1);
+ _changeGlobalDialog->addButton(10, 40, " Cancel ", changeGlobalCancel, 2);
+ _changeGlobalDialog->addTextField(50, 7, gr_font_string_width("MMMMM") + 50,
+ "-----", nullptr, 3, 5);
+ _changeGlobalDialog->configure(3, 1, 2);
+ _changeGlobalDialog->show();
+ }
+}
+
+void Hotkeys::changeGlobalChange(void *, void *) {
+ // Get the global number to change
+ Item *textField = _teleportDialog->getItem(3);
+ _globalToChange = atoi(textField->prompt);
+
+ // Destroy the current dialog
+ _changeGlobalDialog->destroy();
+
+ // Create secondary dialog to get value to set global to
+ int globalVal = (g_engine->getGameType() == GType_Burger) ?
+ Burger::g_vars->_flags[_globalToChange] :
+ Riddle::g_vars->_flags[_globalToChange];
+
+ _changeGlobalDialog = DialogCreateAbsolute(250, 120, 450, 220, 242);
+ _changeGlobalDialog->addButton(60, 40,
+ Common::String::format("Assign new value to #%d ", _globalToChange).c_str(),
+ changeGlobalDoChange, 1);
+ _changeGlobalDialog->addButton(10, 40, " Cancel ", changeGlobalCancel, 2);
+ _changeGlobalDialog->addTextField(50, 7,
+ gr_font_string_width("MMMMM") + 50,
+ Common::String::format("%5d", globalVal).c_str(),
+ nullptr, 3, 5);
+ _changeGlobalDialog->configure(3, 1, 2);
+ _changeGlobalDialog->show();
+}
+
+void Hotkeys::changeGlobalDoChange(void *, void *) {
+ Item *textField = _teleportDialog->getItem(3);
+ int globalVal = atoi(textField->prompt);
+
+ if (g_engine->getGameType() == GType_Burger)
+ Burger::g_vars->_flags[_globalToChange] = globalVal;
+ else
+ Riddle::g_vars->_flags[_globalToChange] = globalVal;
+
+ _changeGlobalDialog->destroy();
+ _changeGlobalDialog = nullptr;
+}
+
+void Hotkeys::changeGlobalCancel(void *, void *) {
+ _changeGlobalDialog->destroy();
+ _changeGlobalDialog = nullptr;
}
void Hotkeys::toggleInfoDialog(void *, void *) {
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 48f471a55f3..5333c0770be 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -31,6 +31,8 @@ namespace M4 {
struct Hotkeys {
private:
static Dialog *_teleportDialog;
+ static Dialog *_changeGlobalDialog;
+ static int _globalToChange;
private:
static void exit_program(void *, void *);
@@ -61,7 +63,7 @@ private:
static void toggle_commands_allowed(void *, void *);
static void debug_memory_dumpcore_to_disk(void *, void *);
static void dbg_mem_set_search(void *, void *);
- static void change_global_var(void *, void *);
+
static void toggleInfoDialog(void *, void *);
static void other_cheat_with_inventory_objects(void *, void *); // was O
static void debug_memory_toggle(void *, void *);
@@ -73,6 +75,11 @@ private:
static void teleportOk(void *, void *);
static void teleportCancel(void *, void *);
+ static void changeGlobal(void *, void *);
+ static void changeGlobalCancel(void *, void *);
+ static void changeGlobalChange(void *, void *);
+ static void changeGlobalDoChange(void *, void *);
+
static void paint_walk_codes(void *, void *);
static void pal_override(void *a = nullptr, void *b = nullptr);
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index d9008e09435..f68b213943e 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -117,7 +117,7 @@ public:
ConvDisplayData _cdd;
Rend_Globals _rend;
- bool _cheating_enabled = true;
+ const bool _cheating_enabled = true;
Font *_system_font = nullptr;
Font *_font_line = nullptr;
Commit: cb1ce6c0e0d2cf7bc16e9eaef43478ca01cf59e6
https://github.com/scummvm/scummvm/commit/cb1ce6c0e0d2cf7bc16e9eaef43478ca01cf59e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Adding change global variable dialog
Changed paths:
engines/m4/gui/hotkeys.cpp
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 0fed8eb111e..5f4e4bab865 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -31,6 +31,11 @@
namespace M4 {
+// Since we include the vars of both games, we need to reset the _G
+// to only point to the common shared variables
+#undef _G
+#define _G(X) (g_vars->_##X)
+
Dialog *Hotkeys::_changeGlobalDialog;
int Hotkeys::_globalToChange;
Dialog *Hotkeys::_teleportDialog;
Commit: 2af44be03831a754c38312785b23a4e225914c65
https://github.com/scummvm/scummvm/commit/2af44be03831a754c38312785b23a4e225914c65
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes to change global dialog
Changed paths:
engines/m4/gui/hotkeys.cpp
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 5f4e4bab865..38e919b90c9 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -271,9 +271,14 @@ void Hotkeys::changeGlobal(void *, void *) {
void Hotkeys::changeGlobalChange(void *, void *) {
// Get the global number to change
- Item *textField = _teleportDialog->getItem(3);
+ Item *textField = _changeGlobalDialog->getItem(3);
_globalToChange = atoi(textField->prompt);
+ if (!_globalToChange) {
+ changeGlobalCancel(nullptr, nullptr);
+ return;
+ }
+
// Destroy the current dialog
_changeGlobalDialog->destroy();
@@ -296,7 +301,7 @@ void Hotkeys::changeGlobalChange(void *, void *) {
}
void Hotkeys::changeGlobalDoChange(void *, void *) {
- Item *textField = _teleportDialog->getItem(3);
+ Item *textField = _changeGlobalDialog->getItem(3);
int globalVal = atoi(textField->prompt);
if (g_engine->getGameType() == GType_Burger)
Commit: ce59fc7a42ce7a7605f2a78b094ed9d572e8c1b0
https://github.com/scummvm/scummvm/commit/ce59fc7a42ce7a7605f2a78b094ed9d572e8c1b0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of npc code in room 143
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
engines/m4/burger/rooms/section1/room143.h
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index 1984f5b71a7..fee495a1621 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -29,7 +29,9 @@ namespace Burger {
namespace Rooms {
enum {
- kCHANGE_VERA_ANIMATION = 44
+ kCHANGE_CAT_ANIMATION = 43,
+ kCHANGE_VERA_ANIMATION = 44,
+ kCHANGE_BURL_ANIMATION = 45
};
const char *Room143::SAID[][4] = {
@@ -163,12 +165,12 @@ void Room143::init() {
if (_G(flags)[V000] == 1003 && _G(flags)[V063])
digi_preload("143_002");
- _val1 = 8;
- _val2 = 8;
+ _veraShould = 8;
+ _veraMode = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
_val3 = 0;
- _val4 = 6;
- kernel_trigger_dispatch_now(43);
+ _catShould = 6;
+ kernel_trigger_dispatch_now(kCHANGE_CAT_ANIMATION);
if (_G(flags)[V064] == 1)
loadCheese();
@@ -177,12 +179,12 @@ void Room143::init() {
if (_G(flags)[V000] == 1003) {
if (_G(flags)[V063]) {
- _val5 = _val6 = 42;
+ _burlMode = _burlShould = 42;
} else {
- _val5 = _val6 = 31;
+ _burlMode = _burlShould = 31;
}
- kernel_trigger_dispatch_now(45);
+ kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
} else {
hotspot_set_active("burl", false);
}
@@ -259,7 +261,7 @@ void Room143::daemon() {
case 7:
digi_play("143e600", 1, 255, 1);
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
@@ -273,7 +275,7 @@ void Room143::daemon() {
break;
case 11:
- _val6 = (_val5 == 42) ? 42 : 31;
+ _burlShould = (_burlMode == 42) ? 42 : 31;
player_set_commands_allowed(true);
break;
@@ -287,7 +289,7 @@ void Room143::daemon() {
wilbur_speech("143w507", 14);
} else {
_digiName = "143v508";
- _val1 = 11;
+ _veraShould = 11;
_digiMode = KT_DAEMON;
_digiTrigger = 15;
}
@@ -308,70 +310,71 @@ void Room143::daemon() {
_digiName = "143v509c";
break;
}
- _val1 = 11;
+
+ _veraShould = 11;
_digiMode = KT_DAEMON;
_digiTrigger = 15;
break;
case 15:
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
case 16:
_digiName = "143v506";
- _val1 = 22;
+ _veraShould = 22;
_digiMode = KT_DAEMON;
_digiTrigger = 17;
break;
case 17:
- _val1 = 13;
+ _veraShould = 13;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
digi_play("143e503", 1, 255, 18);
break;
case 18:
_digiName = "143v507";
- _val1 = 14;
+ _veraShould = 14;
_digiMode = KT_DAEMON;
_digiTrigger = 15;
break;
case 19:
- _val6 = 37;
+ _burlShould = 37;
break;
case 21:
- _val4 = 7;
- kernel_trigger_dispatch_now(43);
+ _catShould = 7;
+ kernel_trigger_dispatch_now(kCHANGE_CAT_ANIMATION);
break;
case 22:
_digiName = "143b001";
_digiMode = KT_DAEMON;
_digiTrigger = 23;
- _val6 = 30;
- _val5 = 29;
- _val1 = 21;
- kernel_trigger_dispatch_now(45);
+ _burlShould = 30;
+ _burlMode = 29;
+ _veraShould = 21;
+ kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
break;
case 23:
_digiName = "143v901";
_digiMode = KT_DAEMON;
_digiTrigger = 24;
- _val6 = 29;
- _val1 = 22;
+ _burlShould = 29;
+ _veraShould = 22;
break;
case 24:
_digiName = "143b002";
_digiMode = KT_DAEMON;
_digiTrigger = 25;
- _val6 = 30;
- _val1 = 21;
+ _burlShould = 30;
+ _veraShould = 21;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
@@ -379,16 +382,16 @@ void Room143::daemon() {
_digiName = "143v902";
_digiMode = KT_DAEMON;
_digiTrigger = 26;
- _val6 = 29;
- _val1 = 22;
+ _burlShould = 29;
+ _veraShould = 22;
break;
case 26:
_digiName = "143v903";
_digiMode = KT_DAEMON;
_digiTrigger = 7;
- _val1 = 14;
- _val6 = 31;
+ _veraShould = 14;
+ _burlShould = 31;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
@@ -402,11 +405,11 @@ void Room143::daemon() {
_digiName = "143b006";
_digiMode = KT_DAEMON;
_digiTrigger = 30;
- _val6 = 36;
+ _burlShould = 36;
break;
case 30:
- _val6 = 39;
+ _burlShould = 39;
break;
case 31:
@@ -433,7 +436,7 @@ void Room143::daemon() {
_digiName = "143b005";
_digiMode = KT_DAEMON;
_digiTrigger = 39;
- _val6 = (_val5 == 42) ? 44 : 36;
+ _burlShould = (_burlMode == 42) ? 44 : 36;
break;
case 38:
@@ -444,40 +447,40 @@ void Room143::daemon() {
terminateMachineAndNull(_wi03);
terminateMachineAndNull(_wi03S);
Series::series_play("143wi03", 0x100, 0, 38, 6, 0, 100, 0, 0, 11, -1);
- _val6 = (_val5 == 42) ? 42 : 31;
+ _burlShould = (_burlMode == 42) ? 42 : 31;
break;
case 40:
_digiName = "143v904";
_digiMode = KT_DAEMON;
_digiTrigger = 41;
- _val6 = 35;
- _val1 = 11;
+ _burlShould = 35;
+ _veraShould = 11;
break;
case 41:
- _val6 = 34;
+ _burlShould = 34;
_digiName = "143b003";
_digiMode = KT_DAEMON;
_digiTrigger = 42;
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
case 42:
- _val6 = 42;
+ _burlShould = 42;
break;
- case 43:
- switch (_val4) {
+ case kCHANGE_CAT_ANIMATION:
+ switch (_catShould) {
case 6:
_cat.show("143cat", 0);
break;
case 7:
_cat.terminate();
- _val4 = 6;
- series_play_with_breaks(PLAY4, "143cat", 0, 43, 3, 10, 100, 0, 0);
+ _catShould = 6;
+ series_play_with_breaks(PLAY4, "143cat", 0, kCHANGE_CAT_ANIMATION, 3, 10, 100, 0, 0);
break;
default:
@@ -486,9 +489,9 @@ void Room143::daemon() {
break;
case kCHANGE_VERA_ANIMATION:
- switch (_val2) {
+ switch (_veraMode) {
case 8:
- switch (_val1) {
+ switch (_veraShould) {
case 8:
switch (imath_ranged_rand(1, 20)) {
case 1:
@@ -496,7 +499,7 @@ void Room143::daemon() {
break;
case 2:
- _val2 = 10;
+ _veraMode = 10;
series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
@@ -507,31 +510,31 @@ void Room143::daemon() {
break;
case 11:
- _val2 = 10;
+ _veraMode = 10;
series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
case 13:
case 14:
case 15:
- _val2 = 13;
+ _veraMode = 13;
Series::series_play("143ve14", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 8);
break;
case 20:
- _val1 = 8;
+ _veraShould = 8;
series_play_with_breaks(PLAY6, "143ve07", 0xf00, kCHANGE_VERA_ANIMATION, 3);
break;
case 21:
case 22:
- _val2 = 21;
+ _veraMode = 21;
Series::series_play("143ve08", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 25:
case 26:
- _val2 = 27;
+ _veraMode = 27;
series_play("143ve04", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
break;
@@ -541,24 +544,24 @@ void Room143::daemon() {
break;
case 9:
- if (_val1 == 8) {
+ if (_veraShould == 8) {
if (imath_ranged_rand(1, 20) == 1) {
- _val2 = 21;
+ _veraMode = 21;
Series::series_play("143ve10", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
} else {
Series::series_play("143ve10", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
}
} else {
- _val2 = 21;
+ _veraMode = 21;
Series::series_play("143ve10", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
}
break;
case 10:
- switch (_val1) {
+ switch (_veraShould) {
case 8:
if (imath_ranged_rand(1, 20) == 1) {
- _val2 = 8;
+ _veraMode = 8;
series_play("143ve03", 0xf00, 2, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
} else {
series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
@@ -566,117 +569,117 @@ void Room143::daemon() {
break;
case 11:
- _val2 = 11;
+ _veraMode = 11;
series_play("143ve03", 0xf00, 0, kCHANGE_VERA_ANIMATION, 4, 0, 100, 0, 0, 3, 3);
break;
default:
- _val2 = 8;
+ _veraMode = 8;
series_play("143ve03", 0xf00, 2, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
break;
}
break;
case 11:
- if (_val1 == 11) {
+ if (_veraShould == 11) {
_ve03 = series_play("143ve03", 0xf00, 4, -1, 4, -1, 100, 0, 0, 3, 6);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
- _val2 = 10;
+ _veraMode = 10;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
case 13:
- switch (_val1) {
+ switch (_veraShould) {
case 13:
Series::series_play("143ve15", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 4, 4);
break;
case 14:
- _val2 = 14;
+ _veraMode = 14;
Series::series_play("143ve17", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
break;
case 15:
- _val2 = (imath_ranged_rand(1, 2) == 1) ? 16 : 17;
+ _veraMode = (imath_ranged_rand(1, 2) == 1) ? 16 : 17;
Series::series_play("143ve18", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 18:
- _val1 = 19;
+ _veraShould = 19;
Series::series_play("143ve16", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 1);
break;
case 19:
terminateMachineAndNull(_plate);
- _val1 = 13;
+ _veraShould = 13;
Series::series_play("143ve16", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 15);
break;
case 21:
- _val2 = 21;
+ _veraMode = 21;
Series::series_play("143ve15", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
default:
- _val2 = 10;
+ _veraMode = 10;
Series::series_play("143ve19", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, -1);
break;
}
break;
case 14:
- if (_val1 == 14) {
+ if (_veraShould == 14) {
_ve03 = series_play("143ve18", 0xf00, 4, -1, 4, -1, 100, 0, 0, 1, 4);
_ve03S = series_play("143ve18s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 1, 4);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 13;
+ _veraMode = 13;
Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
break;
case 16:
- if (_val1 == 15) {
+ if (_veraShould == 15) {
_ve03 = series_play("143ve17", 0xf00, 4, -1, 4, -1, 100, 0, 0, 3, 5);
_ve03S = series_play("143ve17s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 3, 5);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 13;
+ _veraMode = 13;
Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
}
break;
case 17:
- if (_val1 == 15) {
+ if (_veraShould == 15) {
_ve03 = series_play("143ve18", 0xf00, 4, -1, 4, -1, 100, 0, 0, 5, 8);
_ve03S = series_play("143ve18s", 0xf01, 4, -1, 4, -1, 100, 0, 0, 5, 8);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 13;
+ _veraMode = 13;
Series::series_play("143ve18", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
}
break;
case 21:
- switch (_val1) {
+ switch (_veraShould) {
case 15:
- _val2 = 13;
+ _veraMode = 13;
Series::series_play("143ve15", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 21:
if (imath_ranged_rand(1, 20) == 1) {
- _val2 = 9;
+ _veraMode = 9;
Series::series_play("143ve10", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
} else {
Series::series_play("143ve08", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 4, 4);
@@ -685,85 +688,85 @@ void Room143::daemon() {
case 22:
if (imath_ranged_rand(1, 2) == 1) {
- _val2 = 23;
+ _veraMode = 23;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
} else {
- _val2 = 24;
+ _veraMode = 24;
Series::series_play("143ve11", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 4);
}
break;
default:
- _val2 = 8;
+ _veraMode = 8;
Series::series_play("143ve08", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
case 23:
- if (_val1 == 22) {
+ if (_veraShould == 22) {
_ve03 = series_play("143ve11", 0xf00, 0, -1, 6, -1, 100, 0, 0, 0, 1);
_ve03S = series_play("143ve11s", 0xf01, 0, -1, 6, -1, 100, 0, 0, 0, 1);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 21;
+ _veraMode = 21;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
case 24:
- if (_val1 == 22) {
+ if (_veraShould == 22) {
_ve03 = series_play("143ve11", 0xf00, 4, -1, 6, -1, 100, 0, 0, 4, 6);
_ve03S = series_play("143ve11s", 0xf01, 4, -1, 6, -1, 100, 0, 0, 4, 6);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 21;
+ _veraMode = 21;
Series::series_play("143ve11", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 2, 4);
}
break;
case 25:
- switch (_val1) {
+ switch (_veraShould) {
case 25:
Series::series_play("143ve06", 0xf00, 0, kCHANGE_VERA_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 26:
- _val2 = 26;
+ _veraMode = 26;
Series::series_play("143ve06", 0xf00, 0, kCHANGE_VERA_ANIMATION, 4, 0, 100, 0, 0, 0, 0);
break;
default:
- _val2 = 28;
+ _veraMode = 28;
Series::series_play("143ve05", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
}
break;
case 26:
- if (_val1 == 26) {
+ if (_veraShould == 26) {
_ve03 = series_play("143ve06", 0xf00, 4, -1, 5, -1, 100, 0, 0, 0, 4);
_ve03S = series_play("143ve06s", 0xf01, 4, -1, 5, -1, 100, 0, 0, 0, 4);
playDigi2();
} else {
terminateMachineAndNull(_ve03);
terminateMachineAndNull(_ve03S);
- _val2 = 25;
+ _veraMode = 25;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
break;
case 27:
- _val2 = 25;
+ _veraMode = 25;
Series::series_play("143ve05", 0xf00, 0, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 4);
break;
case 28:
- _val2 = 8;
+ _veraMode = 8;
Series::series_play("143ve04", 0xf00, 2, kCHANGE_VERA_ANIMATION, 6, 0, 100, 0, 0, 0, 5);
break;
@@ -772,35 +775,35 @@ void Room143::daemon() {
}
break;
- case 45:
- switch (_val5) {
+ case kCHANGE_BURL_ANIMATION:
+ switch (_burlMode) {
case 20:
- _val5 = 31;
- kernel_trigger_dispatch_now(45);
+ _burlMode = 31;
+ kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
break;
case 29:
- switch (_val6) {
+ switch (_burlShould) {
case 29:
- Series::series_play("143bu02", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143bu02", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 30:
frame = imath_ranged_rand(0, 5);
- Series::series_play("143bu03", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu03", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
playDigi1();
break;
default:
_G(flags)[V298] = 0;
- _val5 = 20;
- series_play_with_breaks(PLAY9, "143bu04", 0xa00, 45, 3);
+ _burlMode = 20;
+ series_play_with_breaks(PLAY9, "143bu04", 0xa00, kCHANGE_BURL_ANIMATION, 3);
break;
}
break;
case 31:
- switch (_val6) {
+ switch (_burlShould) {
case 31: {
int rand = imath_ranged_rand(1, 20);
@@ -815,47 +818,47 @@ void Room143::daemon() {
switch (rand) {
case 1:
- _val5 = 47;
- Series::series_play("143bu10", 0xa00, 0, 45);
+ _burlMode = 47;
+ Series::series_play("143bu10", 0xa00, 0, kCHANGE_BURL_ANIMATION);
break;
case 2:
if (_val3 == -1)
_val3 = 0;
- Series::series_play("143bu05", 0xa00, 0, 45);
+ Series::series_play("143bu05", 0xa00, 0, kCHANGE_BURL_ANIMATION);
break;
default:
- Series::series_play("143bu05", 0xa00, 0, 45, 20, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143bu05", 0xa00, 0, kCHANGE_BURL_ANIMATION, 20, 0, 100, 0, 0, 0, 0);
break;
}
break;
}
case 33:
- _val6 = 31;
- series_play_with_breaks(PLAY11, "143bu11", 0xa00, 45, 3);
+ _burlShould = 31;
+ series_play_with_breaks(PLAY11, "143bu11", 0xa00, kCHANGE_BURL_ANIMATION, 3);
break;
case 35:
- _val5 = 35;
- Series::series_play("143bu06", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 3);
+ _burlMode = 35;
+ Series::series_play("143bu06", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
case 39:
- _val5 = 37;
- Series::series_play("143bu11", 0xa00, 0, 45);
+ _burlMode = 37;
+ Series::series_play("143bu11", 0xa00, 0, kCHANGE_BURL_ANIMATION);
break;
- case 45:
+ case kCHANGE_BURL_ANIMATION:
series_load("143money");
series_play_with_breaks(PLAY8, "143bu24", 0xe00, 1, 3);
break;
default:
- _val5 = 41;
- Series::series_play("143bu17", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 7);
+ _burlMode = 41;
+ Series::series_play("143bu17", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
}
break;
@@ -864,41 +867,41 @@ void Room143::daemon() {
digi_stop(2);
_G(flags)[V063] = 0;
- _val5 = 31;
+ _burlMode = 31;
loadMoney();
- Series::series_play("143bu25", 0xa00, 2, 45);
+ Series::series_play("143bu25", 0xa00, 2, kCHANGE_BURL_ANIMATION);
break;
case 35:
- switch (_val6) {
+ switch (_burlShould) {
case 34:
- Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 3, 3);
+ Series::series_play("143bu06", 0xa00, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
playDigi1();
break;
case 35:
- Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 3, 3);
+ Series::series_play("143bu06", 0xa00, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
break;
default:
- _val5 = 31;
- Series::series_play("143bu06", 0xa00, 0, 45, 10, 0, 100, 0, 0, 0, 3);
+ _burlMode = 31;
+ Series::series_play("143bu06", 0xa00, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 0, 3);
break;
}
break;
case 37:
- switch (_val6) {
+ switch (_burlShould) {
case 36:
frame = imath_ranged_rand(0, 5);
- Series::series_play("143bu13", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu13", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
playDigi1();
break;
case 37:
if (imath_ranged_rand(1, 60) == 22) {
// Talk about unlikely chance of happening
- Series::series_play("143bu14", 0xa00, 0, 45);
+ Series::series_play("143bu14", 0xa00, 0, kCHANGE_BURL_ANIMATION);
switch (imath_ranged_rand(1, 4)) {
case 1:
@@ -917,37 +920,37 @@ void Room143::daemon() {
break;
}
} else {
- Series::series_play("143bu13", 0xa00, 0, 45, 10, 0, 100, 0, 0, 0, 0);
+ Series::series_play("143bu13", 0xa00, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
}
break;
case 39:
- _val6 = 40;
- series_play_with_breaks(PLAY10, "143bu15", 0xa00, 45);
+ _burlShould = 40;
+ series_play_with_breaks(PLAY10, "143bu15", 0xa00, kCHANGE_BURL_ANIMATION);
break;
case 40:
digi_play("143b008", 1, 255, 1);
- _val6 = 31;
- kernel_trigger_dispatch_now(45);
+ _burlShould = 31;
+ kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
break;
default:
- _val5 = 31;
- Series::series_play("143bu11", 0xa00, 2, 45, 6, 0, 100, 0, 0, 0, 7);
+ _burlMode = 31;
+ Series::series_play("143bu11", 0xa00, 2, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
}
break;
case 41:
- _val5 = 42;
+ _burlMode = 42;
digi_preload("143_002");
player_set_commands_allowed(true);
- series_play_with_breaks(PLAY2, "143bu18", 0xa00, 45, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY2, "143bu18", 0xa00, kCHANGE_BURL_ANIMATION, 3, 6, 100, 0, 0);
break;
case 42:
- switch (_val6) {
+ switch (_burlShould) {
case 42:
++_val3;
@@ -959,7 +962,7 @@ void Room143::daemon() {
} while (frame <= _frame);
_frame = frame;
- Series::series_play("143bu19", 0xa00, 0, 45, 8, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu19", 0xa00, 0, kCHANGE_BURL_ANIMATION, 8, 0, 100, 0, 0, frame, frame);
} else if (imath_ranged_rand(1, 30) == 1) {
Series::series_play("143bu19", 0xa00, 0, -1, 8, 0, 100, 0, 0, 6, 12);
@@ -971,43 +974,43 @@ void Room143::daemon() {
} while (frame <= _frame);
_frame = frame;
- Series::series_play("143bu19", 0xa00, 0, 45, 8, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu19", 0xa00, 0, kCHANGE_BURL_ANIMATION, 8, 0, 100, 0, 0, frame, frame);
}
break;
case 44:
- _val5 = 43;
- Series::series_play("143bu20", 0xa00, 0, 45, 4);
+ _burlMode = 43;
+ Series::series_play("143bu20", 0xa00, 0, kCHANGE_BURL_ANIMATION, 4);
break;
case 45:
_G(flags)[V063] = 0;
- _val5 = 46;
- Series::series_play("143bu19", 0xa00, 0, 45, 4, 0, 100, 0, 0, 13, -1);
+ _burlMode = 46;
+ Series::series_play("143bu19", 0xa00, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, 13, -1);
break;
default:
_G(flags)[V063] = 0;
- _val5 = 32;
- Series::series_play("143bu19", 0xa00, 0, 45, 4, 0, 100, 0, 0, 13, -1);
+ _burlMode = 32;
+ Series::series_play("143bu19", 0xa00, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, 13, -1);
break;
}
break;
case 43:
- switch (_val6) {
+ switch (_burlShould) {
case 43:
frame = imath_ranged_rand(0, 5);
- Series::series_play("143bu21", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu21", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
break;
case 44:
frame = imath_ranged_rand(0, 4);
- Series::series_play("143bu22", 0xa00, 0, 45, 6, 0, 100, 0, 0, frame, frame);
+ Series::series_play("143bu22", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
break;
default:
- Series::series_play("143bu20", 0xa00, 2, 45, 6, 0, 100, 0, 0, 0, 7);
+ Series::series_play("143bu20", 0xa00, 2, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
}
break;
@@ -1020,8 +1023,8 @@ void Room143::daemon() {
break;
case 47:
- _val5 = 31;
- Series::series_play("143bu10", 0xa00, 0, 45, 6, 0, 100, 0, 0, 0, 0);
+ _burlMode = 31;
+ Series::series_play("143bu10", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
default:
@@ -1036,7 +1039,7 @@ void Room143::daemon() {
disable_player();
_G(wilbur_should) = 3;
series_play_with_breaks(PLAY1, "143wi02", 0xf00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 25, 0);
- _val1 = 21;
+ _veraShould = 21;
break;
case 3:
@@ -1046,7 +1049,7 @@ void Room143::daemon() {
inv_give_to_player("SPRING");
hotspot_set_active("MOUSE TRAP", false);
- _val1 = 22;
+ _veraShould = 22;
_digiName = "143v501";
_digiMode = KT_DAEMON;
_G(wilbur_should) = 5;
@@ -1057,7 +1060,7 @@ void Room143::daemon() {
break;
case 5:
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -1092,7 +1095,7 @@ void Room143::daemon() {
series_play_with_breaks(PLAY7, "143bu01", 0xe00, 22, 3);
} else {
- kernel_timing_trigger(60, 10028);
+ kernel_timing_trigger(60, kBurlEntersTown);
}
break;
@@ -1100,7 +1103,7 @@ void Room143::daemon() {
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
- _val1 = 20;
+ _veraShould = 20;
player_set_commands_allowed(false);
intr_freshen_sentence();
Section1::walk();
@@ -1113,7 +1116,7 @@ void Room143::daemon() {
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
- _val6 = 31;
+ _burlShould = 31;
} else {
kernel_timing_trigger(60, 10030);
}
@@ -1132,7 +1135,7 @@ void Room143::daemon() {
if (_G(player_info).y < 300)
ws_walk(213, 287, 0, -1, 2);
- _val6 = 45;
+ _burlShould = 45;
hotspot_set_active("burl", false);
} else {
kernel_timing_trigger(60, 10031);
@@ -1174,7 +1177,7 @@ void Room143::parser() {
if (player_commands_allowed() || INTERFACE_VISIBLE) {
talkToBurl();
- if (_val5 != 42 && _val5 != 43) {
+ if (_burlMode != 42 && _burlMode != 43) {
_G(kernel).trigger_mode = KT_DAEMON;
kernel_timing_trigger(60, 19);
}
@@ -1190,7 +1193,7 @@ void Room143::parser() {
switch (_G(kernel).trigger) {
case -1:
player_set_commands_allowed(false);
- _val1 = 22;
+ _veraShould = 22;
_digiName = "143v511";
_digiMode = KT_PARSE;
_digiTrigger = 1;
@@ -1198,7 +1201,7 @@ void Room143::parser() {
case 1:
player_set_commands_allowed(false);
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
@@ -1212,14 +1215,14 @@ void Room143::parser() {
switch (_G(kernel).trigger) {
case -1:
player_set_commands_allowed(false);
- _val1 = 11;
+ _veraShould = 11;
_digiName = "143v504";
_digiMode = KT_PARSE;
_digiTrigger = 1;
break;
case 1:
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
digi_play("143e502", 1, 255, 1);
break;
@@ -1231,7 +1234,7 @@ void Room143::parser() {
switch (_G(kernel).trigger) {
case -1:
player_set_commands_allowed(false);
- _val1 = 22;
+ _veraShould = 22;
_digiName = "143v510";
_digiMode = KT_PARSE;
_digiTrigger = 1;
@@ -1239,7 +1242,7 @@ void Room143::parser() {
break;
case 1:
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -1252,23 +1255,23 @@ void Room143::parser() {
switch (_G(kernel).trigger) {
case -1:
player_set_commands_allowed(false);
- _val1 = 26;
+ _veraShould = 26;
_digiName = "143v502";
_digiMode = KT_PARSE;
_digiTrigger = 1;
- _val4 = 21;
- kernel_trigger_dispatch_now(43);
+ _catShould = 21;
+ kernel_trigger_dispatch_now(kCHANGE_CAT_ANIMATION);
break;
case 1:
- _val1 = 13;
+ _veraShould = 13;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
digi_play("143e501", 1, 255, 2);
break;
case 2:
- _val1 = 14;
+ _veraShould = 14;
_digiName = "143V503";
_digiMode = KT_PARSE;
_digiTrigger = 3;
@@ -1276,7 +1279,7 @@ void Room143::parser() {
case 3:
player_set_commands_allowed(true);
- _val1 = 8;
+ _veraShould = 8;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
break;
@@ -1284,7 +1287,7 @@ void Room143::parser() {
break;
}
} else if (lookFlag && player_said("burl")) {
- if (_val5 == 42 || _val5 == 43 || _val5 == 44)
+ if (_burlMode == 42 || _burlMode == 43 || _burlMode == 44)
wilbur_speech("143w004");
else
wilbur_speech("143w003");
@@ -1312,7 +1315,7 @@ void Room143::conv35() {
}
if (node == 11 && entry == 0) {
- _val1 = 13;
+ _veraShould = 13;
} else if ((node == 1 && entry == 4) ||
(node == 4 && entry == 0) ||
(node == 5 && entry == 1) ||
@@ -1332,8 +1335,8 @@ void Room143::conv35() {
(node == 19 && entry == 0)) {
// Do nothing
} else {
- _val1 = 8;
- if (_val2 != 13) {
+ _veraShould = 8;
+ if (_veraMode != 13) {
_G(kernel).trigger = KT_DAEMON;
kernel_trigger_dispatch_now(kCHANGE_VERA_ANIMATION);
}
@@ -1382,13 +1385,13 @@ void Room143::conv35() {
(node == 19 && entry == 0)) {
digi_play(sound, 1, 255, 9);
} else if (node == 3) {
- _val6 = 34;
+ _burlShould = 34;
_digiName = sound;
} else if ((node == 9 && entry == 0) || (node == 17 && entry == 1)) {
- _val1 = 15;
+ _veraShould = 15;
_digiName = sound;
} else if (node == 5 && entry == 3) {
- _val1 = 26;
+ _veraShould = 26;
_digiName = sound;
} else if ((node == 5 && entry == 0) ||
(node == 1 && entry == 7) ||
@@ -1397,10 +1400,10 @@ void Room143::conv35() {
(node == 8) ||
(node == 9 && entry == 0) ||
(node == 10 && entry == 0)) {
- _val1 = 14;
+ _veraShould = 14;
_digiName = sound;
} else {
- _val1 = 11;
+ _veraShould = 11;
_digiName = sound;
}
} else if (who == 1) {
@@ -1424,10 +1427,10 @@ void Room143::conv30() {
if (_G(kernel).trigger == 9) {
if (who <= 0) {
- if (_val5 == 37 || _val5 == 31) {
- _val6 = 37;
- } else if (_val5 == 42 || _val5 == 43) {
- _val6 = 43;
+ if (_burlMode == 37 || _burlMode == 31) {
+ _burlShould = 37;
+ } else if (_burlMode == 42 || _burlMode == 43) {
+ _burlShould = 43;
digi_change_volume(2, 255);
}
@@ -1437,10 +1440,10 @@ void Room143::conv30() {
}
} else if (sound) {
if (who <= 0) {
- if (_val5 == 37 || _val5 == 31) {
- _val6 = 36;
- } else if (_val5 == 42 || _val5 == 43) {
- _val6 = 44;
+ if (_burlMode == 37 || _burlMode == 31) {
+ _burlShould = 36;
+ } else if (_burlMode == 42 || _burlMode == 43) {
+ _burlShould = 44;
}
_digiName = sound;
@@ -1472,7 +1475,7 @@ void Room143::talkToVera() {
void Room143::talkToBurl() {
conv_load_and_prepare("conv30", 11, 0);
- if (_val5 == 42 || _val5 == 43)
+ if (_burlMode == 42 || _burlMode == 43)
conv_export_value_curr(1, 0);
else
conv_export_value_curr(0, 0);
@@ -1496,7 +1499,7 @@ void Room143::playDigi1() {
digi_play(_digiName, 1, 255, _digiTrigger);
_digiName = nullptr;
- if (_val5 == 43)
+ if (_burlMode == 43)
digi_change_volume(2, 0);
}
}
diff --git a/engines/m4/burger/rooms/section1/room143.h b/engines/m4/burger/rooms/section1/room143.h
index 66725a73397..b22d3e6e789 100644
--- a/engines/m4/burger/rooms/section1/room143.h
+++ b/engines/m4/burger/rooms/section1/room143.h
@@ -54,12 +54,12 @@ private:
const char *_digiName = nullptr;
bool _flag1 = false;
int _frame = 0;
- int _val1 = 0;
- int _val2 = 0;
+ int _veraShould = 0;
+ int _veraMode = 0;
int _val3 = 0;
- int _val4 = 0;
- int _val5 = 0;
- int _val6 = 0;
+ int _catShould = 0;
+ int _burlMode = 0;
+ int _burlShould = 0;
KernelTriggerType _digiMode = (KernelTriggerType)0;
int _digiTrigger = 0;
Commit: 244f1d5201fcacb6427fe15f9a006ee9b4d22189
https://github.com/scummvm/scummvm/commit/244f1d5201fcacb6427fe15f9a006ee9b4d22189
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix talking to Burl at Vera's Diner
Changed paths:
engines/m4/burger/rooms/section1/room143.cpp
diff --git a/engines/m4/burger/rooms/section1/room143.cpp b/engines/m4/burger/rooms/section1/room143.cpp
index fee495a1621..90b3bfcd01c 100644
--- a/engines/m4/burger/rooms/section1/room143.cpp
+++ b/engines/m4/burger/rooms/section1/room143.cpp
@@ -343,6 +343,7 @@ void Room143::daemon() {
break;
case 19:
+ // Burl turns to talk to Wilbur
_burlShould = 37;
break;
@@ -846,6 +847,9 @@ void Room143::daemon() {
Series::series_play("143bu06", 0xa00, 0, kCHANGE_BURL_ANIMATION, 6, 0, 100, 0, 0, 0, 3);
break;
+ case 36:
+ case 37:
+ case 38:
case 39:
_burlMode = 37;
Series::series_play("143bu11", 0xa00, 0, kCHANGE_BURL_ANIMATION);
@@ -1159,8 +1163,10 @@ void Room143::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("conv35")) {
+ // Talking to Vera
conv35();
} else if (player_said("conv30")) {
+ // Talking to Burl
conv30();
} else if (money && lookFlag) {
wilbur_speech("143w030");
@@ -1174,7 +1180,7 @@ void Room143::parser() {
} else if (player_said("talk to", "vera")) {
talkToVera();
} else if (player_said("talk to", "burl")) {
- if (player_commands_allowed() || INTERFACE_VISIBLE) {
+ if (player_commands_allowed() || !INTERFACE_VISIBLE) {
talkToBurl();
if (_burlMode != 42 && _burlMode != 43) {
@@ -1437,6 +1443,7 @@ void Room143::conv30() {
conv_resume();
} else if (who == 1) {
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
+ conv_resume();
}
} else if (sound) {
if (who <= 0) {
Commit: b50aa37d96bc0dad7cccba6b4c393d3671ad1314
https://github.com/scummvm/scummvm/commit/b50aa37d96bc0dad7cccba6b4c393d3671ad1314
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup and fixes for room 106
Changed paths:
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 6c5c8a6f882..a102498f6e2 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -28,6 +28,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_DOG_ANIMATION = 3
+};
+
static const char *SAID[][4] = {
{ "GARBAGE CANS", "106w002", "106w003", nullptr },
{ "POLICE STATION", "106w004", "106w004z", "106w004z" },
@@ -58,13 +62,13 @@ const WilburMatch Room106::MATCH[] = {
};
const seriesPlayBreak Room106::PLAY1[] = {
- { 0, -1, "106d003a", 2, 255, -1, 0, 0, &_val3, 1 },
- { 0, -1, "106d003b", 2, 255, -1, 0, 0, &_val3, 2 },
- { 0, -1, "106d003c", 2, 255, -1, 0, 0, &_val3, 3 },
- { 0, -1, "106d003d", 2, 255, -1, 0, 0, &_val3, 4 },
- { 0, -1, "106d003e", 2, 255, -1, 0, 0, &_val3, 5 },
- { 0, -1, "106d003f", 2, 255, -1, 0, 0, &_val3, 6 },
- { 0, -1, "106d003g", 2, 255, -1, 0, 0, &_val3, 7 },
+ { 0, -1, "106d003a", 2, 255, -1, 0, 0, &_dogState, 1 },
+ { 0, -1, "106d003b", 2, 255, -1, 0, 0, &_dogState, 2 },
+ { 0, -1, "106d003c", 2, 255, -1, 0, 0, &_dogState, 3 },
+ { 0, -1, "106d003d", 2, 255, -1, 0, 0, &_dogState, 4 },
+ { 0, -1, "106d003e", 2, 255, -1, 0, 0, &_dogState, 5 },
+ { 0, -1, "106d003f", 2, 255, -1, 0, 0, &_dogState, 6 },
+ { 0, -1, "106d003g", 2, 255, -1, 0, 0, &_dogState, 7 },
PLAY_BREAK_END
};
@@ -74,54 +78,54 @@ const seriesPlayBreak Room106::PLAY2[] = {
};
const seriesPlayBreak Room106::PLAY3[] = {
- { 0, -1, "106d001a", 2, 255, -1, 0, -1, &_val3, 1 },
- { 0, -1, "106d001b", 2, 255, -1, 0, -1, &_val3, 2 },
- { 0, -1, "106d001c", 2, 255, -1, 0, -1, &_val3, 3 },
- { 0, -1, "106d001d", 2, 255, -1, 0, -1, &_val3, 4 },
- { 0, -1, "106d001e", 2, 255, -1, 0, -1, &_val3, 5 },
- { 0, -1, "106d001f", 2, 255, -1, 0, -1, &_val3, 6 },
+ { 0, -1, "106d001a", 2, 255, -1, 0, -1, &_dogState, 1 },
+ { 0, -1, "106d001b", 2, 255, -1, 0, -1, &_dogState, 2 },
+ { 0, -1, "106d001c", 2, 255, -1, 0, -1, &_dogState, 3 },
+ { 0, -1, "106d001d", 2, 255, -1, 0, -1, &_dogState, 4 },
+ { 0, -1, "106d001e", 2, 255, -1, 0, -1, &_dogState, 5 },
+ { 0, -1, "106d001f", 2, 255, -1, 0, -1, &_dogState, 6 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY4[] = {
- { 0, -1, "106d002a", 2, 255, -1, 0, -1, &_val3, 1 },
- { 0, -1, "106d002b", 2, 255, -1, 0, -1, &_val3, 2 },
- { 0, -1, "106d002c", 2, 255, -1, 0, -1, &_val3, 3 },
- { 0, -1, "106d002d", 2, 255, -1, 0, -1, &_val3, 4 },
- { 0, -1, "106d002e", 2, 255, -1, 0, -1, &_val3, 5 },
- { 0, -1, "106d002f", 2, 255, -1, 0, -1, &_val3, 6 },
- { 0, -1, "106d002g", 2, 255, -1, 0, -1, &_val3, 7 },
+ { 0, -1, "106d002a", 2, 255, -1, 0, -1, &_dogState, 1 },
+ { 0, -1, "106d002b", 2, 255, -1, 0, -1, &_dogState, 2 },
+ { 0, -1, "106d002c", 2, 255, -1, 0, -1, &_dogState, 3 },
+ { 0, -1, "106d002d", 2, 255, -1, 0, -1, &_dogState, 4 },
+ { 0, -1, "106d002e", 2, 255, -1, 0, -1, &_dogState, 5 },
+ { 0, -1, "106d002f", 2, 255, -1, 0, -1, &_dogState, 6 },
+ { 0, -1, "106d002g", 2, 255, -1, 0, -1, &_dogState, 7 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY5[] = {
- { 0, 4, "106d006a", 2, 255, -1, 0, 0, &_val3, 1 },
- { 0, 4, "106d006b", 2, 255, -1, 0, 0, &_val3, 2 },
- { 0, 4, "106d006c", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 0, 4, "106d006a", 2, 255, -1, 0, 0, &_dogState, 1 },
+ { 0, 4, "106d006b", 2, 255, -1, 0, 0, &_dogState, 2 },
+ { 0, 4, "106d006c", 2, 255, -1, 0, 0, &_dogState, 3 },
{ 5, -1, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY6[] = {
{ 0, 4, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
- { 5, -1, "106d007a", 2, 255, -1, 0, 0, &_val3, 1 },
- { 5, -1, "106d007b", 2, 255, -1, 0, 0, &_val3, 2 },
- { 5, -1, "106d007c", 2, 255, -1, 0, 0, &_val3, 3 },
+ { 5, -1, "106d007a", 2, 255, -1, 0, 0, &_dogState, 1 },
+ { 5, -1, "106d007b", 2, 255, -1, 0, 0, &_dogState, 2 },
+ { 5, -1, "106d007c", 2, 255, -1, 0, 0, &_dogState, 3 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY7[] = {
- { 0, -1, "106d005", 2, 255, -1, 0, 0, &_val3, 1 },
- { 0, -1, "106d005b", 2, 255, -1, 0, 0, &_val3, 2 },
- { 0, -1, "106d005c", 2, 255, -1, 0, 0, &_val3, 3 },
- { 0, -1, "106d005d", 2, 255, -1, 0, 0, &_val3, 4 },
- { 0, -1, "106d005e", 2, 255, -1, 0, 0, &_val3, 5 },
- { 0, -1, "106d005f", 2, 255, -1, 0, 0, &_val3, 6 },
+ { 0, -1, "106d005", 2, 255, -1, 0, 0, &_dogState, 1 },
+ { 0, -1, "106d005b", 2, 255, -1, 0, 0, &_dogState, 2 },
+ { 0, -1, "106d005c", 2, 255, -1, 0, 0, &_dogState, 3 },
+ { 0, -1, "106d005d", 2, 255, -1, 0, 0, &_dogState, 4 },
+ { 0, -1, "106d005e", 2, 255, -1, 0, 0, &_dogState, 5 },
+ { 0, -1, "106d005f", 2, 255, -1, 0, 0, &_dogState, 6 },
PLAY_BREAK_END
};
int32 Room106::_val1;
-int32 Room106::_val3;
+int32 Room106::_dogState;
void Room106::preload() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
@@ -129,7 +133,7 @@ void Room106::preload() {
}
void Room106::init() {
- _val3 = 0;
+ _dogState = 0;
digi_preload("100_001");
digi_preload("106_101");
@@ -143,12 +147,12 @@ void Room106::init() {
loadSeries();
if (_G(game).previous_room == -1) {
- _val2 = _G(flags)[V172] == 10023 ? 9 : 15;
+ _dogShould = _G(flags)[V172] == 10023 ? 9 : 15;
} else {
- _val2 = imath_ranged_rand(1, 2) == 1 ? 5 : 6;
+ _dogShould = imath_ranged_rand(1, 2) == 1 ? 5 : 6;
}
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
series_show("106gate", 0x4fd);
series_show("106gates", 0x4fe);
series_show("106tt", 0x600);
@@ -201,30 +205,30 @@ void Room106::daemon() {
}
break;
- case 3:
- switch (_val2) {
+ case kCHANGE_DOG_ANIMATION:
+ switch (_dogShould) {
case 5:
- _val3 = imath_ranged_rand(1, 7);
- _val2 = 7;
- series_play_with_breaks(PLAY1, "106dg01", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 7);
+ _dogShould = 7;
+ series_play_with_breaks(PLAY1, "106dg01", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 6:
- _val2 = 7;
- series_play_with_breaks(PLAY2, "106dg02", 0x501, 3, 3);
+ _dogShould = 7;
+ series_play_with_breaks(PLAY2, "106dg02", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 7:
- _val3 = imath_ranged_rand(1, 6);
- _val2 = _G(game).previous_room == 137 || _G(game).previous_room == 138 ? 9 : 8;
- series_play_with_breaks(PLAY3, "106dg04", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 6);
+ _dogShould = _G(game).previous_room == 137 || _G(game).previous_room == 138 ? 9 : 8;
+ series_play_with_breaks(PLAY3, "106dg04", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 8:
_val1 = 1;
ws_turn_to_face(calc_facing(415, 234), 2);
- _val2 = 9;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 9;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
break;
case 9:
@@ -232,75 +236,75 @@ void Room106::daemon() {
switch (imath_ranged_rand(1, 6)) {
case 1:
- _val2 = 10;
+ _dogShould = 10;
break;
case 2:
- _val2 = 11;
+ _dogShould = 11;
break;
case 3:
- _val2 = 12;
+ _dogShould = 12;
break;
default:
- _val2 = 9;
+ _dogShould = 9;
break;
}
- series_show("106dg07", 0x501, 0, 3, 120);
+ series_show("106dg07", 0x501, 0, kCHANGE_DOG_ANIMATION, 120);
series_show("106dg07s", 0x502, 0, -1, 120);
break;
case 10:
if (digi_play_state(1)) {
- _val2 = 9;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 9;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val3 = imath_ranged_rand(1, 7);
- _val2 = 9;
- series_play_with_breaks(PLAY4, "106dg05", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 7);
+ _dogShould = 9;
+ series_play_with_breaks(PLAY4, "106dg05", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 11:
if (digi_play_state(1)) {
- _val2 = 9;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 9;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val3 = imath_ranged_rand(1, 3);
- _val2 = 15;
- series_play_with_breaks(PLAY5, "106dg07", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 3);
+ _dogShould = 15;
+ series_play_with_breaks(PLAY5, "106dg07", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 12:
if (digi_play_state(1)) {
- _val2 = 9;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 9;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val3 = imath_ranged_rand(1, 6);
- _val2 = 9;
- series_play_with_breaks(PLAY3, "106dg04", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 6);
+ _dogShould = 9;
+ series_play_with_breaks(PLAY3, "106dg04", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 13:
if (digi_play_state(1)) {
- _val2 = 15;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 15;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val3 = imath_ranged_rand(1, 6);
- _val2 = 15;
- series_play_with_breaks(PLAY3, "106dg09", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 6);
+ _dogShould = 15;
+ series_play_with_breaks(PLAY3, "106dg09", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 14:
if (digi_play_state(1)) {
- _val2 = 15;
- kernel_trigger_dispatch_now(3);
+ _dogShould = 15;
+ kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
- _val3 = imath_ranged_rand(1, 3);
- _val2 = 9;
- series_play_with_breaks(PLAY6, "106dg11", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 3);
+ _dogShould = 9;
+ series_play_with_breaks(PLAY6, "106dg11", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
@@ -309,30 +313,30 @@ void Room106::daemon() {
switch (imath_ranged_rand(1, 4)) {
case 1:
- _val2 = 13;
+ _dogShould = 13;
break;
case 2:
- _val2 = 14;
+ _dogShould = 14;
break;
default:
- _val2 = 15;
+ _dogShould = 15;
break;
}
- series_show("106dg07", 0x501, 0, 3, 120, 8);
+ series_show("106dg07", 0x501, 0, kCHANGE_DOG_ANIMATION, 120, 8);
series_show("106dg07s", 0x502, 0, -1, 120, 8);
break;
case 16:
- _val3 = imath_ranged_rand(1, 6);
- _val2 = 11;
- series_play_with_breaks(PLAY7, "106dg06", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 6);
+ _dogShould = 11;
+ series_play_with_breaks(PLAY7, "106dg06", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 17:
- _val3 = imath_ranged_rand(1, 6);
- _val2 = 13;
- series_play_with_breaks(PLAY7, "106dg10", 0x501, 3, 3);
+ _dogState = imath_ranged_rand(1, 6);
+ _dogShould = 13;
+ series_play_with_breaks(PLAY7, "106dg10", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
default:
@@ -351,7 +355,7 @@ void Room106::daemon() {
break;
case 10008:
- _val2 = _G(flags)[V172] == 10023 ? 16 : 17;
+ _dogShould = _G(flags)[V172] == 10023 ? 16 : 17;
break;
default:
@@ -364,7 +368,7 @@ void Room106::pre_parser() {
if (player_said("SKY"))
player_set_facing_hotspot();
- if (player_said("MAIN STREET") && player_said_any("GEAR", "LOOK AT")) {
+ if (player_said("MAIN STREET") && !player_said_any("GEAR", "LOOK AT")) {
player_set_facing_at(-40, 317);
}
}
@@ -372,14 +376,16 @@ void Room106::pre_parser() {
void Room106::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
- if (!_G(walker).wilbur_said(SAID)) {
- if (player_said_any("GEAR", "LOOK AT") && player_said("MAIN STREET")) {
- disable_player_commands_and_fade_init(1001);
- _G(player).command_ready = false;
- } else if (_G(walker).wilbur_match(MATCH)) {
- _G(player).command_ready = false;
- }
+ if (_G(walker).wilbur_said(SAID)) {
+ // Already handled
+ } else if (player_said_any("GEAR", "LOOK AT") && player_said("MAIN STREET")) {
+ disable_player_commands_and_fade_init(1001);
+ _G(player).command_ready = false;
+ } else if (!_G(walker).wilbur_match(MATCH)) {
+ return;
}
+
+ _G(player).command_ready = false;
}
void Room106::setHotspots() {
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index 72b9d1aca72..5f76349e58b 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -41,8 +41,8 @@ class Room106 : public Room {
private:
const char *_digi1 = nullptr;
static int32 _val1;
- int _val2 = 0;
- static int32 _val3;
+ int _dogShould = 0;
+ static int32 _dogState;
void setHotspots();
void loadSeries();
Commit: de85af4df14f965ed9093e00a1d861e0b7376d97
https://github.com/scummvm/scummvm/commit/de85af4df14f965ed9093e00a1d861e0b7376d97
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup for being thrown in jail
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room106.h
engines/m4/burger/vars.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index a973e07c97c..c0f4062bf6f 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -350,7 +350,7 @@ void BurgerEngine::global_daemon() {
_G(walker).wilbur_unpoof();
break;
- case 10022:
+ case kAbduction:
if (_G(game).room_id < 200) {
_G(wilbur_should) = 10017;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
@@ -359,18 +359,18 @@ void BurgerEngine::global_daemon() {
}
break;
- case 10023:
+ case kTestTimeout:
if (_G(game).room_id < 700) {
_G(wilbur_should) = 10018;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
- case kTELEPROTED1:
- disable_player_commands_and_fade_init(kTELEPROTED2);
+ case kTELEPORTED1:
+ disable_player_commands_and_fade_init(kTELEPORTED2);
break;
- case kTELEPROTED2:
+ case kTELEPORTED2:
testDone();
break;
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 8641857efba..ae6d914f3e5 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -45,12 +45,12 @@ static const BoonsvilleEvent EVENTS[] = {
{ 22800, -1, "After getting logic stuff" },
{ 15000, kBurlLeavesTown, "Burl leaves town" },
{ 18600, kBandEntersTown, "Band enters town" },
- { 33600, 10022, "Abduction time" },
- { 55200, 10023, "Nero timeout" },
- { 166800, 10023, "Survival timeout" },
- { 278400, 10023, "Sensory timeout" },
- { 390000, 10023, "Language timeout" },
- { 501600, 10023, "Logic timeout" },
+ { 33600, kAbduction, "Abduction time" },
+ { 55200, kTestTimeout, "Nero timeout" },
+ { 166800, kTestTimeout, "Survival timeout" },
+ { 278400, kTestTimeout, "Sensory timeout" },
+ { 390000, kTestTimeout, "Language timeout" },
+ { 501600, kTestTimeout, "Logic timeout" },
{ 505200, 10033, "Conclusion" },
{ 0, 0, nullptr }
};
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index a102498f6e2..1066ba13c53 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -29,7 +29,10 @@ namespace Burger {
namespace Rooms {
enum {
- kCHANGE_DOG_ANIMATION = 3
+ kWILBUR_SPEECH = 2,
+ kCHANGE_DOG_ANIMATION = 3,
+ kWILBUR_ARRESTED1 = 4,
+ kWILBUR_ARRESTED2 = 5
};
static const char *SAID[][4] = {
@@ -55,9 +58,9 @@ static const char *SAID[][4] = {
};
const WilburMatch Room106::MATCH[] = {
- { "JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_val1, 2 },
- { "JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_val1, 2 },
- { "JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_val1, 2 },
+ { "JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_speechNum, 2 },
+ { "JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_speechNum, 2 },
+ { "JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_speechNum, 2 },
WILBUR_MATCH_END
};
@@ -124,7 +127,7 @@ const seriesPlayBreak Room106::PLAY7[] = {
PLAY_BREAK_END
};
-int32 Room106::_val1;
+int32 Room106::_speechNum;
int32 Room106::_dogState;
void Room106::preload() {
@@ -141,7 +144,7 @@ void Room106::init() {
kernel_trigger_dispatch_now(1);
player_set_commands_allowed(false);
- _val1 = 0;
+ _speechNum = 0;
setHotspots();
loadSeries();
@@ -165,7 +168,8 @@ void Room106::init() {
break;
case 138:
- digi_play("106_102", 1, 255, 4);
+ // Wilbur was arrested
+ digi_play("106_102", 1, 255, kWILBUR_ARRESTED1);
break;
case KERNEL_RESTORING_GAME:
@@ -186,7 +190,7 @@ void Room106::daemon() {
break;
case 2:
- switch (_val1) {
+ switch (_speechNum) {
case 1:
player_set_commands_allowed(true);
_G(walker).wilbur_speech_random("106w001a", "106w001b", "106w001c");
@@ -195,10 +199,10 @@ void Room106::daemon() {
wilbur_speech("106w014");
break;
case 3:
- wilbur_speech("106w501", 5);
+ wilbur_speech("106w501", kWILBUR_ARRESTED2);
break;
case 4:
- wilbur_speech("106w500", 10022);
+ wilbur_speech("106w500", kAbduction);
break;
default:
break;
@@ -225,7 +229,7 @@ void Room106::daemon() {
break;
case 8:
- _val1 = 1;
+ _speechNum = 1;
ws_turn_to_face(calc_facing(415, 234), 2);
_dogShould = 9;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
@@ -344,14 +348,14 @@ void Room106::daemon() {
}
break;
- case 4:
- _val1 = 3;
- digi_play("106s001", 1, 255, 2);
+ case kWILBUR_ARRESTED1:
+ _speechNum = 3;
+ digi_play("106s001", 1, 255, kWILBUR_SPEECH);
break;
- case 5:
- _val1 = 4;
- digi_play("106_103", 1, 255, 2);
+ case kWILBUR_ARRESTED2:
+ _speechNum = 4;
+ digi_play("106_103", 1, 255, kWILBUR_SPEECH);
break;
case 10008:
diff --git a/engines/m4/burger/rooms/section1/room106.h b/engines/m4/burger/rooms/section1/room106.h
index 5f76349e58b..780c969bd89 100644
--- a/engines/m4/burger/rooms/section1/room106.h
+++ b/engines/m4/burger/rooms/section1/room106.h
@@ -40,7 +40,7 @@ class Room106 : public Room {
static const seriesPlayBreak PLAY7[];
private:
const char *_digi1 = nullptr;
- static int32 _val1;
+ static int32 _speechNum;
int _dogShould = 0;
static int32 _dogState;
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 1c3833f9c60..4db3663c017 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -65,8 +65,10 @@ enum global_triggers {
kPOOF = 10019,
kSET_COMMANDS_ALLOWED = 10020,
kUNPOOF = 10021,
- kTELEPROTED1 = 10024,
- kTELEPROTED2 = 10025,
+ kAbduction = 10022,
+ kTestTimeout = 10023,
+ kTELEPORTED1 = 10024,
+ kTELEPORTED2 = 10025,
k10027 = 10027,
kBurlEntersTown = 10028,
kBurlGetsFed = 10029,
Commit: 5cddf0514122170d7db44f62c449e47069c0da27
https://github.com/scummvm/scummvm/commit/5cddf0514122170d7db44f62c449e47069c0da27
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix getting arrested for stealing police keys
Changed paths:
engines/m4/burger/flags.cpp
engines/m4/burger/flags.h
engines/m4/burger/rooms/section1/room101.cpp
engines/m4/burger/rooms/section1/room106.cpp
engines/m4/burger/rooms/section1/room137.cpp
engines/m4/burger/rooms/section1/room137.h
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/console.cpp
engines/m4/console.h
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index ae6d914f3e5..f4a3e27c349 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -180,8 +180,8 @@ void Flags::reset1() {
(*this)[V039] = 0;
(*this)[kRoadOpened] = 0;
(*this)[V046] = 0;
- (*this)[V047] = 0;
- (*this)[V048] = 0;
+ (*this)[kPoliceState] = 0;
+ (*this)[kPoliceCheckCtr] = 0;
(*this)[V049] = 0;
inv_move_object("jawz o' life", 137);
diff --git a/engines/m4/burger/flags.h b/engines/m4/burger/flags.h
index ee91f1c397a..a5fec751d84 100644
--- a/engines/m4/burger/flags.h
+++ b/engines/m4/burger/flags.h
@@ -79,8 +79,8 @@ enum {
V044 = 44,
V045 = 45,
V046 = 46,
- V047 = 47,
- V048 = 48,
+ kPoliceState = 47,
+ kPoliceCheckCtr = 48,
V049 = 49,
V050 = 50,
V051 = 51,
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 0e1a3b7964a..98adf686a0a 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -844,8 +844,8 @@ void Room101::daemon20() {
_G(flags)[V046] = 0;
}
- _G(flags)[V047] = 0;
- _G(flags)[V048] = 0;
+ _G(flags)[kPoliceState] = 0;
+ _G(flags)[kPoliceCheckCtr] = 0;
_G(flags).set_boonsville_time(22800);
}
diff --git a/engines/m4/burger/rooms/section1/room106.cpp b/engines/m4/burger/rooms/section1/room106.cpp
index 1066ba13c53..8aaed7f35a0 100644
--- a/engines/m4/burger/rooms/section1/room106.cpp
+++ b/engines/m4/burger/rooms/section1/room106.cpp
@@ -167,6 +167,7 @@ void Room106::init() {
ws_walk(62, 340, nullptr, 0);
break;
+ case 137:
case 138:
// Wilbur was arrested
digi_play("106_102", 1, 255, kWILBUR_ARRESTED1);
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 31c9f8ef9a5..41e4c2d7ee3 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -30,7 +30,8 @@ namespace Rooms {
enum {
kCHANGE_SHERRIF_ANIMATION = 1,
- kCHANGE_DEPUTY_ANIMATION = 2
+ kCHANGE_DEPUTY_ANIMATION = 2,
+ kSOMEONE_TOOK_KEYS = 4
};
static const char *SAID[][4] = {
@@ -83,12 +84,12 @@ void Room137::init() {
_volume = 255;
_flag1 = true;
_flag2 = false;
- _flag3 = false;
+ _arrested = false;
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
- if (_G(flags)[V048])
- _G(flags)[V048] = 1;
+ if (_G(flags)[kPoliceCheckCtr])
+ _G(flags)[kPoliceCheckCtr] = 1;
break;
case 136:
@@ -100,7 +101,7 @@ void Room137::init() {
case 138:
ws_demand_facing(2);
- if (_G(flags)[V048] >= 200) {
+ if (_G(flags)[kPoliceCheckCtr] >= 200) {
ws_demand_location(264, 347);
_flag1 = false;
digi_preload("137_003");
@@ -112,8 +113,8 @@ void Room137::init() {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
- if (_G(flags)[V048] < 200 && _G(flags)[V048] && _G(flags)[V047] == 4)
- _G(flags)[V047] = 5;
+ if (_G(flags)[kPoliceCheckCtr] < 200 && _G(flags)[kPoliceCheckCtr] && _G(flags)[kPoliceState] == 4)
+ _G(flags)[kPoliceState] = 5;
break;
default:
@@ -132,7 +133,7 @@ void Room137::init() {
for (int i = 0; i < 18; ++i)
digi_preload(NAMES[i]);
- if (inv_object_in_scene("keys", 138) && _G(flags)[V047] != 2) {
+ if (inv_object_in_scene("keys", 138) && _G(flags)[kPoliceState] != 2) {
digi_preload("137_001");
digi_play_loop("137_001", 3);
} else {
@@ -140,10 +141,10 @@ void Room137::init() {
digi_play_loop("137_002", 3);
}
- if (_G(flags)[V048] < 200) {
+ if (_G(flags)[kPoliceCheckCtr] < 200) {
_deputyShould = 27;
} else {
- _deputyShould = _G(flags)[V047] == 2 || _G(flags)[V047] == 3 || _G(flags)[V047] == 4 ? 34 : 27;
+ _deputyShould = _G(flags)[kPoliceState] == 2 || _G(flags)[kPoliceState] == 3 || _G(flags)[kPoliceState] == 4 ? 34 : 27;
digi_play("137_003", 1);
}
@@ -192,7 +193,7 @@ void Room137::daemon() {
break;
case 12:
- sub2();
+ startPoliceTalk();
_sherrifShould = 22;
_sherrifMode = 10;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
@@ -204,7 +205,7 @@ void Room137::daemon() {
break;
case 15:
- sub2();
+ startPoliceTalk();
_sherrifMode = 14;
_sherrifShould = 22;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
@@ -226,7 +227,7 @@ void Room137::daemon() {
break;
case 20:
- sub2();
+ startPoliceTalk();
_sherrifShould = 22;
_sherrifMode = 17;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
@@ -327,7 +328,7 @@ void Room137::daemon() {
case 27:
switch (_deputyShould) {
case 27:
- sub1();
+ movementCheck();
kernel_timing_trigger(10, kCHANGE_DEPUTY_ANIMATION);
break;
@@ -344,7 +345,7 @@ void Room137::daemon() {
break;
case 34:
- sub1();
+ movementCheck();
_deputyShould = 29;
series_play("137dp01", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 6, 6);
break;
@@ -387,14 +388,14 @@ void Room137::daemon() {
ws_walk(276, 292, 0, -1, 4);
break;
- case 4:
+ case kSOMEONE_TOOK_KEYS:
digi_play("137_014", 2, 200, 5);
break;
case 5:
unloadAssets();
- if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] == 4)
+ if (_G(flags)[kPoliceState] != 2 && _G(flags)[kPoliceState] != 3 && _G(flags)[kPoliceState] == 4)
_deputyShould = 30;
_sherrifMode = 5;
@@ -419,7 +420,7 @@ void Room137::daemon() {
if (_G(player_info).y < 308)
_sherrifShould = 10;
- if (_G(flags)[V047] != 2 && _G(flags)[V047] != 3 && _G(flags)[V047] != 4)
+ if (_G(flags)[kPoliceState] != 2 && _G(flags)[kPoliceState] != 3 && _G(flags)[kPoliceState] != 4)
_deputyShould = 30;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
@@ -517,13 +518,15 @@ void Room137::daemon() {
break;
case 15:
- if (_flag3) {
+ if (_arrested) {
+ // Arrested
inv_move_object("keys", 138);
inv_move_object("jawz o' life", 137);
_G(flags)[V046] = 0;
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1006);
} else {
+ // Just sent off
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
}
break;
@@ -748,7 +751,7 @@ void Room137::conv15() {
} else if (conv_sound_to_play()) {
if (who <= 0) {
if (node == 3 || node == 9 || node == 12 || node == 13 || node == 19 || node == 11)
- _flag3 = true;
+ _arrested = true;
_sherrifShould = (node == 20 && entry == 1) || (node == 21 && entry == 1) ? 24 : 23;
_digi1 = conv_sound_to_play();
@@ -788,28 +791,28 @@ void Room137::jawz() {
}
}
-void Room137::sub1() {
- if (_G(flags)[V048] && player_commands_allowed()) {
- ++_G(flags)[V048];
+void Room137::movementCheck() {
+ if (_G(flags)[kPoliceCheckCtr] && player_commands_allowed()) {
+ ++_G(flags)[kPoliceCheckCtr];
player_update_info();
if (_G(player_info).y < 300 && inv_player_has("keys")) {
- _G(flags)[V047] = 6;
- _G(flags)[V048] = 201;
+ _G(flags)[kPoliceState] = 6;
+ _G(flags)[kPoliceCheckCtr] = 201;
}
if (_G(player_info).y < 308 && _G(flags)[V046])
- _G(flags)[V048] = 201;
+ _G(flags)[kPoliceCheckCtr] = 201;
- if (_G(flags)[V048] >= 200) {
+ if (_G(flags)[kPoliceCheckCtr] >= 200) {
player_set_commands_allowed(false);
intr_freshen_sentence();
- _G(flags)[V048] = 0;
+ _G(flags)[kPoliceCheckCtr] = 0;
_flag1 = false;
- if (_G(flags)[V042] == 6) {
+ if (_G(flags)[kPoliceState] == 6) {
kernel_timing_trigger(100, 3);
- digi_play("137_013", 2, 200, 4);
+ digi_play("137_013", 2, 200, kSOMEONE_TOOK_KEYS);
} else if (_G(player_info).x > 460) {
ws_walk(307, 349, nullptr, -1, 2);
@@ -819,8 +822,8 @@ void Room137::sub1() {
} else {
digi_play("137_013", 2, 200, 7);
}
- } else if (_G(flags)[V047] == 1 || _G(flags)[V047] == 2 ||
- _G(flags)[V047] == 3 || _G(flags)[V047] == 4) {
+ } else if (_G(flags)[kPoliceState] == 1 || _G(flags)[kPoliceState] == 2 ||
+ _G(flags)[kPoliceState] == 3 || _G(flags)[kPoliceState] == 4) {
kernel_timing_trigger(30, 7);
} else {
digi_play("137_013", 2, 200, 7);
@@ -833,10 +836,10 @@ void Room137::sub1() {
}
}
-void Room137::sub2() {
+void Room137::startPoliceTalk() {
conv_load_and_prepare("conv15", 15);
- switch (_G(flags)[V047]) {
+ switch (_G(flags)[kPoliceState]) {
case 1:
conv_export_value_curr(0, 0);
break;
@@ -850,6 +853,9 @@ void Room137::sub2() {
case 5:
conv_export_value_curr(2, 0);
break;
+ case 6:
+ conv_export_value_curr(3, 0);
+ break;
default:
break;
}
diff --git a/engines/m4/burger/rooms/section1/room137.h b/engines/m4/burger/rooms/section1/room137.h
index 0e67580e4d0..b54e93d2422 100644
--- a/engines/m4/burger/rooms/section1/room137.h
+++ b/engines/m4/burger/rooms/section1/room137.h
@@ -32,7 +32,7 @@ class Room137 : public Room {
private:
bool _flag1 = false;
bool _flag2 = false;
- bool _flag3 = false;
+ bool _arrested = false;
int _volume = 255;
int _deputyShould = 0;
int _deputyMode = 0;
@@ -46,8 +46,8 @@ private:
void conv15();
void unloadAssets();
void jawz();
- void sub1();
- void sub2();
+ void movementCheck();
+ void startPoliceTalk();
public:
Room137() : Room() {}
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 13734a2e490..0dfefad84df 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -98,8 +98,8 @@ void Room138::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
- if (_G(flags)[V048])
- _G(flags)[V048] = 1;
+ if (_G(flags)[kPoliceCheckCtr])
+ _G(flags)[kPoliceCheckCtr] = 1;
break;
default:
@@ -270,9 +270,9 @@ void Room138::daemon() {
kernel_timing_trigger(120, 7);
if (!inv_object_is_here("keys"))
- _G(flags)[V047] = 6;
+ _G(flags)[kPoliceState] = 6;
- _G(flags)[V048] = 200;
+ _G(flags)[kPoliceCheckCtr] = 200;
_val5 = 31;
kernel_trigger_dispatch_now(2);
break;
@@ -287,9 +287,9 @@ void Room138::daemon() {
kernel_timing_trigger(120, 7);
if (inv_object_is_here("keys"))
- _G(flags)[V047] = 6;
+ _G(flags)[kPoliceState] = 6;
- _G(flags)[V048] = 200;
+ _G(flags)[kPoliceCheckCtr] = 200;
_val5 = 33;
kernel_trigger_dispatch_now(2);
break;
@@ -565,11 +565,11 @@ void Room138::daemon() {
case 10:
digi_play_loop("138_002", 3, 255);
- _G(flags)[V047] = 4;
+ _G(flags)[kPoliceState] = 4;
inv_give_to_player("keys");
hotspot_set_active("keys", false);
hotspot_set_active("ignition switch", true);
- _G(flags)[V048]++;
+ _G(flags)[kPoliceCheckCtr]++;
kernel_timing_trigger(10, 13);
break;
@@ -577,8 +577,8 @@ void Room138::daemon() {
digi_preload("138_001");
digi_play_loop("138_001", 3, 255);
_series1 = series_play("138keys", 0xa00, 0, -1, 7, -1, 100, 0, 0, 0, 0);
- _G(flags)[V047] = 0;
- _G(flags)[V048] = 0;
+ _G(flags)[kPoliceState] = 0;
+ _G(flags)[kPoliceCheckCtr] = 0;
inv_move_object("keys", 138);
hotspot_set_active("keys", true);
hotspot_set_active("ignition switch", false);
@@ -589,10 +589,10 @@ void Room138::daemon() {
break;
case 13:
- if (_G(flags)[V048] && player_commands_allowed()) {
- if (++_G(flags)[V048] >= 200) {
+ if (_G(flags)[kPoliceCheckCtr] && player_commands_allowed()) {
+ if (++_G(flags)[kPoliceCheckCtr] >= 200) {
player_set_commands_allowed(false);
- _G(flags)[V047] = 4;
+ _G(flags)[kPoliceState] = 4;
_val6 = 33;
_val3 = 23;
}
@@ -636,21 +636,21 @@ void Room138::parser() {
} else if (player_said("gear", "horn")) {
player_set_commands_allowed(false);
- _G(flags)[V047] = 1;
+ _G(flags)[kPoliceState] = 1;
_val8 = 10;
} else if (player_said("gear", "radio")) {
player_set_commands_allowed(false);
if (inv_object_is_here("keys"))
- _G(flags)[V047] = 2;
+ _G(flags)[kPoliceState] = 2;
_val8 = 11;
} else if (player_said("talk to") &&
(player_said("sherrif") || player_said("deputy"))) {
player_set_commands_allowed(false);
- _G(flags)[V047] = 3;
+ _G(flags)[kPoliceState] = 3;
wilbur_speech("138w610");
_val8 = 15;
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 8d0b9f9c575..fe6f5a47271 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -30,6 +30,7 @@ Console::Console() : GUI::Debugger() {
registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
registerCmd("item", WRAP_METHOD(Console, cmdItem));
registerCmd("hyperwalk", WRAP_METHOD(Console, cmdHyperwalk));
+ registerCmd("digi", WRAP_METHOD(Console, cmdDigi));
}
Console::~Console() {
@@ -85,4 +86,16 @@ bool Console::cmdHyperwalk(int argc, const char **argv) {
return true;
}
+bool Console::cmdDigi(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("digi <sound name>\n");
+ return true;
+ } else {
+ digi_play(argv[1], 1);
+ return false;
+ }
+
+ return true;
+}
+
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index b39b9d21343..da42ee635ab 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -34,6 +34,7 @@ private:
bool cmdGlobal(int argc, const char **argv);
bool cmdItem(int argc, const char **argv);
bool cmdHyperwalk(int argc, const char **argv);
+ bool cmdDigi(int argc, const char **argv);
public:
Console();
Commit: 5fa0e32e427e4a639199eee41af8874e97fafc12
https://github.com/scummvm/scummvm/commit/5fa0e32e427e4a639199eee41af8874e97fafc12
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Setup character enums for room 138
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
engines/m4/burger/rooms/section1/room138.h
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index 0dfefad84df..dcd18786af1 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -28,6 +28,12 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_DEPUTY_ANIMATION = 1,
+ kCHANGE_SHERRIF_ANIMATION = 2,
+ kCHANGE_WILBUR_ANIMATION = 3
+};
+
static const char *SAID[][4] = {
{ "DONUTS", "138W002", "138W003", "138W003" },
{ "IGNITION SWITCH", "138W006", "138W007", "138W006" },
@@ -123,16 +129,16 @@ void Room138::init() {
}
_frame = 22;
- _val2 = 18;
- _val3 = 18;
+ _deputyMode = 18;
+ _deputyShould = 18;
kernel_trigger_dispatch_now(1);
_val4 = -1;
- _val5 = 26;
- _val6 = 26;
- kernel_trigger_dispatch_now(2);
- _val7 = 2;
- _val8 = 1;
- kernel_trigger_dispatch_now(3);
+ _sherrifMode = 26;
+ _sherrifShould = 26;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
+ _wilburMode = 2;
+ _wilburShould = 1;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_series2 = series_play("138donut", 0x400, 0, -1, 7, -1, 100, 0, 0, 0, 0);
if (!inv_object_is_here("keys"))
@@ -150,37 +156,37 @@ void Room138::daemon() {
int frame;
switch (_G(kernel).trigger) {
- case 1:
- switch (_val2) {
+ case kCHANGE_DEPUTY_ANIMATION:
+ switch (_deputyMode) {
case 18:
- switch (_val3) {
+ switch (_deputyShould) {
case 18:
case 23:
case 25:
- if (_val3 == 23 && _frame == 42) {
+ if (_deputyShould == 23 && _frame == 42) {
freeAssets();
- _val2 = 23;
- series_play("138cp06", 0x500, 0, 1, 7, 0, 100, 0, 0, 30, 45);
+ _deputyMode = 23;
+ series_play("138cp06", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 30, 45);
- } else if (_val3 == 25 && _frame == 42) {
- _val3 = 18;
- series_play("138cp02", 0x500, 0, 1, 7, 0, 100, 0, 0, 31, 61);
+ } else if (_deputyShould == 25 && _frame == 42) {
+ _deputyShould = 18;
+ series_play("138cp02", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 31, 61);
} else if (_frame == 42 && imath_ranged_rand(1, 5) != 1) {
- series_play("138cp01", 0x500, 0, 1, 60, 0, 100, 0, 0, 23, 23);
+ series_play("138cp01", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 23, 23);
} else {
if (++_frame == 43)
_frame = 23;
- series_play("138cp01", 0x500, 0, 1, 7, 0, 100, 0, 0, _frame, _frame);
+ series_play("138cp01", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, _frame, _frame);
}
break;
case 22:
freeAssets();
- _val2 = 22;
- series_play("138cp04", 0x500, 0, 1, 7, 0, 100, 0, 0, 10, 16);
+ _deputyMode = 22;
+ series_play("138cp04", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 10, 16);
break;
default:
@@ -190,15 +196,15 @@ void Room138::daemon() {
case 22:
if (imath_ranged_rand(1, 10) == 1) {
- series_play("138cp04", 0x500, 1, 1, 7, 0, 100, 0, 0, 16, 18);
+ series_play("138cp04", 0x500, 1, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 16, 18);
} else {
- series_play("138cp04", 0x500, 0, 1, 10, 0, 100, 0, 0, 16, 16);
+ series_play("138cp04", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 16, 16);
}
break;
case 23:
- _val2 = 24;
- series_play("138cp06", 0500, 0, 1, 6, 0, 100, 0, 0, 46, 49);
+ _deputyMode = 24;
+ series_play("138cp06", 0500, 0, kCHANGE_DEPUTY_ANIMATION, 6, 0, 100, 0, 0, 46, 49);
digi_play("138_004", 1, 255);
break;
@@ -211,33 +217,33 @@ void Room138::daemon() {
}
break;
- case 2:
- switch (_val5) {
+ case kCHANGE_SHERRIF_ANIMATION:
+ switch (_sherrifMode) {
case 26:
- switch (_val6) {
+ switch (_sherrifShould) {
case 26:
case 33:
case 36:
- if (_val6 == 33 && _val4 == 22) {
+ if (_sherrifShould == 33 && _val4 == 22) {
freeAssets();
term_message("xxx");
- _val6 = 34;
- series_play("138cp06", 0x100, 0, 2, 8, 0, 100, 0, 0, 0, 18);
+ _sherrifShould = 34;
+ series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 18);
digi_play("138_005", 2);
- } else if (_val6 == 36 && _val4 == 22) {
- _val6 = 26;
- series_play("138cp02", 0x100, 0, 2, 8, 0, 100, 0, 0, 0, 30);
+ } else if (_sherrifShould == 36 && _val4 == 22) {
+ _sherrifShould = 26;
+ series_play("138cp02", 0x100, 0, kTestTimeout, 8, 0, 100, 0, 0, 0, 30);
randomDigi();
} else if (_val4 == 22 && !inv_object_is_here("keys") &&
imath_ranged_rand(1, 2) == 1) {
term_message(".........................");
- _val6 = 37;
- series_play("138cp02", 0x100, 2, 2, 8, 0, 100, 0, 0, 25, 30);
+ _sherrifShould = 37;
+ series_play("138cp02", 0x100, 2, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 25, 30);
} else if (_val4 == 22 && imath_ranged_rand(1, 6) != 1) {
- series_play("138cp01", 0x100, 0, 2, 60, 0, 100, 0, 0, 0, 0);
+ series_play("138cp01", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
} else {
_flag1 = false;
@@ -256,14 +262,14 @@ void Room138::daemon() {
break;
}
- series_play("138cp01", 0x100, 0, 2, 7, 0, 100, 0, 0, _val4, _val4);
+ series_play("138cp01", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, _val4, _val4);
}
break;
case 31:
freeAssets();
- _val6 = 32;
- series_play("138cp04", 0x100, 0, 2, 7, 0, 100, 0, 0, 0, 7);
+ _sherrifShould = 32;
+ series_play("138cp04", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 0, 7);
break;
case 32:
@@ -273,14 +279,14 @@ void Room138::daemon() {
_G(flags)[kPoliceState] = 6;
_G(flags)[kPoliceCheckCtr] = 200;
- _val5 = 31;
- kernel_trigger_dispatch_now(2);
+ _sherrifMode = 31;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 34:
terminateMachineAndNull(_series2);
- _val6 = 35;
- series_play("138cp06", 0x100, 0, 2, 8, 0, 100, 0, 0, 19, 29);
+ _sherrifShould = 35;
+ series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 19, 29);
break;
case 35:
@@ -290,19 +296,19 @@ void Room138::daemon() {
_G(flags)[kPoliceState] = 6;
_G(flags)[kPoliceCheckCtr] = 200;
- _val5 = 33;
- kernel_trigger_dispatch_now(2);
+ _sherrifMode = 33;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 37:
- _val6 = 38;
- series_play("138cp02", 0x100, 2, 2, 8, 0, 100, 0, 0, 10, 24);
+ _sherrifShould = 38;
+ series_play("138cp02", 0x100, 2, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 10, 24);
randomDigi();
break;
case 38:
- _val6 = 26;
- series_play("138cp02", 0x100, 0, 2, 8, 0, 100, 0, 0, 26, 30);
+ _sherrifShould = 26;
+ series_play("138cp02", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 26, 30);
_flag1 = true;
break;
@@ -313,41 +319,41 @@ void Room138::daemon() {
case 31:
if (imath_ranged_rand(1, 10) == 1) {
- series_play("138cp04", 0x100, 1, 2, 7, 0, 100, 0, 0, 7, 9);
+ series_play("138cp04", 0x100, 1, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 7, 9);
} else {
- series_play("138cp04", 0x100, 0, 2, 10, 0, 100, 0, 0, 7, 7);
+ series_play("138cp04", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 7, 7);
}
break;
case 33:
if (imath_ranged_rand(1, 10) == 1) {
- series_play("138cp06", 0x100, 1, 2, 7, 0, 100, 0, 0, 27, 29);
+ series_play("138cp06", 0x100, 1, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 27, 29);
} else {
- series_play("138cp06", 0x100, 0, 2, 10, 0, 100, 0, 0, 27, 27);
+ series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 27, 27);
}
break;
}
break;
- case 3:
- switch (_val7) {
+ case kCHANGE_WILBUR_ANIMATION:
+ switch (_wilburMode) {
case 2:
- switch (_val8) {
+ switch (_wilburShould) {
case 1:
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val7 = 3;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 3);
+ _wilburMode = 3;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
break;
case 2:
- _val7 = 6;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 17, 17);
+ _wilburMode = 6;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 17, 17);
break;
default:
- series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 0, 0);
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 0, 0);
break;
}
break;
@@ -355,73 +361,73 @@ void Room138::daemon() {
case 7:
series_load("138wi03");
digi_preload("138_002");
- _val8 = 8;
- series_play("138wi05", 0xa00, 0, 3, 6, 0, 100, 0, 0, 0, 11);
+ _wilburShould = 8;
+ series_play("138wi05", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
break;
case 8:
- _val8 = 9;
- series_play_with_breaks(PLAY1, "138wi03", 0xa00, 3, 2, 6, 100, 0, 0);
+ _wilburShould = 9;
+ series_play_with_breaks(PLAY1, "138wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 9:
player_set_commands_allowed(true);
- _val8 = 1;
- kernel_trigger_dispatch_now(3);
- _val3 = 25;
- _val6 = 36;
+ _wilburShould = 1;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
+ _deputyShould = 25;
+ _sherrifShould = 36;
break;
case 10:
- _val8 = 1;
- series_play_with_breaks(PLAY2, "138wi05", 0xa00, 3, 2, 6, 100, 0, 0);
+ _wilburShould = 1;
+ series_play_with_breaks(PLAY2, "138wi05", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 11:
series_load("138wi06");
digi_preload("138_002");
- _val8 = 12;
- series_play("138wi05", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 11);
+ _wilburShould = 12;
+ series_play("138wi05", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
break;
case 12:
- _val8 = 13;
- series_play_with_breaks(PLAY3, "138wi06", 0xa00, 3, 2, 6, 100, 0, 0);
+ _wilburShould = 13;
+ series_play_with_breaks(PLAY3, "138wi06", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 13:
- _val8 = 14;
- series_play("138wi05", 0xa00, 2, 3, 7, 0, 100, 0, 0, 0, 11);
+ _wilburShould = 14;
+ series_play("138wi05", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
break;
case 14:
- _val8 = 1;
- kernel_trigger_dispatch_now(3);
+ _wilburShould = 1;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
if (inv_object_is_here("keys")) {
- _val6 = 33;
- _val3 = 23;
+ _sherrifShould = 33;
+ _deputyShould = 23;
} else {
player_set_commands_allowed(true);
}
break;
case 15:
- _val7 = 15;
+ _wilburMode = 15;
_G(walker).wilbur_say();
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 16:
series_load("138wi03");
digi_preload("138_001");
- _val8 = 17;
- series_play_with_breaks(PLAY4, "138wi03", 0xa00, 3, 2, 6, 100, 0, 0);
+ _wilburShould = 17;
+ series_play_with_breaks(PLAY4, "138wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 17:
- _val8 = 9;
- series_play("138wi05", 0xa00, 2, 3, 6, 0, 100, 0, 0, 0, 11);
+ _wilburShould = 9;
+ series_play("138wi05", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
break;
default:
@@ -430,108 +436,108 @@ void Room138::daemon() {
break;
case 3:
- if (_val8 == 1) {
+ if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val7 = 2;
- series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 0, 3);
+ _wilburMode = 2;
+ series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
break;
case 2:
- _val7 = 4;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 4, 9);
+ _wilburMode = 4;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
break;
default:
- series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 3, 3);
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 3, 3);
break;
}
} else {
- _val7 = 4;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 4, 9);
+ _wilburMode = 4;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
}
break;
case 4:
- if (_val8 == 1) {
+ if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val7 = 3;
- series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 4, 9);
+ _wilburMode = 3;
+ series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
break;
case 2:
- _val7 = 5;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 10, 12);
+ _wilburMode = 5;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
break;
default:
- series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 9, 9);
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 9, 9);
break;
}
} else {
- _val7 = 5;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 10, 12);
+ _wilburMode = 5;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
}
break;
case 5:
- if (_val8 == 1) {
+ if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val7 = 4;
- series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 10, 12);
+ _wilburMode = 4;
+ series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
break;
case 2:
- _val7 = 6;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 13, 17);
+ _wilburMode = 6;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
break;
default:
- series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 12, 12);
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 12, 12);
break;
}
} else {
- _val7 = 6;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 13, 17);
+ _wilburMode = 6;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
}
break;
case 6:
- if (_val8 == 1) {
+ if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
- _val7 = 5;
- series_play("138wi01", 0xa00, 2, 3, 7, 0, 100, 0, 0, 13, 17);
+ _wilburMode = 5;
+ series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
break;
case 2:
- _val7 = 2;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 0);
+ _wilburMode = 2;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 0);
break;
default:
- series_play("138wi01", 0xa00, 0, 3, 30, 0, 100, 0, 0, 17, 17);
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 17, 17);
break;
}
} else {
- _val7 = 2;
- series_play("138wi01", 0xa00, 0, 3, 7, 0, 100, 0, 0, 0, 0);
+ _wilburMode = 2;
+ series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 0);
}
break;
case 15:
- if (_val8 == 15) {
+ if (_wilburShould == 15) {
loadSeries();
frame = imath_ranged_rand(0, 4);
- series_play("138wi02", 0xa00, 0, 3, 4, 0, 100, 0, 0, frame, frame);
+ series_play("138wi02", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
} else {
freeSeries();
- _val8 = 1;
- _val7 = 2;
- kernel_trigger_dispatch_now(3);
+ _wilburShould = 1;
+ _wilburMode = 2;
+ kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
@@ -545,13 +551,13 @@ void Room138::daemon() {
break;
case 5:
- _val6 = 31;
- _val3 = 22;
+ _sherrifShould = 31;
+ _deputyShould = 22;
break;
case 6:
- _val6 = 33;
- _val3 = 23;
+ _sherrifShould = 33;
+ _deputyShould = 23;
player_set_commands_allowed(false);
break;
@@ -593,8 +599,8 @@ void Room138::daemon() {
if (++_G(flags)[kPoliceCheckCtr] >= 200) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 4;
- _val6 = 33;
- _val3 = 23;
+ _sherrifShould = 33;
+ _deputyShould = 23;
}
}
@@ -602,12 +608,12 @@ void Room138::daemon() {
break;
case kWILBURS_SPEECH_START:
- _val8 = 15;
+ _wilburShould = 15;
player_set_commands_allowed(false);
break;
case kWILBURS_SPEECH_FINISHED:
- _val8 = 1;
+ _wilburShould = 1;
player_set_commands_allowed(true);
_G(kernel).continue_handling_trigger = true;
break;
@@ -624,7 +630,7 @@ void Room138::parser() {
if (_G(walker).wilbur_said(SAID)) {
// Nothing needed
} else if (player_said("keys", "ignition switch")) {
- _val8 = 16;
+ _wilburShould = 16;
player_set_commands_allowed(false);
} else if ((player_said("donuts") || player_said("keys") ||
@@ -637,7 +643,7 @@ void Room138::parser() {
} else if (player_said("gear", "horn")) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 1;
- _val8 = 10;
+ _wilburShould = 10;
} else if (player_said("gear", "radio")) {
player_set_commands_allowed(false);
@@ -645,17 +651,17 @@ void Room138::parser() {
if (inv_object_is_here("keys"))
_G(flags)[kPoliceState] = 2;
- _val8 = 11;
+ _wilburShould = 11;
} else if (player_said("talk to") &&
(player_said("sherrif") || player_said("deputy"))) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 3;
wilbur_speech("138w610");
- _val8 = 15;
+ _wilburShould = 15;
} else if (player_said("take", "keys") && !inv_player_has("keys")) {
- _val8 = 7;
+ _wilburShould = 7;
player_set_commands_allowed(false);
} else if (player_said("look at", "keys") && inv_object_is_here("keys")) {
diff --git a/engines/m4/burger/rooms/section1/room138.h b/engines/m4/burger/rooms/section1/room138.h
index 05cfe5eaf1d..7a6f264b9a9 100644
--- a/engines/m4/burger/rooms/section1/room138.h
+++ b/engines/m4/burger/rooms/section1/room138.h
@@ -34,13 +34,13 @@ private:
machine *_series2 = nullptr;
int _series3 = 0;
int _frame = 0;
- int _val2 = 0;
- int _val3 = 0;
+ int _deputyMode = 0;
+ int _deputyShould = 0;
int _val4 = 0;
- int _val5 = 0;
- int _val6 = 0;
- int _val7 = 0;
- int _val8 = 0;
+ int _sherrifMode = 0;
+ int _sherrifShould = 0;
+ int _wilburMode = 0;
+ int _wilburShould = 0;
bool _assetsFreed = false;
bool _flag1 = false;
Commit: 8077f17de898e94cb49f5eacf79f5ee52019f68b
https://github.com/scummvm/scummvm/commit/8077f17de898e94cb49f5eacf79f5ee52019f68b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix bits of cursor remaining on screen
Changed paths:
engines/m4/gui/gui_vmng_screen.cpp
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index bf55cbf2640..a7d6d24bc31 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -147,7 +147,6 @@ void RestoreScreens(int32 updateX1, int32 updateY1, int32 updateX2, int32 update
// Now, if there is anything left, it should be filled in with black
if (updateRectList) {
-
tempRect = updateRectList;
while (tempRect) {
vmng_black_out_video(tempRect->x1, tempRect->y1, tempRect->x2, tempRect->y2);
@@ -214,7 +213,7 @@ bool ResizeScreen(void *scrnContent, int32 newW, int32 newH) {
static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2) {
Graphics::Surface *screen = g_system->lockScreen();
- Common::Rect r(x1, y1, x2, y2);
+ Common::Rect r(x1, y1, x2 + 1, y2 + 1);
screen->fillRect(r, 0);
g_system->unlockScreen();
}
@@ -316,21 +315,30 @@ static bool MoveScreen(ScreenContext *myScreen, int32 parmX, int32 parmY, bool d
origY1 = myScreen->y1;
origX2 = myScreen->x2;
origY2 = myScreen->y2;
+
if (!deltaMove) {
parmX -= origX1;
parmY -= origY1;
}
if (!(myScreen->scrnFlags & SF_OFFSCRN)) {
- if ((myScreen->x2 + parmX) > MAX_VIDEO_X) parmX = MAX_VIDEO_X - myScreen->x2;
- else if ((myScreen->x1 + parmX) < 0) parmX = -myScreen->x1;
- if ((myScreen->y2 + parmY) > MAX_VIDEO_Y) parmY = MAX_VIDEO_Y - myScreen->y2;
- else if ((myScreen->y1 + parmY) < 0) parmY = -myScreen->y1;
+ if ((myScreen->x2 + parmX) > MAX_VIDEO_X)
+ parmX = MAX_VIDEO_X - myScreen->x2;
+ else if ((myScreen->x1 + parmX) < 0)
+ parmX = -myScreen->x1;
+ if ((myScreen->y2 + parmY) > MAX_VIDEO_Y)
+ parmY = MAX_VIDEO_Y - myScreen->y2;
+ else if ((myScreen->y1 + parmY) < 0)
+ parmY = -myScreen->y1;
}
- if (!(parmX || parmY)) return false;
+
+ if (!(parmX || parmY))
+ return false;
+
myScreen->x1 += parmX;
myScreen->y1 += parmY;
myScreen->x2 += parmX;
myScreen->y2 += parmY;
+
if (parmY > 0) {
RestoreScreens(origX1, origY1, origX2, myScreen->y1 - 1);
if (parmX > 0) {
Commit: d2369f00946ca3155c1157ce6f6f53f22f4e4c05
https://github.com/scummvm/scummvm/commit/d2369f00946ca3155c1157ce6f6f53f22f4e4c05
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup and fixes for Stolie in room 104
Changed paths:
engines/m4/burger/rooms/section1/room104.cpp
engines/m4/burger/rooms/section1/room104.h
diff --git a/engines/m4/burger/rooms/section1/room104.cpp b/engines/m4/burger/rooms/section1/room104.cpp
index 463a4d5d575..4ffd14297f9 100644
--- a/engines/m4/burger/rooms/section1/room104.cpp
+++ b/engines/m4/burger/rooms/section1/room104.cpp
@@ -29,6 +29,10 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_STOLIE_ANIMATION = 3
+};
+
static const char *SAID1[][4] = {
{ "TOWN HALL", "104W001", "104W002", "104w002" },
{ "DOORS", "104W003", "104W002", nullptr },
@@ -51,8 +55,8 @@ static const seriesPlayBreak PLAY2[] = {
};
void Room104::init() {
- _val1 = 0;
- _val2 = 14;
+ _stolieSleepCtr = 0;
+ _stolieShould = 14;
_val3 = 0;
digi_preload("104_001");
@@ -98,7 +102,7 @@ void Room104::init() {
digi_play_loop("104_001", 3, 200, -1);
_G(flags)[V028] = 1;
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
}
void Room104::daemon() {
@@ -123,24 +127,24 @@ void Room104::daemon() {
digi_unload("104_005");
break;
- case 3:
- switch (_val2) {
+ case kCHANGE_STOLIE_ANIMATION:
+ switch (_stolieShould) {
case 6:
_flag1 = false;
- _val2 = 9;
- Series::series_play("104dr04", 0x200, 2, 3, 6, 0, 100, 0, 0, 0, 10);
+ _stolieShould = 9;
+ Series::series_play("104dr04", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 10);
break;
case 8:
_flag1 = false;
- _val2 = 13;
- Series::series_play("104dr04", 0x200, 2, 3, 6, 0, 100, 0, 0, 0, 10);
+ _stolieShould = 13;
+ Series::series_play("104dr04", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 10);
break;
case 9:
_flag1 = false;
- _val2 = 14;
- Series::series_play("104dr02", 0x200, 0, 3, 6, 0, 100, 0, 0, 0, 7);
+ _stolieShould = 14;
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 10:
@@ -152,25 +156,24 @@ void Room104::daemon() {
case 12:
freeSeries();
- _val2 = 10;
- series_play_with_breaks(PLAY1, "104DR03", 0x200, 3, 1);
+ _stolieShould = 10;
+ series_play_with_breaks(PLAY1, "104DR03", 0x200, kCHANGE_STOLIE_ANIMATION, 1);
break;
case 13:
_flag1 = false;
- _val2 = 9;
- series_play_with_breaks(PLAY2, "104dr01", 0x200, 3, 1);
+ _stolieShould = 9;
+ series_play_with_breaks(PLAY2, "104dr01", 0x200, kCHANGE_STOLIE_ANIMATION, 1);
break;
case 14:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
- _val2 = 15;
- Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 13, 14);
+ _stolieShould = 15;
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 13, 14);
return;
}
-
- _val1 = 0;
+ _stolieSleepCtr = 0;
switch (getRandom()) {
case 1:
@@ -178,7 +181,7 @@ void Room104::daemon() {
break;
case 2:
digi_play("104s100b", 2, 125, -1);
- _val1 = 100;
+ _stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
@@ -195,12 +198,12 @@ void Room104::daemon() {
}
_flag1 = false;
- ++_val1;
+ ++_stolieSleepCtr;
frame = 0;
- if (_val1 < 3)
+ if (_stolieSleepCtr < 3)
frame = 22;
- else if (_val1 < 14)
+ else if (_stolieSleepCtr < 14)
frame = 23;
else {
switch (imath_ranged_rand(1, 3)) {
@@ -218,26 +221,27 @@ void Room104::daemon() {
}
}
- frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
- Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ frameRate = _stolieSleepCtr < 14 ? 15 : imath_ranged_rand(6, 15);
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION,
+ frameRate, 0, 100, 0, 0, frame, frame);
break;
case 15:
if (!digi_play_state(2)) {
switch (imath_ranged_rand(1, 6)) {
case 1:
- _val2 = 14;
- Series::series_play("104dr02", 0x200, 2, 3, 8, 0, 100, 0, 0, 13, 14);
+ _stolieShould = 14;
+ Series::series_play("104dr02", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 13, 14);
return;
case 2:
- _val2 = 16;
- Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 20, 20);
+ _stolieShould = 16;
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 20, 20);
return;
default:
break;
}
- _val1 = 0;
+ _stolieSleepCtr = 0;
switch (getRandom()) {
case 1:
@@ -245,7 +249,7 @@ void Room104::daemon() {
break;
case 2:
digi_play("104s100b", 2, 125, -1);
- _val1 = 100;
+ _stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
@@ -262,12 +266,12 @@ void Room104::daemon() {
}
_flag1 = false;
- ++_val1;
+ ++_stolieSleepCtr;
frame = 0;
- if (_val1 < 3)
+ if (_stolieSleepCtr < 3)
frame = 11;
- else if (_val1 < 14)
+ else if (_stolieSleepCtr < 14)
frame = 10;
else {
switch (imath_ranged_rand(1, 3)) {
@@ -284,16 +288,15 @@ void Room104::daemon() {
break;
}
}
-
- frameRate = _val1 < 14 ? 15 : imath_ranged_rand(6, 15);
- Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ frameRate = _stolieSleepCtr < 14 ? 15 : imath_ranged_rand(6, 15);
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 16:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
- _val2 = 15;
- Series::series_play("104dr02", 0x200, 0, 3, 8, 0, 100, 0, 0, 20, 20);
+ _stolieShould = 15;
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 20, 20);
break;
} else {
switch (getRandom()) {
@@ -302,7 +305,7 @@ void Room104::daemon() {
break;
case 2:
digi_play("104s100b", 2, 125, -1);
- _val1 = 100;
+ _stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
@@ -316,43 +319,43 @@ void Room104::daemon() {
default:
break;
}
+ }
+ }
- _flag1 = false;
- ++_val1;
-
- frame = 0;
- if (_val1 < 3)
- frame = 16;
- else if (_val1 < 14)
- frame = 18;
- else {
- switch (getRandom()) {
- case 1:
- frame = 15;
- break;
- case 2:
- frame = 17;
- break;
- case 3:
- frame = 19;
- break;
- default:
- break;
- }
- }
+ _flag1 = false;
+ ++_stolieSleepCtr;
- frameRate = (_val1 < 14) ? 15 : imath_ranged_rand(6, 15);
- Series::series_play("104dr02", 0x200, 0, 3, frameRate, 0, 100, 0, 0, frame, frame);
+ frame = 0;
+ if (_stolieSleepCtr < 3)
+ frame = 16;
+ else if (_stolieSleepCtr < 14)
+ frame = 18;
+ else {
+ switch (getRandom()) {
+ case 1:
+ frame = 15;
+ break;
+ case 2:
+ frame = 17;
+ break;
+ case 3:
+ frame = 19;
+ break;
+ default:
+ break;
}
}
+
+ frameRate = (_stolieSleepCtr < 14) ? 15 : imath_ranged_rand(6, 15);
+ Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 17:
freeSeries();
_flag1 = true;
- _val2 = 18;
+ _stolieShould = 18;
_series1.play("104DR04", 512, 4, -1, 6, -1, 100, 0, 0, 11, 15);
- digi_play(conv_sound_to_play(), 1, 255, 3);
+ digi_play(conv_sound_to_play(), 1, 255, kCHANGE_STOLIE_ANIMATION);
break;
case 18:
@@ -388,7 +391,7 @@ void Room104::daemon() {
case 4:
case 7:
case 11:
- _val2 = 6;
+ _stolieShould = 6;
break;
case 2:
case 3:
@@ -397,13 +400,13 @@ void Room104::daemon() {
case 8:
case 9:
case 10:
- _val2 = 8;
+ _stolieShould = 8;
break;
default:
break;
}
- kernel_trigger_dispatch_now(3);
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
player_set_commands_allowed(true);
break;
@@ -426,7 +429,7 @@ void Room104::daemon() {
case 4:
ws_demand_location(0, 326);
ws_demand_facing(3);
- ws_walk(36, 338, 0, -1, 3);
+ ws_walk(36, 338, nullptr, -1, 3);
break;
default:
_G(kernel).continue_handling_trigger = true;
@@ -471,7 +474,7 @@ void Room104::parser() {
switch (_G(flags)[WAKE_UP_STOLIE_COUNT]) {
case 0:
- _val2 = 12;
+ _stolieShould = 12;
_G(walker).wilbur_speech_random("104W100A", "104W100B", "104W100C",
"104W100D", "104W100E", "104W100F", "104W100G");
break;
@@ -481,7 +484,7 @@ void Room104::parser() {
player_set_commands_allowed(true);
break;
default:
- _val2 = 10;
+ _stolieShould = 10;
break;
}
} else {
@@ -501,8 +504,8 @@ void Room104::conv() {
if (conv_sound_to_play()) {
switch (conv_whos_talking()) {
case 0:
- _val2 = 17;
- kernel_trigger_dispatch_now(3);
+ _stolieShould = 17;
+ kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
break;
case 1:
_G(walker).wilbur_speech(conv_sound_to_play(), 10001);
diff --git a/engines/m4/burger/rooms/section1/room104.h b/engines/m4/burger/rooms/section1/room104.h
index 2ef2355fcd8..5192a792bb9 100644
--- a/engines/m4/burger/rooms/section1/room104.h
+++ b/engines/m4/burger/rooms/section1/room104.h
@@ -30,8 +30,8 @@ namespace Rooms {
class Room104 : public Room {
private:
- int _val1 = 0;
- int _val2 = 14;
+ int _stolieSleepCtr = 0;
+ int _stolieShould = 14;
int _val3 = 0;
bool _flag1 = false;
Series _series1;
Commit: 92e40639dbdde5717fc4a9503741ac24c78f0bfe
https://github.com/scummvm/scummvm/commit/92e40639dbdde5717fc4a9503741ac24c78f0bfe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added enum for Elgus in room 105
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 5a29b6fe588..09e781da962 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -31,6 +31,10 @@ namespace Rooms {
// TODO: Double-check if the belows should be !strcmp
#define COMPARE(X) strcmp(conv_sound_to_play(), X)
+enum {
+ kCHANGE_ELGUS_ANIMATION = 1
+};
+
static const char *SAID[][4] = {
{ "TOWN RECORDS", nullptr, nullptr, nullptr },
{ "MAYOR'S OFFICE", "105W002", nullptr, nullptr },
@@ -269,9 +273,9 @@ void Room105::init() {
if (_G(flags)[V112]) {
series_play("105do01", 0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
- _val3 = 59;
- _val4 = 59;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 59;
+ _elgusMode = 59;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
hotspot_set_active("Angus", false);
@@ -300,25 +304,25 @@ void Room105::daemon() {
int frame;
switch (_G(kernel).trigger) {
- case 1:
- switch (_val4) {
+ case kCHANGE_ELGUS_ANIMATION:
+ switch (_elgusMode) {
case 5:
- switch (_val3) {
+ switch (_elgusShould) {
case 1:
digi_preload("105_011");
digi_preload("105_012");
- _val3 = 2;
+ _elgusShould = 2;
digi_play("105_007", 2, 255, 1);
digi_change_volume(3, 0);
break;
case 2:
- _val3 = 3;
+ _elgusShould = 3;
series_play_with_breaks(PLAY14, "105eg01", 0xa00, 1, 3, 6, 100, 0, ZERO);
break;
case 3:
- _val3 = 5;
+ _elgusShould = 5;
series_play("105eg02", 0xa00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
series_play("105eg02s", 0xa01, 0, -1, 10, 0, 100, 0, ZERO, 0, 0);
_flag3 = false;
@@ -354,13 +358,13 @@ void Room105::daemon() {
break;
case 6:
- _val3 = 5;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 5;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
conv_resume();
break;
case 7:
- _val4 = 7;
+ _elgusMode = 7;
series_play("105eg05", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
series_play("105eg05s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
_G(kernel).trigger_mode = KT_PARSE;
@@ -368,7 +372,7 @@ void Room105::daemon() {
break;
case 8:
- _val4 = 8;
+ _elgusMode = 8;
series_play("105eg06", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 1);
series_play("105eg06s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 1);
_G(kernel).trigger_mode = KT_PARSE;
@@ -376,26 +380,26 @@ void Room105::daemon() {
break;
case 9:
- _val3 = 10;
+ _elgusShould = 10;
series_play_with_breaks(PLAY15, "105eg07", 0xa00, 1, 3, 6, 100, 0, ZERO);
break;
case 10:
- _val3 = 7;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 7;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 14:
- _val3 = 15;
+ _elgusShould = 15;
series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 5);
series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 5);
break;
case 15:
- _val3 = 16;
- _val4 = 16;
+ _elgusShould = 16;
+ _elgusMode = 16;
series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 6, 8);
series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 6, 8);
_G(kernel).trigger_mode = KT_PARSE;
@@ -411,18 +415,18 @@ void Room105::daemon() {
}
case 19:
- _val3 = 20;
+ _elgusShould = 20;
series_play_with_breaks(PLAY19, "105eg11", 0xa00, 1, 3, 6, 100, 0, ZERO);
break;
case 20:
- _val3 = 21;
+ _elgusShould = 21;
series_play_with_breaks(PLAY20, "105eg10", 0xa00, 1, 3, 4, 100, 0, ZERO);
break;
case 21:
kernel_timing_trigger(60, 8);
- _val3 = 22;
+ _elgusShould = 22;
kernel_timing_trigger(1, 1);
break;
@@ -450,52 +454,52 @@ void Room105::daemon() {
break;
case 7:
- if (_val3 == 7) {
+ if (_elgusShould == 7) {
_series6 = series_play("105eg05", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 0, 5);
_series7 = series_play("105eg05s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 0, 5);
} else {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _val4 = 5;
- kernel_trigger_dispatch_now(1);
+ _elgusMode = 5;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
break;
case 8:
- if (_val3 == 8) {
+ if (_elgusShould == 8) {
_series6 = series_play("105eg06", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 2, 6);
_series7 = series_play("105eg06s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 2, 6);
} else {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _val4 = 5;
+ _elgusMode = 5;
series_play("105eg06", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 7, 9);
series_play("105eg06s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 7, 9);
}
break;
case 16:
- if (_val3 == 16) {
+ if (_elgusShould == 16) {
_series6 = series_play("105eg06", 0xa00, 4, -1, 4, -1, 100, 0, ZERO, 4, 9);
_series7 = series_play("105eg06s", 0xa01, 4, -1, 4, -1, 100, 0, ZERO, 4, 9);
} else {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _val4 = 5;
- kernel_trigger_dispatch_now(1);
+ _elgusMode = 5;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
break;
case 25:
- switch (_val3) {
+ switch (_elgusShould) {
case 23:
- _val3 = 24;
+ _elgusShould = 24;
series_play_with_breaks(PLAY10, "105mg01", 0xf00, 1, 3, 6, 100, 0, ZERO);
break;
case 24:
- _val3 = 25;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 25;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
if (_G(flags)[V033] == 2) {
handleDeed3();
@@ -515,13 +519,13 @@ void Room105::daemon() {
break;
case 26:
- _val3 = 25;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 25;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
conv_resume();
break;
case 27:
- _val4 = 27;
+ _elgusMode = 27;
series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 10, 10);
series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 10, 10);
_G(kernel).trigger_mode = KT_PARSE;
@@ -529,7 +533,7 @@ void Room105::daemon() {
break;
case 28:
- _val4 = 27;
+ _elgusMode = 27;
series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
_G(kernel).trigger_mode = KT_PARSE;
@@ -537,30 +541,30 @@ void Room105::daemon() {
break;
case 29:
- _val4 = 25;
+ _elgusMode = 25;
series_play("105mg03", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
series_play("105mg03s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
break;
case 30:
- _val4 = 25;
+ _elgusMode = 25;
series_play("105mg05", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 7);
series_play("105mg05s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 7);
break;
case 31:
- _val4 = 31;
+ _elgusMode = 31;
series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 2);
series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 2);
break;
case 32:
- _val4 = 33;
+ _elgusMode = 33;
series_play_with_breaks(PLAY11, "105mg08", 0xf00, 1, 3, 6, 100, 0, ZERO);
break;
case 33:
- _val3 = 34;
+ _elgusShould = 34;
kernel_timing_trigger(1, 1);
break;
@@ -593,13 +597,13 @@ void Room105::daemon() {
break;
case 27:
- if (_val3 == 27) {
+ if (_elgusShould == 27) {
_series6 = series_play("105mg06", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 10, 14);
_series7 = series_play("105mg06s", 0xf01, 4, -1, 4, -1, 100, 0, ZERO, 10, 14);
} else {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _val4 = 25;
+ _elgusMode = 25;
series_play("105mg02", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
series_play("105mg02s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
@@ -607,14 +611,14 @@ void Room105::daemon() {
break;
case 31:
- if (_val3 == 31) {
+ if (_elgusShould == 31) {
_series6 = series_play("105mg07", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 3, 6);
_series7 = series_play("105mg07s", 0xf01, 4, -1, 4, -1, 100, 0, ZERO, 3, 6);
} else {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
- _val3 = 32;
- _val4 = 25;
+ _elgusShould = 32;
+ _elgusMode = 25;
series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 7, 8);
series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 7, 8);
@@ -622,15 +626,15 @@ void Room105::daemon() {
break;
case 35:
- switch (_val3) {
+ switch (_elgusShould) {
case 23:
- _val3 = 24;
+ _elgusShould = 24;
series_play_with_breaks(PLAY12, "105mg09", 0xf00, 1, 2, 6, 100, 0, ZERO);
break;
case 24:
- _val3 = 35;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 35;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
if (_G(flags)[V033] == 2) {
handleDeed3();
@@ -640,12 +644,12 @@ void Room105::daemon() {
break;
case 32:
- _val3 = 33;
+ _elgusShould = 33;
series_play_with_breaks(PLAY13, "105mg14", 0xf00, 1, 2, 6, 100, 0, ZERO);
break;
case 33:
- _val3 = 34;
+ _elgusShould = 34;
kernel_timing_trigger(1, 1);
break;
@@ -681,27 +685,27 @@ void Room105::daemon() {
break;
case 36:
- _val3 = 35;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 35;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
conv_resume();
break;
case 37:
- _val4 = 37;
+ _elgusMode = 37;
series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 16, 16);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 38:
- _val4 = 38;
+ _elgusMode = 38;
series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 10);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 39:
- _val4 = 37;
+ _elgusMode = 37;
series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 15);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -713,34 +717,34 @@ void Room105::daemon() {
break;
case 37:
- if (_val3 == 37) {
+ if (_elgusShould == 37) {
_series6 = series_play("105mg12", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 16, 18);
} else {
terminateMachineAndNull(_series6);
- _val4 = 35;
+ _elgusMode = 35;
series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 19, 19);
}
break;
case 38:
- if (_val3 == 38) {
+ if (_elgusShould == 38) {
_series6 = series_play("105mg13", 0xf00, 4, -1, 4, -1, 100, 0, ZERO, 11, 14);
} else {
terminateMachineAndNull(_series6);
- _val4 = 35;
+ _elgusMode = 35;
series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 15, 16);
}
break;
case 42:
- switch (_val3) {
+ switch (_elgusShould) {
case 40:
- _val3 = 41;
+ _elgusShould = 41;
series_play_with_breaks(PLAY1, "105ag01", 0xe00, 1, 2, 6, 100, 0, 0);
break;
case 41:
- _val3 = 42;
+ _elgusShould = 42;
series_play("105ag02", 0xe00, 0, 1, 10, 0, 100, 0, 0, 0, 0);
if (_G(flags)[V033] == 1) {
@@ -769,17 +773,17 @@ void Room105::daemon() {
break;
case 43:
- _val3 = 42;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 42;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
conv_resume();
break;
case 44:
if (imath_ranged_rand(1, 2) == 1) {
- _val4 = 45;
+ _elgusMode = 45;
series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 4);
} else {
- _val4 = 46;
+ _elgusMode = 46;
series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 19);
}
@@ -788,30 +792,30 @@ void Room105::daemon() {
break;
case 47:
- _val4 = 47;
+ _elgusMode = 47;
series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 6);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 49:
- _val3 = 50;
+ _elgusShould = 50;
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 9);
break;
case 50:
conv_resume();
- _val4 = 49;
- kernel_trigger_dispatch_now(1);
+ _elgusMode = 49;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
break;
case 51:
- _val4 = 51;
+ _elgusMode = 51;
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 2);
break;
case 52:
- _val4 = 52;
+ _elgusMode = 52;
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 24);
break;
@@ -824,12 +828,12 @@ void Room105::daemon() {
break;
case 56:
- _val3 = 57;
+ _elgusShould = 57;
series_play_with_breaks(PLAY8, "105ag09", 0xe00, 1, 2, 6, 100, 0, 0);
break;
case 57:
- _val3 = 58;
+ _elgusShould = 58;
kernel_timing_trigger(1, 1);
break;
@@ -862,27 +866,27 @@ void Room105::daemon() {
break;
case 45:
- if (_val3 == 44) {
+ if (_elgusShould == 44) {
_series6 = series_play("105ag05", 0xe00, 4, -1, 4, -1, 100, 0, 0, 5, 8);
} else {
terminateMachineAndNull(_series6);
- _val4 = 42;
+ _elgusMode = 42;
series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 4);
}
break;
case 46:
- if (_val3 == 44) {
+ if (_elgusShould == 44) {
_series6 = series_play("105ag05", 0xe00, 4, -1, 4, -1, 100, 0, 0, 11, 15);
} else {
terminateMachineAndNull(_series6);
- _val4 = 42;
+ _elgusMode = 42;
series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 16, 19);
}
break;
case 47:
- if (_val3 == 47) {
+ if (_elgusShould == 47) {
if (imath_ranged_rand(1, 10) == 1) {
series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 7, 11);
} else {
@@ -890,68 +894,68 @@ void Room105::daemon() {
}
} else {
terminateMachineAndNull(_series6);
- _val4 = 42;
+ _elgusMode = 42;
series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 6);
}
break;
case 48:
- if (_val3 == 47) {
+ if (_elgusShould == 47) {
if (imath_ranged_rand(1, 10) == 1) {
- _val4 = 47;
+ _elgusMode = 47;
series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 7, 11);
} else {
_series6 = series_play("105ag06", 0xe00, 4, -1, 4, -1, 100, 0, 0, 12, 15);
}
} else {
terminateMachineAndNull(_series6);
- _val4 = 42;
+ _elgusMode = 42;
series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 18);
}
break;
case 49:
- if (_val3 == 50) {
+ if (_elgusShould == 50) {
series_play("105ag07", 0xe00, 0, 1, 10, 0, 100, 0, 0, 9, 9);
} else {
terminateMachineAndNull(_series6);
- _val4 = 42;
+ _elgusMode = 42;
series_play_with_breaks(PLAY6, "105ag07", 0xe00, 1, 2, 6, 100, 0, 0);
}
break;
case 51:
- switch (_val3) {
+ switch (_elgusShould) {
case 51:
frame = imath_ranged_rand(3, 6);
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
break;
case 54:
- _val4 = 42;
- _val3 = 58;
+ _elgusMode = 42;
+ _elgusShould = 58;
series_play_with_breaks(PLAY9, "105ag10", 0xe00, 1, 3, 6, 100, 0, 0);
break;
default:
- _val4 = 42;
- _val3 = 58;
+ _elgusMode = 42;
+ _elgusShould = 58;
series_play_with_breaks(PLAY8, "105ag14", 0xe00, 1, 3, 6, 100, 0, 0);
break;
}
break;
case 53:
- if (_val3 == 52) {
+ if (_elgusShould == 52) {
series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 29, 29);
} else {
- _val4 = 42;
+ _elgusMode = 42;
series_play("105ag07", 0xe00, 2, 1, 4, 0, 100, 0, 0, 30, 33);
}
break;
case 59:
- switch (_val3) {
+ switch (_elgusShould) {
case 59:
frame = imath_ranged_rand(0, 1);
series_play("105ag12", 0xa00, 0, 1, 40, 0, 100, 0, 0, frame, frame);
@@ -959,7 +963,7 @@ void Room105::daemon() {
break;
case 60:
- _val4 = 60;
+ _elgusMode = 60;
series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 0);
series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 0);
@@ -971,7 +975,7 @@ void Room105::daemon() {
break;
case 61:
- _val4 = 61;
+ _elgusMode = 61;
series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 5);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 5);
@@ -988,24 +992,24 @@ void Room105::daemon() {
break;
case 60:
- if (_val3 == 60) {
+ if (_elgusShould == 60) {
frame = imath_ranged_rand(4, 8);
series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
} else {
- _val4 = 59;
+ _elgusMode = 59;
series_play("105ag13", 0xa00, 2, 1, 4, 0, 100, 0, 0, 0, 3);
series_play("105ag13s", 0xa01, 2, -1, 4, 0, 100, 0, 0, 0, 3);
}
break;
case 61:
- if (_val3 == 61) {
+ if (_elgusShould == 61) {
frame = imath_ranged_rand(6, 9);
series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
} else {
- _val4 = 59;
+ _elgusMode = 59;
series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 12, 15);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 12, 15);
}
@@ -1020,20 +1024,20 @@ void Room105::daemon() {
if (!_val1) {
player_set_commands_allowed(true);
} else {
- _val3 = _series5 ? 54 : 56;
+ _elgusShould = _series5 ? 54 : 56;
player_set_commands_allowed(false);
}
break;
case 3:
- _val3 = 32;
+ _elgusShould = 32;
player_set_commands_allowed(false);
break;
case 4:
digi_unload("105_011");
digi_unload("105_012");
- _val3 = _flag3 ? 19 : 18;
+ _elgusShould = _flag3 ? 19 : 18;
player_set_commands_allowed(_flag5);
_flag5 = false;
break;
@@ -1077,11 +1081,11 @@ void Room105::daemon() {
_savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g003";
- _val3 = 60;
+ _elgusShould = 60;
} else if (_G(flags)[V033] == 3 && !_G(flags)[V032]) {
- _val3 = 1;
- _val4 = 5;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 1;
+ _elgusMode = 5;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
_flag5 = _G(flags)[V032] != 0;
_flag3 = false;
@@ -1102,7 +1106,7 @@ void Room105::daemon() {
_savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g002";
- _val3 = 60;
+ _elgusShould = 60;
} else if (_G(flags)[V033] != 2) {
_flag3 = false;
_flag1 = false;
@@ -1110,7 +1114,7 @@ void Room105::daemon() {
_flag2 = false;
handleDeed3();
} else {
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
break;
@@ -1118,9 +1122,9 @@ void Room105::daemon() {
ws_unhide_walker();
if (_G(flags)[V033] == 1) {
- _val3 = 40;
- _val4 = 42;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 40;
+ _elgusMode = 42;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
handleDeed1();
}
@@ -1136,7 +1140,7 @@ void Room105::daemon() {
case 21:
player_set_commands_allowed(true);
- _val3 = 59;
+ _elgusShould = 59;
break;
case 22:
@@ -1271,9 +1275,9 @@ void Room105::daemon() {
case 44:
series_unload(_series11);
- _val3 = 42;
- _val4 = 42;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 42;
+ _elgusMode = 42;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
conv_resume();
break;
@@ -1350,7 +1354,7 @@ void Room105::parser() {
_savedMode = KT_DAEMON;
_savedTrigger = 21;
_digi1 = "105g001";
- _val3 = 60;
+ _elgusShould = 60;
break;
default:
@@ -1418,11 +1422,11 @@ void Room105::conv10() {
}
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
- _val3 = _val8 ? 36 : 26;
+ _elgusShould = _val8 ? 36 : 26;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
} else {
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
@@ -1450,7 +1454,7 @@ void Room105::conv10() {
digi_play(conv_sound_to_play(), 1, 255, 10);
} else {
- _val3 = _val8 ? 37 : 27;
+ _elgusShould = _val8 ? 37 : 27;
}
} else if (who == 1) {
sendWSMessage(0x140000, 0, _G(my_walker), 0, nullptr, 1);
@@ -1480,8 +1484,8 @@ void Room105::conv11() {
digi_unload("105e1cr3");
}
- _val3 = 1;
- _val4 = 5;
+ _elgusShould = 1;
+ _elgusMode = 5;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_timing_trigger(30, 1);
@@ -1489,12 +1493,12 @@ void Room105::conv11() {
(node == 1 && entry == 4 && inv_player_has("deed"))) {
_G(kernel).trigger_mode = KT_DAEMON;
kernel_timing_trigger(1, 29);
- _val3 = 5;
- kernel_trigger_dispatch_now(1);
+ _elgusShould = 5;
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
- _val3 = 6;
+ _elgusShould = 6;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
} else if (who == 1) {
sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
@@ -1511,11 +1515,11 @@ void Room105::conv11() {
(node != 8 || entry != 0) && (node != 9 || node != 2) &&
(node != 11 || entry != 3) && (node != 12 || entry != 3)) {
if (node == 13 && entry == 0) {
- _val3 = 9;
+ _elgusShould = 9;
} else if (node == 13 && entry == 1) {
- _val3 = 14;
+ _elgusShould = 14;
} else if (node != 1) {
- _val3 = 7;
+ _elgusShould = 7;
} else {
if (COMPARE("10n02011")) {
digi_preload("105e1cr1");
@@ -1531,7 +1535,7 @@ void Room105::conv11() {
digi_play(conv_sound_to_play(), 1, 255, 10);
}
} else {
- _val3 = 8;
+ _elgusShould = 8;
}
} else if (who == 1) {
if (node == 13 && entry == 1) {
@@ -1568,28 +1572,28 @@ void Room105::conv12() {
digi_unload("105ancr3");
}
- _val3 = 40;
- _val4 = 42;
+ _elgusShould = 40;
+ _elgusMode = 42;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else if (node == 7 && entry == 6) {
- _val3 = 49;
+ _elgusShould = 49;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else if (node == 15 && entry == 4) {
- _val3 = 55;
+ _elgusShould = 55;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else if (node == 9) {
conv_resume();
} else {
- _val3 = 43;
+ _elgusShould = 43;
_G(kernel).trigger_mode = KT_DAEMON;
- kernel_trigger_dispatch_now(1);
+ kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
} else if (who == 1) {
if (node == 16 && entry == 1)
@@ -1623,12 +1627,12 @@ void Room105::conv12() {
digi_play(conv_sound_to_play(), 1, 255, 10);
} else {
- _val3 = 44;
+ _elgusShould = 44;
}
} else if (who == 1) {
if (node == 16 && entry == 1) {
digi_preload("12p1702");
- _val3 = 56;
+ _elgusShould = 56;
_val1 = 0;
}
@@ -1647,13 +1651,13 @@ void Room105::conv13() {
if (_G(kernel).trigger == 10) {
if (who <= 0) {
- _val3 = 59;
+ _elgusShould = 59;
} else if (who == 1) {
sendWSMessage(0x150000, 0, _G(my_walker), 0, 0, 1);
}
} else if (conv_sound_to_play()) {
if (who <= 0) {
- _val3 = (node == 2) ? 61 : 60;
+ _elgusShould = (node == 2) ? 61 : 60;
_savedMode = KT_PARSE;
_savedTrigger = 10;
_digi1 = conv_sound_to_play();
@@ -1676,14 +1680,14 @@ void Room105::enteringMayorsOffice() {
if (_G(flags)[V031]) {
_val8 = 1;
loadAssets2();
- _val3 = 23;
- _val4 = 35;
+ _elgusShould = 23;
+ _elgusMode = 35;
} else {
_G(flags)[V031] = 1;
_val8 = 0;
loadAssets1();
- _val3 = 23;
- _val4 = 25;
+ _elgusShould = 23;
+ _elgusMode = 25;
}
}
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index 288cfd8c7da..b373cf5823d 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -31,8 +31,8 @@ namespace Rooms {
class Room105 : public Room {
private:
int _val1 = 0;
- int _val3 = 0;
- int _val4 = 0;
+ int _elgusShould = 0;
+ int _elgusMode = 0;
KernelTriggerType _savedMode = (KernelTriggerType)0;
int _savedTrigger = 0;
int _val7 = 0;
Commit: cfd28537612adcb9c075f78c2db2a47dee9d260c
https://github.com/scummvm/scummvm/commit/cfd28537612adcb9c075f78c2db2a47dee9d260c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further cleanup of Elgus in room 105
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 09e781da962..5330dcc0589 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -312,18 +312,18 @@ void Room105::daemon() {
digi_preload("105_011");
digi_preload("105_012");
_elgusShould = 2;
- digi_play("105_007", 2, 255, 1);
+ digi_play("105_007", 2, 255, kCHANGE_ELGUS_ANIMATION);
digi_change_volume(3, 0);
break;
case 2:
_elgusShould = 3;
- series_play_with_breaks(PLAY14, "105eg01", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY14, "105eg01", 0xa00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
case 3:
_elgusShould = 5;
- series_play("105eg02", 0xa00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg02", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, ZERO, 0, 0);
series_play("105eg02s", 0xa01, 0, -1, 10, 0, 100, 0, ZERO, 0, 0);
_flag3 = false;
_flag1 = false;
@@ -342,7 +342,7 @@ void Room105::daemon() {
switch (imath_ranged_rand(1, 20)) {
case 1:
case 2:
- series_play("105eg04", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 1, 1);
+ series_play("105eg04", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 1, 1);
series_play("105eg04s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 1, 1);
break;
@@ -351,7 +351,7 @@ void Room105::daemon() {
break;
default:
- series_play("105eg04", 0xa00, 0, 1, 30, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg04", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 30, 0, 100, 0, ZERO, 0, 0);
series_play("105eg04s", 0xa01, 0, -1, 30, 0, 100, 0, ZERO, 0, 0);
break;
}
@@ -365,7 +365,7 @@ void Room105::daemon() {
case 7:
_elgusMode = 7;
- series_play("105eg05", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105eg05", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 0);
series_play("105eg05s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -373,7 +373,7 @@ void Room105::daemon() {
case 8:
_elgusMode = 8;
- series_play("105eg06", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 1);
+ series_play("105eg06", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 6, 0, 100, 0, ZERO, 0, 1);
series_play("105eg06s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 1);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -381,7 +381,7 @@ void Room105::daemon() {
case 9:
_elgusShould = 10;
- series_play_with_breaks(PLAY15, "105eg07", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY15, "105eg07", 0xa00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
case 10:
@@ -393,14 +393,14 @@ void Room105::daemon() {
case 14:
_elgusShould = 15;
- series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 0, 5);
+ series_play("105eg08", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 6, 0, 100, 0, ZERO, 0, 5);
series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 0, 5);
break;
case 15:
_elgusShould = 16;
_elgusMode = 16;
- series_play("105eg08", 0xa00, 0, 1, 6, 0, 100, 0, ZERO, 6, 8);
+ series_play("105eg08", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 6, 0, 100, 0, ZERO, 6, 8);
series_play("105eg08s", 0xa01, 0, -1, 6, 0, 100, 0, ZERO, 6, 8);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -416,12 +416,12 @@ void Room105::daemon() {
case 19:
_elgusShould = 20;
- series_play_with_breaks(PLAY19, "105eg11", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY19, "105eg11", 0xa00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
case 20:
_elgusShould = 21;
- series_play_with_breaks(PLAY20, "105eg10", 0xa00, 1, 3, 4, 100, 0, ZERO);
+ series_play_with_breaks(PLAY20, "105eg10", 0xa00, kCHANGE_ELGUS_ANIMATION, 3, 4, 100, 0, ZERO);
break;
case 21:
@@ -473,7 +473,7 @@ void Room105::daemon() {
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
_elgusMode = 5;
- series_play("105eg06", 0xa00, 0, 1, 4, 0, 100, 0, ZERO, 7, 9);
+ series_play("105eg06", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 7, 9);
series_play("105eg06s", 0xa01, 0, -1, 4, 0, 100, 0, ZERO, 7, 9);
}
break;
@@ -494,7 +494,7 @@ void Room105::daemon() {
switch (_elgusShould) {
case 23:
_elgusShould = 24;
- series_play_with_breaks(PLAY10, "105mg01", 0xf00, 1, 3, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY10, "105mg01", 0xf00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
case 24:
@@ -510,10 +510,10 @@ void Room105::daemon() {
case 25:
if (imath_ranged_rand(1, 13) == 1) {
- series_play("105mg04", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg04", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 0);
series_play("105mg04s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
} else {
- series_play("105mg02", 0xf00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg02", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, ZERO, 0, 0);
series_play("105mg02s", 0xf01, 0, -1, 10, 0, 100, 0, ZERO, 0, 0);
}
break;
@@ -526,7 +526,7 @@ void Room105::daemon() {
case 27:
_elgusMode = 27;
- series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 10, 10);
+ series_play("105mg06", 0xf00, 0, 1, kCHANGE_ELGUS_ANIMATION, 0, 100, 0, ZERO, 10, 10);
series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 10, 10);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -534,7 +534,7 @@ void Room105::daemon() {
case 28:
_elgusMode = 27;
- series_play("105mg06", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
+ series_play("105mg06", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 9);
series_play("105mg06s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
@@ -542,30 +542,30 @@ void Room105::daemon() {
case 29:
_elgusMode = 25;
- series_play("105mg03", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 9);
+ series_play("105mg03", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 9);
series_play("105mg03s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
break;
case 30:
_elgusMode = 25;
- series_play("105mg05", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 7);
+ series_play("105mg05", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 7);
series_play("105mg05s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 7);
break;
case 31:
_elgusMode = 31;
- series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 2);
+ series_play("105mg07", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 2);
series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 2);
break;
case 32:
_elgusMode = 33;
- series_play_with_breaks(PLAY11, "105mg08", 0xf00, 1, 3, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY11, "105mg08", 0xf00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
case 33:
_elgusShould = 34;
- kernel_timing_trigger(1, 1);
+ kernel_timing_trigger(1, kCHANGE_ELGUS_ANIMATION);
break;
case 34:
@@ -605,7 +605,7 @@ void Room105::daemon() {
terminateMachineAndNull(_series7);
_elgusMode = 25;
- series_play("105mg02", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg02", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 0);
series_play("105mg02s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 0);
}
break;
@@ -620,7 +620,7 @@ void Room105::daemon() {
_elgusShould = 32;
_elgusMode = 25;
- series_play("105mg07", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 7, 8);
+ series_play("105mg07", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 7, 8);
series_play("105mg07s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 7, 8);
}
break;
@@ -629,7 +629,7 @@ void Room105::daemon() {
switch (_elgusShould) {
case 23:
_elgusShould = 24;
- series_play_with_breaks(PLAY12, "105mg09", 0xf00, 1, 2, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY12, "105mg09", 0xf00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, ZERO);
break;
case 24:
@@ -645,7 +645,7 @@ void Room105::daemon() {
case 32:
_elgusShould = 33;
- series_play_with_breaks(PLAY13, "105mg14", 0xf00, 1, 2, 6, 100, 0, ZERO);
+ series_play_with_breaks(PLAY13, "105mg14", 0xf00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, ZERO);
break;
case 33:
@@ -678,9 +678,9 @@ void Room105::daemon() {
case 35:
if (imath_ranged_rand(1, 13) == 1) {
- series_play("105mg11", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg11", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 0);
} else {
- series_play("105mg11", 0xf00, 0, 1, 10, 0, 100, 0, ZERO, 0, 0);
+ series_play("105mg11", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, ZERO, 0, 0);
}
break;
@@ -692,21 +692,21 @@ void Room105::daemon() {
case 37:
_elgusMode = 37;
- series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 16, 16);
+ series_play("105mg12", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 16, 16);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 38:
_elgusMode = 38;
- series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 10);
+ series_play("105mg13", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 10);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 39:
_elgusMode = 37;
- series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 0, 15);
+ series_play("105mg12", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 15);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
@@ -722,7 +722,7 @@ void Room105::daemon() {
} else {
terminateMachineAndNull(_series6);
_elgusMode = 35;
- series_play("105mg12", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 19, 19);
+ series_play("105mg12", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 19, 19);
}
break;
@@ -732,7 +732,7 @@ void Room105::daemon() {
} else {
terminateMachineAndNull(_series6);
_elgusMode = 35;
- series_play("105mg13", 0xf00, 0, 1, 4, 0, 100, 0, ZERO, 15, 16);
+ series_play("105mg13", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 15, 16);
}
break;
@@ -740,12 +740,12 @@ void Room105::daemon() {
switch (_elgusShould) {
case 40:
_elgusShould = 41;
- series_play_with_breaks(PLAY1, "105ag01", 0xe00, 1, 2, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY1, "105ag01", 0xe00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, 0);
break;
case 41:
_elgusShould = 42;
- series_play("105ag02", 0xe00, 0, 1, 10, 0, 100, 0, 0, 0, 0);
+ series_play("105ag02", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
if (_G(flags)[V033] == 1) {
handleDeed1();
@@ -759,15 +759,15 @@ void Room105::daemon() {
case 1:
case 2:
case 3:
- series_play_with_breaks(PLAY3, "105ag04", 0xe00, 1, 2, 4, 100, 0, 0);
+ series_play_with_breaks(PLAY3, "105ag04", 0xe00, kCHANGE_ELGUS_ANIMATION, 2, 4, 100, 0, 0);
break;
case 4:
- series_play_with_breaks(PLAY5, "105ag03", 0xe00, 1, 2, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY5, "105ag03", 0xe00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, 0);
break;
default:
- series_play("105ag02", 0xe00, 0, 1, 15, 0, 100, 0, 0, 0, 0);
+ series_play("105ag02", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 15, 0, 100, 0, 0, 0, 0);
break;
}
break;
@@ -781,10 +781,10 @@ void Room105::daemon() {
case 44:
if (imath_ranged_rand(1, 2) == 1) {
_elgusMode = 45;
- series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 4);
+ series_play("105ag05", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 4);
} else {
_elgusMode = 46;
- series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 19);
+ series_play("105ag05", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 16, 19);
}
_G(kernel).trigger_mode = KT_PARSE;
@@ -793,14 +793,14 @@ void Room105::daemon() {
case 47:
_elgusMode = 47;
- series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 6);
+ series_play("105ag06", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 6);
_G(kernel).trigger_mode = KT_PARSE;
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
case 49:
_elgusShould = 50;
- series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 9);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 9);
break;
case 50:
@@ -811,12 +811,12 @@ void Room105::daemon() {
case 51:
_elgusMode = 51;
- series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 2);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 2);
break;
case 52:
_elgusMode = 52;
- series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 0, 24);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 24);
break;
case 54:
@@ -829,7 +829,7 @@ void Room105::daemon() {
case 56:
_elgusShould = 57;
- series_play_with_breaks(PLAY8, "105ag09", 0xe00, 1, 2, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY8, "105ag09", 0xe00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, 0);
break;
case 57:
@@ -871,7 +871,7 @@ void Room105::daemon() {
} else {
terminateMachineAndNull(_series6);
_elgusMode = 42;
- series_play("105ag05", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 4);
+ series_play("105ag05", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 4);
}
break;
@@ -881,21 +881,21 @@ void Room105::daemon() {
} else {
terminateMachineAndNull(_series6);
_elgusMode = 42;
- series_play("105ag05", 0xe00, 0, 1, 4, 0, 100, 0, 0, 16, 19);
+ series_play("105ag05", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 16, 19);
}
break;
case 47:
if (_elgusShould == 47) {
if (imath_ranged_rand(1, 10) == 1) {
- series_play("105ag06", 0xe00, 0, 1, 4, 0, 100, 0, 0, 7, 11);
+ series_play("105ag06", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 7, 11);
} else {
_series6 = series_play("105ag06", 0xe00, 4, -1, 4, -1, 100, 0, 0, 6, 9);
}
} else {
terminateMachineAndNull(_series6);
_elgusMode = 42;
- series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 0, 6);
+ series_play("105ag06", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 6);
}
break;
@@ -903,24 +903,24 @@ void Room105::daemon() {
if (_elgusShould == 47) {
if (imath_ranged_rand(1, 10) == 1) {
_elgusMode = 47;
- series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 7, 11);
+ series_play("105ag06", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 7, 11);
} else {
_series6 = series_play("105ag06", 0xe00, 4, -1, 4, -1, 100, 0, 0, 12, 15);
}
} else {
terminateMachineAndNull(_series6);
_elgusMode = 42;
- series_play("105ag06", 0xe00, 2, 1, 4, 0, 100, 0, 0, 16, 18);
+ series_play("105ag06", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 16, 18);
}
break;
case 49:
if (_elgusShould == 50) {
- series_play("105ag07", 0xe00, 0, 1, 10, 0, 100, 0, 0, 9, 9);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, 0, 9, 9);
} else {
terminateMachineAndNull(_series6);
_elgusMode = 42;
- series_play_with_breaks(PLAY6, "105ag07", 0xe00, 1, 2, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY6, "105ag07", 0xe00, kCHANGE_ELGUS_ANIMATION, 2, 6, 100, 0, 0);
}
break;
@@ -928,29 +928,29 @@ void Room105::daemon() {
switch (_elgusShould) {
case 51:
frame = imath_ranged_rand(3, 6);
- series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
break;
case 54:
_elgusMode = 42;
_elgusShould = 58;
- series_play_with_breaks(PLAY9, "105ag10", 0xe00, 1, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY9, "105ag10", 0xe00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, 0);
break;
default:
_elgusMode = 42;
_elgusShould = 58;
- series_play_with_breaks(PLAY8, "105ag14", 0xe00, 1, 3, 6, 100, 0, 0);
+ series_play_with_breaks(PLAY8, "105ag14", 0xe00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, 0);
break;
}
break;
case 53:
if (_elgusShould == 52) {
- series_play("105ag07", 0xe00, 0, 1, 4, 0, 100, 0, 0, 29, 29);
+ series_play("105ag07", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 29, 29);
} else {
_elgusMode = 42;
- series_play("105ag07", 0xe00, 2, 1, 4, 0, 100, 0, 0, 30, 33);
+ series_play("105ag07", 0xe00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 30, 33);
}
break;
@@ -958,13 +958,13 @@ void Room105::daemon() {
switch (_elgusShould) {
case 59:
frame = imath_ranged_rand(0, 1);
- series_play("105ag12", 0xa00, 0, 1, 40, 0, 100, 0, 0, frame, frame);
+ series_play("105ag12", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 40, 0, 100, 0, 0, frame, frame);
series_play("105ag12s", 0xa01, 0, -1, 40, 0, 100, 0, 0, frame, frame);
break;
case 60:
_elgusMode = 60;
- series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 0);
+ series_play("105ag13", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 0);
series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 0);
if (_digi1) {
@@ -976,7 +976,7 @@ void Room105::daemon() {
case 61:
_elgusMode = 61;
- series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 0, 5);
+ series_play("105ag14", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 5);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 0, 5);
if (_digi1) {
@@ -994,11 +994,11 @@ void Room105::daemon() {
case 60:
if (_elgusShould == 60) {
frame = imath_ranged_rand(4, 8);
- series_play("105ag13", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("105ag13", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
series_play("105ag13s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
} else {
_elgusMode = 59;
- series_play("105ag13", 0xa00, 2, 1, 4, 0, 100, 0, 0, 0, 3);
+ series_play("105ag13", 0xa00, 2, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 0, 3);
series_play("105ag13s", 0xa01, 2, -1, 4, 0, 100, 0, 0, 0, 3);
}
break;
@@ -1006,11 +1006,11 @@ void Room105::daemon() {
case 61:
if (_elgusShould == 61) {
frame = imath_ranged_rand(6, 9);
- series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, frame, frame);
+ series_play("105ag14", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, frame, frame);
} else {
_elgusMode = 59;
- series_play("105ag14", 0xa00, 0, 1, 4, 0, 100, 0, 0, 12, 15);
+ series_play("105ag14", 0xa00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, 0, 12, 15);
series_play("105ag14s", 0xa01, 0, -1, 4, 0, 100, 0, 0, 12, 15);
}
break;
Commit: e45379bca5cdd79d2f48e98c12abc3692a8ab4f7
https://github.com/scummvm/scummvm/commit/e45379bca5cdd79d2f48e98c12abc3692a8ab4f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fixes for mayor and complaints conversations in room 105
Changed paths:
engines/m4/burger/rooms/section1/room105.cpp
engines/m4/burger/rooms/section1/room105.h
diff --git a/engines/m4/burger/rooms/section1/room105.cpp b/engines/m4/burger/rooms/section1/room105.cpp
index 5330dcc0589..0084537a0b4 100644
--- a/engines/m4/burger/rooms/section1/room105.cpp
+++ b/engines/m4/burger/rooms/section1/room105.cpp
@@ -28,8 +28,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-// TODO: Double-check if the belows should be !strcmp
-#define COMPARE(X) strcmp(conv_sound_to_play(), X)
+#define COMPARE(X) Common::String(conv_sound_to_play()).equalsIgnoreCase(X)
enum {
kCHANGE_ELGUS_ANIMATION = 1
@@ -332,7 +331,7 @@ void Room105::daemon() {
player_set_commands_allowed(true);
if (_G(flags)[V033] == 3) {
- handleDeed2();
+ complaintsDept();
} else {
conv_resume();
}
@@ -406,11 +405,11 @@ void Room105::daemon() {
digi_play(conv_sound_to_play(), 1, 255, 10);
break;
- case 18:
- {
+ case 18: {
const seriesPlayBreak *PLAYS[3] = { PLAY16, PLAY17, PLAY18 };
+ _elgusShould = 21;
series_play_with_breaks(PLAYS[imath_ranged_rand(0, 2)],
- "105eg10", 0xa00, 1, 3, 6, 100, 0, ZERO);
+ "105eg10", 0xa00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
}
@@ -439,8 +438,8 @@ void Room105::daemon() {
_flag1 = false;
_flag4 = false;
_flag2 = false;
- enteringMayorsOffice();
- handleDeed3();
+ mayorsDoor();
+ mayorsOffice();
kernel_timing_trigger(60, 12);
} else {
player_set_commands_allowed(true);
@@ -502,7 +501,7 @@ void Room105::daemon() {
kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
if (_G(flags)[V033] == 2) {
- handleDeed3();
+ mayorsOffice();
} else {
conv_resume();
}
@@ -541,13 +540,13 @@ void Room105::daemon() {
break;
case 29:
- _elgusMode = 25;
+ _elgusShould = 25;
series_play("105mg03", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 9);
series_play("105mg03s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 9);
break;
case 30:
- _elgusMode = 25;
+ _elgusShould = 25;
series_play("105mg05", 0xf00, 0, kCHANGE_ELGUS_ANIMATION, 4, 0, 100, 0, ZERO, 0, 7);
series_play("105mg05s", 0xf01, 0, -1, 4, 0, 100, 0, ZERO, 0, 7);
break;
@@ -559,7 +558,7 @@ void Room105::daemon() {
break;
case 32:
- _elgusMode = 33;
+ _elgusShould = 33;
series_play_with_breaks(PLAY11, "105mg08", 0xf00, kCHANGE_ELGUS_ANIMATION, 3, 6, 100, 0, ZERO);
break;
@@ -576,14 +575,14 @@ void Room105::daemon() {
_flag4 = false;
_flag2 = false;
loadAssets3();
- handleDeed2();
+ complaintsDept();
kernel_timing_trigger(60, 13);
} else if (_flag2) {
_flag1 = false;
_flag4 = false;
_flag2 = false;
loadAssets4();
- handleDeed1();
+ townRecords();
kernel_timing_trigger(60, 11);
} else {
player_set_commands_allowed(true);
@@ -637,7 +636,7 @@ void Room105::daemon() {
kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
if (_G(flags)[V033] == 2) {
- handleDeed3();
+ mayorsOffice();
} else {
conv_resume();
}
@@ -661,14 +660,14 @@ void Room105::daemon() {
_flag4 = false;
_flag2 = false;
loadAssets3();
- handleDeed2();
+ complaintsDept();
kernel_timing_trigger(60, 13);
} else if (_flag2) {
_flag1 = false;
_flag4 = false;
_flag2 = false;
loadAssets4();
- handleDeed1();
+ townRecords();
kernel_timing_trigger(60, 11);
} else {
player_set_commands_allowed(true);
@@ -748,7 +747,7 @@ void Room105::daemon() {
series_play("105ag02", 0xe00, 0, kCHANGE_ELGUS_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
if (_G(flags)[V033] == 1) {
- handleDeed1();
+ townRecords();
} else {
conv_resume();
}
@@ -845,7 +844,7 @@ void Room105::daemon() {
_flag4 = false;
_flag2 = false;
loadAssets3();
- handleDeed2();
+ complaintsDept();
kernel_timing_trigger(60, 13);
} else if (_flag4) {
@@ -1092,7 +1091,7 @@ void Room105::daemon() {
_flag1 = false;
_flag4 = false;
_flag2 = false;
- handleDeed2();
+ complaintsDept();
}
break;
@@ -1112,7 +1111,7 @@ void Room105::daemon() {
_flag1 = false;
_flag4 = false;
_flag2 = false;
- handleDeed3();
+ mayorsOffice();
} else {
kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
}
@@ -1126,12 +1125,12 @@ void Room105::daemon() {
_elgusMode = 42;
kernel_trigger_dispatch_now(kCHANGE_ELGUS_ANIMATION);
} else {
- handleDeed1();
+ townRecords();
}
break;
case 19:
- talkTo();
+ startConv13();
break;
case 20:
@@ -1340,7 +1339,7 @@ void Room105::parser() {
} else if (player_said("conv13")) {
conv13();
} else if (player_said("talk to")) {
- talkTo();
+ startConv13();
} else if (lookFlag && player_said("town records")) {
if (_G(flags)[V112]) {
switch (_G(kernel).trigger) {
@@ -1381,7 +1380,7 @@ void Room105::parser() {
if (!_G(flags)[V112]) {
_G(flags)[V298] = 1;
- enteringMayorsOffice();
+ mayorsDoor();
}
} else if (player_said("GEAR", "complaints dept.")) {
player_set_commands_allowed(false);
@@ -1564,7 +1563,7 @@ void Room105::conv12() {
if (node == 1) {
digi_stop(2);
- if (COMPARE("10n02011")) {
+ if (COMPARE("10n02011")) {
digi_unload("105ancr1");
} else if (COMPARE("10n02012")) {
digi_unload("105ancr2");
@@ -1670,13 +1669,13 @@ void Room105::conv13() {
}
}
-void Room105::talkTo() {
+void Room105::startConv13() {
_val1 = 1;
conv_load_and_prepare("conv13", 5);
conv_play_curr();
}
-void Room105::enteringMayorsOffice() {
+void Room105::mayorsDoor() {
if (_G(flags)[V031]) {
_val8 = 1;
loadAssets2();
@@ -1753,7 +1752,7 @@ void Room105::unloadAssets4() {
series_unload(_series4[i]);
}
-void Room105::handleDeed1() {
+void Room105::townRecords() {
_val1 = 1;
conv_load_and_prepare("conv12", 2);
conv_export_pointer_curr(&_G(flags)[V033], 0);
@@ -1762,16 +1761,16 @@ void Room105::handleDeed1() {
conv_play_curr();
}
-void Room105::handleDeed2() {
+void Room105::complaintsDept() {
_val1 = 1;
- conv_load_and_prepare("conv12", 4);
+ conv_load_and_prepare("conv11", 4);
conv_export_pointer_curr(&_G(flags)[V032], 0);
conv_export_pointer_curr(&_G(flags)[V033], 3);
conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 5);
conv_play_curr();
}
-void Room105::handleDeed3() {
+void Room105::mayorsOffice() {
_val1 = 1;
conv_load_and_prepare("conv10", 3);
conv_export_value_curr(inv_player_has("deed") ? 1 : 0, 0);
diff --git a/engines/m4/burger/rooms/section1/room105.h b/engines/m4/burger/rooms/section1/room105.h
index b373cf5823d..be0b78f9fbb 100644
--- a/engines/m4/burger/rooms/section1/room105.h
+++ b/engines/m4/burger/rooms/section1/room105.h
@@ -60,8 +60,8 @@ private:
void conv11();
void conv12();
void conv13();
- void talkTo();
- void enteringMayorsOffice();
+ void startConv13();
+ void mayorsDoor();
void loadAssets1();
void loadAssets2();
void loadAssets3();
@@ -70,9 +70,9 @@ private:
void unloadAssets2();
void unloadAssets3();
void unloadAssets4();
- void handleDeed1();
- void handleDeed2();
- void handleDeed3();
+ void townRecords();
+ void complaintsDept();
+ void mayorsOffice();
public:
Room105() : Room() {}
Commit: 6757fbf39bac7fb88f43e1c35f4b44888681f2c1
https://github.com/scummvm/scummvm/commit/6757fbf39bac7fb88f43e1c35f4b44888681f2c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Room 141 is also mapped to room 140
Changed paths:
A engines/m4/burger/rooms/section1/room140_141.cpp
A engines/m4/burger/rooms/section1/room140_141.h
R engines/m4/burger/rooms/section1/room141.cpp
R engines/m4/burger/rooms/section1/room141.h
engines/m4/burger/rooms/section1/section1.cpp
engines/m4/burger/rooms/section1/section1.h
engines/m4/module.mk
diff --git a/engines/m4/burger/rooms/section1/room141.cpp b/engines/m4/burger/rooms/section1/room140_141.cpp
similarity index 99%
rename from engines/m4/burger/rooms/section1/room141.cpp
rename to engines/m4/burger/rooms/section1/room140_141.cpp
index 5c57f7fb282..ca8b1fd283d 100644
--- a/engines/m4/burger/rooms/section1/room141.cpp
+++ b/engines/m4/burger/rooms/section1/room140_141.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "m4/burger/rooms/section1/room141.h"
+#include "m4/burger/rooms/section1/room140_141.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
@@ -135,11 +135,11 @@ static const seriesStreamBreak SERIES4[] = {
};
-void Room141::preload() {
+void Room140_141::preload() {
_G(player).walker_in_this_scene = false;
}
-void Room141::init() {
+void Room140_141::init() {
digi_preload("144_001");
if (_G(game).previous_room != KERNEL_RESTORING_GAME)
@@ -213,7 +213,7 @@ void Room141::init() {
digi_play_loop("144_001", 3, 180);
}
-void Room141::daemon() {
+void Room140_141::daemon() {
int frame;
switch (_G(kernel).trigger) {
@@ -853,7 +853,7 @@ void Room141::daemon() {
}
}
-void Room141::parser() {
+void Room140_141::parser() {
bool lookFlag = player_said("look") || player_said("look at");
if (player_said("conv20")) {
@@ -908,7 +908,7 @@ done:
_G(player).command_ready = false;
}
-void Room141::conv20() {
+void Room140_141::conv20() {
_G(kernel).trigger_mode = KT_PARSE;
int who = conv_whos_talking();
int node = conv_current_node();
@@ -1031,7 +1031,7 @@ void Room141::conv20() {
}
}
-void Room141::playRandom() {
+void Room140_141::playRandom() {
if (_flag1 && !_flag2) {
_flag1 = false;
digi_play(Common::String::format("140t001%c", 'a' + imath_ranged_rand(0, 5)).c_str(),
@@ -1039,7 +1039,7 @@ void Room141::playRandom() {
}
}
-void Room141::loadSeries() {
+void Room140_141::loadSeries() {
static const char *NAMES[34] = {
"140pe02", "140pe02s", "140pe03", "140pe03s", "140pe04",
"140pe04s", "140pe06", "140pe06s", "140pe07", "140pe07s",
diff --git a/engines/m4/burger/rooms/section1/room141.h b/engines/m4/burger/rooms/section1/room140_141.h
similarity index 89%
rename from engines/m4/burger/rooms/section1/room141.h
rename to engines/m4/burger/rooms/section1/room140_141.h
index dce002491ca..f2ce1145235 100644
--- a/engines/m4/burger/rooms/section1/room141.h
+++ b/engines/m4/burger/rooms/section1/room140_141.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef M4_BURGER_ROOMS_SECTION1_ROOM141_H
-#define M4_BURGER_ROOMS_SECTION1_ROOM141_H
+#ifndef M4_BURGER_ROOMS_SECTION1_ROOM140_141_H
+#define M4_BURGER_ROOMS_SECTION1_ROOM140_141_H
#include "m4/burger/rooms/room.h"
@@ -28,7 +28,7 @@ namespace M4 {
namespace Burger {
namespace Rooms {
-class Room141 : public Room {
+class Room140_141 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
@@ -47,8 +47,8 @@ private:
void loadSeries();
public:
- Room141() : Room() {}
- ~Room141() override {}
+ Room140_141() : Room() {}
+ ~Room140_141() override {}
void preload() override;
void init() override;
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 2764dc131f6..4c175119512 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -44,7 +44,8 @@ Section1::Section1() : Rooms::Section() {
add(137, &_room137);
add(138, &_room138);
add(139, &_room139_144);
- add(141, &_room141);
+ add(140, &_room140_141);
+ add(141, &_room140_141);
add(142, &_room142);
add(143, &_room143);
add(145, &_room145);
diff --git a/engines/m4/burger/rooms/section1/section1.h b/engines/m4/burger/rooms/section1/section1.h
index 6deb5c850af..277919c20a8 100644
--- a/engines/m4/burger/rooms/section1/section1.h
+++ b/engines/m4/burger/rooms/section1/section1.h
@@ -36,7 +36,7 @@
#include "m4/burger/rooms/section1/room137.h"
#include "m4/burger/rooms/section1/room138.h"
#include "m4/burger/rooms/section1/room139_144.h"
-#include "m4/burger/rooms/section1/room141.h"
+#include "m4/burger/rooms/section1/room140_141.h"
#include "m4/burger/rooms/section1/room142.h"
#include "m4/burger/rooms/section1/room143.h"
#include "m4/burger/rooms/section1/room145.h"
@@ -71,7 +71,7 @@ private:
Room137 _room137;
Room138 _room138;
Room139_144 _room139_144;
- Room141 _room141;
+ Room140_141 _room140_141;
Room142 _room142;
Room143 _room143;
Room145 _room145;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 4916b1f3b3a..3ea8fb1691d 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -101,7 +101,7 @@ MODULE_OBJS = \
burger/rooms/section1/room137.o \
burger/rooms/section1/room138.o \
burger/rooms/section1/room139_144.o \
- burger/rooms/section1/room141.o \
+ burger/rooms/section1/room140_141.o \
burger/rooms/section1/room142.o \
burger/rooms/section1/room143.o \
burger/rooms/section1/room145.o \
Commit: 35bc3d1d520fd0299c728ed146d9814f93ce1750
https://github.com/scummvm/scummvm/commit/35bc3d1d520fd0299c728ed146d9814f93ce1750
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Hook up the ScummVM save/load dialogs
The engine has tenative code in place for original savegame
dialogs, but it's not yet working correctly.
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/burger.h
engines/m4/burger/rooms/section9/room903.cpp
engines/m4/detection.cpp
engines/m4/gui/hotkeys.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index c0f4062bf6f..3feafbe68d5 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -24,6 +24,7 @@
#include "m4/burger/vars.h"
#include "m4/burger/core/conv.h"
#include "m4/burger/gui/gui_gizmo.h"
+#include "m4/burger/gui/game_menu.h"
#include "m4/graphics/krn_pal.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
@@ -792,5 +793,33 @@ void BurgerEngine::wilburTeleported() {
_G(kernel).trigger_mode = oldMode;
}
+void BurgerEngine::showSaveScreen() {
+ if (_useOriginalSaveLoad) {
+ GUI::CreateF2SaveMenu(_G(master_palette));
+ } else {
+ M4Engine::showSaveScreen();
+ }
+}
+
+void BurgerEngine::showLoadScreen(bool fromMainMenu) {
+ if (_useOriginalSaveLoad) {
+ if (fromMainMenu)
+ GUI::CreateLoadMenuFromMain(_G(master_palette));
+ else
+ GUI::CreateF3LoadMenu(_G(master_palette));
+
+ } else {
+ M4Engine::showLoadScreen(fromMainMenu);
+ }
+}
+
+bool BurgerEngine::canLoadGameStateCurrently(Common::U32String *msg) {
+ if (g_vars && _G(game).room_id == 903)
+ // Allow loading games from the main menu
+ return true;
+ else
+ return M4Engine::canLoadGameStateCurrently(msg);
+}
+
} // namespace Burger
} // namespace M4
diff --git a/engines/m4/burger/burger.h b/engines/m4/burger/burger.h
index e648efac845..0a141a1ea66 100644
--- a/engines/m4/burger/burger.h
+++ b/engines/m4/burger/burger.h
@@ -78,6 +78,10 @@ public:
void syncFlags(Common::Serializer &s) override;
+ void showSaveScreen() override;
+ void showLoadScreen(bool fromMainMenu = false) override;
+ bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
+
void global_daemon() override;
void global_pre_parser() override;
void global_parser() override;
diff --git a/engines/m4/burger/rooms/section9/room903.cpp b/engines/m4/burger/rooms/section9/room903.cpp
index b525eb9a896..feda05d059a 100644
--- a/engines/m4/burger/rooms/section9/room903.cpp
+++ b/engines/m4/burger/rooms/section9/room903.cpp
@@ -120,7 +120,7 @@ void Room903::daemon() {
break;
case 7:
- GUI::CreateLoadMenuFromMain(_G(master_palette));
+ g_engine->showLoadScreen(true);
break;
case 8:
diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp
index a5e54f6b961..6c39ff73d1f 100644
--- a/engines/m4/detection.cpp
+++ b/engines/m4/detection.cpp
@@ -41,7 +41,8 @@ const DebugChannelDef M4MetaEngineDetection::debugFlagList[] = {
};
M4MetaEngineDetection::M4MetaEngineDetection() : AdvancedMetaEngineDetection(M4::gameDescriptions,
- sizeof(M4::M4GameDescription), M4::m4Games) {
+ sizeof(M4::M4GameDescription), M4::m4Games) {
+ _guiOptions = GUIO1(GAMEOPTION_ORIGINAL_SAVELOAD);
}
REGISTER_PLUGIN_STATIC(M4_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, M4MetaEngineDetection);
diff --git a/engines/m4/gui/hotkeys.cpp b/engines/m4/gui/hotkeys.cpp
index 38e919b90c9..c1c66b7dc4f 100644
--- a/engines/m4/gui/hotkeys.cpp
+++ b/engines/m4/gui/hotkeys.cpp
@@ -88,6 +88,8 @@ void Hotkeys::disable_hot_keys() {
void Hotkeys::add_hot_keys() {
AddSystemHotkey(KEY_F2, saveGame);
AddSystemHotkey(KEY_F3, loadGame);
+ AddSystemHotkey(KEY_F5, saveGame);
+ AddSystemHotkey(KEY_F7, loadGame);
AddSystemHotkey(KEY_ALT_X, exit_program);
AddSystemHotkey(KEY_CTRL_X, exit_program);
@@ -145,11 +147,11 @@ void Hotkeys::exit_program(void *, void *) {
}
void Hotkeys::saveGame(void *, void *) {
- warning("TODO: hotkey");
+ g_engine->showSaveScreen();
}
void Hotkeys::loadGame(void *, void *) {
- warning("TODO: hotkey");
+ g_engine->showLoadScreen();
}
void Hotkeys::adv_hyperwalk_to_final_destination(void *a, void *b) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 5201f0d4653..3560ded3d6c 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -82,6 +82,7 @@ Common::Error M4Engine::run() {
setDebugger(new Console());
// Check for launcher savegame to load
+ _useOriginalSaveLoad = ConfMan.getBool("original_menus");
if (ConfMan.hasKey("save_slot")) {
_G(kernel).restore_slot = ConfMan.getInt("save_slot");
_G(game).previous_room = KERNEL_RESTORING_GAME;
@@ -129,6 +130,14 @@ bool M4Engine::canSaveGameStateCurrently(Common::U32String *msg) {
return g_vars && INTERFACE_VISIBLE && player_commands_allowed();
}
+void M4Engine::showSaveScreen() {
+ saveGameDialog();
+}
+
+void M4Engine::showLoadScreen(bool fromMainMenu) {
+ loadGameDialog();
+}
+
Common::Error M4Engine::loadGameState(int slot) {
// Don't load savegame immediately, just set the slot for the engine's
// kernel to take care of in the outer game loop
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index dcd20c6504e..40d75b80ba1 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -59,6 +59,8 @@ private:
Common::InSaveFile *getOriginalSave(int slot) const;
protected:
+ bool _useOriginalSaveLoad = false;
+
// Engine APIs
Common::Error run() override;
@@ -138,6 +140,16 @@ public:
*/
SaveStateList listSaves() const;
+ /**
+ * Show save game dialog
+ */
+ virtual void showSaveScreen();
+
+ /**
+ * Show restore game dialog
+ */
+ virtual void showLoadScreen(bool fromMainMenu = false);
+
/**
* Show the engine information
*/
Commit: e6c7f5e626a0570806407b79d2c325783ec928f0
https://github.com/scummvm/scummvm/commit/e6c7f5e626a0570806407b79d2c325783ec928f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Beginnings of adv_r folder cleanup
Changed paths:
R engines/m4/adv_r/adv_game.cpp
R engines/m4/adv_r/kernel.cpp
engines/m4/adv_r/adv_chk.cpp
engines/m4/adv_r/adv_file.cpp
engines/m4/adv_r/conv.cpp
engines/m4/adv_r/conv_io.cpp
engines/m4/module.mk
diff --git a/engines/m4/adv_r/adv_chk.cpp b/engines/m4/adv_r/adv_chk.cpp
index 67d7bcf9c38..3d918ccd63b 100644
--- a/engines/m4/adv_r/adv_chk.cpp
+++ b/engines/m4/adv_r/adv_chk.cpp
@@ -43,22 +43,22 @@ static HotSpotRec *read_hotspots(SysFile *fpdef, HotSpotRec *h, int32 num) {
for (i = 0; i < num; i++) {
buffPtr = &x1;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->ul_x");
+ error_show(FL, 0, "Could not read ul_x");
x1 = convert_intel32(x1);
buffPtr = &y1;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->ul_y");
+ error_show(FL, 0, "Could not read ul_y");
y1 = convert_intel32(y1);
buffPtr = &x2;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->lr_x");
+ error_show(FL, 0, "Could not read lr_x");
x2 = convert_intel32(x2);
buffPtr = &y2;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->lr_y");
+ error_show(FL, 0, "Could not read lr_y");
y2 = convert_intel32(y2);
h = hotspot_new(x1, y1, x2, y2);
@@ -69,42 +69,42 @@ static HotSpotRec *read_hotspots(SysFile *fpdef, HotSpotRec *h, int32 num) {
buffPtr = &a;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->feet_x");
+ error_show(FL, 0, "Could not read feet_x");
a = convert_intel32(a);
h->feet_x = a;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->feet_y");
+ error_show(FL, 0, "Could not read feet_y");
a = convert_intel32(a);
h->feet_y = a;
buffPtr = &b;
if (!fpdef->read(&buffPtr, sizeof(int8)))
- error_show(FL, 0, "Could not read h->facing");
+ error_show(FL, 0, "Could not read facing");
h->facing = b;
buffPtr = &d;
if (!fpdef->read(&buffPtr, sizeof(bool)))
- error_show(FL, 0, "Could not read h->active");
+ error_show(FL, 0, "Could not read active");
h->active = d;
buffPtr = &e;
if (!fpdef->read(&buffPtr, sizeof(char)))
- error_show(FL, 0, "Could not read h->cursor_number");
+ error_show(FL, 0, "Could not read cursor_number");
h->cursor_number = e;
if (!fpdef->read(&buffPtr, sizeof(char)))
- error_show(FL, 0, "Could not read h->syntax");
+ error_show(FL, 0, "Could not read syntax");
h->syntax = e;
buffPtr = &a;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->vocabID");
+ error_show(FL, 0, "Could not read vocabID");
a = convert_intel32(a);
h->vocabID = a;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->verbID");
+ error_show(FL, 0, "Could not read verbID");
a = convert_intel32(a);
h->verbID = a;
@@ -112,55 +112,55 @@ static HotSpotRec *read_hotspots(SysFile *fpdef, HotSpotRec *h, int32 num) {
buffPtr = &str_len;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->vocab length");
+ error_show(FL, 0, "Could not read vocab length");
str_len = convert_intel32(str_len);
if (str_len) {
buffPtr = &s[0];
if (!fpdef->read(&buffPtr, str_len))
- error_show(FL, 0, "Could not read h->vocab");
+ error_show(FL, 0, "Could not read vocab");
hotspot_newVocab(h, s);
}
buffPtr = &str_len;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->verb length");
+ error_show(FL, 0, "Could not read verb length");
str_len = convert_intel32(str_len);
if (str_len) {
buffPtr = &s[0];
if (!fpdef->read(&buffPtr, str_len))
- error_show(FL, 0, "Could not read h->verb");
+ error_show(FL, 0, "Could not read verb");
hotspot_newVerb(h, s);
}
buffPtr = &str_len;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->prep length");
+ error_show(FL, 0, "Could not read prep length");
str_len = convert_intel32(str_len);
if (str_len) {
buffPtr = &s[0];
if (!fpdef->read(&buffPtr, str_len))
- error_show(FL, 0, "Could not read h->prep");
+ error_show(FL, 0, "Could not read prep");
hotspot_newPrep(h, s);
}
buffPtr = &str_len;
if (!fpdef->read(&buffPtr, sizeof(int32)))
- error_show(FL, 0, "Could not read h->sprite");
+ error_show(FL, 0, "Could not read sprite");
str_len = convert_intel32(str_len);
if (str_len) {
buffPtr = &s[0];
if (!fpdef->read(&buffPtr, str_len))
- error_show(FL, 0, "Could not read h->sprite");
+ error_show(FL, 0, "Could not read sprite");
hotspot_new_sprite(h, s);
}
buffPtr = &c;
if (!fpdef->read(&buffPtr, sizeof(int16)))
- error_show(FL, 0, "Could not read h->sprite");
+ error_show(FL, 0, "Could not read sprite");
c = convert_intel16(c);
h->hash = c;
}
@@ -248,6 +248,7 @@ int db_def_chk_read(int16 room_code, SceneDef *rdef) {
load_def(&fpdef);
fpdef.close();
+
return -1; // everything happy code
}
diff --git a/engines/m4/adv_r/adv_file.cpp b/engines/m4/adv_r/adv_file.cpp
index a8e4fd8268d..a5038067c26 100644
--- a/engines/m4/adv_r/adv_file.cpp
+++ b/engines/m4/adv_r/adv_file.cpp
@@ -207,8 +207,6 @@ GrBuff *load_codes(SysFile *code_file) {
x_size = convert_intel16(x_size);
y_size = convert_intel16(y_size);
- //int buffer_size = (int)(x_size * y_size);
-
GrBuff *temp = new GrBuff(x_size, y_size);
if (!temp) {
error_show(FL, 'OOM!', "load_codes: %d bytes", (int16)(x_size * y_size));
@@ -317,8 +315,7 @@ static Common::String get_attribute_filename(const SceneDef *rdef) {
}
static void recreate_animation_draw_screen(GrBuff **loadBuf) {
- // remove previous animation draw screen
-
+ // Remove previous animation draw screen
if (_G(gameDrawBuff)) {
gui_buffer_deregister((Buffer *)_G(gameDrawBuff));
delete _G(gameDrawBuff);
@@ -359,5 +356,4 @@ static void troll_for_colors(RGB8 *newPal, uint8 minPalEntry, uint8 maxPalEntry)
}
}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_game.cpp b/engines/m4/adv_r/adv_game.cpp
deleted file mode 100644
index 075e1f56a14..00000000000
--- a/engines/m4/adv_r/adv_game.cpp
+++ /dev/null
@@ -1,27 +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/>.
- *
- */
-
-#include "m4/adv_r/adv_game.h"
-#include "m4/core/rooms.h"
-
-namespace M4 {
-
-} // End of namespace M4
diff --git a/engines/m4/adv_r/conv.cpp b/engines/m4/adv_r/conv.cpp
index 4d88972e374..a9f5c54f0c9 100644
--- a/engines/m4/adv_r/conv.cpp
+++ b/engines/m4/adv_r/conv.cpp
@@ -62,23 +62,18 @@ static void conv_exec_entry(int32 offset, Conv *c) {
switch (tag) {
case TEXT_CHUNK:
- //fprintf( conv_fp, "TEXT_CHUNK\n" );
break;
case MESSAGE_CHUNK:
- //fprintf( conv_fp, "MESSAGE_CHUNK\n" );
break;
case ENTRY_CHUNK:
- //fprintf( conv_fp, "ENTRY_CHUNK\n" );
break;
case FALL_CHUNK:
- //fprintf( conv_fp, "FALL_CHUNK\n" );
break;
case C_ASGN_CHUNK:
- //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
c_asgn = get_c_asgn(c, i);
decl = get_decl(c, c_asgn->c_op_l);
@@ -91,14 +86,12 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case ASGN_CHUNK:
- //fprintf( conv_fp, "ASGN_CHUNK\n" );
asgn = get_asgn(c, i);
decl = get_decl(c, asgn->index);
conv_set_decl_val(decl, conv_ops_process_asgn(conv_get_decl_val(decl), asgn->op, asgn->opnd1));
break;
case HIDE_CHUNK:
- //fprintf( conv_fp, "HIDE_CHUNK\n" );
misc = get_misc(c, i);
entry = get_hash_entry(c, misc->index);
@@ -107,7 +100,6 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case CHDE_CHUNK:
- //fprintf( conv_fp, "CHDE_CHUNK\n" );
c_misc = get_c_misc(c, i);
entry = get_hash_entry(c, c_misc->index);
@@ -121,7 +113,6 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case UHID_CHUNK:
- //fprintf( conv_fp, "UHID_CHUNK\n" );
misc = get_misc(c, i);
entry = get_hash_entry(c, misc->index);
if (!(entry->status & DESTROYED)) {
@@ -131,7 +122,6 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case CUHD_CHUNK:
- //fprintf( conv_fp, "CUHD_CHUNK\n" );
c_misc = get_c_misc(c, i);
entry = get_hash_entry(c, c_misc->index);
@@ -147,14 +137,12 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case DSTR_CHUNK:
- //fprintf( conv_fp, "DSTR_CHUNK\n" );
misc = get_misc(c, i);
entry = get_hash_entry(c, misc->index);
entry->status |= DESTROYED;
break;
case CDST_CHUNK:
- //fprintf( conv_fp, "CDST_CHUNK\n" );
c_misc = get_c_misc(c, i);
entry = get_hash_entry(c, c_misc->index);
@@ -166,7 +154,6 @@ static void conv_exec_entry(int32 offset, Conv *c) {
break;
case COND_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
c_goto = get_c_goto(c, i);
decl = get_decl(c, c_goto->opnd1);
@@ -175,15 +162,11 @@ static void conv_exec_entry(int32 offset, Conv *c) {
if (conv_ops_cond_successful(l_op, c_goto->op, r_op)) {
c->myCNode = c_goto->index;
-
- //////term_message( "COND GOTO %x", c->myCNode );
- //fprintf( conv_fp, "COND GOTO %x\n", c->myCNode );
return;
}
break;
case COND_EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
c_goto = get_c_goto(c, i);
decl = get_decl(c, c_goto->opnd1);
@@ -198,14 +181,11 @@ static void conv_exec_entry(int32 offset, Conv *c) {
c->exit_now = CONV_QUIT;
c->myCNode = CONV_QUIT;
}
- //////term_message( "COND EXIT GOTO %x", c->myCNode );
- //fprintf( conv_fp, "COND EXIT GOTO %x\n", c->myCNode );
return;
}
break;
case EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
go = get_goto(c, i);
if (go->index != CONV_QUIT) {
@@ -215,39 +195,31 @@ static void conv_exec_entry(int32 offset, Conv *c) {
c->exit_now = CONV_QUIT;
c->myCNode = CONV_QUIT;
}
- //////term_message( "EXIT GOTO %x", c->myCNode );
- //fprintf( conv_fp, "EXIT GOTO %x\n", c->myCNode );
return;
case GOTO_CHUNK:
- //////fprintf( conv_fp, "GOTO_CHUNK\n" );
go = get_goto(c, i);
c->myCNode = go->index;
- //////term_message( "GOTO %x", c->myCNode );
- //fprintf( conv_fp, "GOTO %x\n", c->myCNode );
return;
- //replies are non-player responses
+ // Replies are non-player responses
case REPLY_CHUNK:
- //fprintf( conv_fp, "REPLY_CHUNK\n" );
break;
case COND_REPLY_CHUNK:
- //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
break;
case WEIGHT_REPLY_CHUNK:
- //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
break;
case WEIGHT_PREPLY_CHUNK:
- //fprintf( conv_fp, "WEIGHT_PREPLY_CHUNK\n" );
break;
default:
conv_ops_unknown_chunk(tag, "conv_exec_entry");
break;
}
+
i = next;
}
}
@@ -279,72 +251,55 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
switch (tag) {
case TEXT_CHUNK:
- //fprintf( conv_fp, "TEXT_CHUNK\n" );
break;
case MESSAGE_CHUNK:
- //fprintf( conv_fp, "MESSAGE_CHUNK\n" );
break;
case ENTRY_CHUNK:
- //fprintf( conv_fp, "ENTRY_CHUNK\n" );
break;
case FALL_CHUNK:
- //fprintf( conv_fp, "FALL_CHUNK\n" );
break;
case C_ASGN_CHUNK:
- //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
break;
case ASGN_CHUNK:
- //fprintf( conv_fp, "ASGN_CHUNK\n" );
break;
case HIDE_CHUNK:
- //fprintf( conv_fp, "HIDE_CHUNK\n" );
break;
case CHDE_CHUNK:
- //fprintf( conv_fp, "CHDE_CHUNK\n" );
break;
case UHID_CHUNK:
- //fprintf( conv_fp, "UHID_CHUNK\n" );
break;
case CUHD_CHUNK:
- //fprintf( conv_fp, "CUHD_CHUNK\n" );
break;
case DSTR_CHUNK:
- //fprintf( conv_fp, "DSTR_CHUNK\n" );
break;
case CDST_CHUNK:
- //fprintf( conv_fp, "CDST_CHUNK\n" );
break;
case COND_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
break;
case COND_EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
break;
case EXIT_GOTO_CHUNK:
- //fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
break;
case GOTO_CHUNK:
- //fprintf( conv_fp, "GOTO_CHUNK\n" );
break;
case REPLY_CHUNK:
reply = get_reply(c, i);
- //fprintf( conv_fp, "REPLY_CHUNK\n" );
if (is_valid) {
result = 1;
@@ -353,11 +308,9 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
if (!strcmp(_G(cdd).mesg, "")) {
text_len = conv_ops_text_strlen(get_string(c, reply->index + sizeof(mesg_chunk)));
- ////fprintf( conv_fp, "reply->index %x text_len %d\n", reply->index, text_len );
Common::strcpy_s(_G(cdd).mesg, get_string(c, reply->index + sizeof(mesg_chunk) + text_len));
_G(cdd).mesg_snd_file = get_string(c, reply->index + sizeof(mesg_chunk));
- //////term_message( "Rreply %s", _G(cdd).mesg_snd_file );
- ////fprintf( conv_fp, "Rreply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode );
+
} else {
Common::strcat_s(_G(cdd).mesg, " ");
text_len = conv_ops_text_strlen(get_string(c, reply->index + sizeof(mesg_chunk)));
@@ -368,7 +321,6 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
break;
case COND_REPLY_CHUNK:
- //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
c_reply = get_c_reply(c, i);
decl = get_decl(c, c_reply->op_l);
@@ -383,8 +335,7 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
text_len = conv_ops_text_strlen(get_string(c, c_reply->index + sizeof(mesg_chunk)));
Common::strcpy_s(_G(cdd).mesg, get_string(c, c_reply->index + sizeof(mesg_chunk) + text_len));
_G(cdd).mesg_snd_file = get_string(c, c_reply->index + sizeof(mesg_chunk));
- //////term_message( "cond reply %s", _G(cdd).mesg_snd_file );
- ////fprintf( conv_fp, "cond reply %s %x\n", _G(cdd).mesg_snd_file, c->myCNode );
+
} else {
Common::strcat_s(_G(cdd).mesg, " ");
text_len = conv_ops_text_strlen(get_string(c, c_reply->index + sizeof(mesg_chunk)));
@@ -395,7 +346,6 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
break;
case WEIGHT_REPLY_CHUNK:
- //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
cSize = i;
w_reply = get_w_reply(c, i);
cSize += sizeof(w_reply_chunk);
@@ -438,7 +388,6 @@ static int conv_get_mesg(int32 offset, int32 is_valid, Conv *c) {
break;
case WEIGHT_PREPLY_CHUNK:
- //fprintf( conv_fp, "WEIGHT_REPLY_CHUNK\n" );
cSize = i;
w_reply = get_w_reply(c, i);
cSize += sizeof(w_reply_chunk);
@@ -524,14 +473,13 @@ static void find_true_ent(int entry_num, Conv *c) {
break;
}
- //ent will now be pointing at an ENTRY or FALLTHROUGH
+ // ent will now be pointing at an ENTRY or FALLTHROUGH
sub_ent = next;
conv_ops_get_entry(sub_ent, &next, &tag, c);
switch (tag) {
case FALL_CHUNK:
- //we either want to jump to a new node
- //or skip to the first offset.
- //fprintf( conv_fp, "FALL_CHUNK 1.\n" );
+ // We either want to jump to a new node
+ // or skip to the first offset.
fall = get_fall(c, sub_ent);
assert(fall);
@@ -555,7 +503,7 @@ static void find_true_ent(int entry_num, Conv *c) {
_GC(ent) = 0;
- //not only i<entry_num, check to see entry->num_entries
+ // Not only i<entry_num, check to see entry->num_entries
for (i = 0, n = 0; n < num_ents; n++) {
offset = get_long(c, ent);
entry = get_entry(c, ent + offset);
@@ -566,7 +514,6 @@ static void find_true_ent(int entry_num, Conv *c) {
if (((entry->status) & 0x00000003) && ok_status(entry)) //was 1
i++;
- //fprintf( conv_fp, "find_true_ent _GC(ent)++\n" );
_GC(ent)++;
ent += sizeof(int32);
@@ -587,7 +534,7 @@ static int conv_get_node_text(Conv *c) {
_G(cdd).num_txt_ents = 0;
_GC(width) = 0; _GC(height) = 0;
- //conv _get_node_text will either get a NODE or LNODE
+ // conv _get_node_text will either get a NODE or LNODE
conv_ops_get_entry(offset, &next, &tag, c);
offset = 0; //not needed.?
_GC(n_t_e) = 0;
@@ -608,14 +555,14 @@ static int conv_get_node_text(Conv *c) {
break;
default:
- //handle error.
+ // handle error.
break;
}
switch (tag) {
case LNODE_CHUNK:
- //was in bounds.
- //lnode->entry_num starts at 0. in the chunk.
+ // was in bounds.
+ // lnode->entry_num starts at 0. in the chunk.
if (lnode->entry_num >= lnode->num_entries)
lnode->entry_num = 0;
@@ -646,7 +593,7 @@ static int conv_get_node_text(Conv *c) {
}
lnode->entry_num++;
- //fprintf( conv_fp, "2. lnode_chunk: conv_get_node_text _GC(ent)=lnode->entry_num++!!!!\n" );
+
_GC(ent) = lnode->entry_num;
break;
@@ -679,7 +626,6 @@ static int conv_get_node_text(Conv *c) {
c->myCNode = fall->index;
c->mode = CONV_GET_TEXT_MODE;
- //fprintf( conv_fp, "FALLTHROUGH!\n" );
result = 0;
}
}
@@ -698,25 +644,25 @@ void conv_shutdown(void) {
_GC(myTextScrn) = nullptr;
}
-// Simplify me.
static void conv_start(Conv *c) {
int32 ok = 1, ent = 0, tag = 0, next;
decl_chunk *decl;
switch (c->exit_now) {
- case CONV_OK: // Potential prob. when entering while loop.
+ case CONV_OK:
+ // Potential prob. when entering while loop.
break;
- // Goto_exit encountered.
- //a conversation state.
+ // Goto_exit encountered.
+ // a conversation state.
case CONV_BAIL:
return;
- // Goodbye forever.
+ // Goodbye forever.
case CONV_QUIT:
return;
- //new conv. no restore file on hard disk.
+ //new conv. no restore file on hard disk.
case CONV_NEW:
c->exit_now = CONV_OK;
c->myCNode = 0;
@@ -746,11 +692,10 @@ static void conv_start(Conv *c) {
}
c->myCNode = ent;
- //if we exit, the current node is set, the next node is null
+ // if we exit, the current node is set, the next node is null
}
static int conv_next_node(Conv *c) {
- //delete me....
if (c->myCNode == -1)
return 0;
@@ -779,9 +724,8 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
int i = 0;
int32 sub_ent = 0;
int result = 1;
- //int changed = 0;
- //repeat fallthrough till done
+ // Repeat fallthrough till done
for (;; ) {
// Start by getting the current NODE or LNODE
conv_ops_get_entry(ent, &next, &tag, c);
@@ -805,18 +749,18 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
break;
}
- //ent will now be pointing at an ENTRY or FALLTHROUGH
+ // ent will now be pointing at an ENTRY or FALLTHROUGH
sub_ent = next;
conv_ops_get_entry(sub_ent, &next, &tag, c);
switch (tag) {
case FALL_CHUNK:
- //we either want to jump to a new node
- //or skip to the first offset.
+ // We either want to jump to a new node
+ // or skip to the first offset.
fall = get_fall(c, sub_ent);
assert(fall);
- //do this to skip the fall chunk and all will be fine.
+ // Do this to skip the fall chunk and all will be fine.
ent += sizeof(int32); //was get_long, sizeof( fall_chunk )
n++; //don't increment i.
break;
@@ -832,7 +776,7 @@ static int conv_process_entry(int entry_num, Conv *c, int mode) {
break;
}
- //not only i<entry_num, check to see entry->num_entries
+ // Not only i<entry_num, check to see entry->num_entries
while ((i < entry_num) && (n < num_ents)) {
offset = get_long(c, ent);
entry = get_entry(c, ent + offset);
@@ -869,37 +813,28 @@ static int conv_run(Conv *c) {
if (!c)
return 0;
- int /*i=0,*/ result = 0;
+ int result = 0;
int ok = 1;
if (conv_next_node(c)) {
switch (c->exit_now) {
case CONV_NEW:
- //term_message( "conv_run CONV_NEW" );
break;
case CONV_QUIT:
- //term_message( "conv_run CONV_QUIT" );
break;
case CONV_BAIL:
- //term_message( "conv_run CONV_BAIL" );
break;
case CONV_OK:
- //term_message( "conv_run CONV_OK" );
while (ok && conv_next_node(c)) {
switch (c->mode) {
case CONV_GET_TEXT_MODE:
cdd_init();
- //////fprintf( conv_fp, "conv_run cdd_init\n" );
-
- //////term_message( "conv_run CONV_GET_TEXT_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_GET_TEXT_MODE %x\n", c->myCNode );
c->mode = CONV_GET_MESG_MODE;
if (conv_get_node_text(c)) {
- //////fprintf( conv_fp, "got some text %d\n", _G(cdd).num_txt_ents );
ok = 0;
if (_G(cdd).num_txt_ents) { //node
mouse_unlock_sprite();
@@ -908,25 +843,20 @@ static int conv_run(Conv *c) {
textBoxInit();
} else { //linear node.
conv_set_event(-1);
- //////term_message( "conv_run LNODE text entry" );
+
Common::strcpy_s(_G(player).verb, get_conv_name()); //was verb.
c->c_entry_num = 1;
}
- } ////else fprintf( conv_fp, "didn't get any text\n" );
+ }
break;
case CONV_GET_MESG_MODE:
cdd_init();
- //////fprintf( conv_fp, "conv_run cdd_init\n" );
-
- //////term_message( "conv_run CONV_GET_MESG_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_GET_MESG_MODE %x %d\n", c->myCNode, c->c_entry_num );
if (conv_process_entry(c->c_entry_num, c, CONV_GET_MESG_MODE)) {
mouse_unlock_sprite();
mouse_lock_sprite(5);
- //////fprintf( conv_fp, "conv_run successful\n" );
conv_set_event(-1);
Common::strcpy_s(_G(player).verb, get_conv_name());
@@ -936,9 +866,6 @@ static int conv_run(Conv *c) {
break;
case CONV_UPDATE_MODE:
- //////term_message( "conv_run CONV_UPDATE_MODE" );
- //////fprintf( conv_fp, "conv_run CONV_UPDATE_MODE %x\n", c->myCNode );
- //////term_message( "conv_process_entry %d", c->c_entry_num );
conv_process_entry(c->c_entry_num, c, CONV_UPDATE_MODE);
c->mode = CONV_GET_TEXT_MODE;
@@ -998,13 +925,9 @@ void set_dlg_rect() {
screen_x_size = VIDEO_W;
screen_y_size = (game_buff_ptr->y2 - game_buff_ptr->y1);
- //term_message( "y2 %d", game_buff_ptr->y2 );
- //term_message( "y1 %d", game_buff_ptr->y1 );
-
_GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v); // Must have....
_GC(width) += 2 * _GC(conv_font_spacing_h);
- //fprintf( conv_fp, "_GC(width) %d _GC(height) %d _G(cdd).nte %d\n", _GC(width), _GC(height), _G(cdd).num_txt_ents );
sizex = _GC(width);
sizey = _G(cdd).num_txt_ents * (_GC(height))+_GC(conv_font_spacing_v);
@@ -1052,7 +975,6 @@ void set_dlg_rect() {
if (_GC(r_y1) < 0)
_GC(r_y1) = 0;
- //fprintf( conv_fp, "_GC(r_x1) %d sizex %d\n", _GC(r_x1), sizex );
_GC(r_y2) = _GC(r_y1) + sizey - 1;
_GC(r_x2) = _GC(r_x1) + sizex - 1;
diff --git a/engines/m4/adv_r/conv_io.cpp b/engines/m4/adv_r/conv_io.cpp
index 2def6a91e8d..07bc298bf6a 100644
--- a/engines/m4/adv_r/conv_io.cpp
+++ b/engines/m4/adv_r/conv_io.cpp
@@ -293,22 +293,18 @@ static int32 find_state(char *s, char *c, int file_size) {
char name[9];
int32 size = 0, offset = 0;
- ////fprintf( conv_fp, "find_state %s\n", s );
while (offset < file_size) {
cstrncpy(name, &c[offset], 8);
- ////fprintf( conv_fp, "name '%s' offset %d\n", name, offset );
name[8] = '\0';
if (!scumm_strnicmp(name, s, 8)) {
offset += 8 * sizeof(char);
- ////fprintf( conv_fp, "state found\n" );
goto handled;
}
offset += 8 * sizeof(char);
if (offset < file_size) {
memcpy(&size, &c[offset], sizeof(int32));
- ////fprintf( conv_fp, "size %x\n", size );
}
offset += size + sizeof(int32);
@@ -316,7 +312,6 @@ static int32 find_state(char *s, char *c, int file_size) {
offset = -1;
- ////fprintf( conv_fp, "state not found\n" );
handled:
return offset;
}
@@ -346,7 +341,7 @@ void find_and_set_conv_name(Conv *c) {
static void conv_save_state(Conv *c) {
//-------------------------------------------------------------------------------
- // calculate amt_to_write by counting up the size of DECL_CHUNKs.
+ // Calculate amt_to_write by counting up the size of DECL_CHUNKs.
// the number of ENTRY_CHUNKs affects the amt_to_write
// also extract fname from the CONV_CHUNK
@@ -473,7 +468,6 @@ static void conv_save_state(Conv *c) {
int32 e_flags = 0;
short flag_index = 0;
- // short flag_num = 0;
ent = 0;
c->myCNode = 0;
@@ -506,7 +500,6 @@ static void conv_save_state(Conv *c) {
if (flag_index == 32) {
flag_index = 0;
- //flag_num++;
memcpy(&conv_save_buff[offset], &e_flags, sizeof(int32));
offset += sizeof(int32);
@@ -515,7 +508,6 @@ static void conv_save_state(Conv *c) {
e_flags = 0;
}
- //fprintf( conv_fp, "entry->status %d\n", entry->status );
e_flags |= ((entry->status & 0x0000000f) << flag_index);
flag_index += 4;
@@ -598,11 +590,10 @@ static Conv *conv_restore_state(Conv *c) {
Common::copy(&_GC(convSave)[0], &_GC(convSave)[0] + file_size, &conv_save_buff[0]);
offset = find_state(fname, conv_save_buff, file_size);
- // nick 960501 changed from a return c to a goto in order to corret an insidious memory leak!
if (offset == -1)
goto i_am_so_done;
- //skip header.
+ // Skip header.
offset += sizeof(int32);
memcpy(&myCNode, &conv_save_buff[offset], sizeof(int32));
@@ -641,15 +632,9 @@ static Conv *conv_restore_state(Conv *c) {
switch (tag) {
case LNODE_CHUNK:
- if (myCNode == ent) {
- //dont_update_ents = 1;
- } else {
- //dont_update_ents = 0;
- }
break;
case NODE_CHUNK:
- //dont_update_ents = 0;
break;
case ENTRY_CHUNK:
@@ -667,7 +652,6 @@ static Conv *conv_restore_state(Conv *c) {
val = (e_flags >> flag_index) & 0x0000000f;
entry->status = val;
- //fprintf( conv_fp, "entry->status %d\n", entry->status );
flag_index += 4;
break;
@@ -681,7 +665,7 @@ static Conv *conv_restore_state(Conv *c) {
c->myCNode = myCNode;
if (c->myCNode == CONV_QUIT) {
c->exit_now = CONV_QUIT;
- ////fprintf( conv_fp, "c->myCNode == CONV_QUIT conv_unload()\n" );
+
conv_unload(c);
c = nullptr;
} else c->exit_now = CONV_OK;
diff --git a/engines/m4/adv_r/kernel.cpp b/engines/m4/adv_r/kernel.cpp
deleted file mode 100644
index 17d8adeec43..00000000000
--- a/engines/m4/adv_r/kernel.cpp
+++ /dev/null
@@ -1,26 +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/>.
- *
- */
-
-#include "m4/adv_r/kernel.h"
-
-namespace M4 {
-
-} // namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 3ea8fb1691d..d6f4e54a764 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -11,7 +11,6 @@ MODULE_OBJS = \
adv_r/adv_chk.o \
adv_r/adv_control.o \
adv_r/adv_file.o \
- adv_r/adv_game.o \
adv_r/adv_hotspot.o \
adv_r/adv_interface.o \
adv_r/adv_inv.o \
@@ -24,7 +23,6 @@ MODULE_OBJS = \
adv_r/conv.o \
adv_r/conv_io.o \
adv_r/db_env.o \
- adv_r/kernel.o \
adv_r/other.o \
core/cstring.o \
core/errors.o \
Commit: 09bdaed772a576daba927642c4f3d929a332dc2e
https://github.com/scummvm/scummvm/commit/09bdaed772a576daba927642c4f3d929a332dc2e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Further adv_r cleanup
Changed paths:
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_player.cpp
engines/m4/adv_r/chunk_ops.cpp
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index f6472e749ff..6a1530cc18c 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -220,7 +220,7 @@ const char *inv_get_verbs(const Common::String &itemName) {
return nullptr;
}
-// this is provided so that when restoring a game from a save file,
+// This is provided so that when restoring a game from a save file,
// we store a pointer to the registered name, not to an unmanaged
// memory pointer.
diff --git a/engines/m4/adv_r/adv_player.cpp b/engines/m4/adv_r/adv_player.cpp
index 3a15c145a31..f02ec7f7509 100644
--- a/engines/m4/adv_r/adv_player.cpp
+++ b/engines/m4/adv_r/adv_player.cpp
@@ -116,7 +116,7 @@ void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int
}
-// this routine must also load shadow animations
+// This routine must also load shadow animations
bool player_load_series(const char *walkerName, const char *shadowName, bool load_palette) {
int i;
@@ -124,7 +124,7 @@ bool player_load_series(const char *walkerName, const char *shadowName, bool loa
char assetPath[MAX_FILENAME_SIZE];
char *tempPtr;
- //LOAD WALKER
+ // Load walker
db_rmlst_get_asset_room_path(walkerName, assetPath, &thatRoomCode);
tempPtr = strrchr(assetPath, '.');
if (!tempPtr)
@@ -136,11 +136,10 @@ bool player_load_series(const char *walkerName, const char *shadowName, bool loa
for (i = 1; i <= 5; i++) {
*tempPtr = (char)((int32)'0' + i);
- //env_get_path(fullPath, thatRoomCode, assetPath);
AddWSAssetCELS(assetPath, i - 1, load_palette ? _G(master_palette) : nullptr);
}
- //LOAD WALKER SHADOW
+ // Load walker shadow
db_rmlst_get_asset_room_path(shadowName, assetPath, &thatRoomCode);
tempPtr = strrchr(assetPath, '.');
if (!tempPtr)
diff --git a/engines/m4/adv_r/chunk_ops.cpp b/engines/m4/adv_r/chunk_ops.cpp
index f319c907de6..2067a3542b9 100644
--- a/engines/m4/adv_r/chunk_ops.cpp
+++ b/engines/m4/adv_r/chunk_ops.cpp
@@ -71,34 +71,28 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
switch (*tag) {
case C_ASGN_CHUNK:
- //fprintf( conv_fp, "C_ASGN_CHUNK\n" );
k = sizeof(c_assign_chunk);
break;
case ASGN_CHUNK:
- //fprintf( conv_fp, "ASGN_CHUNK\n" );
k = sizeof(assign_chunk);
break;
case CONV_CHUNK:
- //fprintf( conv_fp, "CONV_CHUNK\n" );
CC = (conv_chunk *)&outChunk[i];
j = CC->size;
break;
case DECL_CHUNK:
- //fprintf( conv_fp, "DECL_CHUNK\n" );
k = sizeof(decl_chunk);
break;
case FALL_CHUNK:
- //fprintf( conv_fp, "FALL_CHUNK\n" );
k = sizeof(fall_chunk);
break;
case LNODE_CHUNK:
- //fprintf( conv_fp, "LNODE_CHUNK\n" );
L = (lnode_chunk *)&outChunk[i];
k = sizeof(lnode_chunk);
@@ -112,7 +106,6 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
break;
case NODE_CHUNK:
- //fprintf( conv_fp, "NODE_CHUNK\n" );
N = (node_chunk *)&outChunk[i];
k = sizeof(node_chunk);
@@ -126,33 +119,24 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
break;
case ENTRY_CHUNK:
- //fprintf( conv_fp, "ENTRY_CHUNK\n" );
k = sizeof(entry_chunk);
break;
case TEXT_CHUNK:
case MESSAGE_CHUNK:
- //if( *tag == TEXT_CHUNK )
- // fprintf( conv_fp, "MESSAGE_CHUNK\n" );
- //if( *tag == TEXT_CHUNK )
- // fprintf( conv_fp, "TEXT_CHUNK\n" );
-
T = (text_chunk *)&outChunk[i];
num_blocks = T->size;
k = sizeof(text_chunk);
j = num_blocks;
- //fprintf( conv_fp, "%s\n", outChunk[i+j] );
break;
case REPLY_CHUNK:
- //fprintf( conv_fp, "REPLY_CHUNK\n" );
k = sizeof(reply_chunk);
break;
case WEIGHT_REPLY_CHUNK:
- //fprintf( conv_fp, "WREPLY_CHUNK\n" );
W = (w_reply_chunk *)&outChunk[i];
k = sizeof(w_reply_chunk);
@@ -165,7 +149,6 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
break;
case WEIGHT_PREPLY_CHUNK:
- //fprintf( conv_fp, "WREPLY_CHUNK\n" );
W = (w_reply_chunk *)&outChunk[i];
k = sizeof(w_reply_chunk);
@@ -178,40 +161,28 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
break;
case COND_REPLY_CHUNK:
- //fprintf( conv_fp, "COND_REPLY_CHUNK\n" );
k = sizeof(c_reply_chunk);
break;
case COND_EXIT_GOTO_CHUNK:
case COND_GOTO_CHUNK:
- //if( *tag == COND_EXIT_GOTO_CHUNK )
- // fprintf( conv_fp, "COND_EXIT_GOTO_CHUNK\n" );
- //if( *tag == COND_GOTO_CHUNK )
- // fprintf( conv_fp, "COND_GOTO_CHUNK\n" );
k = sizeof(c_goto_chunk);
break;
case GOTO_CHUNK:
case EXIT_GOTO_CHUNK:
- //if( *tag == EXIT_GOTO_CHUNK )
- // fprintf( conv_fp, "EXIT_GOTO_CHUNK\n" );
- //if( *tag == GOTO_CHUNK )
- // fprintf( conv_fp, "GOTO_CHUNK\n" );
-
k = sizeof(goto_chunk);
break;
case HIDE_CHUNK:
case UHID_CHUNK:
case DSTR_CHUNK:
- //fprintf( conv_fp, "MISC_CHUNK\n" );
k = sizeof(misc_chunk);
break;
case CHDE_CHUNK:
case CUHD_CHUNK:
case CDST_CHUNK:
- //fprintf( conv_fp, "CMISC_CHUNK\n" );
k = sizeof(c_misc_chunk);
break;
@@ -226,7 +197,7 @@ char *conv_ops_get_entry(int32 i, int32 *next, int32 *tag, Conv *c) {
j += i;
*next = j;
- //fprintf( conv_fp, "\n\n" );
+
return &outChunk[i];
}
@@ -244,7 +215,6 @@ assign_chunk *get_asgn(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
a = (assign_chunk *)&s[cSize];
- //swap_assign( a );
return a;
}
@@ -267,7 +237,6 @@ c_assign_chunk *get_c_asgn(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
c_a = (c_assign_chunk *)&s[cSize];
- //swap_c_asgn( c_a );
return c_a;
}
@@ -283,7 +252,6 @@ conv_chunk *get_conv(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
c_v = (conv_chunk *)&s[cSize];
- //swap_conv( c_v );
return c_v;
}
@@ -291,7 +259,6 @@ static void swap_decl(decl_chunk *d) {
d->tag = convert_intel32(d->tag);
d->val = convert_intel32(d->val);
d->flags = convert_intel32(d->flags);
- //int32 = convert_intel32( *addr );
}
decl_chunk *get_decl(Conv *c, int32 cSize) {
@@ -301,7 +268,6 @@ decl_chunk *get_decl(Conv *c, int32 cSize) {
s = c->conv;
d = (decl_chunk *)&s[cSize];
- //swap_decl( d );
return d;
}
@@ -318,7 +284,6 @@ fall_chunk *get_fall(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
f = (fall_chunk *)&s[cSize];
- //swap_fall( f );
return f;
}
@@ -332,12 +297,11 @@ static void swap_lnode(lnode_chunk *l) {
l->entry_num = convert_intel32(l->entry_num);
l->num_entries = convert_intel32(l->num_entries);
- L = (int32 *)l; //was &l
- L += 5; // *sizeof( int32 );
+ L = (int32 *)l;
+ L += 5;
for (i = 0; i < l->num_entries; i++) {
L[i] = convert_intel32(L[i]);
}
- //
}
lnode_chunk *get_lnode(Conv *c, int32 cSize) {
@@ -347,7 +311,6 @@ lnode_chunk *get_lnode(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
l = (lnode_chunk *)&s[cSize];
- //swap_lnode( l );
return l;
}
@@ -390,7 +353,6 @@ entry_chunk *get_entry(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
e = (entry_chunk *)&s[cSize];
- //swap_entry( e );
return e;
}
@@ -401,7 +363,6 @@ entry_chunk *get_hash_entry(Conv *c, int32 cSize) {
s = &(c->conv[0]);
e = (entry_chunk *)&s[cSize];
- //swap_hash_entry( e );
return e;
}
@@ -417,7 +378,6 @@ text_chunk *get_text(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
t = (text_chunk *)&s[cSize];
- //swap_text( t );
return t;
}
@@ -433,7 +393,6 @@ mesg_chunk *get_mesg(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
m = (mesg_chunk *)&s[cSize];
- //swap_mesg( m );
return m;
}
@@ -449,7 +408,6 @@ reply_chunk *get_reply(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
r = (reply_chunk *)&s[cSize];
- //swap_reply( r );
return r;
}
@@ -468,7 +426,6 @@ c_reply_chunk *get_c_reply(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
c_r = (c_reply_chunk *)&s[cSize];
- //swap_c_reply( c_r );
return c_r;
}
@@ -515,7 +472,6 @@ goto_chunk *get_goto(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
g = (goto_chunk *)&s[cSize];
- //swap_goto( g );
return g;
}
@@ -534,7 +490,6 @@ c_goto_chunk *get_c_goto(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
cg = (c_goto_chunk *)&s[cSize];
- //swap_c_goto( cg );
return cg;
}
@@ -550,7 +505,6 @@ misc_chunk *get_misc(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
m = (misc_chunk *)&s[cSize];
- //swap_misc( m );
return m;
}
@@ -571,16 +525,9 @@ c_misc_chunk *get_c_misc(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
cm = (c_misc_chunk *)&s[cSize];
- //swap_c_misc( cm );
return cm;
}
-#if 0
-static void swap_long(int32 *l) {
- *l = convert_intel32(*l);
-}
-#endif
-
int32 get_long(Conv *c, int32 cSize) {
char *s = nullptr;
int32 *l = nullptr;
@@ -588,7 +535,6 @@ int32 get_long(Conv *c, int32 cSize) {
s = &(c->conv[c->myCNode]);
l = (int32 *)&s[cSize];
- //swap_long( l );
return *l;
}
@@ -657,11 +603,7 @@ int32 conv_ops_process_asgn(int32 val, int32 oprtr, int32 opnd) {
break;
default:
-#ifdef TEST_CONV
- printf("uh-oh\n");
-#else
error_show(FL, 'PARS', "Operator must be a +,-,*,/,=, Please check tag type: %d in token header file", oprtr);
-#endif
break;
}
return val;
@@ -679,7 +621,6 @@ void conv_swap_words(Conv *c) {
fall_chunk *fall = nullptr;
lnode_chunk *lnode = nullptr;
entry_chunk *entry = nullptr;
- //entry_chunk *hash_entry = nullptr;
text_chunk *text = nullptr;
mesg_chunk *mesg = nullptr;
@@ -776,7 +717,6 @@ void conv_swap_words(Conv *c) {
w_reply = get_w_reply(c, ent);
swap_w_reply(w_reply);
- //dec1
tempEnt = ent + sizeof(w_reply_chunk);
for (x = 0; x < w_reply->num_replies; x++) {
@@ -809,7 +749,6 @@ void conv_swap_words(Conv *c) {
break;
default:
- //term_message( "uh-oh" );
ent = 0;
break;
}
Commit: e68535af9c399e7552411f53eaf7b57bf607007e
https://github.com/scummvm/scummvm/commit/e68535af9c399e7552411f53eaf7b57bf607007e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of core/ folder
Changed paths:
R engines/m4/core/globals.cpp
engines/m4/core/cstring.cpp
engines/m4/core/errors.cpp
engines/m4/core/param.cpp
engines/m4/core/rooms.cpp
engines/m4/core/rooms.h
engines/m4/module.mk
diff --git a/engines/m4/core/cstring.cpp b/engines/m4/core/cstring.cpp
index c3747bbf880..f6e289d60e4 100644
--- a/engines/m4/core/cstring.cpp
+++ b/engines/m4/core/cstring.cpp
@@ -331,18 +331,6 @@ bool stringIsFloat(char *str) {
int16 bail = 0;
bool decimal_seen = false;
- /*
- while (*str) {
- if (!cstr_isdigit(*str))
- return false;
- ++str;
- ++bail;
- if (bail>256)
- return false;
- }
- return true;
- */
-
while (*str) {
if (*str == '.') {
if (!decimal_seen)
diff --git a/engines/m4/core/errors.cpp b/engines/m4/core/errors.cpp
index 22e3bd36af3..45a2f6a4777 100644
--- a/engines/m4/core/errors.cpp
+++ b/engines/m4/core/errors.cpp
@@ -71,6 +71,4 @@ void error_look_up(quadchar errorcode, char *result_string) {
}
}
-
-
} // namespace M4
diff --git a/engines/m4/core/globals.cpp b/engines/m4/core/globals.cpp
deleted file mode 100644
index c6a355618e8..00000000000
--- a/engines/m4/core/globals.cpp
+++ /dev/null
@@ -1,26 +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/>.
- *
- */
-
-#include "m4/core/globals.h"
-
-namespace M4 {
-
-} // namespace M4
diff --git a/engines/m4/core/param.cpp b/engines/m4/core/param.cpp
index ba1601a79eb..fc82e3b2f1f 100644
--- a/engines/m4/core/param.cpp
+++ b/engines/m4/core/param.cpp
@@ -26,19 +26,13 @@
namespace M4 {
-static bool param_inited = false;
-
void param_init() {
- param_inited = true;
}
void param_shutdown() {
- param_inited = false;
}
void parse_all_flags() {
- assert(param_inited);
-
if (ConfMan.hasKey("LOG"))
_G(kernel).use_log_file = ConfMan.getBool("LOG");
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 2b88fce6854..83097baa37a 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -49,11 +49,6 @@ void Room::parser() {
_G(kernel).trigger = KT_DAEMON;
}
-void Section::daemon() {
- warning("TODO: section daemon");
- _G(kernel).continue_handling_trigger = true;
-}
-
void Sections::global_section_constructor() {
uint sectionNum = _G(game).new_section;
diff --git a/engines/m4/core/rooms.h b/engines/m4/core/rooms.h
index 1e96f120e55..e1272fb99cb 100644
--- a/engines/m4/core/rooms.h
+++ b/engines/m4/core/rooms.h
@@ -76,7 +76,7 @@ public:
Room *operator[](uint roomNum);
virtual void global_room_init() {}
- virtual void daemon();
+ virtual void daemon() = 0;
virtual void tick() {}
virtual void pre_parser() {}
virtual void parser() {}
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index d6f4e54a764..0e8ec98240a 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -26,7 +26,6 @@ MODULE_OBJS = \
adv_r/other.o \
core/cstring.o \
core/errors.o \
- core/globals.o \
core/imath.o \
core/mouse.o \
core/param.o \
Commit: fc3cdc2ff59637467a8990494ce631ee92297c6f
https://github.com/scummvm/scummvm/commit/fc3cdc2ff59637467a8990494ce631ee92297c6f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix/cleanup for truck crash viewed from Old Bridge
Changed paths:
engines/m4/burger/rooms/section1/room134_135.cpp
diff --git a/engines/m4/burger/rooms/section1/room134_135.cpp b/engines/m4/burger/rooms/section1/room134_135.cpp
index a1067a80fb7..c4cf3df4cb8 100644
--- a/engines/m4/burger/rooms/section1/room134_135.cpp
+++ b/engines/m4/burger/rooms/section1/room134_135.cpp
@@ -164,6 +164,7 @@ void Room134_135::daemon() {
switch (_G(kernel).trigger) {
case 1:
+ // Burl enters town normally
_val2 = 1;
_val6 = 21;
@@ -176,6 +177,7 @@ void Room134_135::daemon() {
break;
case 2:
+ // Burl is entering town
kernel_trigger_dispatch_now(_G(flags)[kRoadOpened] ? 26 : 1);
break;
@@ -352,6 +354,7 @@ void Room134_135::daemon() {
break;
case 26:
+ // Burl crashing truck off of bridge
digi_preload("135_006");
_series4 = series_play("135dt02", 3840, 0, 27, 6, 0, 100, 0, 0, 0, 13);
break;
@@ -767,7 +770,7 @@ void Room134_135::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
@@ -775,7 +778,7 @@ void Room134_135::daemon() {
digi_play("100_013", 2, 255, -1);
kernel_timing_trigger(240, 2);
} else {
- kernel_timing_trigger(60, 10028);
+ kernel_timing_trigger(60, kBurlEntersTown);
}
break;
@@ -828,7 +831,7 @@ void Room134_135::parser() {
} else if (lookFlag && player_said("baitbox")) {
wilbur_speech(_G(flags)[V038] ? "135w004" : "135w003");
} else if (lookFlag && player_said("wrecked truck")) {
- wilbur_speech(_G(flags)[V038] ? "135w007" : "135w006");
+ wilbur_speech(_G(flags)[V052] ? "134w007" : "134w006");
} else if (player_said("take", "baitbox") || player_said("gear", "baitbox")) {
player_set_commands_allowed(false);
loadOdie();
Commit: 684a8f1c6c6ab2e7d2aef742c51656888a883928
https://github.com/scummvm/scummvm/commit/684a8f1c6c6ab2e7d2aef742c51656888a883928
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of graphics/ folder
Changed paths:
R engines/m4/graphics/graphics.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/graphics/rend.cpp
engines/m4/module.mk
diff --git a/engines/m4/graphics/graphics.cpp b/engines/m4/graphics/graphics.cpp
deleted file mode 100644
index cb1b8d0adf5..00000000000
--- a/engines/m4/graphics/graphics.cpp
+++ /dev/null
@@ -1,26 +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/>.
- *
- */
-
-#include "m4/graphics/graphics.h"
-
-namespace M4 {
-
-} // namespace M4
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 2e49f15e9de..98d580201fb 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -288,58 +288,6 @@ void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType) {
bool examining_inventory_object = false;
-#ifdef UNUSED
-void kernel_examine_inventory_object(char *picName, RGB8 *pal, int steps, int delay,
- int32 x, int32 y, int32 triggerNum, char *digi_name, int32 digi_trigger) {
-
- remember_esc_key = GetSystemHotkey(KEY_ESCAPE);
- RemoveSystemHotkey(KEY_ESCAPE);
-
- interface_hide();
-
- _GP(exam_saved_hotspots) = _G(currentSceneDef).hotspots;
- _G(currentSceneDef).hotspots = nullptr;
-
- _GP(myFadeTrigger) = kernel_trigger_create(triggerNum);
-
- krn_fade_to_grey(pal, steps, delay);
-
- _GP(seriesHash) = series_load(picName, -1, pal); // Preload sprite so we can unload it
- gr_pal_set_range(pal, FREE_START, 197); // Set that series colors into VGA
- RestoreScreens(MIN_VIDEO_X, MIN_VIDEO_Y, MAX_VIDEO_X, MAX_VIDEO_Y);
-
- Buffer *grey_screen = _G(gameDrawBuff)->get_buffer();
- krn_SetGreyVideoMode(
- // Grey rectangle
- 0, 0, MAX_VIDEO_X, screen_height(grey_screen) + _G(kernel).letter_box_y,
- // Color rectangle
- x, y, x + ws_get_sprite_width(_GP(seriesHash), 0) - 1, y + ws_get_sprite_height(_GP(seriesHash), 0) - 1);
- _G(gameDrawBuff)->release();
-
- // Play the sprite series as a loop
- int32 status;
- ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
- _GP(seriesAnim8) = series_play_xy(picName, -1, FORWARD,
- x - game_buff_ptr->x1, y - game_buff_ptr->y1, 100, 0, 7, -1);
-
- if (digi_name) {
- digi_play(digi_name, 1, 255, digi_trigger);
- }
-
- player_set_commands_allowed(true);
-
- CycleEngines(_G(game_bgBuff)->get_buffer(), &(_G(currentSceneDef).depth_table[0]),
- _G(screenCodeBuff)->get_buffer(), (uint8 *)&_G(master_palette)[0], _G(inverse_pal)->get_ptr(), true);
-
- game_pause(true);
-
- _G(inverse_pal)->release();
- _G(game_bgBuff)->release();
-
- PauseEngines();
-}
-#endif
-
void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay) {
if (!_GP(seriesAnim8) || _GP(seriesHash) < 0)
return;
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
index 67285cf540b..4fb6dfc869f 100644
--- a/engines/m4/graphics/rend.cpp
+++ b/engines/m4/graphics/rend.cpp
@@ -990,42 +990,6 @@ void render_sprite_to_8BBM(RendGrBuff *Destination, DrawRequestX *dr, RendCell *
UpdateRect->y1 = MAX(UpdateRect->y1, ClipRectangle->y1);
UpdateRect->y2 = MIN(UpdateRect->y2, ClipRectangle->y2);
-#ifdef DEBUGGING_REND
- {
- int32 i;
-
- for (i = 0; i < 11; ++i)
- if (renderer == fn[i].addr) {
- term_message("renderer: %s", fn[i].name);
- break;
- }
- }
-#endif
-
-#ifdef DEBUGGING_REND
- /* hilite update rectangle */
- {
- int32 i;
- uint8 *p;
-
- p = (uint8 *)Destination->PixMap + UpdateRect->y1 * Destination->Width;
- for (i = UpdateRect->x1; i <= UpdateRect->x2; ++i)
- *(p + i) = ~(*(p + i));
-
- p = (uint8 *)Destination->PixMap + UpdateRect->y2 * Destination->Width;
- for (i = UpdateRect->x1; i <= UpdateRect->x2; ++i)
- *(p + i) = ~(*(p + i));
-
- p = (uint8 *)Destination->PixMap + UpdateRect->x1;
- for (i = UpdateRect->y1; i <= UpdateRect->y2; ++i)
- *(p + i * Destination->Width) = ~(*(p + i * Destination->Width));
-
- p = (uint8 *)Destination->PixMap + UpdateRect->x2;
- for (i = UpdateRect->y1; i <= UpdateRect->y2; ++i)
- *(p + i * Destination->Width) = ~(*(p + i * Destination->Width));
- }
-#endif
-
for (;;) {
errY -= dr->scale_y;
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
index 0e8ec98240a..35a041d0d57 100644
--- a/engines/m4/module.mk
+++ b/engines/m4/module.mk
@@ -46,7 +46,6 @@ MODULE_OBJS = \
graphics/gr_series.o \
graphics/gr_sprite.o \
graphics/gr_surface.o \
- graphics/graphics.o \
graphics/krn_pal.o \
graphics/rend.o \
gui/gui_buffer.o \
Commit: 52f365a2dc0bafb184b91dc0813c9af4eea8d445
https://github.com/scummvm/scummvm/commit/52f365a2dc0bafb184b91dc0813c9af4eea8d445
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of gui/ folder
Changed paths:
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_item.cpp
engines/m4/gui/gui_vmng_rectangles.cpp
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 9350b4ad289..b3ed58581a8 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -617,8 +617,7 @@ static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY) {
while (myRect) {
d->dlgBuffer->refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1);
- //vmng_refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
- // myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, d->dlgBuffer);
+
myRect = myRect->next;
}
} else {
diff --git a/engines/m4/gui/gui_item.cpp b/engines/m4/gui/gui_item.cpp
index 715910466fa..8f98325f4cc 100644
--- a/engines/m4/gui/gui_item.cpp
+++ b/engines/m4/gui/gui_item.cpp
@@ -788,8 +788,8 @@ bool GetPrevListItem(Item *myItem) {
}
bool GetPrevPageList(Item *myItem) {
- int32 i;
- bool changed = false;
+ int32 i;
+ bool changed = false;
if (myItem->currItem && myItem->viewBottom) {
for (i = 0; i < (myItem->listView - 1); i++) {
@@ -882,9 +882,9 @@ bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1
}
bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset) {
- int32 listboxContentX2, itemOffset, fontHeight;
+ int32 listboxContentX2, itemOffset, fontHeight;
ListItem *myListItem;
- M4Rect interiorRect;
+ M4Rect interiorRect;
ButtonDrawRec bdr;
Font *currFont;
@@ -1166,10 +1166,10 @@ static bool Item_UndoTextFieldChange(void) {
}
void SetTextBlockBegin(Item *myItem, int32 relXPos) {
- char myChar, *scan;
- bool finished = false;
- M4Rect interiorRect;
- ButtonDrawRec bdr;
+ char myChar, *scan;
+ bool finished = false;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
bdr.el_type = TEXTFIELD;
bdr.pressed = true; //since this procedure will only be called myItem is the default item
@@ -1196,10 +1196,10 @@ void SetTextBlockBegin(Item *myItem, int32 relXPos) {
}
void SetTextBlockEnd(Item *myItem, int32 relXPos) {
- char myChar, *scan;
- bool finished = false;
- M4Rect interiorRect;
- ButtonDrawRec bdr;
+ char myChar, *scan;
+ bool finished = false;
+ M4Rect interiorRect;
+ ButtonDrawRec bdr;
bdr.el_type = TEXTFIELD;
bdr.pressed = true; //since this procedure will only be called myItem is the default item
diff --git a/engines/m4/gui/gui_vmng_rectangles.cpp b/engines/m4/gui/gui_vmng_rectangles.cpp
index ef8e3fa840f..28dc71655f0 100644
--- a/engines/m4/gui/gui_vmng_rectangles.cpp
+++ b/engines/m4/gui/gui_vmng_rectangles.cpp
@@ -181,10 +181,8 @@ void vmng_AddRectToRectList(RectList **theRectList, int32 rectX1, int32 rectY1,
mem_free_to_stash(dirtyRect, _G(memtypeRECT));
myRect = nullptr;
}
- }
-
- //else get the next rect
- else {
+ } else {
+ // else get the next rect
myRect = myRect->next;
}
}
@@ -201,11 +199,11 @@ void vmng_AddRectToRectList(RectList **theRectList, int32 rectX1, int32 rectY1,
cleanRectList = dirtyRect;
}
- //get the next dirty rect
+ // get the next dirty rect
dirtyRect = dirtyRectList;
}
- //now, just add the clean list onto the dirty list
+ // now, just add the clean list onto the dirty list
if (cleanRectList) {
//now add the entire cleanRectList to the front of myRectList
Commit: 496ae8674d456835a7293dbf2d8d17f4b9de9a22
https://github.com/scummvm/scummvm/commit/496ae8674d456835a7293dbf2d8d17f4b9de9a22
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Cleanup of wscript/ folder
Changed paths:
engines/m4/wscript/ws_load.cpp
diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index 01ce598d497..850ca95abb7 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -1205,8 +1205,7 @@ int32 GetWSAssetCELCount(uint32 hash) {
int32 GetWSAssetCELFrameRate(uint32 hash) {
- uint32 *celsPtr; // *mainAssetPtr,
-// int32 assetSize;
+ uint32 *celsPtr;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1233,8 +1232,7 @@ int32 GetWSAssetCELFrameRate(uint32 hash) {
int32 GetWSAssetCELPixSpeed(uint32 hash) {
- uint32 *celsPtr; // *mainAssetPtr,
-// int32 assetSize;
+ uint32 *celsPtr;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1259,10 +1257,9 @@ int32 GetWSAssetCELPixSpeed(uint32 hash) {
return celsPtr[CELS_PIX_SPEED];
}
-
int32 ws_get_sprite_width(uint32 hash, int32 index) {
- uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
- int32 numCels; // AssetSize,
+ uint32 *celsPtr, *offsets, *data, *myCelSource;
+ int32 numCels;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1304,10 +1301,9 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
return (int32)myCelSource[CELS_W];
}
-
int32 ws_get_sprite_height(uint32 hash, int32 index) {
- uint32 *celsPtr, *offsets, *data, *myCelSource; // *mainAssetPtr,
- int32 numCels; // assetSize,
+ uint32 *celsPtr, *offsets, *data, *myCelSource;
+ int32 numCels;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1381,9 +1377,8 @@ MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset) {
return _GWS(globalSEQUHandles)[hash];
}
-
MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset) {
- uint32 *machPtr; // *mainAssetPtr,
+ uint32 *machPtr;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1457,10 +1452,8 @@ MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset) {
return _GWS(globalDATAHandles)[hash];
}
-
int32 ws_GetDATACount(uint32 hash) {
- uint32 *dataPtr; // *mainAssetPtr,
-// int32 assetSize;
+ uint32 *dataPtr;
// Ensure the WS loader has been initialized.
if (!_GWS(wsloaderInitialized)) {
@@ -1487,7 +1480,6 @@ int32 ws_GetDATACount(uint32 hash) {
return dataPtr[DATA_REC_COUNT];
}
-
static int32 GetSSHeaderInfo(SysFile *sysFile, uint32 **data, RGB8 *myPalette) {
uint32 celsType, celsSize, numColors, *myColors;
uint32 *tempPtr, i, j, header, format;
@@ -1839,7 +1831,6 @@ bool ws_GetNextSSstreamCel(Anim8 *anim8) {
}
void ws_CloseSSstream(CCB *myCCB) {
-
// Verify the parameters
if ((!myCCB) || (!(myCCB->flags & CCB_DISC_STREAM))) {
ws_LogErrorMsg(FL, "Invalid CCB* given.");
Commit: 0419b952878420c018fc940a6babbc28edf51300
https://github.com/scummvm/scummvm/commit/0419b952878420c018fc940a6babbc28edf51300
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Resolving outstanding TODOs
Changed paths:
engines/m4/adv_r/adv_inv.cpp
engines/m4/adv_r/adv_inv.h
engines/m4/adv_r/db_env.cpp
engines/m4/adv_r/kernel.h
engines/m4/burger/rooms/section6/section6_room.cpp
engines/m4/burger/walker.cpp
engines/m4/core/rooms.cpp
engines/m4/fileio/sys_file.cpp
engines/m4/graphics/gr_pal.cpp
engines/m4/m4.cpp
engines/m4/mem/res.cpp
engines/m4/platform/sound/midi.cpp
engines/m4/vars.cpp
diff --git a/engines/m4/adv_r/adv_inv.cpp b/engines/m4/adv_r/adv_inv.cpp
index 6a1530cc18c..80601be79ee 100644
--- a/engines/m4/adv_r/adv_inv.cpp
+++ b/engines/m4/adv_r/adv_inv.cpp
@@ -30,7 +30,6 @@ namespace M4 {
#define MAX_NAME_LENGTH 40
-// TODO: Move more stuff into InventoryBase class
static char *inv_get_name(const Common::String &itemName);
InventoryBase::~InventoryBase() {
@@ -256,42 +255,4 @@ bool inv_object_in_scene(const Common::String &itemName, int32 scene) {
return (inv_where_is(itemName) == scene);
}
-void MoveBP(char *s, int32 from, int32 to) {
-#ifdef TODO
- Dialog *d = inv_dialog;
- Item *myItem;
- char old_loc[MAX_PLYR_STRING_LEN],
- new_loc[MAX_PLYR_STRING_LEN],
- curr_loc[MAX_PLYR_STRING_LEN];
-
- cstrupr(s);
-
- sprintf(old_loc, "%s %d", s, from);
- sprintf(new_loc, "%s %d", s, to);
-
- if ((myItem = Dialog_Get_Item(d, 100)) == nullptr) return; //bp list.
-
- while (GetPrevListItem(myItem)) {
- }
- if ((myItem = Dialog_Get_Item(d, 100)) == nullptr) return; //bp list.
-
- for (;; ) {
- sprintf(curr_loc, "%s", Dialog_GetCurrListItemPrompt(d, myItem, 100));
-
- if (!strcmp(old_loc, curr_loc)) {
- Dialog_Change_List_Item(d, myItem, 100,
- Dialog_GetCurrListItem(d, myItem, 100), 0, //listTag == 0?
- new_loc, 0, LIST_ALPH, true); //true: REFRESH
-
- break;
- }
-
- if (!GetNextListItem(myItem))
- break;
- }
-#else
- error("TODO: MoveBP");
-#endif
-}
-
} // End of namespace M4
diff --git a/engines/m4/adv_r/adv_inv.h b/engines/m4/adv_r/adv_inv.h
index 820c168bf0b..5d8d43cde2c 100644
--- a/engines/m4/adv_r/adv_inv.h
+++ b/engines/m4/adv_r/adv_inv.h
@@ -76,12 +76,6 @@ extern void inv_move_object(const Common::String &itemName, int32 scene);
extern bool inv_object_is_here(const Common::String &itemName);
extern bool inv_object_in_scene(const Common::String &itemName, int32 scene);
-// private
-
-extern void MoveBP(const char *s, int32 from, int32 to);
-extern void InsertBP(const char *s, int32 where);
-
-// private
extern void inv_sync_game(Common::Serializer &s);
diff --git a/engines/m4/adv_r/db_env.cpp b/engines/m4/adv_r/db_env.cpp
index d9e9e35de93..b6564d4dad0 100644
--- a/engines/m4/adv_r/db_env.cpp
+++ b/engines/m4/adv_r/db_env.cpp
@@ -46,7 +46,7 @@ char *env_find(const Common::String &descName) {
}
char *env_get_path(char *resultPath, int room_num, char *fileName) {
- error("TODO: env_get_path");
+ error("env_get_path not implemented in ScummVM");
}
} // End of namespace M4
diff --git a/engines/m4/adv_r/kernel.h b/engines/m4/adv_r/kernel.h
index 83c3e1fdef0..c1bf5d37d60 100644
--- a/engines/m4/adv_r/kernel.h
+++ b/engines/m4/adv_r/kernel.h
@@ -65,10 +65,8 @@ struct Kernel {
bool use_log_file = false;
bool track_open_close = false;
bool going = false;
-
- // TODO: Find every use of these new fields
- int _val1 = 0;
- int _val2 = 0;
+ bool camera_pan_instant = false;
+ bool unused = false;
size_t mem_avail() const { return 7999999; }
};
diff --git a/engines/m4/burger/rooms/section6/section6_room.cpp b/engines/m4/burger/rooms/section6/section6_room.cpp
index b1523064946..3cb7b2760e8 100644
--- a/engines/m4/burger/rooms/section6/section6_room.cpp
+++ b/engines/m4/burger/rooms/section6/section6_room.cpp
@@ -65,7 +65,6 @@ HotSpotRec *Section6Room::custom_hotspot_which(int32 x, int32 y) {
int index = _sectionMachine1->myAnim8->myRegs[IDX_CELS_INDEX];
const GerbilPoint *points = _gerbilTable + index;
- // TODO: Double check the modulus/divisions are correct
diff = points[3]._x - points[0]._x;
x1 = points[0]._x + (index % 3) * diff / 3;
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 8d30a13a358..72226679b81 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -204,7 +204,6 @@ void Walker::unloadSprites() {
for (int i = 0; i < 7; ++i)
series_unload(i);
- // TODO: This seems like it would leak memory
_G(my_walker) = nullptr;
}
}
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 83097baa37a..cdc064cd76c 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -387,7 +387,7 @@ void Sections::pal_game_task() {
error_show(FL, 'BUF!');
if (_cameraShiftAmount) {
- if (_G(kernel)._val2) {
+ if (_G(kernel).camera_pan_instant) {
delta = _cameraShiftAmount;
_cameraShiftAmount = 0;
} else if (_cameraShiftAmount > 0) {
@@ -400,7 +400,7 @@ void Sections::pal_game_task() {
}
if (_cameraShift_vert_Amount) {
- if (_G(kernel)._val2) {
+ if (_G(kernel).camera_pan_instant) {
delta = _cameraShift_vert_Amount;
_cameraShift_vert_Amount = 0;
} else if (_cameraShift_vert_Amount > 0) {
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index aefa77e5bc5..c82ac2f4e90 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -223,7 +223,7 @@ void SysFile::open_read() {
}
void SysFile::open_write() {
- error("TODO: open_write if needed");
+ error("open_write is not implemented in ScummVM");
}
Common::String SysFile::get_last_string(const Common::String &src) {
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index 923d8d93cf3..4f0be9586ce 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -36,15 +36,15 @@ uint8 gr_pal_get_ega_color(uint8 myColor) {
uint8 *gr_color_createInverseTable(RGB8 *pal, uint8 bitDepth, int begin_color, int end_color) {
- error("TODO: gr_color_createInverseTable");
+ error("gr_color_createInverseTable is not implemented in ScummVM");
}
void gr_color_create_ipl5(uint8 *inverseColorTable, char *fname, int room_num) {
- error("TODO: gr_color_create_ipl5");
+ error("gr_color_create_ipl5 is not implemented in ScummVM");
}
uint8 *gr_color_load_ipl5(const char *filename, uint8 *inverseColors) {
- error("TODO: gr_color_load_ipl5");
+ error("gr_color_load_ipl5 is not implemented in ScummVM");
}
void gr_color_set(int32 c) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 3560ded3d6c..61abe98acdc 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -225,7 +225,7 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
for (int i = 0; i < KERNEL_SCRATCH_SIZE; ++i)
s.syncAsUint32LE(_G(kernel).scratch[i]);
- s.syncAsByte(_G(kernel)._val1);
+ s.syncAsByte(_G(kernel).unused);
s.syncAsSint16LE(_G(kernel).last_save);
s.syncAsSint16LE(_G(game).room_id);
s.syncAsSint16LE(_G(game).new_room);
@@ -242,7 +242,7 @@ Common::Error M4Engine::syncGame(Common::Serializer &s) {
s.syncAsByte(_G(kernel).restore_game);
s.syncAsSint32LE(_G(game).digi_overall_volume_percent);
s.syncAsSint32LE(_G(game).midi_overall_volume_percent);
- s.syncAsByte(_G(kernel)._val2);
+ s.syncAsByte(_G(kernel).camera_pan_instant);
}
_G(player).syncGame(s);
diff --git a/engines/m4/mem/res.cpp b/engines/m4/mem/res.cpp
index e4fcc0be3a0..04a4a55f79f 100644
--- a/engines/m4/mem/res.cpp
+++ b/engines/m4/mem/res.cpp
@@ -36,7 +36,6 @@ namespace M4 {
Resources::~Resources() {
delete _fp;
- // TODO: Delete resource entries
}
diff --git a/engines/m4/platform/sound/midi.cpp b/engines/m4/platform/sound/midi.cpp
index 5dc72ab072b..8f16c206335 100644
--- a/engines/m4/platform/sound/midi.cpp
+++ b/engines/m4/platform/sound/midi.cpp
@@ -26,7 +26,7 @@ namespace M4 {
namespace Sound {
void Midi::task() {
- warning("TODO: Midi::task");
+ // No implementation
}
void Midi::loop() {
@@ -34,11 +34,11 @@ void Midi::loop() {
}
void Midi::stop() {
- warning("TODO: Midi::stop");
+ // No implementation
}
void Midi::set_overall_volume(int vol) {
- warning("TODO: Midi::set_overall_volume");
+ // No implementation
}
} // namespace Sound
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index c378b30a28d..f7fa87e4179 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -132,7 +132,7 @@ void Vars::game_systems_initialize(byte flags) {
fire_up_gui();
if (flags & INSTALL_SOUND_DRIVERS) {
- warning("TODO: sound init");
+ // No implementation
} else {
term_message("Sound driver installation skipped");
}
Commit: 08be7695025b11832efffd4563f09e2f9a4760a0
https://github.com/scummvm/scummvm/commit/08be7695025b11832efffd4563f09e2f9a4760a0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remove deprecated stubs for various draw styles
Changed paths:
engines/m4/platform/draw.cpp
engines/m4/platform/draw.h
diff --git a/engines/m4/platform/draw.cpp b/engines/m4/platform/draw.cpp
index fdaa6a6c5e0..2391118ecd2 100644
--- a/engines/m4/platform/draw.cpp
+++ b/engines/m4/platform/draw.cpp
@@ -172,96 +172,4 @@ void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
assert(destP <= (dest->data + dest->h * dest->stride));
}
-void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y) {
- error("TODO: RLE");
-}
-
-void RLE_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
- error("TODO: RLE");
-}
-
-void RLE_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
- error("TODO: RLE");
-}
-
-void Raw_Draw(Buffer *src, Buffer *dest, int32 x, int32 y) {
- error("TODO: RLE");
-}
-
-void Raw_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y) {
- error("TODO: RLE");
-}
-
-void Raw_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
- error("TODO: RLE");
-}
-
-void Raw_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode) {
- error("TODO: RLE");
-}
-
-void Raw_SDraw(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void RLE_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void RLE_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void RLE_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void RLE_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void Raw_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void Raw_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void Raw_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void Raw_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
-void Raw_SDrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable) {
- error("TODO: RLE");
-}
-
} // namespace M4
diff --git a/engines/m4/platform/draw.h b/engines/m4/platform/draw.h
index de2db16c483..64b9a897ab7 100644
--- a/engines/m4/platform/draw.h
+++ b/engines/m4/platform/draw.h
@@ -44,37 +44,6 @@ extern uint8 *SkipRLE_Lines(uint32 linesToSkip, uint8 *rleData);
*/
extern size_t RLE8Decode_Size(byte *src, int pitch);
-
-extern void RLE_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
-extern void RLE_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
-extern void RLE_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
-extern void RLE_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
-
-extern void Raw_Draw(Buffer *src, Buffer *dest, int32 x, int32 y);
-extern void Raw_DrawRev(Buffer *src, Buffer *dest, int32 x, int32 y);
-extern void Raw_DrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
-extern void Raw_DrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode);
-
-extern void Raw_SDraw(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawDepth(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawDepthRev(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, uint8 *palette, uint8 *inverseColorTable);
-
-extern void RLE_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
-extern void RLE_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
-extern void RLE_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
-extern void RLE_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
-
-extern void Raw_DrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
-extern void Raw_DrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset);
-extern void Raw_DrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
-extern void Raw_DrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset);
-
-extern void Raw_SDrawOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawDepthOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
-extern void Raw_SDrawDepthRevOffs(Buffer *src, Buffer *dest, int32 x, int32 y, uint8 srcDepth, uint8 *depthCode, int32 leftOffset, int32 rightOffset, uint8 *palette, uint8 *inverseColorTable);
-
} // namespace M4
#endif
Commit: 6ebbf46718c8984212295e6359d05250ff03d56a
https://github.com/scummvm/scummvm/commit/6ebbf46718c8984212295e6359d05250ff03d56a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
JANITORIAL: Fix code formatting
Changed paths:
engines/m4/fileio/sys_file.cpp
diff --git a/engines/m4/fileio/sys_file.cpp b/engines/m4/fileio/sys_file.cpp
index c82ac2f4e90..276aef41062 100644
--- a/engines/m4/fileio/sys_file.cpp
+++ b/engines/m4/fileio/sys_file.cpp
@@ -472,14 +472,12 @@ int SysFile::hash_search(const Common::String &fname, Hash_Record *current_hash_
} else {
find_offset = offset;
}
- if (next_record == offset) // only one record of fname in hash table
- {
+ if (next_record == offset) { // only one record of fname in hash table
finded = 1;
} else {
offset = next_record;
}
- } else // collision here, search the next entry to see if it is empty until find a empty one
- {
+ } else { // collision here, search the next entry to see if it is empty until find a empty one
next_entry = (next_entry + 1) % hash_table_size; // search the hash table a round way
offset = HASH_RECORD_LENGTH * next_entry + 4; // 4 bytes is header of hash file, store hash_table_size
}
Commit: 8e1b2130a99344a79af2d74f933102093e6ef8a2
https://github.com/scummvm/scummvm/commit/8e1b2130a99344a79af2d74f933102093e6ef8a2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
JANITORIAL: Fix code formatting
Changed paths:
engines/m4/graphics/gr_buff.cpp
engines/m4/graphics/gr_sprite.cpp
engines/m4/graphics/rend.cpp
diff --git a/engines/m4/graphics/gr_buff.cpp b/engines/m4/graphics/gr_buff.cpp
index 74e9e7ff85a..8d5577a8332 100644
--- a/engines/m4/graphics/gr_buff.cpp
+++ b/engines/m4/graphics/gr_buff.cpp
@@ -68,8 +68,7 @@ void GrBuff::alloc_pixmap() {
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap) {
term_message("GrBuff::alloc_pixmap(): Trying to free up %d bytes", pitch * height);
- if (MakeMem(pitch * height, "pixmap"))
- {
+ if (MakeMem(pitch * height, "pixmap")) {
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap)
error_show(FL, 15, "pixmap h:%d w:%d bytes:%d", height, pitch, pitch * height);
@@ -82,8 +81,7 @@ void GrBuff::alloc_pixmap() {
}
uint8 *GrBuff::get_pixmap() {
- if (pixmap)
- {
+ if (pixmap) {
lock();
return (uint8 *)*pixmap;
}
@@ -91,8 +89,7 @@ uint8 *GrBuff::get_pixmap() {
}
Buffer *GrBuff::get_buffer() {
- if (pixmap)
- {
+ if (pixmap) {
lock();
dummy.data = (uint8 *)*pixmap;
dummy.w = w;
@@ -109,7 +106,6 @@ void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x
vmng_refresh_video(scrnX, scrnY, x1, y1, x2, y2, get_buffer());
}
-
int32 gr_buffer_free(Buffer *buf) {
buf->w = buf->h = buf->stride = 0;
@@ -155,11 +151,11 @@ int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
memset(buf->data, 0, buf->stride * h);
- return(true);
+ return (true);
}
bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
- int32 dx, int32 dy, int32 w, int32 h) {
+ int32 dx, int32 dy, int32 w, int32 h) {
// stupid check for no data
if (!from || !to || !from->data || !to->data)
error_show(FL, 'BUF!', "buff_rect_copy2");
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index 48e65440cae..c836facc9c0 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -58,17 +58,13 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
error_show(FL, 'OOM!', "scaled buffer h:%uld w:%uld", D->h, D->stride);
ErrY = 50;
- for (i = 0; i < S->h; ++i)
- {
+ for (i = 0; i < S->h; ++i) {
ErrY += ScaleY;
- while (ErrY >= 100)
- {
+ while (ErrY >= 100) {
ErrX = 50;
- for (j = 0; j < S->w; ++j)
- {
+ for (j = 0; j < S->w; ++j) {
ErrX += ScaleX;
- while (ErrX >= 100)
- {
+ while (ErrX >= 100) {
*pScaled++ = *pData;
ErrX -= 100;
}
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
index 4fb6dfc869f..deff5eb6243 100644
--- a/engines/m4/graphics/rend.cpp
+++ b/engines/m4/graphics/rend.cpp
@@ -42,12 +42,10 @@ enum {
static RenderResult skip_RLE8_line() {
uint8 *from = _GR(sourceAddress);
- for (;;)
- {
+ for (;;) {
if (*from++)
++from;
- else if (*from++ <= kJumpXY)
- {
+ else if (*from++ <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)(*(from - 1));
} else
@@ -342,8 +340,7 @@ static RenderResult r_4() {
int32 PixelPos = _GR(StartingPixelPos);
long Inc = _GR(Increment);
- for (;;)
- {
+ for (;;) {
#ifdef OPTIMIZE_CLIP
if (Inc == 1) {
if (PixelPos >= _GR(RightPorch)) {
Commit: 9bd8c66c74692179183919dea3cfc5567fd86579
https://github.com/scummvm/scummvm/commit/9bd8c66c74692179183919dea3cfc5567fd86579
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix pointer to int cast
Changed paths:
engines/m4/mem/mem.cpp
diff --git a/engines/m4/mem/mem.cpp b/engines/m4/mem/mem.cpp
index 4107f485092..0e0c1294175 100644
--- a/engines/m4/mem/mem.cpp
+++ b/engines/m4/mem/mem.cpp
@@ -80,7 +80,7 @@ bool mem_register_stash_type(int32 *memType, int32 blockSize, int32 maxNumReques
void mem_free_to_stash(void *mem, int32 memType) {
// _G(memBlock)[memType] is block associated with memType
int8 *b_ptr = (int8 *)_G(memBlock)[memType];
- int32 index = ((long)mem - (long)_G(memBlock)[memType]) / (_G(sizeMem)[memType] + 1);
+ int32 index = ((intptr)mem - (intptr)_G(memBlock)[memType]) / (_G(sizeMem)[memType] + 1);
if (index < 0 || index > _G(requests)[memType])
error_show(FL, 'MSGF');
Commit: 50e569b5e0dd921872613f2b2391d13e826bc27a
https://github.com/scummvm/scummvm/commit/50e569b5e0dd921872613f2b2391d13e826bc27a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix constant for Burl entering town in room 101
Changed paths:
engines/m4/burger/rooms/section1/room101.cpp
diff --git a/engines/m4/burger/rooms/section1/room101.cpp b/engines/m4/burger/rooms/section1/room101.cpp
index 98adf686a0a..0ddeeaf5868 100644
--- a/engines/m4/burger/rooms/section1/room101.cpp
+++ b/engines/m4/burger/rooms/section1/room101.cpp
@@ -618,7 +618,7 @@ void Room101::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
@@ -629,7 +629,7 @@ void Room101::daemon() {
digi_play("100_013", 2, 255, -1);
kernel_timing_trigger(240, 24);
} else {
- kernel_timing_trigger(60, 10028);
+ kernel_timing_trigger(60, kBurlEntersTown);
}
break;
Commit: 3d12a3709c3f2ad7cc9350ffb546587025421b9a
https://github.com/scummvm/scummvm/commit/3d12a3709c3f2ad7cc9350ffb546587025421b9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix Burl crash cutscene when at Hanlon's Point
Changed paths:
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/section1.cpp
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index 403f591dfff..0436d1d5610 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -167,6 +167,7 @@ void Room139_144::daemon() {
break;
case 3:
+ // Burl's truck crashing off of bridge
pal_fade_set_start(0);
ws_hide_walker();
terminateMachineAndNull(_series1);
diff --git a/engines/m4/burger/rooms/section1/section1.cpp b/engines/m4/burger/rooms/section1/section1.cpp
index 4c175119512..b7958fc91be 100644
--- a/engines/m4/burger/rooms/section1/section1.cpp
+++ b/engines/m4/burger/rooms/section1/section1.cpp
@@ -126,7 +126,7 @@ void Section1::daemon() {
_G(game).new_room = 138;
break;
case 1012:
- _G(game).new_room = _G(flags)[V000] == 102 ? 144 : 139;
+ _G(game).new_room = _G(flags)[V000] == 1002 ? 144 : 139;
break;
case 1013:
_G(game).new_room = _G(flags)[V000] == 1002 ? 141 : 140;
Commit: 6022404a3aed3630072c7baaecad47eda10961da
https://github.com/scummvm/scummvm/commit/6022404a3aed3630072c7baaecad47eda10961da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix talking to Burl at Hanlon's Point
Changed paths:
engines/m4/burger/rooms/section1/room139_144.cpp
engines/m4/burger/rooms/section1/room139_144.h
diff --git a/engines/m4/burger/rooms/section1/room139_144.cpp b/engines/m4/burger/rooms/section1/room139_144.cpp
index 0436d1d5610..9cb877d7b16 100644
--- a/engines/m4/burger/rooms/section1/room139_144.cpp
+++ b/engines/m4/burger/rooms/section1/room139_144.cpp
@@ -110,7 +110,7 @@ static const seriesStreamBreak SERIES2[] = {
void Room139_144::init() {
_val1 = 0;
- _val2 = 15;
+ _burlFrame = 15;
digi_preload("144_001");
if (_G(game).previous_room == 144)
@@ -233,19 +233,19 @@ void Room139_144::daemon() {
if (imath_ranged_rand(5, 10) < ++_val1) {
switch (imath_ranged_rand(1, 4)) {
case 1:
- _val2 = 25;
+ _burlFrame = 25;
break;
case 2:
- _val2 = 36;
+ _burlFrame = 36;
break;
case 3:
- _val2 = 41;
+ _burlFrame = 41;
break;
case 4:
- _val2 = 42;
+ _burlFrame = 42;
break;
default:
@@ -283,14 +283,15 @@ void Room139_144::daemon() {
break;
}
} else {
- series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, _val2, _val2);
- series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, _val2, _val2);
+ series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, _burlFrame, _burlFrame);
+ series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, _burlFrame, _burlFrame);
}
break;
case 4:
case 5:
digi_play("144b002", 2);
+ _burlMode = 6;
series_play("144bu06", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
break;
diff --git a/engines/m4/burger/rooms/section1/room139_144.h b/engines/m4/burger/rooms/section1/room139_144.h
index b9fa2c12d1a..c891f8ec2a5 100644
--- a/engines/m4/burger/rooms/section1/room139_144.h
+++ b/engines/m4/burger/rooms/section1/room139_144.h
@@ -33,7 +33,7 @@ private:
machine *_series1 = nullptr;
const char *_digi1 = nullptr;
int _val1 = 0;
- int _val2 = 0;
+ int _burlFrame = 0;
int _burlShould = 0;
int _burlMode = 0;
Commit: 55dceb7a7b59552b10467412994fc19d020c47a9
https://github.com/scummvm/scummvm/commit/55dceb7a7b59552b10467412994fc19d020c47a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added trigger debugger command
Changed paths:
engines/m4/console.cpp
engines/m4/console.h
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index fe6f5a47271..5b6a81eb50c 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -30,7 +30,8 @@ Console::Console() : GUI::Debugger() {
registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
registerCmd("item", WRAP_METHOD(Console, cmdItem));
registerCmd("hyperwalk", WRAP_METHOD(Console, cmdHyperwalk));
- registerCmd("digi", WRAP_METHOD(Console, cmdDigi));
+ registerCmd("digi", WRAP_METHOD(Console, cmdDigi));
+ registerCmd("trigger", WRAP_METHOD(Console, cmdTrigger));
}
Console::~Console() {
@@ -42,7 +43,7 @@ bool Console::cmdTeleport(int argc, const char **argv) {
_G(kernel).teleported_in = true;
return false;
} else {
- debugPrintf("teleport <room number>]\n");
+ debugPrintf("teleport <room number>\n");
return true;
}
}
@@ -98,4 +99,14 @@ bool Console::cmdDigi(int argc, const char **argv) {
return true;
}
+bool Console::cmdTrigger(int argc, const char **argv) {
+ if (argc == 2) {
+ kernel_trigger_dispatch_now(atol(argv[1]));
+ return false;
+ } else {
+ debugPrintf("trigger <number>\n");
+ return true;
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index da42ee635ab..a92d218cabd 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -35,6 +35,7 @@ private:
bool cmdItem(int argc, const char **argv);
bool cmdHyperwalk(int argc, const char **argv);
bool cmdDigi(int argc, const char **argv);
+ bool cmdTrigger(int argc, const char **argv);
public:
Console();
Commit: 7936194f4b8c682e50de6aaa87addf23ed55997d
https://github.com/scummvm/scummvm/commit/7936194f4b8c682e50de6aaa87addf23ed55997d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added npc enum for room 103
Changed paths:
engines/m4/burger/rooms/section1/room103.cpp
engines/m4/burger/rooms/section1/room103.h
diff --git a/engines/m4/burger/rooms/section1/room103.cpp b/engines/m4/burger/rooms/section1/room103.cpp
index 0fbe668ac10..0c4ad848d6d 100644
--- a/engines/m4/burger/rooms/section1/room103.cpp
+++ b/engines/m4/burger/rooms/section1/room103.cpp
@@ -28,6 +28,14 @@ namespace M4 {
namespace Burger {
namespace Rooms {
+enum {
+ kCHANGE_CROW1_ANIMATION = 10,
+ kCHANGE_CROW2_ANIMATION = 11,
+ kCHANGE_CROW3_ANIMATION = 12,
+ kCHANGE_CROW4_ANIMATION = 13,
+ kCHANGE_HARRY_ANIMATION = 20
+};
+
static const char *SAID[][4] = {
{ "SATELLITE DISH", "103W001", "103W002", nullptr },
{ "FIRE ESCAPE", "103W005", "103W006", nullptr },
@@ -146,12 +154,12 @@ void Room103::init() {
_series2 = series_play("103door", 0x800, 0, -1, 100, -1, 100, 0, 0, 0, 0);
series_play("103vent", 0x100, 0, -1, 6, -1, 100, 0, 0, 0, 3);
- _val4 = 12;
- kernel_trigger_dispatch_now(10);
- _val5 = 19;
- kernel_trigger_dispatch_now(12);
- _val6 = 21;
- kernel_trigger_dispatch_now(13);
+ _crow1Should = 12;
+ kernel_trigger_dispatch_now(kCHANGE_CROW1_ANIMATION);
+ _crow3Should = 19;
+ kernel_trigger_dispatch_now(kCHANGE_CROW3_ANIMATION);
+ _crow4Should = 21;
+ kernel_trigger_dispatch_now(kCHANGE_CROW4_ANIMATION);
digi_play_loop("103_001", 3, 60);
}
@@ -249,67 +257,62 @@ void Room103::daemon() {
series_play_with_breaks(PLAY2, "103ha03", 0x200, 9, 3, 12);
break;
- case 10:
- switch (_val4) {
+ case kCHANGE_CROW1_ANIMATION:
+ switch (_crow1Should) {
case 12:
if (imath_ranged_rand(1, 3) == 1) {
- series_play("103cr01", 0x100, 0, 10, 30, 0, 100, 0, 0, 1, 2);
- series_play("103cr01s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
} else {
- series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 0, 0);
- series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 0, 0);
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
}
break;
case 13:
switch (imath_ranged_rand(1, 8)) {
case 1:
- _val4 = 12;
- series_play("103cr01", 0x100, 2, 10, 30, 0, 100, 0, 0, 1, 2);
- series_play("103cr01s", 0x100, 2, -1, 30, 0, 100, 0, 0, 1, 2);
+ _crow1Should = 12;
+ Series::series_play("103cr01", 0x100, 2, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
break;
case 3:
- series_play("103cr01", 0x100, 0, 10, 6, 0, 100, 0, 0, 7, 15);
- series_play("103cr01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 7, 15);
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 6, 0, 100, 0, 0, 7, 15);
break;
case 4:
case 5:
- _val4 = 14;
- series_play("103cr01", 0x100, 0, 10, 30, 0, 100, 0, 0, 3, 4);
- series_play("103cr01s", 0x100, 0, -1, 30, 0, 100, 0, 0, 3, 4);
+ _crow1Should = 14;
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 3, 4);
break;
default:
- series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 2, 2);
- series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 2, 2);
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 2, 2);
break;
}
break;
case 14:
if (imath_ranged_rand(1, 4) == 1) {
- _val4 = 13;
- series_play("103cr01", 0x100, 0, 10, 6, 0, 100, 0, 0, 5, 15);
- series_play("103cr01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 5, 15);
+ _crow1Should = 13;
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 6, 0, 100, 0, 0, 5, 15);
} else {
- series_play("103cr01", 0x100, 0, 10, 60, 0, 100, 0, 0, 4, 4);
- series_play("103cr01s", 0x100, 0, -1, 60, 0, 100, 0, 0, 4, 4);
+ Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 4, 4);
}
break;
+
+ default:
+ break;
}
break;
- case 11:
- switch (_val9) {
+ case kCHANGE_CROW2_ANIMATION:
+ switch (_crow2Should) {
case 15:
if (imath_ranged_rand(1, 4) == 1) {
- _val9 = 16;
- series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 1, 2);
+ _crow2Should = 16;
+ series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
} else {
- series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 0, 0);
+ series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 70, 0, 100, 0, 0, 0, 0);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 0, 0);
}
break;
@@ -317,19 +320,19 @@ void Room103::daemon() {
case 16:
switch (imath_ranged_rand(1, 5)) {
case 1:
- _val9 = 15;
- series_play("103cr02", 0x100, 2, 11, 30, 0, 100, 0, 0, 1, 2);
+ _crow2Should = 15;
+ series_play("103cr02", 0x100, 2, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 1, 2);
break;
case 2:
- _val9 = 17;
- series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 3, 4);
+ _crow2Should = 17;
+ series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 3, 4);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 3, 4);
break;
default:
- series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 2, 2);
+ series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 70, 0, 100, 0, 0, 2, 2);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 2, 2);
break;
}
@@ -338,13 +341,13 @@ void Room103::daemon() {
case 17:
switch (imath_ranged_rand(1, 6)) {
case 1:
- _val9 = 16;
+ _crow2Should = 16;
series_play("103cr02", 0x100, 2, 11, 30, 0, 100, 0, 0, 3, 4);
series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 3, 4);
break;
case 2:
- _val9 = 18;
+ _crow2Should = 18;
series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 5, 8);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 5, 8);
break;
@@ -358,7 +361,7 @@ void Room103::daemon() {
case 18:
if (imath_ranged_rand(1, 4) == 1) {
- _val9 = 17;
+ _crow2Should = 17;
series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 9, 12);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 9, 12);
} else {
@@ -372,15 +375,15 @@ void Room103::daemon() {
}
break;
- case 12:
- switch (_val5) {
+ case kCHANGE_CROW3_ANIMATION:
+ switch (_crow3Should) {
case 19:
if (imath_ranged_rand(1, 4) == 1) {
- _val5 = 20;
- series_play("103cr03", 0x100, 0, 12, 30, 0, 100, 0, 0, 1, 2);
+ _crow3Should = 20;
+ series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr03s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
} else {
- series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 0, 0);
+ series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 0, 0);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 0, 0);
}
break;
@@ -388,18 +391,18 @@ void Room103::daemon() {
case 20:
switch (imath_ranged_rand(1, 6)) {
case 1:
- _val5 = 19;
- series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 4, 4);
+ _crow3Should = 19;
+ series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 4, 4);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 4, 4);
break;
case 3:
- series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 2, 2);
+ series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 2, 2);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 2, 2);
break;
default:
- series_play("103cr03", 0x100, 0, 12, 80, 0, 100, 0, 0, 3, 3);
+ series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 3, 3);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 3, 3);
break;
}
@@ -407,23 +410,23 @@ void Room103::daemon() {
}
break;
- case 13:
- switch (_val6) {
+ case kCHANGE_CROW4_ANIMATION:
+ switch (_crow4Should) {
case 21:
switch (imath_ranged_rand(1, 6)) {
case 1:
- series_play("103cr04", 0x100, 0, 13, 6, 0, 100, 0, 0, 5, 9);
+ series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 6, 0, 100, 0, 0, 5, 9);
series_play("103cr04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 5, 9);
break;
case 2:
- _val6 = 22;
- series_play("103cr04", 0x100, 0, 13, 30, 0, 100, 0, 0, 1, 2);
+ _crow4Should = 22;
+ series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr04s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
break;
default:
- series_play("103cr04", 0x100, 0, 13, 90, 0, 100, 0, 0, 0, 0);
+ series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 90, 0, 100, 0, 0, 0, 0);
series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 0, 0);
break;
}
@@ -431,11 +434,11 @@ void Room103::daemon() {
case 22:
if (imath_ranged_rand(1, 4) == 1) {
- _val6 = 21;
- series_play("103cr04", 0x100, 2, 13, 30, 0, 100, 0, 0, 0, 1);
+ _crow4Should = 21;
+ series_play("103cr04", 0x100, 2, kCHANGE_CROW4_ANIMATION, 30, 0, 100, 0, 0, 0, 1);
series_play("103cr04s", 0x100, 2, -1, 30, 0, 100, 0, 0, 0, 1);
} else {
- series_play("103cr04", 0x100, 0, 13, 90, 0, 100, 0, 0, 0, 2);
+ series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 90, 0, 100, 0, 0, 0, 2);
series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 2, 2);
}
break;
@@ -483,13 +486,13 @@ void Room103::daemon() {
case 19:
_G(flags)[V298] = 1;
terminateMachineAndNull(_series2);
- series_play_with_breaks(PLAY4, "103ha02", 0x100, 20, 2, 10, 100, 0, 0);
+ series_play_with_breaks(PLAY4, "103ha02", 0x100, kCHANGE_HARRY_ANIMATION, 2, 10, 100, 0, 0);
_frame = 10;
- _val8 = 9;
+ _harryShould = 9;
break;
- case 20:
- switch (_val8) {
+ case kCHANGE_HARRY_ANIMATION:
+ switch (_harryShould) {
case 9:
if (imath_ranged_rand(1, 2) == 1) {
if (++_frame >= 17)
@@ -499,7 +502,7 @@ void Room103::daemon() {
_frame = 12;
}
- series_play("103ha02", 0x101, 0, 20, 10, 0, 100, 0, 0, _frame, _frame);
+ series_play("103ha02", 0x101, 0, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, _frame, _frame);
break;
case 10:
@@ -512,7 +515,7 @@ void Room103::daemon() {
break;
case 21:
- _val8 = 10;
+ _harryShould = 10;
kernel_timing_trigger(1, 24);
break;
diff --git a/engines/m4/burger/rooms/section1/room103.h b/engines/m4/burger/rooms/section1/room103.h
index dc3010545d0..ba3db438ba9 100644
--- a/engines/m4/burger/rooms/section1/room103.h
+++ b/engines/m4/burger/rooms/section1/room103.h
@@ -38,12 +38,12 @@ private:
bool _flag1 = false;
int _val2 = 0;
int _val3 = 0;
- int _val4 = 0;
- int _val5 = 0;
- int _val6 = 0;
+ int _crow1Should = 0;
+ int _crow3Should = 0;
+ int _crow4Should = 0;
int _val7 = 0;
- int _val8 = 0;
- int _val9 = 0;
+ int _harryShould = 0;
+ int _crow2Should = 0;
int _frame = 0;
int _digi1 = 0;
machine *_series1 = nullptr;
Commit: 6ef646081b78aa52caf45d68dcd4487d2059fd33
https://github.com/scummvm/scummvm/commit/6ef646081b78aa52caf45d68dcd4487d2059fd33
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Add support for mouse wheel to change cursors
Changed paths:
engines/m4/adv_r/adv_control.cpp
engines/m4/adv_r/adv_control.h
engines/m4/burger/hotkeys.cpp
engines/m4/burger/hotkeys.h
engines/m4/core/rooms.cpp
engines/m4/gui/hotkeys.h
engines/m4/platform/events.cpp
engines/m4/riddle/hotkeys.cpp
engines/m4/riddle/hotkeys.h
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_control.cpp b/engines/m4/adv_r/adv_control.cpp
index e842a034351..c835ab782ec 100644
--- a/engines/m4/adv_r/adv_control.cpp
+++ b/engines/m4/adv_r/adv_control.cpp
@@ -82,10 +82,6 @@ void adv_kill_digi_between_rooms(bool true_or_false) {
_G(shut_down_digi_tracks_between_rooms) = true_or_false;
}
-void toggle_through_cursors() {
- g_vars->getHotkeys()->toggle_through_cursors();
-}
-
bool this_is_a_walkcode(int32 x, int32 y) {
if (!_G(screenCodeBuff))
return false;
diff --git a/engines/m4/adv_r/adv_control.h b/engines/m4/adv_r/adv_control.h
index 770c2a17d13..570dd628e00 100644
--- a/engines/m4/adv_r/adv_control.h
+++ b/engines/m4/adv_r/adv_control.h
@@ -31,7 +31,6 @@ namespace M4 {
extern bool kernel_section_startup();
extern void player_set_commands_allowed(bool t_or_f);
extern void game_pause(bool flag);
-extern void toggle_through_cursors();
extern bool this_is_a_walkcode(int32 x, int32 y);
extern int32 get_screen_depth(int32 x, int32 y);
extern int32 get_screen_color(int32 x, int32 y);
diff --git a/engines/m4/burger/hotkeys.cpp b/engines/m4/burger/hotkeys.cpp
index 2ec83a70673..b4542baeafb 100644
--- a/engines/m4/burger/hotkeys.cpp
+++ b/engines/m4/burger/hotkeys.cpp
@@ -59,19 +59,46 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey('f', a_cb);
}
-void Hotkeys::toggle_through_cursors() {
- switch (_G(cursor_state)) {
+void Hotkeys::toggle_through_cursors(CursorChange cursChange) {
+ cursor_states newCursor = kARROW;
+
+ switch (cursChange) {
+ case CURSCHANGE_NEXT:
+ newCursor = _G(cursor_state) == kUSE ? kARROW :
+ static_cast<cursor_states>((int)_G(cursor_state) + 1);
+ break;
+
+ case CURSCHANGE_PREVIOUS:
+ newCursor = _G(cursor_state) == kARROW ? kUSE :
+ static_cast<cursor_states>((int)_G(cursor_state) - 1);
+ break;
+
+ case CURSCHANGE_TOGGLE:
+ if (_G(cursor_state) == kARROW) {
+ newCursor = _priorCursor;
+ _priorCursor = _G(cursor_state);
+ } else {
+ newCursor = kARROW;
+ _priorCursor = _G(cursor_state);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (newCursor) {
case kARROW:
- Hotkeys::l_cb(nullptr, nullptr);
+ Hotkeys::a_cb(nullptr, nullptr);
break;
case kLOOK:
- Hotkeys::t_cb(nullptr, nullptr);
+ Hotkeys::l_cb(nullptr, nullptr);
break;
case kTAKE:
- Hotkeys::u_cb(nullptr, nullptr);
+ Hotkeys::t_cb(nullptr, nullptr);
break;
case kUSE:
- Hotkeys::a_cb(nullptr, nullptr);
+ Hotkeys::u_cb(nullptr, nullptr);
break;
default:
break;
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index daee9ab0c74..e34ebae2673 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -25,6 +25,7 @@
#include "m4/m4_types.h"
#include "m4/gui/hotkeys.h"
+#include "m4/core/mouse.h"
namespace M4 {
namespace Burger {
@@ -32,6 +33,7 @@ namespace Burger {
struct Hotkeys : public M4::Hotkeys {
private:
static Dialog *_versionDialog;
+ cursor_states _priorCursor = kARROW;
private:
static void t_cb(void *, void *);
@@ -56,7 +58,7 @@ public:
void add_hot_keys() override;
- void toggle_through_cursors() override;
+ void toggle_through_cursors(CursorChange cursChange = CURSCHANGE_NEXT) override;
};
} // namespace Burger
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index cdc064cd76c..f696e4a560e 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -370,9 +370,10 @@ void Sections::pal_game_task() {
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
if (!_G(kernel).pause) {
- if (_G(please_hyperwalk)) {
- _G(please_hyperwalk) = false;
- toggle_through_cursors();
+ if (_G(toggle_cursor) != CURSCHANGE_NONE) {
+ CursorChange change = _G(toggle_cursor);
+ _G(toggle_cursor) = CURSCHANGE_NONE;
+ g_vars->getHotkeys()->toggle_through_cursors(change);
}
updateVideo = !_cameraShiftAmount && !_cameraShift_vert_Amount;
diff --git a/engines/m4/gui/hotkeys.h b/engines/m4/gui/hotkeys.h
index 5333c0770be..4e2109158c5 100644
--- a/engines/m4/gui/hotkeys.h
+++ b/engines/m4/gui/hotkeys.h
@@ -28,6 +28,10 @@
namespace M4 {
+enum CursorChange {
+ CURSCHANGE_NONE, CURSCHANGE_NEXT, CURSCHANGE_PREVIOUS, CURSCHANGE_TOGGLE
+};
+
struct Hotkeys {
private:
static Dialog *_teleportDialog;
@@ -96,7 +100,7 @@ public:
static void saveGame(void *, void *);
static void loadGame(void *, void *);
- virtual void toggle_through_cursors() = 0;
+ virtual void toggle_through_cursors(CursorChange cursChange = CURSCHANGE_NEXT) = 0;
};
} // End of namespace M4
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index d167e5611f7..96b390b928a 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -33,11 +33,7 @@ namespace M4 {
enum {
CursorPositionChanged = 0,
LeftButtonPressed, LeftButtonReleased, RightButtonPressed,
- RightButtonReleased, OEM_MiddleButtonPressed, OEM_MiddleButtonReleased
-#if 0
- ,
- LeftButtonHold, RightButtonHold, OEM_MiddleButtonHold
-#endif
+ RightButtonReleased
};
/*
@@ -50,9 +46,6 @@ enum {
#define RBD ((uint16)(1 << RightButtonPressed))
#define RBU ((uint16)(1 << RightButtonReleased))
#define RBH ((uint16)(1 << RightButtonHold))
-#define MBD ((uint16)(1 << OEM_MiddleButtonPressed))
-#define MBU ((uint16)(1 << OEM_MiddleButtonReleased))
-//#define MBHold ((uint16)(1 << OEM_MiddleButtonHold))
#define LBC (LBD + LBU)
#define RBC (RBD + RBU)
@@ -64,10 +57,12 @@ enum {
#define _ClearMLD _mouseStateEvent &= ~LBD
#define _MLU (_mouseStateEvent & LBU)
#define _ClearMLU _mouseStateEvent &= ~LBU
+
#define _MRD (_mouseStateEvent & RBD)
#define _ClearMRD _mouseStateEvent &= ~RBD
#define _MRU (_mouseStateEvent & RBU)
#define _ClearMRU _mouseStateEvent &= ~RBU
+
#define _MMOVE ((_mouseX != _oldX) || (_mouseY != _oldY))
#define _MSAVE _oldX = _mouseX; _oldY = _mouseY
@@ -122,14 +117,17 @@ void Events::handleMouseEvent(const Common::Event &ev) {
_mouseStateEvent |= RBU;
ButtonState = 0;
break;
- case Common::EVENT_MBUTTONDOWN:
- _mouseStateEvent |= MBD;
- ButtonState = 4;
+
+ case Common::EVENT_WHEELDOWN:
+ _G(toggle_cursor) = CURSCHANGE_NEXT;
break;
- case Common::EVENT_MBUTTONUP:
- _mouseStateEvent |= MBU;
- ButtonState = 0;
+ case Common::EVENT_WHEELUP:
+ _G(toggle_cursor) = CURSCHANGE_PREVIOUS;
+ break;
+ case Common::EVENT_MBUTTONDOWN:
+ _G(toggle_cursor) = CURSCHANGE_TOGGLE;
break;
+
default:
break;
}
@@ -184,7 +182,7 @@ MouseEvent Events::mouse_get_event() {
if (_MRU) {
_ClearMRU;
_mouse_state = _MS_no_event;
- _G(please_hyperwalk) = true;
+ _G(toggle_cursor) = CURSCHANGE_NEXT;
return _ME_R_release;
}
if (_MMOVE) {
diff --git a/engines/m4/riddle/hotkeys.cpp b/engines/m4/riddle/hotkeys.cpp
index 894a47f7c51..48a1cce2473 100644
--- a/engines/m4/riddle/hotkeys.cpp
+++ b/engines/m4/riddle/hotkeys.cpp
@@ -48,19 +48,46 @@ void Hotkeys::add_hot_keys() {
AddSystemHotkey('f', a_cb);
}
-void Hotkeys::toggle_through_cursors() {
- switch (_G(cursor_state)) {
+void Hotkeys::toggle_through_cursors(CursorChange cursChange) {
+ cursor_states newCursor = kARROW;
+
+ switch (cursChange) {
+ case CURSCHANGE_NEXT:
+ newCursor = _G(cursor_state) == kUSE ? kARROW :
+ static_cast<cursor_states>((int)_G(cursor_state) + 1);
+ break;
+
+ case CURSCHANGE_PREVIOUS:
+ newCursor = _G(cursor_state) == kARROW ? kUSE :
+ static_cast<cursor_states>((int)_G(cursor_state) - 1);
+ break;
+
+ case CURSCHANGE_TOGGLE:
+ if (_G(cursor_state) == kARROW) {
+ newCursor = _priorCursor;
+ _priorCursor = _G(cursor_state);
+ } else {
+ newCursor = kARROW;
+ _priorCursor = _G(cursor_state);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (newCursor) {
case kARROW:
- Hotkeys::l_cb(nullptr, nullptr);
+ Hotkeys::a_cb(nullptr, nullptr);
break;
case kLOOK:
- Hotkeys::t_cb(nullptr, nullptr);
+ Hotkeys::l_cb(nullptr, nullptr);
break;
case kTAKE:
- Hotkeys::u_cb(nullptr, nullptr);
+ Hotkeys::t_cb(nullptr, nullptr);
break;
case kUSE:
- Hotkeys::a_cb(nullptr, nullptr);
+ Hotkeys::u_cb(nullptr, nullptr);
break;
default:
break;
diff --git a/engines/m4/riddle/hotkeys.h b/engines/m4/riddle/hotkeys.h
index ba8906d236e..0a195b029c4 100644
--- a/engines/m4/riddle/hotkeys.h
+++ b/engines/m4/riddle/hotkeys.h
@@ -25,11 +25,16 @@
#include "m4/m4_types.h"
#include "m4/gui/hotkeys.h"
+#include "m4/core/mouse.h"
namespace M4 {
namespace Riddle {
struct Hotkeys : public M4::Hotkeys {
+private:
+ cursor_states _priorCursor = kARROW;
+
+public:
static void t_cb(void *, void *);
static void u_cb(void *, void *);
static void l_cb(void *, void *);
@@ -44,7 +49,7 @@ struct Hotkeys : public M4::Hotkeys {
void add_hot_keys() override;
- void toggle_through_cursors() override;
+ void toggle_through_cursors(CursorChange cursChange = CURSCHANGE_NEXT) override;
};
} // namespace Riddle
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index f68b213943e..49db4a4b9c7 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -140,7 +140,7 @@ public:
void *_custom_interface_setup = nullptr;
void *_custom_interface_button_handler = nullptr;
int _global_sound_room = 0;
- bool _please_hyperwalk = false;
+ CursorChange _toggle_cursor = CURSCHANGE_NONE;
bool _i_just_hyperwalked = false;
void (*_custom_ascii_converter)(char *string) = nullptr;
bool _vmng_Initted = false;
Commit: 3a42fb0cdddfb870c16dbc5ba82e5c12b1feb4c1
https://github.com/scummvm/scummvm/commit/3a42fb0cdddfb870c16dbc5ba82e5c12b1feb4c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Added kBurlEntersTown enum to room 137
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index 41e4c2d7ee3..b78079af548 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -654,7 +654,7 @@ void Room137::daemon() {
}
break;
- case 10028:
+ case kBurlEntersTown:
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
@@ -663,7 +663,7 @@ void Room137::daemon() {
kernel_timing_trigger(240, 11);
} else {
- kernel_timing_trigger(60, 10028);
+ kernel_timing_trigger(60, kBurlEntersTown);
}
break;
Commit: b3170f30b175f88bac70df4bcf9c5269f78b4298
https://github.com/scummvm/scummvm/commit/b3170f30b175f88bac70df4bcf9c5269f78b4298
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix waking up police with horn
Changed paths:
engines/m4/burger/rooms/section1/room137.cpp
diff --git a/engines/m4/burger/rooms/section1/room137.cpp b/engines/m4/burger/rooms/section1/room137.cpp
index b78079af548..84a6fda1a7e 100644
--- a/engines/m4/burger/rooms/section1/room137.cpp
+++ b/engines/m4/burger/rooms/section1/room137.cpp
@@ -270,6 +270,48 @@ void Room137::daemon() {
}
break;
+ case 14:
+ switch (_sherrifShould) {
+ case 22:
+ if (imath_ranged_rand(1, 30) == 2) {
+ series_play("137sh04", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 14);
+ } else {
+ series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 12, 0, 100, 0, 0, 17, 17);
+ }
+ break;
+
+ case 23:
+ _sherrifMode = 16;
+ series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
+ break;
+
+ case 24:
+ _sherrifShould = 23;
+ series_play("137sh05", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 17);
+
+ if (_digi1) {
+ _G(kernel).trigger_mode = KT_PARSE;
+ digi_play(_digi1, 1, 255, 14);
+ _digi1 = nullptr;
+ }
+ break;
+
+ case 25:
+ _sherrifShould = 26;
+ series_play("137sh06", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 23);
+ break;
+
+ case 26:
+ conv_resume_curr();
+ _sherrifShould = 22;
+ kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
case 16:
if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 8);
Commit: 261f55ab3b3e86fddb457f92d1e456cf0dd8317a
https://github.com/scummvm/scummvm/commit/261f55ab3b3e86fddb457f92d1e456cf0dd8317a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Fix sherrif animation after taking keys
Changed paths:
engines/m4/burger/rooms/section1/room138.cpp
diff --git a/engines/m4/burger/rooms/section1/room138.cpp b/engines/m4/burger/rooms/section1/room138.cpp
index dcd18786af1..e96f0c6188a 100644
--- a/engines/m4/burger/rooms/section1/room138.cpp
+++ b/engines/m4/burger/rooms/section1/room138.cpp
@@ -233,7 +233,7 @@ void Room138::daemon() {
} else if (_sherrifShould == 36 && _val4 == 22) {
_sherrifShould = 26;
- series_play("138cp02", 0x100, 0, kTestTimeout, 8, 0, 100, 0, 0, 0, 30);
+ series_play("138cp02", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 30);
randomDigi();
} else if (_val4 == 22 && !inv_object_is_here("keys") &&
Commit: 6e3d7caf3224ff27c9a437ad47ec21c8acf81ab4
https://github.com/scummvm/scummvm/commit/6e3d7caf3224ff27c9a437ad47ec21c8acf81ab4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Hook ScummVM save/load to in-game options dialog
Changed paths:
engines/m4/burger/gui/game_menu.cpp
engines/m4/m4.h
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index 9bf74ca9921..f3afdaf0994 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -2637,25 +2637,28 @@ void cb_Game_Resume(void *, void *) {
}
void cb_Game_Save(void *, void *) {
-
// Destroy the game menu
DestroyGameMenu();
// Create the save game menu
- CreateSaveMenu(nullptr);
+// CreateSaveMenu(nullptr);
+ if (!g_engine->useOriginalSaveLoad())
+ menu_Shutdown(true);
+ g_engine->showSaveScreen();
}
void cb_Game_Load(void *, void *) {
-
// Destroy the game menu
DestroyGameMenu();
// Create the save game menu
- CreateLoadMenu(nullptr);
+// CreateLoadMenu(nullptr);
+ if (!g_engine->useOriginalSaveLoad())
+ menu_Shutdown(true);
+ g_engine->showLoadScreen();
}
void cb_Game_Main(void *, void *) {
-
// Destroy the game menu
DestroyGameMenu();
@@ -2681,7 +2684,6 @@ void cb_Game_Main(void *, void *) {
}
void cb_Game_Options(void *, void *) {
-
// Destroy the game menu
DestroyGameMenu();
@@ -2689,7 +2691,6 @@ void cb_Game_Options(void *, void *) {
CreateOptionsMenu(nullptr);
}
-
void DestroyGameMenu(void) {
if (!_GM(gameMenu)) {
return;
@@ -2705,7 +2706,6 @@ void DestroyGameMenu(void) {
menu_UnloadSprites();
}
-
void CreateGameMenuMain(RGB8 *myPalette) {
if (!_G(menuSystemInitialized)) {
menu_Initialize(myPalette);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 40d75b80ba1..a996fcad7ac 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -77,6 +77,9 @@ public:
~M4Engine() override;
uint32 getFeatures() const;
+ bool useOriginalSaveLoad() const {
+ return _useOriginalSaveLoad;
+ }
/**
* Returns the game Id
Commit: b0be249473f6b46a170a6f409d08bb815fbd85fb
https://github.com/scummvm/scummvm/commit/b0be249473f6b46a170a6f409d08bb815fbd85fb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-24T01:53:38+01:00
Commit Message:
M4: Remap the options button to the ScummVM GMM
I decided this is better functionally than showing the Options
menu, and just remapping the Save/Load buttons
Changed paths:
engines/m4/burger/gui/interface.cpp
engines/m4/core/rooms.cpp
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index a54320e3e61..5d026525374 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -354,7 +354,12 @@ void Interface::trackIcons() {
case 11:
// Game menu
other_save_game_for_resurrection();
- CreateGameMenu(_G(master_palette));
+
+ if (g_engine->useOriginalSaveLoad()) {
+ CreateGameMenu(_G(master_palette));
+ } else {
+ g_engine->openMainMenuDialog();
+ }
break;
}
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index f696e4a560e..b9b36ac1dca 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -326,6 +326,9 @@ void Sections::game_control_cycle() {
// Ensure the screen is updated
g_system->updateScreen();
g_system->delayMillis(10);
+
+ if (g_engine->shouldQuit())
+ _G(kernel).going = false;
}
_GI().cancel_sentence();
More information about the Scummvm-git-logs
mailing list