Skip to content

Commit

Permalink
Merge pull request #100 from fallahn/golf-1.15
Browse files Browse the repository at this point in the history
Golf 1.15.1
  • Loading branch information
fallahn authored Jan 14, 2024
2 parents 5c706c7 + 4d88321 commit 57911b6
Show file tree
Hide file tree
Showing 26 changed files with 1,200 additions and 283 deletions.
2 changes: 1 addition & 1 deletion editor/src/WorldStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ bool WorldState::imageToArray(const cro::Image& img, const std::string& outpath)
if (file.is_open() && file.good())
{
file << "#pragma once\n\n#include <array>\n#include <crogine/graphics/Colour.hpp>\n\n";
file << "static const std::array<cro::Colour, " << colours.size() << "u> Colours =\n{\n";
file << "static constexpr inline std::array<cro::Colour, " << colours.size() << "u> Colours =\n{\n";

for (auto c : colours)
{
Expand Down
8 changes: 4 additions & 4 deletions libsocial/include/Social.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
Matt Marchant 2022 - 2023
Matt Marchant 2022 - 2024
http://trederia.blogspot.com
Super Video Golf - zlib licence.
Expand Down Expand Up @@ -48,11 +48,11 @@ source distribution.
//(player avatar data format changed 1110 -> 1120)
//(ball started sending wind effect 1120 -> 1124)
//(added night mode/weather 1141 -> 1150)
static constexpr std::uint16_t CURRENT_VER = 1150;
static constexpr std::uint16_t CURRENT_VER = 1151;
#ifdef __APPLE__
static const std::string StringVer("1.15.0 (macOS beta)");
static const std::string StringVer("1.15.1 (macOS beta)");
#else
static const std::string StringVer("1.15.0");
static const std::string StringVer("1.15.1");
#endif

struct HallEntry final
Expand Down
4 changes: 2 additions & 2 deletions samples/golf/buildnumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef BUILD_NUMBER_H_
#define BUILD_NUMBER_H_

#define BUILDNUMBER 3690
#define BUILDNUMBER_STR "3690"
#define BUILDNUMBER 3733
#define BUILDNUMBER_STR "3733"

#endif /* BUILD_NUMBER_H_ */
Binary file modified samples/golf/golf.aps
Binary file not shown.
10 changes: 5 additions & 5 deletions samples/golf/golf.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ IDI_ICON1 ICON "icon.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,14,1,0
PRODUCTVERSION 1,14,1,0
FILEVERSION 1,15,1,0
PRODUCTVERSION 1,15,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Trederia"
VALUE "FileDescription", "Super Video Golf"
VALUE "FileVersion", "1.14.1.0"
VALUE "FileVersion", "1.15.1.0"
VALUE "InternalName", "golf.exe"
VALUE "LegalCopyright", "Copyright (C) 2023 Trederia Games"
VALUE "LegalCopyright", "Copyright (C) 2024 Trederia Games"
VALUE "OriginalFilename", "golf.exe"
VALUE "ProductName", "Super Video Golf"
VALUE "ProductVersion", "1.14.1.0"
VALUE "ProductVersion", "1.15.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion samples/golf/src/Colordome-32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace CD32
{
static constexpr std::array<cro::Colour, 32u> Colours =
static inline constexpr std::array<cro::Colour, 32u> Colours =
{
cro::Colour(0xd0b0dff),
cro::Colour(0xfff8e1ff),
Expand Down
6 changes: 4 additions & 2 deletions samples/golf/src/golf/GameConsts.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
Matt Marchant 2021 - 2023
Matt Marchant 2021 - 2024
http://trederia.blogspot.com
Super Video Golf - zlib licence.
Expand Down Expand Up @@ -150,14 +150,16 @@ struct WeatherType final
enum
{
Clear, Rain, Showers, Mist,
Random,
Count,
Snow
};
};
static inline const std::array<cro::String, WeatherType::Count> WeatherStrings =
{
"Clear", "Rain",
"Showers", "Mist"
"Showers", "Mist",
"Random"
};

struct MRTIndex final
Expand Down
45 changes: 28 additions & 17 deletions samples/golf/src/golf/GolfState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ GolfState::GolfState(cro::StateStack& stack, cro::State::Context context, Shared
m_courseIndex (getCourseIndex(sd.mapDirectory.toAnsiString())),
m_emoteWheel (sd, m_currentPlayer, m_textChat)
{
if (sd.weatherType == WeatherType::Random)
{
sd.weatherType = cro::Util::Random::value(WeatherType::Clear, WeatherType::Mist);
}

sd.holesPlayed = 0;
m_cpuGolfer.setFastCPU(m_sharedData.fastCPU);

Expand Down Expand Up @@ -345,13 +350,13 @@ bool GolfState::handleEvent(const cro::Event& evt)
case SDLK_ESCAPE:
if (m_textChat.isVisible())
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, true);
}
break;
case SDLK_F8:
if (evt.key.keysym.mod & KMOD_SHIFT)
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, true);
}
break;
}
Expand Down Expand Up @@ -476,7 +481,7 @@ bool GolfState::handleEvent(const cro::Event& evt)
case SDLK_F8:
if (evt.key.keysym.mod & KMOD_SHIFT)
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, true);
}
break;
case SDLK_F9:
Expand Down Expand Up @@ -515,14 +520,14 @@ bool GolfState::handleEvent(const cro::Event& evt)
case SDLK_F10:
m_sharedData.clientConnection.netClient.sendPacket(PacketID::ServerCommand, std::uint16_t(ServerCommand::ChangeWind), net::NetFlag::Reliable);
break;
case SDLK_KP_0:
setActiveCamera(CameraID::Idle);
{
/*static bool hidden = false;
m_activeAvatar->model.getComponent<cro::Model>().setHidden(!hidden);
hidden = !hidden;*/
}
break;
//case SDLK_KP_0: //used by emote quick key
// setActiveCamera(CameraID::Idle);
//{
// /*static bool hidden = false;
// m_activeAvatar->model.getComponent<cro::Model>().setHidden(!hidden);
// hidden = !hidden;*/
//}
// break;
case SDLK_KP_1:
//setActiveCamera(1);
//m_cameras[CameraID::Sky].getComponent<CameraFollower>().state = CameraFollower::Zoom;
Expand Down Expand Up @@ -561,15 +566,15 @@ bool GolfState::handleEvent(const cro::Event& evt)
msg->level = 19;
}
break;
case SDLK_KP_7:
/*case SDLK_KP_7: //taken over by emote quick key
{
auto* msg2 = cro::App::getInstance().getMessageBus().post<GolfEvent>(MessageID::GolfMessage);
msg2->type = GolfEvent::BirdHit;
msg2->position = m_currentPlayer.position;
float rot = glm::eulerAngles(m_cameras[m_currentCamera].getComponent<cro::Transform>().getWorldRotation()).y;
msg2->travelDistance = rot;
}
break;
break;*/
//used in font smoothing debug GolfGame.cpp
/*case SDLK_KP_MULTIPLY:
{
Expand Down Expand Up @@ -673,7 +678,7 @@ bool GolfState::handleEvent(const cro::Event& evt)
case SDLK_ESCAPE:
if (m_textChat.isVisible())
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, true);
break;
}
[[fallthrough]];
Expand All @@ -685,15 +690,19 @@ bool GolfState::handleEvent(const cro::Event& evt)
toggleQuitReady();
break;
case SDLK_7:
case SDLK_KP_7:
m_textChat.quickEmote(TextChat::Applaud);
break;
case SDLK_8:
case SDLK_KP_8:
m_textChat.quickEmote(TextChat::Happy);
break;
case SDLK_9:
case SDLK_KP_9:
m_textChat.quickEmote(TextChat::Laughing);
break;
case SDLK_0:
case SDLK_KP_0:
m_textChat.quickEmote(TextChat::Angry);
break;
}
Expand Down Expand Up @@ -731,7 +740,7 @@ bool GolfState::handleEvent(const cro::Event& evt)
break;
case cro::GameController::ButtonTrackpad:
case cro::GameController::PaddleR4:
m_textChat.toggleWindow(true);
m_textChat.toggleWindow(true, true);
break;
}
}
Expand Down Expand Up @@ -3145,7 +3154,8 @@ void GolfState::spawnBall(const ActorInfo& info)
m_ballModels[ballID]->createModel(entity);
applyMaterialData(*m_ballModels[ballID], material);
#ifdef USE_GNS
if (ball->workshopID)
if (ball->workshopID
&& info.clientID == m_sharedData.localConnectionData.connectionID)
{
std::vector<std::uint64_t> v;
v.push_back(ball->workshopID);
Expand Down Expand Up @@ -4922,7 +4932,8 @@ void GolfState::setCurrentHole(std::uint16_t holeInfo)
#ifdef USE_GNS
m_sharedData.minimapData.courseName += Social::getLeader(m_sharedData.mapDirectory, m_sharedData.holeCount);
#endif
m_sharedData.minimapData.courseName += "\nHole: " + std::to_string(m_sharedData.minimapData.holeNumber + 2); //this isn't updated until the map texture is
std::int32_t offset = m_sharedData.reverseCourse ? 0 : 2;
m_sharedData.minimapData.courseName += "\nHole: " + std::to_string(m_sharedData.minimapData.holeNumber + offset); //this isn't updated until the map texture is
m_sharedData.minimapData.courseName += "\nPar: " + std::to_string(m_holeData[m_currentHole].par);
m_gameScene.getDirector<GolfSoundDirector>()->setCrowdPositions(m_holeData[m_currentHole].crowdPositions);
}
Expand Down
8 changes: 5 additions & 3 deletions samples/golf/src/golf/GolfStateAssets.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
Matt Marchant 2021 - 2023
Matt Marchant 2021 - 2024
http://trederia.blogspot.com
Super Video Golf - zlib licence.
Expand Down Expand Up @@ -1893,7 +1893,8 @@ void GolfState::loadModels()
e.getComponent<cro::Model>().setHidden(entity.getComponent<cro::Model>().isHidden());
};

if (m_sharedData.hairInfo[hairID].workshopID)
if (m_sharedData.hairInfo[hairID].workshopID
&& i == m_sharedData.localConnectionData.connectionID)
{
m_modelStats.push_back(m_sharedData.hairInfo[hairID].workshopID);
}
Expand All @@ -1905,7 +1906,8 @@ void GolfState::loadModels()
entity.getComponent<cro::Model>().setRenderFlags(~RenderFlags::CubeMap);
m_avatars[i][j].model = entity;

if (m_sharedData.avatarInfo[avatarIndex].workshopID)
if (m_sharedData.avatarInfo[avatarIndex].workshopID
&& i == m_sharedData.localConnectionData.connectionID)
{
m_modelStats.push_back(m_sharedData.avatarInfo[avatarIndex].workshopID);
}
Expand Down
8 changes: 4 additions & 4 deletions samples/golf/src/golf/GolfStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ void GolfState::showCountdown(std::uint8_t seconds)
Achievements::incrementStat(StatStrings[StatID::PlaysInClearWeather + m_sharedData.weatherType]);

std::int32_t weatherProgress = 0;
for (auto i = 0; i < WeatherType::Count; ++i)
for (auto i = 0; i < WeatherType::Random; ++i)
{
if (Achievements::getStat(StatStrings[StatID::PlaysInClearWeather + i])->value != 0)
{
Expand Down Expand Up @@ -4785,7 +4785,7 @@ bool GolfState::EmoteWheel::handleEvent(const cro::Event& evt)
return true;
}

switch (evt.key.keysym.sym)
/*switch (evt.key.keysym.sym)
{
default: break;
case SDLK_7:
Expand All @@ -4808,7 +4808,7 @@ bool GolfState::EmoteWheel::handleEvent(const cro::Event& evt)
cooldown = 6.f;
buttonNodes[7].getComponent<cro::Callback>().active = true;
return true;
}
}*/
}
}

