Annotation of doom/f_finale.c, revision 1.1.1.5

1.1.1.3   root        1: // Emacs style mode select   -*- C++ -*- 
                      2: //-----------------------------------------------------------------------------
                      3: //
                      4: // $Id:$
                      5: //
                      6: // Copyright (C) 1993-1996 by id Software, Inc.
                      7: //
1.1.1.5 ! root        8: // This source is available for distribution and/or modification
        !             9: // only under the terms of the DOOM Source Code License as
        !            10: // published by id Software. All rights reserved.
1.1.1.3   root       11: //
1.1.1.5 ! root       12: // The source is distributed in the hope that it will be useful,
1.1.1.3   root       13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
1.1.1.5 ! root       14: // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
        !            15: // for more details.
1.1.1.3   root       16: //
                     17: // $Log:$
                     18: //
                     19: // DESCRIPTION:
                     20: //     Game completion, final screen animation.
                     21: //
                     22: //-----------------------------------------------------------------------------
                     23: 
                     24: 
                     25: static const char
                     26: rcsid[] = "$Id: f_finale.c,v 1.5 1997/02/03 21:26:34 b1 Exp $";
1.1       root       27: 
                     28: #include <ctype.h>
                     29: 
1.1.1.3   root       30: // Functions.
                     31: #include "i_system.h"
                     32: #include "m_swap.h"
                     33: #include "z_zone.h"
                     34: #include "v_video.h"
                     35: #include "w_wad.h"
                     36: #include "s_sound.h"
                     37: 
                     38: // Data.
                     39: #include "dstrings.h"
                     40: #include "sounds.h"
                     41: 
                     42: #include "doomstat.h"
                     43: #include "r_state.h"
                     44: 
                     45: // ?
                     46: //#include "doomstat.h"
                     47: //#include "r_local.h"
                     48: //#include "f_finale.h"
                     49: 
                     50: // Stage of animation:
                     51: //  0 = text, 1 = art screen, 2 = character cast
                     52: int            finalestage;
                     53: 
                     54: int            finalecount;
1.1.1.2   root       55: 
                     56: #define        TEXTSPEED       3
                     57: #define        TEXTWAIT        250
                     58: 
1.1.1.3   root       59: char*  e1text = E1TEXT;
                     60: char*  e2text = E2TEXT;
                     61: char*  e3text = E3TEXT;
                     62: char*  e4text = E4TEXT;
                     63: 
                     64: char*  c1text = C1TEXT;
                     65: char*  c2text = C2TEXT;
                     66: char*  c3text = C3TEXT;
                     67: char*  c4text = C4TEXT;
                     68: char*  c5text = C5TEXT;
                     69: char*  c6text = C6TEXT;
                     70: 
                     71: char*  p1text = P1TEXT;
                     72: char*  p2text = P2TEXT;
                     73: char*  p3text = P3TEXT;
                     74: char*  p4text = P4TEXT;
                     75: char*  p5text = P5TEXT;
                     76: char*  p6text = P6TEXT;
                     77: 
                     78: char*  t1text = T1TEXT;
                     79: char*  t2text = T2TEXT;
                     80: char*  t3text = T3TEXT;
                     81: char*  t4text = T4TEXT;
                     82: char*  t5text = T5TEXT;
                     83: char*  t6text = T6TEXT;
                     84: 
                     85: char*  finaletext;
                     86: char*  finaleflat;
                     87: 
                     88: void   F_StartCast (void);
                     89: void   F_CastTicker (void);
                     90: boolean F_CastResponder (event_t *ev);
                     91: void   F_CastDrawer (void);
1.1.1.5 ! root       92: void   F_TileBG(void);  //10.14.98 rude fix
        !            93: 
        !            94: extern boolean plutonia, tnt;
        !            95: 
        !            96: void WriteDebug(char *);
1.1.1.3   root       97: 
                     98: //
                     99: // F_StartFinale
                    100: //
