Network - Merge with gamelogic
This commit is contained in:
commit
3a752f6b95
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
port 15151
|
||||||
|
clients 200
|
|
@ -0,0 +1,4 @@
|
||||||
|
ServerInit ..\Settings\ServerInit.ini
|
||||||
|
More a
|
||||||
|
more b
|
||||||
|
more c
|
|
@ -57,6 +57,7 @@ Global
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64
|
||||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -68,6 +69,7 @@ Global
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64
|
||||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -79,6 +81,7 @@ Global
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64
|
||||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -90,6 +93,7 @@ Global
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64
|
||||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -101,6 +105,7 @@ Global
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64
|
||||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -124,6 +129,7 @@ Global
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64
|
||||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -135,6 +141,7 @@ Global
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.ActiveCfg = Debug|Win32
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Debug|x64
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Debug|x64
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Debug|x64
|
||||||
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -146,6 +153,7 @@ Global
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.ActiveCfg = Debug|Win32
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Debug|x64
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Debug|x64
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Debug|x64
|
||||||
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -157,6 +165,7 @@ Global
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|x64
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Debug|x64
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Debug|x64
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Debug|x64
|
||||||
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
{C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||||
|
@ -168,6 +177,7 @@ Global
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Release|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
@ -178,6 +188,7 @@ Global
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|x64.Build.0 = Release|x64
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|x64.Build.0 = Release|x64
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Debug|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
@ -196,6 +207,7 @@ Global
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64
|
||||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
@ -207,6 +219,7 @@ Global
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.ActiveCfg = Debug|Win32
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.ActiveCfg = Debug|x64
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.Build.0 = Debug|x64
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.Build.0 = Debug|x64
|
||||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
@ -218,6 +231,7 @@ Global
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.ActiveCfg = Debug|Win32
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.ActiveCfg = Debug|x64
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.Build.0 = Debug|x64
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.Build.0 = Debug|x64
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
@ -229,6 +243,7 @@ Global
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64
|
||||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
@ -240,6 +255,7 @@ Global
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
@ -104,15 +104,15 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -121,14 +121,14 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GameProtocols_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -140,16 +140,16 @@
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -161,16 +161,16 @@
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -181,6 +181,9 @@
|
||||||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
||||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Network\NetworkAPI\NetworkAPI.vcxproj">
|
||||||
|
<Project>{460d625f-2ac9-4559-b809-0ba89ceaedf4}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
|
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
|
||||||
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
|
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
#include "GameClientState/GameClientState.h"
|
#include "GameClientState/GameClientState.h"
|
||||||
#include "GameClientState\GameState.h"
|
#include "GameClientState\GameState.h"
|
||||||
#include "GameClientState\LobbyState.h"
|
#include "GameClientState\LobbyState.h"
|
||||||
|
#include "PlayerProtocols.h"
|
||||||
|
#include "NetworkClient.h"
|
||||||
|
|
||||||
|
#include "L_inputClass.h"
|
||||||
#include "vld.h"
|
#include "vld.h"
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
|
@ -12,11 +16,57 @@ namespace DanBias
|
||||||
__int64 DanBiasGame::cntsPerSec = 0;
|
__int64 DanBiasGame::cntsPerSec = 0;
|
||||||
__int64 DanBiasGame::prevTimeStamp = 0;
|
__int64 DanBiasGame::prevTimeStamp = 0;
|
||||||
float DanBiasGame::secsPerCnt = 0;
|
float DanBiasGame::secsPerCnt = 0;
|
||||||
InputClass* DanBiasGame::inputObj = NULL;
|
|
||||||
HINSTANCE DanBiasGame::g_hInst = NULL;
|
HINSTANCE DanBiasGame::g_hInst = NULL;
|
||||||
HWND DanBiasGame::g_hWnd = NULL;
|
HWND DanBiasGame::g_hWnd = NULL;
|
||||||
|
|
||||||
#pragma region Game Data
|
#pragma region Game Data
|
||||||
|
|
||||||
|
|
||||||
|
struct MyRecieverObject :public Oyster::Network::ProtocolRecieverObject
|
||||||
|
{
|
||||||
|
Oyster::Network::NetworkClient* nwClient;
|
||||||
|
Client::GameClientState* gameClientState;
|
||||||
|
|
||||||
|
void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& p) override
|
||||||
|
{
|
||||||
|
|
||||||
|
int pType = p[0].value.netInt;
|
||||||
|
Client::GameClientState::ProtocolStruct* protocol;
|
||||||
|
switch (pType)
|
||||||
|
{
|
||||||
|
case protocol_PlayerNavigation:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case protocol_PlayerPosition:
|
||||||
|
protocol = new Client::GameClientState::PlayerPos;
|
||||||
|
for(int i = 0; i< 3; i++)
|
||||||
|
{
|
||||||
|
((Client::GameClientState::PlayerPos*)protocol)->playerPos[i] = p[i].value.netFloat;
|
||||||
|
}
|
||||||
|
gameClientState->Protocol(protocol);
|
||||||
|
delete protocol;
|
||||||
|
protocol = NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case protocol_ObjectPosition:
|
||||||
|
protocol = new Client::GameClientState::ObjPos;
|
||||||
|
for(int i = 0; i< 16; i++)
|
||||||
|
{
|
||||||
|
((Client::GameClientState::ObjPos*)protocol)->worldPos[i] = p[i].value.netFloat;
|
||||||
|
}
|
||||||
|
gameClientState->Protocol(protocol);
|
||||||
|
delete protocol;
|
||||||
|
protocol = NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
class DanBiasGamePrivateData
|
class DanBiasGamePrivateData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -30,12 +80,15 @@ namespace DanBias
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Client::GameClientState* gameClientState;
|
Client::GameClientState* gameClientState;
|
||||||
// gameClient;
|
InputClass* inputObj;
|
||||||
|
MyRecieverObject* r;
|
||||||
|
|
||||||
} data;
|
} data;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
|
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
@ -63,6 +116,9 @@ namespace DanBias
|
||||||
// Start in lobby state
|
// Start in lobby state
|
||||||
m_data->gameClientState = new Client::LobbyState();
|
m_data->gameClientState = new Client::LobbyState();
|
||||||
m_data->gameClientState->Init();
|
m_data->gameClientState->Init();
|
||||||
|
m_data->r = new MyRecieverObject;
|
||||||
|
m_data->r->nwClient = new Oyster::Network::NetworkClient();
|
||||||
|
|
||||||
return DanBiasClientReturn_Sucess;
|
return DanBiasClientReturn_Sucess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +219,8 @@ namespace DanBias
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
HRESULT DanBiasGame::InitInput()
|
HRESULT DanBiasGame::InitInput()
|
||||||
{
|
{
|
||||||
inputObj = new InputClass;
|
m_data->inputObj = new InputClass;
|
||||||
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
if(!m_data->inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
||||||
{
|
{
|
||||||
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -174,10 +230,10 @@ namespace DanBias
|
||||||
|
|
||||||
HRESULT DanBiasGame::Update(float deltaTime)
|
HRESULT DanBiasGame::Update(float deltaTime)
|
||||||
{
|
{
|
||||||
inputObj->Update();
|
m_data->inputObj->Update();
|
||||||
|
|
||||||
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
|
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
|
||||||
state = m_data->gameClientState->Update(deltaTime, inputObj);
|
state = m_data->gameClientState->Update(deltaTime, m_data->inputObj);
|
||||||
|
|
||||||
if(state != Client::GameClientState::ClientState_Same)
|
if(state != Client::GameClientState::ClientState_Same)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +262,7 @@ namespace DanBias
|
||||||
HRESULT DanBiasGame::Render(float deltaTime)
|
HRESULT DanBiasGame::Render(float deltaTime)
|
||||||
{
|
{
|
||||||
int isPressed = 0;
|
int isPressed = 0;
|
||||||
if(inputObj->IsKeyPressed(DIK_A))
|
if(m_data->inputObj->IsKeyPressed(DIK_A))
|
||||||
{
|
{
|
||||||
isPressed = 1;
|
isPressed = 1;
|
||||||
}
|
}
|
||||||
|
@ -224,8 +280,9 @@ namespace DanBias
|
||||||
{
|
{
|
||||||
m_data->gameClientState->Release();
|
m_data->gameClientState->Release();
|
||||||
delete m_data->gameClientState;
|
delete m_data->gameClientState;
|
||||||
|
delete m_data->inputObj;
|
||||||
delete m_data;
|
delete m_data;
|
||||||
delete inputObj;
|
|
||||||
|
|
||||||
Oyster::Graphics::API::Clean();
|
Oyster::Graphics::API::Clean();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -12,6 +12,26 @@ namespace Client
|
||||||
class GameClientState
|
class GameClientState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct ProtocolStruct
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
struct ObjPos :public ProtocolStruct
|
||||||
|
{
|
||||||
|
float worldPos[16];
|
||||||
|
};
|
||||||
|
struct PlayerPos :public ProtocolStruct
|
||||||
|
{
|
||||||
|
float playerPos[3];
|
||||||
|
};
|
||||||
|
struct PlayerMove :public ProtocolStruct
|
||||||
|
{
|
||||||
|
float playerPos[3];
|
||||||
|
};
|
||||||
|
struct PlayerName :public ProtocolStruct
|
||||||
|
{
|
||||||
|
char name[255];
|
||||||
|
};
|
||||||
enum ClientState
|
enum ClientState
|
||||||
{
|
{
|
||||||
ClientState_Lobby,
|
ClientState_Lobby,
|
||||||
|
@ -26,6 +46,8 @@ public:
|
||||||
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
|
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
|
||||||
virtual bool Render() = 0;
|
virtual bool Render() = 0;
|
||||||
virtual bool Release() = 0;
|
virtual bool Release() = 0;
|
||||||
|
virtual void Protocol(ProtocolStruct* protocolStruct) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include "DllInterfaces/GFXAPI.h"
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
#include "Obj/C_Player.h"
|
#include "Obj/C_Player.h"
|
||||||
#include "Obj/C_DynamicObj.h"
|
#include "Obj/C_DynamicObj.h"
|
||||||
|
#include "NetworkClient.h"
|
||||||
|
#include "PlayerProtocols.h"
|
||||||
|
|
||||||
using namespace DanBias::Client;
|
using namespace DanBias::Client;
|
||||||
|
|
||||||
|
@ -12,7 +14,9 @@ struct GameState::myData
|
||||||
Oyster::Math3D::Float4x4 proj;
|
Oyster::Math3D::Float4x4 proj;
|
||||||
C_Object* object[3];
|
C_Object* object[3];
|
||||||
int modelCount;
|
int modelCount;
|
||||||
|
Oyster::Network::NetworkClient* nwClient;
|
||||||
gameStateState state;
|
gameStateState state;
|
||||||
|
|
||||||
}privData;
|
}privData;
|
||||||
|
|
||||||
GameState::GameState(void)
|
GameState::GameState(void)
|
||||||
|
@ -32,7 +36,7 @@ bool GameState::Init()
|
||||||
privData->state = LoadGame();
|
privData->state = LoadGame();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
GameState::gameStateState GameState::LoadGame()
|
GameState::gameStateState GameState::LoadGame()
|
||||||
{
|
{
|
||||||
LoadModels(L"map");
|
LoadModels(L"map");
|
||||||
InitCamera(Oyster::Math::Float3(0,0,5.4f));
|
InitCamera(Oyster::Math::Float3(0,0,5.4f));
|
||||||
|
@ -86,8 +90,15 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
|
||||||
case gameStateState_playing:
|
case gameStateState_playing:
|
||||||
// read server data
|
// read server data
|
||||||
// update objects
|
// update objects
|
||||||
|
// Client.send(obj);
|
||||||
|
{
|
||||||
|
GameLogic::Protocol_PlayerMovement movePlayer;
|
||||||
|
|
||||||
|
//privData->nwClient->Send(movePlayer);
|
||||||
|
|
||||||
if(KeyInput->IsKeyPressed(DIK_L))
|
if(KeyInput->IsKeyPressed(DIK_L))
|
||||||
privData->state = GameState::gameStateState_end;
|
privData->state = GameState::gameStateState_end;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case gameStateState_end:
|
case gameStateState_end:
|
||||||
return ClientState_Lobby;
|
return ClientState_Lobby;
|
||||||
|
@ -123,4 +134,21 @@ bool GameState::Release()
|
||||||
delete privData;
|
delete privData;
|
||||||
privData = NULL;
|
privData = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameState::Protocol(ProtocolStruct* pos)
|
||||||
|
{
|
||||||
|
if((ObjPos*)pos)
|
||||||
|
ObjectPosProtocol((ObjPos*)pos);
|
||||||
|
else if((PlayerPos*)pos)
|
||||||
|
PlayerPosProtocol((PlayerPos*)pos);
|
||||||
|
}
|
||||||
|
void GameState::PlayerPosProtocol(PlayerPos* pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void GameState::ObjectPosProtocol(ObjPos* pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//void GameState::Protocol(LightPos pos);
|
|
@ -23,13 +23,18 @@ public:
|
||||||
GameState(void);
|
GameState(void);
|
||||||
~GameState(void);
|
~GameState(void);
|
||||||
bool Init();
|
bool Init();
|
||||||
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput);
|
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override;
|
||||||
bool LoadModels(std::wstring mapFile);
|
bool LoadModels(std::wstring mapFile) ;
|
||||||
bool InitCamera(Oyster::Math::Float3 startPos);
|
bool InitCamera(Oyster::Math::Float3 startPos) ;
|
||||||
gameStateState LoadGame();
|
gameStateState LoadGame();
|
||||||
|
|
||||||
bool Render();
|
bool Render()override;
|
||||||
bool Release();
|
bool Release()override;
|
||||||
|
|
||||||
|
void Protocol(ProtocolStruct* pos)override;
|
||||||
|
void PlayerPosProtocol(PlayerPos* pos);
|
||||||
|
void ObjectPosProtocol(ObjPos* pos);
|
||||||
|
//void Protocol(LightPos pos);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,4 +118,14 @@ bool LobbyState::Release()
|
||||||
delete privData;
|
delete privData;
|
||||||
privData = NULL;
|
privData = NULL;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
void LobbyState::Protocol(ProtocolStruct* protocol)
|
||||||
|
{
|
||||||
|
if((PlayerName*)protocol)
|
||||||
|
PlayerJoinProtocol((PlayerName*)protocol);
|
||||||
|
|
||||||
|
}
|
||||||
|
void LobbyState::PlayerJoinProtocol(PlayerName* name)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
|
@ -32,5 +32,8 @@ public:
|
||||||
|
|
||||||
bool Render();
|
bool Render();
|
||||||
bool Release();
|
bool Release();
|
||||||
|
void Protocol(ProtocolStruct* protocol)override;
|
||||||
|
void PlayerJoinProtocol(PlayerName* name);
|
||||||
|
|
||||||
};};};
|
};};};
|
||||||
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef DANBIASGAME_DANBIASGAME_H
|
#ifndef DANBIASGAME_DANBIASGAME_H
|
||||||
#define DANBIASGAME_DANBIASGAME_H
|
#define DANBIASGAME_DANBIASGAME_H
|
||||||
|
|
||||||
|
#define DANBIAS_CLIENT_L
|
||||||
|
|
||||||
#if defined (DANBIAS_GAME_DLL_EXPORT)
|
#if defined (DANBIAS_GAME_DLL_EXPORT)
|
||||||
#define DANBIAS_GAME_DLL __declspec(dllexport)
|
#define DANBIAS_GAME_DLL __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
|
@ -11,8 +13,6 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
|
||||||
#include "L_inputClass.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
@ -25,8 +25,6 @@ namespace DanBias
|
||||||
DanBiasClientReturn_Sucess,
|
DanBiasClientReturn_Sucess,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DanBiasGameDesc
|
struct DanBiasGameDesc
|
||||||
{
|
{
|
||||||
//Stuff goes here...
|
//Stuff goes here...
|
||||||
|
@ -56,11 +54,12 @@ namespace DanBias
|
||||||
static HRESULT Update(float deltaTime);
|
static HRESULT Update(float deltaTime);
|
||||||
static HRESULT Render(float deltaTime);
|
static HRESULT Render(float deltaTime);
|
||||||
static HRESULT CleanUp();
|
static HRESULT CleanUp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static __int64 cntsPerSec;
|
static __int64 cntsPerSec;
|
||||||
static __int64 prevTimeStamp;
|
static __int64 prevTimeStamp;
|
||||||
static float secsPerCnt;
|
static float secsPerCnt;
|
||||||
static InputClass* inputObj;
|
|
||||||
static HINSTANCE g_hInst;
|
static HINSTANCE g_hInst;
|
||||||
static HWND g_hWnd;
|
static HWND g_hWnd;
|
||||||
static DanBiasGamePrivateData* m_data;
|
static DanBiasGamePrivateData* m_data;
|
||||||
|
|
|
@ -71,32 +71,32 @@
|
||||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -105,13 +105,13 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>DanBiasGame_$(PlatformShortName)D.dll;DanBiasServer_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>DanBiasGame_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -121,13 +121,13 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>DanBiasGame_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -167,34 +167,16 @@
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Launcher.cpp" />
|
<ClCompile Include="Launcher.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
|
|
||||||
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Input\Input.vcxproj">
|
|
||||||
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
|
||||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
|
|
||||||
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
|
|
||||||
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\DanBiasGame\DanBiasGame.vcxproj">
|
<ProjectReference Include="..\DanBiasGame\DanBiasGame.vcxproj">
|
||||||
<Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project>
|
<Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\DanBiasServer\DanBiasServer.vcxproj">
|
|
||||||
<Project>{52380daa-0f4a-4d97-8e57-98df39319caf}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -3,16 +3,12 @@
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <vld.h>
|
||||||
//#define DANBIAS_SERVER
|
|
||||||
#define DANBIAS_CLIENT
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(DANBIAS_SERVER)
|
#include "DanBiasServerAPI.h"
|
||||||
#include "IDanBiasServer.h"
|
//#include "DanBiasGame.h"
|
||||||
#elif defined(DANBIAS_CLIENT)
|
|
||||||
#include "DanBiasGame.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
|
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
|
||||||
{
|
{
|
||||||
|
@ -21,16 +17,12 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
|
||||||
{
|
{
|
||||||
return cmdShow;
|
return cmdShow;
|
||||||
}
|
}
|
||||||
// Server starter code goes here
|
if( DanBias::DanBiasServerAPI::Initiate() == DanBias::DanBiasServerReturn_Sucess)
|
||||||
DanBias::DanBiasServerDesc desc;
|
|
||||||
desc.port = 0;
|
|
||||||
|
|
||||||
if( DanBias::DanBiasServer::Initiate(desc) == DanBias::DanBiasServerReturn_Sucess)
|
|
||||||
{
|
{
|
||||||
DanBias::DanBiasServer::Run();
|
DanBias::DanBiasServerAPI::Run();
|
||||||
DanBias::DanBiasServer::Release();
|
DanBias::DanBiasServerAPI::Release();
|
||||||
}
|
}
|
||||||
#elif defined(DANBIAS_CLIENT)
|
#elif defined(DANBIAS_CLIENT_L)
|
||||||
if(SetDllDirectory(L"..\\DLL") == FALSE)
|
if(SetDllDirectory(L"..\\DLL") == FALSE)
|
||||||
{
|
{
|
||||||
return cmdShow;
|
return cmdShow;
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
// Created by [Dennis Andersen] [2013]
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
#include <Windows.h>
|
|
||||||
#include "DBServer.h"
|
|
||||||
//#include "GameLogic\?"
|
|
||||||
#include "Utilities.h"
|
|
||||||
|
|
||||||
using namespace DanBias;
|
|
||||||
|
|
||||||
DBServer::DBServer()
|
|
||||||
: initiated(0)
|
|
||||||
, running(0)
|
|
||||||
, released(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
DBServer::~DBServer()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
DanBiasServerReturn DBServer::Create(const DanBias::DanBiasServerDesc& desc)
|
|
||||||
{
|
|
||||||
this->initiated = true;
|
|
||||||
return DanBiasServerReturn_Sucess;
|
|
||||||
}
|
|
||||||
DanBiasServerReturn DBServer::Run()
|
|
||||||
{
|
|
||||||
|
|
||||||
if(this->running)
|
|
||||||
{
|
|
||||||
return DanBiasServerReturn_Error;
|
|
||||||
}
|
|
||||||
if(this->released)
|
|
||||||
{
|
|
||||||
return DanBiasServerReturn_Error;
|
|
||||||
}
|
|
||||||
if(!this->initiated)
|
|
||||||
{
|
|
||||||
return DanBiasServerReturn_Error;
|
|
||||||
}
|
|
||||||
this->running = true;
|
|
||||||
while (this->running)
|
|
||||||
{
|
|
||||||
MessageBox(0, L"What to do here...", L"TYPELESS", 0);
|
|
||||||
|
|
||||||
this->running = false;
|
|
||||||
}
|
|
||||||
return DanBiasServerReturn_Sucess;
|
|
||||||
}
|
|
||||||
DanBiasServerReturn DBServer::Release()
|
|
||||||
{
|
|
||||||
this->released = true;
|
|
||||||
return DanBiasServerReturn_Sucess;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
// Created by [Dennis Andersen] [2013]
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
#ifndef DANBIASSERVER_DBSERVER_H
|
|
||||||
#define DANBIASSERVER_DBSERVER_H
|
|
||||||
|
|
||||||
#include "Include\IDanBiasServer.h"
|
|
||||||
|
|
||||||
namespace DanBias
|
|
||||||
{
|
|
||||||
class DBServer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DBServer();
|
|
||||||
~DBServer();
|
|
||||||
|
|
||||||
DanBiasServerReturn Create(const DanBias::DanBiasServerDesc& desc);
|
|
||||||
DanBiasServerReturn Run();
|
|
||||||
DanBiasServerReturn Release();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool initiated;
|
|
||||||
bool running;
|
|
||||||
bool released;
|
|
||||||
};
|
|
||||||
}// End namspace DanBias
|
|
||||||
#endif // !DANBIASSERVER_DBSERVER_H
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
|
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
|
||||||
{
|
{
|
||||||
MessageBox(0, L"DanBiasServer Loaded", 0, 0);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
|
@ -73,28 +73,32 @@
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -102,13 +106,15 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
|
</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName)D.dll</DelayLoadDLLs>
|
||||||
|
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -117,13 +123,15 @@
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
|
</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName)D.dll</DelayLoadDLLs>
|
||||||
|
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -134,15 +142,17 @@
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
|
</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName).dll</DelayLoadDLLs>
|
||||||
|
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
@ -153,32 +163,50 @@
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
|
</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName).dll</DelayLoadDLLs>
|
||||||
|
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="IDanBiasServer.cpp" />
|
<ClCompile Include="Include\DanBiasServerAPI.cpp" />
|
||||||
<ClCompile Include="DLLMain.cpp" />
|
<ClCompile Include="DLLMain.cpp" />
|
||||||
<ClCompile Include="DBServer.cpp" />
|
<ClCompile Include="GameServer.cpp" />
|
||||||
|
<ClCompile Include="ServerObjects\ClientObject.cpp" />
|
||||||
|
<ClCompile Include="ServerObjects\Lobby\GameLobby.cpp" />
|
||||||
|
<ClCompile Include="ServerObjects\GameSession.cpp" />
|
||||||
|
<ClCompile Include="ServerObjects\Lobby\MainLobby.cpp" />
|
||||||
|
<ClCompile Include="ServerObjects\NetworkSession.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="DBServer.h" />
|
<ClInclude Include="Event\EventManager.h" />
|
||||||
<ClInclude Include="Include\IDanBiasServer.h" />
|
<ClInclude Include="GameServer.h" />
|
||||||
<ClInclude Include="Include\ServerWrapper.h" />
|
<ClInclude Include="Include\DanBiasServerAPI.h" />
|
||||||
<ClInclude Include="MainLobby.h" />
|
<ClInclude Include="ServerInitReader.h" />
|
||||||
|
<ClInclude Include="ServerObjects\ClientObject.h" />
|
||||||
|
<ClInclude Include="ServerObjects\GameSession.h" />
|
||||||
|
<ClInclude Include="ServerObjects\Lobby\GameLobby.h" />
|
||||||
|
<ClInclude Include="ServerObjects\Lobby\MainLobby.h" />
|
||||||
|
<ClInclude Include="ServerObjects\NetworkSession.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
|
||||||
|
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
||||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
|
||||||
|
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
#define NOMINMAX
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <WindowShell.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "GameServer.h"
|
||||||
|
#include "Utilities.h"
|
||||||
|
#include "ServerInitReader.h"
|
||||||
|
#include <TEST_PROTOCOLS.h>
|
||||||
|
#include <Thread\OysterThread.h>
|
||||||
|
#include "ServerObjects\ClientObject.h"
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
using namespace Oyster::Network;
|
||||||
|
|
||||||
|
|
||||||
|
void GameServer::ClientConnectCallback(NetworkClient& client)
|
||||||
|
{
|
||||||
|
printf("Client connected!\n");
|
||||||
|
|
||||||
|
Utility::DynamicMemory::SmartPointer<ClientObject> c = new ClientObject(client);
|
||||||
|
this->mainLobby->AttachClient(c);
|
||||||
|
}
|
||||||
|
GameServer::GameServer()
|
||||||
|
: initiated(0)
|
||||||
|
, running(0)
|
||||||
|
, released(0)
|
||||||
|
, maxClients(0)
|
||||||
|
, mainLobby(0)
|
||||||
|
, server(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
GameServer::~GameServer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
DanBiasServerReturn GameServer::Create()
|
||||||
|
{
|
||||||
|
this->server = new NetworkServer();
|
||||||
|
this->mainLobby = new MainLobby();
|
||||||
|
|
||||||
|
InitData data;
|
||||||
|
if(!LoadIniFile(data)) return DanBiasServerReturn_Error;
|
||||||
|
|
||||||
|
NetworkServer::INIT_DESC serverDesc;
|
||||||
|
this->maxClients = data.clients;
|
||||||
|
serverDesc.port = data.port;
|
||||||
|
serverDesc.recvObj = this;
|
||||||
|
serverDesc.callbackType = Oyster::Network::NetworkClientCallbackType_Object;
|
||||||
|
|
||||||
|
if(!this->server->Init(serverDesc)) return DanBiasServerReturn_Error;
|
||||||
|
if(!WindowShell::CreateConsoleWindow()) return DanBiasServerReturn_Error;
|
||||||
|
|
||||||
|
this->initiated = true;
|
||||||
|
return DanBiasServerReturn_Sucess;
|
||||||
|
}
|
||||||
|
DanBiasServerReturn GameServer::Run()
|
||||||
|
{
|
||||||
|
if(this->running) return DanBiasServerReturn_Error;
|
||||||
|
if(this->released) return DanBiasServerReturn_Error;
|
||||||
|
if(!this->initiated) return DanBiasServerReturn_Error;
|
||||||
|
|
||||||
|
if(!this->server->Start()) return DanBiasServerReturn_Error;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if(!WindowShell::Frame()) break;
|
||||||
|
|
||||||
|
this->mainLobby->Frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
return DanBiasServerReturn_Sucess;
|
||||||
|
}
|
||||||
|
DanBiasServerReturn GameServer::Release()
|
||||||
|
{
|
||||||
|
this->server->Shutdown();
|
||||||
|
delete this->server;
|
||||||
|
delete this->mainLobby;
|
||||||
|
this->released = true;
|
||||||
|
return DanBiasServerReturn_Sucess;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameServer::LoadIniFile(InitData& ini)
|
||||||
|
{
|
||||||
|
std::ifstream in;
|
||||||
|
std::string f = GetInitPath(InitPath_ServerIni);
|
||||||
|
in.open(f, std::ios::in);
|
||||||
|
if(!in.is_open()) return false;
|
||||||
|
|
||||||
|
std::string buffer;
|
||||||
|
while (!in.eof())
|
||||||
|
{
|
||||||
|
in >> buffer;
|
||||||
|
|
||||||
|
if(buffer == "port")
|
||||||
|
{
|
||||||
|
in >> ini.port;
|
||||||
|
}
|
||||||
|
else if(buffer == "clients")
|
||||||
|
{
|
||||||
|
in >> ini.clients;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}//End namespace DanBias
|
|
@ -0,0 +1,44 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef DANBIASSERVER_GAME_SERVER_H
|
||||||
|
#define DANBIASSERVER_GAME_SERVER_H
|
||||||
|
|
||||||
|
#include "Include\DanBiasServerAPI.h"
|
||||||
|
#include "ServerObjects\Lobby\MainLobby.h"
|
||||||
|
#include <NetworkServer.h>
|
||||||
|
#include <NetworkCallbackHelper.h>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class GameServer :public Oyster::Network::ClientConnectedObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GameServer();
|
||||||
|
~GameServer();
|
||||||
|
|
||||||
|
DanBiasServerReturn Create();
|
||||||
|
DanBiasServerReturn Run();
|
||||||
|
DanBiasServerReturn Release();
|
||||||
|
|
||||||
|
private:
|
||||||
|
//static void ClientConnectCallbackFunction(Oyster::Network::NetworkClient& connectedClient);
|
||||||
|
void ClientConnectCallback(Oyster::Network::NetworkClient& client) override;
|
||||||
|
|
||||||
|
bool initiated;
|
||||||
|
bool running;
|
||||||
|
bool released;
|
||||||
|
int maxClients;
|
||||||
|
MainLobby *mainLobby;
|
||||||
|
Oyster::Network::NetworkServer *server;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct InitData
|
||||||
|
{
|
||||||
|
int port;
|
||||||
|
int clients;
|
||||||
|
};
|
||||||
|
bool LoadIniFile(InitData&);
|
||||||
|
};
|
||||||
|
}// End namspace DanBias
|
||||||
|
#endif // !DANBIASSERVER_DBSERVER_H
|
|
@ -1,26 +1,26 @@
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Created by [Dennis Andersen] [2013]
|
// Created by [Dennis Andersen] [2013]
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
#include "Include\IDanBiasServer.h"
|
#include "DanBiasServerAPI.h"
|
||||||
#include "DBServer.h"
|
#include "..\GameServer.h"
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
|
||||||
#pragma region Server Data
|
#pragma region Server Data
|
||||||
static DBServer server;
|
static GameServer server;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
DanBiasServerReturn DanBiasServer::Initiate(DanBiasServerDesc& desc)
|
DanBiasServerReturn DanBiasServerAPI::Initiate()
|
||||||
{
|
{
|
||||||
return server.Create(desc);
|
return server.Create();
|
||||||
}
|
}
|
||||||
DanBiasServerReturn DanBiasServer::Run()
|
DanBiasServerReturn DanBiasServerAPI::Run()
|
||||||
{
|
{
|
||||||
return server.Run();
|
return server.Run();
|
||||||
}
|
}
|
||||||
DanBiasServerReturn DanBiasServer::Release()
|
DanBiasServerReturn DanBiasServerAPI::Release()
|
||||||
{
|
{
|
||||||
return server.Release();
|
return server.Release();
|
||||||
}
|
}
|
|
@ -4,8 +4,11 @@
|
||||||
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
|
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
|
||||||
#define DANBIAS_SERVER_DANBIAS_SERVER_H
|
#define DANBIAS_SERVER_DANBIAS_SERVER_H
|
||||||
|
|
||||||
|
#include <vld.h>
|
||||||
|
|
||||||
#if defined (DANBIAS_SERVER_DLL_EXPORT)
|
#define DANBIAS_SERVER
|
||||||
|
|
||||||
|
#ifdef DANBIAS_SERVER_DLL_EXPORT
|
||||||
#define DANBIAS_SERVER_DLL __declspec(dllexport)
|
#define DANBIAS_SERVER_DLL __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define DANBIAS_SERVER_DLL __declspec(dllimport)
|
#define DANBIAS_SERVER_DLL __declspec(dllimport)
|
||||||
|
@ -13,28 +16,21 @@
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
enum DanBiasServerReturn
|
||||||
|
{
|
||||||
|
DanBiasServerReturn_Error,
|
||||||
|
DanBiasServerReturn_Sucess,
|
||||||
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
enum DanBiasServerReturn
|
class DANBIAS_SERVER_DLL DanBiasServerAPI
|
||||||
{
|
|
||||||
DanBiasServerReturn_Error,
|
|
||||||
DanBiasServerReturn_Sucess,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DanBiasServerDesc
|
|
||||||
{
|
|
||||||
//Stuff goes here...
|
|
||||||
int port;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DANBIAS_SERVER_DLL DanBiasServer
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static DanBiasServerReturn Initiate(DanBiasServerDesc& desc);
|
static DanBiasServerReturn Initiate();
|
||||||
static DanBiasServerReturn Run();
|
static DanBiasServerReturn Run();
|
||||||
static DanBiasServerReturn Release();
|
static DanBiasServerReturn Release();
|
||||||
};
|
};//End class DanBiasServer
|
||||||
|
|
||||||
}//End Extern "C"
|
}//End Extern "C"
|
||||||
} //End namspace DanBias
|
} //End namspace DanBias
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#ifndef NETWORK_SERVER_WRAPPER_H
|
|
||||||
#define NETWORK_SERVER_WRAPPER_H
|
|
||||||
|
|
||||||
|
|
||||||
class SingletonServer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
struct INIT_DESC
|
|
||||||
{
|
|
||||||
bool l;
|
|
||||||
};
|
|
||||||
void CreateServer(/*DATA*/);
|
|
||||||
void StartServer(/*DATA*/);
|
|
||||||
void StopServer(/*DATA*/);
|
|
||||||
void TerminateServer(/*DATA*/);
|
|
||||||
|
|
||||||
void AttachLobby(/*LOBBY*/);
|
|
||||||
void DetachLobby(/*LOBBY*/);
|
|
||||||
void KickClient(/*CLIENT*/);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // !NETWORK_SERVER_WRAPPER_H
|
|
|
@ -1,17 +0,0 @@
|
||||||
#ifndef DANBIASGAME_GAMELOBBY_H
|
|
||||||
#define DANBIASGAME_GAMELOBBY_H
|
|
||||||
|
|
||||||
#include "Include\ServerWrapper.h"
|
|
||||||
|
|
||||||
class MainLobby :public SingletonServer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MainLobby();
|
|
||||||
~MainLobby();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // !DANBIASGAME_GAMELOBBY_H
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef DANBIASSERVER_SERVER_INIT_READER_H
|
||||||
|
#define DANBIASSERVER_SERVER_INIT_READER_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
enum InitPath
|
||||||
|
{
|
||||||
|
InitPath_ServerIni,
|
||||||
|
};
|
||||||
|
std::string GetInitPath(InitPath file)
|
||||||
|
{
|
||||||
|
std::string type = "";
|
||||||
|
std::string path = "";
|
||||||
|
std::string flag = "";
|
||||||
|
|
||||||
|
switch (file)
|
||||||
|
{
|
||||||
|
case DanBias::InitPath_ServerIni:
|
||||||
|
flag = "ServerInit";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::fstream in;
|
||||||
|
in.open("..\\Settings\\serversearchpath.ini", std::ios::in);
|
||||||
|
if(!in.is_open()) return "";
|
||||||
|
|
||||||
|
while (!in.eof() && type != flag)
|
||||||
|
{
|
||||||
|
in >> type;
|
||||||
|
in >> path;
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !DANBIASSERVER_SERVER_INIT_READER_H
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include "ClientObject.h"
|
||||||
|
|
||||||
|
using namespace DanBias;
|
||||||
|
|
||||||
|
ClientObject::ClientObject(const Oyster::Network::NetworkClient& client)
|
||||||
|
{
|
||||||
|
this->client = client;
|
||||||
|
this->client.SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object);
|
||||||
|
this->box = 0;
|
||||||
|
}
|
||||||
|
ClientObject::~ClientObject()
|
||||||
|
{
|
||||||
|
this->client.Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientObject::SetPostbox(Oyster::PostBox<NetworkSession::ClientEvent>* box)
|
||||||
|
{
|
||||||
|
this->box = box;
|
||||||
|
}
|
||||||
|
GameLogic::Player* ClientObject::Logic_Object()
|
||||||
|
{
|
||||||
|
return &this->logicPlayer;
|
||||||
|
}
|
||||||
|
Oyster::Network::NetworkClient* ClientObject::NetClient_Object()
|
||||||
|
{
|
||||||
|
return &this->client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol)
|
||||||
|
{
|
||||||
|
if(!this->box) return;
|
||||||
|
|
||||||
|
NetworkSession::ClientEvent _event;
|
||||||
|
_event.protocol = protocol;
|
||||||
|
_event.reciever = this;
|
||||||
|
|
||||||
|
this->box->Post(_event);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef DANBIASSERVER_CLIENT_OBJECT_H
|
||||||
|
#define DANBIASSERVER_CLIENT_OBJECT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "NetworkSession.h"
|
||||||
|
#include "NetworkClient.h"
|
||||||
|
#include <PostBox\PostBox.h>
|
||||||
|
#include <Player.h>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class ClientObject
|
||||||
|
:public Oyster::Network::ProtocolRecieverObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ClientObject(const Oyster::Network::NetworkClient& client);
|
||||||
|
~ClientObject();
|
||||||
|
|
||||||
|
void SetPostbox(Oyster::PostBox<NetworkSession::ClientEvent>* box);
|
||||||
|
|
||||||
|
GameLogic::Player* Logic_Object();
|
||||||
|
Oyster::Network::NetworkClient* NetClient_Object();
|
||||||
|
|
||||||
|
/** This method is NOT threadsafe. */
|
||||||
|
virtual void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GameLogic::Player logicPlayer;
|
||||||
|
Oyster::Network::NetworkClient client;
|
||||||
|
Oyster::IPostBox<DanBias::NetworkSession::ClientEvent>* box;
|
||||||
|
};
|
||||||
|
|
||||||
|
}//End namespace DanBias
|
||||||
|
#endif // !DANBIASSERVER_CLIENT_OBJECT_H
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}//End namespace DanBias
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef DANBIASSERVER_GAME_SESSION_H
|
||||||
|
#define DANBIASSERVER_GAME_SESSION_H
|
||||||
|
|
||||||
|
#include "NetworkSession.h"
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class GameSession :public NetworkSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GameSession();
|
||||||
|
~GameSession();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};//End GameSession
|
||||||
|
}//End namespace DanBias
|
||||||
|
#endif // !DANBIASSERVER_GAME_SESSION_H
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "GameLobby.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
GameLobby::GameLobby()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
GameLobby::~GameLobby()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void GameLobby::Release()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}//End namespace DanBias
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef DANBIASSERVER_GAMELOBBY_H
|
||||||
|
#define DANBIASSERVER_GAMELOBBY_H
|
||||||
|
|
||||||
|
#include "..\NetworkSession.h"
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class GameLobby :public NetworkSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GameLobby();
|
||||||
|
~GameLobby();
|
||||||
|
void Release();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}//End namespace DanBias
|
||||||
|
|
||||||
|
#endif // !DANBIASSERVER_GAME_LOBBY_H
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include "MainLobby.h"
|
||||||
|
#include <PlayerProtocols.h>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
MainLobby::MainLobby()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
MainLobby::~MainLobby()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void MainLobby::Release()
|
||||||
|
{
|
||||||
|
this->DetachClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainLobby::Frame()
|
||||||
|
{
|
||||||
|
if(!this->box.IsEmpty())
|
||||||
|
{
|
||||||
|
NetEvent &e = this->box.Fetch();
|
||||||
|
ParseEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////// Private
|
||||||
|
void MainLobby::ParseEvent(NetEvent& e)
|
||||||
|
{
|
||||||
|
static const short i = MAXSHORT;
|
||||||
|
if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return;
|
||||||
|
|
||||||
|
short f = e.protocol[0].value.netShort;
|
||||||
|
|
||||||
|
switch (f)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//End namespace DanBias
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef DANBIASSERVER_MAINLOBBY_H
|
||||||
|
#define DANBIASSERVER_MAINLOBBY_H
|
||||||
|
|
||||||
|
#include "..\NetworkSession.h"
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class MainLobby :public NetworkSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MainLobby();
|
||||||
|
~MainLobby();
|
||||||
|
void Release();
|
||||||
|
|
||||||
|
void Frame();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ParseEvent(NetEvent& e);
|
||||||
|
|
||||||
|
};
|
||||||
|
}//End namespace DanBias
|
||||||
|
#endif // !DANBIASGAME_GAMELOBBY_H
|
|
@ -0,0 +1,73 @@
|
||||||
|
|
||||||
|
#include "ClientObject.h"
|
||||||
|
#include "NetworkSession.h"
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
NetworkSession::NetworkSession()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
NetworkSession::~NetworkSession()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkSession::AttachClient(Utility::DynamicMemory::SmartPointer<ClientObject> client)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
if(!this->clients[i])
|
||||||
|
{
|
||||||
|
this->clients[i] = client;
|
||||||
|
this->clients[i]->SetPostbox(&this->box);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->clients.push_back(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkSession::DetachClient(Oyster::Network::NetworkClient* client)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
if(this->clients[0]->NetClient_Object()->Id() == client->Id())
|
||||||
|
this->clients[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void NetworkSession::DetachClient(ClientObject* client)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
if(this->clients[0]->NetClient_Object()->Id() == client->NetClient_Object()->Id())
|
||||||
|
this->clients[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void NetworkSession::DetachClient(short ID)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
if(this->clients[0]->NetClient_Object()->Id() == ID)
|
||||||
|
this->clients[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void NetworkSession::DetachClient()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
this->clients[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkSession::Kick()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->clients.size(); i++)
|
||||||
|
{
|
||||||
|
this->clients[i]->NetClient_Object()->Disconnect();
|
||||||
|
this->clients[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//End namespace DanBias
|
|
@ -0,0 +1,50 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef DANBIASSERVER_NETWORK_SESSION_H
|
||||||
|
#define DANBIASSERVER_NETWORK_SESSION_H
|
||||||
|
|
||||||
|
#define NOMINMAX
|
||||||
|
#include "Utilities.h"
|
||||||
|
#include <PostBox\PostBox.h>
|
||||||
|
#include <CustomNetProtocol.h>
|
||||||
|
#include <NetworkClient.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
class ClientObject;
|
||||||
|
class NetworkSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct NetEvent
|
||||||
|
{
|
||||||
|
ClientObject* reciever;
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
NetworkSession();
|
||||||
|
~NetworkSession();
|
||||||
|
|
||||||
|
void AttachClient(Utility::DynamicMemory::SmartPointer<ClientObject> client);
|
||||||
|
|
||||||
|
void DetachClient(Oyster::Network::NetworkClient* client);
|
||||||
|
void DetachClient(ClientObject* client);
|
||||||
|
void DetachClient(short ID);
|
||||||
|
void DetachClient();
|
||||||
|
|
||||||
|
void Kick();
|
||||||
|
|
||||||
|
void Send(Oyster::Network::CustomNetProtocol& protocol);
|
||||||
|
void Send(Oyster::Network::CustomNetProtocol& protocol, int ID);
|
||||||
|
|
||||||
|
//TODO: Do more lobby features
|
||||||
|
//virtual void
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<Utility::DynamicMemory::SmartPointer<ClientObject>> clients;
|
||||||
|
Oyster::PostBox<DanBias::NetworkSession::NetEvent> box;
|
||||||
|
};
|
||||||
|
}//End namespace DanBias
|
||||||
|
#endif // !DANBIASSERVER_NETWORK_SESSION_H
|
|
@ -1,4 +1,5 @@
|
||||||
#include "AttatchmentMassDriver.h"
|
#include "AttatchmentMassDriver.h"
|
||||||
|
#include "PhysicsAPI.h"
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
@ -19,11 +20,20 @@ struct AttatchmentMassDriver::PrivateData
|
||||||
|
|
||||||
AttatchmentMassDriver::AttatchmentMassDriver(void)
|
AttatchmentMassDriver::AttatchmentMassDriver(void)
|
||||||
{
|
{
|
||||||
|
myData = new PrivateData();
|
||||||
|
this->owner = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttatchmentMassDriver::AttatchmentMassDriver(Player &owner)
|
||||||
|
{
|
||||||
|
myData = new PrivateData();
|
||||||
|
this->owner = &owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AttatchmentMassDriver::~AttatchmentMassDriver(void)
|
AttatchmentMassDriver::~AttatchmentMassDriver(void)
|
||||||
{
|
{
|
||||||
|
delete myData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
@ -31,15 +41,33 @@ AttatchmentMassDriver::~AttatchmentMassDriver(void)
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
|
void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
|
||||||
{
|
{
|
||||||
ForcePush(fireInput);
|
//switch case to determin what functionallity to use in the attatchment
|
||||||
}
|
switch (fireInput)
|
||||||
|
{
|
||||||
/********************************************************
|
case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
|
||||||
* This is a specific functionallity of the weapon
|
ForcePush(fireInput);
|
||||||
********************************************************/
|
break;
|
||||||
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
|
case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS:
|
||||||
{
|
ForcePull(fireInput);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* Pushes objects in a cone in front of the weapon when fired
|
||||||
|
********************************************************/
|
||||||
|
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
|
||||||
|
{
|
||||||
|
//create coneRigidBody that will then collide with object and push them in the aimed direction
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* Pulls the player in the direction he is looking, used for fast movement(kinda like a jetpack)
|
||||||
|
********************************************************/
|
||||||
|
void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &fireInput)
|
||||||
|
{
|
||||||
|
Oyster::Physics::API::Instance().ApplyForceAt(owner->GetRigidBody(), owner->GetRigidBody()->GetCenter(), owner->GetLookDir() * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
//Created by Erik of the GameLogic team
|
||||||
|
//////////////////////////////////////////////////
|
||||||
#ifndef ATTATCHMENTMASSDRIVER_H
|
#ifndef ATTATCHMENTMASSDRIVER_H
|
||||||
#define ATTATCHMENTMASSDRIVER_H
|
#define ATTATCHMENTMASSDRIVER_H
|
||||||
#include "IAttatchment.h"
|
#include "IAttatchment.h"
|
||||||
|
@ -8,6 +11,7 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AttatchmentMassDriver(void);
|
AttatchmentMassDriver(void);
|
||||||
|
AttatchmentMassDriver(Player &owner);
|
||||||
~AttatchmentMassDriver(void);
|
~AttatchmentMassDriver(void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +19,7 @@ namespace GameLogic
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ForcePush(const WEAPON_FIRE &fireInput);
|
void ForcePush(const WEAPON_FIRE &fireInput);
|
||||||
|
void ForcePull(const WEAPON_FIRE &fireInput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct AttatchmentSocket::PrivateData
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IAttatchment *Attatchment;
|
IAttatchment *attatchment;
|
||||||
|
|
||||||
|
|
||||||
}myData;
|
}myData;
|
||||||
|
@ -30,5 +30,23 @@ AttatchmentSocket::~AttatchmentSocket(void)
|
||||||
|
|
||||||
IAttatchment* AttatchmentSocket::GetAttatchment()
|
IAttatchment* AttatchmentSocket::GetAttatchment()
|
||||||
{
|
{
|
||||||
return myData->Attatchment;
|
return myData->attatchment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttatchmentSocket::SetAttatchment(IAttatchment *attatchment)
|
||||||
|
{
|
||||||
|
if (myData->attatchment)
|
||||||
|
{
|
||||||
|
delete myData->attatchment;
|
||||||
|
}
|
||||||
|
|
||||||
|
myData->attatchment = attatchment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttatchmentSocket::RemoveAttatchment()
|
||||||
|
{
|
||||||
|
if (myData->attatchment)
|
||||||
|
{
|
||||||
|
delete myData->attatchment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
//Created by Erik of the GameLogic team
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef ATTATCHMENTSOCKET_H
|
#ifndef ATTATCHMENTSOCKET_H
|
||||||
#define ATTATCHMENTSOCKET_H
|
#define ATTATCHMENTSOCKET_H
|
||||||
#include "IAttatchment.h"
|
#include "IAttatchment.h"
|
||||||
|
@ -11,6 +15,8 @@ namespace GameLogic
|
||||||
~AttatchmentSocket(void);
|
~AttatchmentSocket(void);
|
||||||
|
|
||||||
IAttatchment* GetAttatchment();
|
IAttatchment* GetAttatchment();
|
||||||
|
void SetAttatchment(IAttatchment *attatchment);
|
||||||
|
void RemoveAttatchment();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#include "CollisionManager.h"
|
#include "CollisionManager.h"
|
||||||
|
#include "PhysicsAPI.h"
|
||||||
|
#include "Object.h"
|
||||||
|
#include "DynamicObject.h"
|
||||||
|
#include "Player.h"
|
||||||
|
|
||||||
using namespace Oyster;
|
using namespace Oyster;
|
||||||
|
|
||||||
|
@ -8,42 +12,44 @@ namespace GameLogic
|
||||||
namespace CollisionManager
|
namespace CollisionManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
void PlayerVBox(Player &player, DynamicObject &box);
|
||||||
|
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
||||||
{
|
{
|
||||||
Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyPlayer));
|
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
|
||||||
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType())
|
||||||
{
|
{
|
||||||
case Object::OBJECT_TYPE_BOX:
|
case OBJECT_TYPE_BOX:
|
||||||
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
||||||
break;
|
break;
|
||||||
case Object::OBJECT_TYPE_PLAYER:
|
case OBJECT_TYPE_PLAYER:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//spela ljud? ta skada? etc etc
|
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box)
|
void PlayerVBox(Player &player, DynamicObject &box)
|
||||||
{
|
{
|
||||||
//spela ljud? ta skada? etc etc
|
player.DamageLife(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
||||||
{
|
{
|
||||||
DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyBox));
|
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
|
||||||
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType())
|
||||||
{
|
{
|
||||||
case Object::OBJECT_TYPE_BOX:
|
case OBJECT_TYPE_BOX:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Object::OBJECT_TYPE_PLAYER:
|
case OBJECT_TYPE_PLAYER:
|
||||||
PlayerVBox(*(Player*)realObj,*box);
|
//PlayerVBox(*(Player*)realObj,*box);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
|
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "PhysicsAPI.h"
|
#include "PhysicsAPI.h"
|
||||||
#include "RefManager.h"
|
|
||||||
#include "DynamicObject.h"
|
|
||||||
#include "Player.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
@ -18,8 +15,8 @@ namespace GameLogic
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
|
Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
|
||||||
|
|
||||||
//these are the specific collision case functions
|
//these are the specific collision case functions
|
||||||
void PlayerVBox(Player &player, DynamicObject &box);
|
//void PlayerVBox(Player &player, DynamicObject &box);
|
||||||
void BoxVBox(DynamicObject &box1, DynamicObject &box2);
|
//void BoxVBox(DynamicObject &box1, DynamicObject &box2);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,23 @@
|
||||||
#include "DynamicObject.h"
|
#include "DynamicObject.h"
|
||||||
|
#include "CollisionManager.h"
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
struct DynamicObject::PrivateData
|
|
||||||
{
|
|
||||||
PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}myData;
|
|
||||||
|
|
||||||
|
|
||||||
DynamicObject::DynamicObject()
|
DynamicObject::DynamicObject()
|
||||||
|
:Object()
|
||||||
{
|
{
|
||||||
myData = new PrivateData();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject::DynamicObject(void* collisionFunc, OBJECT_TYPE type)
|
||||||
|
:Object(collisionFunc, type)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DynamicObject::~DynamicObject(void)
|
DynamicObject::~DynamicObject(void)
|
||||||
{
|
{
|
||||||
delete myData;
|
|
||||||
}
|
}
|
|
@ -1,27 +1,24 @@
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
//Created by Erik and Linda of the GameLogic team
|
//Created by Erik and Linda of the GameLogic team
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef DYNAMICOBJECT_H
|
#ifndef DYNAMICOBJECT_H
|
||||||
#define DYNAMICOBJECT_H
|
#define DYNAMICOBJECT_H
|
||||||
|
#include "Object.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class DynamicObject
|
class DynamicObject : public Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DynamicObject();
|
DynamicObject();
|
||||||
|
DynamicObject(void* collisionFunc, OBJECT_TYPE type);
|
||||||
~DynamicObject(void);
|
~DynamicObject(void);
|
||||||
|
|
||||||
void Update();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
|
||||||
PrivateData *myData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,39 +69,39 @@
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.dll</TargetExt>
|
<TargetExt>.dll</TargetExt>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<DelayLoadDLLs>GamePhysics_$(PlatformShortName)D.dll</DelayLoadDLLs>
|
<DelayLoadDLLs>GamePhysics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -109,12 +109,13 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>GamePhysics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -124,14 +125,15 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>GamePhysics_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
@ -141,14 +143,15 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>GamePhysics_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -168,22 +171,20 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="AttatchmentMassDriver.h" />
|
<ClInclude Include="AttatchmentMassDriver.h" />
|
||||||
<ClInclude Include="AttatchmentSocket.h" />
|
<ClInclude Include="AttatchmentSocket.h" />
|
||||||
<ClInclude Include="Camera.h" />
|
|
||||||
<ClInclude Include="CollisionManager.h" />
|
<ClInclude Include="CollisionManager.h" />
|
||||||
<ClInclude Include="DynamicObject.h" />
|
<ClInclude Include="DynamicObject.h" />
|
||||||
|
<ClInclude Include="GameLogicDef.h" />
|
||||||
<ClInclude Include="GameMode.h" />
|
<ClInclude Include="GameMode.h" />
|
||||||
<ClInclude Include="IAttatchment.h" />
|
<ClInclude Include="IAttatchment.h" />
|
||||||
<ClInclude Include="Level.h" />
|
<ClInclude Include="Level.h" />
|
||||||
<ClInclude Include="Object.h" />
|
<ClInclude Include="Object.h" />
|
||||||
<ClInclude Include="Player.h" />
|
<ClInclude Include="Player.h" />
|
||||||
<ClInclude Include="RefManager.h" />
|
|
||||||
<ClInclude Include="StaticObject.h" />
|
<ClInclude Include="StaticObject.h" />
|
||||||
<ClInclude Include="Weapon.h" />
|
<ClInclude Include="Weapon.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="AttatchmentMassDriver.cpp" />
|
<ClCompile Include="AttatchmentMassDriver.cpp" />
|
||||||
<ClCompile Include="AttatchmentSocket.cpp" />
|
<ClCompile Include="AttatchmentSocket.cpp" />
|
||||||
<ClCompile Include="Camera.cpp" />
|
|
||||||
<ClCompile Include="CollisionManager.cpp" />
|
<ClCompile Include="CollisionManager.cpp" />
|
||||||
<ClCompile Include="DynamicObject.cpp" />
|
<ClCompile Include="DynamicObject.cpp" />
|
||||||
<ClCompile Include="GameMode.cpp" />
|
<ClCompile Include="GameMode.cpp" />
|
||||||
|
@ -191,7 +192,6 @@
|
||||||
<ClCompile Include="Level.cpp" />
|
<ClCompile Include="Level.cpp" />
|
||||||
<ClCompile Include="Object.cpp" />
|
<ClCompile Include="Object.cpp" />
|
||||||
<ClCompile Include="Player.cpp" />
|
<ClCompile Include="Player.cpp" />
|
||||||
<ClCompile Include="RefManager.cpp" />
|
|
||||||
<ClCompile Include="StaticObject.cpp" />
|
<ClCompile Include="StaticObject.cpp" />
|
||||||
<ClCompile Include="Weapon.cpp" />
|
<ClCompile Include="Weapon.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef GAMELOGIC_GAMELOGICDEF_H
|
||||||
|
#define GAMELOGIC_GAMELOGICDEF_H
|
||||||
|
|
||||||
|
#ifndef DANBIAS_GAMELOGIC
|
||||||
|
#define DANBIAS_GAMELOGIC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DANBIAS_GAMELOGIC_DLL_EXPORT
|
||||||
|
#define DANBIAS_GAMELOGIC_DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DANBIAS_GAMELOGIC_DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // !GAMELOGIC_GAMELOGICDEF_H
|
|
@ -36,6 +36,13 @@ namespace GameLogic
|
||||||
WEAPON_STATE_IDLE = 1,
|
WEAPON_STATE_IDLE = 1,
|
||||||
WEAPON_STATE_RELOADING = 2,
|
WEAPON_STATE_RELOADING = 2,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
enum OBJECT_TYPE
|
||||||
|
{
|
||||||
|
OBJECT_TYPE_PLAYER = 0,
|
||||||
|
OBJECT_TYPE_BOX = 1,
|
||||||
|
OBJECT_TYPE_UNKNOWN = 2,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,22 +3,6 @@
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
struct IAttatchment::PrivateData
|
|
||||||
{
|
|
||||||
PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}myData;
|
|
||||||
|
|
||||||
IAttatchment::IAttatchment(void)
|
IAttatchment::IAttatchment(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
//Created by Erik of the GameLogic team
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef IATTATCHMENT_H
|
#ifndef IATTATCHMENT_H
|
||||||
#define IATTATCHMENT_H
|
#define IATTATCHMENT_H
|
||||||
#include "GameLogicStates.h"
|
#include "GameLogicStates.h"
|
||||||
|
#include "Player.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
@ -16,9 +21,10 @@ namespace GameLogic
|
||||||
|
|
||||||
virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
|
virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
|
||||||
PrivateData *myData;
|
protected:
|
||||||
|
Player *owner;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "StaticObject.h"
|
#include "StaticObject.h"
|
||||||
#include "DynamicObject.h"
|
#include "DynamicObject.h"
|
||||||
#include "GameMode.h"
|
#include "GameMode.h"
|
||||||
|
#include "Player.h"
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
@ -9,16 +10,14 @@ struct Level::PrivateData
|
||||||
{
|
{
|
||||||
PrivateData()
|
PrivateData()
|
||||||
{
|
{
|
||||||
gameMode = new GameMode();
|
|
||||||
}
|
}
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
{
|
{
|
||||||
if (gameMode)
|
|
||||||
{
|
|
||||||
delete gameMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player *players;
|
||||||
|
int nrOfPlayers;
|
||||||
|
|
||||||
StaticObject** staticObjects;
|
StaticObject** staticObjects;
|
||||||
int nrOfStaticObjects;
|
int nrOfStaticObjects;
|
||||||
|
@ -40,3 +39,10 @@ Level::~Level(void)
|
||||||
{
|
{
|
||||||
delete myData;
|
delete myData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Level::InitiateLevel(std::string levelPath)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
#ifndef LEVEL_H
|
#ifndef LEVEL_H
|
||||||
#define LEVEL_H
|
#define LEVEL_H
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
@ -14,6 +15,8 @@ namespace GameLogic
|
||||||
Level(void);
|
Level(void);
|
||||||
~Level(void);
|
~Level(void);
|
||||||
|
|
||||||
|
void InitiateLevel(std::string levelPath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData *myData;
|
PrivateData *myData;
|
||||||
|
|
|
@ -1,48 +1,55 @@
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "OysterMath.h"
|
#include "OysterMath.h"
|
||||||
#include "DllInterfaces\GFXAPI.h"
|
|
||||||
#include "CollisionManager.h"
|
#include "CollisionManager.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
using namespace Oyster::Math;
|
using namespace Oyster::Math;
|
||||||
using namespace Oyster::Graphics::Model;
|
|
||||||
|
|
||||||
using namespace Utility::DynamicMemory;
|
|
||||||
using namespace Oyster::Physics;
|
using namespace Oyster::Physics;
|
||||||
|
|
||||||
Object::Object(std::wstring objFile)
|
Object::Object()
|
||||||
{
|
{
|
||||||
|
|
||||||
//model = new Model();
|
|
||||||
model = Oyster::Graphics::API::CreateModel(objFile);
|
|
||||||
|
|
||||||
API::SimpleBodyDescription sbDesc;
|
API::SimpleBodyDescription sbDesc;
|
||||||
//sbDesc.centerPosition =
|
//sbDesc.centerPosition =
|
||||||
|
|
||||||
//poi
|
//poi
|
||||||
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);
|
rigidBody->gameObjectRef = this;
|
||||||
|
|
||||||
|
this->type = OBJECT_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
||||||
|
{
|
||||||
|
API::SimpleBodyDescription sbDesc;
|
||||||
|
//sbDesc.centerPosition =
|
||||||
|
|
||||||
|
//poi
|
||||||
|
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
|
rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
|
||||||
|
|
||||||
|
rigidBody->gameObjectRef = this;
|
||||||
|
|
||||||
|
this->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object::~Object(void)
|
Object::~Object(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
Oyster::Graphics::API::DeleteModel(model);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::Render()
|
OBJECT_TYPE Object::GetType()
|
||||||
{
|
|
||||||
this->rigidBody->GetOrientation(model->WorldMatrix);
|
|
||||||
Oyster::Graphics::API::RenderScene(model, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object::OBJECT_TYPE Object::GetType()
|
|
||||||
{
|
{
|
||||||
return this->type;
|
return this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Oyster::Physics::ICustomBody* Object::GetRigidBody()
|
||||||
|
{
|
||||||
|
return this->rigidBody;
|
||||||
|
}
|
||||||
|
|
|
@ -7,41 +7,27 @@
|
||||||
#define OBJECT_H
|
#define OBJECT_H
|
||||||
|
|
||||||
#include "PhysicsAPI.h"
|
#include "PhysicsAPI.h"
|
||||||
#include "DllInterfaces/GFXAPI.h"
|
#include "GameLogicStates.h"
|
||||||
|
#include "GameLogicDef.h"
|
||||||
#include "Model/Model.h"
|
|
||||||
#include "Utilities.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
class Object
|
class DANBIAS_GAMELOGIC_DLL Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Object();
|
||||||
enum OBJECT_TYPE
|
Object(void* collisionFunc, OBJECT_TYPE type);
|
||||||
{
|
~Object(void);
|
||||||
OBJECT_TYPE_PLAYER,
|
|
||||||
OBJECT_TYPE_BOX,
|
|
||||||
};
|
|
||||||
Object(std::wstring objFile );
|
|
||||||
virtual ~Object(void);
|
|
||||||
|
|
||||||
void Render();
|
|
||||||
|
|
||||||
OBJECT_TYPE GetType();
|
OBJECT_TYPE GetType();
|
||||||
|
|
||||||
|
Oyster::Physics::ICustomBody* GetRigidBody();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OBJECT_TYPE type;
|
OBJECT_TYPE type;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
|
||||||
//rigidBody
|
|
||||||
|
|
||||||
Oyster::Physics::ICustomBody *rigidBody;
|
Oyster::Physics::ICustomBody *rigidBody;
|
||||||
Oyster::Graphics::Model::Model *model;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ struct Player::PrivateData
|
||||||
life = 100;
|
life = 100;
|
||||||
playerState = PLAYER_STATE_IDLE;
|
playerState = PLAYER_STATE_IDLE;
|
||||||
|
|
||||||
rigidBody->SetSubscription(CollisionManager::PlayerCollision);
|
lookDir = Oyster::Math::Float3(1,0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
|
@ -30,16 +29,16 @@ struct Player::PrivateData
|
||||||
int life;
|
int life;
|
||||||
Weapon *weapon;
|
Weapon *weapon;
|
||||||
PLAYER_STATE playerState;
|
PLAYER_STATE playerState;
|
||||||
|
Oyster::Math::Float3 lookDir;
|
||||||
ICustomBody *rigidBody;
|
|
||||||
|
|
||||||
}myData;
|
}myData;
|
||||||
|
|
||||||
Player::Player()
|
Player::Player()
|
||||||
|
:Object(CollisionManager::PlayerCollision, OBJECT_TYPE_PLAYER)
|
||||||
{
|
{
|
||||||
myData = new PrivateData();
|
myData = new PrivateData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
{
|
{
|
||||||
delete myData;
|
delete myData;
|
||||||
|
@ -61,12 +60,16 @@ void Player::Update()
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void Player::Move(const PLAYER_MOVEMENT &movement)
|
void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
{
|
{
|
||||||
|
Oyster::Math::Float3 currentVelocity = rigidBody->GetRigidLinearVelocity();
|
||||||
|
|
||||||
switch(movement)
|
switch(movement)
|
||||||
{
|
{
|
||||||
case PLAYER_MOVEMENT_FORWARD:
|
case PLAYER_MOVEMENT_FORWARD:
|
||||||
|
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),myData->lookDir * 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_BACKWARD:
|
case PLAYER_MOVEMENT_BACKWARD:
|
||||||
|
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-myData->lookDir * 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_LEFT:
|
case PLAYER_MOVEMENT_LEFT:
|
||||||
|
@ -83,9 +86,9 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Uses the players weapon based on user input
|
* Uses the players weapon based on user input
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void Player::Shoot(const WEAPON_FIRE &fireInput)
|
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
||||||
{
|
{
|
||||||
myData->weapon->UseWeapon(fireInput);
|
myData->weapon->Use(fireInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
@ -94,7 +97,7 @@ void Player::Shoot(const WEAPON_FIRE &fireInput)
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
{
|
{
|
||||||
|
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-Oyster::Math::Float3(0,1,0) * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsWalking()
|
bool Player::IsWalking()
|
||||||
|
@ -112,7 +115,12 @@ bool Player::IsIdle()
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetPos()
|
Oyster::Math::Float3 Player::GetPos()
|
||||||
{
|
{
|
||||||
return myData->rigidBody->GetCenter();
|
return rigidBody->GetCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
Oyster::Math::Float3 Player::GetLookDir()
|
||||||
|
{
|
||||||
|
return myData->lookDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
@ -123,3 +131,9 @@ void Player::Respawn()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Player::DamageLife(int damage)
|
||||||
|
{
|
||||||
|
myData->life -= damage;
|
||||||
|
}
|
|
@ -5,10 +5,12 @@
|
||||||
#define PLAYER_H
|
#define PLAYER_H
|
||||||
#include "GameLogicStates.h"
|
#include "GameLogicStates.h"
|
||||||
#include "OysterMath.h"
|
#include "OysterMath.h"
|
||||||
|
#include "Object.h"
|
||||||
|
#include "GameLogicDef.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
class Player
|
class DANBIAS_GAMELOGIC_DLL Player : public Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -17,7 +19,7 @@ namespace GameLogic
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void Move(const PLAYER_MOVEMENT &movement);
|
void Move(const PLAYER_MOVEMENT &movement);
|
||||||
void Shoot(const WEAPON_FIRE &fireInput);
|
void UseWeapon(const WEAPON_FIRE &fireInput);
|
||||||
void Jump();
|
void Jump();
|
||||||
|
|
||||||
bool IsWalking();
|
bool IsWalking();
|
||||||
|
@ -25,8 +27,12 @@ namespace GameLogic
|
||||||
bool IsIdle();
|
bool IsIdle();
|
||||||
|
|
||||||
Oyster::Math::Float3 GetPos();
|
Oyster::Math::Float3 GetPos();
|
||||||
|
Oyster::Math::Float3 GetLookDir();
|
||||||
|
|
||||||
void Respawn();
|
void Respawn();
|
||||||
|
|
||||||
|
void DamageLife(int damage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData *myData;
|
PrivateData *myData;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include<map>
|
#include<map>
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "PhysicsAPI.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,28 +2,22 @@
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
struct StaticObject::PrivateData
|
|
||||||
{
|
|
||||||
PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~PrivateData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}myData;
|
|
||||||
|
|
||||||
|
|
||||||
StaticObject::StaticObject()
|
StaticObject::StaticObject()
|
||||||
|
:Object()
|
||||||
{
|
{
|
||||||
myData = new PrivateData();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticObject::StaticObject(void* collisionFunc, OBJECT_TYPE type)
|
||||||
|
:Object(collisionFunc,type)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StaticObject::~StaticObject(void)
|
StaticObject::~StaticObject(void)
|
||||||
{
|
{
|
||||||
delete myData;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,16 @@
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
class StaticObject
|
class StaticObject : public Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StaticObject();
|
StaticObject();
|
||||||
|
StaticObject(void* collisionFunc, OBJECT_TYPE type);
|
||||||
~StaticObject(void);
|
~StaticObject(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
|
||||||
PrivateData *myData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,24 @@ struct Weapon::PrivateData
|
||||||
PrivateData()
|
PrivateData()
|
||||||
{
|
{
|
||||||
weaponState = WEAPON_STATE_IDLE;
|
weaponState = WEAPON_STATE_IDLE;
|
||||||
SelectedAttatchment = new AttatchmentMassDriver();
|
selectedAttatchment = 0;
|
||||||
|
currentNrOfAttatchments = 0;
|
||||||
|
selectedSocketID = 0;
|
||||||
|
maxNrOfSockets = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
{
|
{
|
||||||
delete SelectedAttatchment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WEAPON_STATE weaponState;
|
WEAPON_STATE weaponState;
|
||||||
|
|
||||||
AttatchmentSocket **attatchmentSockets;
|
AttatchmentSocket **attatchmentSockets;
|
||||||
int nrOfAttatchmentSockets;
|
int maxNrOfSockets;
|
||||||
|
int currentNrOfAttatchments;
|
||||||
|
|
||||||
IAttatchment *SelectedAttatchment;
|
IAttatchment *selectedAttatchment;
|
||||||
|
int selectedSocketID;
|
||||||
|
|
||||||
}myData;
|
}myData;
|
||||||
|
|
||||||
|
@ -31,6 +35,17 @@ Weapon::Weapon()
|
||||||
myData = new PrivateData();
|
myData = new PrivateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Weapon::Weapon(int MaxNrOfSockets)
|
||||||
|
{
|
||||||
|
myData = new PrivateData();
|
||||||
|
myData->maxNrOfSockets = MaxNrOfSockets;
|
||||||
|
myData->attatchmentSockets = new AttatchmentSocket*[MaxNrOfSockets];
|
||||||
|
for (int i = 0; i < MaxNrOfSockets; i++)
|
||||||
|
{
|
||||||
|
myData->attatchmentSockets[i] = new AttatchmentSocket();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Weapon::~Weapon(void)
|
Weapon::~Weapon(void)
|
||||||
{
|
{
|
||||||
|
@ -40,9 +55,9 @@ Weapon::~Weapon(void)
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Uses the weapon based on the input given and the current chosen attatchment
|
* Uses the weapon based on the input given and the current chosen attatchment
|
||||||
********************************************************/
|
********************************************************/
|
||||||
void Weapon::UseWeapon(const WEAPON_FIRE &fireInput)
|
void Weapon::Use(const WEAPON_FIRE &fireInput)
|
||||||
{
|
{
|
||||||
myData->SelectedAttatchment->UseAttatchment(fireInput);
|
myData->selectedAttatchment->UseAttatchment(fireInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
@ -67,3 +82,56 @@ bool Weapon::IsReloading()
|
||||||
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_RELOADING);
|
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_RELOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Weapon::IsValidSocket(int socketID)
|
||||||
|
{
|
||||||
|
if(socketID < myData->maxNrOfSockets && socketID >= 0)
|
||||||
|
{
|
||||||
|
if (myData->attatchmentSockets[socketID]->GetAttatchment() != 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Weapon::GetCurrentSocketID()
|
||||||
|
{
|
||||||
|
return myData->selectedSocketID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Weapon::AddNewAttatchment(IAttatchment *attatchment, Player *owner)
|
||||||
|
{
|
||||||
|
if(myData->currentNrOfAttatchments < myData->maxNrOfSockets)
|
||||||
|
{
|
||||||
|
myData->attatchmentSockets[myData->currentNrOfAttatchments]->SetAttatchment(attatchment);
|
||||||
|
myData->currentNrOfAttatchments++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID, Player *owner)
|
||||||
|
{
|
||||||
|
if (IsValidSocket(socketID))
|
||||||
|
{
|
||||||
|
myData->attatchmentSockets[socketID]->SetAttatchment(attatchment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Weapon::RemoveAttatchment(int socketID)
|
||||||
|
{
|
||||||
|
if (IsValidSocket(socketID))
|
||||||
|
{
|
||||||
|
myData->attatchmentSockets[socketID]->RemoveAttatchment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Weapon::SelectAttatchment(int socketID)
|
||||||
|
{
|
||||||
|
if (IsValidSocket(socketID))
|
||||||
|
{
|
||||||
|
myData->selectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment();
|
||||||
|
myData->selectedSocketID = socketID;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,8 @@
|
||||||
#ifndef WEAPON_H
|
#ifndef WEAPON_H
|
||||||
#define WEAPON_H
|
#define WEAPON_H
|
||||||
#include "GameLogicStates.h"
|
#include "GameLogicStates.h"
|
||||||
|
#include "IAttatchment.h"
|
||||||
|
#include "Player.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
@ -15,14 +17,24 @@ namespace GameLogic
|
||||||
|
|
||||||
|
|
||||||
Weapon(void);
|
Weapon(void);
|
||||||
|
Weapon(int nrOfAttatchmentSockets);
|
||||||
~Weapon(void);
|
~Weapon(void);
|
||||||
|
|
||||||
void UseWeapon(const WEAPON_FIRE &fireInput);
|
void Use(const WEAPON_FIRE &fireInput);
|
||||||
|
|
||||||
|
void AddNewAttatchment(IAttatchment *attatchment, Player *owner);
|
||||||
|
void SwitchAttatchment(IAttatchment *attatchment, int socketID, Player *owner);
|
||||||
|
void RemoveAttatchment(int socketID);
|
||||||
|
|
||||||
|
void SelectAttatchment(int socketID);
|
||||||
|
|
||||||
bool IsFireing();
|
bool IsFireing();
|
||||||
bool IsIdle();
|
bool IsIdle();
|
||||||
bool IsReloading();
|
bool IsReloading();
|
||||||
|
bool IsValidSocket(int socketID);
|
||||||
|
|
||||||
|
int GetCurrentSocketID();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -154,8 +154,11 @@
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="LobbyProtocols.h" />
|
||||||
|
<ClInclude Include="ObjectProtocols.h" />
|
||||||
<ClInclude Include="PlayerProtocols.h" />
|
<ClInclude Include="PlayerProtocols.h" />
|
||||||
<ClInclude Include="ProtocolIdentificationID.h" />
|
<ClInclude Include="ProtocolIdentificationID.h" />
|
||||||
|
<ClInclude Include="TEST_PROTOCOLS.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||||
|
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||||
|
|
||||||
|
#include <CustomNetProtocol.h>
|
||||||
|
#include "ProtocolIdentificationID.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
struct Protocol_ObjectPosition :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
float worldMatrix[16];
|
||||||
|
// look at dir
|
||||||
|
|
||||||
|
Protocol_ObjectPosition()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_PlayerPosition;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[13].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[14].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[15].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[16].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
|
{
|
||||||
|
|
||||||
|
this->protocol[1].value = worldMatrix[0];
|
||||||
|
this->protocol[2].value = worldMatrix[1];
|
||||||
|
this->protocol[3].value = worldMatrix[2]; //Forgot?
|
||||||
|
this->protocol[4].value = worldMatrix[4]; //Forgot?
|
||||||
|
this->protocol[5].value = worldMatrix[5];
|
||||||
|
this->protocol[6].value = worldMatrix[6];
|
||||||
|
this->protocol[7].value = worldMatrix[7];
|
||||||
|
this->protocol[8].value = worldMatrix[8];
|
||||||
|
this->protocol[9].value = worldMatrix[9];
|
||||||
|
this->protocol[10].value = worldMatrix[10];
|
||||||
|
this->protocol[11].value = worldMatrix[11];
|
||||||
|
this->protocol[12].value = worldMatrix[12];
|
||||||
|
this->protocol[13].value = worldMatrix[13];
|
||||||
|
this->protocol[14].value = worldMatrix[14];
|
||||||
|
this->protocol[15].value = worldMatrix[15];
|
||||||
|
this->protocol[16].value = worldMatrix[16];
|
||||||
|
return &protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
@ -1,14 +1,19 @@
|
||||||
|
//////////////////////////////////////////////////////////
|
||||||
|
// Created 2013 //
|
||||||
|
// Dennis Andersen, Linda Andersson //
|
||||||
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||||
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||||
|
|
||||||
#include "CustomNetProtocol.h"
|
#include <CustomNetProtocol.h>
|
||||||
#include "ProtocolIdentificationID.h"
|
#include "ProtocolIdentificationID.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
struct Protocol_PlayerMovement :public Network::CustomProtocolObject
|
struct Protocol_PlayerMovement :public Oyster::Network::CustomProtocolObject
|
||||||
{
|
{
|
||||||
int ProtocolID;
|
int ProtocolID;
|
||||||
bool bForward;
|
bool bForward;
|
||||||
|
@ -20,31 +25,60 @@ namespace GameLogic
|
||||||
|
|
||||||
Protocol_PlayerMovement()
|
Protocol_PlayerMovement()
|
||||||
{
|
{
|
||||||
protocol[0]->value = ProtocolID = protocol_PlayerNavigation;
|
this->protocol[0].value = ProtocolID = protocol_PlayerNavigation;
|
||||||
|
|
||||||
protocol[0]->type = Network::NetAttributeType_Int;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
||||||
protocol[1]->type = Network::NetAttributeType_Bool;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
protocol[2]->type = Network::NetAttributeType_Bool;
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
protocol[3]->type = Network::NetAttributeType_Bool;
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
protocol[4]->type = Network::NetAttributeType_Bool;
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
protocol[5]->type = Network::NetAttributeType_Bool;
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
protocol[6]->type = Network::NetAttributeType_Bool;
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
}
|
}
|
||||||
Network::CustomNetProtocol* GetProtocol() override
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
{
|
{
|
||||||
protocol[1]->value = bForward;
|
this->protocol[1].value = bForward;
|
||||||
protocol[2]->value = bBackward;
|
this->protocol[2].value = bBackward;
|
||||||
protocol[3]->value = bTurnLeft;
|
this->protocol[3].value = bTurnLeft;
|
||||||
protocol[4]->value = bTurnRight;
|
this->protocol[4].value = bTurnRight;
|
||||||
protocol[5]->value = bStrafeRight;
|
this->protocol[5].value = bStrafeRight;
|
||||||
protocol[6]->value = bStrafeRight;
|
this->protocol[6].value = bStrafeRight;
|
||||||
|
|
||||||
return &protocol;
|
return &protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Network::CustomNetProtocol protocol;
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Protocol_PlayerPosition :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
float position[3];
|
||||||
|
// look at dir
|
||||||
|
|
||||||
|
Protocol_PlayerPosition()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_PlayerPosition;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
|
{
|
||||||
|
|
||||||
|
this->protocol[1].value = position[0];
|
||||||
|
this->protocol[2].value = position[1];
|
||||||
|
this->protocol[3].value = position[2];
|
||||||
|
return &protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created 2013 by:
|
||||||
|
// [Dennis Andersen], [Linda Andersson]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
#ifndef GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
#ifndef GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
||||||
#define GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
#define GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
||||||
|
|
||||||
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
||||||
|
|
||||||
#define protocol_PlayerNavigation 0;
|
#define protocol_PlayerNavigation 0
|
||||||
|
#define protocol_PlayerPosition 1
|
||||||
|
#define protocol_ObjectPosition 2
|
||||||
|
|
||||||
|
#define protocol_Lobby_Msg 60
|
||||||
|
|
||||||
|
#define protocol_General_Disconnect 100
|
||||||
|
#define protocol_General_Ping 101
|
||||||
|
|
||||||
|
#define PROTOCOL_TEST 1000
|
||||||
|
|
||||||
#endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
#endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef GAMESERVER_TEST_H
|
||||||
|
#define GAMESERVER_TEST_H
|
||||||
|
|
||||||
|
#include <CustomNetProtocol.h>
|
||||||
|
#include "ProtocolIdentificationID.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
struct Protocol_TEST :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
int ProtocolID;
|
||||||
|
char text;
|
||||||
|
|
||||||
|
Protocol_TEST()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = ProtocolID = PROTOCOL_TEST;
|
||||||
|
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Char;
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
|
{
|
||||||
|
this->protocol[1].value = text;
|
||||||
|
|
||||||
|
return &protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !GAMESERVER_TEST_H
|
|
@ -91,9 +91,12 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ModuleDefinitionFile>
|
||||||
|
</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -102,9 +105,12 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ModuleDefinitionFile>
|
||||||
|
</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -115,11 +121,14 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>
|
||||||
|
</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
@ -130,11 +139,14 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>
|
||||||
|
</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -154,6 +166,8 @@
|
||||||
<ClInclude Include="Implementation\SimpleRigidBody.h" />
|
<ClInclude Include="Implementation\SimpleRigidBody.h" />
|
||||||
<ClInclude Include="Implementation\SphericalRigidBody.h" />
|
<ClInclude Include="Implementation\SphericalRigidBody.h" />
|
||||||
<ClInclude Include="PhysicsAPI.h" />
|
<ClInclude Include="PhysicsAPI.h" />
|
||||||
|
<ClInclude Include="PhysicsStructs-Impl.h" />
|
||||||
|
<ClInclude Include="PhysicsStructs.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Implementation\Octree.cpp" />
|
<ClCompile Include="Implementation\Octree.cpp" />
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
<ClInclude Include="Implementation\Octree.h">
|
<ClInclude Include="Implementation\Octree.h">
|
||||||
<Filter>Header Files\Implementation</Filter>
|
<Filter>Header Files\Implementation</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="PhysicsStructs.h">
|
||||||
|
<Filter>Header Files\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="PhysicsStructs-Impl.h">
|
||||||
|
<Filter>Header Files\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Implementation\PhysicsAPI_Impl.cpp">
|
<ClCompile Include="Implementation\PhysicsAPI_Impl.cpp">
|
||||||
|
|
|
@ -39,7 +39,7 @@ void Octree::AddObject(UniquePointer< ICustomBody > customBodyRef)
|
||||||
data.next = NULL;
|
data.next = NULL;
|
||||||
data.prev = NULL;
|
data.prev = NULL;
|
||||||
data.customBodyRef = customBodyRef;
|
data.customBodyRef = customBodyRef;
|
||||||
this->mapReferences.insert(std::pair <ICustomBody*, unsigned int> (customBodyRef, this->leafData.size()));
|
this->mapReferences.insert(std::pair <ICustomBody*, unsigned int> (data.customBodyRef, this->leafData.size()));
|
||||||
this->leafData.push_back(data);
|
this->leafData.push_back(data);
|
||||||
|
|
||||||
/*if(tempPtr != NULL)
|
/*if(tempPtr != NULL)
|
||||||
|
@ -184,6 +184,7 @@ unsigned int Octree::GetTemporaryReferenceOf( const ICustomBody* objRef ) const
|
||||||
|
|
||||||
void Octree::SetAsAltered( unsigned int tempRef )
|
void Octree::SetAsAltered( unsigned int tempRef )
|
||||||
{
|
{
|
||||||
|
this->leafData[tempRef].container = this->leafData[tempRef].customBodyRef->GetBoundingSphere();
|
||||||
//! @todo TODO: implement stub
|
//! @todo TODO: implement stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,36 +20,36 @@ namespace
|
||||||
|
|
||||||
float deltaWhen;
|
float deltaWhen;
|
||||||
Float3 worldWhere;
|
Float3 worldWhere;
|
||||||
if( deuter->Intersects(*deuter, 1.0f, deltaWhen, worldWhere) )
|
if( proto->Intersects(*deuter, 1.0f, deltaWhen, worldWhere) )
|
||||||
{
|
{
|
||||||
proto->CallSubscription( proto, deuter );
|
proto->CallSubscription( proto, deuter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Float4x4 & MomentOfInertia::CreateSphereMatrix( const Float mass, const Float radius)
|
Float4x4 & MomentOfInertia::CreateSphereMatrix( const Float mass, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||||
{
|
{
|
||||||
return Formula::MomentOfInertia::Sphere(mass, radius);
|
return targetMem = Formula::MomentOfInertia::Sphere(mass, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float4x4 & MomentOfInertia::CreateHollowSphereMatrix( const Float mass, const Float radius)
|
Float4x4 & MomentOfInertia::CreateHollowSphereMatrix( const Float mass, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||||
{
|
{
|
||||||
return Formula::MomentOfInertia::HollowSphere(mass, radius);
|
return targetMem = Formula::MomentOfInertia::HollowSphere(mass, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float4x4 & MomentOfInertia::CreateCuboidMatrix( const Float mass, const Float height, const Float width, const Float depth )
|
Float4x4 & MomentOfInertia::CreateCuboidMatrix( const Float mass, const Float height, const Float width, const Float depth, ::Oyster::Math::Float4x4 &targetMem )
|
||||||
{
|
{
|
||||||
return Formula::MomentOfInertia::Cuboid(mass, height, width, depth);
|
return targetMem = Formula::MomentOfInertia::Cuboid(mass, height, width, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float4x4 & MomentOfInertia::CreateCylinderMatrix( const Float mass, const Float height, const Float radius )
|
Float4x4 & MomentOfInertia::CreateCylinderMatrix( const Float mass, const Float height, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||||
{
|
{
|
||||||
return Formula::MomentOfInertia::Cylinder(mass, height, radius);
|
return targetMem = Formula::MomentOfInertia::Cylinder(mass, height, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float4x4 & MomentOfInertia::CreateRodMatrix( const Float mass, const Float length )
|
Float4x4 & MomentOfInertia::CreateRodMatrix( const Float mass, const Float length, ::Oyster::Math::Float4x4 &targetMem )
|
||||||
{
|
{
|
||||||
return Formula::MomentOfInertia::RodCenter(mass, length);
|
return targetMem = Formula::MomentOfInertia::RodCenter(mass, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
API & API::Instance()
|
API & API::Instance()
|
||||||
|
|
|
@ -42,6 +42,23 @@ UniquePointer<ICustomBody> SimpleRigidBody::Clone() const
|
||||||
return new SimpleRigidBody( *this );
|
return new SimpleRigidBody( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SimpleRigidBody::State SimpleRigidBody::GetState() const
|
||||||
|
{
|
||||||
|
return State( this->rigid.box.boundingOffset, this->rigid.box.center, AngularAxis(this->rigid.box.rotation).xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleRigidBody::State & SimpleRigidBody::GetState( SimpleRigidBody::State &targetMem ) const
|
||||||
|
{
|
||||||
|
return targetMem = State( this->rigid.box.boundingOffset, this->rigid.box.center, AngularAxis(this->rigid.box.rotation).xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleRigidBody::SetState( const SimpleRigidBody::State &state )
|
||||||
|
{ /** @todo TODO: temporary solution! Need to know it's occtree */
|
||||||
|
this->rigid.box.boundingOffset = state.GetReach();
|
||||||
|
this->rigid.box.center = state.GetCenterPosition();
|
||||||
|
this->rigid.box.rotation = state.GetRotation();
|
||||||
|
}
|
||||||
|
|
||||||
void SimpleRigidBody::CallSubscription( const ICustomBody *proto, const ICustomBody *deuter )
|
void SimpleRigidBody::CallSubscription( const ICustomBody *proto, const ICustomBody *deuter )
|
||||||
{
|
{
|
||||||
this->collisionAction( proto, deuter );
|
this->collisionAction( proto, deuter );
|
||||||
|
@ -107,6 +124,12 @@ Float4x4 & SimpleRigidBody::GetView( Float4x4 &targetMem ) const
|
||||||
return targetMem = this->rigid.GetView();
|
return targetMem = this->rigid.GetView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Float3 SimpleRigidBody::GetRigidLinearVelocity() const
|
||||||
|
{
|
||||||
|
return this->rigid.GetLinearVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateState SimpleRigidBody::Update( Float timeStepLength )
|
UpdateState SimpleRigidBody::Update( Float timeStepLength )
|
||||||
{
|
{
|
||||||
this->rigid.Update_LeapFrog( timeStepLength );
|
this->rigid.Update_LeapFrog( timeStepLength );
|
||||||
|
@ -177,4 +200,9 @@ void SimpleRigidBody::SetOrientation( const Float4x4 &orientation )
|
||||||
void SimpleRigidBody::SetSize( const Float3 &size )
|
void SimpleRigidBody::SetSize( const Float3 &size )
|
||||||
{
|
{
|
||||||
this->rigid.SetSize( size );
|
this->rigid.SetSize( size );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleRigidBody::SetMomentum( const Float3 &worldG )
|
||||||
|
{
|
||||||
|
this->rigid.SetLinearMomentum( worldG );
|
||||||
}
|
}
|
|
@ -15,6 +15,11 @@ namespace Oyster { namespace Physics
|
||||||
|
|
||||||
::Utility::DynamicMemory::UniquePointer<ICustomBody> Clone() const;
|
::Utility::DynamicMemory::UniquePointer<ICustomBody> Clone() const;
|
||||||
|
|
||||||
|
State GetState() const;
|
||||||
|
State & GetState( State &targetMem ) const;
|
||||||
|
void SetState( const State &state );
|
||||||
|
::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
||||||
|
|
||||||
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
|
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
|
||||||
bool IsAffectedByGravity() const;
|
bool IsAffectedByGravity() const;
|
||||||
bool Intersects( const ICustomBody &object, ::Oyster::Math::Float timeStepLength, ::Oyster::Math::Float &deltaWhen, ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
bool Intersects( const ICustomBody &object, ::Oyster::Math::Float timeStepLength, ::Oyster::Math::Float &deltaWhen, ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||||
|
@ -41,6 +46,7 @@ namespace Oyster { namespace Physics
|
||||||
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
||||||
void SetOrientation( const ::Oyster::Math::Float4x4 &orientation );
|
void SetOrientation( const ::Oyster::Math::Float4x4 &orientation );
|
||||||
void SetSize( const ::Oyster::Math::Float3 &size );
|
void SetSize( const ::Oyster::Math::Float3 &size );
|
||||||
|
void SetMomentum( const ::Oyster::Math::Float3 &worldG );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
::Oyster::Physics3D::RigidBody rigid;
|
::Oyster::Physics3D::RigidBody rigid;
|
||||||
|
|
|
@ -44,6 +44,23 @@ UniquePointer<ICustomBody> SphericalRigidBody::Clone() const
|
||||||
return new SphericalRigidBody( *this );
|
return new SphericalRigidBody( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SphericalRigidBody::State SphericalRigidBody::GetState() const
|
||||||
|
{
|
||||||
|
return State( this->rigid.box.boundingOffset, this->rigid.box.center, AngularAxis(this->rigid.box.rotation).xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
SphericalRigidBody::State & SphericalRigidBody::GetState( SphericalRigidBody::State &targetMem ) const
|
||||||
|
{
|
||||||
|
return targetMem = State( this->rigid.box.boundingOffset, this->rigid.box.center, AngularAxis(this->rigid.box.rotation).xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SphericalRigidBody::SetState( const SphericalRigidBody::State &state )
|
||||||
|
{ /** @todo TODO: temporary solution! Need to know it's occtree */
|
||||||
|
this->rigid.box.boundingOffset = state.GetReach();
|
||||||
|
this->rigid.box.center = state.GetCenterPosition();
|
||||||
|
this->rigid.box.rotation = state.GetRotation();
|
||||||
|
}
|
||||||
|
|
||||||
void SphericalRigidBody::CallSubscription( const ICustomBody *proto, const ICustomBody *deuter )
|
void SphericalRigidBody::CallSubscription( const ICustomBody *proto, const ICustomBody *deuter )
|
||||||
{
|
{
|
||||||
this->collisionAction( proto, deuter );
|
this->collisionAction( proto, deuter );
|
||||||
|
@ -109,6 +126,11 @@ Float4x4 & SphericalRigidBody::GetView( Float4x4 &targetMem ) const
|
||||||
return targetMem = this->rigid.GetView();
|
return targetMem = this->rigid.GetView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Float3 SphericalRigidBody::GetRigidLinearVelocity() const
|
||||||
|
{
|
||||||
|
return this->rigid.GetLinearVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateState SphericalRigidBody::Update( Float timeStepLength )
|
UpdateState SphericalRigidBody::Update( Float timeStepLength )
|
||||||
{
|
{
|
||||||
this->rigid.Update_LeapFrog( timeStepLength );
|
this->rigid.Update_LeapFrog( timeStepLength );
|
||||||
|
@ -183,4 +205,9 @@ void SphericalRigidBody::SetSize( const Float3 &size )
|
||||||
{
|
{
|
||||||
this->rigid.SetSize( size );
|
this->rigid.SetSize( size );
|
||||||
this->body.radius = 0.5f * Min( Min( size.x, size.y ), size.z ); // inline Min( FloatN )?
|
this->body.radius = 0.5f * Min( Min( size.x, size.y ), size.z ); // inline Min( FloatN )?
|
||||||
|
}
|
||||||
|
|
||||||
|
void SphericalRigidBody::SetMomentum( const Float3 &worldG )
|
||||||
|
{
|
||||||
|
this->rigid.SetLinearMomentum( worldG );
|
||||||
}
|
}
|
|
@ -16,6 +16,11 @@ namespace Oyster { namespace Physics
|
||||||
|
|
||||||
::Utility::DynamicMemory::UniquePointer<ICustomBody> Clone() const;
|
::Utility::DynamicMemory::UniquePointer<ICustomBody> Clone() const;
|
||||||
|
|
||||||
|
State GetState() const;
|
||||||
|
State & GetState( State &targetMem = State() ) const;
|
||||||
|
void SetState( const State &state );
|
||||||
|
::Oyster::Math::Float3 GetRigidLinearVelocity() const;
|
||||||
|
|
||||||
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
|
void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter );
|
||||||
bool IsAffectedByGravity() const;
|
bool IsAffectedByGravity() const;
|
||||||
bool Intersects( const ICustomBody &object, ::Oyster::Math::Float timeStepLength, ::Oyster::Math::Float &deltaWhen, ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
bool Intersects( const ICustomBody &object, ::Oyster::Math::Float timeStepLength, ::Oyster::Math::Float &deltaWhen, ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||||
|
@ -42,6 +47,7 @@ namespace Oyster { namespace Physics
|
||||||
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
||||||
void SetOrientation( const ::Oyster::Math::Float4x4 &orientation );
|
void SetOrientation( const ::Oyster::Math::Float4x4 &orientation );
|
||||||
void SetSize( const ::Oyster::Math::Float3 &size );
|
void SetSize( const ::Oyster::Math::Float3 &size );
|
||||||
|
void SetMomentum( const ::Oyster::Math::Float3 &worldG );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
::Oyster::Physics3D::RigidBody rigid;
|
::Oyster::Physics3D::RigidBody rigid;
|
||||||
|
|
|
@ -17,6 +17,13 @@ namespace Oyster
|
||||||
class API;
|
class API;
|
||||||
class ICustomBody;
|
class ICustomBody;
|
||||||
|
|
||||||
|
namespace Struct
|
||||||
|
{
|
||||||
|
struct SimpleBodyDescription;
|
||||||
|
struct SphericalBodyDescription;
|
||||||
|
struct CustomBodyState;
|
||||||
|
}
|
||||||
|
|
||||||
enum UpdateState
|
enum UpdateState
|
||||||
{
|
{
|
||||||
UpdateState_resting,
|
UpdateState_resting,
|
||||||
|
@ -31,22 +38,22 @@ namespace Oyster
|
||||||
class PHYSICS_DLL_USAGE MomentOfInertia
|
class PHYSICS_DLL_USAGE MomentOfInertia
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static ::Oyster::Math::Float4x4 & CreateSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius);
|
static ::Oyster::Math::Float4x4 & CreateSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||||
|
|
||||||
static ::Oyster::Math::Float4x4 & CreateHollowSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius);
|
static ::Oyster::Math::Float4x4 & CreateHollowSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||||
|
|
||||||
static ::Oyster::Math::Float4x4 & CreateCuboidMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth );
|
static ::Oyster::Math::Float4x4 & CreateCuboidMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||||
|
|
||||||
static ::Oyster::Math::Float4x4 & CreateCylinderMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius );
|
static ::Oyster::Math::Float4x4 & CreateCylinderMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||||
|
|
||||||
static ::Oyster::Math::Float4x4 & CreateRodMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length );
|
static ::Oyster::Math::Float4x4 & CreateRodMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||||
};
|
};
|
||||||
|
|
||||||
class PHYSICS_DLL_USAGE API
|
class PHYSICS_DLL_USAGE API
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct SimpleBodyDescription;
|
typedef Struct::SimpleBodyDescription SimpleBodyDescription;
|
||||||
struct SphericalBodyDescription;
|
typedef Struct::SphericalBodyDescription SphericalBodyDescription;
|
||||||
|
|
||||||
typedef void (*EventAction_Destruction)( ::Utility::DynamicMemory::UniquePointer<ICustomBody> proto );
|
typedef void (*EventAction_Destruction)( ::Utility::DynamicMemory::UniquePointer<ICustomBody> proto );
|
||||||
|
|
||||||
|
@ -236,7 +243,15 @@ namespace Oyster
|
||||||
SubscriptMessage_ignore_collision_response
|
SubscriptMessage_ignore_collision_response
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* @param gameObjectRef: a pointer to the object in the game owning the rigid body.
|
||||||
|
********************************************************/
|
||||||
|
void* gameObjectRef;
|
||||||
|
|
||||||
typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
||||||
|
typedef Struct::SimpleBodyDescription SimpleBodyDescription;
|
||||||
|
typedef Struct::SphericalBodyDescription SphericalBodyDescription;
|
||||||
|
typedef Struct::CustomBodyState State;
|
||||||
|
|
||||||
virtual ~ICustomBody() {};
|
virtual ~ICustomBody() {};
|
||||||
|
|
||||||
|
@ -251,6 +266,26 @@ namespace Oyster
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ) = 0;
|
virtual void CallSubscription( const ICustomBody *proto, const ICustomBody *deuter ) = 0;
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* @todo TODO: need doc
|
||||||
|
********************************************************/
|
||||||
|
virtual State GetState() const = 0;
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* @todo TODO: need doc
|
||||||
|
********************************************************/
|
||||||
|
virtual State & GetState( State &targetMem ) const = 0;
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* @return the linear velocity of the rigid body in a vector.
|
||||||
|
********************************************************/
|
||||||
|
virtual Math::Float3 GetRigidLinearVelocity() const = 0;
|
||||||
|
|
||||||
|
/********************************************************
|
||||||
|
* @todo TODO: need doc
|
||||||
|
********************************************************/
|
||||||
|
virtual void SetState( const State &state ) = 0;
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* @return true if Engine should apply gravity on this object.
|
* @return true if Engine should apply gravity on this object.
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
@ -390,49 +425,16 @@ namespace Oyster
|
||||||
* Use API::SetSize(...)
|
* Use API::SetSize(...)
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void SetSize( const ::Oyster::Math::Float3 &size ) = 0;
|
virtual void SetSize( const ::Oyster::Math::Float3 &size ) = 0;
|
||||||
};
|
|
||||||
|
|
||||||
struct API::SimpleBodyDescription
|
/********************************************************
|
||||||
{
|
* To not be called if is in Engine
|
||||||
::Oyster::Math::Float4x4 rotation;
|
* Use API::?? @todo TODO:
|
||||||
::Oyster::Math::Float3 centerPosition;
|
********************************************************/
|
||||||
::Oyster::Math::Float3 size;
|
virtual void SetMomentum( const ::Oyster::Math::Float3 &worldG ) = 0;
|
||||||
::Oyster::Math::Float mass;
|
|
||||||
::Oyster::Math::Float4x4 inertiaTensor;
|
|
||||||
ICustomBody::EventAction_Collision subscription;
|
|
||||||
bool ignoreGravity;
|
|
||||||
|
|
||||||
SimpleBodyDescription()
|
|
||||||
{
|
|
||||||
this->rotation = ::Oyster::Math::Float4x4::identity;
|
|
||||||
this->centerPosition = ::Oyster::Math::Float3::null;
|
|
||||||
this->size = ::Oyster::Math::Float3( 1.0f );
|
|
||||||
this->mass = 12.0f;
|
|
||||||
this->inertiaTensor = ::Oyster::Math::Float4x4::identity;
|
|
||||||
this->subscription = NULL;
|
|
||||||
this->ignoreGravity = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct API::SphericalBodyDescription
|
|
||||||
{
|
|
||||||
::Oyster::Math::Float4x4 rotation;
|
|
||||||
::Oyster::Math::Float3 centerPosition;
|
|
||||||
::Oyster::Math::Float radius;
|
|
||||||
::Oyster::Math::Float mass;
|
|
||||||
ICustomBody::EventAction_Collision subscription;
|
|
||||||
bool ignoreGravity;
|
|
||||||
|
|
||||||
SphericalBodyDescription()
|
|
||||||
{
|
|
||||||
this->rotation = ::Oyster::Math::Float4x4::identity;
|
|
||||||
this->centerPosition = ::Oyster::Math::Float3::null;
|
|
||||||
this->radius = 0.5f;
|
|
||||||
this->mass = 10.0f;
|
|
||||||
this->subscription = NULL;
|
|
||||||
this->ignoreGravity = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "PhysicsStructs.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,117 @@
|
||||||
|
#ifndef PHYSICS_STRUCTS_IMPL_H
|
||||||
|
#define PHYSICS_STRUCTS_IMPL_H
|
||||||
|
|
||||||
|
#include "PhysicsStructs.h"
|
||||||
|
|
||||||
|
namespace Oyster { namespace Physics
|
||||||
|
{
|
||||||
|
namespace Struct
|
||||||
|
{
|
||||||
|
inline SimpleBodyDescription::SimpleBodyDescription()
|
||||||
|
{
|
||||||
|
this->rotation = ::Oyster::Math::Float4x4::identity;
|
||||||
|
this->centerPosition = ::Oyster::Math::Float3::null;
|
||||||
|
this->size = ::Oyster::Math::Float3( 1.0f );
|
||||||
|
this->mass = 12.0f;
|
||||||
|
this->inertiaTensor = ::Oyster::Math::Float4x4::identity;
|
||||||
|
this->subscription = NULL;
|
||||||
|
this->ignoreGravity = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline SphericalBodyDescription::SphericalBodyDescription()
|
||||||
|
{
|
||||||
|
this->rotation = ::Oyster::Math::Float4x4::identity;
|
||||||
|
this->centerPosition = ::Oyster::Math::Float3::null;
|
||||||
|
this->radius = 0.5f;
|
||||||
|
this->mass = 10.0f;
|
||||||
|
this->subscription = NULL;
|
||||||
|
this->ignoreGravity = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline CustomBodyState::CustomBodyState( const ::Oyster::Math::Float3 &reach, const ::Oyster::Math::Float3 ¢erPos, const ::Oyster::Math::Float3 &rotation )
|
||||||
|
{
|
||||||
|
this->reach = ::Oyster::Math::Float4( reach, 0.0f );
|
||||||
|
this->centerPos = ::Oyster::Math::Float4( centerPos, 1.0f );
|
||||||
|
this->angularAxis = ::Oyster::Math::Float4( rotation, 0.0f );
|
||||||
|
this->isSpatiallyAltered = this->isDisturbed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state )
|
||||||
|
{
|
||||||
|
this->reach = state.reach;
|
||||||
|
this->centerPos = state.centerPos;
|
||||||
|
this->angularAxis = state.angularAxis;
|
||||||
|
|
||||||
|
this->isSpatiallyAltered = state.isSpatiallyAltered;
|
||||||
|
this->isDisturbed = state.isDisturbed;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const ::Oyster::Math::Float4 & CustomBodyState::GetReach() const
|
||||||
|
{
|
||||||
|
return this->reach;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ::Oyster::Math::Float4 CustomBodyState::GetSize() const
|
||||||
|
{
|
||||||
|
return 2.0f * this->GetReach();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const ::Oyster::Math::Float4 & CustomBodyState::GetCenterPosition() const
|
||||||
|
{
|
||||||
|
return this->centerPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const ::Oyster::Math::Float4 & CustomBodyState::GetAngularAxis() const
|
||||||
|
{
|
||||||
|
return this->angularAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ::Oyster::Math::Float4x4 CustomBodyState::GetRotation() const
|
||||||
|
{
|
||||||
|
return ::Oyster::Math3D::RotationMatrix( this->GetAngularAxis().xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CustomBodyState::SetSize( const ::Oyster::Math::Float3 &size )
|
||||||
|
{
|
||||||
|
this->SetReach( 0.5f * size );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CustomBodyState::SetReach( const ::Oyster::Math::Float3 &halfSize )
|
||||||
|
{
|
||||||
|
this->reach.xyz = halfSize;
|
||||||
|
this->reach = ::Utility::Value::Max( this->reach, ::Oyster::Math::Float4::null );
|
||||||
|
this->isSpatiallyAltered = this->isDisturbed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CustomBodyState::SetCenterPosition( const ::Oyster::Math::Float3 ¢erPos )
|
||||||
|
{
|
||||||
|
this->centerPos.xyz = centerPos;
|
||||||
|
this->isSpatiallyAltered = this->isDisturbed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CustomBodyState::SetRotation( const ::Oyster::Math::Float3 &angularAxis )
|
||||||
|
{
|
||||||
|
this->angularAxis.xyz = angularAxis;
|
||||||
|
this->isSpatiallyAltered = this->isDisturbed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CustomBodyState::SetRotation( const ::Oyster::Math::Float4x4 &rotation )
|
||||||
|
{
|
||||||
|
this->SetRotation( ::Oyster::Math3D::AngularAxis(rotation).xyz );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool CustomBodyState::IsSpatiallyAltered() const
|
||||||
|
{
|
||||||
|
return this->isSpatiallyAltered;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool CustomBodyState::IsDisturbed() const
|
||||||
|
{
|
||||||
|
return this->isDisturbed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,70 @@
|
||||||
|
#ifndef PHYSICS_STRUCTS_H
|
||||||
|
#define PHYSICS_STRUCTS_H
|
||||||
|
|
||||||
|
#include "OysterMath.h"
|
||||||
|
#include "PhysicsAPI.h"
|
||||||
|
|
||||||
|
namespace Oyster { namespace Physics
|
||||||
|
{
|
||||||
|
namespace Struct
|
||||||
|
{
|
||||||
|
struct SimpleBodyDescription
|
||||||
|
{
|
||||||
|
::Oyster::Math::Float4x4 rotation;
|
||||||
|
::Oyster::Math::Float3 centerPosition;
|
||||||
|
::Oyster::Math::Float3 size;
|
||||||
|
::Oyster::Math::Float mass;
|
||||||
|
::Oyster::Math::Float4x4 inertiaTensor;
|
||||||
|
::Oyster::Physics::ICustomBody::EventAction_Collision subscription;
|
||||||
|
bool ignoreGravity;
|
||||||
|
|
||||||
|
SimpleBodyDescription();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SphericalBodyDescription
|
||||||
|
{
|
||||||
|
::Oyster::Math::Float4x4 rotation;
|
||||||
|
::Oyster::Math::Float3 centerPosition;
|
||||||
|
::Oyster::Math::Float radius;
|
||||||
|
::Oyster::Math::Float mass;
|
||||||
|
::Oyster::Physics::ICustomBody::EventAction_Collision subscription;
|
||||||
|
bool ignoreGravity;
|
||||||
|
|
||||||
|
SphericalBodyDescription();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CustomBodyState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CustomBodyState( const ::Oyster::Math::Float3 &reach = ::Oyster::Math::Float3::null,
|
||||||
|
const ::Oyster::Math::Float3 ¢erPos = ::Oyster::Math::Float3::null,
|
||||||
|
const ::Oyster::Math::Float3 &rotation = ::Oyster::Math::Float3::null );
|
||||||
|
|
||||||
|
CustomBodyState & operator = ( const CustomBodyState &state );
|
||||||
|
|
||||||
|
const ::Oyster::Math::Float4 & GetReach() const;
|
||||||
|
::Oyster::Math::Float4 GetSize() const;
|
||||||
|
const ::Oyster::Math::Float4 & GetCenterPosition() const;
|
||||||
|
const ::Oyster::Math::Float4 & GetAngularAxis() const;
|
||||||
|
::Oyster::Math::Float4x4 GetRotation() const;
|
||||||
|
|
||||||
|
void SetSize( const ::Oyster::Math::Float3 &size );
|
||||||
|
void SetReach( const ::Oyster::Math::Float3 &halfSize );
|
||||||
|
void SetCenterPosition( const ::Oyster::Math::Float3 ¢erPos );
|
||||||
|
void SetRotation( const ::Oyster::Math::Float3 &angularAxis );
|
||||||
|
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
||||||
|
|
||||||
|
bool IsSpatiallyAltered() const;
|
||||||
|
bool IsDisturbed() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
::Oyster::Math::Float4 reach, centerPos, angularAxis;
|
||||||
|
|
||||||
|
bool isSpatiallyAltered, isDisturbed;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
|
||||||
|
#include "PhysicsStructs-Impl.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -157,6 +157,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="IQueue.h" />
|
<ClInclude Include="IQueue.h" />
|
||||||
|
<ClInclude Include="PostBox\IPostBox.h" />
|
||||||
|
<ClInclude Include="PostBox\PostBox.h" />
|
||||||
<ClInclude Include="Resource\OysterResource.h" />
|
<ClInclude Include="Resource\OysterResource.h" />
|
||||||
<ClInclude Include="Resource\OResource.h" />
|
<ClInclude Include="Resource\OResource.h" />
|
||||||
<ClInclude Include="ThreadSafeQueue.h" />
|
<ClInclude Include="ThreadSafeQueue.h" />
|
||||||
|
|
|
@ -86,5 +86,11 @@
|
||||||
<ClInclude Include="ThreadSafeQueue.h">
|
<ClInclude Include="ThreadSafeQueue.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="PostBox\PostBox.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="PostBox\IPostBox.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef NETWORK_DEPENDENCIES_I_POST_BOX_H
|
||||||
|
#define NETWORK_DEPENDENCIES_I_POST_BOX_H
|
||||||
|
|
||||||
|
/////////////////////////////////////
|
||||||
|
// Created by Pontus Fransson 2013 //
|
||||||
|
/////////////////////////////////////
|
||||||
|
|
||||||
|
namespace Oyster
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
class IPostBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IPostBox() {}
|
||||||
|
virtual void Post(T message) = 0;
|
||||||
|
virtual T Fetch() = 0;
|
||||||
|
virtual bool IsEmpty() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,61 @@
|
||||||
|
#ifndef NETWORK_DEPENDENCIES_POST_BOX_H
|
||||||
|
#define NETWORK_DEPENDENCIES_POST_BOX_H
|
||||||
|
|
||||||
|
/////////////////////////////////////
|
||||||
|
// Created by Pontus Fransson 2013 //
|
||||||
|
/////////////////////////////////////
|
||||||
|
|
||||||
|
#include "IPostBox.h"
|
||||||
|
#include "../ThreadSafeQueue.h"
|
||||||
|
|
||||||
|
namespace Oyster
|
||||||
|
{
|
||||||
|
//With this class you can post items to it and then fetch them somewhere else.
|
||||||
|
//It is thread safe beacause of the ThreadSafeQueue.
|
||||||
|
template <class T>
|
||||||
|
class PostBox : public IPostBox<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PostBox();
|
||||||
|
virtual ~PostBox();
|
||||||
|
|
||||||
|
virtual void Post(T message);
|
||||||
|
virtual T Fetch();
|
||||||
|
virtual bool IsEmpty();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Queue::ThreadSafeQueue<T> messages;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//Implementation of PostBox
|
||||||
|
template <class T>
|
||||||
|
PostBox<T>::PostBox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
PostBox<T>::~PostBox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PostBox<T>::Post(T message)
|
||||||
|
{
|
||||||
|
messages.Push(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T PostBox<T>::Fetch()
|
||||||
|
{
|
||||||
|
return messages.Pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool PostBox<T>::IsEmpty()
|
||||||
|
{
|
||||||
|
return !messages.IsEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,73 +0,0 @@
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
// Created by [Dennis Andersen] [2013]
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "..\OResource.h"
|
|
||||||
#include "..\..\Utilities.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
using namespace Oyster::Resource;
|
|
||||||
|
|
||||||
|
|
||||||
OResource* OResource::CustomLoader(const wchar_t filename[], CustomLoadFunction fnc)
|
|
||||||
{
|
|
||||||
<<<<<<< HEAD
|
|
||||||
CustomData &data = fnc(filename);
|
|
||||||
|
|
||||||
if(!data.loadedData) return 0;
|
|
||||||
if(!data.resourceUnloadFnc) return 0;
|
|
||||||
OHRESOURCE n = (OHRESOURCE)data.loadedData;
|
|
||||||
OResource *resource = new OResource(n, ResourceType_UNKNOWN, 0, 0, filename);
|
|
||||||
|
|
||||||
resource->customData = new CustomResourceData();
|
|
||||||
resource->customData->unloadingFunction = data.resourceUnloadFnc;
|
|
||||||
//resource->resourceData = (OHRESOURCE)data.loadedData;
|
|
||||||
=======
|
|
||||||
CustomData data;
|
|
||||||
memset(&data, 0, sizeof(CustomData));
|
|
||||||
|
|
||||||
fnc(filename, data);
|
|
||||||
|
|
||||||
if(!data.loadedData)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(!data.resourceUnloadFnc)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/** For some wierd reason that i don't understand when trying to send data.loadedData directly as a
|
|
||||||
* parameter to OResource constructor, the value is changed when it arrives in the constructor.
|
|
||||||
* Doing it like this, storing in a temporary variable, the value stays correct. (What the fuck! I must be overloking something...)*/
|
|
||||||
//OHRESOURCE temp = data.loadedData;
|
|
||||||
OResource *resource = new OResource(data.loadedData, ResourceType_UNKNOWN, 0, 0, filename);
|
|
||||||
|
|
||||||
resource->customData = new CustomResourceData();
|
|
||||||
resource->customData->unloadingFunction = data.resourceUnloadFnc;
|
|
||||||
>>>>>>> d08644e8e1ecc56f4d9dfa6a9aa33df94d9e655a
|
|
||||||
resource->customData->loadingFunction = fnc;
|
|
||||||
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
void OResource::CustomUnloader()
|
|
||||||
{
|
|
||||||
this->customData->unloadingFunction(this->resourceData);
|
|
||||||
}
|
|
||||||
OResource* OResource::CustomReloader()
|
|
||||||
{
|
|
||||||
CustomUnloader();
|
|
||||||
|
|
||||||
CustomData data;
|
|
||||||
memset(&data, 0, sizeof(CustomData));
|
|
||||||
|
|
||||||
this->customData->loadingFunction(this->resourceFilename.c_str(), data);
|
|
||||||
this->resourceData = (OHRESOURCE)data.loadedData;
|
|
||||||
|
|
||||||
if(data.resourceUnloadFnc)
|
|
||||||
{
|
|
||||||
this->customData->unloadingFunction = data.resourceUnloadFnc;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,9 @@ namespace Oyster
|
||||||
*/
|
*/
|
||||||
virtual void ThreadExit() { }
|
virtual void ThreadExit() { }
|
||||||
/**
|
/**
|
||||||
* This function is required to get threading working.
|
* This function is required to get threading working.
|
||||||
|
* Note that this function is NOT thread safe.
|
||||||
|
* OBS! Do not highjack the looping.
|
||||||
*/
|
*/
|
||||||
virtual bool DoWork ( ) = 0;
|
virtual bool DoWork ( ) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,12 @@ namespace Oyster
|
||||||
OYSTER_THREAD_ERROR_FAILED,
|
OYSTER_THREAD_ERROR_FAILED,
|
||||||
OYSTER_THREAD_ERROR_SUCCESS,
|
OYSTER_THREAD_ERROR_SUCCESS,
|
||||||
};
|
};
|
||||||
|
enum OYSTER_THREAD_PRIORITY
|
||||||
|
{
|
||||||
|
OYSTER_THREAD_PRIORITY_1, //!< High
|
||||||
|
OYSTER_THREAD_PRIORITY_2, //!< Medium
|
||||||
|
OYSTER_THREAD_PRIORITY_3, //!< Low
|
||||||
|
};
|
||||||
|
|
||||||
class OysterThread
|
class OysterThread
|
||||||
{
|
{
|
||||||
|
@ -30,16 +36,17 @@ namespace Oyster
|
||||||
|
|
||||||
OYSTER_THREAD_ERROR Create(IThreadObject* worker, bool start);
|
OYSTER_THREAD_ERROR Create(IThreadObject* worker, bool start);
|
||||||
OYSTER_THREAD_ERROR Start();
|
OYSTER_THREAD_ERROR Start();
|
||||||
void Stop();
|
void Stop(bool wait = false);
|
||||||
void Pause();
|
void Pause();
|
||||||
void Pause(int mSec);
|
void Pause(int mSec);
|
||||||
void Resume();
|
void Resume();
|
||||||
OYSTER_THREAD_ERROR Reset(IThreadObject* worker = 0);
|
OYSTER_THREAD_ERROR Reset(IThreadObject* worker = 0);
|
||||||
void Terminate();
|
void Terminate(bool wait = false);
|
||||||
void Wait();
|
void Wait();
|
||||||
void Wait(int mSec);
|
void Wait(int mSec);
|
||||||
OYSTER_THREAD_ERROR Swap(const OysterThread* other);
|
OYSTER_THREAD_ERROR Swap(const OysterThread* other);
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
|
void SetPriority(OYSTER_THREAD_PRIORITY priority);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,43 +31,57 @@ using namespace Utility::DynamicMemory;
|
||||||
|
|
||||||
struct ThreadData
|
struct ThreadData
|
||||||
{
|
{
|
||||||
std::atomic<OYSTER_THREAD_STATE> state; //<! The current thread state.
|
OYSTER_THREAD_STATE state; //<! The current thread state.
|
||||||
|
OYSTER_THREAD_PRIORITY prio; //<! The thread priority
|
||||||
SmartPointer<std::thread> workerThread; //<! The worker thread.
|
SmartPointer<std::thread> workerThread; //<! The worker thread.
|
||||||
std::thread::id callingThread; //<! The owner thread.
|
std::thread::id callingThread; //<! The owner thread.
|
||||||
IThreadObject *owner; //<! The owner of the thread as IThread.
|
IThreadObject *owner; //<! The owner of the thread as IThread.
|
||||||
std::atomic<int> msec; //<! A timer in miliseconds.
|
std::atomic<int> msec; //<! A timer in miliseconds.
|
||||||
|
bool first;
|
||||||
//OysterMutex mutexLock; //<! The lock, locking the member variabls.
|
|
||||||
//OYSTER_THREAD_STATE state; //<! The current thread state.
|
|
||||||
|
|
||||||
ThreadData() {}
|
ThreadData() {}
|
||||||
~ThreadData() {}
|
~ThreadData()
|
||||||
ThreadData(const ThreadData&) {};
|
{
|
||||||
|
this->owner = 0;
|
||||||
|
this->state = OYSTER_THREAD_STATE_DEAD;
|
||||||
|
|
||||||
|
if(this->workerThread)
|
||||||
|
{
|
||||||
|
//@todo TODO: Make detatch avalible.
|
||||||
|
if(this->workerThread->joinable())
|
||||||
|
this->workerThread->detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ThreadData(const ThreadData&)
|
||||||
|
{};
|
||||||
|
const ThreadData& operator =(const ThreadData& o)
|
||||||
|
{};
|
||||||
};
|
};
|
||||||
struct OysterThread::PrivateData
|
struct OysterThread::PrivateData
|
||||||
{
|
{
|
||||||
SmartPointer<ThreadData> threadData;
|
SmartPointer<ThreadData> threadData;
|
||||||
|
|
||||||
PrivateData()
|
PrivateData()
|
||||||
:threadData(new ThreadData())
|
|
||||||
{
|
{
|
||||||
|
threadData = new ThreadData();
|
||||||
|
threadData->first = true;
|
||||||
threadData->owner = 0;
|
threadData->owner = 0;
|
||||||
threadData->workerThread = 0;
|
threadData->workerThread = 0;
|
||||||
threadData->callingThread;
|
threadData->callingThread;
|
||||||
threadData->state = OYSTER_THREAD_STATE_STOPED;
|
threadData->state = OYSTER_THREAD_STATE_STOPED;
|
||||||
|
threadData->prio = OYSTER_THREAD_PRIORITY_3;
|
||||||
}
|
}
|
||||||
PrivateData(const PrivateData& o)
|
PrivateData(const PrivateData& o)
|
||||||
{
|
{
|
||||||
threadData = o.threadData;
|
threadData = o.threadData;
|
||||||
}
|
}
|
||||||
|
const PrivateData& operator=(const PrivateData& o)
|
||||||
|
{
|
||||||
|
threadData = o.threadData;
|
||||||
|
}
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
{
|
{
|
||||||
//@todo TODO: Make detatch avalible.
|
threadData.Release();
|
||||||
this->threadData->workerThread->detach();
|
|
||||||
|
|
||||||
this->threadData->owner = 0;
|
|
||||||
|
|
||||||
this->threadData->state = OYSTER_THREAD_STATE_DEAD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -75,77 +89,47 @@ using namespace Utility::DynamicMemory;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
int tempId = 0;
|
|
||||||
std::vector<int> IDS;
|
|
||||||
static void ThreadingFunction(SmartPointer<ThreadData> &origin)
|
static void ThreadingFunction(SmartPointer<ThreadData> &origin)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool shouldContinue;
|
bool shouldContinue = true;
|
||||||
SmartPointer<ThreadData> w = origin;
|
SmartPointer<ThreadData> w = origin;
|
||||||
|
|
||||||
theBegining:
|
theBegining:
|
||||||
|
|
||||||
while(w->state == OYSTER_THREAD_STATE_STOPED)
|
while(w->state == OYSTER_THREAD_STATE_STOPED) std::this_thread::yield();
|
||||||
|
|
||||||
|
if(w->owner) w->owner->ThreadEntry();
|
||||||
|
w->first = false;
|
||||||
|
while (w->state != OYSTER_THREAD_STATE_STOPED && w->state != OYSTER_THREAD_STATE_DEAD && shouldContinue)
|
||||||
{
|
{
|
||||||
std::this_thread::yield();
|
switch (w->prio)
|
||||||
}
|
|
||||||
|
|
||||||
// w->mutexLock.LockMutex();
|
|
||||||
if(w->owner)
|
|
||||||
{
|
|
||||||
w->owner->ThreadEntry();
|
|
||||||
}
|
|
||||||
// w->mutexLock.UnlockMutex();
|
|
||||||
|
|
||||||
while (w->state != OYSTER_THREAD_STATE_STOPED && w->state != OYSTER_THREAD_STATE_DEAD)
|
|
||||||
{
|
|
||||||
// w->mutexLock.LockMutex();
|
|
||||||
{
|
{
|
||||||
if(w->owner)
|
case Oyster::Thread::OYSTER_THREAD_PRIORITY_2:
|
||||||
{
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
shouldContinue = w->owner->DoWork();
|
break;
|
||||||
}
|
case Oyster::Thread::OYSTER_THREAD_PRIORITY_3:
|
||||||
}
|
std::this_thread::yield();
|
||||||
// w->mutexLock.UnlockMutex();
|
break;
|
||||||
|
|
||||||
if(!shouldContinue)
|
|
||||||
{
|
|
||||||
goto theEnd;
|
|
||||||
}
|
|
||||||
if(w->state == OYSTER_THREAD_STATE_DEAD)
|
|
||||||
{
|
|
||||||
goto theEnd;
|
|
||||||
}
|
|
||||||
else if(w->state == OYSTER_THREAD_STATE_RESET)
|
|
||||||
{
|
|
||||||
goto theBegining;
|
|
||||||
}
|
|
||||||
else if(w->msec > 0)
|
|
||||||
{
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(w->msec));
|
|
||||||
}
|
|
||||||
|
|
||||||
while (w->state == OYSTER_THREAD_STATE_PAUSED)
|
|
||||||
{
|
|
||||||
std::this_thread::yield();
|
|
||||||
}
|
}
|
||||||
|
if(w->owner) shouldContinue = w->owner->DoWork();
|
||||||
|
|
||||||
|
if(w->state == OYSTER_THREAD_STATE_RESET) goto theBegining;
|
||||||
|
else if(w->msec > 0) std::this_thread::sleep_for(std::chrono::milliseconds(w->msec));
|
||||||
|
|
||||||
|
while (w->state == OYSTER_THREAD_STATE_PAUSED) std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(w->state == OYSTER_THREAD_STATE_DEAD)
|
if(w->state == OYSTER_THREAD_STATE_DEAD)
|
||||||
{
|
{
|
||||||
w->workerThread->detach();
|
if(w->workerThread->joinable()) w->workerThread->detach();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theEnd:
|
//theEnd:
|
||||||
|
|
||||||
// w->mutexLock.LockMutex();
|
if(w->owner) w->owner->ThreadExit();
|
||||||
if(w->owner)
|
|
||||||
{
|
|
||||||
w->owner->ThreadExit();
|
|
||||||
}
|
|
||||||
// w->mutexLock.UnlockMutex();
|
|
||||||
|
|
||||||
w->state = OYSTER_THREAD_STATE_DEAD;
|
w->state = OYSTER_THREAD_STATE_DEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +143,8 @@ OysterThread::OysterThread(const OysterThread& original)
|
||||||
}
|
}
|
||||||
const OysterThread& OysterThread::operator=(const OysterThread& original)
|
const OysterThread& OysterThread::operator=(const OysterThread& original)
|
||||||
{
|
{
|
||||||
|
delete this->privateData;
|
||||||
|
this->privateData = new PrivateData(*original.privateData);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
OysterThread::~OysterThread()
|
OysterThread::~OysterThread()
|
||||||
|
@ -200,7 +186,7 @@ OYSTER_THREAD_ERROR OysterThread::Start()
|
||||||
this->privateData->threadData->state = OYSTER_THREAD_STATE_RUNNING;
|
this->privateData->threadData->state = OYSTER_THREAD_STATE_RUNNING;
|
||||||
return OYSTER_THREAD_ERROR_SUCCESS;
|
return OYSTER_THREAD_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
void OysterThread::Stop()
|
void OysterThread::Stop(bool wait)
|
||||||
{
|
{
|
||||||
//this->privateData->threadData->mutexLock.LockMutex();
|
//this->privateData->threadData->mutexLock.LockMutex();
|
||||||
this->privateData->threadData->state = OYSTER_THREAD_STATE_STOPED;
|
this->privateData->threadData->state = OYSTER_THREAD_STATE_STOPED;
|
||||||
|
@ -221,10 +207,8 @@ void OysterThread::Pause(int msec)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//this->privateData->threadData->mutexLock.LockMutex();
|
|
||||||
this->privateData->threadData->state = OYSTER_THREAD_STATE_PAUSED;
|
this->privateData->threadData->state = OYSTER_THREAD_STATE_PAUSED;
|
||||||
this->privateData->threadData->msec = msec;
|
this->privateData->threadData->msec = msec;
|
||||||
//this->privateData->threadData->mutexLock.UnlockMutex();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void OysterThread::Resume()
|
void OysterThread::Resume()
|
||||||
|
@ -246,26 +230,35 @@ OYSTER_THREAD_ERROR OysterThread::Reset(IThreadObject* worker)
|
||||||
|
|
||||||
return OYSTER_THREAD_ERROR_SUCCESS;
|
return OYSTER_THREAD_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
void OysterThread::Terminate()
|
void OysterThread::Terminate(bool wait)
|
||||||
{
|
{
|
||||||
this->privateData->threadData->state = OYSTER_THREAD_STATE_DEAD;
|
this->privateData->threadData->state = OYSTER_THREAD_STATE_DEAD;
|
||||||
}
|
}
|
||||||
void OysterThread::Wait()
|
void OysterThread::Wait()
|
||||||
{
|
{
|
||||||
if(this->privateData->threadData->state == OYSTER_THREAD_STATE_DEAD)
|
if(this->privateData->threadData->state == OYSTER_THREAD_STATE_DEAD)
|
||||||
{
|
{ return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this->privateData->threadData->workerThread->get_id() == std::this_thread::get_id()) return;
|
if( this->privateData->threadData->workerThread
|
||||||
|
&&
|
||||||
|
this->privateData->threadData->workerThread->get_id() == std::this_thread::get_id())
|
||||||
|
return;
|
||||||
|
|
||||||
this->privateData->threadData->workerThread->join();
|
//if(this->privateData->threadData->state == OYSTER_THREAD_STATE_STOPED)
|
||||||
|
if(this->privateData->threadData->first)
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
if(this->privateData->threadData->workerThread)
|
||||||
|
if(this->privateData->threadData->workerThread->joinable())
|
||||||
|
this->privateData->threadData->workerThread->join();
|
||||||
}
|
}
|
||||||
void OysterThread::Wait(int msec)
|
void OysterThread::Wait(int msec)
|
||||||
{
|
{
|
||||||
if(this->privateData->threadData->workerThread->get_id() == std::this_thread::get_id()) return;
|
if(this->privateData->threadData->workerThread->get_id() == std::this_thread::get_id()) return;
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(msec));
|
//TODO: Sync with thread.
|
||||||
|
|
||||||
|
//std::this_thread::sleep_for(std::chrono::milliseconds(msec));
|
||||||
}
|
}
|
||||||
OYSTER_THREAD_ERROR OysterThread::Swap(const OysterThread* other)
|
OYSTER_THREAD_ERROR OysterThread::Swap(const OysterThread* other)
|
||||||
{
|
{
|
||||||
|
@ -279,4 +272,8 @@ bool OysterThread::IsActive()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
void OysterThread::SetPriority(OYSTER_THREAD_PRIORITY priority)
|
||||||
|
{
|
||||||
|
this->privateData->threadData->prio = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,12 @@ namespace Utility
|
||||||
template<typename T> SmartPointer<T>::SmartPointer()
|
template<typename T> SmartPointer<T>::SmartPointer()
|
||||||
:_rc(0), _ptr(0)
|
:_rc(0), _ptr(0)
|
||||||
{ }
|
{ }
|
||||||
|
template<typename T> SmartPointer<T>::SmartPointer(UniquePointer<T>& p)
|
||||||
|
:_ptr(p.Release())
|
||||||
|
{
|
||||||
|
this->_rc = new ReferenceCount();
|
||||||
|
this->_rc->Incref();
|
||||||
|
}
|
||||||
template<typename T> SmartPointer<T>::SmartPointer(T* p)
|
template<typename T> SmartPointer<T>::SmartPointer(T* p)
|
||||||
:_ptr(p)
|
:_ptr(p)
|
||||||
{
|
{
|
||||||
|
@ -222,10 +228,7 @@ namespace Utility
|
||||||
}
|
}
|
||||||
template<typename T> SmartPointer<T>::~SmartPointer()
|
template<typename T> SmartPointer<T>::~SmartPointer()
|
||||||
{
|
{
|
||||||
if (this->_rc && this->_rc->Decref() == 0)
|
this->Release();
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
template<typename T> SmartPointer<T>& SmartPointer<T>::operator= (const SmartPointer<T>& p)
|
template<typename T> SmartPointer<T>& SmartPointer<T>::operator= (const SmartPointer<T>& p)
|
||||||
{
|
{
|
||||||
|
@ -244,6 +247,30 @@ namespace Utility
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
template<typename T> SmartPointer<T>& SmartPointer<T>::operator= (UniquePointer<T>& p)
|
||||||
|
{
|
||||||
|
//Last to go?
|
||||||
|
if(this->_rc)
|
||||||
|
{
|
||||||
|
if(this->_rc->Decref() == 0)
|
||||||
|
{
|
||||||
|
//Call child specific
|
||||||
|
Destroy();
|
||||||
|
this->_rc = new ReferenceCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(p) this->_rc = new ReferenceCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->_rc)
|
||||||
|
this->_rc->Incref();
|
||||||
|
|
||||||
|
this->_ptr = p.Release();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
template<typename T> SmartPointer<T>& SmartPointer<T>::operator= (T* p)
|
template<typename T> SmartPointer<T>& SmartPointer<T>::operator= (T* p)
|
||||||
{
|
{
|
||||||
if (this->_ptr != p)
|
if (this->_ptr != p)
|
||||||
|
@ -266,27 +293,51 @@ namespace Utility
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename T> inline bool SmartPointer<T>::operator== (const SmartPointer<T>& d)
|
template<typename T> inline bool SmartPointer<T>::operator== (const SmartPointer<T>& d) const
|
||||||
{
|
{
|
||||||
return d._ptr == this->_ptr;
|
return d._ptr == this->_ptr;
|
||||||
}
|
}
|
||||||
template<typename T> inline bool SmartPointer<T>::operator== (const T& p)
|
template<typename T> inline bool SmartPointer<T>::operator== (const T& p) const
|
||||||
{
|
{
|
||||||
return &p == this->_ptr;
|
return &p == this->_ptr;
|
||||||
}
|
}
|
||||||
|
template<typename T> inline bool SmartPointer<T>::operator!= (const SmartPointer<T>& d) const
|
||||||
|
{
|
||||||
|
return d._ptr != this->_ptr;
|
||||||
|
}
|
||||||
|
template<typename T> inline bool SmartPointer<T>::operator!= (const T& p) const
|
||||||
|
{
|
||||||
|
return &p != this->_ptr;
|
||||||
|
}
|
||||||
template<typename T> inline T& SmartPointer<T>::operator* ()
|
template<typename T> inline T& SmartPointer<T>::operator* ()
|
||||||
{
|
{
|
||||||
return *this->_ptr;
|
return *this->_ptr;
|
||||||
}
|
}
|
||||||
|
template<typename T> inline const T& SmartPointer<T>::operator* () const
|
||||||
|
{
|
||||||
|
return *this->_ptr;
|
||||||
|
}
|
||||||
template<typename T> inline T* SmartPointer<T>::operator-> ()
|
template<typename T> inline T* SmartPointer<T>::operator-> ()
|
||||||
{
|
{
|
||||||
return this->_ptr;
|
return this->_ptr;
|
||||||
}
|
}
|
||||||
template<typename T> inline SmartPointer<T>::operator T* ()
|
template<typename T> inline const T* SmartPointer<T>::operator-> () const
|
||||||
{
|
{
|
||||||
return this->_ptr;
|
return this->_ptr;
|
||||||
}
|
}
|
||||||
template<typename T> inline SmartPointer<T>::operator bool()
|
template<typename T> inline SmartPointer<T>::operator T* () const
|
||||||
|
{
|
||||||
|
return this->_ptr;
|
||||||
|
}
|
||||||
|
template<typename T> inline SmartPointer<T>::operator const T* () const
|
||||||
|
{
|
||||||
|
return this->_ptr;
|
||||||
|
}
|
||||||
|
template<typename T> inline SmartPointer<T>::operator T& () const
|
||||||
|
{
|
||||||
|
return *this->_ptr;
|
||||||
|
}
|
||||||
|
template<typename T> inline SmartPointer<T>::operator bool() const
|
||||||
{
|
{
|
||||||
return (this->_ptr != 0);
|
return (this->_ptr != 0);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +345,21 @@ namespace Utility
|
||||||
{
|
{
|
||||||
return this->_ptr;
|
return this->_ptr;
|
||||||
}
|
}
|
||||||
template<typename T> inline bool SmartPointer<T>::IsValid()
|
template<typename T> inline T* SmartPointer<T>::Get() const
|
||||||
|
{
|
||||||
|
return this->_ptr;
|
||||||
|
}
|
||||||
|
template<typename T> int SmartPointer<T>::Release()
|
||||||
|
{
|
||||||
|
int returnVal = 0;
|
||||||
|
|
||||||
|
if(this->_rc && ((returnVal = this->_rc->Decref()) == 0))
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
return returnVal;
|
||||||
|
}
|
||||||
|
template<typename T> inline bool SmartPointer<T>::IsValid() const
|
||||||
{
|
{
|
||||||
return (this->_ptr != NULL) ? true : false;
|
return (this->_ptr != NULL) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,27 +205,41 @@ namespace Utility
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SmartPointer();
|
SmartPointer();
|
||||||
|
SmartPointer(UniquePointer<T>& up);
|
||||||
SmartPointer(T* p);
|
SmartPointer(T* p);
|
||||||
SmartPointer(const SmartPointer& d);
|
SmartPointer(const SmartPointer& d);
|
||||||
virtual~SmartPointer();
|
virtual~SmartPointer();
|
||||||
SmartPointer<T>& operator= (const SmartPointer<T>& p);
|
SmartPointer<T>& operator= (const SmartPointer<T>& p);
|
||||||
|
SmartPointer<T>& operator= (UniquePointer<T>& p);
|
||||||
SmartPointer<T>& operator= (T* p);
|
SmartPointer<T>& operator= (T* p);
|
||||||
bool operator== (const SmartPointer<T>& d);
|
bool operator== (const SmartPointer<T>& d) const;
|
||||||
bool operator== (const T& p);
|
bool operator== (const T& p) const;
|
||||||
|
bool operator!= (const SmartPointer<T>& d) const;
|
||||||
|
bool operator!= (const T& p) const;
|
||||||
T& operator* ();
|
T& operator* ();
|
||||||
|
const T& operator* () const;
|
||||||
T* operator-> ();
|
T* operator-> ();
|
||||||
operator T* ();
|
const T* operator-> () const;
|
||||||
operator bool();
|
operator T* () const;
|
||||||
|
operator const T* () const;
|
||||||
|
operator T& () const;
|
||||||
|
operator bool() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the connected pointer
|
* Returns the connected pointer
|
||||||
*/
|
*/
|
||||||
T* Get();
|
T* Get();
|
||||||
|
T* Get() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases one reference of the pointer and set value to null, making the current SmartPointer invalid.
|
||||||
|
*/
|
||||||
|
int Release();
|
||||||
|
|
||||||
/** Checks if the pointer is valid (not NULL)
|
/** Checks if the pointer is valid (not NULL)
|
||||||
* Returns true for valid, else false.
|
* Returns true for valid, else false.
|
||||||
*/
|
*/
|
||||||
bool IsValid();
|
bool IsValid() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,34 @@ struct CustomNetProtocol::PrivateData
|
||||||
|
|
||||||
PrivateData()
|
PrivateData()
|
||||||
{ }
|
{ }
|
||||||
|
PrivateData( const CustomNetProtocol::PrivateData& o)
|
||||||
|
{
|
||||||
|
for (auto i = o.attributes.begin(); i != o.attributes.end(); i++)
|
||||||
|
{
|
||||||
|
if(i->second.type == NetAttributeType_CharArray)
|
||||||
|
{
|
||||||
|
size_t size = strlen(i->second.value.netCharPtr);
|
||||||
|
if(size == 0) continue;
|
||||||
|
|
||||||
|
attributes[i->first];
|
||||||
|
attributes[i->first].value.netCharPtr = new char[size + 1];
|
||||||
|
//strcpy_s(attributes[i->first].value.netCharPtr, size + 1, i->second.value.netCharPtr);
|
||||||
|
memcpy(&attributes[i->first].value.netCharPtr[0], &i->second.value.netCharPtr[0], size + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attributes[i->first] = i->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
attributes = o.attributes;
|
||||||
|
}
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
{
|
{
|
||||||
for (auto i = attributes.begin(); i != attributes.end(); i++)
|
for (auto i = attributes.begin(); i != attributes.end(); i++)
|
||||||
{
|
{
|
||||||
RemoveAttribute(i->first);
|
RemoveAttribute(i->first);
|
||||||
}
|
}
|
||||||
|
attributes.clear();
|
||||||
}
|
}
|
||||||
void RemoveAttribute(int ID)
|
void RemoveAttribute(int ID)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +50,8 @@ struct CustomNetProtocol::PrivateData
|
||||||
switch (i->second.type)
|
switch (i->second.type)
|
||||||
{
|
{
|
||||||
case NetAttributeType_CharArray:
|
case NetAttributeType_CharArray:
|
||||||
delete [] i->second.value.netCharPtr;
|
//delete [] i->second.value.netCharPtr;
|
||||||
|
i->second.value.netCharPtr = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +64,16 @@ CustomNetProtocol::CustomNetProtocol()
|
||||||
{
|
{
|
||||||
this->privateData = new PrivateData();
|
this->privateData = new PrivateData();
|
||||||
}
|
}
|
||||||
|
CustomNetProtocol::CustomNetProtocol(const CustomNetProtocol& o)
|
||||||
|
{
|
||||||
|
this->privateData = new PrivateData(*o.privateData);
|
||||||
|
}
|
||||||
|
const CustomNetProtocol& CustomNetProtocol::operator=(const CustomNetProtocol& o)
|
||||||
|
{
|
||||||
|
delete this->privateData;
|
||||||
|
this->privateData = new PrivateData(*o.privateData);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
CustomNetProtocol::~CustomNetProtocol()
|
CustomNetProtocol::~CustomNetProtocol()
|
||||||
{
|
{
|
||||||
delete this->privateData;
|
delete this->privateData;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define NETWORK_CUSTOM_NETWORK_PROTOCOL_H
|
#define NETWORK_CUSTOM_NETWORK_PROTOCOL_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vld.h>
|
||||||
|
|
||||||
#ifdef CUSTOM_NET_PROTOCOL_EXPORT
|
#ifdef CUSTOM_NET_PROTOCOL_EXPORT
|
||||||
#define NET_PROTOCOL_EXPORT __declspec(dllexport)
|
#define NET_PROTOCOL_EXPORT __declspec(dllexport)
|
||||||
|
@ -82,6 +83,8 @@ namespace Oyster
|
||||||
public:
|
public:
|
||||||
CustomNetProtocol();
|
CustomNetProtocol();
|
||||||
~CustomNetProtocol();
|
~CustomNetProtocol();
|
||||||
|
CustomNetProtocol(const CustomNetProtocol& o);
|
||||||
|
const CustomNetProtocol& operator=(const CustomNetProtocol& o);
|
||||||
|
|
||||||
NetAttributeContainer& operator[](int ID);
|
NetAttributeContainer& operator[](int ID);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Oyster
|
||||||
typedef void(*ProtocolRecieverFunction)(CustomNetProtocol& protocol);
|
typedef void(*ProtocolRecieverFunction)(CustomNetProtocol& protocol);
|
||||||
struct ClientConnectedObject
|
struct ClientConnectedObject
|
||||||
{
|
{
|
||||||
virtual void ClientConnectCallback(NetworkClient &client) = 0;
|
virtual void ClientConnectCallback(NetworkClient& client) = 0;
|
||||||
};
|
};
|
||||||
struct ProtocolRecieverObject
|
struct ProtocolRecieverObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,28 +23,13 @@ using namespace Utility::DynamicMemory;
|
||||||
/*************************************
|
/*************************************
|
||||||
PrivateData
|
PrivateData
|
||||||
*************************************/
|
*************************************/
|
||||||
|
struct ClientDataContainer
|
||||||
struct NetworkClient::PrivateData : public IThreadObject
|
|
||||||
{
|
{
|
||||||
PrivateData();
|
Connection connection;
|
||||||
PrivateData(unsigned int socket);
|
|
||||||
~PrivateData();
|
|
||||||
|
|
||||||
void Start();
|
|
||||||
|
|
||||||
void Send(CustomNetProtocol& protocol); //Is called from the outside to add messages to send.
|
|
||||||
|
|
||||||
//Called on from the thread
|
|
||||||
int Send();
|
|
||||||
int Recv();
|
|
||||||
|
|
||||||
bool DoWork();
|
|
||||||
|
|
||||||
SmartPointer<Connection> connection;
|
|
||||||
|
|
||||||
SmartPointer<IPostBox<CustomNetProtocol>> sendPostBox;
|
SmartPointer<IPostBox<CustomNetProtocol>> sendPostBox;
|
||||||
|
|
||||||
SmartPointer<RecieverObject> recvObj;
|
RecieverObject recvObj;
|
||||||
NetworkProtocolCallbackType callbackType;
|
NetworkProtocolCallbackType callbackType;
|
||||||
|
|
||||||
Oyster::Thread::OysterThread thread;
|
Oyster::Thread::OysterThread thread;
|
||||||
|
@ -56,125 +41,116 @@ struct NetworkClient::PrivateData : public IThreadObject
|
||||||
//ID
|
//ID
|
||||||
static unsigned int currID;
|
static unsigned int currID;
|
||||||
const unsigned int ID;
|
const unsigned int ID;
|
||||||
|
|
||||||
|
ClientDataContainer(IThreadObject* o)
|
||||||
|
: ID(currID++)
|
||||||
|
{
|
||||||
|
InitWinSock();
|
||||||
|
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||||
|
sendPostBox = new PostBox<CustomNetProtocol>();
|
||||||
|
connection.SetBlockingMode(false);
|
||||||
|
}
|
||||||
|
ClientDataContainer(IThreadObject* o, unsigned int socket )
|
||||||
|
:connection(socket), ID(currID++)
|
||||||
|
{
|
||||||
|
InitWinSock();
|
||||||
|
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||||
|
sendPostBox = new PostBox<CustomNetProtocol>();
|
||||||
|
connection.SetBlockingMode(false);
|
||||||
|
}
|
||||||
|
~ClientDataContainer()
|
||||||
|
{
|
||||||
|
thread.Stop();
|
||||||
|
thread.Wait();
|
||||||
|
connection.Disconnect();
|
||||||
|
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||||
|
|
||||||
|
ShutdownWinSock();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
unsigned int ClientDataContainer::currID = 0;
|
||||||
|
|
||||||
|
struct NetworkClient::PrivateData : public IThreadObject
|
||||||
|
{
|
||||||
|
Utility::DynamicMemory::SmartPointer<ClientDataContainer> data;
|
||||||
|
|
||||||
|
PrivateData() { this->data = new ClientDataContainer(this); }
|
||||||
|
PrivateData(unsigned int socket) { this->data = new ClientDataContainer(this, socket); }
|
||||||
|
~PrivateData() { }
|
||||||
|
|
||||||
|
bool DoWork()
|
||||||
|
{
|
||||||
|
if(!this->data)return true;
|
||||||
|
if(!this->data->connection.IsConnected()) return true;
|
||||||
|
|
||||||
|
Send();
|
||||||
|
Recv();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Send(CustomNetProtocol* protocol)
|
||||||
|
{
|
||||||
|
if(!data) return;
|
||||||
|
|
||||||
|
this->data->postBoxMutex.lock();
|
||||||
|
this->data->sendPostBox->PostMessage(*protocol);
|
||||||
|
this->data->postBoxMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Send()
|
||||||
|
{
|
||||||
|
int errorCode = 0;
|
||||||
|
if(!data) return -1;
|
||||||
|
|
||||||
|
this->data->postBoxMutex.lock();
|
||||||
|
if(this->data->sendPostBox->IsFull())
|
||||||
|
{
|
||||||
|
SmartPointer<OysterByte> temp = new OysterByte();
|
||||||
|
this->data->translator.Pack(temp, this->data->sendPostBox->FetchMessage());
|
||||||
|
errorCode = this->data->connection.Send(temp);
|
||||||
|
}
|
||||||
|
this->data->postBoxMutex.unlock();
|
||||||
|
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Recv()
|
||||||
|
{
|
||||||
|
int errorCode = -1;
|
||||||
|
|
||||||
|
if(this->data->callbackType == NetworkProtocolCallbackType_Function)
|
||||||
|
{
|
||||||
|
OysterByte temp = OysterByte();
|
||||||
|
errorCode = this->data->connection.Recieve(temp);
|
||||||
|
|
||||||
|
if(errorCode == 0)
|
||||||
|
{
|
||||||
|
CustomNetProtocol protocol;
|
||||||
|
bool ok = this->data->translator.Unpack(protocol, temp);
|
||||||
|
|
||||||
|
//Check if the protocol was unpacked correctly
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
this->data->recvObjMutex.lock();
|
||||||
|
if(this->data->callbackType == NetworkProtocolCallbackType_Function)
|
||||||
|
{
|
||||||
|
this->data->recvObj.protocolRecieverFnc(protocol);
|
||||||
|
}
|
||||||
|
else if(this->data->callbackType == NetworkProtocolCallbackType_Object)
|
||||||
|
{
|
||||||
|
this->data->recvObj.protocolRecievedObject->ProtocolRecievedCallback(protocol);
|
||||||
|
}
|
||||||
|
this->data->recvObjMutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int NetworkClient::PrivateData::currID = 0;
|
|
||||||
|
|
||||||
NetworkClient::PrivateData::PrivateData() : ID(currID++)
|
|
||||||
{
|
|
||||||
InitWinSock();
|
|
||||||
|
|
||||||
callbackType = NetworkProtocolCallbackType_Unknown;
|
|
||||||
|
|
||||||
connection = new Connection();
|
|
||||||
sendPostBox = new PostBox<CustomNetProtocol>;
|
|
||||||
this->thread.Create(this, false);
|
|
||||||
|
|
||||||
Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkClient::PrivateData::PrivateData(unsigned int socket) : ID(currID++)
|
|
||||||
{
|
|
||||||
InitWinSock();
|
|
||||||
|
|
||||||
callbackType = NetworkProtocolCallbackType_Unknown;
|
|
||||||
|
|
||||||
connection = new Connection(socket);
|
|
||||||
sendPostBox = new PostBox<CustomNetProtocol>;
|
|
||||||
this->thread.Create(this, false);
|
|
||||||
|
|
||||||
connection->SetBlockingMode(false);
|
|
||||||
|
|
||||||
Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkClient::PrivateData::~PrivateData()
|
|
||||||
{
|
|
||||||
thread.Stop();
|
|
||||||
|
|
||||||
/*if(connection)
|
|
||||||
{
|
|
||||||
delete connection;
|
|
||||||
connection = NULL;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*if(sendPostBox)
|
|
||||||
{
|
|
||||||
delete sendPostBox;
|
|
||||||
sendPostBox = NULL;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
callbackType = NetworkProtocolCallbackType_Unknown;
|
|
||||||
|
|
||||||
ShutdownWinSock();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NetworkClient::PrivateData::DoWork()
|
|
||||||
{
|
|
||||||
Send();
|
|
||||||
Recv();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkClient::PrivateData::Send(CustomNetProtocol& protocol)
|
|
||||||
{
|
|
||||||
postBoxMutex.lock();
|
|
||||||
sendPostBox->PostMessage(protocol);
|
|
||||||
postBoxMutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkClient::PrivateData::Send()
|
|
||||||
{
|
|
||||||
int errorCode = 0;
|
|
||||||
|
|
||||||
postBoxMutex.lock();
|
|
||||||
if(sendPostBox->IsFull())
|
|
||||||
{
|
|
||||||
SmartPointer<OysterByte> temp = new OysterByte;
|
|
||||||
this->translator.Pack(temp, sendPostBox->FetchMessage());
|
|
||||||
errorCode = this->connection->Send(temp);
|
|
||||||
}
|
|
||||||
postBoxMutex.unlock();
|
|
||||||
|
|
||||||
return errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkClient::PrivateData::Recv()
|
|
||||||
{
|
|
||||||
int errorCode = -1;
|
|
||||||
|
|
||||||
SmartPointer<OysterByte> temp = new OysterByte;
|
|
||||||
errorCode = this->connection->Recieve(temp);
|
|
||||||
|
|
||||||
if(errorCode == 0)
|
|
||||||
{
|
|
||||||
CustomNetProtocol protocol;
|
|
||||||
bool ok = translator.Unpack(protocol, temp);
|
|
||||||
|
|
||||||
//Check if the protocol was unpacked correctly
|
|
||||||
if(ok)
|
|
||||||
{
|
|
||||||
recvObjMutex.lock();
|
|
||||||
if(callbackType == NetworkProtocolCallbackType_Function)
|
|
||||||
{
|
|
||||||
recvObj->protocolRecieverFnc(protocol);
|
|
||||||
}
|
|
||||||
else if(callbackType == NetworkProtocolCallbackType_Object)
|
|
||||||
{
|
|
||||||
recvObj->protocolRecievedObject->ProtocolRecievedCallback(protocol);
|
|
||||||
}
|
|
||||||
recvObjMutex.unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkClient::PrivateData::Start()
|
|
||||||
{
|
|
||||||
this->thread.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
NetworkClient
|
NetworkClient
|
||||||
|
@ -193,28 +169,25 @@ NetworkClient::NetworkClient(unsigned int socket)
|
||||||
NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type)
|
NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type)
|
||||||
{
|
{
|
||||||
privateData = new PrivateData();
|
privateData = new PrivateData();
|
||||||
this->privateData->recvObj = SmartPointer<RecieverObject>(&recvObj);;
|
this->privateData->data->recvObj = SmartPointer<RecieverObject>(&recvObj);;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type, unsigned int socket)
|
NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type, unsigned int socket)
|
||||||
{
|
{
|
||||||
privateData = new PrivateData(socket);
|
privateData = new PrivateData(socket);
|
||||||
this->privateData->recvObj = SmartPointer<RecieverObject>(&recvObj);
|
this->privateData->data->recvObj = SmartPointer<RecieverObject>(&recvObj);
|
||||||
this->privateData->callbackType = type;
|
this->privateData->data->callbackType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkClient::NetworkClient(const NetworkClient& obj)
|
NetworkClient::NetworkClient(const NetworkClient& obj)
|
||||||
{
|
{
|
||||||
this->privateData = new PrivateData();
|
this->privateData = new PrivateData(*obj.privateData);
|
||||||
|
|
||||||
this->privateData = obj.privateData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkClient& NetworkClient::operator =(const NetworkClient& obj)
|
NetworkClient& NetworkClient::operator =(const NetworkClient& obj)
|
||||||
{
|
{
|
||||||
delete privateData;
|
delete privateData;
|
||||||
this->privateData = new PrivateData();
|
this->privateData = new PrivateData(*obj.privateData);
|
||||||
this->privateData = obj.privateData;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,16 +202,16 @@ NetworkClient::~NetworkClient()
|
||||||
|
|
||||||
bool NetworkClient::Connect(unsigned short port, const char serverIP[])
|
bool NetworkClient::Connect(unsigned short port, const char serverIP[])
|
||||||
{
|
{
|
||||||
int result = this->privateData->connection->Connect(port, serverIP);
|
int result = this->privateData->data->connection.Connect(port, serverIP);
|
||||||
|
|
||||||
//Connect has succeeded
|
//Connect has succeeded
|
||||||
if(result == 0)
|
if(result == 0)
|
||||||
{
|
{
|
||||||
privateData->Start();
|
privateData->data->thread.Start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
privateData->connection->SetBlockingMode(false);
|
privateData->data->connection.SetBlockingMode(false);
|
||||||
|
|
||||||
//Connect has failed
|
//Connect has failed
|
||||||
return false;
|
return false;
|
||||||
|
@ -246,28 +219,40 @@ bool NetworkClient::Connect(unsigned short port, const char serverIP[])
|
||||||
|
|
||||||
void NetworkClient::Disconnect()
|
void NetworkClient::Disconnect()
|
||||||
{
|
{
|
||||||
privateData->connection->Disconnect();
|
privateData->data->connection.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkClient::IsConnected()
|
bool NetworkClient::IsConnected()
|
||||||
{
|
{
|
||||||
return privateData->connection->IsConnected();
|
return privateData->data->connection.IsConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkClient::Send(CustomProtocolObject& protocol)
|
void NetworkClient::Send(CustomProtocolObject& protocol)
|
||||||
{
|
{
|
||||||
this->privateData->Send(*protocol.GetProtocol());
|
this->privateData->Send(protocol.GetProtocol());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkClient::SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type)
|
void NetworkClient::SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type)
|
||||||
{
|
{
|
||||||
privateData->recvObjMutex.lock();
|
if (type == NetworkProtocolCallbackType_Unknown) return;
|
||||||
privateData->recvObj = SmartPointer<RecieverObject>(&recvObj);
|
|
||||||
privateData->callbackType = type;
|
privateData->data->recvObjMutex.lock();
|
||||||
privateData->recvObjMutex.unlock();
|
privateData->data->recvObj = recvObj;
|
||||||
|
privateData->data->callbackType = type;
|
||||||
|
privateData->data->recvObjMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkClient::operator ==(const NetworkClient& obj)
|
bool NetworkClient::operator ==(const NetworkClient& obj)
|
||||||
{
|
{
|
||||||
return (this->privateData->ID == obj.privateData->ID);
|
return (this->privateData->data->ID == obj.privateData->data->ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetworkClient::operator ==(const int& ID)
|
||||||
|
{
|
||||||
|
return this->privateData->data->ID == ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NetworkClient::Id() const
|
||||||
|
{
|
||||||
|
return this->privateData->data->ID;
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "NetworkCallbackHelper.h"
|
#include "NetworkCallbackHelper.h"
|
||||||
|
#include <vld.h>
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,9 @@ namespace Oyster
|
||||||
|
|
||||||
//Compares the internal ID.
|
//Compares the internal ID.
|
||||||
bool operator ==(const NetworkClient& obj);
|
bool operator ==(const NetworkClient& obj);
|
||||||
|
bool operator ==(const int& ID);
|
||||||
|
|
||||||
|
int Id() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "NetworkClient.h"
|
#include "NetworkClient.h"
|
||||||
#include "NetworkCallbackHelper.h"
|
#include "NetworkCallbackHelper.h"
|
||||||
|
#include <vld.h>
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,28 +17,6 @@ using namespace std;
|
||||||
struct MyCastingStruct
|
struct MyCastingStruct
|
||||||
{
|
{
|
||||||
std::map<int, NetAttributeContainer> attributes;
|
std::map<int, NetAttributeContainer> attributes;
|
||||||
|
|
||||||
/*MyCastingStruct()
|
|
||||||
{ }
|
|
||||||
~MyCastingStruct()
|
|
||||||
{
|
|
||||||
for (auto i = attributes.begin(); i != attributes.end(); i++)
|
|
||||||
{
|
|
||||||
RemoveAttribute(i->first);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void RemoveAttribute(int ID)
|
|
||||||
{
|
|
||||||
auto i = attributes.find(ID);
|
|
||||||
if(i == attributes.end()) return;
|
|
||||||
|
|
||||||
switch (i->second.type)
|
|
||||||
{
|
|
||||||
case NetAttributeType_CharArray:
|
|
||||||
delete [] i->second.value.netCharPtr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Check if the package has been packed correctly.
|
// TODO: Check if the package has been packed correctly.
|
||||||
|
@ -221,6 +199,16 @@ Translator::~Translator()
|
||||||
privateData = NULL;
|
privateData = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Translator::Translator(const Translator& obj)
|
||||||
|
{
|
||||||
|
this->privateData = new PrivateData(*obj.privateData);
|
||||||
|
}
|
||||||
|
const Translator& Translator::operator=(const Translator& obj)
|
||||||
|
{
|
||||||
|
delete this->privateData;
|
||||||
|
this->privateData = new PrivateData(*obj.privateData);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void Translator::Pack(OysterByte &bytes, CustomNetProtocol& protocol)
|
void Translator::Pack(OysterByte &bytes, CustomNetProtocol& protocol)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,8 @@ namespace Oyster
|
||||||
public:
|
public:
|
||||||
Translator ();
|
Translator ();
|
||||||
~Translator();
|
~Translator();
|
||||||
|
Translator(const Translator& obj);
|
||||||
|
const Translator& operator=(const Translator& obj);
|
||||||
|
|
||||||
void Pack(OysterByte &bytes, CustomNetProtocol& protocol);
|
void Pack(OysterByte &bytes, CustomNetProtocol& protocol);
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue