Skip to content

Commit

Permalink
Character view, training working again
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Mar 14, 2016
1 parent 1311c22 commit a79480a
Show file tree
Hide file tree
Showing 13 changed files with 622 additions and 423 deletions.
4 changes: 4 additions & 0 deletions GameData/messages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,8 @@ PICKPOCKET_CASH <You steal $#.>
PICKPOCKET_CASH+ITEM <You steal $# and a #.>
BONDING_LOVE <You get the feeling that # is attracted to you.>
BONDING_ALLY <You get the feeling that you can count on #.>
FREEXP <FREE XP: #>
TALENTS <TALENTS>
CYBERWARE <CYBERWARE>
SKILL_SLOTS_LEFT <# skill slots used>

4 changes: 4 additions & 0 deletions arenacfe.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ implementation
var
EMek: GearPtr; { Enemy Meks }
begin
{$IFNDEF SDLMODE}
DisplayGearInfo( Target , gb );
{$ENDIF}

{ Firing weapons automatically gives away one's position. }
{ THIS CODE SHOULD BE MOVED INTO THE EFFECTS.PP PROCEDURE!!! }
Expand All @@ -160,7 +162,9 @@ implementation

{ Report the effect of the attack. }
Display_Effect_History( GB );
{$IFNDEF SDLMODE}
DisplayGearInfo( Target , GB );
{$ENDIF}

{ AT the end, redisplay the map. }
{$IFNDEF SDLMODE}
Expand Down
8 changes: 5 additions & 3 deletions arenahq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ procedure SellGear( U,Part: GearPtr );

Roll := RecurseFix( U , Mek );

{$IFNDEF SDLMODE}
DisplayGearInfo( Mek );
{$ENDIF}

C1 := NAttValue( U^.NA , NAG_Experience , NAS_Credits );
if C1 < C0 then begin
Expand Down Expand Up @@ -407,12 +409,12 @@ procedure AddPilotToUnit( U: GearPtr );
{ is in fact a valid, singular character. }
if ( PC <> Nil ) then begin
{ Display the character's stats. }
DisplayGearInfo( PC );

{ Ask the player what to do with this character. }
{$IFDEF SDLMODE}
if SelectMenu( YNMenu , Nil ) = 1 then begin
{$ELSE}
DisplayGearInfo( PC );
if SelectMenu( YNMenu ) = 1 then begin
{$ENDIF}
{ Add the character to the unit. }
Expand Down Expand Up @@ -534,7 +536,9 @@ procedure BuyMechsForUnit( U: GearPtr );

{ Check to make sure that Mek isn't Nil. }
if Mek <> Nil then begin
{$IFNDEF SDLMODE}
DisplayGearInfo( Mek );
{$ENDIF}

PurchaseGear( U , Mek );

Expand Down Expand Up @@ -1275,7 +1279,6 @@ procedure HQMain( HQCamp: CampaignPtr );
if ( msg <> '' ) or ( Part^.G <> GG_Mecha ) then begin
repeat
RedrawOpening;
DisplayGearInfo( Part );
CMessage( msg , ZONE_Menu.GetRect() , InfoGreen );
GHFlip;
A := RPGKey;
Expand All @@ -1285,7 +1288,6 @@ procedure HQMain( HQCamp: CampaignPtr );
if Part^.G = GG_Mecha then begin
repeat
RedrawOpening;
DisplayGearInfo( Part );
CMessage( msg , ZONE_Menu.GetRect() , InfoGreen );
GHFlip;
A := RPGKey;
Expand Down
4 changes: 2 additions & 2 deletions arenascript.pp
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,12 @@ implementation
{ Redraw the combat screen for some menu usage. }
begin
if ASRD_GameBoard <> Nil then SDLCombatDisplay( ASRD_GameBoard );
DisplayGearInfo( ASRD_InfoGear , ASRD_GameBoard );
end;

Procedure MemoPageReDraw;
{ Redraw the combat screen for some menu usage. }
begin
if ASRD_GameBoard <> Nil then SDLCombatDisplay( ASRD_GameBoard );
DisplayGearInfo( ASRD_InfoGear , ASRD_GameBoard );
SetupMemoDisplay;
GameMsg( ASRD_MemoMessage , ZONE_MemoText.GetRect() , InfoGreen );
end;
Expand Down Expand Up @@ -4096,8 +4094,10 @@ implementation
{ Set up the display. }
SetupInteractDisplay( TeamColor( GB , NPC ) );

{$IFNDEF SDLMODE}
DisplayGearInfo( NPC , GB );
DisplayGearInfo( PC , GB , ZONE_Menu );
{$ENDIF}

{ Initialize interaction variables. }
I_PC := PC;
Expand Down
151 changes: 141 additions & 10 deletions backpack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
interface

{$IFDEF SDLMODE}
uses gears,locale,sdlgfx;
uses gears,locale,sdlgfx,ui4gh;
{$ELSE}
uses gears,locale;
{$ENDIF}
Expand All @@ -38,6 +38,11 @@ interface
Procedure SelectSprite( M: GearPtr; Redrawer: RedrawProcedureType );
{$ENDIF}

Function LanceMateMenuName( M: GearPtr ): String;
Function FindNextPC( GB: GameBoardPtr; CurrentPC: GearPtr ): GearPtr;
Function FindPrevPC( GB: GameBoardPtr; CurrentPC: GearPtr ): GearPtr;


Procedure GivePartToPC( GB: GameBoardPtr; Part, PC: GearPtr );

Function SelectRobotParts( GB: GameBoardPtr; PC: GearPtr ): GearPtr;
Expand Down Expand Up @@ -93,7 +98,7 @@ implementation
{ Miscellaneous menu redraw procedure. }
begin
if InfoGB <> Nil then SDLCombatDisplay( InfoGB );
if InfoGear <> Nil then DisplayGearInfo( InfoGear , InfoGB );
{if InfoGear <> Nil then DisplayGearInfo( InfoGear , InfoGB );}
end;

Procedure EqpRedraw;
Expand Down Expand Up @@ -175,7 +180,7 @@ implementation
begin
if InfoGB <> Nil then SDLCombatDisplay( InfoGB );
DrawBPBorder;
if InfoGear <> Nil then DisplayGearInfo( InfoGear , InfoGB );
{if InfoGear <> Nil then DisplayGearInfo( InfoGear , InfoGB );}
GameMsg( MsgString( 'SELECT_ROBOT_PARTS' ) , ZONE_EqpMenu.GetRect() , MenuItem );
end;

Expand Down Expand Up @@ -224,6 +229,82 @@ implementation

{$ENDIF}


Function LanceMateMenuName( M: GearPtr ): String;
var
msg,pilot: string;
begin
msg := FullGearName( M );

if M^.G = GG_Mecha then begin
pilot := SAttValue( M^.SA , 'PILOT' );
if pilot <> '' then msg := msg + ' (' + pilot + ')';
end;

LanceMateMenuName := msg;
end;

Function FindNextPC( GB: GameBoardPtr; CurrentPC: GearPtr ): GearPtr;
{ Locate the next player character on the gameboard. }
Function IsPC( PC: GearPtr ): Boolean;
{ Return True if this is a PC, or False otherwise. }
begin
IsPC := IsMasterGear( PC ) and GearActive(PC) and ((NAttValue( PC^.NA , NAG_Location, NAS_Team ) = NAV_DefPlayerTeam) or (NAttValue( PC^.NA , NAG_Location, NAS_Team ) = NAV_LancemateTeam));
end;
var
PC,NextPC,FirstPC: GearPtr;
FoundStart: Boolean;
begin
NextPC := Nil;
FirstPC := Nil;
FoundStart := CurrentPC = Nil;

PC := GB^.Meks;
while ( PC <> Nil ) and ( NextPC = Nil ) do begin
if IsPC(PC) then begin
if FirstPC = Nil then FirstPC := PC;
if FoundStart and (NextPC = Nil) then NextPC := PC;
if PC = CurrentPC then FoundStart := True;
end;
PC := PC^.Next;
end;
if NextPC = Nil then begin
if FirstPC = Nil then FindNextPC := CurrentPC
else FindNextPC := FirstPC;
end else FindNextPC := NextPC;
end;

Function FindPrevPC( GB: GameBoardPtr; CurrentPC: GearPtr ): GearPtr;
{ Locate the previous player character on the gameboard. }
Function IsPC( PC: GearPtr ): Boolean;
{ Return True if this is a PC, or False otherwise. }
begin
IsPC := IsMasterGear( PC ) and GearActive(PC) and ((NAttValue( PC^.NA , NAG_Location, NAS_Team ) = NAV_DefPlayerTeam) or (NAttValue( PC^.NA , NAG_Location, NAS_Team ) = NAV_LancemateTeam));
end;
var
PC,PrevPC,LastPC: GearPtr;
FoundStart: Boolean;
begin
PrevPC := Nil;
LastPC := Nil;
FoundStart := CurrentPC = Nil;

PC := GB^.Meks;
while ( PC <> Nil ) and not FoundStart do begin
if IsPC(PC) then begin
PrevPC := LastPC;
if PC <> CurrentPC then LastPC := PC
else if PrevPC <> Nil then FoundStart := True;
end;
PC := PC^.Next;
end;
if not FoundStart then begin
if LastPC = Nil then FindPrevPC := CurrentPC
else FindPrevPC := LastPC;
end else FindPrevPC := PrevPC;
end;


Function SelectRobotParts( GB: GameBoardPtr; PC: GearPtr ): GearPtr;
{ Select up to 10 parts to build a robot with. }
{ Delink them from the INVENTORY and return them as a list. }
Expand Down Expand Up @@ -446,7 +527,7 @@ implementation
Procedure GetItemRedraw;
begin
SDLCombatDisplay( InfoGB );
DisplayGearInfo( InfoGear , InfoGB );
{DisplayGearInfo( InfoGear , InfoGB );}
end;
{$ENDIF}

Expand Down Expand Up @@ -565,6 +646,13 @@ implementation

{ Add the menu keys. }
AddRPGMenuKey(InvRPM,'/',-2);
{$IFDEF SDLMODE}
AddRPGMenuKey( InvRPM , RPK_Right , -3 );
AddRPGMenuKey( InvRPM , RPK_Left , -4 );
{$ELSE}
AddRPGMenuKey( InvRPM , KeyMap[ KMC_East ].KCode , -3 );
AddRPGMenuKey( InvRPM , KeyMap[ KMC_West ].KCode , -4 );
{$ENDIF}
end;

Procedure CreateEqpMenu( PC: GearPtr );
Expand All @@ -583,6 +671,13 @@ implementation

{ Add the menu keys. }
AddRPGMenuKey(EqpRPM,'/',-2);
{$IFDEF SDLMODE}
AddRPGMenuKey( EqpRPM , RPK_Right , -3 );
AddRPGMenuKey( EqpRPM , RPK_Left , -4 );
{$ELSE}
AddRPGMenuKey( EqpRPM , KeyMap[ KMC_East ].KCode , -3 );
AddRPGMenuKey( EqpRPM , KeyMap[ KMC_West ].KCode , -4 );
{$ENDIF}
end;

Procedure UpdateBackpack( PC: GearPtr );
Expand Down Expand Up @@ -1377,7 +1472,7 @@ implementation
DisposeRPGMenu( TIWS_Menu );
end;

Function DoInvMenu( GB: GameBoardPtr; var LList: GearPtr; PC,M: GearPtr ): Boolean;
Function DoInvMenu( GB: GameBoardPtr; var LList: GearPtr; var PC,M: GearPtr ): Boolean;
{ Return TRUE if the user selected Quit. }
var
N: Integer;
Expand All @@ -1403,6 +1498,22 @@ implementation
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end else if N = -3 then begin
M := FindNextPC( GB, M );
N := 0;
{ Restore the display. }
UpdateBackpack( M );
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end else if N = -4 then begin
M := FindPrevPC( GB, M );
N := 0;
{ Restore the display. }
UpdateBackpack( M );
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end;
until ( N < 0 ) or ForceQuit;

Expand All @@ -1413,7 +1524,7 @@ implementation
DoInvMenu := N=-1;
end;

Function DoEqpMenu( GB: GameBoardPtr; var LList: GearPtr; PC,M: GearPtr ): Boolean;
Function DoEqpMenu( GB: GameBoardPtr; var LList: GearPtr; var PC,M: GearPtr ): Boolean;
{ Return TRUE if the user selected Quit. }
var
N: Integer;
Expand All @@ -1439,6 +1550,22 @@ implementation
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end else if N = -3 then begin
M := FindNextPC( GB, M );
N := 0;
{ Restore the display. }
UpdateBackpack( M );
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end else if N = -4 then begin
M := FindPrevPC( GB, M );
N := 0;
{ Restore the display. }
UpdateBackpack( M );
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}
end;
until ( N < 0 ) or ForceQuit;

Expand Down Expand Up @@ -1507,7 +1634,7 @@ implementation
SDLCombatDisplay( InfoGB );
DrawBPBorder;
GameMsg( FullGearName( INFOGear ) + ' ' + MechaDescription( InfoGear) , ZONE_EqpMenu.GetRect() , InfoGreen );
DisplayGearInfo( InfoGear );
{DisplayGearInfo( InfoGear );}
end;
{$ENDIF}

Expand All @@ -1530,8 +1657,8 @@ implementation

{$IFNDEF SDLMODE}
GameMsg( FullGearName( Mek ) + ' ' + MechaDescription( Mek ) , ZONE_EqpMenu , InfoGreen );
{$ENDIF}
DisplayGearInfo( Mek );
{$ENDIF}
{$IFDEF SDLMODE}
InfoGear := Mek;
InfoGB := GB;
Expand All @@ -1554,7 +1681,7 @@ implementation
{ Redraw the screen for the part browser. }
begin
if MPB_Redraw <> Nil then MPB_Redraw;
if MPB_Gear <> Nil then DisplayGearInfo( MPB_Gear );
{if MPB_Gear <> Nil then DisplayGearInfo( MPB_Gear );}
end;

Procedure MechaPartBrowser( Mek: GearPtr; RDP: RedrawProcedureType );
Expand Down Expand Up @@ -1601,7 +1728,7 @@ implementation
Procedure FHQRedraw;
begin
if InfoGB <> Nil then SDLCombatDisplay( InfoGB );
DisplayGearInfo( InfoGear );
{DisplayGearInfo( InfoGear );}
end;
{$ENDIF}

Expand All @@ -1614,7 +1741,9 @@ implementation
N,Team: Integer;
begin
{ Show the item's stats. }
{$IFNDEF SDLMODE}
DisplayGearInfo( Item );
{$ENDIF}

{ Create the menu. }
RPM := CreateRPGMenu( MenuItem, MenuSelect, ZONE_Menu );
Expand Down Expand Up @@ -1678,7 +1807,9 @@ implementation
begin
repeat
{ Show the mecha's stats. }
{$IFNDEF SDLMODE}
DisplayGearInfo( M );
{$ENDIF}

{ Create the FHQ menu. }
RPM := CreateRPGMenu( MenuItem, MenuSelect, ZONE_Menu );
Expand Down
Loading

0 comments on commit a79480a

Please sign in to comment.