mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Made player attack knockback configurable
This commit is contained in:
parent
b9750057d5
commit
7dafd081e1
6 changed files with 14 additions and 6 deletions
|
|
@ -631,7 +631,7 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
||||||
|
|
||||||
// set knockback very high when dealing with player attacks
|
// set knockback very high when dealing with player attacks
|
||||||
if (m->interactObj != NULL && (m->interactObj->oInteractType & INTERACT_PLAYER) && terrainIndex != 2) {
|
if (m->interactObj != NULL && (m->interactObj->oInteractType & INTERACT_PLAYER) && terrainIndex != 2) {
|
||||||
f32 mag = m->interactObj->oDamageOrCoinValue * 25.0f * sign;
|
f32 mag = m->interactObj->oDamageOrCoinValue * (f32)gServerSettings.playerKnockbackStrength * sign;
|
||||||
m->forwardVel = mag;
|
m->forwardVel = mag;
|
||||||
if (sign > 0 && terrainIndex == 1) { mag *= -1.0f; }
|
if (sign > 0 && terrainIndex == 1) { mag *= -1.0f; }
|
||||||
m->vel[0] = mag * sins(angleToObject);
|
m->vel[0] = mag * sins(angleToObject);
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ unsigned int configJoinPort = DEFAULT_PORT;
|
||||||
unsigned int configHostPort = DEFAULT_PORT;
|
unsigned int configHostPort = DEFAULT_PORT;
|
||||||
unsigned int configHostSaveSlot = 1;
|
unsigned int configHostSaveSlot = 1;
|
||||||
unsigned int configPlayerInteraction = 1;
|
unsigned int configPlayerInteraction = 1;
|
||||||
|
unsigned int configPlayerKnockbackStrength = 25;
|
||||||
|
|
||||||
static const struct ConfigOption options[] = {
|
static const struct ConfigOption options[] = {
|
||||||
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
|
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
|
||||||
|
|
@ -150,11 +151,12 @@ static const struct ConfigOption options[] = {
|
||||||
{.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC},
|
{.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC},
|
||||||
#endif
|
#endif
|
||||||
// coop-specific
|
// coop-specific
|
||||||
{.name = "coop_join_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configJoinIp},
|
{.name = "coop_join_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configJoinIp},
|
||||||
{.name = "coop_join_port", .type = CONFIG_TYPE_UINT , .uintValue = &configJoinPort},
|
{.name = "coop_join_port", .type = CONFIG_TYPE_UINT , .uintValue = &configJoinPort},
|
||||||
{.name = "coop_host_port", .type = CONFIG_TYPE_UINT , .uintValue = &configHostPort},
|
{.name = "coop_host_port", .type = CONFIG_TYPE_UINT , .uintValue = &configHostPort},
|
||||||
{.name = "coop_host_save_slot", .type = CONFIG_TYPE_UINT , .uintValue = &configHostSaveSlot},
|
{.name = "coop_host_save_slot", .type = CONFIG_TYPE_UINT , .uintValue = &configHostSaveSlot},
|
||||||
{.name = "coop_player_interaction", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerInteraction},
|
{.name = "coop_player_interaction", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerInteraction},
|
||||||
|
{.name = "coop_player_knockback_strength", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerKnockbackStrength},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ extern unsigned int configJoinPort;
|
||||||
extern unsigned int configHostPort;
|
extern unsigned int configHostPort;
|
||||||
extern unsigned int configHostSaveSlot;
|
extern unsigned int configHostSaveSlot;
|
||||||
extern unsigned int configPlayerInteraction;
|
extern unsigned int configPlayerInteraction;
|
||||||
|
extern unsigned int configPlayerKnockbackStrength;
|
||||||
|
|
||||||
void configfile_load(const char *filename);
|
void configfile_load(const char *filename);
|
||||||
void configfile_save(const char *filename);
|
void configfile_save(const char *filename);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ bool gNetworkLevelLoaded = false;
|
||||||
|
|
||||||
struct ServerSettings gServerSettings = {
|
struct ServerSettings gServerSettings = {
|
||||||
.playerInteractions = PLAYER_INTERACTIONS_SOLID,
|
.playerInteractions = PLAYER_INTERACTIONS_SOLID,
|
||||||
|
.playerKnockbackStrength = 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
void network_init(enum NetworkType inNetworkType, char* ip, unsigned int port) {
|
void network_init(enum NetworkType inNetworkType, char* ip, unsigned int port) {
|
||||||
|
|
@ -35,6 +36,7 @@ void network_init(enum NetworkType inNetworkType, char* ip, unsigned int port) {
|
||||||
// set server settings
|
// set server settings
|
||||||
if (gNetworkType == NT_SERVER) {
|
if (gNetworkType == NT_SERVER) {
|
||||||
gServerSettings.playerInteractions = configPlayerInteraction;
|
gServerSettings.playerInteractions = configPlayerInteraction;
|
||||||
|
gServerSettings.playerKnockbackStrength = configPlayerKnockbackStrength;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a receiver socket to receive datagrams
|
// create a receiver socket to receive datagrams
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ enum PlayerInteractions {
|
||||||
|
|
||||||
struct ServerSettings {
|
struct ServerSettings {
|
||||||
enum PlayerInteractions playerInteractions;
|
enum PlayerInteractions playerInteractions;
|
||||||
|
u8 playerKnockbackStrength;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Networking-specific externs
|
// Networking-specific externs
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ void network_send_save_file(void) {
|
||||||
packet_init(&p, PACKET_SAVE_FILE, true);
|
packet_init(&p, PACKET_SAVE_FILE, true);
|
||||||
packet_write(&p, &gCurrSaveFileNum, sizeof(s16));
|
packet_write(&p, &gCurrSaveFileNum, sizeof(s16));
|
||||||
packet_write(&p, &gServerSettings.playerInteractions, sizeof(u8));
|
packet_write(&p, &gServerSettings.playerInteractions, sizeof(u8));
|
||||||
|
packet_write(&p, &gServerSettings.playerKnockbackStrength, sizeof(u8));
|
||||||
packet_write(&p, eeprom, sizeof(u8) * 512);
|
packet_write(&p, eeprom, sizeof(u8) * 512);
|
||||||
network_send(&p);
|
network_send(&p);
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +55,7 @@ void network_receive_save_file(struct Packet* p) {
|
||||||
// find all reserved objects
|
// find all reserved objects
|
||||||
packet_read(p, &gCurrSaveFileNum, sizeof(s16));
|
packet_read(p, &gCurrSaveFileNum, sizeof(s16));
|
||||||
packet_read(p, &gServerSettings.playerInteractions, sizeof(u8));
|
packet_read(p, &gServerSettings.playerInteractions, sizeof(u8));
|
||||||
|
packet_read(p, &gServerSettings.playerKnockbackStrength, sizeof(u8));
|
||||||
packet_read(p, eeprom, sizeof(u8) * 512);
|
packet_read(p, eeprom, sizeof(u8) * 512);
|
||||||
|
|
||||||
save_file_load_all(TRUE);
|
save_file_load_all(TRUE);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue