Removed old chat system

This commit is contained in:
MysterD 2021-07-01 21:14:11 -07:00
parent 1b1ed0038f
commit 58eec0e19f
12 changed files with 16 additions and 189 deletions

View file

@ -3847,7 +3847,6 @@
<ClCompile Include="..\src\game\behaviors\yoshi.inc.c" />
<ClCompile Include="..\src\game\camera.c" />
<ClCompile Include="..\src\game\characters.c" />
<ClCompile Include="..\src\game\chat.c" />
<ClCompile Include="..\src\game\debug.c" />
<ClCompile Include="..\src\game\debug_course.c" />
<ClCompile Include="..\src\game\envfx_bubbles.c" />
@ -4378,7 +4377,6 @@
<ClInclude Include="..\include\behavior_table.h" />
<ClInclude Include="..\include\luigi_audio_defines.h" />
<ClInclude Include="..\src\game\characters.h" />
<ClInclude Include="..\src\game\chat.h" />
<ClInclude Include="..\src\game\rng_position.h" />
<ClInclude Include="..\src\menu\custom_menu.h" />
<ClInclude Include="..\src\menu\custom_menu_system.h" />

View file

@ -15048,9 +15048,6 @@
<ClCompile Include="..\src\menu\custom_menu.c">
<Filter>Source Files\src\menu</Filter>
</ClCompile>
<ClCompile Include="..\src\game\chat.c">
<Filter>Source Files\src\game</Filter>
</ClCompile>
<ClCompile Include="..\src\pc\network\packets\packet_chat.c">
<Filter>Source Files\src\pc\network\packets</Filter>
</ClCompile>
@ -16201,9 +16198,6 @@
<ClInclude Include="..\src\menu\custom_menu.h">
<Filter>Header Files\src\menu</Filter>
</ClInclude>
<ClInclude Include="..\src\game\chat.h">
<Filter>Header Files\src\game</Filter>
</ClInclude>
<ClInclude Include="..\src\pc\network\network_player.h">
<Filter>Header Files\src\pc\network</Filter>
</ClInclude>

View file

@ -1,4 +1,5 @@
#!/bin/bash
#make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run' -ex 'quit'
#make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run --server 27015 --configfile sm64config_server.txt' -ex 'quit'
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && ./build/us_pc/sm64.us.f3dex2e.exe --server 27015 --configfile sm64config_server.txt
#make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && ./build/us_pc/sm64.us.f3dex2e.exe --server 27015 --configfile sm64config_server.txt
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && ./build/us_pc/sm64.us.f3dex2e.exe

View file

