Skip to content

Commit

Permalink
Merge pull request #242 from FreeAllegiance/master
Browse files Browse the repository at this point in the history
Pull the changes from next-release to main. (#103)
  • Loading branch information
kgersen authored Apr 2, 2023
2 parents 9c0e97d + 8faff75 commit 9e80fd1
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 64 deletions.
2 changes: 1 addition & 1 deletion VS2022/How To Run a Local Lobby and Server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Go to C:\Allegiance\Server
Follow instructions in the readme.


The batch files are looking for files in these paths, so it would be easiest not to modify them.
The batch files are looking for files in these paths, so it would be easiest not to modify them...
14 changes: 14 additions & 0 deletions VS2022/Shared.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__MODULE__="$(ProjectName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
2 changes: 1 addition & 1 deletion src/Igc/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,7 +2357,7 @@ bool LineOfSightExist(const IclusterIGC* pcluster,
Vector V13 = P3 - P1;
float fLengthSquaredV13 = V13.LengthSquared ();

// if the obscruing object is closer than the target, then it might really
// if the obscuring object is closer than the target, then it might really
// obscure the view of the target
if (fLengthSquaredV13 < fLengthSquaredV12)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Igc/igc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ class MissionParams
bLockLobby = false;
bLockSides = false;
bLockTeamSettings = false;
bAllowDefections = false;
bAllowDefections = false; //Student TODO
bStations = true ;
bScoresCount = true;
bSquadGame = false;
Expand Down
7 changes: 5 additions & 2 deletions src/Igc/shipIGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ DamageResult CshipIGC::ReceiveDamage(DamageTypeID type,
{
IsideIGC* pside = GetSide();

//if launcher exists and is friendly, friendly fire is off, and damage is > 0 (not repairing), do no damage.
if (launcher &&
(!GetMyMission()->GetMissionParams()->bAllowFriendlyFire) &&
((pside == launcher->GetSide()) || IsideIGC::AlliedSides(pside,launcher->GetSide())) && // #ALLY - Imago fixed 7/8/09
Expand Down Expand Up @@ -1246,12 +1247,13 @@ DamageResult CshipIGC::ReceiveDamage(DamageTypeID type,
leakage = 0.0f;
dr = c_drNoDamage;

//if launcher is repairing a friendly ship, add that the launcher's repair stat
if (launcher->GetObjectType() == OT_ship && (pside == launcher->GetSide() || IsideIGC::AlliedSides(pside, launcher->GetSide())))
{
IshipIGC * pIship = ((IshipIGC*)launcher);
float repairFraction = -amount * dtmArmor / maxHP;
if (GetBaseHullType() && (GetBaseHullType()->GetCapabilities() & c_habmThreatToStation))
repairFraction *= 2.0f; //double points for nanning a bomber/htt
repairFraction *= 2.0f; //double points for nanning a bomber/htt
pIship->AddRepair(repairFraction);
pIship->SetAchievementMask(c_achmNewRepair);
}
Expand All @@ -1263,12 +1265,13 @@ DamageResult CshipIGC::ReceiveDamage(DamageTypeID type,
if (launcher)
{
if (launcher->GetObjectType() == OT_ship)
amount *= ((IshipIGC*)launcher)->GetExperienceMultiplier();
amount *= ((IshipIGC*)launcher)->GetExperienceMultiplier(); //Student Note: This is kb multiplier. Also, repairing is not affected by kb

if (m_damageTrack && (launcher->GetMission() == GetMyMission()))
m_damageTrack->ApplyDamage(timeCollision, launcher, amount);
}

//Student Note: here is where shields take damage and where we would implement (maybe) shields not giving leakage (probably for a special shield or something)
if (m_mountedOthers[ET_Shield])
{
Vector deltaP = position2 - position1;
Expand Down
2 changes: 1 addition & 1 deletion src/Igc/shipIGC.h
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ class CshipIGC : public TmodelIGC<IshipIGC>
assert (pship->GetSide() == pside);
assert (pship->GetAutoDonate() == NULL);

//Was anyone on my ide donating to me ... if so, they start donating to the new person
//Was anyone on my side donating to me ... if so, they start donating to the new person
for (ShipLinkIGC* psl = pside->GetShips()->first();
(psl != NULL);
psl = psl->next())
Expand Down
84 changes: 69 additions & 15 deletions src/WinTrek/WinTrek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ class CameraControl
//
// Jiggle the camera orientation based on the amount of afterburner and any residual effects
//

// Student TODO: reduce camera jiggle on afterburn (maybe make it adjustable? also potential accessibility issue)

const double jiggleHalfLife = 0.25f;
m_jiggle *= (float)pow(jiggleHalfLife, (double)dt);

Expand Down Expand Up @@ -2888,7 +2891,7 @@ class TrekWindowImpl :
pnsGamePanes->AddMember(
"StyleHUD",
m_pwrapNumberStyleHUD = new WrapNumber(
m_pnumberStyleHUD = new ModifiableNumber(0)
m_pnumberStyleHUD = new ModifiableNumber(atof(LoadPreference("StyleHUD", "0.0")))
)
);

Expand Down Expand Up @@ -2975,8 +2978,14 @@ class TrekWindowImpl :
}
}

// display load preferences
GetEngine()->SetAA(uint32_t(LoadPreference("UseAntialiasing", uint32_t(0)))); // Student 8/11/2022 load anti-aliasing preference

GetEngine()->SetVSync(bool(LoadPreference("UseVSync", bool(false)))); // Student 8/12/2022 load VSync preferebce


//
// initialize the sound engine (for the intro music if nothing else)
// initialize the sound engine (for the intro music if nothingB else)
//

DWORD dwSoundInitStartTime = timeGetTime();
Expand Down Expand Up @@ -3034,6 +3043,7 @@ class TrekWindowImpl :

m_bShowJoystickIndicator = (LoadPreference("ShowJoystickIndicator", 1) != 0);


GetInputEngine()->GetMouse()->SetAccel(m_iMouseAccel);

// BUILD_DX9
Expand Down Expand Up @@ -3071,8 +3081,9 @@ class TrekWindowImpl :
//
// Command View
//
m_pCommandGeo = new CommandGeo(c_fCommandGridRadius, 0.0f, 40); //Student, shipping without attempts to load image in grid GetModeler()->LoadSurface("toparrowbmp", true

m_pCommandVisibleGeo = new VisibleGeo(m_pCommandGeo = new CommandGeo(c_fCommandGridRadius, 0.0f, 40));
m_pCommandVisibleGeo = new VisibleGeo(m_pCommandGeo);
m_pCommandVisibleGeo->SetVisible(false);

//
Expand Down Expand Up @@ -3275,8 +3286,8 @@ class TrekWindowImpl :
ToggleCenterHUD();
if (!LoadPreference("TargetHUD", TRUE))
ToggleTargetHUD();
if (LoadPreference("SoftwareHUD", FALSE)) //All we need with two styles
CycleStyleHUD();
//if (LoadPreference("SoftwareHUD", FALSE)) //All we need with two styles //Student 7/28/2022 loading preference elsewhere
// CycleStyleHUD();
SetDeadzone(LoadPreference("DeadZone", 5)); //ToggleLargeDeadZone(); //Imago updated 7/8/09 // BT 8/17 - Small deadzone default.
SetRadarLOD(LoadPreference("RadarLOD", 0)); //Imago updated 7/8/09 #24 (Gamma, VirtualJoystick, RadarLOD, ShowGrid)
if (LoadPreference("ShowGrid", FALSE))
Expand Down Expand Up @@ -3722,7 +3733,7 @@ class TrekWindowImpl :
void contextBanPlayer()
{
char szMessageParam[CB_ZTS];
lstrcpy(szMessageParam, "You have been banned from this game an administrator.");
lstrcpy(szMessageParam, "You have been banned from this game by an administrator.");
trekClient.SetMessageType(BaseClient::c_mtGuaranteed);
BEGIN_PFM_CREATE(trekClient.m_fm, pfmQuitSide, CS, QUIT_MISSION)
FM_VAR_PARM(szMessageParam, CB_ZTS)
Expand Down Expand Up @@ -4584,6 +4595,16 @@ class TrekWindowImpl :

return pmenu;
}

//Student 8/11/2022 explicitly handle changing Anti-Aliasing
void ToggleAA()
{
GetEngine()->SetAA(g_DX9Settings.m_dwAA + 1);
SavePreference("UseAntialiasing", g_DX9Settings.m_dwAA); //Student TODO: This is never used, make a toggle and loadpreference
if (m_pitemAA != NULL) {
m_pitemAA->SetString(GetAAString());
}
}

void ToggleDebris()
{
Expand Down Expand Up @@ -5037,15 +5058,52 @@ class TrekWindowImpl :

//Something of a misnomer since there are only two styles but this may change
//Andon: Changed to support up to 5 styles
void CycleStyleHUD()
void CycleStyleHUD() //Student 7/28/2022 Upgrade to save preference correctly
{
float style = m_pnumberStyleHUD->GetValue();

if (style < 5.0f)
{
style += 1.0f;
}
else
{
style = 0.0f;
}
m_pnumberStyleHUD->SetValue(style);
if (m_pitemStyleHUD != NULL)
m_pitemStyleHUD->SetString(GetStyleHUDMenuString());

if (style == 1.0f)
{
SavePreference("StyleHUD", "1.0");
}
else if (style == 2.0f)
{
SavePreference("StyleHUD", "2.0");
}
else if (style == 3.0f)
{
SavePreference("StyleHUD", "3.0");
}
else if (style == 1.0f)
{
SavePreference("StyleHUD", "4.0");
}
else
{
SavePreference("StyleHUD", "5.0");
}


/* Student 7/28/2022 was:
int style = (int(m_pnumberStyleHUD->GetValue()) + 1) % 5;
m_pnumberStyleHUD->SetValue(float(style));

SavePreference("SoftwareHUD", (DWORD)style);
SavePreference("StyleHUD", (DWORD)style);

if (m_pitemStyleHUD != NULL)
m_pitemStyleHUD->SetString(GetStyleHUDMenuString());
m_pitemStyleHUD->SetString(GetStyleHUDMenuString());*/
}

//Imago 7/8/09 7/13/09
Expand Down Expand Up @@ -5627,7 +5685,7 @@ class TrekWindowImpl :

ZString GetTransparentObjectsMenuString()
{
return ThingGeo::GetTransparentObjects() ? "TransparentObjects On " : "TransparentObjects Off ";
return ThingGeo::GetTransparentObjects() ? "Transparent Objects On " : "Transparent Objects Off ";
}

ZString GetLensFlareMenuString()
Expand Down Expand Up @@ -6085,11 +6143,7 @@ class TrekWindowImpl :
break;

case idmAA:
GetEngine()->SetAA(g_DX9Settings.m_dwAA + 1);
SavePreference("UseAntialiasing", g_DX9Settings.m_dwAA);
if (m_pitemAA != NULL) {
m_pitemAA->SetString(GetAAString());
}
ToggleAA(); //Student 8/11/2022 moved to function ToggleAA()
break;
case idmMip:
GetEngine()->SetAutoGenMipMaps(!g_DX9Settings.m_bAutoGenMipmaps);
Expand Down
1 change: 1 addition & 0 deletions src/WinTrek/artwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#define AWF_FLIGHT_CURRENT_DIRECTION_ICON "directionbmp"
#define AWF_FLIGHT_CROSSHAIR_IN_ICON "centerinbmp"
#define AWF_FLIGHT_CROSSHAIR_OUT_ICON "centeroutbmp"
#define AWF_FLIGHT_EYE_ICON "eyebmp" //Student 7/2/2022 Show friendly eyed ships

#define AWF_HUD_BACKGROUND "hudbkgrndbmp"
#define AWF_HUD_SPEED_INDICATOR "speedindicatorbmp"
Expand Down
49 changes: 38 additions & 11 deletions src/WinTrek/cmdview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
float xMin, float yMin,
float xMax, float yMax,
*/
CommandGeo::CommandGeo(float radius, float zGrid, int nSegments)
:
m_vertices(
4 * (nSegments + 1),
4 * (nSegments + 1)
),
m_indices(
4 * (nSegments + 1),
4 * (nSegments + 1)
),
m_zGrid(zGrid)
//Surface* top
CommandGeo::CommandGeo(float radius, float zGrid, int nSegments)
:
m_vertices(
4 * (nSegments + 1),
4 * (nSegments + 1)
),
m_indices(
4 * (nSegments + 1),
4 * (nSegments + 1)
),
m_zGrid(zGrid),
m_radius(radius)
//m_top(top)
{
int index = 0;
float radius2 = radius * radius;
Expand Down Expand Up @@ -256,6 +259,27 @@ void CommandGeo::DrawShips(Context* pcontext)
pcontext->DrawLines(vertices, indices);
}

//Student 7/18/2022 - indicate the original top of the sector, so it can be rotated and there still be a point of reference to discuss with teammates.
void CommandGeo::DrawTop(Context* pcontext)
{
TRef<IEngineFont> pfont = TrekResources::HugeBoldFont();

char* topString = "NORTH";
float xShiftStr = pfont->GetTextExtent(topString).X();
//float yShiftStr = pfont->GetHeight();


//float yShiftArrow = m_top->GetSize().Y();
//float xShiftArrow = m_top->GetSize().X();


Point offset(0, 3 * m_radius / 4);
//pcontext->DrawImage3D(m_top, s_colorNeutral, true, offset); //Something is going wrong with this image.

offset.SetX(offset.X() - xShiftStr * 0.5f);

pcontext->DrawString(pfont, s_colorNeutral, offset, topString);
}

void CommandGeo::Render(Context* pcontext)
{
Expand All @@ -268,6 +292,8 @@ void CommandGeo::Render(Context* pcontext)
// draw the grid
pcontext->DrawLines(m_vertices, m_indices);

DrawTop(pcontext);

//Draw the drop line for the point in space (if there is one)
{
ConsoleImage* pci = GetWindow()->GetConsoleImage();
Expand All @@ -287,6 +313,7 @@ const Color CommandGeo::s_colorGridMajor(0,0,128.0f/255.0f);
const Color CommandGeo::s_colorDropLineUp(200.0f / 255.0f, 180.0f / 255.0f, 20.0f / 255.0f);
const Color CommandGeo::s_colorDropLineDown(150.0f / 255.0f, 100.0f / 255.0f, 0.0f / 255.0f);
const Color CommandGeo::s_colorFeet(0,0,128.0f/255.0f);
const Color CommandGeo::s_colorNeutral(1.0f, 1.0f, 1.0f);

const Color g_colorUp(75 / 255.0f, 124 / 255.0f, 88 / 255.0f);
const Color g_colorDown(2 / 255.0f, 84 / 255.0f, 84 / 255.0f);
Expand Down
7 changes: 6 additions & 1 deletion src/WinTrek/cmdview.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ class CommandGeo : public Geo
TVector<WORD> m_indices;
TRef<IclusterIGC> m_pcluster;
float m_zGrid;
float m_radius;


//TRef<Surface> m_top; //GetModeler()->LoadImage("toparrowbmp", true)->GetSurface();

void DrawShips(Context* pcontext);
void DrawTop(Context* pcontext);

public:
CommandGeo(float radius, float zGrid, int nSegments);
CommandGeo(float radius, float zGrid, int nSegments); //Surface* top
void Render(Context* pcontext);
void SetCluster(IclusterIGC* pcluster);

Expand Down
Loading

0 comments on commit 9e80fd1

Please sign in to comment.