additions

This commit is contained in:
2026-05-24 00:40:45 +03:00
parent c5aef33171
commit c55a34f33c
42 changed files with 5019 additions and 2331 deletions

View File

@@ -2,7 +2,7 @@
sysroot = "/home/kotofyt/Downloads/wasi-sysroot-29.0/"
[aarch64-apple-ios]
sysroot = "/home/kotofyt/clones/yay/xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
sysroot = "/home/kotofyt/Downloads/xcode/Xcode_26.1_Apple_silicon/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
[x86_64-apple-ios]
sysroot = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"

3
.gitmodules vendored
View File

@@ -31,9 +31,6 @@
[submodule "external/funnystdlib"]
path = external/funnystdlib
url = https://github.com/KoT3isGood/funnystdlib.git
[submodule "external/SPIRV-Tools"]
path = external/SPIRV-Tools
url = https://github.com/KoT3isGood/SPIRV-Tools.git
[submodule "external/SPIRV-Headers"]
path = external/SPIRV-Headers
url = https://github.com/KhronosGroup/SPIRV-Headers

View File

@@ -38,6 +38,8 @@ DECLARE_BUILD_STAGE(install_game)
if ( GET_PROJECT_VALUE(config, "bundle") == "true" ) {
return 0;
}
filesystem2->MakeDirectory(CUtlString("%s/core/",szOutputDir.GetString()));
filesystem2->CopyFile(szOutputDir, GET_PROJECT_OBJECT(launcher, "launcher"));
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/maps");
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/models");

View File

@@ -11,7 +11,7 @@ DECLARE_BUILD_STAGE(config)
ADD_OUTPUT_VALUE("bundle", "true");
}
if (Target_t::DefaultTarget().GetTriplet() == "x86_64-unknown-linux")
if (Target_t::DefaultTarget().GetTriplet() == "x86_64-unknown-linux-gnu")
{
ADD_OUTPUT_VALUE("static", "false");
ADD_OUTPUT_VALUE("bundle", "false");

View File

@@ -26,9 +26,13 @@ DECLARE_BUILD_STAGE(engine)
"sv_dll.cpp",
"cl_dll.cpp",
"miniaudio.cpp",
"kotgui.cpp",
};
if ( GET_PROJECT_VALUE(config, "static") == "true" )
if ( GET_PROJECT_VALUE(config, "steam") == "true" )
{
compileProject.files.AppendTail("steamnetwork.cpp");
}
@@ -39,6 +43,7 @@ DECLARE_BUILD_STAGE(engine)
"../external/cglm/include",
FUNNYSTDLIB"public",
EXTERNAL"steamworks/public",
EXTERNAL
};
if ( GET_PROJECT_VALUE(config, "steam") == "true" )
compileProject.macros.AppendTail({"STEAM", "TRUE"});

View File

@@ -56,7 +56,6 @@ extern "C" void FunnyMain( int argc, char **argv )
CommandLine()->CreateCommandLine(argc, argv);
EngineConsts_t stConstants = {};
V_printf("------------ 1\n");
#ifdef STEAM
V_printf("Steam :)\n");
if(SteamAPI_RestartAppIfNecessary(480))
@@ -74,7 +73,7 @@ extern "C" void FunnyMain( int argc, char **argv )
stConstants.LaunchServer = LaunchServerAtSteamRelay;
stConstants.ConnectSteamServer = ConnectBySteamID;
//SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Debug, SteamAPIDebug);
SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg, SteamAPIDebug);
#endif
stConstants.m_bIsDedicated = CommandLine()->CheckParam("-dedicated");
stConstants.LaunchLocalBridge = LaunchLocalBridge;
@@ -121,6 +120,15 @@ extern "C" void FunnyMain( int argc, char **argv )
Console()->Execute();
double fPrevious = Plat_GetTime();
for (;;) {
if (!stConstants.m_bIsDedicated)
{
if (pWindow->IsValid() == false)
{
g_pWindowManager->DestroyWindow(pWindow);
break;
}
}
#ifdef STEAM
SteamAPI_RunCallbacks();
#endif
@@ -149,7 +157,14 @@ extern "C" void FunnyMain( int argc, char **argv )
fCurrent = Plat_GetTime();
};
g_pClientGame->Shutdown();
g_pServerGame->Shutdown();
g_pRenderContext->Shutdown();
Console()->Shutdown();
#ifdef STEAM
SteamAPI_Shutdown();
#endif
};

