Commit Graph
63 Commits
Author SHA1 Message Date
Walter Agazzi 5ce015027f AGS: Add const_casts, comment out unneeded bindings 2024-10-30 18:07:42 +02:00
Walter Agazzi c6e115e697 AGS: Script API: added readonly ScriptName property to all applicable types
From upstream a19c52bae9d8513bcb68924c0c4f11717dde90e7
2024-10-30 18:07:42 +02:00
Walter Agazzi 455b9609d0 AGS: Script API: implemented Type.GetByName() for all applicable types
From upstream 29602688ec766cdc0b8fb7aa761f73292365651b
2024-10-30 18:07:42 +02:00
Walter Agazzi d7c2c0a490 AGS: ScriptAPI: add Object.AnimationVolume bindings
This completes 094efb1c332edb1580d25a7922890fe42fc77e92
2024-10-30 18:07:42 +02:00
Walter Agazzi b498b14ecc AGS: Engine: save global draw method args in DrawState struct
Avoid query gfxDriver's properties all the time, instead save them once in init_draw_method() and use saved values.

From upstream db535512af65119d50ae3d6fb06c221d56f42d85
2024-10-30 18:07:42 +02:00
Walter Agazzi 20706c475f AGS: Engine: Complete move to new API registering
This complements the previous commits related to the upstream commit
9221ea54c1a81b9f37829d7fafc90ac2806d4eb1:
Engine: replaced script API registration with cleaner array tables
The benefits are:
1. Cleaner registration view, an array initializer instead of myriads of function calls.
2. Implicit distinction between static and object member functions based on prototype
detection, no need to explicitly pass a parameter or call respective registration function.
3. Enforced function registration for plugins, now combined with the regular registration
in one table entry, so more difficult to skip plugin variant
2024-10-30 18:07:42 +02:00
Walter Agazzi f35fe9b988 AGS: Script API: added Object.AnimationVolume, like in Character
Missed to add this in 3.6.0 (thought it is not necessary for some reason...)
From upstream 480a8de9d3c5dc36eaaa3e4be94a1edf00445d68
2024-10-30 18:07:42 +02:00
Walter Agazzi 48f18177e7 AGS: Engine: picked out SetObjectFrameSimple that does not play frame sound
From upstream 98ea0fe0c0b0d82d5caf9d085c8b6c04cdb28c38
2024-10-30 18:07:42 +02:00
Walter Agazzi 887aea0229 AGS: Engine: fixed incorrect ScalingFar condition in update_object_scale()
From upstream 5dc8c065a7162f892ecbfbdd1d8d276e75a5eaaa
2024-10-30 18:07:42 +02:00
Walter Agazzi ac85f7fc52 AGS: Engine: unified API assertions for view, loop and frame
From upstream 1fe83591970e6a87d1f97c8f4e2d752a3a35b301
2024-10-30 18:07:42 +02:00
Walter Agazzi a23bc88912 AGS: Engine: character and room object share function updating sprite scale
from upstream 54b689724c076e92e70decf9fe795ea76bec5f84
2024-10-30 18:07:42 +02:00
Walter Agazzi 393aed7dd2 AGS: Engine: removed AGS_INLINE macro, as it's useless
from upstream e1919aa3b9e719f437e966780a41dd297eb82940
2024-10-30 18:07:42 +02:00
Walter Agazzi 09039ca805 AGS: Engine: brought multivariant script api functions to naming consistency
The idea is that the old variants have internal names with number
(signifying number of args), while the latest variant has a name without number.

Make sure there's a distinct function for each variant, and older vars are calling later ones in a sequence.
These calls likely to be inlined.
From upstream ca48926a37e848a1bcc162f77cc81e63ec7a1ca0
2024-10-30 18:07:42 +02:00
Walter Agazzi 32433b1368 AGS: Engine: fixed error check and messages in ValidateViewAnimParams() 2024-10-30 18:07:42 +02:00
Walter Agazzi e0aab081f2 AGS: Engine: picked out view-loop-frame Animate params check, fixup sframe
from upstream db71d928a6f290172975209d36ba7b7e22881f57
2024-10-30 18:07:42 +02:00
Walter Agazzi 96257b87cb AGS: Engine: ensure that all AnimateObject variants lead to the same impl 2024-10-30 18:07:42 +02:00
Walter Agazzi f75a45d38d AGS: Engine: separated RoomObject's internal ANIM flags, fix ONCERESET arg
Separated internal RoomObject's storage values for ANIM_* types into OBJANIM_ constants.
Use common ANIM_* constants in shared code, such as ValidateViewAnimParams() and CycleViewAnim().
The internal storage values of objects, characters and buttons are converted from and to ANIM_ values
as necessary.
2024-10-30 18:07:42 +02:00
Walter Agazzi 0b50067abb AGS: Engine: implement add_waypoint_direct(), fix AddWaypoint's resolution
This fixes Character.AddWaypoint not applying room<->mask resolution conversion,
which result in character's speed being different if room has non 1:1 mask resolution.

