Jump to content

[BG2:ToB] VVC V1.0


Ascension64

Recommended Posts

Here are my findings from my VVC research. It is pretty much complete.

 

Offset Size (data type) Description

0x0000 4 (char array) Signature ('VVC ')

0x0004 4 (char array) Version ('V1.0')

 

0x0008 8 (resref) Animation name

In BG2:ToB, this animation is loaded into both primary (main) and secondary (translucent shadow) CVidCell slots.

 

0x0010 8 (resref) Unused

In BG2:ToB, this animation is unused, because the animation 1 ResRef is loaded into the secondary CVidCell slot (translucent shadow, see dispbit2)

 

0x0018 2 (word) Display flags

Bit 0: Transparent first colour

CVIDIMG_TRANSPARENT

Sets alpha of palette[0] to 0

Mostly unused due to the use of transparency index in BAM files, but can theoretically specify a second transparent colour

 

Bit 1: Use translucency

CVIDIMG_TRANSLUCENT (50% transparency)

Will crash if used with bit3

If not 3d accelerated, this overrides bit2 and bit3

 

Bit 2: Translucent shadow

CVIDCELL_TRANSLUCENT_SHADOW

Draws a shadow animation (no translucency), then draws the primary animation at Z above the shadow animation

If not 3d accelerated, this is overridden by bit1 and bit3

Sets alpha of palette[1] to 80h (50%) for both images

If bit1 is not set, “shadow†image will not be translucent

The Z coordinate is treated separately from the Y coordinate

 

Bit 3: Blend and brighten

CVIDCELL_BRIGHTEST

Will crash if used with bit1

 

No 3d acceleration:

This is overridden by bit1 and overrides bit3

Applies brightness multiplier

Sets all palette colours less than [32.32.32] to transparent (12.5% blend)

For each frame pixel, chooses brightest colour from either FxSurface or BAM palette

m_bDisableBrightest disables all these features

(note: this is somewhat bugged; the 12.5% blend does not work unless both m_bDisableBrightest and bit3 is set together)

This bit is replaced with bit13 if High Level Brighten is not enabled (so long as seqbit7 is not set) – default is enabled

This bit is replaced with bit13 if seqbit8 is set, and both Mid Level Brighten and High Level Brighten are disabled – default is enabled

 

3d acceleration:

glBlendFunc(dest: GL_ONE_MINUS_DST_COLOR, src: GL_ONE)

Applies brightness multiplier

m_bDisableBrightest disables all these features

 

Bit 4: Mirror X axis

Mirrors orientations 9-15 (X axis)

 

Bit 5: Mirror Y axis

Mirrors orientations 5-11 (Y axis)

 

Bit 6: Clip to frame 3d

Automatically added on render

3d acceleration only

Clips FxRender to frame

 

Bit 7: Copy from back surface No3d

CVIDCELL_FXPREP_COPYFROMBACK

Automatically added on render

Non-3d acceleration only

Will crash if used with bit8

Prepares FxSurface by copying from BackSurface

 

Bit 8: Clear fill No3d

CVIDCELL_FXPREP_CLEARFILL

Non-3d acceleration only

Will crash if used with bit7

Prepares FxSurface by clearing and filling with black colour

 

Bit 9: Blend 3d

3d acceleration only

glBlendFunc(dest: GL_DST_COLOR, src: GL_ONE)

Added to GRNDGLOW animation when using DrawLightingEffect()

 

Bit 10: Render on wallgroups

Do not render wallgroups over animation

Somewhat more processor-unfriendly seqbit6

 

Bit 11: Ignore time stop

Ignores time stop effect that would cause conversion of palette to greyscale

 

Bit 12: Ignore dream area

Ignores dream area that would cause conversion of palette to sepia tone

 

Bit 13: Blend No3d

Non-3d acceleration only

Sets all palette colours less than [32.32.32] to transparent (12.5% blend)

This bit replaces bit3 if High Level Brighten is not enabled (so long as seqbit7 is not set) – default is enabled

