Commit Graph
58 Commits
Author SHA1 Message Date
Walter Agazzi 57464f3dce AGS: Engine: Complete "object interaction events take obj pointer and mode as params" commit
This completes cb6cce267d75ccdbca452873693a1ccadf0f688b
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 84f7493959 AGS: Engine: support scaling character sprite offsets after char's own zoom
Historically, neither Character.z (vertical offset), nor picture offsets (ones set by Character.LockViewAligned() and Character.LockViewOffset())
 were not scaled along with the character's sprite.
Although it seems like that would be a right thing to do in a majority of practical applications of these properties.

This change introduces a separate zoom factor for these parameters. It's done separately to be able to maintain backwards compatibility.
 In backwards mode this factor is always 100 (%), in the new mode it is always set equal to regular character's zoom (whether got from
  a manual property, or a walkable area scaling).
The switch between modes is controlled by OPT_SCALECHAROFFSETS. This supposed to be always set in the new games. But this is also
 a backup opportunity to disable this behavior, if a user finds it making it impossible to achieve a previously possible effect: in such case
  one may disable this when compiling a game, or call SetGameOption(OPT_SCALECHAROFFSETS, 0) in script.

Code-wise, I had to move get_effective_y() method to CharacterExtras class, which makes more sense, as that's a runtime character class,
 as opposed to CharacterInfo which is a game data serialization class, shared with the Editor.

There's still alot of potential for refactor and tidying the code, but I'd leave that for another task.

From upstream a2b0c88379f37fdaf44155e37f372b7de725db21
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 51cf1f1568 AGS: Engine: tidied code in RunObjectInteraction functions
From upstream c20764239b3a8a234c473feb4f7009afdc3c4c6d
2024-10-30 18:07:42 +02:00
Walter Agazzi dd8c13c1f0 AGS: Engine: replaced global evblock* vars with a local ObjectEvent argument
From upstream 279d3d78ff04423fce137a4907fd42d44ee12969
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 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 69ea55b721 AGS: Engine: fixes to construct_object_gfx()
from upstream fb240801322d30eb957fbb6a9e228928a7345553
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 c4f25a16ed AGS: Engine: ensure that all AnimateCharacter variants lead to the same impl
from upstream eb623b4557c91e353fe6fa1bbcfc109e614ceac2
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 8ddf1c837d AGS: Engine: tidied use of RoomObject::cycling and flags
from upstream 7e3f4118a6aa133e69d2b9bb61faa4b39e98b314
2024-10-30 18:07:42 +02:00
Paul Gilbert c2a476411c AGS: Move std namespace into common/std/ 2024-07-07 15:28:31 -07: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
Eugene Sandulenko 03460f9469 AGS: Fix bitwise operations 2023-04-29 20:28:20 +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
Walter Agazzi 7133cbfcdb AGS: Engine: fixed room objects with ID >= 100 fail to Animate
This is because of legacy AnimateObject behavior, which treated IDs >= 100
as a command to run AnimateCharacter(ID - 100) instead.

From upstream 8365802092cd3f704aecffe7d08b4d9f65f1f396
2023-04-29 13:11:41 +02:00
Walter Agazzi f77da38379 AGS: Engine: fixed view frames have a linked sound 0 by default
from upstream a4a98adfcb039e0f8f213d60e8b0b639b0217f9b
2023-03-12 20:58:28 +00:00
Thierry Crozat 8d36266724 AGS: Replaced strcpy with snprintf in old string API impls
From upstream 44d99badb2708fb99b1f7b9bc024082d570706c7
2022-06-19 20:50:24 +01: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 830c1b096b AGS: introduced ObjTexture struct which combines bmp and ddb
From upstream b628fb4d1b3ca6a85e2b2424a468f4cec94ae9c6
Also includes new implementation of std::vector class to
properly allow for arrays of smart pointers
2022-05-05 22:41:05 -07:00
Paul Gilbert a6f42ad1ab AGS: Fixing various "unused va/arg" warnings + removed empty funcs
From upstream 61771ecd638338806c40d0da2bf1addea06cac90
2022-04-25 21:44:40 -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 fabab1285d AGS: Made Hotspot.Name and Object.Name settable
From upstream 6a7271c4df1765dc86f88d7676337b63fcef17aa
2022-04-10 19:39:08 -07:00
Paul Gilbert 8511f7b36c AGS: Adjusted comment in SetObjectFrame to make it bit more visible
From upstream 6c6a5ff35a29eedbcd8aa1a33ec99de2f3536b09
2022-03-23 20:40:23 -07:00
Paul Gilbert a3dda03cf1 AGS: Store Views in std::vector
From upstream 095db88ae0f1acceb298f793a2e1b81dbe06fcff
2022-03-18 21:29:56 -07:00
Paul Gilbert 255a739eca AGS: Encapsulate game object draw caches in draw.cpp
From upstream e04ebc0039580faf017ceb0acbeeab975bf44fcc
2022-03-14 21:04:09 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +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 47928c39aa AGS: changed Object.SetView default loop & frame values to 0
From upstream eb376e63f95b09fd75ca7f96591aca20d0564072
2021-07-27 22:03:36 -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 2d82d32577 AGS: Move draw.cpp globals to Globals 2021-03-09 21:14:02 -08:00
Paul Gilbert 764271844a AGS: Move global_object globals to Globals 2021-03-08 20:03:22 -08:00
Paul Gilbert dc019af530 AGS: Move character.cpp globals to Globals 2021-03-08 19:04:35 -08:00
Paul Gilbert d12bb69417 AGS: Move event.cpp globals to Globals 2021-03-08 18:29:32 -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
Paul Gilbert ef245e2104 AGS: Move thisroom to Globals 2021-02-28 13:27:21 -08:00
Paul Gilbert 334b2a9d48 AGS: Move play to Globals 2021-02-27 15:31:34 -08:00