Hide calculate_move_stage() inside pathfinder, and expose add_waypoint_direct()
in the pathfinder interface instead.
From upstream 093354d78849dc3b4f13a244d4400c4e71f7d687
2024-03-28 12:01:52 +01:00
Walter Agazzi dacccc343e AGS: Engine: fix use of global "walkspeed" variables in the pathfinder
These variables had to be set using set_route_move_speed() call in order for
the find_route() and calculate_move_stage() work properly.
But it's not obvious, and easy to forget. So turn them into function arguments instead.

This fixes Character.AddWaypoint potentially using wrong walkspeed, if there are
multiple characters or objects moving simultaneously.
An example of a script that would cause a bug:

    cEgo.AddWaypoint(20, 20);
    oObject0.Move(0, 160, 1, eNoBlock, eAnywhere);
    cEgo.AddWaypoint(200, 200);

from upstream 9a00255a2699845bd0e53054d81c24e6955f663e
2024-03-28 12:01:52 +01:00
Walter Agazzi 7cd860207d AGS: Engine: add object and char assertions in Get/SetProperty functions
Since older commit 5f3b8eb the properties are stored in vectors,
strictly resized to the number of characters and objects.
But the script functions that access these do not do any assertion
whether the object or char is valid, which could cause bad mem
access in case script loops over a array of objects of MAX_OBJECTS
size, or tries to access something using Object* pointer from another room.
From upstream 6ad4b220d75a32ea8df959e9a7b7f1ecb21d0c26
2023-09-02 13:23:59 +02:00
Walter Agazzi 18b8335fea AGS: Engine: fixed the bw-compat SetObjectFrame() behavior
This was broken by eb376e6

1. Treating negative loop and frame as an instruction to keep latest object's
loop and frame values was introduced around AGS 2.70 by Object.SetView(),
but this behavior also propagated to SetObjectFrame() command.

2. Removed clamping of loop and frame values inside Object.SetView(),
as that prevented applying a historical behavior of SetObjectFrame(),
where any invalid loop and frame value would be changed to just 0.

3. Don't quit the game in case of invalid loop and frame, but fallback
to default 0 value, and print a warning.

Also removed some redundant assignments to RoomObject,
possibly a result of a commit merge from another branch.