This bit replaces bit3 if seqbit8 is set, and both Mid Level Brighten and High Level Brighten are disabled – default is enabled

 

Bit 14: unused

Bit 15: unused

 

0x001a 2 (word) Colour flags

The engine treats these flags with the display flags as a dword.

 

Bit 16 (0): Use area lighting

Applies an area lighting mask to the animation

If not set, engine sets dispbit17

 

Bit 17 (1): Use own light mask

Uses own lighting mask

This really is only used for the application of greyscale and sepia effects when area lighting is not in use (greyscale overrides sepia)

Can be used in conjunction with bit16

 

Bit 18 (2): Use own brightness

Never used for a CVefVidCell

 

Bit 19 (3): Time stop colour (force greyscale)

Each RgbColor becomes [(r+g+b)/4.(r+g+b)/4.(r+g+b)/4]

Applies greyscale to own lighting mask; therefore, this does not take effect if bit16 is set and bit17 is not

 

Bit 20 (4): unused

 

Bit 21 (5): Use own gamma

Brightness is increased by color*(x/8), where x = gamma + 8

Since gamma is always set to constant [8.8.8], brightness is always doubled.

This may be a bug. Note that the animation’s gamma is never set in-game

 

Bit 22 (6): No black colour

Forces game to recognise that the second palette colour is not [0.0.0] and therefore is not a special colour. Note that if this is not set, the game will still check that the second palette colour is [0.0.0] when enumerating special colours. Special colours are subject to unique treatment when modifying the palette. For example, lighting masks are not applied. However, the black colour is modified by brightness and gamma adjustments on [0.0.0]

This bit overrides bit23

 

Bit 23 (7): No special colours

Forces game to treat entire palette as normal colours. Normal colours are subject to application of lighting masks, brightness, and gamma adjustments.

 

Bit 24 (8): unused

 

Bit 25 (9): area dream colour (force sepia/red tint)

Each RgbColor becomes [(r+g+b)/4 + 21.(r+g+b)/4.(r+g+b)/4 - 32]

Applies sepia/red tint to own lighting mask; therefore, this does not take effect if bit16 is set and bit17 is not

 

Bit 26 (10): unused

Bit 27 (11): unused

Bit 28 (12): unused

Bit 29 (13): unused

Bit 30 (14): unused

Bit 31 (15): unused

 

0x001c 4 (dword) Unused

0x0020 4 (dword) Sequence flags

Bit 0: Looping

 

Bit 1: Draw lighting effect

Draws GRNDGLOW.BAM frame (x-3)/5, where x is the value of 0x8a

The amount of glow is determined as colours by 127 + glowBrightness – 0.5 * areaLighting

The Z coordinate is treated separately from the Y coordinate

 

Bit 2: Use area height

Y coordinate is influenced by area height map

Not sure if this is useful, since objects use area height map for placement, so the visual effects are created where the objects are anyway

 

Bit 3: Enable (draw animation)

If not set, nothing is drawn

 

Bit 4: Use bitmap palette

Added by engine if a bitmap is set

Game will crash with an invalid CRes pointer if invalid bitmap is set

Sets the animation palette to the palette of the specified bitmap

 

Bit 5: Purge on update

On next AI update, will purge itself and send a CMessage

 

Bit 6: Render on wall groups

Wallgroups are not rendered on this animation

This bit is more processor-friendly than dispbit10

 

Bit 7: Ignore high level brighten No3d

Non-3d acceleration

When set, ignores the high level brighten (including automated) game option

See descriptions of dispbit3 and dispbit13 for more information

 

Bit 8: Use mid and high level brighten No3d

Non-3d acceleration

When set, brighten will be disabled if both MidLevelBrighten and HighLevelBrighten (including automated) are not active

 

Bit 9: unused

Bit 10: unused

Bit 11: unused

Bit 12: unused

Bit 13: unused

Bit 14: unused

Bit 15: unused

 

0x0024 4 (dword) Unused

0x0028 4 (dword) X offset position

X axis displacement from the location of the visual effect

 

