mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 03:39:00 +00:00
Reduced externalization cost.
This commit is contained in:
parent
4e0928cb1b
commit
c6b98855af
@ -83,17 +83,17 @@ cc.Class({
|
|||||||
updateCharacterAnim(rdfPlayer, prevRdfPlayer, forceAnimSwitch, chConfig) {
|
updateCharacterAnim(rdfPlayer, prevRdfPlayer, forceAnimSwitch, chConfig) {
|
||||||
// As this function might be called after many frames of a rollback, it's possible that the playing animation was predicted, different from "prevRdfPlayer.CharacterState" but same as "newCharacterState". More granular checks are needed to determine whether we should interrupt the playing animation.
|
// As this function might be called after many frames of a rollback, it's possible that the playing animation was predicted, different from "prevRdfPlayer.CharacterState" but same as "newCharacterState". More granular checks are needed to determine whether we should interrupt the playing animation.
|
||||||
|
|
||||||
let newCharacterState = rdfPlayer.CharacterState;
|
let newCharacterState = rdfPlayer.GetCharacterState();
|
||||||
|
|
||||||
// Update directions
|
// Update directions
|
||||||
if (this.animComp && this.animComp.node) {
|
if (this.animComp && this.animComp.node) {
|
||||||
if (0 > rdfPlayer.DirX) {
|
if (0 > rdfPlayer.GetDirX()) {
|
||||||
this.animNode.scaleX = (-1.0);
|
this.animNode.scaleX = (-1.0);
|
||||||
} else if (0 < rdfPlayer.DirX) {
|
} else if (0 < rdfPlayer.GetDirX()) {
|
||||||
this.animNode.scaleX = (+1.0);
|
this.animNode.scaleX = (+1.0);
|
||||||
}
|
}
|
||||||
if (ATK_CHARACTER_STATE.OnWall[0] == newCharacterState || ATK_CHARACTER_STATE.TurnAround1[0] == newCharacterState) {
|
if (ATK_CHARACTER_STATE.OnWall[0] == newCharacterState || ATK_CHARACTER_STATE.TurnAround1[0] == newCharacterState) {
|
||||||
if (0 < rdfPlayer.OnWallNormX) {
|
if (0 < rdfPlayer.GetOnWallNormX()) {
|
||||||
this.animNode.scaleX = (-1.0);
|
this.animNode.scaleX = (-1.0);
|
||||||
} else {
|
} else {
|
||||||
this.animNode.scaleX = (+1.0);
|
this.animNode.scaleX = (+1.0);
|
||||||
@ -147,7 +147,7 @@ cc.Class({
|
|||||||
}
|
}
|
||||||
// The "playTimes" counterpart is managed by each "cc.AnimationClip.wrapMode", already preset in the editor.
|
// The "playTimes" counterpart is managed by each "cc.AnimationClip.wrapMode", already preset in the editor.
|
||||||
const targetClip = this.animComp.getClips()[newCharacterState]; // The clips follow the exact order in ATK_CHARACTER_STATE
|
const targetClip = this.animComp.getClips()[newCharacterState]; // The clips follow the exact order in ATK_CHARACTER_STATE
|
||||||
let frameIdxInAnim = rdfPlayer.FramesInChState;
|
let frameIdxInAnim = rdfPlayer.GetFramesInChState();
|
||||||
if (window.ATK_CHARACTER_STATE.InAirIdle1ByJump == newCharacterState && null != chConfig) {
|
if (window.ATK_CHARACTER_STATE.InAirIdle1ByJump == newCharacterState && null != chConfig) {
|
||||||
frameIdxInAnim = chConfig.InAirIdleFrameIdxTurningPoint + (frameIdxInAnim - chConfig.InAirIdleFrameIdxTurningPoint) % chConfig.InAirIdleFrameIdxTurnedCycle; // TODO: Anyway to avoid using division here?
|
frameIdxInAnim = chConfig.InAirIdleFrameIdxTurningPoint + (frameIdxInAnim - chConfig.InAirIdleFrameIdxTurningPoint) % chConfig.InAirIdleFrameIdxTurnedCycle; // TODO: Anyway to avoid using division here?
|
||||||
}
|
}
|
||||||
|
@ -158,9 +158,9 @@ cc.Class({
|
|||||||
currSelfInput = null;
|
currSelfInput = null;
|
||||||
const joinIndex = self.selfPlayerInfo.joinIndex;
|
const joinIndex = self.selfPlayerInfo.joinIndex;
|
||||||
const selfJoinIndexMask = (1 << (joinIndex - 1));
|
const selfJoinIndexMask = (1 << (joinIndex - 1));
|
||||||
const existingInputFrame = self.recentInputCache.GetByFrameId(inputFrameId);
|
const existingInputFrame = gopkgs.GetInputFrameDownsync(self.recentInputCache, inputFrameId);
|
||||||
const previousInputFrameDownsync = self.recentInputCache.GetByFrameId(inputFrameId - 1);
|
const previousInputFrameDownsync = gopkgs.GetInputFrameDownsync(self.recentInputCache, (inputFrameId - 1));
|
||||||
previousSelfInput = (null == previousInputFrameDownsync ? null : previousInputFrameDownsync.InputList[joinIndex - 1]);
|
previousSelfInput = (null == previousInputFrameDownsync ? null : gopkgs.GetInput(previousInputFrameDownsync, joinIndex - 1));
|
||||||
if (
|
if (
|
||||||
null != existingInputFrame
|
null != existingInputFrame
|
||||||
&&
|
&&
|
||||||
@ -168,7 +168,7 @@ cc.Class({
|
|||||||
) {
|
) {
|
||||||
// This could happen upon either [type#1] or [type#2] forceConfirmation, where "refRenderFrame" is accompanied by some "inputFrameDownsyncs". The check here also guarantees that we don't override history
|
// This could happen upon either [type#1] or [type#2] forceConfirmation, where "refRenderFrame" is accompanied by some "inputFrameDownsyncs". The check here also guarantees that we don't override history
|
||||||
//console.log(`noDelayInputFrameId=${inputFrameId} already exists in recentInputCache: recentInputCache=${self._stringifyRecentInputCache(false)}`);
|
//console.log(`noDelayInputFrameId=${inputFrameId} already exists in recentInputCache: recentInputCache=${self._stringifyRecentInputCache(false)}`);
|
||||||
return [previousSelfInput, existingInputFrame.InputList[joinIndex - 1]];
|
return [previousSelfInput, gopkgs.GetInput(existingInputFrame, joinIndex - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
const prefabbedInputList = new Array(self.playerRichInfoDict.size).fill(0);
|
const prefabbedInputList = new Array(self.playerRichInfoDict.size).fill(0);
|
||||||
@ -176,14 +176,14 @@ cc.Class({
|
|||||||
for (let k = 0; k < window.boundRoomCapacity; ++k) {
|
for (let k = 0; k < window.boundRoomCapacity; ++k) {
|
||||||
if (null != existingInputFrame) {
|
if (null != existingInputFrame) {
|
||||||
// When "null != existingInputFrame", it implies that "true == canConfirmSelf" here, we just have to assign "prefabbedInputList[(joinIndex-1)]" specifically and copy all others
|
// When "null != existingInputFrame", it implies that "true == canConfirmSelf" here, we just have to assign "prefabbedInputList[(joinIndex-1)]" specifically and copy all others
|
||||||
prefabbedInputList[k] = existingInputFrame.InputList[k];
|
prefabbedInputList[k] = gopkgs.GetInput(existingInputFrame, k);
|
||||||
} else if (self.lastIndividuallyConfirmedInputFrameId[k] <= inputFrameId) {
|
} else if (self.lastIndividuallyConfirmedInputFrameId[k] <= inputFrameId) {
|
||||||
prefabbedInputList[k] = self.lastIndividuallyConfirmedInputList[k];
|
prefabbedInputList[k] = self.lastIndividuallyConfirmedInputList[k];
|
||||||
// Don't predict "btnA & btnB"!
|
// Don't predict "btnA & btnB"!
|
||||||
prefabbedInputList[k] = (prefabbedInputList[k] & 15);
|
prefabbedInputList[k] = (prefabbedInputList[k] & 15);
|
||||||
} else if (null != previousInputFrameDownsync) {
|
} else if (null != previousInputFrameDownsync) {
|
||||||
// When "self.lastIndividuallyConfirmedInputFrameId[k] > inputFrameId", don't use it to predict a historical input!
|
// When "self.lastIndividuallyConfirmedInputFrameId[k] > inputFrameId", don't use it to predict a historical input!
|
||||||
prefabbedInputList[k] = previousInputFrameDownsync.InputList[k];
|
prefabbedInputList[k] = gopkgs.GetInput(previousInputFrameDownsync, k);
|
||||||
// Don't predict "btnA & btnB"!
|
// Don't predict "btnA & btnB"!
|
||||||
prefabbedInputList[k] = (prefabbedInputList[k] & 15);
|
prefabbedInputList[k] = (prefabbedInputList[k] & 15);
|
||||||
}
|
}
|
||||||
@ -191,14 +191,14 @@ cc.Class({
|
|||||||
let initConfirmedList = 0;
|
let initConfirmedList = 0;
|
||||||
if (null != existingInputFrame) {
|
if (null != existingInputFrame) {
|
||||||
// When "null != existingInputFrame", it implies that "true == canConfirmSelf" here
|
// When "null != existingInputFrame", it implies that "true == canConfirmSelf" here
|
||||||
initConfirmedList = (existingInputFrame.ConfirmedList | selfJoinIndexMask);
|
initConfirmedList = (existingInputFrame.GetConfirmedList() | selfJoinIndexMask);
|
||||||
}
|
}
|
||||||
currSelfInput = self.ctrl.getEncodedInput(); // When "null == existingInputFrame", it'd be safe to say that the realtime "self.ctrl.getEncodedInput()" is for the requested "inputFrameId"
|
currSelfInput = self.ctrl.getEncodedInput(); // When "null == existingInputFrame", it'd be safe to say that the realtime "self.ctrl.getEncodedInput()" is for the requested "inputFrameId"
|
||||||
prefabbedInputList[(joinIndex - 1)] = currSelfInput;
|
prefabbedInputList[(joinIndex - 1)] = currSelfInput;
|
||||||
while (self.recentInputCache.GetEdFrameId() <= inputFrameId) {
|
while (self.recentInputCache.GetEdFrameId() <= inputFrameId) {
|
||||||
// Fill the gap
|
// Fill the gap
|
||||||
// [WARNING] Do not blindly use "selfJoinIndexMask" here, as the "actuallyUsedInput for self" couldn't be confirmed while prefabbing, otherwise we'd have confirmed a wrong self input by "_markConfirmationIfApplicable()"!
|
// [WARNING] Do not blindly use "selfJoinIndexMask" here, as the "actuallyUsedInput for self" couldn't be confirmed while prefabbing, otherwise we'd have confirmed a wrong self input by "_markConfirmationIfApplicable()"!
|
||||||
const prefabbedInputFrameDownsync = gopkgs.NewInputFrameDownsync(self.recentInputCache.GetEdFrameId(), prefabbedInputList.slice(), initConfirmedList);
|
const prefabbedInputFrameDownsync = gopkgs.NewInputFrameDownsync(self.recentInputCache.GetEdFrameId(), prefabbedInputList, initConfirmedList);
|
||||||
// console.log(`Prefabbed inputFrameId=${prefabbedInputFrameDownsync.GetInputFrameId()}`);
|
// console.log(`Prefabbed inputFrameId=${prefabbedInputFrameDownsync.GetInputFrameId()}`);
|
||||||
self.recentInputCache.Put(prefabbedInputFrameDownsync);
|
self.recentInputCache.Put(prefabbedInputFrameDownsync);
|
||||||
}
|
}
|
||||||
@ -720,8 +720,7 @@ cc.Class({
|
|||||||
console.error(`pbRdf.speciesIdList is required for starting or resyncing battle!`);
|
console.error(`pbRdf.speciesIdList is required for starting or resyncing battle!`);
|
||||||
}
|
}
|
||||||
self.chConfigsOrderedByJoinIndex = gopkgs.GetCharacterConfigsOrderedByJoinIndex(pbRdf.speciesIdList);
|
self.chConfigsOrderedByJoinIndex = gopkgs.GetCharacterConfigsOrderedByJoinIndex(pbRdf.speciesIdList);
|
||||||
const playersArr = rdf.GetPlayersArr();
|
self._initPlayerRichInfoDict(rdf);
|
||||||
self._initPlayerRichInfoDict(playersArr);
|
|
||||||
|
|
||||||
if (shouldForceDumping1 || shouldForceDumping2 || shouldForceResync) {
|
if (shouldForceDumping1 || shouldForceDumping2 || shouldForceResync) {
|
||||||
// In fact, not having "window.RING_BUFF_CONSECUTIVE_SET == dumpRenderCacheRet" should already imply that "self.renderFrameId <= rdfId", but here we double check and log the anomaly
|
// In fact, not having "window.RING_BUFF_CONSECUTIVE_SET == dumpRenderCacheRet" should already imply that "self.renderFrameId <= rdfId", but here we double check and log the anomaly
|
||||||
@ -1285,18 +1284,16 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
|
|
||||||
applyRoomDownsyncFrameDynamics(rdf, prevRdf) {
|
applyRoomDownsyncFrameDynamics(rdf, prevRdf) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const playersArr = rdf.PlayersArr;
|
for (let k = 0; k < window.boundRoomCapacity; k++) {
|
||||||
const prevPlayersArr = (null == prevRdf ? null : prevRdf.PlayersArr);
|
const currPlayerDownsync = gopkgs.GetPlayer(rdf, k);
|
||||||
for (let k in playersArr) {
|
const prevRdfPlayer = (null == prevRdf ? null : gopkgs.GetPlayer(prevRdf, k));
|
||||||
const currPlayerDownsync = playersArr[k];
|
|
||||||
const chConfig = self.chConfigsOrderedByJoinIndex[k];
|
const chConfig = self.chConfigsOrderedByJoinIndex[k];
|
||||||
const prevRdfPlayer = (null == prevPlayersArr ? null : prevPlayersArr[k]);
|
const [wx, wy] = gopkgs.VirtualGridToWorldPos(currPlayerDownsync.GetVirtualGridX(), currPlayerDownsync.GetVirtualGridY());
|
||||||
const [wx, wy] = gopkgs.VirtualGridToWorldPos(currPlayerDownsync.VirtualGridX, currPlayerDownsync.VirtualGridY);
|
|
||||||
const playerRichInfo = self.playerRichInfoArr[k];
|
const playerRichInfo = self.playerRichInfoArr[k];
|
||||||
playerRichInfo.node.setPosition(wx, wy);
|
playerRichInfo.node.setPosition(wx, wy);
|
||||||
playerRichInfo.scriptIns.updateSpeed(currPlayerDownsync.Speed);
|
playerRichInfo.scriptIns.updateSpeed(currPlayerDownsync.GetSpeed());
|
||||||
playerRichInfo.scriptIns.updateCharacterAnim(currPlayerDownsync, prevRdfPlayer, false, chConfig);
|
playerRichInfo.scriptIns.updateCharacterAnim(currPlayerDownsync, prevRdfPlayer, false, chConfig);
|
||||||
playerRichInfo.scriptIns.hpBar.progress = (currPlayerDownsync.Hp * 1.0) / currPlayerDownsync.MaxHp;
|
playerRichInfo.scriptIns.hpBar.progress = (currPlayerDownsync.GetHp() * 1.0) / currPlayerDownsync.GetMaxHp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move all to infinitely far away first
|
// Move all to infinitely far away first
|
||||||
@ -1305,21 +1302,23 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
const fireball = pqNode.value;
|
const fireball = pqNode.value;
|
||||||
fireball.node.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE));
|
fireball.node.setPosition(cc.v2(Number.MAX_VALUE, Number.MAX_VALUE));
|
||||||
}
|
}
|
||||||
const meleeBullets = rdf.MeleeBullets;
|
for (let k = 0;; k++) {
|
||||||
for (let k in meleeBullets) {
|
const meleeBullet = gopkgs.GetMeleeBullet(rdf, k);
|
||||||
const meleeBullet = meleeBullets[k];
|
if (null == meleeBullet) {
|
||||||
const isExploding = (window.BULLET_STATE.Exploding == meleeBullet.BlState && meleeBullet.FramesInBlState < meleeBullet.Bullet.ExplosionFrames);
|
break;
|
||||||
|
}
|
||||||
|
const isExploding = (window.BULLET_STATE.Exploding == meleeBullet.GetBlState() && meleeBullet.GetFramesInBlState() < meleeBullet.GetExplosionFrames());
|
||||||
if (isExploding) {
|
if (isExploding) {
|
||||||
let pqNode = self.cachedFireballs.popAny(meleeBullet.BattleAttr.BulletLocalId);
|
let pqNode = self.cachedFireballs.popAny(meleeBullet.GetBulletLocalId());
|
||||||
let speciesName = `MeleeExplosion`;
|
let speciesName = `MeleeExplosion`;
|
||||||
let animName = `MeleeExplosion${meleeBullet.Bullet.SpeciesId}`;
|
let animName = `MeleeExplosion${meleeBullet.GetSpeciesId()}`;
|
||||||
|
|
||||||
const offender = playersArr[meleeBullet.BattleAttr.OffenderJoinIndex - 1];
|
const offender = gopkgs.GetPlayer(rdf, meleeBullet.GetOffenderJoinIndex() - 1);
|
||||||
let xfac = 1; // By now, straight Punch offset doesn't respect "y-axis"
|
let xfac = 1; // By now, straight Punch offset doesn't respect "y-axis"
|
||||||
if (0 > offender.DirX) {
|
if (0 > offender.GetDirX()) {
|
||||||
xfac = -1;
|
xfac = -1;
|
||||||
}
|
}
|
||||||
const [wx, wy] = gopkgs.VirtualGridToWorldPos(offender.VirtualGridX + xfac * meleeBullet.Bullet.HitboxOffsetX, offender.VirtualGridY);
|
const [wx, wy] = gopkgs.VirtualGridToWorldPos(offender.GetVirtualGridX() + xfac * meleeBullet.GetHitboxOffsetX(), offender.GetVirtualGridY());
|
||||||
|
|
||||||
if (null == pqNode) {
|
if (null == pqNode) {
|
||||||
pqNode = self.cachedFireballs.pop();
|
pqNode = self.cachedFireballs.pop();
|
||||||
@ -1329,27 +1328,29 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
}
|
}
|
||||||
const cachedFireball = pqNode.value;
|
const cachedFireball = pqNode.value;
|
||||||
cachedFireball.setSpecies(speciesName, meleeBullet, rdf);
|
cachedFireball.setSpecies(speciesName, meleeBullet, rdf);
|
||||||
const newAnimIdx = meleeBullet.Bullet.SpeciesId - 1;
|
const newAnimIdx = meleeBullet.GetSpeciesId() - 1;
|
||||||
cachedFireball.updateAnim(animName, meleeBullet.FramesInBlState, offender.DirX, false, rdf, newAnimIdx);
|
cachedFireball.updateAnim(animName, meleeBullet.GetFramesInBlState(), offender.GetDirX(), false, rdf, newAnimIdx);
|
||||||
cachedFireball.lastUsed = self.renderFrameId;
|
cachedFireball.lastUsed = self.renderFrameId;
|
||||||
cachedFireball.bulletLocalId = meleeBullet.BattleAttr.BulletLocalId;
|
cachedFireball.bulletLocalId = meleeBullet.GetBulletLocalId();
|
||||||
cachedFireball.node.setPosition(cc.v2(wx, wy));
|
cachedFireball.node.setPosition(cc.v2(wx, wy));
|
||||||
|
|
||||||
self.cachedFireballs.push(cachedFireball.lastUsed, cachedFireball, meleeBullet.BattleAttr.BulletLocalId);
|
self.cachedFireballs.push(cachedFireball.lastUsed, cachedFireball, meleeBullet.GetBulletLocalId());
|
||||||
} else {
|
} else {
|
||||||
//console.log(`@rdf.Id=${rdf.Id}, origRdfId=${meleeBullet.BattleAttr.OriginatedRenderFrameId}, startupFrames=${meleeBullet.Bullet.StartupFrames}, activeFrames=${meleeBullet.Bullet.ActiveFrames}, not rendering melee node for bulletLocalId=${meleeBullet.BattleAttr.BulletLocalId}`);
|
//console.log(`@rdf.Id=${rdf.Id}, origRdfId=${meleeBullet.BattleAttr.OriginatedRenderFrameId}, startupFrames=${meleeBullet.Bullet.StartupFrames}, activeFrames=${meleeBullet.Bullet.ActiveFrames}, not rendering melee node for bulletLocalId=${meleeBullet.BattleAttr.BulletLocalId}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const fireballBullets = rdf.FireballBullets;
|
for (let k = 0;; k++) {
|
||||||
for (let k in fireballBullets) {
|
const fireballBullet = gopkgs.GetFireballBullet(rdf, k);
|
||||||
const fireballBullet = fireballBullets[k];
|
if (null == fireballBullet) {
|
||||||
const isExploding = (window.BULLET_STATE.Exploding == fireballBullet.BlState);
|
break;
|
||||||
if (gopkgs.IsGeneralBulletActive(fireballBullet.BlState, fireballBullet.BattleAttr.OriginatedRenderFrameId, fireballBullet.Bullet.StartupFrames, fireballBullet.Bullet.ActiveFrames, rdf.Id) || isExploding) {
|
}
|
||||||
let pqNode = self.cachedFireballs.popAny(fireballBullet.BattleAttr.BulletLocalId);
|
const isExploding = (window.BULLET_STATE.Exploding == fireballBullet.GetBlState());
|
||||||
let speciesName = `Fireball${fireballBullet.Bullet.SpeciesId}`;
|
if (gopkgs.IsGeneralBulletActive(fireballBullet.GetBlState(), fireballBullet.GetOriginatedRenderFrameId(), fireballBullet.GetStartupFrames(), fireballBullet.GetActiveFrames(), rdf.GetId()) || isExploding) {
|
||||||
let animName = (BULLET_STATE.Exploding == fireballBullet.BlState ? `Fireball${fireballBullet.Bullet.SpeciesId}Explosion` : speciesName);
|
let pqNode = self.cachedFireballs.popAny(fireballBullet.GetBulletLocalId());
|
||||||
|
let speciesName = `Fireball${fireballBullet.GetSpeciesId()}`;
|
||||||
|
let animName = (isExploding ? `Fireball${fireballBullet.GetSpeciesId()}Explosion` : speciesName);
|
||||||
|
|
||||||
const [wx, wy] = gopkgs.VirtualGridToWorldPos(fireballBullet.VirtualGridX, fireballBullet.VirtualGridY);
|
const [wx, wy] = gopkgs.VirtualGridToWorldPos(fireballBullet.GetVirtualGridX(), fireballBullet.GetVirtualGridY());
|
||||||
|
|
||||||
if (null == pqNode) {
|
if (null == pqNode) {
|
||||||
pqNode = self.cachedFireballs.pop();
|
pqNode = self.cachedFireballs.pop();
|
||||||
@ -1361,12 +1362,12 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
cachedFireball.setSpecies(speciesName, fireballBullet, rdf);
|
cachedFireball.setSpecies(speciesName, fireballBullet, rdf);
|
||||||
const spontaneousLooping = !isExploding;
|
const spontaneousLooping = !isExploding;
|
||||||
const newAnimIdx = (spontaneousLooping ? 0 : 1);
|
const newAnimIdx = (spontaneousLooping ? 0 : 1);
|
||||||
cachedFireball.updateAnim(animName, fireballBullet.FramesInBlState, fireballBullet.DirX, spontaneousLooping, rdf, newAnimIdx);
|
cachedFireball.updateAnim(animName, fireballBullet.GetFramesInBlState(), fireballBullet.GetDirX(), spontaneousLooping, rdf, newAnimIdx);
|
||||||
cachedFireball.lastUsed = self.renderFrameId;
|
cachedFireball.lastUsed = self.renderFrameId;
|
||||||
cachedFireball.bulletLocalId = fireballBullet.BattleAttr.BulletLocalId;
|
cachedFireball.bulletLocalId = fireballBullet.GetBulletLocalId();
|
||||||
cachedFireball.node.setPosition(cc.v2(wx, wy));
|
cachedFireball.node.setPosition(cc.v2(wx, wy));
|
||||||
|
|
||||||
self.cachedFireballs.push(cachedFireball.lastUsed, cachedFireball, fireballBullet.BattleAttr.BulletLocalId);
|
self.cachedFireballs.push(cachedFireball.lastUsed, cachedFireball, fireballBullet.GetBulletLocalId());
|
||||||
} else {
|
} else {
|
||||||
//console.log(`@rdf.Id=${rdf.Id}, origRdfId=${fireballBullet.BattleAttr.OriginatedRenderFrameId}, startupFrames=${fireballBullet.Bullet.StartupFrames}, activeFrames=${fireballBullet.Bullet.ActiveFrames}, not rendering fireball node for bulletLocalId=${fireballBullet.BattleAttr.BulletLocalId}`);
|
//console.log(`@rdf.Id=${rdf.Id}, origRdfId=${fireballBullet.BattleAttr.OriginatedRenderFrameId}, startupFrames=${fireballBullet.Bullet.StartupFrames}, activeFrames=${fireballBullet.Bullet.ActiveFrames}, not rendering fireball node for bulletLocalId=${fireballBullet.BattleAttr.BulletLocalId}`);
|
||||||
}
|
}
|
||||||
@ -1384,15 +1385,15 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
let prevLatestRdf = null,
|
let prevLatestRdf = null,
|
||||||
latestRdf = null;
|
latestRdf = null;
|
||||||
for (let i = renderFrameIdSt; i < renderFrameIdEd; i++) {
|
for (let i = renderFrameIdSt; i < renderFrameIdEd; i++) {
|
||||||
const currRdf = self.recentRenderCache.GetByFrameId(i); // typed "RoomDownsyncFrame"; [WARNING] When "true == isChasing" and using Firefox, this function could be interruptted by "onRoomDownsyncFrame(rdf)" asynchronously anytime, making this line return "null"!
|
const currRdf = gopkgs.GetRoomDownsyncFrame(self.recentRenderCache, i); // typed "RoomDownsyncFrame"; [WARNING] When "true == isChasing" and using Firefox, this function could be interruptted by "onRoomDownsyncFrame(rdf)" asynchronously anytime, making this line return "null"!
|
||||||
if (null == currRdf) {
|
if (null == currRdf) {
|
||||||
throw `Couldn't find renderFrame for i=${i} to rollback (are you using Firefox?), self.renderFrameId=${self.renderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, might've been interruptted by onRoomDownsyncFrame`;
|
throw `Couldn't find renderFrame for i=${i} to rollback (are you using Firefox?), self.renderFrameId=${self.renderFrameId}, lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}, might've been interruptted by onRoomDownsyncFrame`;
|
||||||
}
|
}
|
||||||
const j = gopkgs.ConvertToDelayedInputFrameId(i);
|
const j = gopkgs.ConvertToDelayedInputFrameId(i);
|
||||||
const delayedInputFrame = self.recentInputCache.GetByFrameId(j);
|
const delayedInputFrame = gopkgs.GetInputFrameDownsync(self.recentInputCache, j);
|
||||||
|
|
||||||
if (self.frameDataLoggingEnabled) {
|
if (self.frameDataLoggingEnabled) {
|
||||||
const actuallyUsedInputClone = delayedInputFrame.InputList.slice();
|
const actuallyUsedInputClone = delayedInputFrame.GetInputList();
|
||||||
const inputFrameDownsyncClone = {
|
const inputFrameDownsyncClone = {
|
||||||
inputFrameId: j,
|
inputFrameId: j,
|
||||||
inputList: actuallyUsedInputClone,
|
inputList: actuallyUsedInputClone,
|
||||||
@ -1401,13 +1402,13 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
self.rdfIdToActuallyUsedInput.set(i, inputFrameDownsyncClone);
|
self.rdfIdToActuallyUsedInput.set(i, inputFrameDownsyncClone);
|
||||||
}
|
}
|
||||||
const renderRes = gopkgs.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs(self.recentInputCache, i, collisionSys, collisionSysMap, self.spaceOffsetX, self.spaceOffsetY, self.chConfigsOrderedByJoinIndex, self.recentRenderCache, self.collisionHolder, self.pEffPushbacks, self.pHardPushbackNormsArr, self.pJumpedOrNotList);
|
const renderRes = gopkgs.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs(self.recentInputCache, i, collisionSys, collisionSysMap, self.spaceOffsetX, self.spaceOffsetY, self.chConfigsOrderedByJoinIndex, self.recentRenderCache, self.collisionHolder, self.pEffPushbacks, self.pHardPushbackNormsArr, self.pJumpedOrNotList);
|
||||||
const nextRdf = self.recentRenderCache.GetByFrameId(self.renderFrameId + 1);
|
const nextRdf = gopkgs.GetRoomDownsyncFrame(self.recentRenderCache, self.renderFrameId + 1);
|
||||||
|
|
||||||
if (true == isChasing) {
|
if (true == isChasing) {
|
||||||
// [WARNING] Move the cursor "self.chaserRenderFrameId" when "true == isChasing", keep in mind that "self.chaserRenderFrameId" is not monotonic!
|
// [WARNING] Move the cursor "self.chaserRenderFrameId" when "true == isChasing", keep in mind that "self.chaserRenderFrameId" is not monotonic!
|
||||||
self.chaserRenderFrameId = nextRdf.Id;
|
self.chaserRenderFrameId = nextRdf.GetId();
|
||||||
} else if (nextRdf.Id == self.chaserRenderFrameId + 1) {
|
} else if (nextRdf.GetId() == self.chaserRenderFrameId + 1) {
|
||||||
self.chaserRenderFrameId = nextRdf.Id; // To avoid redundant calculation
|
self.chaserRenderFrameId = nextRdf.GetId(); // To avoid redundant calculation
|
||||||
}
|
}
|
||||||
prevLatestRdf = currRdf;
|
prevLatestRdf = currRdf;
|
||||||
latestRdf = nextRdf;
|
latestRdf = nextRdf;
|
||||||
@ -1416,16 +1417,16 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
return [prevLatestRdf, latestRdf];
|
return [prevLatestRdf, latestRdf];
|
||||||
},
|
},
|
||||||
|
|
||||||
_initPlayerRichInfoDict(playersArr) {
|
_initPlayerRichInfoDict(rdf) {
|
||||||
const self = this;
|
const self = this;
|
||||||
for (let k in playersArr) {
|
for (let k = 0; k < window.boundRoomCapacity; k++) {
|
||||||
const immediatePlayerInfo = playersArr[k];
|
const immediatePlayerInfo = gopkgs.GetPlayer(rdf, k);
|
||||||
const playerId = immediatePlayerInfo.Id;
|
const playerId = immediatePlayerInfo.GetId();
|
||||||
if (self.playerRichInfoDict.has(playerId)) continue; // Skip already put keys
|
if (self.playerRichInfoDict.has(playerId)) continue; // Skip already put keys
|
||||||
self.playerRichInfoDict.set(playerId, immediatePlayerInfo);
|
self.playerRichInfoDict.set(playerId, immediatePlayerInfo);
|
||||||
const joinIndex = immediatePlayerInfo.JoinIndex;
|
const joinIndex = immediatePlayerInfo.GetJoinIndex();
|
||||||
const vx = immediatePlayerInfo.VirtualGridX;
|
const vx = immediatePlayerInfo.GetVirtualGridX();
|
||||||
const vy = immediatePlayerInfo.VirtualGridY;
|
const vy = immediatePlayerInfo.GetVirtualGridY();
|
||||||
const nodeAndScriptIns = self.spawnPlayerNode(joinIndex, vx, vy, immediatePlayerInfo);
|
const nodeAndScriptIns = self.spawnPlayerNode(joinIndex, vx, vy, immediatePlayerInfo);
|
||||||
|
|
||||||
Object.assign(self.playerRichInfoDict.get(playerId), {
|
Object.assign(self.playerRichInfoDict.get(playerId), {
|
||||||
@ -1435,13 +1436,13 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
|||||||
|
|
||||||
const selfPlayerId = self.selfPlayerInfo.id;
|
const selfPlayerId = self.selfPlayerInfo.id;
|
||||||
if (selfPlayerId == playerId) {
|
if (selfPlayerId == playerId) {
|
||||||
self.selfPlayerInfo.joinIndex = immediatePlayerInfo.JoinIndex; // Update here in case of any change during WAITING phase
|
self.selfPlayerInfo.joinIndex = joinIndex; // Update here in case of any change during WAITING phase
|
||||||
nodeAndScriptIns[1].showArrowTipNode();
|
nodeAndScriptIns[1].showArrowTipNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.playerRichInfoArr = new Array(self.playerRichInfoDict.size);
|
self.playerRichInfoArr = new Array(self.playerRichInfoDict.size);
|
||||||
self.playerRichInfoDict.forEach((playerRichInfo, playerId) => {
|
self.playerRichInfoDict.forEach((playerRichInfo, playerId) => {
|
||||||
self.playerRichInfoArr[playerRichInfo.JoinIndex - 1] = playerRichInfo;
|
self.playerRichInfoArr[playerRichInfo.GetJoinIndex() - 1] = playerRichInfo;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2289,7 +2289,7 @@ var $isASCII = function(s) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
$packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
||||||
var $pkg = {}, $init, Object, Error, sliceType, ptrType, sliceType$2, funcType, ptrType$1, MakeWrapper, init;
|
var $pkg = {}, $init, Object, Error, M, sliceType, ptrType, sliceType$2, funcType, funcType$1, funcType$2, ptrType$1, MakeWrapper, MakeFullWrapper, init;
|
||||||
Object = $pkg.Object = $newType(0, $kindStruct, "js.Object", true, "github.com/gopherjs/gopherjs/js", true, function(object_) {
|
Object = $pkg.Object = $newType(0, $kindStruct, "js.Object", true, "github.com/gopherjs/gopherjs/js", true, function(object_) {
|
||||||
this.$val = this;
|
this.$val = this;
|
||||||
if (arguments.length === 0) {
|
if (arguments.length === 0) {
|
||||||
@ -2306,10 +2306,13 @@ $packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
|||||||
}
|
}
|
||||||
this.Object = Object_;
|
this.Object = Object_;
|
||||||
});
|
});
|
||||||
|
M = $pkg.M = $newType(4, $kindMap, "js.M", true, "github.com/gopherjs/gopherjs/js", true, null);
|
||||||
sliceType = $sliceType($emptyInterface);
|
sliceType = $sliceType($emptyInterface);
|
||||||
ptrType = $ptrType(Object);
|
ptrType = $ptrType(Object);
|
||||||
sliceType$2 = $sliceType(ptrType);
|
sliceType$2 = $sliceType(ptrType);
|
||||||
funcType = $funcType([sliceType$2], [ptrType], true);
|
funcType = $funcType([sliceType$2], [ptrType], true);
|
||||||
|
funcType$1 = $funcType([], [ptrType], false);
|
||||||
|
funcType$2 = $funcType([ptrType], [], false);
|
||||||
ptrType$1 = $ptrType(Error);
|
ptrType$1 = $ptrType(Error);
|
||||||
Object.ptr.prototype.Get = function(key) {
|
Object.ptr.prototype.Get = function(key) {
|
||||||
var key, o;
|
var key, o;
|
||||||
@ -2449,6 +2452,94 @@ $packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
|||||||
return o;
|
return o;
|
||||||
};
|
};
|
||||||
$pkg.MakeWrapper = MakeWrapper;
|
$pkg.MakeWrapper = MakeWrapper;
|
||||||
|
MakeFullWrapper = function(i) {
|
||||||
|
var {constructor, defineProperty, e, f, fields, i, i$1, i$2, i$3, internalObj, m, methods, ms, pkg, pkgTyp, ptr, typ, wrapperObj, $s, $r, $c} = $restore(this, {i});
|
||||||
|
/* */ $s = $s || 0; s: while (true) { switch ($s) { case 0:
|
||||||
|
internalObj = [internalObj];
|
||||||
|
wrapperObj = [wrapperObj];
|
||||||
|
internalObj[0] = i;
|
||||||
|
constructor = internalObj[0].constructor;
|
||||||
|
wrapperObj[0] = new ($global.Object)();
|
||||||
|
defineProperty = (function(internalObj, wrapperObj) { return function(key, descriptor) {
|
||||||
|
var descriptor, key;
|
||||||
|
$global.Object.defineProperty(wrapperObj[0], $externalize(key, $String), $externalize(descriptor, M));
|
||||||
|
}; })(internalObj, wrapperObj);
|
||||||
|
$r = defineProperty("__internal_object__", $makeMap($String.keyFor, [{ k: "value", v: new $jsObjectPtr(internalObj[0]) }])); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
||||||
|
typ = $internalize(constructor.string, $String);
|
||||||
|
pkg = $internalize(constructor.pkg, $String);
|
||||||
|
ptr = "";
|
||||||
|
if (typ.charCodeAt(0) === 42) {
|
||||||
|
ptr = "*";
|
||||||
|
}
|
||||||
|
i$1 = 0;
|
||||||
|
while (true) {
|
||||||
|
if (!(i$1 < typ.length)) { break; }
|
||||||
|
if (typ.charCodeAt(i$1) === 46) {
|
||||||
|
typ = $substring(typ, (i$1 + 1 >> 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i$1 = i$1 + (1) >> 0;
|
||||||
|
}
|
||||||
|
pkgTyp = pkg + "." + ptr + typ;
|
||||||
|
$r = defineProperty("$type", $makeMap($String.keyFor, [{ k: "value", v: new $String(pkgTyp) }])); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
||||||
|
fields = null;
|
||||||
|
methods = new ($global.Array)();
|
||||||
|
ms = constructor.methods;
|
||||||
|
if (!(ms === undefined)) {
|
||||||
|
methods = methods.concat(ms);
|
||||||
|
}
|
||||||
|
e = constructor.elem;
|
||||||
|
if (!(e === undefined)) {
|
||||||
|
fields = e.fields;
|
||||||
|
methods = methods.concat(e.methods);
|
||||||
|
} else {
|
||||||
|
fields = constructor.fields;
|
||||||
|
}
|
||||||
|
i$2 = 0;
|
||||||
|
/* while (true) { */ case 3:
|
||||||
|
/* if (!(i$2 < $parseInt(methods.length))) { break; } */ if(!(i$2 < $parseInt(methods.length))) { $s = 4; continue; }
|
||||||
|
m = [m];
|
||||||
|
m[0] = methods[i$2];
|
||||||
|
if (!($internalize(m[0].pkg, $String) === "")) {
|
||||||
|
i$2 = i$2 + (1) >> 0;
|
||||||
|
/* continue; */ $s = 3; continue;
|
||||||
|
}
|
||||||
|
$r = defineProperty($internalize(m[0].prop, $String), $makeMap($String.keyFor, [{ k: "value", v: new funcType((function(internalObj, m, wrapperObj) { return function(args) {
|
||||||
|
var args;
|
||||||
|
return $externalizeFunction(internalObj[0][$externalize($internalize(m[0].prop, $String), $String)], m[0].typ, $externalize(true, $Bool), MakeFullWrapper).apply(internalObj[0], $externalize(args, sliceType$2));
|
||||||
|
}; })(internalObj, m, wrapperObj)) }])); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
||||||
|
i$2 = i$2 + (1) >> 0;
|
||||||
|
$s = 3; continue;
|
||||||
|
case 4:
|
||||||
|
/* */ if (!(fields === undefined)) { $s = 6; continue; }
|
||||||
|
/* */ $s = 7; continue;
|
||||||
|
/* if (!(fields === undefined)) { */ case 6:
|
||||||
|
i$3 = 0;
|
||||||
|
/* while (true) { */ case 8:
|
||||||
|
/* if (!(i$3 < $parseInt(fields.length))) { break; } */ if(!(i$3 < $parseInt(fields.length))) { $s = 9; continue; }
|
||||||
|
f = [f];
|
||||||
|
f[0] = fields[i$3];
|
||||||
|
if (!!!(f[0].exported)) {
|
||||||
|
i$3 = i$3 + (1) >> 0;
|
||||||
|
/* continue; */ $s = 8; continue;
|
||||||
|
}
|
||||||
|
$r = defineProperty($internalize(f[0].prop, $String), $makeMap($String.keyFor, [{ k: "get", v: new funcType$1((function(f, internalObj, wrapperObj) { return function() {
|
||||||
|
var vc;
|
||||||
|
vc = $copyIfRequired(internalObj[0].$val[$externalize($internalize(f[0].prop, $String), $String)], f[0].typ);
|
||||||
|
return $externalize(vc, f[0].typ, MakeFullWrapper);
|
||||||
|
}; })(f, internalObj, wrapperObj)) }, { k: "set", v: new funcType$2((function(f, internalObj, wrapperObj) { return function(jv) {
|
||||||
|
var gv, jv;
|
||||||
|
gv = $internalize(jv, f[0].typ, MakeFullWrapper);
|
||||||
|
internalObj[0].$val[$externalize($internalize(f[0].prop, $String), $String)] = gv;
|
||||||
|
}; })(f, internalObj, wrapperObj)) }])); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
||||||
|
i$3 = i$3 + (1) >> 0;
|
||||||
|
$s = 8; continue;
|
||||||
|
case 9:
|
||||||
|
/* } */ case 7:
|
||||||
|
$s = -1; return wrapperObj[0];
|
||||||
|
/* */ } return; } var $f = {$blk: MakeFullWrapper, $c: true, $r, constructor, defineProperty, e, f, fields, i, i$1, i$2, i$3, internalObj, m, methods, ms, pkg, pkgTyp, ptr, typ, wrapperObj, $s};return $f;
|
||||||
|
};
|
||||||
|
$pkg.MakeFullWrapper = MakeFullWrapper;
|
||||||
init = function() {
|
init = function() {
|
||||||
var e;
|
var e;
|
||||||
e = new Error.ptr(null);
|
e = new Error.ptr(null);
|
||||||
@ -2458,6 +2549,7 @@ $packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
|||||||
ptrType$1.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Stack", name: "Stack", pkg: "", typ: $funcType([], [$String], false)}];
|
ptrType$1.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Stack", name: "Stack", pkg: "", typ: $funcType([], [$String], false)}];
|
||||||
Object.init("github.com/gopherjs/gopherjs/js", [{prop: "object", name: "object", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
Object.init("github.com/gopherjs/gopherjs/js", [{prop: "object", name: "object", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
||||||
Error.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType, tag: ""}]);
|
Error.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType, tag: ""}]);
|
||||||
|
M.init($String, $emptyInterface);
|
||||||
$init = function() {
|
$init = function() {
|
||||||
$pkg.$init = function() {};
|
$pkg.$init = function() {};
|
||||||
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
||||||
@ -6099,7 +6191,36 @@ $packages["jsexport/battle"] = (function() {
|
|||||||
if (!(_i < _ref.$length)) { break; }
|
if (!(_i < _ref.$length)) { break; }
|
||||||
i = _i;
|
i = _i;
|
||||||
currPlayerDownsync = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
currPlayerDownsync = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
||||||
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i] = new PlayerDownsync.ptr(currPlayerDownsync.Id, currPlayerDownsync.VirtualGridX, currPlayerDownsync.VirtualGridY, currPlayerDownsync.DirX, currPlayerDownsync.DirY, currPlayerDownsync.VelX, currPlayerDownsync.VelY, currPlayerDownsync.Speed, currPlayerDownsync.BattleState, currPlayerDownsync.JoinIndex, currPlayerDownsync.ColliderRadius, currPlayerDownsync.Removed, currPlayerDownsync.Score, 0, currPlayerDownsync.FramesToRecover - 1 >> 0, currPlayerDownsync.FramesInChState + 1 >> 0, currPlayerDownsync.Hp, currPlayerDownsync.MaxHp, currPlayerDownsync.CharacterState, true, false, currPlayerDownsync.OnWallNormX, currPlayerDownsync.OnWallNormY, currPlayerDownsync.CapturedByInertia, currPlayerDownsync.ActiveSkillId, currPlayerDownsync.ActiveSkillHit, currPlayerDownsync.FramesInvinsible - 1 >> 0, currPlayerDownsync.BulletTeamId, currPlayerDownsync.ChCollisionTeamId, currPlayerDownsync.RevivalVirtualGridX, currPlayerDownsync.RevivalVirtualGridY));
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).Id = currPlayerDownsync.Id;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).VirtualGridX = currPlayerDownsync.VirtualGridX;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).VirtualGridY = currPlayerDownsync.VirtualGridY;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).DirX = currPlayerDownsync.DirX;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).DirY = currPlayerDownsync.DirY;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).VelX = currPlayerDownsync.VelX;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).VelY = currPlayerDownsync.VelY;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).CharacterState = currPlayerDownsync.CharacterState;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).InAir = true;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).OnWall = false;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).Speed = currPlayerDownsync.Speed;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).BattleState = currPlayerDownsync.BattleState;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).Score = currPlayerDownsync.Score;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).Removed = currPlayerDownsync.Removed;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).JoinIndex = currPlayerDownsync.JoinIndex;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).Hp = currPlayerDownsync.Hp;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).MaxHp = currPlayerDownsync.MaxHp;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesToRecover = currPlayerDownsync.FramesToRecover - 1 >> 0;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesInChState = currPlayerDownsync.FramesInChState + 1 >> 0;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).ActiveSkillId = currPlayerDownsync.ActiveSkillId;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).ActiveSkillHit = currPlayerDownsync.ActiveSkillHit;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesInvinsible = currPlayerDownsync.FramesInvinsible - 1 >> 0;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).BulletTeamId = currPlayerDownsync.BulletTeamId;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).ChCollisionTeamId = currPlayerDownsync.ChCollisionTeamId;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).RevivalVirtualGridX = currPlayerDownsync.RevivalVirtualGridX;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).RevivalVirtualGridY = currPlayerDownsync.RevivalVirtualGridY;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).ColliderRadius = currPlayerDownsync.ColliderRadius;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).OnWallNormX = currPlayerDownsync.OnWallNormX;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).OnWallNormY = currPlayerDownsync.OnWallNormY;
|
||||||
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).CapturedByInertia = currPlayerDownsync.CapturedByInertia;
|
||||||
if (((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesToRecover < 0) {
|
if (((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesToRecover < 0) {
|
||||||
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesToRecover = 0;
|
((i < 0 || i >= nextRenderFramePlayers.$length) ? ($throwRuntimeError("index out of range"), undefined) : nextRenderFramePlayers.$array[nextRenderFramePlayers.$offset + i]).FramesToRecover = 0;
|
||||||
}
|
}
|
||||||
@ -7092,7 +7213,7 @@ $packages["jsexport/battle"] = (function() {
|
|||||||
return $pkg;
|
return $pkg;
|
||||||
})();
|
})();
|
||||||
$packages["jsexport"] = (function() {
|
$packages["jsexport"] = (function() {
|
||||||
var $pkg = {}, $init, js, battle, resolv, sliceType, ptrType, sliceType$1, ptrType$1, ptrType$2, sliceType$2, ptrType$3, sliceType$3, ptrType$4, sliceType$4, ptrType$5, sliceType$5, ptrType$6, funcType, funcType$1, funcType$2, funcType$3, funcType$4, funcType$5, funcType$6, funcType$7, funcType$8, funcType$9, funcType$10, funcType$11, funcType$12, ptrType$7, funcType$13, funcType$14, funcType$15, funcType$16, sliceType$6, funcType$17, ptrType$8, ptrType$9, mapType, sliceType$7, ptrType$10, sliceType$8, sliceType$9, funcType$18, funcType$19, funcType$20, funcType$21, mapType$1, NewCollisionHolder, NewInputFrameDownsync, NewRingBufferJs, NewCollisionSpaceJs, NewVec2DJs, NewPolygon2DJs, NewBarrierJs, NewPlayerDownsyncJs, NewMeleeBulletJs, NewFireballBulletJs, NewNpcPatrolCue, NewRoomDownsyncFrameJs, GetCollisionSpaceObjsJs, GenerateConvexPolygonColliderJs, GetCharacterConfigsOrderedByJoinIndex, ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs, main;
|
var $pkg = {}, $init, js, battle, resolv, sliceType, ptrType, sliceType$1, ptrType$1, ptrType$2, sliceType$2, ptrType$3, sliceType$3, ptrType$4, sliceType$4, ptrType$5, sliceType$5, ptrType$6, ptrType$7, ptrType$8, funcType, funcType$1, funcType$2, funcType$3, funcType$4, funcType$5, funcType$6, funcType$7, funcType$8, funcType$9, funcType$10, funcType$11, funcType$12, ptrType$9, funcType$13, funcType$14, funcType$15, funcType$16, sliceType$6, funcType$17, ptrType$10, ptrType$11, mapType, sliceType$7, ptrType$12, sliceType$8, sliceType$9, funcType$18, funcType$19, funcType$20, funcType$21, funcType$22, funcType$23, funcType$24, mapType$1, NewCollisionHolder, NewInputFrameDownsync, NewRingBufferJs, NewCollisionSpaceJs, NewVec2DJs, NewPolygon2DJs, NewBarrierJs, NewPlayerDownsyncJs, NewMeleeBulletJs, NewFireballBulletJs, NewNpcPatrolCue, NewRoomDownsyncFrameJs, GetCollisionSpaceObjsJs, GenerateConvexPolygonColliderJs, GetCharacterConfigsOrderedByJoinIndex, ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs, GetRoomDownsyncFrame, GetInputFrameDownsync, GetInput, GetPlayer, GetMeleeBullet, GetFireballBullet, main;
|
||||||
js = $packages["github.com/gopherjs/gopherjs/js"];
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
||||||
battle = $packages["jsexport/battle"];
|
battle = $packages["jsexport/battle"];
|
||||||
resolv = $packages["resolv"];
|
resolv = $packages["resolv"];
|
||||||
@ -7109,6 +7230,8 @@ $packages["jsexport"] = (function() {
|
|||||||
ptrType$5 = $ptrType(js.Object);
|
ptrType$5 = $ptrType(js.Object);
|
||||||
sliceType$5 = $sliceType(ptrType$5);
|
sliceType$5 = $sliceType(ptrType$5);
|
||||||
ptrType$6 = $ptrType(battle.CharacterConfig);
|
ptrType$6 = $ptrType(battle.CharacterConfig);
|
||||||
|
ptrType$7 = $ptrType(battle.RoomDownsyncFrame);
|
||||||
|
ptrType$8 = $ptrType(battle.InputFrameDownsync);
|
||||||
funcType = $funcType([$Float64, $Float64], [ptrType$5], false);
|
funcType = $funcType([$Float64, $Float64], [ptrType$5], false);
|
||||||
funcType$1 = $funcType([ptrType, sliceType$1], [ptrType$5], false);
|
funcType$1 = $funcType([ptrType, sliceType$1], [ptrType$5], false);
|
||||||
funcType$2 = $funcType([ptrType$1], [ptrType$5], false);
|
funcType$2 = $funcType([ptrType$1], [ptrType$5], false);
|
||||||
@ -7122,24 +7245,27 @@ $packages["jsexport"] = (function() {
|
|||||||
funcType$10 = $funcType([$Int32, sliceType, $Uint64], [ptrType$5], false);
|
funcType$10 = $funcType([$Int32, sliceType, $Uint64], [ptrType$5], false);
|
||||||
funcType$11 = $funcType([$Int32], [ptrType$5], false);
|
funcType$11 = $funcType([$Int32], [ptrType$5], false);
|
||||||
funcType$12 = $funcType([ptrType$1, $Float64, $Float64, $emptyInterface, $String], [ptrType$5], false);
|
funcType$12 = $funcType([ptrType$1, $Float64, $Float64, $emptyInterface, $String], [ptrType$5], false);
|
||||||
ptrType$7 = $ptrType(resolv.Space);
|
ptrType$9 = $ptrType(resolv.Space);
|
||||||
funcType$13 = $funcType([ptrType$7], [sliceType$5], false);
|
funcType$13 = $funcType([ptrType$9], [sliceType$5], false);
|
||||||
funcType$14 = $funcType([$Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64], [$Float64, $Float64], false);
|
funcType$14 = $funcType([$Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64, $Float64], [$Float64, $Float64], false);
|
||||||
funcType$15 = $funcType([$Float64, $Float64], [$Int32, $Int32], false);
|
funcType$15 = $funcType([$Float64, $Float64], [$Int32, $Int32], false);
|
||||||
funcType$16 = $funcType([$Int32, $Int32], [$Float64, $Float64], false);
|
funcType$16 = $funcType([$Int32, $Int32], [$Float64, $Float64], false);
|
||||||
sliceType$6 = $sliceType($Int);
|
sliceType$6 = $sliceType($Int);
|
||||||
funcType$17 = $funcType([sliceType$6], [sliceType$5], false);
|
funcType$17 = $funcType([sliceType$6], [sliceType$5], false);
|
||||||
ptrType$8 = $ptrType(resolv.RingBuffer);
|
ptrType$10 = $ptrType(resolv.RingBuffer);
|
||||||
ptrType$9 = $ptrType(resolv.Object);
|
ptrType$11 = $ptrType(resolv.Object);
|
||||||
mapType = $mapType($Int32, ptrType$9);
|
mapType = $mapType($Int32, ptrType$11);
|
||||||
sliceType$7 = $sliceType(ptrType$6);
|
sliceType$7 = $sliceType(ptrType$6);
|
||||||
ptrType$10 = $ptrType(resolv.Collision);
|
ptrType$12 = $ptrType(resolv.Collision);
|
||||||
sliceType$8 = $sliceType(sliceType$1);
|
sliceType$8 = $sliceType(sliceType$1);
|
||||||
sliceType$9 = $sliceType($Bool);
|
sliceType$9 = $sliceType($Bool);
|
||||||
funcType$18 = $funcType([ptrType$8, $Int32, ptrType$7, mapType, $Float64, $Float64, sliceType$7, ptrType$8, ptrType$10, sliceType$1, sliceType$8, sliceType$9], [$Bool], false);
|
funcType$18 = $funcType([ptrType$10, $Int32, ptrType$9, mapType, $Float64, $Float64, sliceType$7, ptrType$10, ptrType$12, sliceType$1, sliceType$8, sliceType$9], [$Bool], false);
|
||||||
funcType$19 = $funcType([$Int32], [$Int32], false);
|
funcType$19 = $funcType([$Int32], [$Int32], false);
|
||||||
funcType$20 = $funcType([$Int32], [$Bool], false);
|
funcType$20 = $funcType([$Int32], [$Bool], false);
|
||||||
funcType$21 = $funcType([$Int32, $Int32, $Int32, $Int32, $Int32], [$Bool], false);
|
funcType$21 = $funcType([$Int32, $Int32, $Int32, $Int32, $Int32], [$Bool], false);
|
||||||
|
funcType$22 = $funcType([ptrType$10, $Int32], [ptrType$5], false);
|
||||||
|
funcType$23 = $funcType([ptrType$7, $Int], [ptrType$5], false);
|
||||||
|
funcType$24 = $funcType([ptrType$8, $Int], [$Uint64], false);
|
||||||
mapType$1 = $mapType($String, $emptyInterface);
|
mapType$1 = $mapType($String, $emptyInterface);
|
||||||
NewCollisionHolder = function() {
|
NewCollisionHolder = function() {
|
||||||
return js.MakeWrapper(resolv.NewCollision());
|
return js.MakeWrapper(resolv.NewCollision());
|
||||||
@ -7227,18 +7353,22 @@ $packages["jsexport"] = (function() {
|
|||||||
};
|
};
|
||||||
$pkg.GenerateConvexPolygonColliderJs = GenerateConvexPolygonColliderJs;
|
$pkg.GenerateConvexPolygonColliderJs = GenerateConvexPolygonColliderJs;
|
||||||
GetCharacterConfigsOrderedByJoinIndex = function(speciesIdList) {
|
GetCharacterConfigsOrderedByJoinIndex = function(speciesIdList) {
|
||||||
var _entry, _i, _ref, i, ret, speciesId, speciesIdList;
|
var {_entry, _i, _r, _ref, i, ret, speciesId, speciesIdList, $s, $r, $c} = $restore(this, {speciesIdList});
|
||||||
|
/* */ $s = $s || 0; s: while (true) { switch ($s) { case 0:
|
||||||
ret = $makeSlice(sliceType$5, speciesIdList.$length, speciesIdList.$length);
|
ret = $makeSlice(sliceType$5, speciesIdList.$length, speciesIdList.$length);
|
||||||
_ref = speciesIdList;
|
_ref = speciesIdList;
|
||||||
_i = 0;
|
_i = 0;
|
||||||
while (true) {
|
/* while (true) { */ case 1:
|
||||||
if (!(_i < _ref.$length)) { break; }
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
||||||
i = _i;
|
i = _i;
|
||||||
speciesId = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
speciesId = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
||||||
((i < 0 || i >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i] = js.MakeWrapper((_entry = battle.Characters[$Int.keyFor(speciesId)], _entry !== undefined ? _entry.v : ptrType$6.nil)));
|
_r = js.MakeFullWrapper((_entry = battle.Characters[$Int.keyFor(speciesId)], _entry !== undefined ? _entry.v : ptrType$6.nil)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
||||||
|
((i < 0 || i >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i] = _r);
|
||||||
_i++;
|
_i++;
|
||||||
}
|
$s = 1; continue;
|
||||||
return ret;
|
case 2:
|
||||||
|
$s = -1; return ret;
|
||||||
|
/* */ } return; } var $f = {$blk: GetCharacterConfigsOrderedByJoinIndex, $c: true, $r, _entry, _i, _r, _ref, i, ret, speciesId, speciesIdList, $s};return $f;
|
||||||
};
|
};
|
||||||
$pkg.GetCharacterConfigsOrderedByJoinIndex = GetCharacterConfigsOrderedByJoinIndex;
|
$pkg.GetCharacterConfigsOrderedByJoinIndex = GetCharacterConfigsOrderedByJoinIndex;
|
||||||
ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs = function(inputsBuffer, currRenderFrameId, collisionSys, collisionSysMap, collisionSpaceOffsetX, collisionSpaceOffsetY, chConfigsOrderedByJoinIndex, renderFrameBuffer, collision, effPushbacks, hardPushbackNormsArr, jumpedOrNotList) {
|
ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs = function(inputsBuffer, currRenderFrameId, collisionSys, collisionSysMap, collisionSpaceOffsetX, collisionSpaceOffsetY, chConfigsOrderedByJoinIndex, renderFrameBuffer, collision, effPushbacks, hardPushbackNormsArr, jumpedOrNotList) {
|
||||||
@ -7250,8 +7380,52 @@ $packages["jsexport"] = (function() {
|
|||||||
/* */ } return; } var $f = {$blk: ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs, $c: true, $r, $24r, _r, chConfigsOrderedByJoinIndex, collision, collisionSpaceOffsetX, collisionSpaceOffsetY, collisionSys, collisionSysMap, currRenderFrameId, effPushbacks, hardPushbackNormsArr, inputsBuffer, jumpedOrNotList, renderFrameBuffer, $s};return $f;
|
/* */ } return; } var $f = {$blk: ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs, $c: true, $r, $24r, _r, chConfigsOrderedByJoinIndex, collision, collisionSpaceOffsetX, collisionSpaceOffsetY, collisionSys, collisionSysMap, currRenderFrameId, effPushbacks, hardPushbackNormsArr, inputsBuffer, jumpedOrNotList, renderFrameBuffer, $s};return $f;
|
||||||
};
|
};
|
||||||
$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs = ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs;
|
$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs = ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs;
|
||||||
|
GetRoomDownsyncFrame = function(renderFrameBuffer, frameId) {
|
||||||
|
var candidate, frameId, renderFrameBuffer;
|
||||||
|
candidate = renderFrameBuffer.GetByFrameId(frameId);
|
||||||
|
if ($interfaceIsEqual($ifaceNil, candidate)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return js.MakeWrapper($assertType(candidate, ptrType$7));
|
||||||
|
};
|
||||||
|
$pkg.GetRoomDownsyncFrame = GetRoomDownsyncFrame;
|
||||||
|
GetInputFrameDownsync = function(inputsBuffer, inputFrameId) {
|
||||||
|
var candidate, inputFrameId, inputsBuffer;
|
||||||
|
candidate = inputsBuffer.GetByFrameId(inputFrameId);
|
||||||
|
if ($interfaceIsEqual($ifaceNil, candidate)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return js.MakeWrapper($assertType(candidate, ptrType$8));
|
||||||
|
};
|
||||||
|
$pkg.GetInputFrameDownsync = GetInputFrameDownsync;
|
||||||
|
GetInput = function(ifd, i) {
|
||||||
|
var i, ifd, x;
|
||||||
|
return (x = ifd.InputList, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
||||||
|
};
|
||||||
|
$pkg.GetInput = GetInput;
|
||||||
|
GetPlayer = function(rdf, i) {
|
||||||
|
var i, rdf, x;
|
||||||
|
return js.MakeWrapper((x = rdf.PlayersArr, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])));
|
||||||
|
};
|
||||||
|
$pkg.GetPlayer = GetPlayer;
|
||||||
|
GetMeleeBullet = function(rdf, i) {
|
||||||
|
var i, rdf, x, x$1;
|
||||||
|
if (-1 === (x = rdf.MeleeBullets, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])).GetBulletLocalId()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return js.MakeWrapper((x$1 = rdf.MeleeBullets, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])));
|
||||||
|
};
|
||||||
|
$pkg.GetMeleeBullet = GetMeleeBullet;
|
||||||
|
GetFireballBullet = function(rdf, i) {
|
||||||
|
var i, rdf, x, x$1;
|
||||||
|
if (-1 === (x = rdf.FireballBullets, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])).GetBulletLocalId()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return js.MakeWrapper((x$1 = rdf.FireballBullets, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])));
|
||||||
|
};
|
||||||
|
$pkg.GetFireballBullet = GetFireballBullet;
|
||||||
main = function() {
|
main = function() {
|
||||||
$global.gopkgs = $externalize($makeMap($String.keyFor, [{ k: "NewVec2DJs", v: new funcType(NewVec2DJs) }, { k: "NewPolygon2DJs", v: new funcType$1(NewPolygon2DJs) }, { k: "NewBarrierJs", v: new funcType$2(NewBarrierJs) }, { k: "NewPlayerDownsyncJs", v: new funcType$3(NewPlayerDownsyncJs) }, { k: "NewMeleeBulletJs", v: new funcType$4(NewMeleeBulletJs) }, { k: "NewFireballBulletJs", v: new funcType$5(NewFireballBulletJs) }, { k: "NewNpcPatrolCue", v: new funcType$6(NewNpcPatrolCue) }, { k: "NewRoomDownsyncFrameJs", v: new funcType$7(NewRoomDownsyncFrameJs) }, { k: "NewCollisionSpaceJs", v: new funcType$8(NewCollisionSpaceJs) }, { k: "NewCollisionHolder", v: new funcType$9(NewCollisionHolder) }, { k: "NewInputFrameDownsync", v: new funcType$10(NewInputFrameDownsync) }, { k: "NewRingBufferJs", v: new funcType$11(NewRingBufferJs) }, { k: "GenerateConvexPolygonColliderJs", v: new funcType$12(GenerateConvexPolygonColliderJs) }, { k: "GetCollisionSpaceObjsJs", v: new funcType$13(GetCollisionSpaceObjsJs) }, { k: "WorldToPolygonColliderBLPos", v: new funcType$14(battle.WorldToPolygonColliderBLPos) }, { k: "PolygonColliderBLToWorldPos", v: new funcType$14(battle.PolygonColliderBLToWorldPos) }, { k: "WorldToVirtualGridPos", v: new funcType$15(battle.WorldToVirtualGridPos) }, { k: "VirtualGridToWorldPos", v: new funcType$16(battle.VirtualGridToWorldPos) }, { k: "GetCharacterConfigsOrderedByJoinIndex", v: new funcType$17(GetCharacterConfigsOrderedByJoinIndex) }, { k: "ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs", v: new funcType$18(ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs) }, { k: "ConvertToDelayedInputFrameId", v: new funcType$19(battle.ConvertToDelayedInputFrameId) }, { k: "ConvertToNoDelayInputFrameId", v: new funcType$19(battle.ConvertToNoDelayInputFrameId) }, { k: "ConvertToFirstUsedRenderFrameId", v: new funcType$19(battle.ConvertToFirstUsedRenderFrameId) }, { k: "ConvertToLastUsedRenderFrameId", v: new funcType$19(battle.ConvertToLastUsedRenderFrameId) }, { k: "ShouldGenerateInputFrameUpsync", v: new funcType$20(battle.ShouldGenerateInputFrameUpsync) }, { k: "IsGeneralBulletActive", v: new funcType$21(battle.IsGeneralBulletActive) }]), mapType$1);
|
$global.gopkgs = $externalize($makeMap($String.keyFor, [{ k: "NewVec2DJs", v: new funcType(NewVec2DJs) }, { k: "NewPolygon2DJs", v: new funcType$1(NewPolygon2DJs) }, { k: "NewBarrierJs", v: new funcType$2(NewBarrierJs) }, { k: "NewPlayerDownsyncJs", v: new funcType$3(NewPlayerDownsyncJs) }, { k: "NewMeleeBulletJs", v: new funcType$4(NewMeleeBulletJs) }, { k: "NewFireballBulletJs", v: new funcType$5(NewFireballBulletJs) }, { k: "NewNpcPatrolCue", v: new funcType$6(NewNpcPatrolCue) }, { k: "NewRoomDownsyncFrameJs", v: new funcType$7(NewRoomDownsyncFrameJs) }, { k: "NewCollisionSpaceJs", v: new funcType$8(NewCollisionSpaceJs) }, { k: "NewCollisionHolder", v: new funcType$9(NewCollisionHolder) }, { k: "NewInputFrameDownsync", v: new funcType$10(NewInputFrameDownsync) }, { k: "NewRingBufferJs", v: new funcType$11(NewRingBufferJs) }, { k: "GenerateConvexPolygonColliderJs", v: new funcType$12(GenerateConvexPolygonColliderJs) }, { k: "GetCollisionSpaceObjsJs", v: new funcType$13(GetCollisionSpaceObjsJs) }, { k: "WorldToPolygonColliderBLPos", v: new funcType$14(battle.WorldToPolygonColliderBLPos) }, { k: "PolygonColliderBLToWorldPos", v: new funcType$14(battle.PolygonColliderBLToWorldPos) }, { k: "WorldToVirtualGridPos", v: new funcType$15(battle.WorldToVirtualGridPos) }, { k: "VirtualGridToWorldPos", v: new funcType$16(battle.VirtualGridToWorldPos) }, { k: "GetCharacterConfigsOrderedByJoinIndex", v: new funcType$17(GetCharacterConfigsOrderedByJoinIndex) }, { k: "ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs", v: new funcType$18(ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs) }, { k: "ConvertToDelayedInputFrameId", v: new funcType$19(battle.ConvertToDelayedInputFrameId) }, { k: "ConvertToNoDelayInputFrameId", v: new funcType$19(battle.ConvertToNoDelayInputFrameId) }, { k: "ConvertToFirstUsedRenderFrameId", v: new funcType$19(battle.ConvertToFirstUsedRenderFrameId) }, { k: "ConvertToLastUsedRenderFrameId", v: new funcType$19(battle.ConvertToLastUsedRenderFrameId) }, { k: "ShouldGenerateInputFrameUpsync", v: new funcType$20(battle.ShouldGenerateInputFrameUpsync) }, { k: "IsGeneralBulletActive", v: new funcType$21(battle.IsGeneralBulletActive) }, { k: "GetRoomDownsyncFrame", v: new funcType$22(GetRoomDownsyncFrame) }, { k: "GetInputFrameDownsync", v: new funcType$22(GetInputFrameDownsync) }, { k: "GetPlayer", v: new funcType$23(GetPlayer) }, { k: "GetMeleeBullet", v: new funcType$23(GetMeleeBullet) }, { k: "GetFireballBullet", v: new funcType$23(GetFireballBullet) }, { k: "GetInput", v: new funcType$24(GetInput) }]), mapType$1);
|
||||||
};
|
};
|
||||||
$init = function() {
|
$init = function() {
|
||||||
$pkg.$init = function() {};
|
$pkg.$init = function() {};
|
||||||
|
@ -579,38 +579,37 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *resolv.Rin
|
|||||||
nextRenderFramePlayers := ret.PlayersArr
|
nextRenderFramePlayers := ret.PlayersArr
|
||||||
// Make a copy first
|
// Make a copy first
|
||||||
for i, currPlayerDownsync := range currRenderFrame.PlayersArr {
|
for i, currPlayerDownsync := range currRenderFrame.PlayersArr {
|
||||||
nextRenderFramePlayers[i] = &PlayerDownsync{
|
nextRenderFramePlayers[i].Id = currPlayerDownsync.Id
|
||||||
Id: currPlayerDownsync.Id,
|
nextRenderFramePlayers[i].VirtualGridX = currPlayerDownsync.VirtualGridX
|
||||||
VirtualGridX: currPlayerDownsync.VirtualGridX,
|
nextRenderFramePlayers[i].VirtualGridY = currPlayerDownsync.VirtualGridY
|
||||||
VirtualGridY: currPlayerDownsync.VirtualGridY,
|
nextRenderFramePlayers[i].DirX = currPlayerDownsync.DirX
|
||||||
DirX: currPlayerDownsync.DirX,
|
nextRenderFramePlayers[i].DirY = currPlayerDownsync.DirY
|
||||||
DirY: currPlayerDownsync.DirY,
|
nextRenderFramePlayers[i].VelX = currPlayerDownsync.VelX
|
||||||
VelX: currPlayerDownsync.VelX,
|
nextRenderFramePlayers[i].VelY = currPlayerDownsync.VelY
|
||||||
VelY: currPlayerDownsync.VelY,
|
nextRenderFramePlayers[i].CharacterState = currPlayerDownsync.CharacterState
|
||||||
CharacterState: currPlayerDownsync.CharacterState,
|
nextRenderFramePlayers[i].InAir = true
|
||||||
InAir: true,
|
nextRenderFramePlayers[i].OnWall = false
|
||||||
OnWall: false,
|
nextRenderFramePlayers[i].Speed = currPlayerDownsync.Speed
|
||||||
Speed: currPlayerDownsync.Speed,
|
nextRenderFramePlayers[i].BattleState = currPlayerDownsync.BattleState
|
||||||
BattleState: currPlayerDownsync.BattleState,
|
nextRenderFramePlayers[i].Score = currPlayerDownsync.Score
|
||||||
Score: currPlayerDownsync.Score,
|
nextRenderFramePlayers[i].Removed = currPlayerDownsync.Removed
|
||||||
Removed: currPlayerDownsync.Removed,
|
nextRenderFramePlayers[i].JoinIndex = currPlayerDownsync.JoinIndex
|
||||||
JoinIndex: currPlayerDownsync.JoinIndex,
|
nextRenderFramePlayers[i].Hp = currPlayerDownsync.Hp
|
||||||
Hp: currPlayerDownsync.Hp,
|
nextRenderFramePlayers[i].MaxHp = currPlayerDownsync.MaxHp
|
||||||
MaxHp: currPlayerDownsync.MaxHp,
|
nextRenderFramePlayers[i].FramesToRecover = currPlayerDownsync.FramesToRecover - 1
|
||||||
FramesToRecover: currPlayerDownsync.FramesToRecover - 1,
|
nextRenderFramePlayers[i].FramesInChState = currPlayerDownsync.FramesInChState + 1
|
||||||
FramesInChState: currPlayerDownsync.FramesInChState + 1,
|
nextRenderFramePlayers[i].ActiveSkillId = currPlayerDownsync.ActiveSkillId
|
||||||
ActiveSkillId: currPlayerDownsync.ActiveSkillId,
|
nextRenderFramePlayers[i].ActiveSkillHit = currPlayerDownsync.ActiveSkillHit
|
||||||
ActiveSkillHit: currPlayerDownsync.ActiveSkillHit,
|
nextRenderFramePlayers[i].FramesInvinsible = currPlayerDownsync.FramesInvinsible - 1
|
||||||
FramesInvinsible: currPlayerDownsync.FramesInvinsible - 1,
|
nextRenderFramePlayers[i].BulletTeamId = currPlayerDownsync.BulletTeamId
|
||||||
BulletTeamId: currPlayerDownsync.BulletTeamId,
|
nextRenderFramePlayers[i].ChCollisionTeamId = currPlayerDownsync.ChCollisionTeamId
|
||||||
ChCollisionTeamId: currPlayerDownsync.ChCollisionTeamId,
|
nextRenderFramePlayers[i].RevivalVirtualGridX = currPlayerDownsync.RevivalVirtualGridX
|
||||||
RevivalVirtualGridX: currPlayerDownsync.RevivalVirtualGridX,
|
nextRenderFramePlayers[i].RevivalVirtualGridY = currPlayerDownsync.RevivalVirtualGridY
|
||||||
RevivalVirtualGridY: currPlayerDownsync.RevivalVirtualGridY,
|
nextRenderFramePlayers[i].ColliderRadius = currPlayerDownsync.ColliderRadius
|
||||||
ColliderRadius: currPlayerDownsync.ColliderRadius,
|
nextRenderFramePlayers[i].OnWallNormX = currPlayerDownsync.OnWallNormX
|
||||||
OnWallNormX: currPlayerDownsync.OnWallNormX,
|
nextRenderFramePlayers[i].OnWallNormY = currPlayerDownsync.OnWallNormY
|
||||||
OnWallNormY: currPlayerDownsync.OnWallNormY,
|
nextRenderFramePlayers[i].CapturedByInertia = currPlayerDownsync.CapturedByInertia
|
||||||
CapturedByInertia: currPlayerDownsync.CapturedByInertia,
|
|
||||||
}
|
|
||||||
if nextRenderFramePlayers[i].FramesToRecover < 0 {
|
if nextRenderFramePlayers[i].FramesToRecover < 0 {
|
||||||
nextRenderFramePlayers[i].FramesToRecover = 0
|
nextRenderFramePlayers[i].FramesToRecover = 0
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func GenerateConvexPolygonColliderJs(unalignedSrc *Polygon2D, spaceOffsetX, spac
|
|||||||
func GetCharacterConfigsOrderedByJoinIndex(speciesIdList []int) []*js.Object {
|
func GetCharacterConfigsOrderedByJoinIndex(speciesIdList []int) []*js.Object {
|
||||||
ret := make([]*js.Object, len(speciesIdList), len(speciesIdList))
|
ret := make([]*js.Object, len(speciesIdList), len(speciesIdList))
|
||||||
for i, speciesId := range speciesIdList {
|
for i, speciesId := range speciesIdList {
|
||||||
ret[i] = js.MakeWrapper(Characters[speciesId])
|
ret[i] = js.MakeFullWrapper(Characters[speciesId])
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
@ -108,6 +108,47 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs(inputsBuffer *resolv.R
|
|||||||
return ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer, currRenderFrameId, collisionSys, collisionSysMap, collisionSpaceOffsetX, collisionSpaceOffsetY, chConfigsOrderedByJoinIndex, renderFrameBuffer, collision, effPushbacks, hardPushbackNormsArr, jumpedOrNotList)
|
return ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer, currRenderFrameId, collisionSys, collisionSysMap, collisionSpaceOffsetX, collisionSpaceOffsetY, chConfigsOrderedByJoinIndex, renderFrameBuffer, collision, effPushbacks, hardPushbackNormsArr, jumpedOrNotList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetRoomDownsyncFrame(renderFrameBuffer *resolv.RingBuffer, frameId int32) *js.Object {
|
||||||
|
// [WARNING] Calling "renderFrameBuffer.GetByFrameId(frameId)" directly from transpiled frontend code would automatically invoke the expensive "$externalize" and "$mapArray"! See profiling result for more details.
|
||||||
|
candidate := renderFrameBuffer.GetByFrameId(frameId)
|
||||||
|
if nil == candidate {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return js.MakeWrapper(candidate.(*RoomDownsyncFrame))
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetInputFrameDownsync(inputsBuffer *resolv.RingBuffer, inputFrameId int32) *js.Object {
|
||||||
|
candidate := inputsBuffer.GetByFrameId(inputFrameId)
|
||||||
|
if nil == candidate {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return js.MakeWrapper(candidate.(*InputFrameDownsync))
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetInput(ifd *InputFrameDownsync, i int) uint64 {
|
||||||
|
// [WARNING] Calling "ifd.GetInputList()" directly from transpiled frontend code would make a copy of the array.
|
||||||
|
return ifd.InputList[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPlayer(rdf *RoomDownsyncFrame, i int) *js.Object {
|
||||||
|
// [WARNING] Calling "rdf.GetPlayersArr()" directly from transpiled frontend code would automatically invoke the expensive "$externalize" and "$mapArray"! See profiling result for more details.
|
||||||
|
return js.MakeWrapper(rdf.PlayersArr[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMeleeBullet(rdf *RoomDownsyncFrame, i int) *js.Object {
|
||||||
|
if TERMINATING_BULLET_LOCAL_ID == rdf.MeleeBullets[i].GetBulletLocalId() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return js.MakeWrapper(rdf.MeleeBullets[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetFireballBullet(rdf *RoomDownsyncFrame, i int) *js.Object {
|
||||||
|
if TERMINATING_BULLET_LOCAL_ID == rdf.FireballBullets[i].GetBulletLocalId() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return js.MakeWrapper(rdf.FireballBullets[i])
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
js.Global.Set("gopkgs", map[string]interface{}{
|
js.Global.Set("gopkgs", map[string]interface{}{
|
||||||
"NewVec2DJs": NewVec2DJs,
|
"NewVec2DJs": NewVec2DJs,
|
||||||
@ -136,5 +177,11 @@ func main() {
|
|||||||
"ConvertToLastUsedRenderFrameId": ConvertToLastUsedRenderFrameId,
|
"ConvertToLastUsedRenderFrameId": ConvertToLastUsedRenderFrameId,
|
||||||
"ShouldGenerateInputFrameUpsync": ShouldGenerateInputFrameUpsync,
|
"ShouldGenerateInputFrameUpsync": ShouldGenerateInputFrameUpsync,
|
||||||
"IsGeneralBulletActive": IsGeneralBulletActive,
|
"IsGeneralBulletActive": IsGeneralBulletActive,
|
||||||
|
"GetRoomDownsyncFrame": GetRoomDownsyncFrame,
|
||||||
|
"GetInputFrameDownsync": GetInputFrameDownsync,
|
||||||
|
"GetPlayer": GetPlayer,
|
||||||
|
"GetMeleeBullet": GetMeleeBullet,
|
||||||
|
"GetFireballBullet": GetFireballBullet,
|
||||||
|
"GetInput": GetInput,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user