From upstream 66bb18f0224eebfb2a130395e9b18ce59b584e13
This is the 3.6.1 branch, but the fix is required to solve a game-breaking
bug in Chronicle of Innsmouth
2023-08-14 18:34:58 +02:00
Walter Agazzi 503e06a1a1 AGS: Engine: picked out basic Animate params check and warn instead of quit
This avoids the Gobliiins5 errors.
From upstream ecb4ae13031c32c2793d1d6a2b2af9f2af7bd911
2023-05-12 12:00:39 +02:00
Walter Agazzi 150df392b4 AGS: Engine: fixed <3.6.0 Animate functions default volume parameter
From upstream d8d94b36a3e4e7fe201e93965952698fc6c8da5e
2023-04-29 14:32:39 +02:00
Thierry Crozat 9619169132 AGS: Use 100 as a default animation volume, as it's relative anyway
From upstream 90a60fffd5f010e957a53721f860997835216308
Also includes upstream 951f60c4dc25aa1d4320f595e01b048b53f6bf5f
2022-06-19 00:46:56 +01:00
Thierry Crozat 282ee9ad97 AGS: Fixing more trivial warnings
From upstream 83f7d9857e70f7d1d10fedf61196740d20ba0b0a
2022-06-18 01:08:54 +01:00
Paul Gilbert d39c6cb31f AGS: Added "sound volume" param to all Animate() functions
From upstream 926220f9706baafa80d05ff6264f7fa13296dc16
2022-05-10 21:17:59 -07:00
Paul Gilbert 97c12e8435 AGS: Merged Character and ObjectCache structs, and hid in draw.cpp
From upstream 753d47d975b10666702c47a22cbc4e68847787f1
2022-05-05 22:41:09 -07:00
Paul Gilbert a40ea44aa2 AGS: CharacterCache is stored in std::vector, hide in draw.cpp
From upstream 417879fce0dc27d458a73fedc20f311f3305f26f
2022-05-05 22:41:08 -07:00
Paul Gilbert 6482e38803 AGS: CharacterExtras and MoveLists are stored in std::vector
From upstream 0c81cfefb788c0dcfdb2cad914f939f28110edca
2022-05-05 22:41:08 -07:00
Paul Gilbert 8d261dd92f AGS: Corrected naimng style of RoomObject::NO_VIEW constant
From upstream ff544cda911ab036be44171a1b97b8a52e943758
2022-04-24 16:00:03 -07:00
Paul Gilbert f27e782b23 AGS: Use constant to setup "no view" in RoomObjects instead of -1
From upstream a1f74944a7e3c058deb8b12680c5b9aba19dee5a
2022-04-24 16:00:01 -07:00
Paul Gilbert 09d4069428 AGS: Share animation cycling algo between Buttons and RoomObjects
From upstream fd28a2548e39c85478d98e26b51713cd687acada
2022-04-22 20:05:04 -07:00
Paul Gilbert cb95772ad9 AGS: Update @OVERHOTSPOT@ when object/hotspot name changes
From upstream 64bb4fe130908d078c7945c000e0b43dfea49a14
2022-04-10 19:39:08 -07:00
Paul Gilbert fabab1285d AGS: Made Hotspot.Name and Object.Name settable
From upstream 6a7271c4df1765dc86f88d7676337b63fcef17aa
2022-04-10 19:39:08 -07:00
Paul Gilbert a3dda03cf1 AGS: Store Views in std::vector
From upstream 095db88ae0f1acceb298f793a2e1b81dbe06fcff
2022-03-18 21:29:56 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Alexandre Detiste 6044504762 JANITORIAL: typos
some in the variable names, some in the comments;
no change for the strings that interract with original games assets
2021-10-31 20:46:31 +01:00
Paul Gilbert 5e5a7ab089 AGS: SetObjectFrame fallback to dummy frame in an empty loop
From upstream 1496f7f6419d192bd4060956492e8897678035c9
2021-09-28 20:18:40 -07:00
Paul Gilbert 5ad9352f8e AGS: Re-add accidentally removed Object::get_Solid export 2021-07-31 14:34:11 -07:00
Paul Gilbert cf36b34f0d AGS: Implemented Object.ManualScaling and Object.Scaling
From upstream fe9bf3707afb4c36effc358d8e3eb7834d333fb5
2021-07-27 22:03:38 -07:00
Paul Gilbert 47928c39aa AGS: changed Object.SetView default loop & frame values to 0
From upstream eb376e63f95b09fd75ca7f96591aca20d0564072
2021-07-27 22:03:36 -07:00
Paul Gilbert 0274540d47 AGS: Implement remaining plugin core export classes 2021-07-17 15:52:11 -07:00
Paul Gilbert bfabf7c94d AGS: Fixed infinite wait in Object_Move under specific conditions
From upstream 9dbdfe423c870e010a887cada725a8bbdf2de16e
2021-07-07 22:07:10 -07:00
Paul Gilbert eb1e337edd AGS: Removed String's "const char*" conversion operator
From upstream 7c426674e7e53bffe9120f8ffc059b77fa03a606
2021-06-13 21:08:59 -07:00
Paul Gilbert 701396361c AGS: Import of fresh codebase 2021-06-13 21:08:44 -07:00
Paul Gilbert 3a0a70bc43 AGS: Move more game.cpp globals to Globals 2021-03-10 21:01:11 -08:00
Paul Gilbert dbdac3c3cf AGS: Move walkablearea.cpp globals to Globals 2021-03-09 21:14:03 -08:00
Paul Gilbert 2d82d32577 AGS: Move draw.cpp globals to Globals 2021-03-09 21:14:02 -08:00
Paul Gilbert 37b563ef35 AGS: Move game globals to Globals 2021-03-07 19:23:24 -08:00
Paul Gilbert 887472c8c1 AGS: Moved a lot of game.cpp globals to Globals 2021-02-28 13:27:21 -08:00