0x002c 4 (dword) Y offset position

Y axis displacement from the location of the visual effect

 

Unless dispbit2 or seqbit1 is set, the Z coordinate is not treated separately; it is subtracted from the Y coordinate when determining position.

 

0x0030 4 (dword) Use orientation

Boolean. Determines whether the XY coordinates are relative to orientation. Orientation is relative to the parent object.

 

0: No

The XY coordinates specify a position within a normal Cartesian plane.

 

A 2D positioning system is used

+x is to the right and -x to the left

+y is downwards and -y upwards

+z is upwards and -z downwards

 

1: Yes

The XY coordinates specify a position within a rotated axis based on the current orientation. Each value of the orientation specifies a 22.5° clockwise rotation of the axes (note that in mathematics, rotation of axes occurs counter-clockwise; but here, the positive Y-axis is pointing down rather than up. Also, a creature faces in the direction of the Y-axis). The engine will calculate the corresponding XY coordinates of the same point if the axes were not rotated.

 

For example, let's say point [xRotated.yRotated] is at coordinates (10,10) in 45°-rotated axes. That same point will be at coordinates (0,14.14) in unrotated axes.

 

Mathematically, the calculations are the same as for any rotation of axes.

xUnrotated = xRotated cos(angle) - yRotated sin(angle)

yUnrotated = xRotated sin(angle) + yRotated cos(angle)

where angle = orientation * 22.5°

 

0x0034 4 (dword) Frame rate (1-29)

How quickly should the frame update (in nAiUpdates)

Range 1-29, else division by 0 occurs.

From 1-15, update occurs every 30/n updates

From 16-29, update occurs every other 30/n update

 

0x0038 4 (dword) Number of orientations

The number of orientations of the animations present in the animation files. Values are 0, 1, 8, and 16. 0 is treated as 1.

Dispbit4 and dispbit5 each halves the number of orientations and adds one to indicate the mirroring of animations.

For example, if number of orientations is 16, the animation should have 16 cycles, one for each orientation. If the same animation should be mirrored about the X axis, it should have 9 cycles (16 / 2 + 1).

 

0x003c 4 (dword) Base Orientation

Starting orientation to use.

Modified whenever a new orientation is calculated (i.e. post-drawing of animation)

 

0x0040 4 (dword) Orientation flags

Determines how orientation is calculated.

 

No bits: Relative to previous

Current position relative to previous position of this object (if moving)

If no change in position, default orientation is used

 

Bit 0: Orbit (relative to origin)

Current position relative to source position

If no change in position, default orientation is used

This initiates an orbit if displaced in two axes, or alternating sides if displacement in a single axis. This orientation will change every AI update.

 

Bit 1: Use parent

Uses the orientation of the parent creature

Actually uses the blurred creature copy orientation

 

Bit 2: unused

 

Bit 3: Ignore orientation

Does not update the orientation, as if orient with parent is not set

 

0x0044 8 (resref) Bitmap palette

Bitmap of which the palette will replace the animation palette

Engine will set seqbit4 is an entry is present

Game will crash with an invalid CRes pointer if invalid bitmap is set

 

0x004c 4 (dword) Z offset position

Z axis displacement from the location of the visual effect. Positive displaces in the upwards direction, negative downward. Direction of displacement is unaffected by orientation.

 

Unless dispbit2 or seqbit1 is set, the Z coordinate is not treated separately; it is subtracted from the Y coordinate when determining position.

 

0x0050 4 (dword) Lighting effect radius/Centre X position

If seqbit1 is set, this values determines the frame of GRNDGLOW.BAM to use. This is calculated as “frame = (this - 3)/5â€. Each frame has a larger circular radius.

 

See below for use of centre positions.

 

0x0054 4 (dword) Centre Y position

Defines an arbitrary centre point of the drawing area. This is compared to the current animation frame’s centre point. The engine uses the largest X and Y points and calculates the according drawing rectangle based on this. Usage requires seqbit1 to be set.

 

0x0058 4 (dword) Lighting effect brightness

Treated as unsigned byte. Sets the brightness of the lighting effect. The brightness is calculated by colour as 127 + glowBrightness – 0.5 * areaLighting. If seqbit1 is not set, areaLighting is treated as 255.

 

0x005c 4 (dword) Duration (frames)

Number of frames to run the animation for.

 

0x0060 8 (resref) Name (for internal use)

The engine loads the resref name of this resource. Used to purge self

 

0x0068 4 (dword) Primary animation sequence

This is the primary animation sequence (cycle) that starts the animation. If this is a looping animation, and the secondary animation sequence is not set, this animation sequence will be looped.

 

0x006c 4 (dword) Secondary animation sequence

This is the animation sequence (cycle) played when primary animation sequence is completed, unless continuous sequences is set. 0 means not set.

 

0x0070 4 (dword) Current animation sequence

The current animation sequence (cycle) to play. Note that the first cycle is 1. If 0, then it is set to the primary animation sequence.

 

0x0074 4 (dword) Continuous sequences

Boolean. If set, when the current animation sequence (cycle) is completed, starts playing the next animation sequence within the same file. Used internally for the debug function DisplayAllBAMFiles() and set via VEF files.

 

0x0078 8 (resref) Primary sound

This is the first sound played. If no secondary sound is not set, this is the looping sound.

 

0x0080 8 (resref) Secondary sound

This sound is played immediately after the primary sound if present, and is looped.

 

0x0088 8 (resref) Alpha blending animation

3d acceleration only.

This is the tertiary animation to play for the Visual Effect.

The frame data (pixels) are treated not as a reference to the palette, but as an alpha value. The alpha value is multiplied by the current alpha value of the screen to determine the final alpha value to render.

In BG2:ToB, this animation is loaded into the tertiary CVidCell slot. Due to an erroneously placed assertion, setting this will crash the game.

 

0x0090 4 (dword) Tertiary animation sequence

For a non-looping visual effect (seqbit0 not set), this is the animation sequence (cycle) to play then when the secondary animation sequence is completed, unless continuous sequences is set. 0 means not set.

 

0x0094 8 (resref) Tertiary sound

This is the sound played when the tertiary animation sequence is played. See the tertiary animation sequence for more information.

 

0x009c 336 (bytes) Unused

Not loaded from file.

Link to comment

I put the kids in the bullshit sweatshop to work, and this is what they came back with:

  private static final String s_transparency[] =
{"No flags set", "Transparent", "Translucent", "Translucent shadow", "Blended",
"Mirror X axis", "Mirror Y axis", "Clipped", "Copy from back", "Clear fill",
"3D blend", "Not covered by wall", "Persist through time stop", "Ignore dream palette",
"2D blend"};
 private static final String s_tint[] =
{"No flags set", "Not light source", "Light source", "Internal brightness", "Time stopped", "",
"Internal gamma", "Non-reserved palette", "Full palette", "", "Dream palette"};
 private static final String s_seq[] =
{"No flags set", "Looping", "Special lighting", "Modify for height", "Draw animation", "Custom palette",
"Purgeable", "Not covered by wall", "Mid-level brighten", "High-level brighten"};
 private static final String s_face[] =
{"Use current", "Orbit parent", "Parent orientation", "", "Ignore orientation"};

Not necessarily helpful to the modder in most cases, but I think it fits the normal Flag() label style we have (as well sticking with "covered by wall" and "light source" nonsense we get from our ARE list).

 

Everything else fits, but I left out the self-name and the alpha mask for now. And I decided against bothering with explicit VEF editor. You'll all have to use DLTCEP if you want it.

Link to comment
0x0090 4 (dword) Tertiary animation sequence

For a non-looping visual effect (seqbit0 not set), this is the animation sequence (cycle) to play then when the secondary animation sequence is completed, unless continuous sequences is set. 0 means not set.

 

0x90 not working when seqbit0 is set is a bug; the developers intended this to be the completion animation. Take a look at "SPGLBBLD.vvc", where 0x90 is set to 3.

 

-Galactygon

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...