vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function Tetris_gost_stone () |
2 | if (Tetris["options"]["gost"] == 1) then |
||
3 | Tetris_stone_gost_pos (); |
||
4 | end |
||
5 | end |
||
6 | |||
7 | |||
8 | function Tetris_stone_gost_hide () |
||
9 | --variablen holen und setzen |
||
10 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
11 | local textur = Tetris["options"]["texturenset"]; |
||
12 | if ( Tetris["game"]["s_gost"]["temp"]["save"] == 1) then |
||
13 | --textur ändern |
||
14 | for s = 1, anz_s do |
||
15 | local s_pos = Tetris["game"]["s_gost"]["temp"][s]; |
||
16 | getglobal("Tetris_"..s_pos):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\0"); |
||
17 | end |
||
18 | |||
19 | if (Tetris["debug"]==1) then |
||
20 | DEFAULT_CHAT_FRAME:AddMessage("Hide Ex-Gost"); |
||
21 | end |
||
22 | end |
||
23 | end |
||
24 | |||
25 | --aktuelle neue position des gost-bausteins speichern |
||
26 | function Tetris_gost_stone_save () |
||
27 | --variablen holen und setzen |
||
28 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
29 | --liste erstellen |
||
30 | for s = 1, anz_s do |
||
31 | --pos des berechneten steins auslesen |
||
32 | local pos = Tetris["game"]["s_gost"][s]; |
||
33 | --pos des steines als string im temp speichern |
||
34 | Tetris["game"]["s_gost"]["temp"][s]=pos; |
||
35 | end |
||
36 | Tetris["game"]["s_gost"]["temp"]["save"] = 1; |
||
37 | end |
||
38 | |||
39 | function Tetris_stone_gost_show () |
||
40 | --variablen holen und setzen |
||
41 | local stone = Tetris["game"]["s"]; |
||
42 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
43 | local textur = Tetris["options"]["texturenset"]; |
||
44 | --textur ändern |
||
45 | for s = 1, anz_s do |
||
46 | local s_pos = Tetris["game"]["s_gost"][s]; |
||
47 | getglobal("Tetris_"..s_pos):SetNormalTexture ("Interface\\AddOns\\Tetris\\texturen\\"..textur.."\\g"); |
||
48 | end |
||
49 | end |
||
50 | |||
51 | function Tetris_stone_gost_pos (minus) |
||
52 | --minus = anzahl der felder nach unten |
||
53 | --variablen holen und setzen |
||
54 | local anz_l = Tetris["game"]["s_anz_l"]; |
||
55 | local s_l = Tetris["game"]["s_lage"]; |
||
56 | local pos_y = Tetris["game"]["s_pos_y"]; |
||
57 | |||
58 | --änderungen speichern |
||
59 | if (minus == nil) then |
||
60 | Tetris["game"]["s_gost"]["s_pos_y"] = pos_y; |
||
61 | else |
||
62 | Tetris["game"]["s_gost"]["s_pos_y"] = pos_y+minus; |
||
63 | end |
||
64 | |||
65 | --neue position der steine berechnen |
||
66 | Tetris_falling_gost_stone_coming_soon(); |
||
67 | --test laufen lassen und reagieren |
||
68 | if (Tetris_gost_stone_outside_test()==true) then |
||
69 | --gost stein ist unten |
||
70 | Tetris_stone_gost_is_down (); |
||
71 | else |
||
72 | --gost stein ist nicht unten |
||
73 | if (minus == nil) then |
||
74 | Tetris_stone_gost_pos (1); |
||
75 | else |
||
76 | local minus = minus-1; |
||
77 | Tetris_stone_gost_pos (minus); |
||
78 | end |
||
79 | end |
||
80 | end |
||
81 | |||
82 | --position des zukünftigen gost-bausteins berechnen |
||
83 | function Tetris_falling_gost_stone_coming_soon () |
||
84 | --variablen holen und setzen |
||
85 | local stone = Tetris["game"]["s"]; |
||
86 | local s_lage = Tetris["game"]["s_lage"]; |
||
87 | local x_pos = Tetris["game"]["s_pos_x"]; |
||
88 | local y_pos = Tetris["game"]["s_gost"]["s_pos_y"]; |
||
89 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
90 | --pos der steine über diesen baustein in dieser lage holen |
||
91 | local infos = Tetris_baustein (stone, 2, s_lage); |
||
92 | --liste erstellen |
||
93 | for s = 1, anz_s do |
||
94 | --relative pos des steins zum nullpunkt des bausteins als string |
||
95 | local r_string_s_pos = infos[s]; |
||
96 | --zahlen auslesen |
||
97 | local r_s_pos = Tetris_return_xy(r_string_s_pos); |
||
98 | local r_s_x = r_s_pos["x"]; |
||
99 | local r_s_y = r_s_pos["y"]; |
||
100 | --absolute pos des steins im gamewindow |
||
101 | local s_x = x_pos+r_s_x; |
||
102 | local s_y = y_pos+r_s_y; |
||
103 | --pos des steines als string im temp speichern |
||
104 | Tetris["game"]["s_gost"][s]="x"..s_x.."y"..s_y; |
||
105 | end |
||
106 | end |
||
107 | |||
108 | function Tetris_gost_stone_outside_test () |
||
109 | --variablen holen und setzen |
||
110 | local anz_s = Tetris["game"]["s_anz_s"]; |
||
111 | --liste erstellen |
||
112 | for s = 1, anz_s do |
||
113 | --pos des berechneten steins auslesen |
||
114 | local pos_string = Tetris["game"]["s_gost"][s]; |
||
115 | --pos x y als zahlen holen |
||
116 | local pos_xy = Tetris_return_xy(pos_string); |
||
117 | local pos_x = pos_xy["x"]; |
||
118 | local pos_y = pos_xy["y"]-1; |
||
119 | --überprüfen ob stein auserhalb spielfeld |
||
120 | if (pos_y < 1) then |
||
121 | --stein ist nicht im spielfeld |
||
122 | return true; |
||
123 | else |
||
124 | --überprüfen ob stein schon besetzt ist |
||
125 | local pos = "x"..pos_x.."y"..pos_y; |
||
126 | if not (Tetris["game"]["feld"][pos] == 0) then |
||
127 | return true; |
||
128 | end |
||
129 | end |
||
130 | end |
||
131 | --keine ungültige oder besetzte steine gefunden |
||
132 | return false; |
||
133 | end |
||
134 | |||
135 | function Tetris_stone_gost_is_down () |
||
136 | Tetris_stone_gost_hide (); |
||
137 | Tetris_gost_stone_save (); |
||
138 | Tetris_stone_gost_show (); |
||
139 | end |