38 eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf, |
38 eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf, |
39 eidHomerun, eidFrozen); |
39 eidHomerun, eidFrozen); |
40 |
40 |
41 TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, |
41 TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, |
42 gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, |
42 gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, |
43 gidSolidLand, gidSharedAmmo, gidMineTimer); |
43 gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer); |
44 |
44 |
45 const MAX_EVENT_STRINGS = 100; |
45 const MAX_EVENT_STRINGS = 100; |
46 var trammo: array[TAmmoStrId] of string; |
46 var trammo: array[TAmmoStrId] of ansistring; |
47 trammoc: array[TAmmoStrId] of string; |
47 trammoc: array[TAmmoStrId] of ansistring; |
48 trammod: array[TAmmoStrId] of string; |
48 trammod: array[TAmmoStrId] of ansistring; |
49 trmsg: array[TMsgStrId] of string; |
49 trmsg: array[TMsgStrId] of ansistring; |
50 trgoal: array[TGoalStrId] of string; |
50 trgoal: array[TGoalStrId] of ansistring; |
51 |
51 |
52 procedure LoadLocale(FileName: string); |
52 procedure LoadLocale(FileName: shortstring); |
53 function Format(fmt: shortstring; var arg: shortstring): shortstring; |
53 function Format(fmt: shortstring; var arg: shortstring): shortstring; |
|
54 function Format(fmt: ansistring; var arg: ansistring): ansistring; |
54 |
55 |
55 function GetEventString(e: TEventId): string; |
56 function GetEventString(e: TEventId): ansistring; |
56 |
57 |
57 implementation |
58 implementation |
58 uses uMisc, uRandom, uConsole; |
59 uses uMisc, uRandom, uConsole; |
59 |
60 |
60 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of string; |
61 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; |
61 trevt_n: array[TEventId] of integer; |
62 trevt_n: array[TEventId] of integer; |
62 |
63 |
63 procedure LoadLocale(FileName: string); |
64 procedure LoadLocale(FileName: shortstring); |
64 var s: shortstring; |
65 var s: shortstring; |
65 f: textfile; |
66 f: textfile; |
66 a, b, c: LongInt; |
67 a, b, c: LongInt; |
67 first: array[TEventId] of boolean; |
68 first: array[TEventId] of boolean; |
68 e: TEventId; |
69 e: TEventId; |
130 i:= Pos('%1', fmt); |
131 i:= Pos('%1', fmt); |
131 if i = 0 then Format:= fmt |
132 if i = 0 then Format:= fmt |
132 else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) |
133 else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) |
133 end; |
134 end; |
134 |
135 |
|
136 function Format(fmt: ansistring; var arg: ansistring): ansistring; |
|
137 var i: LongInt; |
|
138 begin |
|
139 i:= Pos('%1', fmt); |
|
140 if i = 0 then Format:= fmt |
|
141 else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) |
|
142 end; |
|
143 |
135 end. |
144 end. |