Skip to content

Commit

Permalink
chat stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
fallahn committed Aug 22, 2023
1 parent 4e53ac8 commit 78a21ac
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
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 1314
#define BUILDNUMBER_STR "1314"
#define BUILDNUMBER 1319
#define BUILDNUMBER_STR "1319"

#endif /* BUILD_NUMBER_H_ */
11 changes: 11 additions & 0 deletions samples/golf/src/GolfGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ void GolfGame::handleEvent(const cro::Event& evt)
switch (evt.type)
{
default: break;
case SDL_MOUSEMOTION:
cro::App::getWindow().setMouseCaptured(false);
break;
case SDL_KEYUP:
switch (evt.key.keysym.sym)
{
Expand All @@ -231,6 +234,14 @@ void GolfGame::handleEvent(const cro::Event& evt)
case SDLK_KP_PLUS:
togglePixelScale(m_sharedData, true);
break;
#ifdef USE_GNS
case SDLK_F8:
if (evt.key.keysym.mod & KMOD_SHIFT)
{
//Social::toggleChat();
}
break;
#endif
}
break;
}
Expand Down
17 changes: 12 additions & 5 deletions samples/golf/src/golf/BallSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ bool BallSystem::setHoleData(HoleData& holeData, bool rebuildMesh)
holeData.pin.y = getTerrain(holeData.pin).intersection.y;
holeData.puttFromTee = m_puttFromTee;

//m_gimmeRadius = m_puttFromTee ? 0 : m_activeGimme;

for (auto entity : getEntities())
{
entity.getComponent<cro::Transform>().setPosition(holeData.tee);
Expand All @@ -238,7 +236,7 @@ const BullsEye& BallSystem::spawnBullsEye()
}

m_bullsEye.position = m_holeData->target;
m_bullsEye.spawn = true;// !m_puttFromTee;
m_bullsEye.spawn = true;
return m_bullsEye;
}

Expand Down Expand Up @@ -665,7 +663,16 @@ void BallSystem::processEntity(cro::Entity entity, float dt)
//ball.delay = 0.f;
return;
}

//if we went OOB in a putting course we
//want to quit immediately, not wait for the velocity to stop
else if (ball.terrain == TerrainID::Water
|| ball.terrain == TerrainID::Scrub)
{
ball.state = Ball::State::Reset;
ball.delay = BallTurnDelay / 2.f;
ball.velocity = glm::vec3(0.f);
return;
}

//rotate based on velocity
auto vel2 = glm::length2(ball.velocity);
Expand All @@ -687,7 +694,7 @@ void BallSystem::processEntity(cro::Entity entity, float dt)
{
ball.velocity = glm::vec3(0.f);

if (ball.terrain == TerrainID::Water
if (ball.terrain == TerrainID::Water //TODO this should never be true because of the above check
|| ball.terrain == TerrainID::Scrub)
{
ball.state = Ball::State::Reset;
Expand Down
1 change: 1 addition & 0 deletions samples/golf/src/golf/BilliardsState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ bool BilliardsState::handleEvent(const cro::Event& evt)
case SDLK_F4:
//addPocketBall(1);
break;
//F8 toggles chat!
case SDLK_HOME:
m_gameScene.getSystem<BilliardsCollisionSystem>()->toggleDebug();
break;
Expand Down
1 change: 1 addition & 0 deletions samples/golf/src/golf/DrivingState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ bool DrivingState::handleEvent(const cro::Event& evt)
case SDLK_F7:
floatingMessage("buns");
break;
//F8 toggles chat!
case SDLK_HOME:
debugFlags = (debugFlags == 0) ? BulletDebug::DebugFlags : 0;
m_gameScene.getSystem<BallSystem>()->setDebugFlags(debugFlags);
Expand Down
5 changes: 3 additions & 2 deletions samples/golf/src/golf/GolfState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,12 @@ bool GolfState::handleEvent(const cro::Event& evt)
//Achievements::awardAchievement(AchievementStrings[AchievementID::SkinOfYourTeeth]);
break;
case SDLK_F8:
{
LogW << "Toggles chat window!" << std::endl;
/*{
m_sharedData.hqShadows = !m_sharedData.hqShadows;
auto* msg = getContext().appInstance.getMessageBus().post<SystemEvent>(MessageID::SystemMessage);
msg->type = SystemEvent::ShadowQualityChanged;
}
}*/
break;
case SDLK_F10:
m_sharedData.clientConnection.netClient.sendPacket(PacketID::ServerCommand, std::uint8_t(ServerCommand::ChangeWind), net::NetFlag::Reliable);
Expand Down
4 changes: 3 additions & 1 deletion samples/golf/src/golf/GolfStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3141,12 +3141,14 @@ void GolfState::showMessageBoard(MessageBoardID messageType, bool special)
if (!m_sharedData.localConnectionData.playerData[m_currentPlayer.player].isCPU)
{
m_achievementTracker.eagles++;

LogI << "Wiggle wiggle" << std::endl;
if (m_sharedData.holeCount == 2
|| m_currentHole > 8)
{
LogI << "Oi OI" << std::endl;
if (m_courseIndex != -1)
{
LogI << "Pass the toilet paper" << std::endl;
Social::getMonthlyChallenge().updateChallenge(ChallengeID::Ten, m_courseIndex);
}
}
Expand Down

0 comments on commit 78a21ac

Please sign in to comment.