Skip to content

Commit 986bb20

Browse files
committed
Half part of Reinfected
1 parent 7c25453 commit 986bb20

File tree

16 files changed

+611
-2
lines changed

16 files changed

+611
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ set(EXPECTED_DATA
877877
editor/checker.png
878878
editor/cursor.png
879879
editor/entities.png
880+
editor/entities/reinfected.png
880881
emoticons.png
881882
fonts/DejaVuSans.ttf
882883
fonts/SourceHanSans.ttc
@@ -1110,6 +1111,7 @@ set(EXPECTED_DATA
11101111
ui/gametypes/lts.png
11111112
ui/gametypes/mod.png
11121113
ui/gametypes/race.png
1114+
ui/gametypes/reinfected.png
11131115
ui/gametypes/tdm.png
11141116
ui/gui_buttons.png
11151117
ui/gui_cursor.png
@@ -1617,6 +1619,8 @@ set_src(GAME_SERVER GLOB_RECURSE src/game/server
16171619
gamemodes/lts.h
16181620
gamemodes/mod.cpp
16191621
gamemodes/mod.h
1622+
gamemodes/reinfected.cpp
1623+
gamemodes/reinfected.h
16201624
gamemodes/tdm.cpp
16211625
gamemodes/tdm.h
16221626
gameworld.cpp
51.4 KB
Loading
4.05 KB
Loading

license.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Authors: android272, Chi11y (chi1), Crises, Daniel, Echchouik, Fisico,
2626
red_com, serpis, SkizZ, somerunce, Sonix, Stephanator, teetow,
2727
Ubu, Zatline
2828

29+
Teeworlds Archive Project: Bamcane
30+
2931
------------------------------------------------------------------------
3032

3133
IMPORTANT NOTE! The source under src/engine/external are stripped

maps/reinfected1.map

3.42 KB
Binary file not shown.

src/engine/shared/protocol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ enum
9090
SERVERINFO_VERSION_CURRENT, // add extend player info
9191

9292
MAX_CLIENTS=64,
93+
/*
9394
MAX_PLAYERS=16,
95+
*/
96+
MAX_PLAYERS=64,
9497

9598
MAX_INPUT_SIZE=128,
9699
MAX_SNAPSHOT_PACKSIZE=900,

src/game/editor/editor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,6 +3027,11 @@ void CEditor::FilelistPopulate(int StorageType)
30273027
Item.m_IsLink = true;
30283028
Item.m_StorageType = IStorage::TYPE_ALL;
30293029
m_CompleteFileList.add(Item);
3030+
3031+
str_copy(Item.m_aFilename, "entities/reinfected.png", sizeof(Item.m_aFilename));
3032+
str_copy(Item.m_aName, "Reinfected", sizeof(Item.m_aName));
3033+
Item.m_StorageType = IStorage::TYPE_ALL;
3034+
m_CompleteFileList.add(Item);
30303035
}
30313036
Storage()->ListDirectory(StorageType, m_pFileDialogPath, EditorListdirCallback, this);
30323037
RefreshFilteredFileList();

src/game/server/entities/character.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <game/server/player.h>
99

1010
#include "character.h"
11+
/*
1112
#include "laser.h"
13+
*/
1214
#include "projectile.h"
1315

1416
//input count
@@ -253,18 +255,23 @@ void CCharacter::FireWeapon()
253255
DoWeaponSwitch();
254256
vec2 Direction = normalize(vec2(m_LatestInput.m_TargetX, m_LatestInput.m_TargetY));
255257

258+
/*
256259
bool FullAuto = false;
257260
if(m_ActiveWeapon == WEAPON_GRENADE || m_ActiveWeapon == WEAPON_SHOTGUN || m_ActiveWeapon == WEAPON_LASER)
258261
FullAuto = true;
259-
262+
*/
260263

261264
// check if we gonna fire
262265
bool WillFire = false;
263266
if(CountInput(m_LatestPrevInput.m_Fire, m_LatestInput.m_Fire).m_Presses)
264267
WillFire = true;
265268

269+
/*
266270
if(FullAuto && (m_LatestInput.m_Fire&1) && m_aWeapons[m_ActiveWeapon].m_Ammo)
267271
WillFire = true;
272+
*/
273+
if(GameServer()->m_pController->CanCharacterWeaponFullAuto(this, m_ActiveWeapon) && (m_LatestInput.m_Fire&1) && m_aWeapons[m_ActiveWeapon].m_Ammo)
274+
WillFire = true;
268275

269276
if(!WillFire)
270277
return;
@@ -282,7 +289,9 @@ void CCharacter::FireWeapon()
282289
return;
283290
}
284291

292+
/*
285293
vec2 ProjStartPos = m_Pos+Direction*GetProximityRadius()*0.75f;
294+
*/
286295

287296
if(Config()->m_Debug)
288297
{
@@ -291,6 +300,7 @@ void CCharacter::FireWeapon()
291300
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
292301
}
293302

303+
/*
294304
switch(m_ActiveWeapon)
295305
{
296306
case WEAPON_HAMMER:
@@ -396,14 +406,18 @@ void CCharacter::FireWeapon()
396406
} break;
397407
398408
}
409+
*/
399410

400411
m_AttackTick = Server()->Tick();
401412

402413
if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0) // -1 == unlimited
403414
m_aWeapons[m_ActiveWeapon].m_Ammo--;
404415

