diff --git a/README.md b/README.md index fa6d5449..794e5051 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - Taisei +# Taisei ## Introduction diff --git a/gfx/mainmenu/logo.png b/gfx/mainmenu/logo.png index 0358018e..bde02533 100644 Binary files a/gfx/mainmenu/logo.png and b/gfx/mainmenu/logo.png differ diff --git a/models/reeds.obj b/models/reeds.obj new file mode 100644 index 00000000..3f020525 --- /dev/null +++ b/models/reeds.obj @@ -0,0 +1,617 @@ +# Blender v2.78 (sub 0) OBJ File: 'reeds.blend' +# www.blender.org +v -0.634038 -1.301613 -1.045364 +v -0.634038 0.698387 -1.045364 +v -0.595995 -1.301613 -1.017725 +v -0.595995 0.698387 -1.017725 +v -0.610526 -1.301613 -0.973004 +v -0.610526 0.698387 -0.973004 +v -0.657549 -1.301613 -0.973004 +v -0.657549 0.698387 -0.973004 +v -0.672080 -1.301613 -1.017725 +v -0.672080 0.698387 -1.017725 +s off +f 2 3 1 +f 4 5 3 +f 6 7 5 +f 2 8 6 +f 8 9 7 +f 10 1 9 +f 3 7 1 +f 2 4 3 +f 4 6 5 +f 6 8 7 +f 6 4 2 +f 2 10 8 +f 8 10 9 +f 10 2 1 +f 9 1 7 +f 3 5 7 +v 0.600419 -0.664715 -1.807740 +v 0.600419 1.335285 -1.807740 +v 0.638461 -0.664715 -1.780100 +v 0.638461 1.335285 -1.780100 +v 0.623930 -0.664715 -1.735379 +v 0.623930 1.335285 -1.735379 +v 0.576907 -0.664715 -1.735379 +v 0.576907 1.335285 -1.735379 +v 0.562376 -0.664715 -1.780100 +v 0.562376 1.335285 -1.780100 +s off +f 12 13 11 +f 14 15 13 +f 16 17 15 +f 12 18 16 +f 18 19 17 +f 20 11 19 +f 13 17 19 +f 12 14 13 +f 14 16 15 +f 16 18 17 +f 16 14 12 +f 12 20 18 +f 18 20 19 +f 20 12 11 +f 19 11 13 +f 13 15 17 +v -0.218597 -0.826936 -3.401073 +v -0.218597 1.173064 -3.401073 +v -0.180554 -0.826936 -3.373434 +v -0.180554 1.173064 -3.373434 +v -0.195085 -0.826936 -3.328713 +v -0.195085 1.173064 -3.328713 +v -0.242108 -0.826936 -3.328713 +v -0.242108 1.173064 -3.328713 +v -0.256639 -0.826936 -3.373434 +v -0.256639 1.173064 -3.373434 +s off +f 22 23 21 +f 24 25 23 +f 26 27 25 +f 30 28 26 +f 28 29 27 +f 30 21 29 +f 23 27 29 +f 22 24 23 +f 24 26 25 +f 26 28 27 +f 26 24 22 +f 22 30 26 +f 28 30 29 +f 30 22 21 +f 29 21 23 +f 23 25 27 +v 1.337848 -0.989626 -2.523676 +v 1.337848 1.010374 -2.523676 +v 1.375890 -0.989626 -2.496037 +v 1.375890 1.010374 -2.496037 +v 1.361359 -0.989626 -2.451315 +v 1.361359 1.010374 -2.451315 +v 1.314337 -0.989626 -2.451315 +v 1.314337 1.010374 -2.451315 +v 1.299806 -0.989626 -2.496037 +v 1.299806 1.010374 -2.496037 +s off +f 32 33 31 +f 34 35 33 +f 36 37 35 +f 32 38 36 +f 38 39 37 +f 40 31 39 +f 33 37 39 +f 32 34 33 +f 34 36 35 +f 36 38 37 +f 36 34 32 +f 32 40 38 +f 38 40 39 +f 40 32 31 +f 39 31 33 +f 33 35 37 +v 0.232023 -1.562242 4.240509 +v 0.232023 0.437758 4.240509 +v 0.270065 -1.562242 4.268148 +v 0.270065 0.437758 4.268148 +v 0.255534 -1.562242 4.312870 +v 0.255534 0.437758 4.312870 +v 0.208512 -1.562242 4.312870 +v 0.208512 0.437758 4.312870 +v 0.193981 -1.562242 4.268148 +v 0.193981 0.437758 4.268148 +s off +f 42 43 41 +f 44 45 43 +f 46 47 45 +f 42 48 46 +f 48 49 47 +f 50 41 49 +f 43 47 41 +f 42 44 43 +f 44 46 45 +f 46 48 47 +f 46 44 42 +f 42 50 48 +f 48 50 49 +f 50 42 41 +f 49 41 47 +f 43 45 47 +v -0.290649 -1.343812 3.756744 +v -0.290649 0.656188 3.756744 +v -0.252606 -1.343812 3.784384 +v -0.252606 0.656188 3.784384 +v -0.267137 -1.343812 3.829105 +v -0.267137 0.656188 3.829105 +v -0.314160 -1.343812 3.829105 +v -0.314160 0.656188 3.829105 +v -0.328691 -1.343812 3.784384 +v -0.328691 0.656188 3.784384 +s off +f 52 53 51 +f 54 55 53 +f 56 57 55 +f 60 58 56 +f 58 59 57 +f 60 51 59 +f 55 57 59 +f 52 54 53 +f 54 56 55 +f 56 58 57 +f 56 54 52 +f 52 60 56 +f 58 60 59 +f 60 52 51 +f 59 51 53 +f 53 55 59 +v -0.258230 -0.769334 3.206080 +v -0.258230 1.230666 3.206080 +v -0.220188 -0.769334 3.233720 +v -0.220188 1.230666 3.233720 +v -0.234719 -0.769334 3.278441 +v -0.234719 1.230666 3.278441 +v -0.281741 -0.769334 3.278441 +v -0.281741 1.230666 3.278441 +v -0.296272 -0.769334 3.233720 +v -0.296272 1.230666 3.233720 +s off +f 62 63 61 +f 64 65 63 +f 66 67 65 +f 70 68 66 +f 68 69 67 +f 70 61 69 +f 65 67 69 +f 62 64 63 +f 64 66 65 +f 66 68 67 +f 66 64 62 +f 62 70 66 +f 68 70 69 +f 70 62 61 +f 69 61 63 +f 63 65 69 +v 0.435490 -0.919370 3.220089 +v 0.435490 1.080630 3.220089 +v 0.473532 -0.919370 3.247729 +v 0.473532 1.080630 3.247729 +v 0.459001 -0.919370 3.292450 +v 0.459001 1.080630 3.292450 +v 0.411978 -0.919370 3.292450 +v 0.411978 1.080630 3.292450 +v 0.397448 -0.919370 3.247729 +v 0.397448 1.080630 3.247729 +s off +f 72 73 71 +f 74 75 73 +f 76 77 75 +f 80 78 76 +f 78 79 77 +f 80 71 79 +f 75 77 79 +f 72 74 73 +f 74 76 75 +f 76 78 77 +f 76 74 72 +f 72 80 76 +f 78 80 79 +f 80 72 71 +f 79 71 73 +f 73 75 79 +v 0.559867 -0.853226 3.349545 +v 0.559867 1.146774 3.349545 +v 0.597910 -0.853226 3.377184 +v 0.597910 1.146774 3.377184 +v 0.583379 -0.853226 3.421906 +v 0.583379 1.146774 3.421906 +v 0.536356 -0.853226 3.421906 +v 0.536356 1.146774 3.421906 +v 0.521825 -0.853226 3.377184 +v 0.521825 1.146774 3.377184 +s off +f 82 83 81 +f 84 85 83 +f 86 87 85 +f 82 88 86 +f 88 89 87 +f 90 81 89 +f 83 87 89 +f 82 84 83 +f 84 86 85 +f 86 88 87 +f 86 84 82 +f 82 90 88 +f 88 90 89 +f 90 82 81 +f 89 81 83 +f 83 85 87 +v -0.141651 -0.878030 2.482493 +v -0.141651 1.121970 2.482493 +v -0.103609 -0.878030 2.510133 +v -0.103609 1.121970 2.510133 +v -0.118140 -0.878030 2.554854 +v -0.118140 1.121970 2.554854 +v -0.165163 -0.878030 2.554854 +v -0.165163 1.121970 2.554854 +v -0.179694 -0.878030 2.510133 +v -0.179694 1.121970 2.510133 +s off +f 92 93 91 +f 94 95 93 +f 96 97 95 +f 100 98 96 +f 98 99 97 +f 100 91 99 +f 93 97 99 +f 92 94 93 +f 94 96 95 +f 96 98 97 +f 96 94 92 +f 92 100 96 +f 98 100 99 +f 100 92 91 +f 99 91 93 +f 93 95 97 +v 0.083493 -0.640279 1.831740 +v 0.083493 1.359721 1.831740 +v 0.121535 -0.640279 1.859380 +v 0.121535 1.359721 1.859380 +v 0.107004 -0.640279 1.904101 +v 0.107004 1.359721 1.904101 +v 0.059982 -0.640279 1.904101 +v 0.059982 1.359721 1.904101 +v 0.045451 -0.640279 1.859380 +v 0.045451 1.359721 1.859380 +s off +f 102 103 101 +f 104 105 103 +f 106 107 105 +f 110 108 106 +f 108 109 107 +f 110 101 109 +f 103 107 109 +f 102 104 103 +f 104 106 105 +f 106 108 107 +f 106 104 102 +f 102 110 106 +f 108 110 109 +f 110 102 101 +f 109 101 103 +f 103 105 107 +v 0.248519 -1.010113 1.798276 +v 0.248519 0.989887 1.798276 +v 0.286561 -1.010113 1.825915 +v 0.286561 0.989887 1.825915 +v 0.272030 -1.010113 1.870637 +v 0.272030 0.989887 1.870637 +v 0.225007 -1.010113 1.870637 +v 0.225007 0.989887 1.870637 +v 0.210477 -1.010113 1.825915 +v 0.210477 0.989887 1.825915 +s off +f 112 113 111 +f 114 115 113 +f 116 117 115 +f 112 118 116 +f 118 119 117 +f 120 111 119 +f 113 117 111 +f 112 114 113 +f 114 116 115 +f 116 118 117 +f 116 114 112 +f 112 120 118 +f 118 120 119 +f 120 112 111 +f 119 111 117 +f 113 115 117 +v -0.271830 -0.284843 0.335923 +v -0.271830 1.715157 0.335923 +v -0.233788 -0.284843 0.363562 +v -0.233788 1.715157 0.363562 +v -0.248319 -0.284843 0.408283 +v -0.248319 1.715157 0.408283 +v -0.295341 -0.284843 0.408283 +v -0.295341 1.715157 0.408283 +v -0.309872 -0.284843 0.363562 +v -0.309872 1.715157 0.363562 +s off +f 122 123 121 +f 124 125 123 +f 126 127 125 +f 130 128 126 +f 128 129 127 +f 130 121 129 +f 123 127 129 +f 122 124 123 +f 124 126 125 +f 126 128 127 +f 126 124 122 +f 122 130 126 +f 128 130 129 +f 130 122 121 +f 129 121 123 +f 123 125 127 +v -0.583754 -0.503976 0.656024 +v -0.583754 1.496024 0.656024 +v -0.545711 -0.503976 0.683663 +v -0.545711 1.496024 0.683663 +v -0.560242 -0.503976 0.728384 +v -0.560242 1.496024 0.728384 +v -0.607265 -0.503976 0.728384 +v -0.607265 1.496024 0.728384 +v -0.621796 -0.503976 0.683663 +v -0.621796 1.496024 0.683663 +s off +f 132 133 131 +f 134 135 133 +f 136 137 135 +f 132 138 136 +f 138 139 137 +f 140 131 139 +f 133 137 131 +f 132 134 133 +f 134 136 135 +f 136 138 137 +f 136 134 132 +f 132 140 138 +f 138 140 139 +f 140 132 131 +f 139 131 137 +f 133 135 137 +v 0.000000 -0.454338 -0.040000 +v 0.000000 1.545662 -0.040000 +v 0.038042 -0.454338 -0.012361 +v 0.038042 1.545662 -0.012361 +v 0.023511 -0.454338 0.032361 +v 0.023511 1.545662 0.032361 +v -0.023511 -0.454338 0.032361 +v -0.023511 1.545662 0.032361 +v -0.038042 -0.454338 -0.012361 +v -0.038042 1.545662 -0.012361 +s off +f 142 143 141 +f 144 145 143 +f 146 147 145 +f 142 148 144 +f 148 149 147 +f 150 141 149 +f 143 147 141 +f 142 144 143 +f 144 146 145 +f 146 148 147 +f 146 144 148 +f 142 150 148 +f 148 150 149 +f 150 142 141 +f 149 141 147 +f 143 145 147 +v -1.603625 0.000000 4.977862 +v 1.603625 0.000000 4.977862 +v -1.603625 0.000000 -4.977862 +v 1.603625 0.000000 -4.977862 +v -1.603625 0.000000 0.000000 +v 0.000000 0.000000 4.977862 +v 1.603625 0.000000 0.000000 +v 0.000000 0.000000 -4.977862 +v -0.110037 0.215929 -0.063601 +v -1.603625 0.000000 2.488931 +v 0.801812 0.000000 4.977862 +v 1.603625 0.000000 -2.488931 +v -0.801812 0.000000 -4.977862 +v -1.603625 0.000000 -2.488931 +v -0.801812 0.000000 4.977862 +v 1.603625 0.000000 2.488931 +v 0.801812 0.000000 -4.977862 +v -0.084695 0.283219 -2.563736 +v -0.027203 0.289014 2.443751 +v -0.821686 0.039000 -0.011487 +v 0.781938 0.039000 -0.011487 +v 0.796899 0.052200 2.480771 +v -0.806726 0.052200 2.480771 +v -0.817238 0.028620 -2.506167 +v 0.787067 0.147948 -2.486437 +v -1.603625 0.000000 3.733397 +v 1.202718 0.000000 4.977862 +v 1.603625 0.000000 -3.733397 +v -1.202718 0.000000 -4.977862 +v -1.603625 0.000000 -1.244465 +v -0.400906 0.000000 4.977862 +v 1.603625 0.000000 1.244465 +v 0.400906 0.000000 -4.977862 +v 0.000000 0.000000 -3.733397 +v -0.102702 0.288924 1.255214 +v -1.202718 0.000000 0.000000 +v 0.324064 0.150790 -0.044414 +v -1.603625 0.000000 1.244465 +v 0.400906 0.000000 4.977862 +v 1.603625 0.000000 -1.244465 +v -0.400906 0.000000 -4.977862 +v -1.603625 0.000000 -3.733397 +v -1.202718 0.000000 4.977862 +v 1.603625 0.000000 3.733397 +v 1.202718 0.000000 -4.977862 +v -0.148464 0.365815 -1.250392 +v 0.003248 0.121451 3.710740 +v -0.477748 0.150790 -0.044414 +v 1.202718 0.000000 0.000000 +v 0.702399 0.211221 1.268367 +v 0.805061 0.121451 3.710740 +v 0.381909 0.201827 2.457381 +v 1.202718 0.000000 2.488931 +v -0.804921 0.073454 1.232032 +v -0.801812 0.000000 3.733397 +v -1.202718 0.000000 2.488931 +v -0.419903 0.201827 2.457381 +v -0.801812 0.000000 -3.733397 +v -0.943026 0.289957 -1.261309 +v -1.202718 0.000000 -2.488931 +v -0.460354 0.144655 -2.549954 +v 0.801812 0.000000 -3.733397 +v 0.793061 0.091555 -1.231290 +v 0.342338 0.298892 -2.524451 +v 1.202843 0.021807 -2.485325 +v 1.200807 0.019997 -1.241588 +v 0.350881 0.216250 -1.228494 +v 0.400906 0.000000 -3.733397 +v -0.603499 0.419158 -1.268018 +v -1.239241 0.074993 -1.248822 +v -1.202718 0.000000 -3.733397 +v -0.400066 0.031412 3.727537 +v -1.202718 0.000000 3.733397 +v -1.203607 0.020994 1.240912 +v 1.203559 0.031412 3.727537 +v 0.405558 0.173917 3.700953 +v 0.257278 0.332445 1.273618 +v 1.177007 0.054629 1.250647 +v -0.430886 0.155468 1.233578 +v -0.400906 0.000000 -3.733397 +v 1.202718 0.000000 -3.733397 +s 1 +f 178 195 231 +f 184 191 230 +f 229 159 198 +f 182 199 228 +f 200 187 227 +f 226 172 202 +f 225 166 203 +f 204 186 224 +f 205 206 223 +f 197 207 222 +f 208 179 221 +f 209 210 220 +f 196 211 219 +f 212 183 218 +f 217 175 214 +f 190 215 216 +f 216 175 213 +f 171 216 213 +f 157 216 199 +f 196 214 168 +f 159 217 196 +f 187 213 217 +f 218 158 184 +f 214 184 168 +f 175 218 214 +f 219 174 209 +f 198 209 170 +f 198 196 219 +f 220 164 180 +f 155 220 180 +f 170 220 186 +f 221 153 192 +f 210 192 164 +f 174 221 210 +f 222 173 205 +f 181 205 165 +f 156 222 181 +f 223 160 176 +f 193 176 151 +f 165 223 193 +f 224 155 188 +f 206 188 160 +f 173 224 206 +f 201 203 172 +f 161 225 201 +f 177 194 225 +f 197 202 169 +f 189 197 156 +f 189 201 226 +f 185 187 159 +f 169 227 185 +f 202 200 227 +f 228 171 200 +f 172 228 200 +f 203 182 228 +f 229 170 204 +f 207 204 173 +f 207 185 229 +f 230 163 208 +f 211 208 174 +f 168 230 211 +f 231 167 212 +f 215 212 175 +f 162 231 215 +f 178 154 195 +f 184 158 191 +f 229 185 159 +f 182 157 199 +f 200 171 187 +f 226 201 172 +f 225 194 166 +f 204 170 186 +f 205 173 206 +f 197 169 207 +f 208 163 179 +f 209 174 210 +f 196 168 211 +f 212 167 183 +f 217 213 175 +f 190 162 215 +f 216 215 175 +f 171 199 216 +f 157 190 216 +f 196 217 214 +f 159 187 217 +f 187 171 213 +f 218 183 158 +f 214 218 184 +f 175 212 218 +f 219 211 174 +f 198 219 209 +f 198 159 196 +f 220 210 164 +f 155 186 220 +f 170 209 220 +f 221 179 153 +f 210 221 192 +f 174 208 221 +f 222 207 173 +f 181 222 205 +f 156 197 222 +f 223 206 160 +f 193 223 176 +f 165 205 223 +f 224 186 155 +f 206 224 188 +f 173 204 224 +f 201 225 203 +f 161 177 225 +f 177 152 194 +f 197 226 202 +f 189 226 197 +f 189 161 201 +f 185 227 187 +f 169 202 227 +f 202 172 200 +f 228 199 171 +f 172 203 228 +f 203 166 182 +f 229 198 170 +f 207 229 204 +f 207 169 185 +f 230 191 163 +f 211 230 208 +f 168 184 230 +f 231 195 167 +f 215 231 212 +f 162 178 231 diff --git a/shader/zbuf_fog.sha b/shader/zbuf_fog.sha index 3a78ea37..ed99a29d 100644 --- a/shader/zbuf_fog.sha +++ b/shader/zbuf_fog.sha @@ -15,13 +15,14 @@ uniform sampler2D tex; uniform float start; uniform float end; uniform float exponent; +uniform float sphereness; uniform vec4 fog_color; void main(void) { vec2 pos = vec2(gl_TexCoord[0]); - float z = pow(texture2D(depth, pos).x, exponent); + float z = pow(texture2D(depth,pos).x+sphereness*length(pos-vec2(0.3,0.0)), exponent); float f = clamp((end - z)/(end-start),0.0,1.0); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6a7771a..9f7da44c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,6 +63,7 @@ set(SRCs menu/spellpractice.c menu/common.c stages/stage1.c + stages/stage1_events.c stages/stage2.c stages/stage2_events.c stages/stage3.c diff --git a/src/menu/mainmenu.c b/src/menu/mainmenu.c index e81bbf29..e6536c13 100644 --- a/src/menu/mainmenu.c +++ b/src/menu/mainmenu.c @@ -96,7 +96,7 @@ void draw_main_menu_bg(MenuData* menu) { void draw_main_menu(MenuData *menu) { draw_main_menu_bg(menu); - draw_texture(150, 100, "mainmenu/logo"); + draw_texture(150.5, 100, "mainmenu/logo"); glPushMatrix(); glTranslatef(0, SCREEN_H-235, 0); diff --git a/src/player.c b/src/player.c index 60b62698..a3d8d7a0 100644 --- a/src/player.c +++ b/src/player.c @@ -257,9 +257,9 @@ void player_death(Player *plr) { int i; for(i = 0; i < 20; i++) { tsrand_fill(2); - create_particle2c("flare", plr->pos, 0, Shrink, timeout_linear, 40, (3+afrand(0)*7)*cexp(I*tsrand_a(1))); + create_particle2c("flare", plr->pos, 0, Shrink, timeout_linear, 40, (3+afrand(0)*7)*cexp(I*tsrand_a(1)))->type=PlrProj; } - create_particle2c("blast", plr->pos, rgb(1,0.5,0.3), GrowFade, timeout, 35, 2.4); + create_particle2c("blast", plr->pos, rgb(1,0.5,0.3), GrowFade, timeout, 35, 2.4)->type=PlrProj; plr->deathtime = global.frames + DEATHBOMB_TIME; } } @@ -437,6 +437,6 @@ void player_graze(Player *plr, complex pos, int pts) { int i = 0; for(i = 0; i < 5; ++i) { tsrand_fill(3); - create_particle2c("flare", pos, 0, Shrink, timeout_linear, 5 + 5 * afrand(2), (1+afrand(0)*5)*cexp(I*tsrand_a(1))); + create_particle2c("flare", pos, 0, Shrink, timeout_linear, 5 + 5 * afrand(2), (1+afrand(0)*5)*cexp(I*tsrand_a(1)))->type=PlrProj; } } diff --git a/src/plrmodes.c b/src/plrmodes.c index ec83098d..a31ea861 100644 --- a/src/plrmodes.c +++ b/src/plrmodes.c @@ -124,7 +124,7 @@ int youmu_slash(Enemy *e, int t) { void YoumuOppositeMyon(Enemy *e, int t) { complex pos = e->pos; - create_particle2c("flare", pos, 0, Shrink, timeout, 10, -e->pos+10.0*I); + create_particle2c("flare", pos, 0, Shrink, timeout, 10, -e->pos+10.0*I)->type = PlrProj; } int youmu_opposite_myon(Enemy *e, int t) { @@ -428,7 +428,7 @@ void MariStarBomb(Projectile *p, int t) { int marisa_star_projectile(Projectile *p, int t) { int r = accelerated(p, t); - create_projectile_p(&global.particles, get_tex("proj/maristar"), p->pos, 0, MariStarTrail, timeout, 10, 0, 0, 0)->type = Particle; + create_projectile_p(&global.particles, get_tex("proj/maristar"), p->pos, 0, MariStarTrail, timeout, 10, 0, 0, 0)->type = PlrProj; return r; } diff --git a/src/stages/stage1.c b/src/stages/stage1.c index 12c081ce..994c3f19 100644 --- a/src/stages/stage1.c +++ b/src/stages/stage1.c @@ -7,18 +7,13 @@ #include "stage1.h" -#include "stage.h" #include "global.h" +#include "stage.h" #include "stageutils.h" +#include "stage1_events.h" static Stage3D bgcontext; -void cirno_perfect_freeze(Boss*, int); -void cirno_crystal_rain(Boss*, int); -void cirno_icicle_fall(Boss*, int); -void cirno_pfreeze_bg(Boss*, int); -void cirno_crystal_blizzard(Boss*, int); - /* * See the definition of AttackInfo in boss.h for information on how to set up the idmaps. */ @@ -36,51 +31,51 @@ AttackInfo stage1_spells[] = { {{0}} }; -Dialog *stage1_dialog(void) { - Dialog *d = create_dialog(global.plr.cha == Marisa ? "dialog/marisa" : "dialog/youmu", "dialog/cirno"); - - dadd_msg(d, Right, "Hey! Who’s there?"); - - if(global.plr.cha == Marisa) - dadd_msg(d, Left, "It’s me!"); - else - dadd_msg(d, Left, "Just someone?"); - - dadd_msg(d, Right, "How dare you pass the lake of the fairies?!\nIt’s a dangerous place for weak humans!"); - - if(global.plr.cha == Marisa) { - dadd_msg(d, Left, "You call me weak?"); - dadd_msg(d, Right, "I do!"); - } else { - dadd_msg(d, Left, "I’m just passing by. Got a problem with that?"); - dadd_msg(d, Right, "Of course! You can’t do that!"); - } - - dadd_msg(d, Right, "I’ll freeze you where you stand!"); - dadd_msg(d, BGM, "bgm_stage1boss"); - - return d; -} - void stage1_bg_draw(Vector pos) { glPushMatrix(); - glTranslatef(pos[0],pos[1],pos[0]); + glTranslatef(0,bgcontext.cx[1]+500,0); glRotatef(180,1,0,0); + + + //glEnable(GL_TEXTURE_2D); + //glBindTexture(GL_TEXTURE_2D, get_tex("stage1/water")->gltex); + + glPushMatrix(); glScalef(1200,3000,1); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, get_tex("stage1/water")->gltex); - + glColor4f(0,0.1,.1,1); draw_quad(); + glColor4f(1,1,1,1); + glPopMatrix(); - glDisable(GL_TEXTURE_2D); + glPushMatrix(); + glRotatef(30,1,0,0); + glScalef(.85,-.85,.85); + glTranslatef(-VIEWPORT_W/2,0,0); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + for(Projectile *p = global.particles; p; p = p->next) { + if(p->type != PlrProj) + p->draw(p,global.frames - p->birthtime); + } + draw_enemies(global.enemies); + if(global.boss) + draw_boss(global.boss); + glPopMatrix(); + glEnable(GL_CULL_FACE); + + glPushMatrix(); + glScalef(1200,3000,1); + glColor4f(0,0.1,.1,0.8); + draw_quad(); + glColor4f(1,1,1,1); + glPopMatrix(); + glEnable(GL_DEPTH_TEST); glPopMatrix(); } Vector **stage1_bg_pos(Vector p, float maxrange) { Vector q = {0,0,0}; - Vector r = {0,3000,0}; - return linear3dpos(p, maxrange, q, r); + return single3dpos(p, INFINITY, q); } void stage1_smoke_draw(Vector pos) { @@ -93,7 +88,7 @@ void stage1_smoke_draw(Vector pos) { glScalef(3.5,2,1); glRotatef(global.frames,0,0,1); - glColor4f(.2,.2,.2,((d-500)*(d-500))/1.5e6); + glColor4f(.8,.8,.8,((d-500)*(d-500))/1.5e7); draw_texture(0,0,"stage1/fog"); glColor4f(1,1,1,1); @@ -113,10 +108,11 @@ void stage1_fog(int fbonum) { glUseProgram(shader->prog); glUniform1i(uniloc(shader, "tex"), 0); glUniform1i(uniloc(shader, "depth"), 1); - glUniform4f(uniloc(shader, "fog_color"),0.1, 0.1, 0.1, 1.0); + glUniform4f(uniloc(shader, "fog_color"),0.8, 0.8, 0.8, 1.0); glUniform1f(uniloc(shader, "start"),0.0); - glUniform1f(uniloc(shader, "end"),0.4); + glUniform1f(uniloc(shader, "end"),.8); glUniform1f(uniloc(shader, "exponent"),3.0); + glUniform1f(uniloc(shader, "sphereness"),.2); glActiveTexture(GL_TEXTURE0 + 1); glBindTexture(GL_TEXTURE_2D, resources.fbg[fbonum].depth); glActiveTexture(GL_TEXTURE0); @@ -131,627 +127,38 @@ void stage1_draw(void) { draw_stage3d(&bgcontext, 7000); } - -void cirno_intro(Boss *c, int time) { - - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.035); -} - -void cirno_icy(Boss *c, int time) { - int t = time % 280; - TIMER(&t); - - if(time < 0) - return; - - FROM_TO(0, 200, 5-global.diff) { - tsrand_fill(6); - create_projectile2c("crystal", VIEWPORT_W/2.0 + 10*_i*(0.5-afrand(0)) + cimag(c->pos)*I, rgb(0.2,0.5,0.4+0.5*afrand(1)), accelerated, 1.7*cexp(I*_i/10.0)*(1-2*(_i&1)), 0.0001*I*_i + (0.0025 - global.diff*0.005*afrand(2))); - create_projectile2c("crystal", VIEWPORT_W/2.0 + 10*_i*(0.5-afrand(3)) + cimag(c->pos)*I, rgb(0.2,0.5,0.4+0.5*afrand(4)), accelerated, 1.7*cexp(I*_i/10.0)*(1-2*(_i&1)), 0.0001*I*_i + (0.0025 - global.diff*0.005*afrand(5))); - } -} - - -int cirno_pfreeze_frogs(Projectile *p, int t) { - if(t == EVENT_DEATH) - free_ref(p->args[1]); - if(t < 0) - return 1; - - Boss *parent = REF(p->args[1]); - - if(parent == NULL) - return ACTION_DESTROY; - - int boss_t = (global.frames - parent->current->starttime) % 320; - - if(boss_t < 110) - linear(p, t); - else if(boss_t == 110) { - p->clr = rgb(0.7,0.7,0.7); - } - - if(t == 240) { - p->pos0 = p->pos; - p->args[0] = (1.8+0.2*global.diff)*cexp(I*2*M_PI*frand()); - } - - if(t > 240) - linear(p, t-240); - - return 1; -} - -void cirno_perfect_freeze(Boss *c, int time) { - int t = time % 320; - TIMER(&t); - - if(time < 0) - return; - - FROM_TO(-40, 0, 1) - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.04); - - FROM_TO(20,80,1) { - float r = frand(); - float g = frand(); - float b = frand(); - - int i; - int n = global.diff; - for(i = 0; i < n; i++) - create_projectile2c("ball", c->pos, rgb(r, g, b), cirno_pfreeze_frogs, 4*cexp(I*tsrand()), add_ref(global.boss)); - } - - GO_AT(c, 160, 190, 2 + 1.0*I); - - FROM_TO(160, 220, 6-global.diff) { - create_projectile2c("rice", c->pos + 60, rgb(0.3, 0.4, 0.9), asymptotic, (2.5+0.5*global.diff)*cexp(I*(carg(global.plr.pos - c->pos) + 0.5*nfrand())), 2.5); - create_projectile2c("rice", c->pos - 60, rgb(0.3, 0.4, 0.9), asymptotic, (2.5+0.5*global.diff)*cexp(I*(carg(global.plr.pos - c->pos) + 0.5*nfrand())), 2.5); - } - - GO_AT(c, 190, 220, -2); - - FROM_TO(280, 320, 1) - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.04); -} - -void cirno_pfreeze_bg(Boss *c, int time) { - glColor4f(0.5,0.5,0.5,1); - fill_screen(time/700.0, time/700.0, 1, "stage1/cirnobg"); - glColor4f(0.7,0.7,0.7,0.5); - glBlendFunc(GL_ZERO, GL_SRC_COLOR); - fill_screen(-time/700.0 + 0.5, time/700.0+0.5, 0.4, "stage1/cirnobg"); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - fill_screen(0, -time/100.0, 0, "stage1/snowlayer"); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +void stage1_reed_draw(Vector pos) { + float d = -55+50*sin(pos[1]/25.0); + glPushMatrix(); + glTranslatef(pos[0]+200*sin(pos[1]), pos[1], d); + glRotatef(90,1,0,0); +//glRotatef(90,0,0,1); + glScalef(80,80,80); + glColor4f(0.,0.05,0.05,1); + + draw_model("reeds"); + glTranslatef(0,-d/80,0); + glScalef(1,-1,1); + glTranslatef(0,d/80,0); + glDepthFunc(GL_GREATER); + glDepthMask(GL_FALSE); + glColor4f(0.,0.05,0.05,0.5); + draw_model("reeds"); + glDepthMask(GL_TRUE); + glDepthFunc(GL_LEQUAL); glColor4f(1,1,1,1); -} - -Boss *create_cirno_mid(void) { - Boss* cirno = create_boss("Cirno", "cirno", VIEWPORT_W + 220 + 30.0*I); - boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro, NULL); - boss_add_attack(cirno, AT_Normal, "Icy Storm", 20, 20000, cirno_icy, NULL); - boss_add_attack_from_info(cirno, stage1_spells+0, false); - - start_attack(cirno, cirno->attacks); - return cirno; -} - -void cirno_intro_boss(Boss *c, int time) { - if(time < 0) - return; - TIMER(&time); - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.035); - - AT(100) - global.dialog = stage1_dialog(); -} - -void cirno_iceplosion0(Boss *c, int time) { - int t = time % 350; - TIMER(&t); - - if(time < 0) - return; - - FROM_TO(20,30,2) { - int i; - int n = 8+global.diff; - for(i = 0; i < n; i++) { - create_projectile2c("plainball", c->pos, rgb(0,0,0.5), asymptotic, (3+_i/3.0)*cexp(I*(2*M_PI/n*i + carg(global.plr.pos-c->pos))), _i*0.7); - } - } - - FROM_TO(40,100,1) { - create_projectile2c("crystal", c->pos, rgb(0.3,0.3,0.8), accelerated, 2*cexp(2.0*I*M_PI*frand()) + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); - } - - FROM_TO(150, 300, 30-5*global.diff) { - float dif = M_PI*2*frand(); - int i; - for(i = 0; i < 20; i++) { - create_projectile2c("plainball", c->pos, rgb(0.04*_i,0.04*_i,0.4+0.04*_i), asymptotic, (3+_i/4.0)*cexp(I*(2*M_PI/8.0*i + dif)), 2.5); - } - } -} - -void cirno_crystal_rain(Boss *c, int time) { - int t = time % 500; - TIMER(&t); - - if(time < 0) - return; - - if(frand() > 0.9-0.1*global.diff) { - tsrand_fill(2); - create_projectile2c("crystal", VIEWPORT_W*afrand(0), rgb(0.2,0.2,0.4), accelerated, 1.0*I, 0.01*I + (0.01+0.003*global.diff)*anfrand(1)); - } - - FROM_TO(100, 400, 120-20*global.diff) { - float i; - float n = global.diff/2.0; - for(i = -n; i <= n; i++) - create_projectile2c("bigball", c->pos, rgb(0.2,0.2,0.9), asymptotic, 2*cexp(I*carg(global.plr.pos-c->pos)+0.3*I*i), 2.3); - } - - GO_AT(c, 20, 70, 1+0.6*I); - GO_AT(c, 120, 170, -1+0.2*I); - GO_AT(c, 230, 300, -1+0.6*I); - - FROM_TO(400, 500, 1) - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.01); -} - -void cirno_iceplosion1(Boss *c, int time) { - int t = time % 360; - TIMER(&t); - - if(time < 0) - GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.02); - - FROM_TO(20,30,2) { - int i; - for(i = 0; i < 15+global.diff; i++) { - create_projectile2c("plainball", c->pos, rgb(0,0,0.5), asymptotic, (3+_i/3.0)*cexp(I*((2)*M_PI/8.0*i + (0.1+0.03*global.diff)*(1 - 2*frand()))), _i*0.7); - } - } - - FROM_TO(40,100,2) { - create_projectile2c("crystal", c->pos + 100, rgb(0.3,0.3,0.8), accelerated, 1.5*cexp(2.0*I*M_PI*frand()) - 0.4 + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); - create_projectile2c("crystal", c->pos - 100, rgb(0.3,0.3,0.8), accelerated, 1.5*cexp(2.0*I*M_PI*frand()) + 0.4 + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); - } - - FROM_TO(150, 300, 30) { - float dif = M_PI*2*frand(); - int i; - for(i = 0; i < 20; i++) { - create_projectile2c("plainball", c->pos, rgb(0.04*_i,0.04*_i,0.4+0.04*_i), asymptotic, (3+_i/3.0)*cexp(I*(2*M_PI/8.0*i + dif)), 2.5); - } - } -} - -int cirno_icicles(Projectile *p, int t) { - int turn = 60; - - if(t < 0) - return 1; - - if(t < turn) { - p->pos += p->args[0]*pow(0.9,t); - } else if(t == turn) { - p->args[0] = 2.5*cexp(I*(carg(p->args[0])-M_PI/2.0+M_PI*(creal(p->args[0]) > 0))); - } else if(t > turn) { - p->pos += p->args[0]; - } - - p->angle = carg(p->args[0]); - - return 1; -} - -void cirno_icicle_fall(Boss *c, int time) { - int t = time % 400; - TIMER(&t); - - if(time < 0) - return; - - GO_TO(c, VIEWPORT_W/2.0+120.0*I, 0.01); - - FROM_TO(20,200,30) { - int i; - for(i = 2; i < 5; i++) { - create_projectile1c("crystal", c->pos, rgb(0.3,0.3,0.9), cirno_icicles, 6*i*cexp(I*(-0.1+0.1*_i))); - create_projectile1c("crystal", c->pos, rgb(0.3,0.3,0.9), cirno_icicles, 6*i*cexp(I*(M_PI+0.1-0.1*_i))); - } - } -} - -int cirno_crystal_blizzard_proj(Projectile *p, int time) { - if(!(time % 7)) - create_particle1c("stain", p->pos, 0, GrowFadeAdd, timeout, 20)->angle = global.frames * 15; - - if(time > 100 + global.diff * 100) - p->args[0] *= 1.03; - - return asymptotic(p, time); -} - -void cirno_crystal_blizzard(Boss *c, int time) { - int t = time % 700; - TIMER(&t); - - if(time < 0) { - GO_TO(c, VIEWPORT_W/2.0+300*I, 0.1); - return; - } - - FROM_TO(60, 360, 10) { - int i, cnt = 14 + global.diff * 3; - for(i = 0; i < cnt; ++i) { - create_projectile2c("crystal", i*VIEWPORT_W/cnt, i % 2? rgb(0.2,0.2,0.4) : rgb(0.5,0.5,0.5), accelerated, 0, 0.02*I + 0.01*I * (i % 2? 1 : -1) * sin((i*3+global.frames)/30.0)); - } - } - - FROM_TO(330, 700, 1) { - GO_TO(c, global.plr.pos, 0.01); - - if(!(time % (1 + D_Lunatic - global.diff))) { - tsrand_fill(2); - create_projectile2c("wave", c->pos, rgb(0.2, 0.2, 0.4), cirno_crystal_blizzard_proj, - 20 * (0.1 + 0.1 * anfrand(0)) * cexp(I*(carg(global.plr.pos - c->pos) + anfrand(1) * 0.2)), 5 - )->draw = ProjDrawAdd; - } - - if(!(time % 7)) { - int i, cnt = global.diff - 1; - for(i = 0; i < cnt; ++i) - create_projectile2c("ball", c->pos, rgb(0.1, 0.1, 0.5), accelerated, 0, 0.01 * cexp(I*(global.frames/20.0 + 2*i*M_PI/cnt)))->draw = ProjDrawAdd; - } - } -} - -void cirno_superhardspellcard(Boss *c, int t) { - // HOWTO: create a super hard spellcard in a few seconds - - cirno_iceplosion0(c, t); - cirno_iceplosion1(c, t); - cirno_crystal_rain(c, t); - cirno_icicle_fall(c, t); - cirno_icy(c, t); - cirno_perfect_freeze(c, t); -} - -Boss *create_cirno(void) { - Boss* cirno = create_boss("Cirno", "cirno", -230 + 100.0*I); - - boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro_boss, NULL); - boss_add_attack(cirno, AT_Normal, "Iceplosion 0", 20, 20000, cirno_iceplosion0, NULL); - boss_add_attack_from_info(cirno, stage1_spells+1, false); - boss_add_attack(cirno, AT_Normal, "Iceplosion 1", 20, 20000, cirno_iceplosion1, NULL); - boss_add_attack_from_info(cirno, stage1_spells+2, false); - - start_attack(cirno, cirno->attacks); - return cirno; -} - -int stage1_burst(Enemy *e, int time) { - TIMER(&time); - AT(EVENT_DEATH) { - spawn_items(e->pos, 3,0,0,0); - return 1; - } - - FROM_TO(0, 60, 1) - e->pos += 2.0*I; - - AT(60) { - int i = 0; - int n = global.diff+1; - - for(i = -n; i <= n; i++) { - create_projectile2c("crystal", e->pos, rgb(0.2, 0.3, 0.5), asymptotic, (2+0.1*global.diff)*cexp(I*(carg(global.plr.pos - e->pos) + 0.2*i)), 5); - } - - e->moving = true; - e->dir = creal(e->args[0]) < 0; - - e->pos0 = e->pos; - } - - - FROM_TO(70, 900, 1) - e->pos = e->pos0 + (0.04*e->args[0])*_i*_i; - - return 1; -} - -int stage1_circletoss(Enemy *e, int time) { - TIMER(&time); - AT(EVENT_DEATH) { - spawn_items(e->pos, 2,2,0,0); - return 1; - } - - e->pos += e->args[0]; - - FROM_TO(60,100,2) { - e->args[0] = 0.5*e->args[0]; - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 2*cexp(I*M_PI/10*_i), _i/2.0); - } - - - if(global.diff > D_Easy) { - FROM_TO_INT(90,500,150,15+5*global.diff,1) { - tsrand_fill(2); - create_projectile2c("thickrice", e->pos, rgb(0.2, 0.4, 0.8), asymptotic, (1+afrand(0)*2)*cexp(I*carg(global.plr.pos - e->pos)+0.05*I*global.diff*anfrand(1)), 3); - } - } - - FROM_TO(global.diff > D_Easy ? 500 : 240, 900, 1) - e->args[0] += 0.03*e->args[1] - 0.04*I; - - return 1; -} - -int stage1_sinepass(Enemy *e, int time) { - TIMER(&time); - AT(EVENT_DEATH) { - tsrand_fill(2); - spawn_items(e->pos, afrand(0)>0.5, afrand(1)>0.2,0,0); - return 1; - } - - e->args[1] -= cimag(e->pos-e->pos0)*0.03*I; - e->pos += e->args[1]*0.4 + e->args[0]; - - if(frand() > 0.993-0.002*global.diff) - create_projectile1c("ball", e->pos, rgb(0.8,0.8,0.4), linear, (1+0.2*global.diff+frand())*cexp(I*carg(global.plr.pos - e->pos))); - - return 1; -} - -int stage1_drop(Enemy *e, int t) { - TIMER(&t); - AT(EVENT_DEATH) { - spawn_items(e->pos, 2,1,0,0); - return 1; - } - if(t < 0) - return 1; - - e->pos = e->pos0 + e->args[0]*t + e->args[1]*t*t; - - FROM_TO(10,1000,1) - if(frand() > 0.995-0.006*global.diff) - create_projectile1c("ball", e->pos, rgb(0.8,0.8,0.4), linear, (1+0.3*global.diff+frand())*cexp(I*carg(global.plr.pos - e->pos))); - - return 1; -} - -int stage1_circle(Enemy *e, int t) { - TIMER(&t); - AT(EVENT_DEATH) { - spawn_items(e->pos, 3,4,0,0); - return 1; - } - - FROM_TO(0, 150, 1) - e->pos += (e->args[0] - e->pos)*0.02; - - FROM_TO_INT(150, 550, 40, 40, 2) - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, (2+0.1*global.diff)*cexp(I*M_PI/10*_ni), _ni/2.0); - - FROM_TO(560,1000,1) - e->pos += e->args[1]; - - return 1; -} - -int stage1_multiburst(Enemy *e, int t) { - TIMER(&t); - AT(EVENT_DEATH) { - spawn_items(e->pos, 3,4,0,0); - return 1; - } - - FROM_TO(0, 50, 1) - e->pos += 2.0*I; - - FROM_TO_INT(60, 300, 70, 40, 12-global.diff) { - int i; - int n = 1+global.diff/2; - for(i = -n; i <= n; i++) - create_projectile1c("crystal", e->pos, rgb(0.2, 0.3, 0.5), linear, 2.5*cexp(I*(carg(global.plr.pos - e->pos) + i/5.0))); - } - - FROM_TO(320, 700, 1) { - e->args[1] += 0.03; - e->pos += e->args[0]*e->args[1] + 1.4*I; - } - - return 1; -} - -int stage1_instantcircle(Enemy *e, int t) { - TIMER(&t); - AT(EVENT_DEATH) { - spawn_items(e->pos, 2,4,0,0); - return 1; - } - - FROM_TO(0, 110, 1) { - e->pos += e->args[0]; - } - - int i; - - AT(150) { - for(i = 0; i < 20+2*global.diff; i++) - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 1.5*cexp(I*2*M_PI/(20.0+global.diff)*i), 2.0); - } - - AT(170) { - for(i = 0; i < 20+3*global.diff; i++) - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 3*cexp(I*2*M_PI/(20.0+global.diff)*i), 3.0); - } - - if(t > 200) - e->pos += e->args[1]; - - return 1; -} - -int stage1_tritoss(Enemy *e, int t) { - TIMER(&t); - AT(EVENT_DEATH) { - spawn_items(e->pos, 5,5,0,0); - return 1; - } - - FROM_TO(0, 100, 1) { - e->pos += e->args[0]; - } - - FROM_TO(120, 800,8-global.diff) { - float a = M_PI/30.0*((_i/7)%30)+0.1*nfrand(); - int i; - int n = 3+global.diff/2; - - for(i = 0; i < n; i++) - create_projectile2c("thickrice", e->pos, rgb(0.2, 0.4, 0.8), asymptotic, 2*cexp(I*a+2.0*I*M_PI/n*i), 3); - } - - FROM_TO(480, 800, 300) { - int i, n = 20 + global.diff*2; - for(i = 0; i < n; i++) { - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 1.5*cexp(I*2*M_PI/n*i), 2.0); - create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 3*cexp(I*2*M_PI/n*i), 3.0); - } - } - - if(t > 820) - e->pos += e->args[1]; - - return 1; -} - -void stage1_events(void) { - TIMER(&global.timer); - - AT(0) { - start_bgm("bgm_stage1"); - } - - /* - // graze testing - AT(0) { - create_projectile1c("rice", 0.5*(VIEWPORT_W+VIEWPORT_H*1.3*I), rgb(1, 0.3, 0.3), linear, 0); - create_projectile1c("ball", 0.5*(VIEWPORT_W+VIEWPORT_H*1.5*I), rgb(1, 0.3, 0.3), linear, 0); - create_projectile1c("soul", 0.5*(VIEWPORT_W+VIEWPORT_H*I), rgb(1, 0.3, 0.3), linear, 0); - - int i; - for(i = 0; i < 20; ++i) { - create_projectile1c("crystal", VIEWPORT_W/2+30 + (30+10*i)*I, rgb(0.7, 0.7, 1), linear, 0.01*I); - create_projectile1c("crystal", VIEWPORT_W/2-30 + (30+10*i)*I, rgb(0.7, 0.7, 1), linear, 0.01*I); - } - } - - return; - */ - - // opening. projectile bursts - FROM_TO(100, 160, 25) { - create_enemy1c(VIEWPORT_W/2 + 70, 700, Fairy, stage1_burst, 1 + 0.6*I); - create_enemy1c(VIEWPORT_W/2 - 70, 700, Fairy, stage1_burst, -1 + 0.6*I); - } - - // more bursts. fairies move / \ like - FROM_TO(240, 300, 30) { - create_enemy1c(70 + _i*40, 700, Fairy, stage1_burst, -1 + 0.6*I); - create_enemy1c(VIEWPORT_W - (70 + _i*40), 700, Fairy, stage1_burst, 1 + 0.6*I); - } - - // big fairies, circle + projectile toss - FROM_TO(400, 460, 50) - create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1500, BigFairy, stage1_circletoss, 2-4*_i-0.3*I, 1-2*_i); - - - // swirl, sine pass - FROM_TO(380, 1000, 20) { - tsrand_fill(2); - create_enemy2c(VIEWPORT_W*(_i&1) + afrand(0)*100.0*I + 70.0*I, 100, Swirl, stage1_sinepass, 3.5*(1-2*(_i&1)), afrand(1)*7.0*I); - } - - // swirl, drops - FROM_TO(1100, 1600, 20) - create_enemy2c(VIEWPORT_W/3, 100, Swirl, stage1_drop, 4.0*I, 0.06); - - FROM_TO(1500, 2000, 20) - create_enemy2c(VIEWPORT_W+200.0*I, 100, Swirl, stage1_drop, -2, -0.04-0.03*I); - - // bursts - FROM_TO(1250, 1800, 60) { - tsrand_fill(2); - create_enemy1c(VIEWPORT_W/2 + afrand(0)*500-250, 500, Fairy, stage1_burst, afrand(1)*2-1); - } - - // circle - multi burst combo - FROM_TO(1700, 2300, 300) { - tsrand_fill(3); - create_enemy2c(VIEWPORT_W/2, 1400, BigFairy, stage1_circle, VIEWPORT_W/4 + VIEWPORT_W/2*afrand(0)+200.0*I, 3-6*(afrand(1)>0.5)+afrand(2)*2.0*I); - } - - FROM_TO(2000, 2500, 200) { - int i, t = global.diff + 1; - for(i = 0; i < t; i++) - create_enemy1c(VIEWPORT_W/2 - 40*t + 80*i, 1000, Fairy, stage1_multiburst, i - 2.5); - } - - AT(2700) - global.boss = create_cirno_mid(); - - // some chaotic swirls + instant circle combo - FROM_TO(2760, 3800, 20) { - tsrand_fill(2); - create_enemy2c(VIEWPORT_W/2 - 200*anfrand(0), 250+40*global.diff, Swirl, stage1_drop, 1.0*I, 0.001*I + 0.02 + 0.06*anfrand(1)); - } - - FROM_TO(2900, 3750, 190-30*global.diff) { - tsrand_fill(2); - create_enemy2c(VIEWPORT_W*afrand(0), 1200, Fairy, stage1_instantcircle, 2.0*I, 3.0 - 6*afrand(1) - 1.0*I); - } - - - // multiburst + normal circletoss, later tri-toss - FROM_TO(3900, 4800, 200) { - tsrand_fill(2); - create_enemy1c(VIEWPORT_W*afrand(0), 1000, Fairy, stage1_multiburst, 2.5*afrand(1)); - } - - FROM_TO(4000, 4100, 20) - create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1700, Fairy, stage1_circletoss, 2-4*_i-0.3*I, 1-2*_i); - - AT(4200) - create_enemy2c(VIEWPORT_W/2.0, 4000, BigFairy, stage1_tritoss, 2.0*I, -2.6*I); - - AT(5000) - global.boss = create_cirno(); - - AT(5200 - FADE_TIME) { - stage_finish(GAMEOVER_WIN); - } + glPopMatrix(); } void stage1_start(void) { init_stage3d(&bgcontext); add_model(&bgcontext, stage1_bg_draw, stage1_bg_pos); add_model(&bgcontext, stage1_smoke_draw, stage1_smoke_pos); + add_model(&bgcontext, stage1_reed_draw, stage1_smoke_pos); bgcontext.crot[0] = 60; bgcontext.cx[2] = 700; - bgcontext.cv[1] = 7; + bgcontext.cv[1] = 4; } void stage1_end(void) { diff --git a/src/stages/stage1_events.c b/src/stages/stage1_events.c new file mode 100644 index 00000000..9db5177a --- /dev/null +++ b/src/stages/stage1_events.c @@ -0,0 +1,645 @@ +#include "stage1_events.h" +#include "global.h" + +Dialog *stage1_dialog(void) { + Dialog *d = create_dialog(global.plr.cha == Marisa ? "dialog/marisa" : "dialog/youmu", "dialog/cirno"); + + dadd_msg(d, Right, "Hey! Who’s there?"); + + if(global.plr.cha == Marisa) + dadd_msg(d, Left, "It’s me!"); + else + dadd_msg(d, Left, "Just someone?"); + + dadd_msg(d, Right, "How dare you pass the lake of the fairies?!\nIt’s a dangerous place for weak humans!"); + + if(global.plr.cha == Marisa) { + dadd_msg(d, Left, "You call me weak?"); + dadd_msg(d, Right, "I do!"); + } else { + dadd_msg(d, Left, "I’m just passing by. Got a problem with that?"); + dadd_msg(d, Right, "Of course! You can’t do that!"); + } + + dadd_msg(d, Right, "I’ll freeze you where you stand!"); + dadd_msg(d, BGM, "bgm_stage1boss"); + + return d; +} + +void cirno_intro(Boss *c, int time) { + + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.035); +} + +void cirno_icy(Boss *c, int time) { + int t = time % 280; + TIMER(&t); + + if(time < 0) + return; + + FROM_TO(0, 200, 5-global.diff) { + tsrand_fill(6); + create_projectile2c("crystal", VIEWPORT_W/2.0 + 10*_i*(0.5-afrand(0)) + cimag(c->pos)*I, rgb(0.2,0.5,0.4+0.5*afrand(1)), accelerated, 1.7*cexp(I*_i/10.0)*(1-2*(_i&1)), 0.0001*I*_i + (0.0025 - global.diff*0.005*afrand(2))); + create_projectile2c("crystal", VIEWPORT_W/2.0 + 10*_i*(0.5-afrand(3)) + cimag(c->pos)*I, rgb(0.2,0.5,0.4+0.5*afrand(4)), accelerated, 1.7*cexp(I*_i/10.0)*(1-2*(_i&1)), 0.0001*I*_i + (0.0025 - global.diff*0.005*afrand(5))); + } +} + + +int cirno_pfreeze_frogs(Projectile *p, int t) { + if(t == EVENT_DEATH) + free_ref(p->args[1]); + if(t < 0) + return 1; + + Boss *parent = REF(p->args[1]); + + if(parent == NULL) + return ACTION_DESTROY; + + int boss_t = (global.frames - parent->current->starttime) % 320; + + if(boss_t < 110) + linear(p, t); + else if(boss_t == 110) { + p->clr = rgb(0.7,0.7,0.7); + } + + if(t == 240) { + p->pos0 = p->pos; + p->args[0] = (1.8+0.2*global.diff)*cexp(I*2*M_PI*frand()); + } + + if(t > 240) + linear(p, t-240); + + return 1; +} + +void cirno_perfect_freeze(Boss *c, int time) { + int t = time % 320; + TIMER(&t); + + if(time < 0) + return; + + FROM_TO(-40, 0, 1) + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.04); + + FROM_TO(20,80,1) { + float r = frand(); + float g = frand(); + float b = frand(); + + int i; + int n = global.diff; + for(i = 0; i < n; i++) + create_projectile2c("ball", c->pos, rgb(r, g, b), cirno_pfreeze_frogs, 4*cexp(I*tsrand()), add_ref(global.boss)); + } + + GO_AT(c, 160, 190, 2 + 1.0*I); + + FROM_TO(160, 220, 6-global.diff) { + create_projectile2c("rice", c->pos + 60, rgb(0.3, 0.4, 0.9), asymptotic, (2.5+0.5*global.diff)*cexp(I*(carg(global.plr.pos - c->pos) + 0.5*nfrand())), 2.5); + create_projectile2c("rice", c->pos - 60, rgb(0.3, 0.4, 0.9), asymptotic, (2.5+0.5*global.diff)*cexp(I*(carg(global.plr.pos - c->pos) + 0.5*nfrand())), 2.5); + } + + GO_AT(c, 190, 220, -2); + + FROM_TO(280, 320, 1) + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.04); +} + +void cirno_pfreeze_bg(Boss *c, int time) { + glColor4f(0.5,0.5,0.5,1); + fill_screen(time/700.0, time/700.0, 1, "stage1/cirnobg"); + glColor4f(0.7,0.7,0.7,0.5); + glBlendFunc(GL_ZERO, GL_SRC_COLOR); + fill_screen(-time/700.0 + 0.5, time/700.0+0.5, 0.4, "stage1/cirnobg"); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + fill_screen(0, -time/100.0, 0, "stage1/snowlayer"); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(1,1,1,1); +} + +Boss *create_cirno_mid(void) { + Boss* cirno = create_boss("Cirno", "cirno", VIEWPORT_W + 220 + 30.0*I); + boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro, NULL); + boss_add_attack(cirno, AT_Normal, "Icy Storm", 20, 20000, cirno_icy, NULL); + boss_add_attack_from_info(cirno, stage1_spells+0, false); + + start_attack(cirno, cirno->attacks); + return cirno; +} + +void cirno_intro_boss(Boss *c, int time) { + if(time < 0) + return; + TIMER(&time); + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.035); + + AT(100) + global.dialog = stage1_dialog(); +} + +void cirno_iceplosion0(Boss *c, int time) { + int t = time % 350; + TIMER(&t); + + if(time < 0) + return; + + FROM_TO(20,30,2) { + int i; + int n = 8+global.diff; + for(i = 0; i < n; i++) { + create_projectile2c("plainball", c->pos, rgb(0,0,0.5), asymptotic, (3+_i/3.0)*cexp(I*(2*M_PI/n*i + carg(global.plr.pos-c->pos))), _i*0.7); + } + } + + FROM_TO(40,100,1) { + create_projectile2c("crystal", c->pos, rgb(0.3,0.3,0.8), accelerated, 2*cexp(2.0*I*M_PI*frand()) + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); + } + + FROM_TO(150, 300, 30-5*global.diff) { + float dif = M_PI*2*frand(); + int i; + for(i = 0; i < 20; i++) { + create_projectile2c("plainball", c->pos, rgb(0.04*_i,0.04*_i,0.4+0.04*_i), asymptotic, (3+_i/4.0)*cexp(I*(2*M_PI/8.0*i + dif)), 2.5); + } + } +} + +void cirno_crystal_rain(Boss *c, int time) { + int t = time % 500; + TIMER(&t); + + if(time < 0) + return; + + if(frand() > 0.9-0.1*global.diff) { + tsrand_fill(2); + create_projectile2c("crystal", VIEWPORT_W*afrand(0), rgb(0.2,0.2,0.4), accelerated, 1.0*I, 0.01*I + (0.01+0.003*global.diff)*anfrand(1)); + } + + FROM_TO(100, 400, 120-20*global.diff) { + float i; + float n = global.diff/2.0; + for(i = -n; i <= n; i++) + create_projectile2c("bigball", c->pos, rgb(0.2,0.2,0.9), asymptotic, 2*cexp(I*carg(global.plr.pos-c->pos)+0.3*I*i), 2.3); + } + + GO_AT(c, 20, 70, 1+0.6*I); + GO_AT(c, 120, 170, -1+0.2*I); + GO_AT(c, 230, 300, -1+0.6*I); + + FROM_TO(400, 500, 1) + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.01); +} + +void cirno_iceplosion1(Boss *c, int time) { + int t = time % 360; + TIMER(&t); + + if(time < 0) + GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.02); + + FROM_TO(20,30,2) { + int i; + for(i = 0; i < 15+global.diff; i++) { + create_projectile2c("plainball", c->pos, rgb(0,0,0.5), asymptotic, (3+_i/3.0)*cexp(I*((2)*M_PI/8.0*i + (0.1+0.03*global.diff)*(1 - 2*frand()))), _i*0.7); + } + } + + FROM_TO(40,100,2) { + create_projectile2c("crystal", c->pos + 100, rgb(0.3,0.3,0.8), accelerated, 1.5*cexp(2.0*I*M_PI*frand()) - 0.4 + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); + create_projectile2c("crystal", c->pos - 100, rgb(0.3,0.3,0.8), accelerated, 1.5*cexp(2.0*I*M_PI*frand()) + 0.4 + 2.0*I, 0.002*cexp(I*(M_PI/10.0*(_i%20)))); + } + + FROM_TO(150, 300, 30) { + float dif = M_PI*2*frand(); + int i; + for(i = 0; i < 20; i++) { + create_projectile2c("plainball", c->pos, rgb(0.04*_i,0.04*_i,0.4+0.04*_i), asymptotic, (3+_i/3.0)*cexp(I*(2*M_PI/8.0*i + dif)), 2.5); + } + } +} + +int cirno_icicles(Projectile *p, int t) { + int turn = 60; + + if(t < 0) + return 1; + + if(t < turn) { + p->pos += p->args[0]*pow(0.9,t); + } else if(t == turn) { + p->args[0] = 2.5*cexp(I*(carg(p->args[0])-M_PI/2.0+M_PI*(creal(p->args[0]) > 0))); + if(global.diff > D_Normal) + p->args[0] += 0.05*nfrand(); + } else if(t > turn) { + p->pos += p->args[0]; + } + + p->angle = carg(p->args[0]); + + return 1; +} + +void cirno_icicle_fall(Boss *c, int time) { + int t = time % 400; + TIMER(&t); + + if(time < 0) + return; + + GO_TO(c, VIEWPORT_W/2.0+120.0*I, 0.01); + + FROM_TO(20,200,30-3*global.diff) { + for(float i = 2-0.2*global.diff; i < 5; i+=1./(1+global.diff)) { + create_projectile1c("crystal", c->pos, rgb(0.3,0.3,0.9), cirno_icicles, 6*i*cexp(I*(-0.1+0.1*_i))); + create_projectile1c("crystal", c->pos, rgb(0.3,0.3,0.9), cirno_icicles, 6*i*cexp(I*(M_PI+0.1-0.1*_i))); + } + } + + if(global.diff > D_Easy) { + FROM_TO(120,200,3) { + float f = frand()*_i; + + create_projectile2c("ball", c->pos, rgb(0.,0.,0.3), accelerated, 0.2*(-2*I-1.5+f),-0.02*I); + create_projectile2c("ball", c->pos, rgb(0.,0.,0.3), accelerated, 0.2*(-2*I+1.5-f),-0.02*I); + } + } + if(global.diff > D_Normal) { + FROM_TO(300,400,10) { + float x = VIEWPORT_W/2+VIEWPORT_W/2*(0.3+_i/10.); + float angle1 = M_PI/10*frand(); + float angle2 = M_PI/10*frand(); + for(float i = 1; i < 5; i++) { + create_projectile2c("ball", x, rgb(0.,0.,0.3), accelerated, i*I*0.5*cexp(I*angle1),0.001*I-(global.diff == D_Lunatic)*0.001*frand()); + create_projectile2c("ball", VIEWPORT_W-x, rgb(0.,0.,0.3), accelerated, i*I*0.5*cexp(-I*angle2),0.001*I+(global.diff == D_Lunatic)*0.001*frand()); + } + } + } + + +} + +int cirno_crystal_blizzard_proj(Projectile *p, int time) { + if(!(time % 7)) + create_particle1c("stain", p->pos, 0, GrowFadeAdd, timeout, 20)->angle = global.frames * 15; + + if(time > 100 + global.diff * 100) + p->args[0] *= 1.03; + + return asymptotic(p, time); +} + +void cirno_crystal_blizzard(Boss *c, int time) { + int t = time % 700; + TIMER(&t); + + if(time < 0) { + GO_TO(c, VIEWPORT_W/2.0+300*I, 0.1); + return; + } + + FROM_TO(60, 360, 10) { + int i, cnt = 14 + global.diff * 3; + for(i = 0; i < cnt; ++i) { + create_projectile2c("crystal", i*VIEWPORT_W/cnt, i % 2? rgb(0.2,0.2,0.4) : rgb(0.5,0.5,0.5), accelerated, 0, 0.02*I + 0.01*I * (i % 2? 1 : -1) * sin((i*3+global.frames)/30.0)); + } + } + + FROM_TO(330, 700, 1) { + GO_TO(c, global.plr.pos, 0.01); + + if(!(time % (1 + D_Lunatic - global.diff))) { + tsrand_fill(2); + create_projectile2c("wave", c->pos, rgb(0.2, 0.2, 0.4), cirno_crystal_blizzard_proj, + 20 * (0.1 + 0.1 * anfrand(0)) * cexp(I*(carg(global.plr.pos - c->pos) + anfrand(1) * 0.2)), 5 + )->draw = ProjDrawAdd; + } + + if(!(time % 7)) { + int i, cnt = global.diff - 1; + for(i = 0; i < cnt; ++i) + create_projectile2c("ball", c->pos, rgb(0.1, 0.1, 0.5), accelerated, 0, 0.01 * cexp(I*(global.frames/20.0 + 2*i*M_PI/cnt)))->draw = ProjDrawAdd; + } + } +} + +void cirno_superhardspellcard(Boss *c, int t) { + // HOWTO: create a super hard spellcard in a few seconds + + cirno_iceplosion0(c, t); + cirno_iceplosion1(c, t); + cirno_crystal_rain(c, t); + cirno_icicle_fall(c, t); + cirno_icy(c, t); + cirno_perfect_freeze(c, t); +} + +Boss *create_cirno(void) { + Boss* cirno = create_boss("Cirno", "cirno", -230 + 100.0*I); + boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro_boss, NULL); + boss_add_attack(cirno, AT_Normal, "Iceplosion 0", 20, 20000, cirno_iceplosion0, NULL); + boss_add_attack_from_info(cirno, stage1_spells+1, false); + boss_add_attack(cirno, AT_Normal, "Iceplosion 1", 20, 20000, cirno_iceplosion1, NULL); + boss_add_attack_from_info(cirno, stage1_spells+2, false); + + start_attack(cirno, cirno->attacks); + return cirno; +} + +int stage1_burst(Enemy *e, int time) { + TIMER(&time); + AT(EVENT_DEATH) { + spawn_items(e->pos, 3,0,0,0); + return 1; + } + + FROM_TO(0, 60, 1) + e->pos += 2.0*I; + + AT(60) { + int i = 0; + int n = global.diff+1; + + for(i = -n; i <= n; i++) { + create_projectile2c("crystal", e->pos, rgb(0.2, 0.3, 0.5), asymptotic, (2+0.1*global.diff)*cexp(I*(carg(global.plr.pos - e->pos) + 0.2*i)), 5); + } + + e->moving = true; + e->dir = creal(e->args[0]) < 0; + + e->pos0 = e->pos; + } + + + FROM_TO(70, 900, 1) + e->pos = e->pos0 + (0.04*e->args[0])*_i*_i; + + return 1; +} + +int stage1_circletoss(Enemy *e, int time) { + TIMER(&time); + AT(EVENT_DEATH) { + spawn_items(e->pos, 2,2,0,0); + return 1; + } + + e->pos += e->args[0]; + + FROM_TO(60,100,2) { + e->args[0] = 0.5*e->args[0]; + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 2*cexp(I*M_PI/10*_i), _i/2.0); + } + + + if(global.diff > D_Easy) { + FROM_TO_INT(90,500,150,15+5*global.diff,1) { + tsrand_fill(2); + create_projectile2c("thickrice", e->pos, rgb(0.2, 0.4, 0.8), asymptotic, (1+afrand(0)*2)*cexp(I*carg(global.plr.pos - e->pos)+0.05*I*global.diff*anfrand(1)), 3); + } + } + + FROM_TO(global.diff > D_Easy ? 500 : 240, 900, 1) + e->args[0] += 0.03*e->args[1] - 0.04*I; + + return 1; +} + +int stage1_sinepass(Enemy *e, int time) { + TIMER(&time); + AT(EVENT_DEATH) { + tsrand_fill(2); + spawn_items(e->pos, afrand(0)>0.5, afrand(1)>0.2,0,0); + return 1; + } + + e->args[1] -= cimag(e->pos-e->pos0)*0.03*I; + e->pos += e->args[1]*0.4 + e->args[0]; + + if(frand() > 0.993-0.002*global.diff) + create_projectile1c("ball", e->pos, rgb(0.8,0.8,0.4), linear, (1+0.2*global.diff+frand())*cexp(I*carg(global.plr.pos - e->pos))); + + return 1; +} + +int stage1_drop(Enemy *e, int t) { + TIMER(&t); + AT(EVENT_DEATH) { + spawn_items(e->pos, 2,1,0,0); + return 1; + } + if(t < 0) + return 1; + + e->pos = e->pos0 + e->args[0]*t + e->args[1]*t*t; + + FROM_TO(10,1000,1) + if(frand() > 0.995-0.006*global.diff) + create_projectile1c("ball", e->pos, rgb(0.8,0.8,0.4), linear, (1+0.3*global.diff+frand())*cexp(I*carg(global.plr.pos - e->pos))); + + return 1; +} + +int stage1_circle(Enemy *e, int t) { + TIMER(&t); + AT(EVENT_DEATH) { + spawn_items(e->pos, 3,4,0,0); + return 1; + } + + FROM_TO(0, 150, 1) + e->pos += (e->args[0] - e->pos)*0.02; + + FROM_TO_INT(150, 550, 40, 40, 2) + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, (2+0.1*global.diff)*cexp(I*M_PI/10*_ni), _ni/2.0); + + FROM_TO(560,1000,1) + e->pos += e->args[1]; + + return 1; +} + +int stage1_multiburst(Enemy *e, int t) { + TIMER(&t); + AT(EVENT_DEATH) { + spawn_items(e->pos, 3,4,0,0); + return 1; + } + + FROM_TO(0, 50, 1) + e->pos += 2.0*I; + + FROM_TO_INT(60, 300, 70, 40, 12-global.diff) { + int i; + int n = 1+global.diff/2; + for(i = -n; i <= n; i++) + create_projectile1c("crystal", e->pos, rgb(0.2, 0.3, 0.5), linear, 2.5*cexp(I*(carg(global.plr.pos - e->pos) + i/5.0))); + } + + FROM_TO(320, 700, 1) { + e->args[1] += 0.03; + e->pos += e->args[0]*e->args[1] + 1.4*I; + } + + return 1; +} + +int stage1_instantcircle(Enemy *e, int t) { + TIMER(&t); + AT(EVENT_DEATH) { + spawn_items(e->pos, 2,4,0,0); + return 1; + } + + FROM_TO(0, 110, 1) { + e->pos += e->args[0]; + } + + int i; + + AT(150) { + for(i = 0; i < 20+2*global.diff; i++) + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 1.5*cexp(I*2*M_PI/(20.0+global.diff)*i), 2.0); + } + + AT(170) { + for(i = 0; i < 20+3*global.diff; i++) + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 3*cexp(I*2*M_PI/(20.0+global.diff)*i), 3.0); + } + + if(t > 200) + e->pos += e->args[1]; + + return 1; +} + +int stage1_tritoss(Enemy *e, int t) { + TIMER(&t); + AT(EVENT_DEATH) { + spawn_items(e->pos, 5,5,0,0); + return 1; + } + + FROM_TO(0, 100, 1) { + e->pos += e->args[0]; + } + + FROM_TO(120, 800,8-global.diff) { + float a = M_PI/30.0*((_i/7)%30)+0.1*nfrand(); + int i; + int n = 3+global.diff/2; + + for(i = 0; i < n; i++) + create_projectile2c("thickrice", e->pos, rgb(0.2, 0.4, 0.8), asymptotic, 2*cexp(I*a+2.0*I*M_PI/n*i), 3); + } + + FROM_TO(480, 800, 300) { + int i, n = 20 + global.diff*2; + for(i = 0; i < n; i++) { + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 1.5*cexp(I*2*M_PI/n*i), 2.0); + create_projectile2c("rice", e->pos, rgb(0.6, 0.2, 0.7), asymptotic, 3*cexp(I*2*M_PI/n*i), 3.0); + } + } + + if(t > 820) + e->pos += e->args[1]; + + return 1; +} + +void stage1_events(void) { + TIMER(&global.timer); + + AT(0) { + start_bgm("bgm_stage1"); + } + + // opening. projectile bursts + FROM_TO(100, 160, 25) { + create_enemy1c(VIEWPORT_W/2 + 70, 700, Fairy, stage1_burst, 1 + 0.6*I); + create_enemy1c(VIEWPORT_W/2 - 70, 700, Fairy, stage1_burst, -1 + 0.6*I); + } + + // more bursts. fairies move / \ like + FROM_TO(240, 300, 30) { + create_enemy1c(70 + _i*40, 700, Fairy, stage1_burst, -1 + 0.6*I); + create_enemy1c(VIEWPORT_W - (70 + _i*40), 700, Fairy, stage1_burst, 1 + 0.6*I); + } + + // big fairies, circle + projectile toss + FROM_TO(400, 460, 50) + create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1500, BigFairy, stage1_circletoss, 2-4*_i-0.3*I, 1-2*_i); + + + // swirl, sine pass + FROM_TO(380, 1000, 20) { + tsrand_fill(2); + create_enemy2c(VIEWPORT_W*(_i&1) + afrand(0)*100.0*I + 70.0*I, 100, Swirl, stage1_sinepass, 3.5*(1-2*(_i&1)), afrand(1)*7.0*I); + } + + // swirl, drops + FROM_TO(1100, 1600, 20) + create_enemy2c(VIEWPORT_W/3, 100, Swirl, stage1_drop, 4.0*I, 0.06); + + FROM_TO(1500, 2000, 20) + create_enemy2c(VIEWPORT_W+200.0*I, 100, Swirl, stage1_drop, -2, -0.04-0.03*I); + + // bursts + FROM_TO(1250, 1800, 60) { + tsrand_fill(2); + create_enemy1c(VIEWPORT_W/2 + afrand(0)*500-250, 500, Fairy, stage1_burst, afrand(1)*2-1); + } + + // circle - multi burst combo + FROM_TO(1700, 2300, 300) { + tsrand_fill(3); + create_enemy2c(VIEWPORT_W/2, 1400, BigFairy, stage1_circle, VIEWPORT_W/4 + VIEWPORT_W/2*afrand(0)+200.0*I, 3-6*(afrand(1)>0.5)+afrand(2)*2.0*I); + } + + FROM_TO(2000, 2500, 200) { + int i, t = global.diff + 1; + for(i = 0; i < t; i++) + create_enemy1c(VIEWPORT_W/2 - 40*t + 80*i, 1000, Fairy, stage1_multiburst, i - 2.5); + } + + AT(2700) + global.boss = create_cirno_mid(); + + // some chaotic swirls + instant circle combo + FROM_TO(2760, 3800, 20) { + tsrand_fill(2); + create_enemy2c(VIEWPORT_W/2 - 200*anfrand(0), 250+40*global.diff, Swirl, stage1_drop, 1.0*I, 0.001*I + 0.02 + 0.06*anfrand(1)); + } + + FROM_TO(2900, 3750, 190-30*global.diff) { + tsrand_fill(2); + create_enemy2c(VIEWPORT_W*afrand(0), 1200, Fairy, stage1_instantcircle, 2.0*I, 3.0 - 6*afrand(1) - 1.0*I); + } + + + // multiburst + normal circletoss, later tri-toss + FROM_TO(3900, 4800, 200) { + tsrand_fill(2); + create_enemy1c(VIEWPORT_W*afrand(0), 1000, Fairy, stage1_multiburst, 2.5*afrand(1)); + } + + FROM_TO(4000, 4100, 20) + create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1700, Fairy, stage1_circletoss, 2-4*_i-0.3*I, 1-2*_i); + + AT(4200) + create_enemy2c(VIEWPORT_W/2.0, 4000, BigFairy, stage1_tritoss, 2.0*I, -2.6*I); + + AT(5000) + global.boss = create_cirno(); + + AT(5200 - FADE_TIME) { + stage_finish(GAMEOVER_WIN); + } +} diff --git a/src/stages/stage1_events.h b/src/stages/stage1_events.h new file mode 100644 index 00000000..e92bd922 --- /dev/null +++ b/src/stages/stage1_events.h @@ -0,0 +1,14 @@ +#ifndef STAGE1_EVENTS +#define STAGE1_EVENTS + +#include "boss.h" + +void cirno_perfect_freeze(Boss*, int); +void cirno_crystal_rain(Boss*, int); +void cirno_icicle_fall(Boss*, int); +void cirno_pfreeze_bg(Boss*, int); +void cirno_crystal_blizzard(Boss*, int); + +void stage1_events(void); + +#endif diff --git a/src/stages/stage2.c b/src/stages/stage2.c index 4cda1797..76844001 100644 --- a/src/stages/stage2.c +++ b/src/stages/stage2.c @@ -109,6 +109,7 @@ void stage2_fog(int fbonum) { glUniform1f(uniloc(shader, "start"),0.2); glUniform1f(uniloc(shader, "end"),0.8); glUniform1f(uniloc(shader, "exponent"),3.0); + glUniform1f(uniloc(shader, "sphereness"),0); glActiveTexture(GL_TEXTURE0 + 2); glBindTexture(GL_TEXTURE_2D, resources.fbg[fbonum].depth); glActiveTexture(GL_TEXTURE0); diff --git a/src/stages/stage3.c b/src/stages/stage3.c index 1b95b147..25f341dc 100644 --- a/src/stages/stage3.c +++ b/src/stages/stage3.c @@ -102,6 +102,7 @@ void stage3_fog(int fbonum) { glUniform1f(uniloc(shader, "start"), 0.2); glUniform1f(uniloc(shader, "end"), 0.8); glUniform1f(uniloc(shader, "exponent"), stgstate.fog_exp + 0.5 * sin(global.frames / 50.0)); + glUniform1f(uniloc(shader, "sphereness"),0); glActiveTexture(GL_TEXTURE0 + 2); glBindTexture(GL_TEXTURE_2D, resources.fbg[fbonum].depth); glActiveTexture(GL_TEXTURE0); diff --git a/src/stages/stage4.c b/src/stages/stage4.c index b2cb85f2..c61897ff 100644 --- a/src/stages/stage4.c +++ b/src/stages/stage4.c @@ -28,6 +28,7 @@ void stage4_fog(int fbonum) { glUniform1f(uniloc(shader, "start"),0.4); glUniform1f(uniloc(shader, "end"),0.8); glUniform1f(uniloc(shader, "exponent"),4.0); + glUniform1f(uniloc(shader, "sphereness"),0); glActiveTexture(GL_TEXTURE0 + 2); glBindTexture(GL_TEXTURE_2D, resources.fbg[fbonum].depth); glActiveTexture(GL_TEXTURE0); diff --git a/src/taiseigl.h b/src/taiseigl.h index 55055615..c6c8e6a4 100644 --- a/src/taiseigl.h +++ b/src/taiseigl.h @@ -147,6 +147,7 @@ typedef void (APIENTRY *tsglDeleteProgram_ptr)(GLuint program); typedef void (APIENTRY *tsglDeleteShader_ptr)(GLuint shader); typedef void (GLAPIENTRY *tsglDeleteTextures_ptr)(GLsizei n, const GLuint *textures); typedef void (GLAPIENTRY *tsglDepthFunc_ptr)(GLenum func); +typedef void (GLAPIENTRY *tsglDepthMask_ptr)(GLboolean flag); typedef void (GLAPIENTRY *tsglDisable_ptr)(GLenum cap); typedef void (GLAPIENTRY *tsglDrawArrays_ptr)(GLenum mode, GLint first, GLsizei count); typedef void (APIENTRY *tsglDrawArraysInstanced_ptr)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); @@ -223,6 +224,7 @@ typedef void (GLAPIENTRY *tsglViewport_ptr)(GLint x, GLint y, GLsizei width, GLs #undef glDeleteShader #undef glDeleteTextures #undef glDepthFunc +#undef glDepthMask #undef glDisable #undef glDrawArrays #undef glDrawArraysInstanced @@ -300,6 +302,7 @@ typedef void (GLAPIENTRY *tsglViewport_ptr)(GLint x, GLint y, GLsizei width, GLs #define glDeleteShader tsglDeleteShader #define glDeleteTextures tsglDeleteTextures #define glDepthFunc tsglDepthFunc +#define glDepthMask tsglDepthMask #define glDisable tsglDisable #define glDrawArrays tsglDrawArrays #define glDrawArraysInstanced tsglDrawArraysInstanced @@ -379,6 +382,7 @@ GLDEF(glDeleteProgram, tsglDeleteProgram, tsglDeleteProgram_ptr) \ GLDEF(glDeleteShader, tsglDeleteShader, tsglDeleteShader_ptr) \ GLDEF(glDeleteTextures, tsglDeleteTextures, tsglDeleteTextures_ptr) \ GLDEF(glDepthFunc, tsglDepthFunc, tsglDepthFunc_ptr) \ +GLDEF(glDepthMask, tsglDepthMask, tsglDepthMask_ptr) \ GLDEF(glDisable, tsglDisable, tsglDisable_ptr) \ GLDEF(glDrawArrays, tsglDrawArrays, tsglDrawArrays_ptr) \ GLDEF(glDrawArraysInstanced, tsglDrawArraysInstanced, tsglDrawArraysInstanced_ptr) \ @@ -462,6 +466,7 @@ GLAPI void APIENTRY glDeleteProgram (GLuint program); GLAPI void APIENTRY glDeleteShader (GLuint shader); GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); GLAPI void GLAPIENTRY glDisable( GLenum cap ); GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); @@ -538,6 +543,7 @@ GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei heigh #define tsglDeleteShader glDeleteShader #define tsglDeleteTextures glDeleteTextures #define tsglDepthFunc glDepthFunc +#define tsglDepthMask glDepthMask #define tsglDisable glDisable #define tsglDrawArrays glDrawArrays #define tsglDrawArraysInstanced glDrawArraysInstanced