Expand Down Expand Up @@ -4883,7 +4883,7 @@ bool GolfState::EmoteWheel::handleEvent(const cro::Event& evt)
//consume this so we don't mess with the swing
return true;
case cro::GameController::ButtonX:
m_textChat.toggleWindow(true);
m_textChat.toggleWindow(true, true);
//close emote wheel automatically
targetScale = 0.f;
return true;
Expand Down
6 changes: 3 additions & 3 deletions samples/golf/src/golf/MapOverviewState.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
Matt Marchant 2021 - 2023
Matt Marchant 2021 - 2024
http://trederia.blogspot.com
Super Video Golf - zlib licence.
Expand Down Expand Up @@ -395,8 +395,8 @@ bool MapOverviewState::simulate(float dt)
auto zoom = -cro::GameController::getAxisPosition(controllerID, cro::GameController::AxisRightY);
if (zoom < -LeftThumbDeadZone || zoom > LeftThumbDeadZone)
{
zoom /= cro::GameController::AxisMax;
m_zoomScale = std::clamp(m_zoomScale + (2.f * zoom * m_zoomScale * dt), MinZoom, MaxZoom);
float zoomRatio = static_cast<float>(zoom) / cro::GameController::AxisMax;
m_zoomScale = std::clamp(m_zoomScale + (2.f * zoomRatio * m_zoomScale * dt), MinZoom, MaxZoom);
rescaleMap();
}
}
Expand Down
6 changes: 3 additions & 3 deletions samples/golf/src/golf/MenuState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ bool MenuState::handleEvent(const cro::Event& evt)
case SDLK_ESCAPE:
if (m_textChat.isVisible())
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, false);
}
break;
/*case SDLK_F8:
Expand Down Expand Up @@ -806,7 +806,7 @@ bool MenuState::handleEvent(const cro::Event& evt)
if ((evt.key.keysym.mod & KMOD_SHIFT)
&& m_currentMenu == MenuID::Lobby)
{
m_textChat.toggleWindow(false);
m_textChat.toggleWindow(false, false);
}
break;
}
Expand Down Expand Up @@ -872,7 +872,7 @@ bool MenuState::handleEvent(const cro::Event& evt)
case cro::GameController::ButtonY:
if (m_currentMenu == MenuID::Lobby)
{
m_textChat.toggleWindow(true);
m_textChat.toggleWindow(true, false);
}
break;
}
Expand Down
2 changes: 2 additions & 0 deletions samples/golf/src/golf/OptionsState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,7 @@ void OptionsState::buildAVMenu(cro::Entity parent, const cro::SpriteSheet& sprit
{
m_sharedData.showBeacon = !m_sharedData.showBeacon;
m_audioEnts[AudioID::Accept].getComponent<cro::AudioEmitter>().play();
m_scene.getActiveCamera().getComponent<cro::Camera>().active = true;
}
});

Expand Down Expand Up @@ -2125,6 +2126,7 @@ void OptionsState::buildAVMenu(cro::Entity parent, const cro::SpriteSheet& sprit
{
m_sharedData.showPuttingPower = !m_sharedData.showPuttingPower;
m_audioEnts[AudioID::Accept].getComponent<cro::AudioEmitter>().play();
m_scene.getActiveCamera().getComponent<cro::Camera>().active = true;
}
});

Expand Down
Loading

0 comments on commit 57911b6

Please sign in to comment.