416+
m_ReloadTimer = GameServer()->m_pController->OnCharacterFireWeapon(this, Direction, m_ActiveWeapon);
417+
/*
405418
if(!m_ReloadTimer)
406419
m_ReloadTimer = g_pData->m_Weapons.m_aId[m_ActiveWeapon].m_Firedelay * Server()->TickSpeed() / 1000;
420+
*/
407421
}
408422

409423
void CCharacter::HandleWeapons()
@@ -477,6 +491,14 @@ void CCharacter::SetEmote(int Emote, int Tick)
477491
m_EmoteStop = Tick;
478492
}
479493

494+
void CCharacter::DoNinjaFire(vec2 Direction, int MoveTime)
495+
{
496+
m_NumObjectsHit = 0;
497+
m_Ninja.m_ActivationDir = Direction;
498+
m_Ninja.m_CurrentMoveTime = MoveTime;
499+
m_Ninja.m_OldVelAmount = length(m_Core.m_Vel);
500+
}
501+
480502
void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
481503
{
482504
// check for changes

src/game/server/entities/character.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class CCharacter : public CEntity
6363
bool IsAlive() const { return m_Alive; }
6464
class CPlayer *GetPlayer() { return m_pPlayer; }
6565

66+
// need this hook for gamecontroller to call ninja fire
67+
void DoNinjaFire(vec2 Direction, int MoveTime);
6668
private:
6769
// player controlling this character
6870
class CPlayer *m_pPlayer;

src/game/server/entities/pickup.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* If you are missing that file, acquire a complete release at teeworlds.com. */
33
#include <generated/server_data.h>
44
#include <game/server/gamecontext.h>
5+
#include <game/server/gamecontroller.h>
56
#include <game/server/player.h>
67

78
#include "character.h"
@@ -43,6 +44,9 @@ void CPickup::Tick()
4344
}
4445
// Check if a player intersected us
4546
CCharacter *pChr = (CCharacter *)GameWorld()->ClosestEntity(m_Pos, 20.0f, CGameWorld::ENTTYPE_CHARACTER, 0);
47+
if(pChr && !GameServer()->m_pController->CanCharacterPickup(pChr))
48+
return;
49+
4650
if(pChr && pChr->IsAlive())
4751
{
4852
// player picked us up, is someone was hooking us, let them go

0 commit comments

Comments
 (0)