1.1.1.5 ! root      101: void F_StartFinale(void)
1.1.1.3   root      102: {
                    103:     gameaction = ga_nothing;
                    104:     gamestate = GS_FINALE;
                    105:     viewactive = false;
                    106:     automapactive = false;
                    107: 
                    108:     // Okay - IWAD dependend stuff.
                    109:     // This has been changed severly, and
                    110:     //  some stuff might have changed in the process.
                    111:     switch ( gamemode )
                    112:     {
                    113: 
                    114:       // DOOM 1 - E1, E3 or E4, but each nine missions
1.1.1.5 ! root      115:        case shareware:
        !           116:        case registered:
        !           117:        case retail:
        !           118:                {
        !           119:                        S_ChangeMusic(mus_victor, true);
        !           120:                        switch (gameepisode)
        !           121:                        {
        !           122:                        case 1:
        !           123:                                finaleflat = "FLOOR4_8";
        !           124:                                finaletext = e1text;
        !           125:                                break;
        !           126:                        case 2:
        !           127:                                finaleflat = "SFLR6_1";
        !           128:                                finaletext = e2text;
        !           129:                                break;
        !           130:                        case 3:
        !           131:                                finaleflat = "MFLR8_4";
        !           132:                                finaletext = e3text;
        !           133:                                break;
        !           134:                        case 4:
        !           135:                                finaleflat = "MFLR8_3";
        !           136:                                finaletext = e4text;
        !           137:                                break;
        !           138:                        default:
        !           139:                                // Ouch.
        !           140:                                break;
        !           141:                        }
        !           142:                        break;
        !           143:                }
        !           144:        // DOOM II and missions packs with E1, M34
        !           145:        case commercial:
        !           146:                {
        !           147:                        S_ChangeMusic(mus_read_m, true);
        !           148:                        switch (gamemap)
        !           149:                        {
        !           150:                        case 6:
        !           151:                                finaleflat = "SLIME16";
        !           152:                                if (tnt == TRUE)
        !           153:                                        finaletext = t1text;
        !           154:                                else
        !           155:                                        if (plutonia == TRUE)
        !           156:                                                finaletext = p1text;
        !           157:                                        else
        !           158:                                                finaletext = c1text;
        !           159:                                        break;
        !           160:                        case 11:
        !           161:                                finaleflat = "RROCK14";
        !           162:                                if (tnt == TRUE)
        !           163:                                        finaletext = t2text;
        !           164:                                else
        !           165:                                        if (plutonia == TRUE)
        !           166:                                                finaletext = p2text;
        !           167:                                        else
        !           168:                                                finaletext = c2text;
        !           169:                                        break;
        !           170:                        case 20:
        !           171:                                finaleflat = "RROCK07";
        !           172:                                if (tnt == TRUE)
        !           173:                                        finaletext = t3text;
        !           174:                                else
        !           175:                                        if (plutonia == TRUE)
        !           176:                                                finaletext = p3text;
        !           177:                                        else
        !           178:                                                finaletext = c3text;
        !           179:                                        break;
        !           180:                        case 30:
        !           181:                                finaleflat = "RROCK17";
        !           182:                                if (tnt == TRUE)
        !           183:                                        finaletext = t4text;
        !           184:                                else
        !           185:                                        if (plutonia == TRUE)
        !           186:                                                finaletext = p4text;
        !           187:                                        else
        !           188:                                                finaletext = c4text;
        !           189:                                        break;
        !           190:                        case 15:
        !           191:                                finaleflat = "RROCK13";
        !           192:                                if (tnt == TRUE)
        !           193:                                        finaletext = t5text;
        !           194:                                else
        !           195:                                        if (plutonia == TRUE)
        !           196:                                                finaletext = p5text;
        !           197:                                        else
        !           198:                                                finaletext = c5text;
        !           199:                                        break;
        !           200:                        case 31:
        !           201:                                finaleflat = "RROCK19";
        !           202:                                if (tnt == TRUE)
        !           203:                                        finaletext = t6text;
        !           204:                                else
        !           205:                                        if (plutonia == TRUE)
        !           206:                                                finaletext = p6text;
        !           207:                                        else
        !           208:                                                finaletext = c6text;
        !           209:                                        break;
        !           210:                        default:
        !           211:                                // Ouch.
        !           212:                                break;
        !           213:                        }
        !           214:                        break;
        !           215:                }
        !           216:        // Indeterminate.
        !           217:        default:
        !           218:                S_ChangeMusic(mus_read_m, true);
        !           219:                finaleflat = "F_SKY1"; // Not used anywhere else.
        !           220:                finaletext = c1text;  // FIXME - other text, music?
        !           221:                break;
1.1.1.3   root      222:     }
                    223:     
                    224:     finalestage = 0;
                    225:     finalecount = 0;
                    226:        
                    227: }
1.1.1.2   root      228: 
1.1       root      229: 
                    230: 
1.1.1.3   root      231: boolean F_Responder (event_t *event)
                    232: {
                    233:     if (finalestage == 2)
1.1.1.5 ! root      234:                return F_CastResponder(event);
1.1.1.3   root      235:        
                    236:     return false;
                    237: }