31
engine/kotgui.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include "kotgui/kotgui.h"
class CKotUIManager: public IKotUIManager
{
public:
virtual void BeginDrawing() = 0;
virtual void EndDrawing() = 0;
virtual IRenderContext *GetContext() = 0;
virtual IShader *GetShader( EKotUIShader eShader ) = 0;
virtual IRenderCommandList *GetCommandList() = 0;
};
namespace kotgui
{
void DrawText(
Alignment_t position,
Alignment_t offset,
float fRotation,
Color4 color,
uint32_t *pText,
uint32_t uSize,
IRenderFont *pFont,
float fTextSize
)
{
}
}

25
engine/miniaudio.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include "iaudio.h"
#include "miniaudio.h"
class CAudioPlayer
{
public:
virtual void StartAt( double fTime ) = 0;
virtual double GetPlayTime() = 0;
virtual double Stop() = 0;
virtual void Continue() = 0;
};
class CAudio
{
public:
virtual IAudioPlayer *SpawnPlayer() = 0;
};
class CAudioManager: public IAppSystem
{
public:
virtual void CreateAudio( const char *szFile ) = 0;
virtual void SetEarsPosition( Vector v ) = 0;
virtual void SetEarsRotation( Quat q ) = 0;
};

View File

@@ -182,7 +182,20 @@ void CSteamNetworkServer::ClientConnected( SteamNetConnectionStatusChangedCallba
callback.m_ullUserConnection = pParam->m_hConn;
m_pInterface->SetConnectionPollGroup(pParam->m_hConn, m_hPollGroup);
m_hConnections.AppendTail(pParam->m_hConn);
break;
case k_ESteamNetworkingConnectionState_ClosedByPeer:
case k_ESteamNetworkingConnectionState_ProblemDetectedLocally:
callback.m_eType = NET_DISCONNECTED;
callback.m_ullUserID = pParam->m_info.m_identityRemote.GetSteamID64();
callback.m_ullUserConnection = pParam->m_hConn;
for ( int i = 0; i < m_hConnections.GetSize(); i++ )
{
m_pInterface->CloseConnection(pParam->m_hConn, 0, "Connection denied", 0);
if (m_hConnections[i] != pParam->m_hConn)
continue;
m_hConnections.RemoveAt(i);
break;
}
break;
default:
break;

2
external/SDL vendored

Submodule external/SPIRV-Tools deleted from 0436c4b055

2
external/cglm vendored

6976
external/miniaudio.h vendored

File diff suppressed because it is too large Load Diff

2
external/slang vendored

2
external/stb vendored

2
external/volk vendored

2
external/xtool vendored

View File

View File

View File

@@ -239,6 +239,15 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket )
}
}
break;
case k_EMessage_EntityDeleted:
C_BaseEntity **ppEntities = m_pEntities;
for ( int i = 0; i < MAX_EDICTS; i++ )
{
if (ppEntities[i] == NULL)
{
}
}
default:
break;
}

View File

@@ -280,6 +280,29 @@ CBaseEntity **CEntitySystem::GetEntities()
return m_pEntities;
}
void CEntitySystem::DestroyEntityByIndex( uint32_t uIndex )
{
if ( uIndex >= MAX_EDICTS )
return;
if (m_pEntities[uIndex])
{
delete m_pEntities[uIndex];
m_pEntities[uIndex] = 0;
}
EntityDelete_t stClassSync = {
k_EMessage_EntityDeleted,
uIndex,
};
if (g_pCurrentConnection)
g_pCurrentConnection->SendPacket({&stClassSync, sizeof(stClassSync), 0, PACKET_MUST_ARRIVE});
}
void CEntitySystem::DestroyEntityByPtr( CBaseEntity *pEntity )
{
}
void CEntitySystem::SetAllowedEntityForPlayer( uint64_t ullPlayer, CBaseEntity *pEntity )
{
if (pEntity)

View File

@@ -27,6 +27,9 @@ public:
virtual void Think( float fDelta );
virtual CBaseEntity **GetEntities();
virtual void DestroyEntityByIndex( uint32_t uIndex );
virtual void DestroyEntityByPtr( CBaseEntity *pEntity );
virtual void NetRecvPacket( NetPacket_t *pPacket );
virtual void NetSendThink( INetworkBase *pBase );
virtual void SetAllowedEntityForPlayer( uint64_t ullPlayer, CBaseEntity *pEntity );

View File

@@ -79,6 +79,21 @@ uint32_t NET_ServerCallback( NetCallback_t *pCallback )
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), pCallback->m_ullUserConnection, PACKET_MUST_ARRIVE});
return 1;
}
if (pCallback->m_eType == NET_DISCONNECTED)
{
V_printf("user %llu has disconnected, bye!\n", pCallback->m_ullUserID);
CBaseEntity **ppEntitites = EntitySystem()->GetEntities();
for ( int i = 0; i < MAX_EDICTS; i++ )
{
if (ppEntitites[i] == NULL)
continue;
if (ppEntitites[i]->m_ullOwner != pCallback->m_ullUserConnection)
continue;
EntitySystem()->DestroyEntityByIndex(i);
}
}
return 0;
}

