mirror of
https://github.com/Retera/WarsmashModEngine.git
synced 2022-07-31 17:38:59 +02:00
Merge branch 'main' of bitbucket.org:etheller/warsmash into main
This commit is contained in:
commit
38f67af599
@ -267,8 +267,8 @@ public class WarsmashGdxMenuScreen implements InputProcessor, Screen, SingleMode
|
||||
final float yScale = worldHeight / getMinWorldHeight();
|
||||
final float uiSceneWidth = 0.8f * xScale;
|
||||
final float uiSceneHeight = 0.6f * yScale;
|
||||
final float uiSceneX = ((0.8f - uiSceneWidth) / 2);
|
||||
final float uiSceneY = ((0.6f - uiSceneHeight) / 2);
|
||||
final float uiSceneX = (0.8f - uiSceneWidth) / 2;
|
||||
final float uiSceneY = (0.6f - uiSceneHeight) / 2;
|
||||
this.uiScene.camera.ortho(uiSceneX, uiSceneWidth + uiSceneX, uiSceneY, uiSceneHeight + uiSceneY, -1024f, 1024);
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ public class WarsmashGdxMenuScreen implements InputProcessor, Screen, SingleMode
|
||||
effectInstance.setSequenceLoopMode(SequenceLoopMode.ALWAYS_LOOP);
|
||||
effectInstance.localLocation.x = (float) Math.cos(angle) * 256;
|
||||
effectInstance.localLocation.y = (float) Math.sin(angle) * 256;
|
||||
effectInstance.localRotation.setFromAxisRad(0, 0, 1, (float) (angle));
|
||||
effectInstance.localRotation.setFromAxisRad(0, 0, 1, (float) angle);
|
||||
|
||||
}
|
||||
final MdxModel mineModel = (MdxModel) this.viewer.load("buildings\\undead\\hauntedmine\\hauntedmine.mdx",
|
||||
@ -464,7 +464,7 @@ public class WarsmashGdxMenuScreen implements InputProcessor, Screen, SingleMode
|
||||
effectInstance.setSequenceLoopMode(SequenceLoopMode.ALWAYS_LOOP);
|
||||
effectInstance.localLocation.x = (float) Math.cos(angle) * 256;
|
||||
effectInstance.localLocation.y = (float) Math.sin(angle) * 256;
|
||||
effectInstance.localRotation.setFromAxisRad(0, 0, 1, (float) (angle));
|
||||
effectInstance.localRotation.setFromAxisRad(0, 0, 1, (float) angle);
|
||||
|
||||
}
|
||||
final MdxModel mineModel = (MdxModel) this.viewer.load("units\\orc\\spiritwolf\\spiritwolf.mdx",
|
||||
@ -503,8 +503,8 @@ public class WarsmashGdxMenuScreen implements InputProcessor, Screen, SingleMode
|
||||
private void makeFourHundred(final Scene scene, final MdxModel model2) {
|
||||
for (int i = 0; i < 400; i++) {
|
||||
final MdxComplexInstance instance3 = (MdxComplexInstance) model2.addInstance(0);
|
||||
instance3.localLocation.x = (((i % 20) - 10) * 128);
|
||||
instance3.localLocation.y = (((i / 20) - 10) * 128);
|
||||
instance3.localLocation.x = ((i % 20) - 10) * 128;
|
||||
instance3.localLocation.y = ((i / 20) - 10) * 128;
|
||||
|
||||
instance3.setScene(scene);
|
||||
|
||||
@ -519,8 +519,8 @@ public class WarsmashGdxMenuScreen implements InputProcessor, Screen, SingleMode
|
||||
final int n2 = n * n;
|
||||
for (int i = 0; i < n2; i++) {
|
||||
final MdxComplexInstance instance3 = (MdxComplexInstance) model2.addInstance(0);
|
||||
instance3.localLocation.x = (((i % n) - (n / 2)) * 128);
|
||||
instance3.localLocation.y = (((i / n) - (n / 2)) * 128);
|
||||
instance3.localLocation.x = ((i % n) - (n / 2)) * 128;
|
||||
instance3.localLocation.y = ((i / n) - (n / 2)) * 128;
|
||||
|
||||
instance3.setScene(scene);
|
||||
|
||||
|
@ -98,6 +98,7 @@ import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerGame
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerJass;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerScore;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerState;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerUnitOrderExecutor;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CRace;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CRacePreference;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CStartLocPrio;
|
||||
@ -132,7 +133,9 @@ import com.etheller.warsmash.viewer5.handlers.w3x.simulation.trigger.enumtypes.C
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.trigger.enumtypes.CVersion;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.trigger.enumtypes.CWeaponSoundTypeJass;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.unit.CUnitTypeJass;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.BooleanAbilityActivationReceiver;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.CHashtable;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.PointAbilityTargetCheckReceiver;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.ui.MeleeUI;
|
||||
|
||||
public class Jass2 {
|
||||
@ -1371,11 +1374,11 @@ public class Jass2 {
|
||||
final List<CUnit> group = arguments.get(0).visit(ObjectJassValueVisitor.<List<CUnit>>getInstance());
|
||||
final CPlayerJass player = arguments.get(1)
|
||||
.visit(ObjectJassValueVisitor.<CPlayerJass>getInstance());
|
||||
final TriggerBooleanExpression filter = arguments.get(2)
|
||||
.visit(ObjectJassValueVisitor.<TriggerBooleanExpression>getInstance());
|
||||
final TriggerBooleanExpression filter = nullable(arguments, 2,
|
||||
ObjectJassValueVisitor.<TriggerBooleanExpression>getInstance());
|
||||
for (final CUnit unit : simulation.getUnits()) {
|
||||
if (unit.getPlayerIndex() == player.getId()) {
|
||||
if (filter.evaluate(globalScope,
|
||||
if ((filter == null) || filter.evaluate(globalScope,
|
||||
CommonTriggerExecutionScope.filterScope(triggerScope, unit))) {
|
||||
// TODO the trigger scope for evaluation here might need to be a clean one?
|
||||
group.add(unit);
|
||||
@ -1385,6 +1388,38 @@ public class Jass2 {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
jassProgramVisitor.getJassNativeManager().createNative("IssuePointOrderLoc", new JassFunction() {
|
||||
@Override
|
||||
public JassValue call(final List<JassValue> arguments, final GlobalScope globalScope,
|
||||
final TriggerExecutionScope triggerScope) {
|
||||
final CUnit whichUnit = arguments.get(0).visit(ObjectJassValueVisitor.getInstance());
|
||||
final String orderString = arguments.get(1).visit(StringJassValueVisitor.getInstance());
|
||||
final Point2D.Double whichLocation = arguments.get(2)
|
||||
.visit(ObjectJassValueVisitor.<Point2D.Double>getInstance());
|
||||
final CPlayerUnitOrderExecutor defaultPlayerUnitOrderExecutor = simulation
|
||||
.getDefaultPlayerUnitOrderExecutor(whichUnit.getPlayerIndex());
|
||||
final BooleanAbilityActivationReceiver activationReceiver = BooleanAbilityActivationReceiver.INSTANCE;
|
||||
final int orderId = OrderIdUtils.getOrderId(orderString);
|
||||
int abilityHandleId = 0;
|
||||
AbilityPointTarget targetAsPoint = new AbilityPointTarget((float) whichLocation.x,
|
||||
(float) whichLocation.y);
|
||||
for (final CAbility ability : whichUnit.getAbilities()) {
|
||||
ability.checkCanUse(simulation, whichUnit, orderId, activationReceiver);
|
||||
if (activationReceiver.isOk()) {
|
||||
final PointAbilityTargetCheckReceiver targetReceiver = PointAbilityTargetCheckReceiver.INSTANCE;
|
||||
ability.checkCanTarget(simulation, whichUnit, orderId, targetAsPoint,
|
||||
targetReceiver.reset());
|
||||
if (targetReceiver.getTarget() != null) {
|
||||
targetAsPoint = targetReceiver.getTarget();
|
||||
abilityHandleId = ability.getHandleId();
|
||||
}
|
||||
}
|
||||
}
|
||||
defaultPlayerUnitOrderExecutor.issuePointOrder(whichUnit.getHandleId(), abilityHandleId, orderId,
|
||||
targetAsPoint.x, targetAsPoint.y, false);
|
||||
return BooleanJassValue.of(abilityHandleId != 0);
|
||||
}
|
||||
});
|
||||
jassProgramVisitor.getJassNativeManager().createNative("GroupEnumUnitsOfTypeCounted", new JassFunction() {
|
||||
@Override
|
||||
public JassValue call(final List<JassValue> arguments, final GlobalScope globalScope,
|
||||
@ -3227,7 +3262,7 @@ public class Jass2 {
|
||||
final int lowBound = arguments.get(0).visit(IntegerJassValueVisitor.getInstance());
|
||||
final int highBound = arguments.get(1).visit(IntegerJassValueVisitor.getInstance());
|
||||
return new IntegerJassValue(
|
||||
(simulation.getSeededRandom().nextInt((highBound - lowBound) + 1)) + lowBound);
|
||||
simulation.getSeededRandom().nextInt((highBound - lowBound) + 1) + lowBound);
|
||||
}
|
||||
});
|
||||
jassProgramVisitor.getJassNativeManager().createNative("GetWidgetX", new JassFunction() {
|
||||
|
@ -6,7 +6,7 @@ public class WarsmashConstants {
|
||||
* With version, we use 0 for RoC, 1 for TFT emulation, and probably 2+ or
|
||||
* whatever for custom mods and other stuff
|
||||
*/
|
||||
public static int GAME_VERSION = 1;
|
||||
public static int GAME_VERSION = 0;
|
||||
public static final int REPLACEABLE_TEXTURE_LIMIT = 64;
|
||||
public static final float SIMULATION_STEP_TIME = 1 / 20f;
|
||||
public static final int PORT_NUMBER = 6115;
|
||||
@ -25,7 +25,7 @@ public class WarsmashConstants {
|
||||
// find it yet so I used this
|
||||
public static final String DEFAULT_STRING = "Default string";
|
||||
|
||||
public static final boolean CATCH_CURSOR = false;
|
||||
public static final boolean CATCH_CURSOR = true;
|
||||
public static final boolean VERBOSE_LOGGING = true;
|
||||
public static final boolean ENABLE_DEBUG = true;
|
||||
public static final char SPECIAL_ESCAPE_KEYCODE = 0x7E;
|
||||
|
@ -42,6 +42,7 @@ import com.etheller.warsmash.viewer5.handlers.w3x.simulation.pathing.CPathfindin
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CAllianceType;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayer;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerJass;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CPlayerUnitOrderExecutor;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.players.CRace;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.region.CRegionManager;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.timers.CTimer;
|
||||
@ -62,6 +63,7 @@ public class CSimulation implements CPlayerAPI {
|
||||
private final List<CDestructable> destructables;
|
||||
private final List<CItem> items;
|
||||
private final List<CPlayer> players;
|
||||
private final List<CPlayerUnitOrderExecutor> defaultPlayerUnitOrderExecutors;
|
||||
private final List<CAttackProjectile> projectiles;
|
||||
private final List<CAttackProjectile> newProjectiles;
|
||||
private final HandleIdAllocator handleIdAllocator;
|
||||
@ -115,6 +117,7 @@ public class CSimulation implements CPlayerAPI {
|
||||
}
|
||||
this.seededRandom = seededRandom;
|
||||
this.players = new ArrayList<>();
|
||||
this.defaultPlayerUnitOrderExecutors = new ArrayList<>();
|
||||
for (int i = 0; i < WarsmashConstants.MAX_PLAYERS; i++) {
|
||||
final CBasePlayer configPlayer = config.getPlayer(i);
|
||||
final War3MapConfigStartLoc startLoc = config.getStartLoc(configPlayer.getStartLocationIndex());
|
||||
@ -127,6 +130,7 @@ public class CSimulation implements CPlayerAPI {
|
||||
}
|
||||
}
|
||||
this.players.add(newPlayer);
|
||||
this.defaultPlayerUnitOrderExecutors.add(new CPlayerUnitOrderExecutor(this, i));
|
||||
}
|
||||
this.players.get(this.players.size() - 4).setName(miscData.getLocalizedString("WESTRING_PLAYER_NA"));
|
||||
this.players.get(this.players.size() - 3).setName(miscData.getLocalizedString("WESTRING_PLAYER_NV"));
|
||||
@ -330,14 +334,14 @@ public class CSimulation implements CPlayerAPI {
|
||||
this.daytime = (timeOfDayAfter >= this.gameplayConstants.getDawnTimeGameHours())
|
||||
&& (timeOfDayAfter < this.gameplayConstants.getDuskTimeGameHours());
|
||||
for (final CTimer timer : this.addedTimers) {
|
||||
internalRegisterTimer(timer);
|
||||
this.internalRegisterTimer(timer);
|
||||
}
|
||||
this.addedTimers.clear();
|
||||
while (!this.activeTimers.isEmpty() && (this.activeTimers.peek().getEngineFireTick() <= this.gameTurnTick)) {
|
||||
this.activeTimers.pop().fire(this);
|
||||
}
|
||||
for (final CTimer timer : this.removedTimers) {
|
||||
internalUnregisterTimer(timer);
|
||||
this.internalUnregisterTimer(timer);
|
||||
}
|
||||
this.removedTimers.clear();
|
||||
for (final TimeOfDayVariableEvent timeOfDayEvent : this.timeOfDayVariableEvents) {
|
||||
@ -420,6 +424,10 @@ public class CSimulation implements CPlayerAPI {
|
||||
return this.players.get(index);
|
||||
}
|
||||
|
||||
public CPlayerUnitOrderExecutor getDefaultPlayerUnitOrderExecutor(final int index) {
|
||||
return this.defaultPlayerUnitOrderExecutors.get(index);
|
||||
}
|
||||
|
||||
public CommandErrorListener getCommandErrorListener(final int playerIndex) {
|
||||
return this.commandErrorListener;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user