1.1       root      238: 
1.1.1.2   root      239: 
1.1.1.3   root      240: //
                    241: // F_Ticker
                    242: //
                    243: void F_Ticker (void)
                    244: {
                    245:     int                i;
                    246:     
                    247:     // check for skipping
1.1.1.5 ! root      248:     if ( (gamemode == commercial) && (finalecount > 50) )
1.1.1.3   root      249:     {
1.1.1.5 ! root      250:                // go on to the next level
        !           251:                for (i=0 ; i<MAXPLAYERS ; i++)
        !           252:                        if (players[i].cmd.buttons)
        !           253:                                break;
        !           254:                        if (i < MAXPLAYERS)
        !           255:                        {       
        !           256:                                if(gamemap == 30)
        !           257:                                        F_StartCast ();
        !           258:                                else
        !           259:                                        gameaction = ga_worlddone;
        !           260:                        }
1.1.1.3   root      261:     }
                    262:     
                    263:     // advance animation
                    264:     finalecount++;
                    265:        
                    266:     if (finalestage == 2)
                    267:     {
1.1.1.5 ! root      268:                F_CastTicker();
        !           269:                return;
1.1.1.3   root      270:     }
                    271:        
1.1.1.5 ! root      272:     if(gamemode == commercial)
        !           273:                return;
1.1.1.3   root      274:                
1.1.1.5 ! root      275:     if (!finalestage && (unsigned)finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
1.1.1.3   root      276:     {
1.1.1.5 ! root      277:                finalecount = 0;
        !           278:                finalestage = 1;
        !           279:                //id stuff wipegamestate = -1;          // force a wipe
        !           280:                F_TileBG();
        !           281:                if (gameepisode == 3)
        !           282:                        S_StartMusic (mus_bunny);
1.1.1.3   root      283:     }
                    284: }
1.1       root      285: 
                    286: 
1.1.1.2   root      287: 
1.1.1.3   root      288: //
                    289: // F_TextWrite
                    290: //
1.1.1.2   root      291: 
1.1.1.3   root      292: #include "hu_stuff.h"
                    293: extern patch_t *hu_font[HU_FONTSIZE];
1.1       root      294: 
1.1.1.2   root      295: 
1.1.1.5 ! root      296: 
        !           297: // 10.14.98 dlw adding some code to double if high res
        !           298: void F_TextWrite(void)
1.1.1.3   root      299: {
1.1.1.5 ! root      300:     //byte*    src;
        !           301:     //byte*    dest;    
        !           302:     //int              x,y,w;
        !           303:        int             w;
1.1.1.3   root      304:     int                count;
                    305:     char*      ch;
1.1.1.5 ! root      306:     int                c, doublec; // test char added 10.14.98
1.1.1.3   root      307:     int                cx;
                    308:     int                cy;
                    309:     
                    310:     // erase the entire screen to a tiled background
1.1.1.5 ! root      311:        F_TileBG();
        !           312:     //src = W_CacheLumpName ( finaleflat , PU_CACHE);
        !           313:     //dest = screens[0];
        !           314:        //for (y = 0; y < SCREENHEIGHT; y++)
        !           315:        //{
        !           316:     //    for (x = 0; x < SCREENWIDTH/64; x++)
        !           317:        //      {
        !           318:     //        memcpy (dest, src+((y&63)<<6), 64);
        !           319:        //              dest += 64;
        !           320:        //      }
        !           321:        //      if (SCREENWIDTH&63)
        !           322:        //      {
        !           323:        //              memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
        !           324:        //              dest += (SCREENWIDTH&63);
        !           325:        //      }
        !           326:        //}
        !           327:     //V_MarkRect(0, 0, SCREENWIDTH, SCREENHEIGHT);
        !           328:     
        !           329:     // draw some of the text onto the screen
        !           330:        // really need that DOUBLESTUFF here, there and everywhere
        !           331:        if(DOUBLESTUFF)
1.1.1.3   root      332:        {
1.1.1.5 ! root      333:                cx = ((SCREENWIDTH-640)/2)+20; // raw double of orig code
        !           334:                cy = ((SCREENHEIGHT-400)/2)+20;
1.1.1.3   root      335:        }
1.1.1.5 ! root      336:        else
1.1.1.3   root      337:        {
1.1.1.5 ! root      338:                cx = ((SCREENWIDTH-320)/2)+10;
        !           339:                cy = ((SCREENHEIGHT-200)/2)+10;
1.1.1.3   root      340:        }
1.1.1.5 ! root      341:        ch = finaletext;
1.1.1.3   root      342:        
                    343:     count = (finalecount - 10)/TEXTSPEED;
1.1.1.5 ! root      344:     if (count < 0) count = 0;
1.1.1.3   root      345:     for ( ; count ; count-- )
                    346:        {
1.1.1.5 ! root      347:         c = *ch++;
        !           348:         if (!c)
        !           349:             break;
        !           350:         if (c == '\n')
        !           351:                {
        !           352:                        // really need that DOUBLESTUFF here, there and everywhere
        !           353:                        if(DOUBLESTUFF)
        !           354:                        {
        !           355:                                cx = ((SCREENWIDTH-640)/2)+20;
        !           356:                                cy += 22;
        !           357:                        }
        !           358:                        else
        !           359:                        {
        !           360:                                cx = ((SCREENWIDTH-320)/2)+10;
        !           361:                                cy += 11;
        !           362:                        }
        !           363:             continue;
        !           364:                }
        !           365:                doublec=c;
        !           366:         c = toupper(c) - HU_FONTSTART;
        !           367:         if (c < 0 || c> HU_FONTSIZE)
        !           368:                {
        !           369:             cx += 4;
        !           370:                        if(DOUBLESTUFF) cx+=4; //double
        !           371:             continue;
        !           372:                }
        !           373:                w = SHORT (hu_font[c]->width);
        !           374:                if(DOUBLESTUFF) w*=2; //double
        !           375:         if (cx+w > SCREENWIDTH)
        !           376:             break;
        !           377:                // really need that DOUBLESTUFF here, there and everywhere
        !           378:                if(DOUBLESTUFF)
        !           379:                {
        !           380:                        if(doublec==',' || doublec=='.')
        !           381:                                V_DrawPatchDouble(cx, cy+4, 0, hu_font[c]);
        !           382:                        else
        !           383:                                V_DrawPatchDouble(cx, cy, 0, hu_font[c]);
        !           384:                }
        !           385:                else
        !           386:                        V_DrawPatch(cx, cy, 0, hu_font[c]);
        !           387:         cx += w;
1.1.1.3   root      388:        }
                    389: }
1.1.1.2   root      390: 
                    391: //
1.1.1.3   root      392: // Final DOOM 2 animation
                    393: // Casting by id Software.
                    394: //   in order of appearance
1.1.1.2   root      395: //
1.1.1.3   root      396: typedef struct
1.1       root      397: {
1.1.1.3   root      398:     char               *name;
                    399:     mobjtype_t type;
                    400: } castinfo_t;
                    401: 
                    402: castinfo_t     castorder[] = {
                    403:     {CC_ZOMBIE, MT_POSSESSED},
                    404:     {CC_SHOTGUN, MT_SHOTGUY},
                    405:     {CC_HEAVY, MT_CHAINGUY},
                    406:     {CC_IMP, MT_TROOP},
                    407:     {CC_DEMON, MT_SERGEANT},
                    408:     {CC_LOST, MT_SKULL},
                    409:     {CC_CACO, MT_HEAD},
                    410:     {CC_HELL, MT_KNIGHT},
                    411:     {CC_BARON, MT_BRUISER},
                    412:     {CC_ARACH, MT_BABY},
                    413:     {CC_PAIN, MT_PAIN},
                    414:     {CC_REVEN, MT_UNDEAD},
                    415:     {CC_MANCU, MT_FATSO},
                    416:     {CC_ARCH, MT_VILE},
                    417:     {CC_SPIDER, MT_SPIDER},
                    418:     {CC_CYBER, MT_CYBORG},
                    419:     {CC_HERO, MT_PLAYER},
                    420: 
                    421:     {NULL,0}
                    422: };
                    423: 
                    424: int            castnum;
                    425: int            casttics;
                    426: state_t*       caststate;
                    427: boolean                castdeath;
                    428: int            castframes;
                    429: int            castonmelee;
                    430: boolean                castattacking;
1.1       root      431: 
                    432: 
1.1.1.2   root      433: //
1.1.1.3   root      434: // F_StartCast
1.1.1.2   root      435: //
1.1.1.3   root      436: extern gamestate_t     wipegamestate;
                    437: 
1.1       root      438: 
1.1.1.3   root      439: void F_StartCast (void)
1.1       root      440: {
1.1.1.5 ! root      441:     // wipegamestate = -1;             // force a screen wipe
        !           442:        F_TileBG();
1.1.1.3   root      443:     castnum = 0;
                    444:     caststate = &states[mobjinfo[castorder[castnum].type].seestate];
                    445:     casttics = caststate->tics;
                    446:     castdeath = false;
                    447:     finalestage = 2;   
                    448:     castframes = 0;
                    449:     castonmelee = 0;
                    450:     castattacking = false;
                    451:     S_ChangeMusic(mus_evil, true);
1.1       root      452: }
                    453: 
1.1.1.3   root      454: 
1.1.1.2   root      455: //
1.1.1.3   root      456: // F_CastTicker
1.1.1.2   root      457: //
1.1.1.3   root      458: void F_CastTicker (void)
1.1       root      459: {
1.1.1.3   root      460:     int                st;
                    461:     int                sfx;
                    462:        
                    463:     if (--casttics > 0)
                    464:        return;                 // not time to change state yet
                    465:                
                    466:     if (caststate->tics == -1 || caststate->nextstate == S_NULL)
                    467:     {
                    468:        // switch from deathstate to next monster
                    469:        castnum++;
                    470:        castdeath = false;
                    471:        if (castorder[castnum].name == NULL)
                    472:            castnum = 0;
                    473:        if (mobjinfo[castorder[castnum].type].seesound)
                    474:            S_StartSound (NULL, mobjinfo[castorder[castnum].type].seesound);
                    475:        caststate = &states[mobjinfo[castorder[castnum].type].seestate];
                    476:        castframes = 0;
                    477:     }
                    478:     else
                    479:     {
                    480:        // just advance to next state in animation
                    481:        if (caststate == &states[S_PLAY_ATK1])
                    482:            goto stopattack;    // Oh, gross hack!
                    483:        st = caststate->nextstate;
                    484:        caststate = &states[st];
                    485:        castframes++;
                    486:        
                    487:        // sound hacks....
                    488:        switch (st)
                    489:        {
                    490:          case S_PLAY_ATK1:     sfx = sfx_dshtgn; break;
                    491:          case S_POSS_ATK2:     sfx = sfx_pistol; break;
                    492:          case S_SPOS_ATK2:     sfx = sfx_shotgn; break;
                    493:          case S_VILE_ATK2:     sfx = sfx_vilatk; break;
                    494:          case S_SKEL_FIST2:    sfx = sfx_skeswg; break;
                    495:          case S_SKEL_FIST4:    sfx = sfx_skepch; break;
                    496:          case S_SKEL_MISS2:    sfx = sfx_skeatk; break;
                    497:          case S_FATT_ATK8:
                    498:          case S_FATT_ATK5:
                    499:          case S_FATT_ATK2:     sfx = sfx_firsht; break;
                    500:          case S_CPOS_ATK2:
                    501:          case S_CPOS_ATK3:
                    502:          case S_CPOS_ATK4:     sfx = sfx_shotgn; break;
                    503:          case S_TROO_ATK3:     sfx = sfx_claw; break;
                    504:          case S_SARG_ATK2:     sfx = sfx_sgtatk; break;
                    505:          case S_BOSS_ATK2:
                    506:          case S_BOS2_ATK2:
                    507:          case S_HEAD_ATK2:     sfx = sfx_firsht; break;
                    508:          case S_SKULL_ATK2:    sfx = sfx_sklatk; break;
                    509:          case S_SPID_ATK2:
                    510:          case S_SPID_ATK3:     sfx = sfx_shotgn; break;
                    511:          case S_BSPI_ATK2:     sfx = sfx_plasma; break;
                    512:          case S_CYBER_ATK2:
                    513:          case S_CYBER_ATK4:
                    514:          case S_CYBER_ATK6:    sfx = sfx_rlaunc; break;
                    515:          case S_PAIN_ATK3:     sfx = sfx_sklatk; break;
                    516:          default: sfx = 0; break;
                    517:        }
                    518:                
                    519:        if (sfx)
                    520:            S_StartSound (NULL, sfx);
                    521:     }
                    522:        
                    523:     if (castframes == 12)
                    524:     {
                    525:        // go into attack frame
                    526:        castattacking = true;
                    527:        if (castonmelee)
                    528:            caststate=&states[mobjinfo[castorder[castnum].type].meleestate];
1.1.1.2   root      529:        else
1.1.1.3   root      530:            caststate=&states[mobjinfo[castorder[castnum].type].missilestate];
                    531:        castonmelee ^= 1;
                    532:        if (caststate == &states[S_NULL])
                    533:        {
                    534:            if (castonmelee)
                    535:                caststate=
                    536:                    &states[mobjinfo[castorder[castnum].type].meleestate];
                    537:            else
                    538:                caststate=
                    539:                    &states[mobjinfo[castorder[castnum].type].missilestate];
                    540:        }
                    541:     }
                    542:        
                    543:     if (castattacking)
                    544:     {
                    545:        if (castframes == 24
                    546:            ||  caststate == &states[mobjinfo[castorder[castnum].type].seestate] )
                    547:        {
                    548:          stopattack:
                    549:            castattacking = false;
                    550:            castframes = 0;
                    551:            caststate = &states[mobjinfo[castorder[castnum].type].seestate];
                    552:        }
                    553:     }
                    554:        
                    555:     casttics = caststate->tics;
                    556:     if (casttics == -1)
                    557:        casttics = 15;
1.1       root      558: }
                    559: 
1.1.1.3   root      560: 
1.1.1.2   root      561: //
1.1.1.3   root      562: // F_CastResponder
1.1.1.2   root      563: //
1.1       root      564: 
1.1.1.3   root      565: boolean F_CastResponder (event_t* ev)
1.1       root      566: {
1.1.1.3   root      567:     if (ev->type != ev_keydown)
                    568:        return false;
                    569:                
1.1.1.5 ! root      570:     if(castdeath)
1.1.1.3   root      571:        return true;                    // already in dying frames
                    572:                
                    573:     // go into death frame
                    574:     castdeath = true;
                    575:     caststate = &states[mobjinfo[castorder[castnum].type].deathstate];
                    576:     casttics = caststate->tics;
                    577:     castframes = 0;
                    578:     castattacking = false;
                    579:     if (mobjinfo[castorder[castnum].type].deathsound)
                    580:        S_StartSound (NULL, mobjinfo[castorder[castnum].type].deathsound);
                    581:        
                    582:     return true;
1.1       root      583: }
                    584: 
                    585: 
1.1.1.3   root      586: void F_CastPrint (char* text)
1.1       root      587: {
1.1.1.3   root      588:     char*      ch;
                    589:     int                c;
                    590:     int                cx;
                    591:     int                w;
                    592:     int                width;
                    593:     
                    594:     // find width
                    595:     ch = text;
                    596:     width = 0;
                    597:        
                    598:     while (ch)
                    599:     {
                    600:        c = *ch++;
                    601:        if (!c)
                    602:            break;
                    603:        c = toupper(c) - HU_FONTSTART;
                    604:        if (c < 0 || c> HU_FONTSIZE)
                    605:        {
                    606:            width += 4;
                    607:            continue;
                    608:        }
                    609:                
                    610:        w = SHORT (hu_font[c]->width);
                    611:        width += w;
                    612:     }
                    613:     
                    614:     // draw it
1.1.1.5 ! root      615:     cx = (SCREENWIDTH/2)-width/2;
1.1.1.3   root      616:     ch = text;
                    617:     while (ch)
                    618:     {
                    619:        c = *ch++;
                    620:        if (!c)
                    621:            break;
                    622:        c = toupper(c) - HU_FONTSTART;
                    623:        if (c < 0 || c> HU_FONTSIZE)
                    624:        {
                    625:            cx += 4;
                    626:            continue;
                    627:        }
                    628:                
                    629:        w = SHORT (hu_font[c]->width);
1.1.1.5 ! root      630:        V_DrawPatch(cx, ((SCREENHEIGHT-200)/2)+180, 0, hu_font[c]);
1.1.1.3   root      631:        cx+=w;
                    632:     }
                    633:        
1.1       root      634: }
                    635: 
1.1.1.3   root      636: 
1.1.1.2   root      637: //
1.1.1.3   root      638: // F_CastDrawer
1.1.1.2   root      639: //
1.1.1.3   root      640: void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch);
1.1       root      641: 
1.1.1.3   root      642: void F_CastDrawer (void)
1.1       root      643: {
1.1.1.3   root      644:     spritedef_t*       sprdef;
                    645:     spriteframe_t*     sprframe;
                    646:     int                        lump;
                    647:     boolean            flip;
                    648:     patch_t*           patch;
                    649:     
                    650:     // erase the entire screen to a background
1.1.1.5 ! root      651:        // really need that DOUBLESTUFF here, there and everywhere
        !           652:        if(DOUBLESTUFF)
        !           653:                V_DrawPatchDouble(((SCREENWIDTH-640)/2),((SCREENHEIGHT-400)/2),0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
        !           654:        else
        !           655:                V_DrawPatch (((SCREENWIDTH-320)/2)+0,((SCREENHEIGHT-200)/2)+0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
1.1.1.3   root      656: 
                    657:     F_CastPrint (castorder[castnum].name);
                    658:     
                    659:     // draw the current frame in the middle of the screen
                    660:     sprdef = &sprites[caststate->sprite];
                    661:     sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK];
                    662:     lump = sprframe->lump[0];
                    663:     flip = (boolean)sprframe->flip[0];
                    664:                        
                    665:     patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
                    666:     if (flip)
1.1.1.5 ! root      667:        V_DrawPatchFlipped ((SCREENWIDTH/2),((SCREENHEIGHT-200)/2)+170,0,patch);
1.1.1.3   root      668:     else
1.1.1.5 ! root      669:        V_DrawPatch ((SCREENWIDTH/2),((SCREENHEIGHT-200)/2)+170,0,patch);
1.1.1.2   root      670: }
1.1       root      671: 
1.1.1.3   root      672: 
1.1.1.2   root      673: //
1.1.1.3   root      674: // F_DrawPatchCol
1.1.1.2   root      675: //
1.1.1.3   root      676: void
                    677: F_DrawPatchCol
                    678: ( int          x,
                    679:   patch_t*     patch,
                    680:   int          col )
1.1.1.2   root      681: {
1.1.1.3   root      682:     column_t*  column;
                    683:     byte*      source;
                    684:     byte*      dest;
                    685:     byte*      desttop;
                    686:     int                count;
                    687:        
                    688:     column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
1.1.1.5 ! root      689:     desttop = screens[0]+x+(((SCREENHEIGHT-200)/2)*(SCREENWIDTH));
1.1.1.3   root      690: 
                    691:     // step through the posts in a column
                    692:     while (column->topdelta != 0xff )
                    693:     {
                    694:        source = (byte *)column + 3;
                    695:        dest = desttop + column->topdelta*SCREENWIDTH;
                    696:        count = column->length;
                    697:                
                    698:        while (count--)
1.1       root      699:        {
1.1.1.3   root      700:            *dest = *source++;
                    701:            dest += SCREENWIDTH;
1.1       root      702:        }
1.1.1.3   root      703:        column = (column_t *)(  (byte *)column + column->length + 4 );
                    704:     }
1.1       root      705: }
                    706: 
1.1.1.3   root      707: 
1.1.1.2   root      708: //
1.1.1.3   root      709: // F_BunnyScroll
1.1.1.2   root      710: //
1.1.1.3   root      711: void F_BunnyScroll (void)
1.1       root      712: {
1.1.1.3   root      713:     int                scrolled;
1.1.1.5 ! root      714:     int                x, xx;
1.1.1.3   root      715:     patch_t*   p1;
                    716:     patch_t*   p2;
                    717:     char       name[10];
                    718:     int                stage;
                    719:     static int laststage;
1.1.1.5 ! root      720: 
        !           721:     WriteDebug("Entering F_BunnyScroll...\n");
1.1.1.3   root      722:                
                    723:     p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
                    724:     p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);
                    725: 
                    726:     V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
                    727:        
                    728:     scrolled = 320 - (finalecount-230)/2;
                    729:     if (scrolled > 320)
1.1.1.5 ! root      730:         scrolled = 320;
1.1.1.3   root      731:     if (scrolled < 0)
1.1.1.5 ! root      732:         scrolled = 0;
        !           733: 
        !           734:     //for (x = 0; x < SCREENWIDTH ; x++)
        !           735:     for (x = ((SCREENWIDTH-320)/2), xx = 0; x < ((SCREENWIDTH-320)/2)+320; x++, xx++)
1.1.1.3   root      736:     {
1.1.1.5 ! root      737:        if (xx + scrolled < 320)
        !           738:            F_DrawPatchCol (x, p1, xx+scrolled);
1.1.1.3   root      739:        else
1.1.1.5 ! root      740:            F_DrawPatchCol (x, p2, xx+scrolled - 320);          
1.1.1.3   root      741:     }
                    742:        
                    743:     if (finalecount < 1130)
                    744:        return;
                    745:     if (finalecount < 1180)
                    746:     {
                    747:        V_DrawPatch ((SCREENWIDTH-13*8)/2,
                    748:                     (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName ("END0",PU_CACHE));
                    749:        laststage = 0;
                    750:        return;
                    751:     }
                    752:        
                    753:     stage = (finalecount-1180) / 5;
                    754:     if (stage > 6)
                    755:        stage = 6;
                    756:     if (stage > laststage)
                    757:     {
                    758:        S_StartSound (NULL, sfx_pistol);
                    759:        laststage = stage;
                    760:     }
                    761:        
                    762:     sprintf (name,"END%i",stage);
                    763:     V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE));
                    764: }
