about summary refs log tree commit diff stats
path: root/data/maps/the_unyielding/rooms/Brown Alcove.txtpb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-08 16:07:10 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-08 16:07:10 -0400
commitd592b58af373c2c8e863ff0c744f23c26a26fa64 (patch)
tree972d87514e228b9b7621c6e77dcc59eeefe19bf7 /data/maps/the_unyielding/rooms/Brown Alcove.txtpb
parent1c361226240182db6f72f26c6fe0f0de65456239 (diff)
downloadlingo2-archipelago-d592b58af373c2c8e863ff0c744f23c26a26fa64.tar.gz
lingo2-archipelago-d592b58af373c2c8e863ff0c744f23c26a26fa64.tar.bz2
lingo2-archipelago-d592b58af373c2c8e863ff0c744f23c26a26fa64.zip
Downgrade protobuf
This allows the generated Python file to be compatible with the frozen Archipelago install.
Diffstat (limited to 'data/maps/the_unyielding/rooms/Brown Alcove.txtpb')
0 files changed, 0 insertions, 0 deletions
fourisland.com> 2009-02-03 21:11:23 -0500 Started working on new Transitions' href='/fourpuzzle/commit/src/com/fourisland/fourpuzzle/Display.java?id=029190712a8f38cef760741cf53652e0ccd89172'>0291907 ^
69b495c ^
325f629 ^

bbf294d ^

0291907 ^
325f629 ^

69b495c ^
325f629 ^
69b495c ^







bbf294d ^

69b495c ^
cd6b395 ^
69b495c ^
0291907 ^

69b495c ^
0291907 ^




69b495c ^
0291907 ^





69b495c ^
0291907 ^

69b495c ^
0291907 ^


69b495c ^
0291907 ^




69b495c ^


cd6b395 ^
69b495c ^







fdcfd3a ^
69b495c ^
fdcfd3a ^
0291907 ^
fdcfd3a ^
0291907 ^
fdcfd3a ^







0291907 ^
fdcfd3a ^

0291907 ^
fdcfd3a ^
bbf294d ^
69b495c ^

69b495c ^


bbf294d ^



















0291907 ^
69b495c ^
0291907 ^



69b495c ^
0291907 ^














fdcfd3a ^
bbf294d ^


d8cb607 ^
bbf294d ^


0291907 ^











d8cb607 ^
fdcfd3a ^
bbf294d ^


d8cb607 ^
bbf294d ^


0291907 ^


69b495c ^
0291907 ^





fdcfd3a ^

0291907 ^



69b495c ^

0291907 ^
69b495c ^
0291907 ^
69b495c ^

325f629 ^













6789090 ^
325f629 ^











41bc398 ^









325f629 ^






41bc398 ^










69b495c ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259






                                                    


                                                                       
                                                       

                                                                           
                                                 

                                    
                            


                           
                                    
                                    

                           

                                                 
                                           

                                
                           
                                            







                                             

                                                                                         
 
                                                
     

                                                                                    
 




                                                                                 
             





                                                                              
 

                                      
 


                                                                                                                                                                
 




                                     


         
                                                                     







                                                                                                    
                              
         
                                   
             
                                         
                 







                                                           
                 

                                                       
             
                
                      

         


                    



















                                                         
                                                     
                                         



                                                                                    
     














                                                                                                                   
                


                                                                                   
                    


                                                                                   











                                                                                                                   
                                                           
                


                                                                                   
                    


                                                                                   


             
                                        





                                               

                          



                                      

     
                                               
     
                                 

     













                                                                                                                      
                                                    











                                            









                                






                                                                                           










                                                                                        
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fourisland.fourpuzzle;

import com.fourisland.fourpuzzle.transition.InTransition;
import com.fourisland.fourpuzzle.transition.MultidirectionalTransition;
import com.fourisland.fourpuzzle.transition.OutTransition;
import com.fourisland.fourpuzzle.transition.Transition;
import com.fourisland.fourpuzzle.transition.TransitionDirection;
import com.fourisland.fourpuzzle.transition.TransitionUnsupportedException;
import com.fourisland.fourpuzzle.util.Renderable;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.VolatileImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import org.jdesktop.application.ResourceMap;

/**
 *
 * @author hatkirby
 */
public class Display {
    
    public static int tileAnimationFrame = 0;
    
    private static List<Renderable> renderables = new CopyOnWriteArrayList<Renderable>();

    public static void render(JDialog gameFrame)
    {
        VolatileImage vImg = gameFrame.createVolatileImage(Game.WIDTH, Game.HEIGHT);
        render(gameFrame, vImg);

        Image img = null;
        do
        {
            int returnCode = vImg.validate(gameFrame.getGraphicsConfiguration());
            if (returnCode == VolatileImage.IMAGE_RESTORED)
            {
                render(gameFrame, vImg);
            } else if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE)
            {
                vImg = gameFrame.createVolatileImage(Game.WIDTH, Game.HEIGHT);
                render(gameFrame, vImg);
            }

            img = vImg;
        } while (vImg.contentsLost());

