diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/Don't_Get_Worse/Hold_The_Line.dpr | 23 | ||||
-rw-r--r-- | plugins/Makefile.in | 17 | ||||
-rw-r--r-- | plugins/SDK/USDXStrUtils.pas | 79 | ||||
-rw-r--r-- | plugins/Team_Duell/TeamDuell.dpr | 29 |
4 files changed, 23 insertions, 125 deletions
diff --git a/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/plugins/Don't_Get_Worse/Hold_The_Line.dpr index 583a0b94..a7828f8e 100644 --- a/plugins/Don't_Get_Worse/Hold_The_Line.dpr +++ b/plugins/Don't_Get_Worse/Hold_The_Line.dpr @@ -5,18 +5,16 @@ library Hold_The_Line; {$ENDIF} uses - ModiSDK in '..\SDK\ModiSDK.pas', -// USDXStrUtils in '..\SDK\USDXStrUtils.pas', - sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', - moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', - gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; + SysUtils, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; var PointerTex: TSmallTexture; CountSentences: cardinal; Limit: byte; MethodRec: TMethodRec; - Frame: integer; +// Frame: integer; PlayerTimes: array[0..5] of integer; LastTick: cardinal; PointerVisible: boolean; @@ -92,7 +90,7 @@ begin CountSentences := Sentences.High; Limit := 0; - Frame := 0; +// Frame := 0; MethodRec := Methods; @@ -115,14 +113,12 @@ var Index: integer; L: byte; C: byte; -// Text: PChar; - Blink: boolean; Tick: cardinal; begin // activate blink if (CurSentence = CountSentences div 5 * 2 - 1) or (CurSentence = CountSentences div 3 * 2 - 1) then begin - Tick := SDL_GetTicks() div 400; + Tick := round(TimeStampToMSecs(DateTimeToTimeStamp(Now))) div 400; if (Tick <> LastTick) then begin LastTick := Tick; @@ -188,14 +184,7 @@ begin begin Inc(C); // Draw dismissed -// Text := CreateStr(PChar('PARTY_DISMISSED')); - glColor4f (0.8, 0.8, 0.8, 1); - -{ - MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY-8, Text); - FreeStr(Text); -} MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY-8, SoundName); end; end; diff --git a/plugins/Makefile.in b/plugins/Makefile.in index 43c9d604..0fc49745 100644 --- a/plugins/Makefile.in +++ b/plugins/Makefile.in @@ -44,17 +44,6 @@ PUNIT_FLAGS := -FE../game/plugins -Fu../build/fpc-$(PPROCESSOR)-$(PPLATFORM) PCUNIT_DIR := $(USDX_BUILD_DIR)/fpc-$(PPROCESSOR)-$(PPLATFORM) PCUNIT_FLAGS := -FU$(PCUNIT_DIR) -# Directories added to the includes path -PINC_FLAGS := -Fi$(USDX_LIB_DIR)/JEDI-SDL/SDL/Pas - -# Flags for the treatment of a linker issue with SDL. -# Symbol _SDK_main is undefined -FPC_PLATFORM = @FPC_PLATFORM@ -PFLAGS_SDL := -ifeq ($(FPC_PLATFORM), darwin) -PFLAGS_SDL += -k"-U _SDL_main" -endif - ## # PFLAGS ## @@ -108,7 +97,6 @@ all: SDK 5000Points Blind Dont_Get_Worse Duell Team_Duell .PHONY: SDK SDK: clean-SDK $(PPC) $(strip $(PFLAGS_ALL)) SDK/ModiSDK.pas -# $(PPC) $(strip $(PFLAGS_ALL)) SDK/USDXStrUtils.pas .PHONY: 5000Points 5000Points: SDK clean-5000Points @@ -124,11 +112,11 @@ Duell: SDK clean-Duell .PHONY: Team_Duell Team_Duell: SDK clean-Team_Duell - $(PPC) $(PFLAGS_SDL) $(strip $(PFLAGS_ALL)) Team_Duell/TeamDuell.dpr + $(PPC) $(strip $(PFLAGS_ALL)) Team_Duell/TeamDuell.dpr .PHONY: Dont_Get_Worse Dont_Get_Worse: SDK clean-Dont_Get_Worse - $(PPC) $(PFLAGS_SDL) $(strip $(PFLAGS_ALL)) Don\'t_Get_Worse/Hold_The_Line.dpr + $(PPC) $(strip $(PFLAGS_ALL)) Don\'t_Get_Worse/Hold_The_Line.dpr .PHONY: clean-plugins clean-plugins: clean-SDK clean-5000Points clean-Blind clean-Dont_Get_Worse clean-Duell clean-Team_Duell @@ -136,7 +124,6 @@ clean-plugins: clean-SDK clean-5000Points clean-Blind clean-Dont_Get_Worse clean .PHONY: clean-SDK clean-SDK: $(RM) $(PCUNIT_DIR)/ModiSDK.o $(PCUNIT_DIR)/ModiSDK.ppu - $(RM) $(PCUNIT_DIR)/USDXStrUtils.o $(PCUNIT_DIR)/USDXStrUtils.ppu .PHONY: clean-5000Points clean-5000Points: diff --git a/plugins/SDK/USDXStrUtils.pas b/plugins/SDK/USDXStrUtils.pas deleted file mode 100644 index 94e5f65f..00000000 --- a/plugins/SDK/USDXStrUtils.pas +++ /dev/null @@ -1,79 +0,0 @@ -unit USDXStrUtils; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses ModiSDK; - -//function StrToAChar(Str: String): AChar; -function CreateStr(Str: PChar): PChar; -procedure FreeStr(Str: PChar); - -implementation - -{$IFDEF FPC} - {$ASMMODE Intel} -{$ENDIF} - -{function StrToAChar(Str: String): AChar; -var - L, I: Integer; -begin - L := Length(Str); - For I := 0 to L-1 do - AChar[I] := Str[I+1]; - - For I := L to 254 do - AChar[I] := #0; -end; } - -function StrCopy(Dest, Source: PChar): PChar; assembler; -asm - PUSH EDI - PUSH ESI - MOV ESI,EAX - MOV EDI,EDX - MOV ECX,0FFFFFFFFH - XOR AL,AL - REPNE SCASB - NOT ECX - MOV EDI,ESI - MOV ESI,EDX - MOV EDX,ECX - MOV EAX,EDI - SHR ECX,2 - REP MOVSD - MOV ECX,EDX - AND ECX,3 - REP MOVSB - POP ESI - POP EDI -end; - -function StrLen(Str: PChar): Cardinal; assembler; -asm - MOV EDX,EDI - MOV EDI,EAX - MOV ECX,0FFFFFFFFH - XOR AL,AL - REPNE SCASB - MOV EAX,0FFFFFFFEH - SUB EAX,ECX - MOV EDI,EDX -end; - -function CreateStr(Str: PChar): PChar; -begin - GetMem(Result, StrLen(Str) + 1); - StrCopy(Result, Str); -end; - -procedure FreeStr(Str: PChar); -begin - FreeMem(Str); -end; - -end. diff --git a/plugins/Team_Duell/TeamDuell.dpr b/plugins/Team_Duell/TeamDuell.dpr index 7937a78c..60bed41a 100644 --- a/plugins/Team_Duell/TeamDuell.dpr +++ b/plugins/Team_Duell/TeamDuell.dpr @@ -4,15 +4,10 @@ library TeamDuell ; {$MODE Delphi} {$ENDIF} -// compile with fpc -k-U -k_SDL_main TeamDuell.dpr -Fi../../src/lib/JEDI-SDL/SDL/Pas/ - uses - ModiSDK in '..\SDK\ModiSDK.pas', -// USDXStrUtils in '..\SDK\USDXStrUtils.pas', - sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', - moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', - gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas', - sysutils; + SysUtils, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; var TeamPlayer: array of array of string; @@ -24,6 +19,12 @@ var bps, RTimeToNextChange: double; firsttime, secondtime: boolean; +function GetTicks: integer; +// returns a time stamp in milliseconds +begin + GetTicks := round(TimeStampToMSecs(DateTimeToTimeStamp(Now))); +end; + // Give the plugin's info procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin @@ -92,7 +93,7 @@ begin until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1); end; ChangeOnSentence := 8; - starttick := SDL_GetTicks(); + starttick := GetTicks; firsttime := true; secondtime := true; bps := 1; @@ -114,11 +115,11 @@ begin if (CurSentence = ChangeOnSentence - 7) and (firsttime) then begin firsttime := false; - starttick := SDL_GetTicks(); + starttick := GetTicks; end; start := false; // show first singer for 5 sec - if (CurSentence < 1) and ((starttick + 5000) > SDL_GetTicks()) then + if (CurSentence < 1) and ((starttick + 5000) > GetTicks) then start := true; // TickCount(thirdSentence) @@ -126,12 +127,12 @@ begin begin secondtime := false; firsttime := true; - endtick := SDL_GetTicks(); + endtick := GetTicks; bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond end; // Time to next change - RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); + RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTicks - starttick) / 1000); TimeToNextChange := Trunc(RTimeToNextChange) + 1; // Next singer for team I @@ -222,7 +223,7 @@ end; // is executed on finish, returns the player number of the winner function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - Index: integer; + Index: integer; MaxScore: word; begin Result := 0; |