Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ MonoBehaviour:
Value: 1
DrawOnTimeUp:
Value: 0
DropStarsOnDeath:
Value: 1
BigStarPrototype:
Id:
Value: 1295981493910502871
Original file line number Diff line number Diff line change
Expand Up @@ -799,12 +799,14 @@ public unsafe partial struct GameRules {
public Int32 Lives;
[FieldOffset(12)]
public Int32 TimerMinutes;
[FieldOffset(24)]
[FieldOffset(28)]
public QBoolean TeamsEnabled;
[FieldOffset(16)]
public QBoolean CustomPowerupsEnabled;
[FieldOffset(20)]
public QBoolean DrawOnTimeUp;
[FieldOffset(24)]
public QBoolean DropStarsOnDeath;
public override Int32 GetHashCode() {
unchecked {
var hash = 443;
Expand All @@ -817,6 +819,7 @@ public override Int32 GetHashCode() {
hash = hash * 31 + TeamsEnabled.GetHashCode();
hash = hash * 31 + CustomPowerupsEnabled.GetHashCode();
hash = hash * 31 + DrawOnTimeUp.GetHashCode();
hash = hash * 31 + DropStarsOnDeath.GetHashCode();
return hash;
}
}
Expand All @@ -828,6 +831,7 @@ public static void Serialize(void* ptr, FrameSerializer serializer) {
serializer.Stream.Serialize(&p->TimerMinutes);
QBoolean.Serialize(&p->CustomPowerupsEnabled, serializer);
QBoolean.Serialize(&p->DrawOnTimeUp, serializer);
QBoolean.Serialize(&p->DropStarsOnDeath, serializer);
QBoolean.Serialize(&p->TeamsEnabled, serializer);
AssetRef.Serialize(&p->Gamemode, serializer);
AssetRef.Serialize(&p->Stage, serializer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ public unsafe partial class GameRulesPrototype : StructPrototype {
public QBoolean TeamsEnabled;
public QBoolean CustomPowerupsEnabled;
public QBoolean DrawOnTimeUp;
public QBoolean DropStarsOnDeath;
partial void MaterializeUser(Frame frame, ref Quantum.GameRules result, in PrototypeMaterializationContext context);
public void Materialize(Frame frame, ref Quantum.GameRules result, in PrototypeMaterializationContext context = default) {
result.Stage = this.Stage;
Expand All @@ -416,6 +417,7 @@ public void Materialize(Frame frame, ref Quantum.GameRules result, in PrototypeM
result.TeamsEnabled = this.TeamsEnabled;
result.CustomPowerupsEnabled = this.CustomPowerupsEnabled;
result.DrawOnTimeUp = this.DrawOnTimeUp;
result.DropStarsOnDeath = this.DropStarsOnDeath;
MaterializeUser(frame, ref result, in context);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ public void SpawnStars(Frame f, EntityRef entity, int amount) {
1 => 2,
_ => starDirection
};
//if DropStarsOnDeath is deactivated, drop only 1 star
if (!f.Global->Rules.DropStarsOnDeath) {
GamemodeData.StarChasers->Stars = 1;
}
}

int droppedStars = 0;
Expand Down
1 change: 1 addition & 0 deletions Assets/QuantumUser/Simulation/NSMB/Logic/GameLogic.qtn
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct GameRules {
bool TeamsEnabled;
bool CustomPowerupsEnabled;
bool DrawOnTimeUp;
bool DropStarsOnDeath;
}

enum GameState : Byte {
Expand Down
1 change: 1 addition & 0 deletions Assets/QuantumUser/Simulation/NSMB/Logic/GameRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public unsafe partial struct GameRules {

public readonly bool IsLivesEnabled => Lives > 0;
public readonly bool IsTimerEnabled => TimerMinutes > 0;
public readonly bool IsDropStarsOnDeathEnabled => DropStarsOnDeath;

}
}
6 changes: 6 additions & 0 deletions Assets/QuantumUser/Simulation/NSMB/Room/CommandChangeRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class CommandChangeRules : DeterministicCommand, ILobbyCommand {
public bool TeamsEnabled;
public bool CustomPowerupsEnabled;
public bool DrawOnTimeUp;
public bool DropStarsOnDeath;

public override void Serialize(BitStream stream) {
if (stream.Writing) {
Expand All @@ -32,6 +33,7 @@ public override void Serialize(BitStream stream) {
stream.Serialize(ref TeamsEnabled);
stream.Serialize(ref CustomPowerupsEnabled);
stream.Serialize(ref DrawOnTimeUp);
stream.Serialize(ref DropStarsOnDeath);
}

public unsafe void Execute(Frame f, PlayerRef sender, PlayerData* playerData) {
Expand Down Expand Up @@ -79,6 +81,9 @@ public unsafe void Execute(Frame f, PlayerRef sender, PlayerData* playerData) {
if (rulesChanges.HasFlag(Rules.DrawOnTimeUp)) {
rules.DrawOnTimeUp = DrawOnTimeUp;
}
if (rulesChanges.HasFlag(Rules.DropStarsOnDeath)) {
rules.DropStarsOnDeath = DropStarsOnDeath;
}

f.Global->Rules = rules;
f.Events.RulesChanged(gamemodeChanged, levelChanged);
Expand All @@ -100,6 +105,7 @@ public enum Rules : ushort {
TeamsEnabled = 1 << 6,
CustomPowerupsEnabled = 1 << 7,
DrawOnTimeUp = 1 << 8,
DropStarsOnDeath = 1 << 9,
}
}
}
2 changes: 2 additions & 0 deletions Assets/Resources/Data/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
"ui.inroom.settings.game.friendlyfire.description": "Allows players on the same team to attack one another, dropping stars in the process. This includes direct attacks (such as stomps or the Propeller Suit's drill), along with projectiles from powerups such as the Fire Flower.",
"ui.inroom.settings.game.powerups": "Custom powerups",
"ui.inroom.settings.game.powerups.description": "Enables the spawning of the powerups that are not native to New Super Mario Bros (DS), such as the Ice Flower and Propeller Mushroom.",
"ui.inroom.settings.game.dropallstars": "Drop all stars on death",
"ui.inroom.settings.game.dropallstars.description": "When enabled, players that lose all their lives will drop all stars they are carrying. When disabled, they will only drop 1 star.",
"ui.inroom.settings.map.header": "Map Selection",
"ui.inroom.settings.room.header": "Room Settings",
"ui.inroom.settings.room.players": "Max Players",
Expand Down
Loading