        gameFrame.getContentPane().getGraphics().drawImage(img, 0, 0, gameFrame.getContentPane().getWidth(), gameFrame.getContentPane().getHeight(), gameFrame);
        img.flush();
        Toolkit.getDefaultToolkit().sync();

        if (tileAnimationFrame == 15)
        {
            tileAnimationFrame = 0;
        } else {
            tileAnimationFrame++;
        }
    }

    private static void render(JDialog gameFrame, VolatileImage vImg)
    {
        if (vImg.validate(gameFrame.getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE)
        {
            vImg = gameFrame.createVolatileImage(Game.WIDTH, Game.HEIGHT);
        }

        Graphics2D g = vImg.createGraphics();
        
        if (transitionRunning)
        {
            if (transition != null)
            {
                if (transition.render(g))
                {
                    if (startedTransition)
                    {
                        midTransition = vImg.getSnapshot();
                    } else {
                        midTransition = null;
                    }

                    transitionWait.countDown();
                }
            } else {
                g.drawImage(midTransition, 0, 0, null);
            }
        } else {
            render(g);
        }
        
        g.dispose();
    }
    
    private static void render(Graphics2D g)
    {
        Game.getGameState().render(g);
        
        for (Renderable r : renderables)
        {
            r.render(g);
        }
    }
    
    public static void registerRenderable(Renderable r)
    {
        renderables.add(r);
    }
    
    public static void unregisterRenderable(Renderable r)
    {
        renderables.remove(r);
    }
    
    private static boolean startedTransition = false;
    private static Transition transition;
    private static CountDownLatch transitionWait;
    private static boolean transitionRunning = false;
    private static BufferedImage midTransition = null;
    public static void transition(Transition transition) throws InterruptedException
    {
        if (transition instanceof MultidirectionalTransition)
        {
            MultidirectionalTransition temp = (MultidirectionalTransition) transition;
            
            if (startedTransition && (temp.getDirection() != TransitionDirection.In))
            {
                throw new TransitionUnsupportedException(transition.getClass().getName(), TransitionDirection.In);
            } else if (!startedTransition && (temp.getDirection() != TransitionDirection.Out))
            {
                throw new TransitionUnsupportedException(transition.getClass().getName(), TransitionDirection.Out);
            }
            
            if (temp.getDirection() == TransitionDirection.In)
            {
                temp.setPreTransition(midTransition);
                
                BufferedImage bImg = Display.createCanvas(Game.WIDTH, Game.HEIGHT);
                render(bImg.createGraphics());
                temp.setPostTransition(bImg);
            } else {
                BufferedImage bImg = Display.createCanvas(Game.WIDTH, Game.HEIGHT);
                render(bImg.createGraphics());
                temp.setPreTransition(bImg);
            }
        } else {
            if (startedTransition && !(transition instanceof InTransition))
            {
                throw new TransitionUnsupportedException(transition.getClass().getName(), TransitionDirection.In);
            } else if (!startedTransition && !(transition instanceof OutTransition))
            {
                throw new TransitionUnsupportedException(transition.getClass().getName(), TransitionDirection.Out);
            }
            
            if (transition instanceof InTransition)
            {
                transition.setPreTransition(midTransition);
                
                BufferedImage bImg = Display.createCanvas(Game.WIDTH, Game.HEIGHT);
                render(bImg.createGraphics());
                ((InTransition) transition).setPostTransition(bImg);
            } else {
                BufferedImage bImg = Display.createCanvas(Game.WIDTH, Game.HEIGHT);
                render(bImg.createGraphics());
                transition.setPreTransition(bImg);
            }
        }
        
        Display.transition = transition;
        startedTransition = !startedTransition;
        transitionRunning = true;
        
        transitionWait = new CountDownLatch(1);
        transitionWait.await();
        
        transition = null;
        
        if (!startedTransition)
        {
            transitionRunning = false;
        }
    }
    
    public static boolean isTransitionRunning()
    {
        return transitionRunning;
    }
    
    private static Font theFont = null;
    private static void initalizeFont()
    {
        ResourceMap rm = PuzzleApplication.getInstance().getContext().getResourceMap();
        InputStream file = rm.getClassLoader().getResourceAsStream("com/fourisland/fourpuzzle/resources/RMG2000.ttf");

        try {
            theFont = Font.createFont(Font.TRUETYPE_FONT, file);
        } catch (FontFormatException ex) {
            Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        theFont = theFont.deriveFont(Font.PLAIN, 9);
    }
    
    public static void setFont(Graphics2D g)
    {
        if (theFont == null)
        {
            initalizeFont();
        }
        
        g.setFont(theFont);
    }
    
    public static Font getFont()
    {
        if (theFont == null)
        {
            initalizeFont();
        }
        
        return theFont;
    }
    
    public static BufferedImage createCanvas(int width, int height)
    {
        BufferedImage temp = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        
        return temp;
    }
    
    private static FontMetrics fontMetrics = null;
    public static FontMetrics getFontMetrics()
    {
        if (fontMetrics == null)
        {
            fontMetrics = createCanvas(1, 1).createGraphics().getFontMetrics(getFont());
        }
        
        return fontMetrics;
    }
    
}