View File

@@ -21,6 +21,8 @@ EngineConsts_t *g_pEngineConstants;
IPhysics *g_pPhysics;
IPhysicsWorld *g_pPhysicsWorld;
IKotUIManager *g_pKotUI;
CreateInterfaceFn GetEngineFactory()
{
return Sys_GetFactory("engine");

View File

@@ -9,6 +9,7 @@
#include "networkbase.h"
#include "iphysics.h"
#include "ihumandevice.h"
#include "kotgui/kotgui.h"
class CEngineVars
{
@@ -39,6 +40,8 @@ extern EngineConsts_t *g_pEngineConstants;
extern IPhysics *g_pPhysics;
extern IPhysicsWorld *g_pPhysicsWorld;
extern IKotUIManager *g_pKotUI;
#define FUNNY_SECURE_PORT 27015
#define FUNNY_QUERY_PORT 27016

View File

@@ -26,6 +26,7 @@ enum EMessageType: uint32_t
k_EMessage_PlayerSetLocalEntity,
k_EMessage_ResetEntities,
k_EMessage_EntityDeleted,
};
struct PlayerJoined_t
@@ -53,6 +54,12 @@ struct EntityClass_t
int8_t m_szEntityName[256];
};
struct EntityDelete_t
{
EMessageType m_eType;
CNetworkProtocolUInt32 m_uIndex;
};
struct EntityDataSync_t
{
EMessageType m_eType;
@@ -81,6 +88,7 @@ union PlayerPacket_t
EntityClass_t m_entityClass;
EntityDataSync_t m_entityData;
SetLocalEntity_t m_setLocalEntity;
EntityDelete_t m_deleteEntity;
};
#endif

View File

@@ -41,8 +41,6 @@ EngineMainFn pEngineMain;
extern "C" void FunnyMain( int argc, char **argv );
int main( int argc, char **argv ) {
printf("HIIII!\n");
return 0;
#ifdef __linux__
readlink("/proc/self/exe",szLauncherPath, MAX_PATH);
dirname(szLauncherPath);
@@ -83,6 +81,7 @@ int main( int argc, char **argv ) {
pEngineMain(argc, argv);
dlclose(pEngineLib);
return 0;
#endif
#ifdef __WIN32__
GetModuleFileNameA(NULL, szLauncherPath, MAX_PATH);
@@ -102,6 +101,6 @@ int main( int argc, char **argv ) {
SetCurrentDirectoryA(szLauncherPath);
pEngineMain(argc, argv);
#endif
FunnyMain(argc, argv);
return 0;
//FunnyMain(argc, argv);
//return 0;
};

View File

@@ -31,6 +31,8 @@ public:
virtual void *CreateVulkanSurface( void *pInstance ) override;
virtual void DestroyVulkanSurface( void *pInstance ) override;
virtual bool IsValid() override;
SDL_WindowID WindowID();
KeyCallbackFn m_fnKeyCallback = NULL;
@@ -40,6 +42,8 @@ public:
uint32_t m_uRenderWidth;
uint32_t m_uRenderHeight;
bool m_bIsValid = true;
private:
VkSurfaceKHR m_hSurface;
@@ -60,7 +64,7 @@ void CSDLGameWindow::Init()
void CSDLGameWindow::Shutdown()
{
SDL_DestroyWindow(m_pWindow);
}
void CSDLGameWindow::Frame( float fDelta )
@@ -122,6 +126,11 @@ SDL_WindowID CSDLGameWindow::WindowID()
return SDL_GetWindowID(m_pWindow);
}
bool CSDLGameWindow::IsValid()
{
return m_bIsValid;
}
class CSDLGameWindowManager: public IGameWindowManager
{
public:
@@ -239,6 +248,8 @@ void CSDLGameWindowManager::Frame( float fDelta )
pWindow = a;
break;
}
if (pWindow == NULL)
continue;
switch (event.type)
{
@@ -267,7 +278,7 @@ void CSDLGameWindowManager::Frame( float fDelta )
break;
case SDL_EVENT_QUIT:
Plat_Exit(0);
pWindow->m_bIsValid = false;
break;
default:
break;
@@ -290,6 +301,7 @@ IGameWindow *CSDLGameWindowManager::CreateWindow()
void CSDLGameWindowManager::DestroyWindow( IGameWindow* pWindow )
{
pWindow->Shutdown();
delete (CSDLGameWindow*)pWindow;
}

View File

@@ -820,7 +820,7 @@ void CVkRenderContext::Init()
stAllocatorInfo.device = s_vkDevice;
stAllocatorInfo.instance = s_vkInstance;
VmaVulkanFunctions vulkanFunctions;
VmaVulkanFunctions vulkanFunctions = {};
vmaImportVulkanFunctionsFromVolk(&stAllocatorInfo, &vulkanFunctions);
stAllocatorInfo.pVulkanFunctions = &vulkanFunctions;

View File

@@ -484,7 +484,7 @@ case 5300: return 7;
case 5301: return 7;
case 5302: return 5;
case 5303: return 4;
case 5304: return 4;
case 5304: return 5;
case 5305: return 7;
case 5306: return 8;
case 5307: return 3;
@@ -812,7 +812,7 @@ case 6086: return 2;
case 6090: return 1;
case 6091: return 1;
case 6092: return 1;
case 6096: return 3;
case 6096: return 1;
case 6116: return 3;
case 6117: return 3;
case 6142: return 3;
@@ -839,6 +839,8 @@ case 6251: return 4;
case 6252: return 6;
case 6253: return 3;
case 6254: return 3;
case 6258: return 6;
case 6259: return 4;
case 6401: return 5;
case 6402: return 5;
case 6403: return 5;
@@ -3656,6 +3658,7 @@ pTypes[0] = k_ESpirv_RefId;
pTypes[1] = k_ESpirv_RefId;
pTypes[2] = k_ESpirv_RefId;
pTypes[3] = k_ESpirv_RefId;
pTypes[4] = k_ESpirv_RefId;
break;
case 5305:
pTypes[0] = k_ESpirv_RefId;
@@ -5531,9 +5534,7 @@ case 6092:
pTypes[0] = k_ESpirv_RefId;
break;
case 6096:
pTypes[0] = k_ESpirv_ResultTypeId;
pTypes[1] = k_ESpirv_ResultId;
pTypes[2] = k_ESpirv_RefId;
pTypes[0] = k_ESpirv_RefId;
break;
case 6116:
pTypes[0] = k_ESpirv_ResultTypeId;
@@ -5693,6 +5694,18 @@ pTypes[0] = k_ESpirv_ResultTypeId;
pTypes[1] = k_ESpirv_ResultId;
pTypes[2] = k_ESpirv_RefId;
break;
case 6258:
pTypes[0] = k_ESpirv_ResultTypeId;
pTypes[1] = k_ESpirv_ResultId;
pTypes[2] = k_ESpirv_RefId;
pTypes[3] = k_ESpirv_RefId;
pTypes[4] = k_ESpirv_RefId;
break;
case 6259:
pTypes[0] = k_ESpirv_RefId;
pTypes[1] = k_ESpirv_RefId;
pTypes[2] = k_ESpirv_RefId;
break;
case 6401:
pTypes[0] = k_ESpirv_ResultTypeId;
pTypes[1] = k_ESpirv_ResultId;
@@ -8395,12 +8408,12 @@ break;
case 5147:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_Array;
break;
case 5148:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_Array;
break;
case 5158:
pTypes[0] = k_ESpirvOperandFlags_None;
@@ -8756,6 +8769,7 @@ pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_None;
pTypes[3] = k_ESpirvOperandFlags_None;
pTypes[4] = k_ESpirvOperandFlags_Optional;
break;
case 5305:
pTypes[0] = k_ESpirvOperandFlags_None;
@@ -10902,9 +10916,7 @@ case 6092:
pTypes[0] = k_ESpirvOperandFlags_Array;
break;
case 6096:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_Array;
pTypes[0] = k_ESpirvOperandFlags_Array;
break;
case 6116:
pTypes[0] = k_ESpirvOperandFlags_None;
@@ -11081,6 +11093,20 @@ pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_Array;
break;
case 6258:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_None;
pTypes[3] = k_ESpirvOperandFlags_None;
pTypes[4] = k_ESpirvOperandFlags_None;
pTypes[5] = k_ESpirvOperandFlags_Optional;
break;
case 6259:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;
pTypes[2] = k_ESpirvOperandFlags_None;
pTypes[3] = k_ESpirvOperandFlags_Optional;
break;
case 6401:
pTypes[0] = k_ESpirvOperandFlags_None;
pTypes[1] = k_ESpirvOperandFlags_None;

31
public/iaudio.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef IAUDIO_H
#define IAUDIO_H
#include "tier1/interface.h"
#include "tier2/iappsystem.h"
#include "trig.h"
abstract_class IAudioPlayer
{
public:
virtual void StartAt( double fTime ) = 0;
virtual double GetPlayTime() = 0;
virtual double Stop() = 0;
virtual void Continue() = 0;
};
abstract_class IAudio
{
public:
virtual IAudioPlayer *SpawnPlayer() = 0;
};
abstract_class IAudioManager: public IAppSystem
{
public:
virtual void CreateAudio( const char *szFile ) = 0;
virtual void SetEarsPosition( Vector v ) = 0;
virtual void SetEarsRotation( Quat q ) = 0;
};
#endif

72
public/kotgui/kotgui.h Normal file
View File

@@ -0,0 +1,72 @@
#ifndef KOTGUI_H
#define KOTGUI_H
#include "../materialsystem/imaterialsystem.h"
#include "../materialsystem/igamewindow.h"
#include "tier2/iappsystem.h"
abstract_class IRenderFont
{
public:
virtual IImage *GetAtlas();
virtual bool IsLetterPresent( uint32_t letter );
virtual float GetLetterX( uint32_t letter );
virtual float GetLetterY( uint32_t letter );
virtual float GetWidthX( uint32_t letter );
virtual float GetWidthY( uint32_t letter );
};
struct Alignment_t
{
int iX;
int iY;
float fX;
float fY;
};
struct Color3
{
float R;
float G;
float B;
};
struct Color4
{
float R;
float G;
float B;
};
enum EKotUIShader
{
k_eKotGUI_Text,
k_eKotGUI_Widget,
};
abstract_class IKotUIManager: public IAppSystem2
{
public:
virtual void BeginDrawing() = 0;
virtual void EndDrawing() = 0;
virtual void DrawText(
Alignment_t position,
Alignment_t offset,
float fRotation,
Color4 color,
uint32_t *pText,
uint32_t uSize,
IRenderFont *pFont,
float fTextSize
) = 0;
};
IKotUIManager *KotUIManager();
#define KOT_UI_INTEFACE_VERSION "KotUI001"
#endif

View File

@@ -3,7 +3,7 @@
#include "tier0/platform.h"
#include "tier2/iappsystem.h"
#include "materialsystem/humandevice_enums.h"
#include "humandevice_enums.h"
typedef void ( *KeyCallbackFn )( EInputDeviceType eDevice, EInputButton eButton, bool bIsPressed );
typedef void ( *AxisCallbackFn )( EInputDeviceType eDevice, EInputAxis eAxis, float fd );
@@ -26,6 +26,8 @@ public:
virtual void *CreateVulkanSurface( void *pInstance ) = 0;
virtual void DestroyVulkanSurface( void *pInstance ) = 0;
virtual bool IsValid() = 0;
};
abstract_class IGameWindowManager: public IAppSystem

Binary file not shown.

Binary file not shown.

Binary file not shown.