From 2648bf52507205e7b00898cf2f5b6a3eb40e2229 Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 29 May 2007 16:57:11 +0000 Subject: Added: Support for Player Name Templates. Set Names in config.ini ([NameTemplate], Name1..12=text and recall in Name-Screens with F1..F12. Fix: All 12 player- and 3 teamnames are now saved in config.ini git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@237 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 22 +++++++++-- Game/Code/Screens/UScreenName.pas | 51 +++++++++++++++++++++++++ Game/Code/Screens/UScreenPartyPlayer.pas | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 3 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index f3ea84ac..c92a7a50 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -5,7 +5,11 @@ uses IniFiles, ULog, SysUtils; type TIni = class - Name: array[0..5] of string; + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; // Game Players: integer; @@ -174,9 +178,16 @@ begin IniFile := TMemIniFile.Create(GamePath + 'config.ini'); // Name - for I := 0 to 5 do + for I := 0 to 11 do Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + // Players Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); for Pet := 0 to High(IPlayers) do @@ -665,8 +676,13 @@ begin IniFile := TIniFile.Create(GamePath + 'config.ini'); //Name - for I := 1 to 6 do + // Templates for Names Mod + for I := 1 to 12 do IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); IniFile.Free; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e2a80687..1b90c570 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -32,6 +32,57 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index f6bcb0b7..e8607470 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -61,6 +61,56 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; @@ -135,6 +185,21 @@ procedure TScreenPartyPlayer.onShow; var I: integer; begin + // Templates for Names Mod + for I := 1 to 4 do + Button[I].Text[0].Text := Ini.Name[I-1]; + + for I := 6 to 9 do + Button[I].Text[0].Text := Ini.Name[I-2]; + + for I := 11 to 14 do + Button[I].Text[0].Text := Ini.Name[I-3]; + + Button[0].Text[0].Text := Ini.NameTeam[0]; + Button[5].Text[0].Text := Ini.NameTeam[1]; + Button[10].Text[0].Text := Ini.NameTeam[2]; + // Templates for Names Mod end + If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; -- cgit v1.2.3