1.1.1.2   root      765: 
1.1.1.3   root      766: 
                    767: //
                    768: // F_Drawer
                    769: //
1.1.1.5 ! root      770: // 10.14.98 reworked so shareware looks good
1.1.1.3   root      771: void F_Drawer (void)
                    772: {
                    773:     if (finalestage == 2)
                    774:     {
1.1.1.5 ! root      775:                //WriteDebug("F_Drawer() finalstage=2\n");
        !           776:                F_CastDrawer();
        !           777:                return;
1.1.1.3   root      778:     }
1.1.1.5 ! root      779:     
        !           780:        if (!finalestage)
1.1.1.3   root      781:        {
1.1.1.5 ! root      782:                //WriteDebug("F_Drawer() !finalstate");
        !           783:                F_TextWrite();
1.1.1.2   root      784:        }
1.1.1.5 ! root      785:     else
        !           786:     {
        !           787:                switch (gameepisode)
        !           788:                {
        !           789:                case 1:
        !           790:                        if ( gamemode == retail )
        !           791:                                //need that DOUBLESTUFF here too
        !           792:                                if(DOUBLESTUFF)
        !           793:                                        V_DrawPatchDouble( (SCREENWIDTH-640)/2, (SCREENHEIGHT-400)/2,0, W_CacheLumpName("CREDIT",PU_CACHE));
        !           794:                                else
        !           795:                                        V_DrawPatch( (SCREENWIDTH-320)/2, (SCREENHEIGHT-200)/2,0, W_CacheLumpName("CREDIT",PU_CACHE));
        !           796:                        else
        !           797:                                //need that DOUBLESTUFF here too
        !           798:                                if(DOUBLESTUFF)
        !           799:                                        V_DrawPatchDouble( (SCREENWIDTH-640)/2, (SCREENHEIGHT-400)/2,0, W_CacheLumpName("HELP2",PU_CACHE));
        !           800:                                else
        !           801:                                        V_DrawPatch( (SCREENWIDTH-320)/2, (SCREENHEIGHT-200)/2,0, W_CacheLumpName("HELP2",PU_CACHE));
        !           802:                                break;
        !           803:                case 2:
        !           804:                        //need that DOUBLESTUFF here too
        !           805:                        if(DOUBLESTUFF)
        !           806:                                V_DrawPatchDouble( (SCREENWIDTH-640)/2, (SCREENHEIGHT-400)/2,0, W_CacheLumpName("VICTORY2",PU_CACHE));
        !           807:                        else
        !           808:                                V_DrawPatch( (SCREENWIDTH-320)/2, (SCREENHEIGHT-200)/2,0, W_CacheLumpName("VICTORY2",PU_CACHE));
        !           809:                        break;
        !           810:                case 3:
        !           811:                        F_BunnyScroll ();
        !           812:                        break;
        !           813:                case 4:
        !           814:                        //need that DOUBLESTUFF here too
        !           815:                        if(DOUBLESTUFF)
        !           816:                                V_DrawPatchDouble( (SCREENWIDTH-640)/2, (SCREENHEIGHT-400)/2,0, W_CacheLumpName("ENDPIC",PU_CACHE));
        !           817:                        else
        !           818:                                V_DrawPatch( (SCREENWIDTH-320)/2, (SCREENHEIGHT-200)/2,0, W_CacheLumpName("ENDPIC",PU_CACHE));
        !           819:                        break;
        !           820:                }
        !           821:     }                  
1.1       root      822: }
1.1.1.3   root      823: 
                    824: 
1.1.1.5 ! root      825: // 10.14.98 dlw - wipegamestate wasn't working for doom ][ finale
        !           826: // prob cuz no page flipping anymore.  Rude snack way to do things...
        !           827: void F_TileBG(void)
        !           828: {
        !           829:     byte*      src;
        !           830:     byte*      dest;    
        !           831:     int                x,y;
        !           832:     // erase the entire screen to a tiled background
        !           833:     src = W_CacheLumpName ( finaleflat , PU_CACHE);
        !           834:     dest = screens[0];
        !           835:        
        !           836:     for (y = 0; y < SCREENHEIGHT; y++)
        !           837:        {
        !           838:         for (x = 0; x < SCREENWIDTH/64; x++)
        !           839:                {
        !           840:             memcpy (dest, src+((y&63)<<6), 64);
        !           841:             dest += 64;
        !           842:                }
        !           843:                if (SCREENWIDTH&63)
        !           844:                {
        !           845:                        memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
        !           846:                        dest += (SCREENWIDTH&63);
        !           847:                }
        !           848:        }
        !           849:     V_MarkRect(0, 0, SCREENWIDTH, SCREENHEIGHT);
        !           850: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.