⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scr.java

📁 Jake2是一个Java 3D游戏引擎.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                continue;            }            if (token.equals("pic")) { // draw a pic from a stat number                token = Com.Parse(ph);                value = cl.frame.playerstate.stats[Lib.atoi(token)];                if (value >= MAX_IMAGES)                    Com.Error(ERR_DROP, "Pic >= MAX_IMAGES");                if (cl.configstrings[CS_IMAGES + value] != null) {                    AddDirtyPoint(x, y);                    AddDirtyPoint(x + 23, y + 23);                    re.DrawPic(x, y, cl.configstrings[CS_IMAGES + value]);                }                continue;            }            if (token.equals("client")) { // draw a deathmatch client block                int score, ping, time;                token = Com.Parse(ph);                x = viddef.width / 2 - 160 + Lib.atoi(token);                token = Com.Parse(ph);                y = viddef.height / 2 - 120 + Lib.atoi(token);                AddDirtyPoint(x, y);                AddDirtyPoint(x + 159, y + 31);                token = Com.Parse(ph);                value = Lib.atoi(token);                if (value >= MAX_CLIENTS || value < 0)                    Com.Error(ERR_DROP, "client >= MAX_CLIENTS");                ci = cl.clientinfo[value];                token = Com.Parse(ph);                score = Lib.atoi(token);                token = Com.Parse(ph);                ping = Lib.atoi(token);                token = Com.Parse(ph);                time = Lib.atoi(token);                Console.DrawAltString(x + 32, y, ci.name);                Console.DrawString(x + 32, y + 8, "Score: ");                Console.DrawAltString(x + 32 + 7 * 8, y + 8, "" + score);                Console.DrawString(x + 32, y + 16, "Ping:  " + ping);                Console.DrawString(x + 32, y + 24, "Time:  " + time);                if (ci.icon == null)                    ci = cl.baseclientinfo;                re.DrawPic(x, y, ci.iconname);                continue;            }            if (token.equals("ctf")) { // draw a ctf client block                int score, ping;                token = Com.Parse(ph);                x = viddef.width / 2 - 160 + Lib.atoi(token);                token = Com.Parse(ph);                y = viddef.height / 2 - 120 + Lib.atoi(token);                AddDirtyPoint(x, y);                AddDirtyPoint(x + 159, y + 31);                token = Com.Parse(ph);                value = Lib.atoi(token);                if (value >= MAX_CLIENTS || value < 0)                    Com.Error(ERR_DROP, "client >= MAX_CLIENTS");                ci = cl.clientinfo[value];                token = Com.Parse(ph);                score = Lib.atoi(token);                token = Com.Parse(ph);                ping = Lib.atoi(token);                if (ping > 999)                    ping = 999;                // sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name);                String block = Com.sprintf("%3d %3d %-12.12s", new Vargs(3)                        .add(score).add(ping).add(ci.name));                if (value == cl.playernum)                    Console.DrawAltString(x, y, block);                else                    Console.DrawString(x, y, block);                continue;            }            if (token.equals("picn")) { // draw a pic from a name                token = Com.Parse(ph);                AddDirtyPoint(x, y);                AddDirtyPoint(x + 23, y + 23);                re.DrawPic(x, y, token);                continue;            }            if (token.equals("num")) { // draw a number                token = Com.Parse(ph);                width = Lib.atoi(token);                token = Com.Parse(ph);                value = cl.frame.playerstate.stats[Lib.atoi(token)];                DrawField(x, y, 0, width, value);                continue;            }            if (token.equals("hnum")) { // health number                int color;                width = 3;                value = cl.frame.playerstate.stats[STAT_HEALTH];                if (value > 25)                    color = 0; // green                else if (value > 0)                    color = (cl.frame.serverframe >> 2) & 1; // flash                else                    color = 1;                if ((cl.frame.playerstate.stats[STAT_FLASHES] & 1) != 0)                    re.DrawPic(x, y, "field_3");                DrawField(x, y, color, width, value);                continue;            }            if (token.equals("anum")) { // ammo number                int color;                width = 3;                value = cl.frame.playerstate.stats[STAT_AMMO];                if (value > 5)                    color = 0; // green                else if (value >= 0)                    color = (cl.frame.serverframe >> 2) & 1; // flash                else                    continue; // negative number = don't show                if ((cl.frame.playerstate.stats[STAT_FLASHES] & 4) != 0)                    re.DrawPic(x, y, "field_3");                DrawField(x, y, color, width, value);                continue;            }            if (token.equals("rnum")) { // armor number                int color;                width = 3;                value = cl.frame.playerstate.stats[STAT_ARMOR];                if (value < 1)                    continue;                color = 0; // green                if ((cl.frame.playerstate.stats[STAT_FLASHES] & 2) != 0)                    re.DrawPic(x, y, "field_3");                DrawField(x, y, color, width, value);                continue;            }            if (token.equals("stat_string")) {                token = Com.Parse(ph);                index = Lib.atoi(token);                if (index < 0 || index >= MAX_CONFIGSTRINGS)                    Com.Error(ERR_DROP, "Bad stat_string index");                index = cl.frame.playerstate.stats[index];                if (index < 0 || index >= MAX_CONFIGSTRINGS)                    Com.Error(ERR_DROP, "Bad stat_string index");                Console.DrawString(x, y, cl.configstrings[index]);                continue;            }            if (token.equals("cstring")) {                token = Com.Parse(ph);                DrawHUDString(token, x, y, 320, 0);                continue;            }            if (token.equals("string")) {                token = Com.Parse(ph);                Console.DrawString(x, y, token);                continue;            }            if (token.equals("cstring2")) {                token = Com.Parse(ph);                DrawHUDString(token, x, y, 320, 0x80);                continue;            }            if (token.equals("string2")) {                token = Com.Parse(ph);                Console.DrawAltString(x, y, token);                continue;            }            if (token.equals("if")) { // draw a number                token = Com.Parse(ph);                value = cl.frame.playerstate.stats[Lib.atoi(token)];                if (value == 0) {                    // skip to endif                    while (!ph.isEof() && !(token = Com.Parse(ph)).equals("endif"));                }                continue;            }        }    }    /*     * ================ SCR_DrawStats     *      * The status bar is a small layout program that is based on the stats array     * ================     */    static void DrawStats() {        //TODO:        SCR.ExecuteLayoutString(cl.configstrings[CS_STATUSBAR]);    }    /*     * ================ SCR_DrawLayout     *      * ================     */    static final int STAT_LAYOUTS = 13;    static void DrawLayout() {        if (cl.frame.playerstate.stats[STAT_LAYOUTS] != 0)            SCR.ExecuteLayoutString(cl.layout);    }    // =======================================================    /*     * ================== SCR_UpdateScreen     *      * This is called every frame, and can also be called explicitly to flush     * text to the screen. ==================     */    private static final float[] separation = { 0, 0 };        static void UpdateScreen2() {        int numframes;        int i;        // if the screen is disabled (loading plaque is up, or vid mode        // changing)        // do nothing at all        if (cls.disable_screen != 0) {            if (Timer.Milliseconds() - cls.disable_screen > 120000) {                cls.disable_screen = 0;                Com.Printf("Loading plaque timed out.\n");            }            return;        }        if (!scr_initialized || !con.initialized)            return; // not initialized yet        /*         * * range check cl_camera_separation so we don't inadvertently fry         * someone's * brain         */        if (cl_stereo_separation.value > 1.0)            Cvar.SetValue("cl_stereo_separation", 1.0f);        else if (cl_stereo_separation.value < 0)            Cvar.SetValue("cl_stereo_separation", 0.0f);        if (cl_stereo.value != 0) {            numframes = 2;            separation[0] = -cl_stereo_separation.value / 2;            separation[1] = cl_stereo_separation.value / 2;        } else {            separation[0] = 0;            separation[1] = 0;            numframes = 1;        }        for (i = 0; i < numframes; i++) {            re.BeginFrame(separation[i]);            if (scr_draw_loading == 2) { //  loading plaque over black screen                Dimension dim = new Dimension();                re.CinematicSetPalette(null);                scr_draw_loading = 0; // false                re.DrawGetPicSize(dim, "loading");                re.DrawPic((viddef.width - dim.width) / 2,                        (viddef.height - dim.height) / 2, "loading");            }            // if a cinematic is supposed to be running, handle menus            // and console specially            else if (cl.cinematictime > 0) {                if (cls.key_dest == key_menu) {                    if (cl.cinematicpalette_active) {                        re.CinematicSetPalette(null);                        cl.cinematicpalette_active = false;                    }                    Menu.Draw();                } else if (cls.key_dest == key_console) {                    if (cl.cinematicpalette_active) {                        re.CinematicSetPalette(null);                        cl.cinematicpalette_active = false;                    }                    DrawConsole();                } else {                    // TODO implement cinematics completely                    DrawCinematic();                }            } else {                // make sure the game palette is active                if (cl.cinematicpalette_active) {                    re.CinematicSetPalette(null);                    cl.cinematicpalette_active = false;                }                // do 3D refresh drawing, and then update the screen                CalcVrect();                // clear any dirty part of the background                TileClear();                V.RenderView(separation[i]);                DrawStats();                if ((cl.frame.playerstate.stats[STAT_LAYOUTS] & 1) != 0)                    DrawLayout();                if ((cl.frame.playerstate.stats[STAT_LAYOUTS] & 2) != 0)                    CL_inv.DrawInventory();                DrawNet();                CheckDrawCenterString();                DrawFPS();                //                //				if (scr_timegraph->value)                //					SCR_DebugGraph (cls.frametime*300, 0);                //                //				if (scr_debuggraph->value || scr_timegraph->value ||                // scr_netgraph->value)                //					SCR_DrawDebugGraph ();                //                DrawPause();                DrawConsole();                Menu.Draw();                DrawLoading();            }        }        Globals.re.EndFrame();    }    /*     * ================= SCR_DrawCrosshair =================     */    static void DrawCrosshair() {        if (crosshair.value == 0.0f)            return;        if (crosshair.modified) {            crosshair.modified = false;            SCR.TouchPics();        }        if (crosshair_pic.length() == 0)            return;        re.DrawPic(scr_vrect.x + ((scr_vrect.width - crosshair_width) >> 1),                scr_vrect.y + ((scr_vrect.height - crosshair_height) >> 1),                crosshair_pic);    }    private static xcommand_t updateScreenCallback = new xcommand_t() {        public void execute() {            UpdateScreen2();        }    };    // wird anstelle von der richtigen UpdateScreen benoetigt    public static void UpdateScreen() {        Globals.re.updateScreen(updateScreenCallback);    }    /*     * ================= SCR_AddDirtyPoint =================     */    static void AddDirtyPoint(int x, int y) {        if (x < scr_dirty.x1)            scr_dirty.x1 = x;        if (x > scr_dirty.x2)            scr_dirty.x2 = x;        if (y < scr_dirty.y1)            scr_dirty.y1 = y;        if (y > scr_dirty.y2)            scr_dirty.y2 = y;    }    private static int lastframes = 0;    private static int lasttime = 0;    private static String fpsvalue = "";    static void DrawFPS() {        if (fps.value > 0.0f) {            if (fps.modified) {                fps.modified = false;                Cvar.SetValue("cl_maxfps", 1000);            }            int diff = cls.realtime - lasttime;            if (diff > (int) (fps.value * 1000)) {                fpsvalue = (cls.framecount - lastframes) * 100000 / diff                        / 100.0f + " fps";                lastframes = cls.framecount;                lasttime = cls.realtime;            }            int x = viddef.width - 8 * fpsvalue.length() - 2;            for (int i = 0; i < fpsvalue.length(); i++) {                re.DrawChar(x, 2, fpsvalue.charAt(i));                x += 8;            }        } else if (fps.modified) {            fps.modified = false;            Cvar.SetValue("cl_maxfps", 90);        }    }    /*     * =================================================================     *      * cl_cin.c     *      * Play Cinematics     *      * =================================================================     */    private static class cinematics_t {        boolean restart_sound;        int s_rate;        int s_width;        int s_channels;                int width;        int height;        byte[] pic;        byte[] pic_pending;        // order 1 huffman stuff        int[] hnodes1; // [256][256][2];        int[] numhnodes1 = new int[256];                int[] h_used = new int[512];        int[] h_count = new int[512];    }        private static cinematics_t cin = new cinematics_t();    /**     * LoadPCX     */    static int LoadPCX(String filename, byte[] palette, cinematics_t cin) {        qfiles.pcx_t pcx;        // load the file        ByteBuffer raw = FS.LoadMappedFile(filename);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -