Skip to content

Commit

Permalink
1.0.1 導入前のセーブデータをロードするとエラーになる不具合の修正
Browse files Browse the repository at this point in the history
  • Loading branch information
elleonard committed Jun 12, 2024
1 parent 9c98f2b commit a88e0d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/codes/ChangeImageWithPattern/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { createBooleanParam, createCommand, createNumberParam, createSelectParam
import { dedent } from '@qnighy/dedent';

const histories: PluginHistorySchema[] = [
{
date: "2024/06/13",
version: "1.0.1",
description: "導入前のセーブデータをロードするとエラーになる不具合の修正",
},
{
date: "2024/06/07",
version: "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ type ChangeImageWith = {
};

declare interface Game_Character {
_changeImageWith: ChangeImageWith;
_changeImageWith: ChangeImageWith|undefined;
_isPatternFixed: boolean;

setChangeImageWith(changeImageWith: ChangeImageWith): void;
setChangeImageWithDirection(direction: number): void;
setChangeImageWithPattern(pattern: number): void;
setChangeImageWithFixPattern(fixPattern: boolean): void;

changeImageWith(): ChangeImageWith;

isPatternFixed(): boolean;
fixPattern(): void;
unfixPattern(): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,52 @@ function Game_Character_ChangeImageWithPatternMixIn(gameCharacter: Game_Characte
const _initMembers = gameCharacter.initMembers;
gameCharacter.initMembers = function () {
_initMembers.call(this);
this._changeImageWith = {
this._changeImageWith = this.changeImageWith();
this._isPatternFixed = false;
};

gameCharacter.changeImageWith = function () {
return this._changeImageWith || {
direction: 0,
pattern: 1,
fixPattern: false,
};
this._isPatternFixed = false;
};

gameCharacter.setChangeImageWith = function (changeImageWith) {
this.setChangeImageWithDirection(changeImageWith.direction);
this.setChangeImageWithPattern(changeImageWith.pattern);
this.setChangeImageWithFixPattern(changeImageWith.fixPattern);
this._changeImageWith = changeImageWith;
};

gameCharacter.setChangeImageWithDirection = function (direction) {
this._changeImageWith = this.changeImageWith();
this._changeImageWith.direction = direction;
};

gameCharacter.setChangeImageWithPattern = function (pattern) {
this._changeImageWith = this.changeImageWith();
this._changeImageWith.pattern = pattern;
};

gameCharacter.setChangeImageWithFixPattern = function (fixPattern) {
this._changeImageWith = this.changeImageWith();
this._changeImageWith.fixPattern = fixPattern;
};

const _processMoveCommand = gameCharacter.processMoveCommand;
gameCharacter.processMoveCommand = function (command) {
_processMoveCommand.call(this, command);
if (command.code === Game_Character.ROUTE_CHANGE_IMAGE) {
if (this._changeImageWith.direction) {
if (this.changeImageWith().direction) {
/**
* 明示的に指定するため、向き固定を貫通する
*/
const isDirectionFixed = this.isDirectionFixed();
this.setDirectionFix(false);
this.setDirection(this._changeImageWith.direction);
this.setDirection(this.changeImageWith().direction);
this.setDirectionFix(isDirectionFixed);
}
this.setPattern(this._changeImageWith.pattern);
if (this._changeImageWith.fixPattern) {
this.setPattern(this.changeImageWith().pattern);
if (this.changeImageWith().fixPattern) {
this.fixPattern();
}
}
Expand Down

0 comments on commit a88e0d0

Please sign in to comment.