@ -1,150 +0,0 @@
#include <stdio.h>
#include <ultra64.h>
#include <string.h>
#include "chat.h"
#include "game_init.h"
#include "ingame_menu.h"
#include "mario_misc.h"
#include "segment2.h"
#include "gfx_dimensions.h"
#include "config.h"
#include "PR/gbi.h"
#include "pc/controller/controller_keyboard.h"
#include "pc/network/network.h"
#include "audio_defines.h"
#include "audio/external.h"
#include "menu/file_select.h"
#define CHAT_DIALOG_MAX 96
#define CHAT_MESSAGES_MAX 16
#define CHAT_LIFE_MAX 400
struct ChatMessage {
u8 dialog[CHAT_DIALOG_MAX];
enum ChatMessageType type;
u16 life;
u8 color[3];
};
static char inputMessage[CHAT_DIALOG_MAX] = { 0 };
static struct ChatMessage message[CHAT_MESSAGES_MAX] = { 0 };
static u8 onMessageIndex = 0;
static u8 sInChatInput = FALSE;
#define CHAT_SCALE 0.5f
#define CHAT_SPACE 10.0f
#define CHATBOX_PAD_X 0.0215f
#define CHATBOX_SCALE_X 0.00385f
#define CHATBOX_SCALE_Y 0.115f
#define CHATBOX_X 2.0f
#define CHATBOX_Y 11.0f
#define CHAT_X 4.0f
#define CHAT_Y -18.0f
static void render_chat_message(struct ChatMessage* chatMessage, u8 index) {
f32 textWidth = get_generic_dialog_width(chatMessage->dialog);
f32 alphaScale = ((f32)chatMessage->life / (f32)(CHAT_LIFE_MAX / 20.0f));
alphaScale *= alphaScale;
if (alphaScale > 1) { alphaScale = 1; }
f32 chatBoxWidth = CHATBOX_SCALE_X * textWidth + CHATBOX_PAD_X;
create_dl_translation_matrix(MENU_MTX_PUSH, GFX_DIMENSIONS_FROM_LEFT_EDGE(CHATBOX_X), CHATBOX_Y + index * CHAT_SPACE, 0);
create_dl_scale_matrix(MENU_MTX_NOPUSH, chatBoxWidth, CHATBOX_SCALE_Y, 1.0f);
u8 boxR, boxG, boxB;
if (chatMessage->type == CMT_INPUT) {
boxR = 150;
boxG = 150;
boxB = 255;
} else {
f32 rgbScale = (((f32)chatMessage->life - ((f32)CHAT_LIFE_MAX * 0.98f)) / ((f32)CHAT_LIFE_MAX * 0.02f));
if (chatMessage->type == CMT_LOCAL || rgbScale < 0) { rgbScale = 0; }
boxR = 255 * rgbScale;
boxG = 255 * rgbScale;
boxB = 255 * rgbScale;
}
gDPSetEnvColor(gDisplayListHead++, boxR, boxG, boxB, 110 * alphaScale);
gSPDisplayList(gDisplayListHead++, dl_draw_text_bg_box);
create_dl_scale_matrix(MENU_MTX_NOPUSH, CHAT_SCALE / chatBoxWidth, CHAT_SCALE / CHATBOX_SCALE_Y, 1.0f);
u8 textR, textG, textB;
switch (chatMessage->type) {
case CMT_LOCAL: textR = 200; textG = 200; textB = 255; break;
case CMT_INPUT: textR = 0; textG = 0; textB = 0; break;
case CMT_SYSTEM: textR = 255; textG = 255; textB = 190; break;
default: textR = 255; textG = 255; textB = 255; break;
}
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, textR, textG, textB, 255 * alphaScale);
print_generic_string(CHAT_X, CHAT_Y, chatMessage->dialog);
if (chatMessage->type == CMT_REMOTE || chatMessage->type == CMT_SYSTEM) {
// if it's someone else's message, highlight the icon with their color
u8 starR = chatMessage->color[0];
u8 starG = chatMessage->color[1];
u8 starB = chatMessage->color[2];
gDPSetEnvColor(gDisplayListHead++, starR, starG, starB, 255 * alphaScale);
create_dl_translation_matrix(MENU_MTX_PUSH, CHAT_X, CHAT_Y, 0.0f);
render_generic_char(chatMessage->dialog[0]);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
void chat_add_message_ext(char* ascii, enum ChatMessageType chatMessageType, const u8 color[3]) {
u8 character = '?';
switch (chatMessageType) {
case CMT_INPUT:
case CMT_LOCAL: character = 0xFD; break;
case CMT_REMOTE: character = 0xFA; break;
case CMT_SYSTEM: character = 0xF9; break;
}
struct ChatMessage* msg = &message[onMessageIndex];
msg->dialog[0] = character;
msg->dialog[1] = 0x9E;
str_ascii_to_dialog(ascii, &msg->dialog[2], MIN(strlen(ascii), CHAT_DIALOG_MAX - 3));
msg->life = (sSelectedFileNum != 0) ? CHAT_LIFE_MAX : CHAT_LIFE_MAX / 3;
msg->type = chatMessageType;
msg->color[0] = color[0];
msg->color[1] = color[1];
msg->color[2] = color[2];
onMessageIndex = (onMessageIndex + 1) % CHAT_MESSAGES_MAX;
play_sound((msg->type == CMT_LOCAL) ? SOUND_MENU_MESSAGE_DISAPPEAR : SOUND_MENU_MESSAGE_APPEAR, gDefaultSoundArgs);
}
void chat_add_message(char* ascii, enum ChatMessageType chatMessageType) {
const u8 defaultColor[3] = { 255, 255, 255 };
chat_add_message_ext(ascii, chatMessageType, defaultColor);
}
static void chat_stop_input(void) {
sInChatInput = FALSE;
}
static void chat_send_input(void) {
}
void chat_start_input(void) {
}
void render_chat(void) {
u8 count = 0;
if (sInChatInput) {
}
u8 index = onMessageIndex;
for (int i = 0; i < CHAT_MESSAGES_MAX; i++) {
if (--index >= CHAT_MESSAGES_MAX) { index = CHAT_MESSAGES_MAX - 1; }
if (message[index].life == 0) { continue; }
render_chat_message(&message[index], count++);
message[index].life--;
}
}

View file

@ -1,16 +0,0 @@
#ifndef CHAT_H
#define CHAT_H
enum ChatMessageType {
CMT_LOCAL,
CMT_REMOTE,
CMT_SYSTEM,
CMT_INPUT,
};
void render_chat(void);
void chat_add_message(char* ascii, enum ChatMessageType chatMessageType);
void chat_add_message_ext(char* ascii, enum ChatMessageType chatMessageType, const u8 color[3]);
void chat_start_input(void);
#endif

View file

@ -32,7 +32,6 @@
#ifdef EXT_OPTIONS_MENU
#include "options_menu.h"
#endif
#include "chat.h"
u16 gDialogColorFadeTimer;
s8 gLastDialogLineNum;
@ -3114,8 +3113,8 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e)
s16 xOffset = get_str_x_pos_from_center(160, textContinueWithoutSaveArr[gInGameLanguage], 12.0f);
#else
u8 textSaveAndContinue[] = { TEXT_SAVE_AND_CONTINUE };
u8 textSaveAndQuit[] = { TEXT_SAVE_AND_QUIT };
u8 textSaveExitGame[] = { TEXT_SAVE_EXIT_GAME };
//u8 textSaveAndQuit[] = { TEXT_SAVE_AND_QUIT };
//u8 textSaveExitGame[] = { TEXT_SAVE_EXIT_GAME };
u8 textContinueWithoutSave[] = { TEXT_CONTINUE_WITHOUT_SAVING };
#endif
@ -3200,8 +3199,6 @@ s16 render_menus_and_dialogs() {
create_dl_ortho_matrix();
render_chat();
if (gMenuMode != -1) {
switch (gMenuMode) {
case 0:

View file

@ -17,7 +17,6 @@
#include "pc/pc_main.h"
#include "engine/math_util.h"
#include "menu/file_select.h"
#include "game/chat.h"
#include "src/pc/djui/djui.h"
static int keyboard_buttons_down;

View file

@ -273,3 +273,8 @@ void network_shutdown(void) {
gNetworkType = NT_NONE;
}
// TODO: REPLACE WITH A REAL CHAT
void chat_add_message(char* message) {
LOG_INFO("chat: %s", message);
}

View file

@ -101,4 +101,6 @@ void network_update(void);
void network_register_mod(char* modName);
void network_shutdown(void);
// TODO: replace with a real chat
void chat_add_message(char* message);
#endif

View file

@ -1,6 +1,5 @@
#include <stdio.h>
#include "network_player.h"
#include "game/chat.h"
#include "game/mario_misc.h"
#include "reservation_area.h"
#include "pc/debuglog.h"
@ -179,7 +178,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex) {
if (gNetworkType == NT_SERVER || type == NPT_SERVER) { gNetworkSystem->save_id(i, 0); }
for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; }
if (type == NPT_SERVER) { gNetworkPlayerServer = np; }
else { chat_add_message_ext("player connected", CMT_SYSTEM, get_player_color(np->globalIndex, 0)); }
else { chat_add_message("player connected"); }
LOG_INFO("player connected, local %d, global %d", i, np->globalIndex);
packet_ordered_clear(np->globalIndex);
return i;
@ -219,7 +218,7 @@ u8 network_player_disconnected(u8 globalIndex) {
gNetworkSystem->clear_id(i);
for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; }
LOG_INFO("player disconnected, local %d, global %d", i, globalIndex);
chat_add_message_ext("player disconnected", CMT_SYSTEM, get_player_color(globalIndex, 0));
chat_add_message("player disconnected");
packet_ordered_clear(globalIndex);
reservation_area_change(np);
return i;
@ -236,6 +235,6 @@ void network_player_shutdown(void) {
gNetworkSystem->clear_id(i);
}
chat_add_message("network shutdown", CMT_SYSTEM);
chat_add_message("network shutdown");
LOG_INFO("cleared all network players");
}

View file

@ -1,7 +1,6 @@
#include <stdio.h>
#include "../network.h"
#include "../reservation_area.h"
#include "game/chat.h"
#include "pc/debuglog.h"
#ifdef DEVELOPMENT
@ -55,7 +54,7 @@ void network_receive_chat(struct Packet* p) {
packet_read(p, &remoteMessage, remoteMessageLength * sizeof(u8));
// add the message
chat_add_message_ext(remoteMessage, CMT_REMOTE, rgb);
chat_add_message(remoteMessage);
LOG_INFO("rx chat: %s", remoteMessage);
/*
#ifdef DEVELOPMENT

View file

@ -9,7 +9,6 @@
#include "audio/external.h"
#include "engine/surface_collision.h"
#include "game/object_list_processor.h"
#include "game/chat.h"
#include "game/mario_misc.h"
#include "pc/configfile.h"
@ -324,7 +323,7 @@ void network_receive_player(struct Packet* p) {
// inform of player death
if (oldData.action != ACT_BUBBLED && data.action == ACT_BUBBLED) {
chat_add_message_ext("player died", CMT_SYSTEM, get_player_color(globalIndex, 0));
chat_add_message("player died");
}
// action changed, reset timer