Skip to content

Commit

Permalink
Show Chara Fade In in script if the it's a new speaker
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Jan 27, 2024
1 parent c6868d8 commit 1d772ac
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions packages/db/src/Component/ScriptTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ const ScriptTable = (props: {
figureComponent: ScriptCharaFace | ScriptCharaFaceFade | undefined,
charaFadeIn: ScriptCharaMovement | undefined,
wideScreen = false,
sceneSpeakerCode: string | undefined = undefined,
sceneDisplayed = false,
offsets: ScriptOffsets | undefined,
cameraFilter: CameraFilterType = "normal",
Expand Down Expand Up @@ -755,22 +756,25 @@ const ScriptTable = (props: {
const { content, lineNumber } = component;

let sceneRow,
renderScene = () => (
<SceneRow
region={props.region}
filters={filters}
foreground={foreground}
cameraFilter={cameraFilter}
offsets={offsets}
background={backgroundComponent}
figure={figureComponent}
charaFadeIn={charaFadeIn}
wideScreen={wideScreen}
lineNumber={lineNumber}
effects={[...effects]}
colSpan={colSpan}
/>
);
renderScene = () => {
sceneSpeakerCode = undefined;
return (
<SceneRow
region={props.region}
filters={filters}
foreground={foreground}
cameraFilter={cameraFilter}
offsets={offsets}
background={backgroundComponent}
figure={figureComponent}
charaFadeIn={charaFadeIn}
wideScreen={wideScreen}
lineNumber={lineNumber}
effects={[...effects]}
colSpan={colSpan}
/>
);
};

switch (content.type) {
case ScriptComponentType.ENABLE_FULL_SCREEN:
Expand All @@ -790,6 +794,7 @@ const ScriptTable = (props: {
if (figureComponent && !sceneDisplayed) sceneRow = renderScene();

figureComponent = content;
sceneSpeakerCode = content.speakerCode;
sceneDisplayed = false;
break;

Expand All @@ -798,6 +803,7 @@ const ScriptTable = (props: {
if (figureComponent && !sceneDisplayed) sceneRow = renderScene();

figureComponent = content;
sceneSpeakerCode = content.speakerCode;
sceneDisplayed = false;
break;

Expand All @@ -812,6 +818,17 @@ const ScriptTable = (props: {
charaFadeIn = undefined;
}

if (assetSet && content.speakerCode !== sceneSpeakerCode) {
figureComponent = {
type: ScriptComponentType.CHARA_FACE,
speakerCode: content.speakerCode,
face: 1,
assetSet,
};
sceneRow = renderScene();
figureComponent = undefined;
}

if (content.position && (content.position.y !== 0 || offsets?.y !== content.position.y)) {
switch (assetSet?.type) {
case ScriptComponentType.CHARA_SET:
Expand Down

0 comments on commit 1d772ac

Please sign in to comment.