branch | webgl |
changeset 8444 | 75db7bb8dce8 |
parent 8330 | aaefa587e277 |
parent 8370 | 0c79946e96f8 |
child 8833 | c13ebed437cb |
8340:46a9fde631f4 | 8444:75db7bb8dce8 |
---|---|
38 function CheckForWin: boolean; |
38 function CheckForWin: boolean; |
39 procedure TeamGoneEffect(var Team: TTeam); |
39 procedure TeamGoneEffect(var Team: TTeam); |
40 procedure SwitchCurrentHedgehog(newHog: PHedgehog); |
40 procedure SwitchCurrentHedgehog(newHog: PHedgehog); |
41 |
41 |
42 implementation |
42 implementation |
43 uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript, |
43 uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, |
44 uGearsUtils, uGearsList |
44 uGearsUtils, uGearsList |
45 {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF}; |
45 {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF}; |
46 |
46 |
47 var MaxTeamHealth: LongInt; |
47 var MaxTeamHealth: LongInt; |
48 GameOver: boolean; |
48 GameOver: boolean; |
319 AddVoice(sndIllGetYou, CurrentTeam^.voicepack) |
319 AddVoice(sndIllGetYou, CurrentTeam^.voicepack) |
320 else AddVoice(sndJustYouWait, CurrentTeam^.voicepack) |
320 else AddVoice(sndJustYouWait, CurrentTeam^.voicepack) |
321 end; |
321 end; |
322 ReadyTimeLeft:= 0 |
322 ReadyTimeLeft:= 0 |
323 end; |
323 end; |
324 |
|
325 {$IFDEF SDL13} |
|
326 uTouch.NewTurnBeginning(); |
|
327 {$ENDIF} |
|
328 ScriptCall('onNewTurn'); |
|
329 end; |
324 end; |
330 |
325 |
331 function AddTeam(TeamColor: Longword): PTeam; |
326 function AddTeam(TeamColor: Longword): PTeam; |
332 var team: PTeam; |
327 var team: PTeam; |
333 c: LongInt; |
328 c, t: LongInt; |
334 begin |
329 begin |
335 TryDo(TeamsCount < cMaxTeams, 'Too many teams', true); |
330 TryDo(TeamsCount < cMaxTeams, 'Too many teams', true); |
336 New(team); |
331 New(team); |
337 TryDo(team <> nil, 'AddTeam: team = nil', true); |
332 TryDo(team <> nil, 'AddTeam: team = nil', true); |
338 FillChar(team^, sizeof(TTeam), 0); |
333 FillChar(team^, sizeof(TTeam), 0); |
340 team^.CurrHedgehog:= 0; |
335 team^.CurrHedgehog:= 0; |
341 team^.Flag:= 'hedgewars'; |
336 team^.Flag:= 'hedgewars'; |
342 |
337 |
343 TeamsArray[TeamsCount]:= team; |
338 TeamsArray[TeamsCount]:= team; |
344 inc(TeamsCount); |
339 inc(TeamsCount); |
340 |
|
341 for t:= 0 to cKbdMaxIndex do |
|
342 team^.Binds[t]:= ''; |
|
345 |
343 |
346 c:= Pred(ClansCount); |
344 c:= Pred(ClansCount); |
347 while (c >= 0) and (ClansArray[c]^.Color <> TeamColor) do dec(c); |
345 while (c >= 0) and (ClansArray[c]^.Color <> TeamColor) do dec(c); |
348 if c < 0 then |
346 if c < 0 then |
349 begin |
347 begin |
503 end; |
501 end; |
504 |
502 |
505 procedure chAddHH(var id: shortstring); |
503 procedure chAddHH(var id: shortstring); |
506 var s: shortstring; |
504 var s: shortstring; |
507 Gear: PGear; |
505 Gear: PGear; |
508 c: LongInt; |
|
509 begin |
506 begin |
510 s:= ''; |
507 s:= ''; |
511 if (not isDeveloperMode) or (CurrentTeam = nil) then |
508 if (not isDeveloperMode) or (CurrentTeam = nil) then |
512 exit; |
509 exit; |
513 with CurrentTeam^ do |
510 with CurrentTeam^ do |
514 begin |
511 begin |
515 SplitBySpace(id, s); |
512 SplitBySpace(id, s); |
516 SwitchCurrentHedgehog(@Hedgehogs[HedgehogsNumber]); |
513 SwitchCurrentHedgehog(@Hedgehogs[HedgehogsNumber]); |
517 val(id, CurrentHedgehog^.BotLevel, c); |
514 CurrentHedgehog^.BotLevel:= StrToInt(id); |
518 Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
515 Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0); |
519 SplitBySpace(s, id); |
516 SplitBySpace(s, id); |
520 val(s, Gear^.Health, c); |
517 Gear^.Health:= StrToInt(s); |
521 TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
518 TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); |
522 Gear^.Hedgehog^.Team:= CurrentTeam; |
519 Gear^.Hedgehog^.Team:= CurrentTeam; |
523 if (GameFlags and gfSharedAmmo) <> 0 then |
520 if (GameFlags and gfSharedAmmo) <> 0 then |
524 CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex |
521 CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex |
525 else if (GameFlags and gfPerHogAmmo) <> 0 then |
522 else if (GameFlags and gfPerHogAmmo) <> 0 then |
536 end |
533 end |
537 end; |
534 end; |
538 |
535 |
539 procedure chAddTeam(var s: shortstring); |
536 procedure chAddTeam(var s: shortstring); |
540 var Color: Longword; |
537 var Color: Longword; |
541 c: LongInt; |
|
542 ts, cs: shortstring; |
538 ts, cs: shortstring; |
543 begin |
539 begin |
544 cs:= ''; |
540 cs:= ''; |
545 ts:= ''; |
541 ts:= ''; |
546 if isDeveloperMode then |
542 if isDeveloperMode then |
547 begin |
543 begin |
548 SplitBySpace(s, cs); |
544 SplitBySpace(s, cs); |
549 SplitBySpace(cs, ts); |
545 SplitBySpace(cs, ts); |
550 val(cs, Color, c); |
546 Color:= StrToInt(cs); |
551 TryDo(Color <> 0, 'Error: black team color', true); |
547 TryDo(Color <> 0, 'Error: black team color', true); |
552 |
548 |
553 // color is always little endian so the mask must be constant also in big endian archs |
549 // color is always little endian so the mask must be constant also in big endian archs |
554 Color:= Color or $FF000000; |
550 Color:= Color or $FF000000; |
555 AddTeam(Color); |
551 AddTeam(Color); |
562 end |
558 end |
563 end; |
559 end; |
564 |
560 |
565 procedure chSetHHCoords(var x: shortstring); |
561 procedure chSetHHCoords(var x: shortstring); |
566 var y: shortstring; |
562 var y: shortstring; |
567 t, c: Longint; |
563 t: Longint; |
568 begin |
564 begin |
569 y:= ''; |
565 y:= ''; |
570 if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then |
566 if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then |
571 exit; |
567 exit; |
572 SplitBySpace(x, y); |
568 SplitBySpace(x, y); |
573 val(x, t, c); |
569 t:= StrToInt(x); |
574 CurrentHedgehog^.Gear^.X:= int2hwFloat(t); |
570 CurrentHedgehog^.Gear^.X:= int2hwFloat(t); |
575 val(y, t, c); |
571 t:= StrToInt(y); |
576 CurrentHedgehog^.Gear^.Y:= int2hwFloat(t) |
572 CurrentHedgehog^.Gear^.Y:= int2hwFloat(t) |
577 end; |
573 end; |
578 |
574 |
579 procedure chBind(var id: shortstring); |
575 procedure chBind(var id: shortstring); |
580 var KeyName, Modifier, tmp : shortstring; |
576 var KeyName, Modifier, tmp : shortstring; |
581 b : LongInt; |
577 b : LongInt; |