Subversion Repositories eduke32

Rev

Rev 3645 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3645 Rev 3803
Line 89... Line 89...
89
    { CON_INCLUDEDEFAULT, 20110615 },
89
    { CON_INCLUDEDEFAULT, 20110615 },
90
    { CON_SETACTORSOUNDPITCH, 20111102 },
90
    { CON_SETACTORSOUNDPITCH, 20111102 },
91
    { CON_ECHO, 20120304 },
91
    { CON_ECHO, 20120304 },
92
    { CON_SHOWVIEWUNBIASED, 20120331 },
92
    { CON_SHOWVIEWUNBIASED, 20120331 },
93
    { CON_ROTATESPRITEA, 20130324 },
93
    { CON_ROTATESPRITEA, 20130324 },
-
 
94
    { CON_SHADETO, 20130522 },
-
 
95
    { CON_ENDOFLEVEL, 20130522 },
-
 
96
    { CON_IFPLAYERSL, 20130522 },
-
 
97
    { CON_ACTIVATE, 20130522 },
94
};
98
};
95
#endif
99
#endif
96
100
97
char g_szScriptFileName[BMAX_PATH] = "(none)";  // file we're currently compiling
101
char g_szScriptFileName[BMAX_PATH] = "(none)";  // file we're currently compiling
98
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
102
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
Line 576... Line 580...
576
    "includedefault",           // 360
580
    "includedefault",           // 360
577
    "setactorsoundpitch",       // 361
581
    "setactorsoundpitch",       // 361
578
    "echo",                     // 362
582
    "echo",                     // 362
579
    "showviewunbiased",         // 363
583
    "showviewunbiased",         // 363
580
    "rotatespritea",            // 364
584
    "rotatespritea",            // 364
-
 
585
    "shadeto",                  // 365
-
 
586
    "endoflevel",               // 366
-
 
587
    "ifplayersl",               // 367
-
 
588
    "activate",                 // 368
581
    "<null>"
589
    "<null>"
582
};
590
};
583
#endif
591
#endif
584
592
585
// KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua
593
// KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua
Line 2079... Line 2087...
2079
    ud.const_visibility = params[j++];
2087
    ud.const_visibility = params[j++];
2080
    g_impactDamage = params[j++];
2088
    g_impactDamage = params[j++];
2081
    g_maxPlayerHealth = g_player[0].ps->max_player_health = g_player[0].ps->max_shield_amount = params[j++];
2089
    g_maxPlayerHealth = g_player[0].ps->max_player_health = g_player[0].ps->max_shield_amount = params[j++];
2082
    g_startArmorAmount = params[j++];
2090
    g_startArmorAmount = params[j++];
2083
    g_actorRespawnTime = params[j++];
2091
    g_actorRespawnTime = params[j++];
-
 
2092
-
 
2093
    if (g_scriptVersion >= 11)
2084
    g_itemRespawnTime = params[j++];
2094
        g_itemRespawnTime = params[j++];
-
 
2095
    else
-
 
2096
        g_itemRespawnTime = g_actorRespawnTime;
-
 
2097
-
 
2098
    if (g_scriptVersion >= 11)
2085
    g_playerFriction = params[j++];
2099
        g_playerFriction = params[j++];
-
 
2100
-
 
2101
    if (g_scriptVersion == 14)
2086
    if (g_scriptVersion == 14) g_spriteGravity = params[j++];
2102
        g_spriteGravity = params[j++];
-
 
2103
-
 
2104
    if (g_scriptVersion >= 11)
-
 
2105
    {
2087
    g_rpgBlastRadius = params[j++];
2106
        g_rpgBlastRadius = params[j++];
2088
    g_pipebombBlastRadius = params[j++];
2107
        g_pipebombBlastRadius = params[j++];
2089
    g_shrinkerBlastRadius = params[j++];
2108
        g_shrinkerBlastRadius = params[j++];
2090
    g_tripbombBlastRadius = params[j++];
2109
        g_tripbombBlastRadius = params[j++];
2091
    g_morterBlastRadius = params[j++];
2110
        g_morterBlastRadius = params[j++];
2092
    g_bouncemineBlastRadius = params[j++];
2111
        g_bouncemineBlastRadius = params[j++];
2093
    g_seenineBlastRadius = params[j++];
2112
        g_seenineBlastRadius = params[j++];
-
 
2113
    }
-
 
2114
2094
    g_player[0].ps->max_ammo_amount[PISTOL_WEAPON] = params[j++];
2115
    g_player[0].ps->max_ammo_amount[PISTOL_WEAPON] = params[j++];
2095
    g_player[0].ps->max_ammo_amount[SHOTGUN_WEAPON] = params[j++];
2116
    g_player[0].ps->max_ammo_amount[SHOTGUN_WEAPON] = params[j++];
2096
    g_player[0].ps->max_ammo_amount[CHAINGUN_WEAPON] = params[j++];
2117
    g_player[0].ps->max_ammo_amount[CHAINGUN_WEAPON] = params[j++];
2097
    g_player[0].ps->max_ammo_amount[RPG_WEAPON] = params[j++];
2118
    g_player[0].ps->max_ammo_amount[RPG_WEAPON] = params[j++];
2098
    g_player[0].ps->max_ammo_amount[HANDBOMB_WEAPON] = params[j++];
2119
    g_player[0].ps->max_ammo_amount[HANDBOMB_WEAPON] = params[j++];
2099
    g_player[0].ps->max_ammo_amount[SHRINKER_WEAPON] = params[j++];
2120
    g_player[0].ps->max_ammo_amount[SHRINKER_WEAPON] = params[j++];
2100
    g_player[0].ps->max_ammo_amount[DEVISTATOR_WEAPON] = params[j++];
2121
    g_player[0].ps->max_ammo_amount[DEVISTATOR_WEAPON] = params[j++];
2101
    g_player[0].ps->max_ammo_amount[TRIPBOMB_WEAPON] = params[j++];
2122
    g_player[0].ps->max_ammo_amount[TRIPBOMB_WEAPON] = params[j++];
-
 
2123
-
 
2124
    if (g_scriptVersion >= 13)
-
 
2125
    {
2102
    g_player[0].ps->max_ammo_amount[FREEZE_WEAPON] = params[j++];
2126
        g_player[0].ps->max_ammo_amount[FREEZE_WEAPON] = params[j++];
-
 
2127
-
 
2128
        if (g_scriptVersion == 14)
2103
    if (g_scriptVersion == 14) g_player[0].ps->max_ammo_amount[GROW_WEAPON] = params[j++];
2129
            g_player[0].ps->max_ammo_amount[GROW_WEAPON] = params[j++];
-
 
2130
2104
    g_damageCameras = params[j++];
2131
        g_damageCameras = params[j++];
2105
    g_numFreezeBounces = params[j++];
2132
        g_numFreezeBounces = params[j++];
2106
    g_freezerSelfDamage = params[j++];
2133
        g_freezerSelfDamage = params[j++];
-
 
2134
2107
    if (g_scriptVersion == 14)
2135
        if (g_scriptVersion == 14)
2108
    {
2136
        {
2109
        g_spriteDeleteQueueSize = params[j++];
2137
            g_spriteDeleteQueueSize = params[j++];
2110
        g_spriteDeleteQueueSize = clamp(g_spriteDeleteQueueSize, 0, 1024);
2138
            g_spriteDeleteQueueSize = clamp(g_spriteDeleteQueueSize, 0, 1024);
2111
2139
2112
        g_tripbombLaserMode = params[j++];
2140
            g_tripbombLaserMode = params[j++];
2113
    }
2141
        }
2114
}
2142
    }
-
 
2143
}
2115
2144
2116
#ifdef LUNATIC
2145
#ifdef LUNATIC
2117
void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5])
2146
void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5])
2118
{
2147
{
2119
    Bassert((unsigned)sndidx < MAXSOUNDS);
2148
    Bassert((unsigned)sndidx < MAXSOUNDS);
Line 2757... Line 2786...
2757
            }
2786
            }
2758
2787
2759
            while (j>-1)
2788
            while (j>-1)
2760
            {
2789
            {
2761
                bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
2790
                bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
2762
                *g_scriptPtr = 0;
2791
                *g_scriptPtr++ = 0;
2763
                g_scriptPtr++;
-
 
2764
                j--;
2792
                j--;
2765
            }
2793
            }
2766
            continue;
2794
            continue;
2767
2795
2768
        case CON_MOVE:
2796
        case CON_MOVE:
Line 3255... Line 3283...
3255
        case CON_ADDPHEALTH:
3283
        case CON_ADDPHEALTH:
3256
        case CON_SPAWN:
3284
        case CON_SPAWN:
3257
        case CON_CSTAT:
3285
        case CON_CSTAT:
3258
        case CON_COUNT:
3286
        case CON_COUNT:
3259
        case CON_ENDOFGAME:
3287
        case CON_ENDOFGAME:
-
 
3288
        case CON_ENDOFLEVEL:
3260
        case CON_SPRITEPAL:
3289
        case CON_SPRITEPAL:
3261
        case CON_CACTOR:
3290
        case CON_CACTOR:
3262
        case CON_MONEY:
3291
        case CON_MONEY:
3263
        case CON_ADDKILLS:
3292
        case CON_ADDKILLS:
3264
        case CON_DEBUG:
3293
        case CON_DEBUG:
Line 4359... Line 4388...
4359
                    g_numCompilerWarnings++;
4388
                    g_numCompilerWarnings++;
4360
                }
4389
                }
4361
            }
4390
            }
4362
            continue;
4391
            continue;
4363
4392
-
 
4393
        case CON_ACTIVATE:
-
 
4394
            *g_scriptPtr = CON_OPERATEACTIVATORS;
-
 
4395
            C_GetNextValue(LABEL_DEFINE);
-
 
4396
            *g_scriptPtr++ = g_iThisActorID;
-
 
4397
            continue;
-
 
4398
4364
        case CON_DRAGPOINT:
4399
        case CON_DRAGPOINT:
4365
        case CON_GETKEYNAME:
4400
        case CON_GETKEYNAME:
4366
            C_GetManyVars(3);
4401
            C_GetManyVars(3);
4367
            continue;
4402
            continue;
4368
4403
Line 5059... Line 5094...
5059
        case CON_IFAI:
5094
        case CON_IFAI:
5060
        case CON_IFACTION:
5095
        case CON_IFACTION:
5061
        case CON_IFMOVE:
5096
        case CON_IFMOVE:
5062
        case CON_IFP:
5097
        case CON_IFP:
5063
        case CON_IFPINVENTORY:
5098
        case CON_IFPINVENTORY:
-
 
5099
        case CON_IFPLAYERSL:
5064
            {
5100
            {
5065
                intptr_t offset;
5101
                intptr_t offset;
5066
                intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1);
5102
                intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1);
5067
5103
5068
                g_ifElseAborted = 0;
5104
                g_ifElseAborted = 0;
Line 5586... Line 5622...
5586
                (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
5622
                (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
5587
5623
5588
            textptr += 5;
5624
            textptr += 5;
5589
            while (*textptr == ' '  || *textptr == '\t') textptr++;
5625
            while (*textptr == ' '  || *textptr == '\t') textptr++;
5590
5626
-
 
5627
            // cheap hack, 0.99 doesn't have the 3D Realms time
-
 
5628
            if (*(textptr+2) == ':')
-
 
5629
            {
5591
            MapInfo[j *MAXLEVELS+k].designertime =
5630
                MapInfo[j *MAXLEVELS+k].designertime =
5592
                (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
5631
                    (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
5593
                (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
5632
                    (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
5594
5633
5595
            textptr += 5;
5634
                textptr += 5;
5596
            while (*textptr == ' '  || *textptr == '\t') textptr++;
5635
                while (*textptr == ' '  || *textptr == '\t') textptr++;
-
 
5636
            }
-
 
5637
            else g_scriptVersion = 9;
5597
5638
5598
            i = 0;
5639
            i = 0;
5599
5640
5600
            while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
5641
            while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
5601
            {
5642
            {
Line 5888... Line 5929...
5888
            g_scriptPtr--;
5929
            g_scriptPtr--;
5889
            C_SkipComments();
5930
            C_SkipComments();
5890
            if (C_SetScriptSize(j)) return 1;
5931
            if (C_SetScriptSize(j)) return 1;
5891
            continue;
5932
            continue;
5892
5933
-
 
5934
        case CON_SHADETO:
-
 
5935
            g_scriptPtr--;
-
 
5936
            C_GetNextValue(LABEL_DEFINE);
-
 
5937
            g_scriptPtr--;
-
 
5938
            continue;
-
 
5939
5893
        case CON_FALL:
5940
        case CON_FALL:
5894
        case CON_TIP:
5941
        case CON_TIP:
5895
            //        case 21:
5942
            //        case 21:
5896
        case CON_KILLIT:
5943
        case CON_KILLIT:
5897
        case CON_RESETACTIONCOUNT:
5944
        case CON_RESETACTIONCOUNT:
Line 5928... Line 5975...
5928
                {
5975
                {
5929
                    C_GetNextValue(LABEL_DEFINE);
5976
                    C_GetNextValue(LABEL_DEFINE);
5930
                    g_scriptPtr--;
5977
                    g_scriptPtr--;
5931
                    params[j] = *g_scriptPtr;
5978
                    params[j] = *g_scriptPtr;
5932
5979
5933
                    if (j != 25) continue;
5980
                    if (j != 12 && j != 21 && j != 25) continue;
5934
5981
5935
                    if (C_GetKeyword() != -1)
5982
                    if (C_GetKeyword() != -1)
5936
                    {
5983
                    {
-
 
5984
                        if (j == 12)
-
 
5985
                            g_scriptVersion = 10;
-
 
5986
                        else if (j == 21)
5937
                        //                initprintf("Duke Nukem 3D v1.3D style CON files detected.\n");
5987
                            g_scriptVersion = 11;
5938
                        break;
5988
                        break;
5939
                    }
5989
                    }
5940
                    else
5990
                    else
5941
                    {
-
 
5942
                        g_scriptVersion = 14;
5991
                        g_scriptVersion = 14;
5943
                        //                initprintf("Duke Nukem 3D v1.4+ style CON files detected.\n");
-
 
5944
                    }
-
 
5945
-
 
5946
                }
5992
                }
5947
5993
5948
                /*
5994
                /*
5949
                v1.3d                   v1.5
5995
                v1.3d                   v1.5
5950
                DEFAULTVISIBILITY       DEFAULTVISIBILITY
5996
                DEFAULTVISIBILITY       DEFAULTVISIBILITY
Line 6128... Line 6174...
6128
6174
6129
#if !defined LUNATIC
6175
#if !defined LUNATIC
6130
extern int32_t g_numObituaries;
6176
extern int32_t g_numObituaries;
6131
extern int32_t g_numSelfObituaries;
6177
extern int32_t g_numSelfObituaries;
6132
6178
-
 
6179
static char * C_ScriptVersionString(int32_t version)
-
 
6180
{
-
 
6181
    switch (version)
-
 
6182
    {
-
 
6183
    case 9:
-
 
6184
        return "0.99";
-
 
6185
    case 10:
-
 
6186
        return "1.0";
-
 
6187
    case 11:
-
 
6188
        return "1.1";
-
 
6189
    case 13:
-
 
6190
        return "1.3D";
-
 
6191
    default:
-
 
6192
        return "1.4+";
-
 
6193
    }
-
 
6194
}
-
 
6195
6133
void C_Compile(const char *filenam)
6196
void C_Compile(const char *filenam)
6134
{
6197
{
6135
    char *mptr;
6198
    char *mptr;
6136
    int32_t i;
6199
    int32_t i;
6137
    int32_t fs,fp;
6200
    int32_t fs,fp;
Line 6313... Line 6376...
6313
6376
6314
        g_totalLines += g_lineNumber;
6377
        g_totalLines += g_lineNumber;
6315
6378
6316
        C_SetScriptSize(g_scriptPtr-script+8);
6379
        C_SetScriptSize(g_scriptPtr-script+8);
6317
6380
6318
        initprintf("Script compiled in %dms, %ld*%db, version %s\n", getticks() - startcompiletime,
6381
        initprintf("Script compiled in %dms, %ld*%db, language version %s\n", getticks() - startcompiletime,
6319
                   (unsigned long)(g_scriptPtr-script), (int32_t)sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D"));
6382
                   (unsigned long)(g_scriptPtr-script), (int32_t)sizeof(intptr_t), C_ScriptVersionString(g_scriptVersion));
6320
6383
6321
        initprintf("%d/%d labels, %d/%d variables, %d/%d arrays\n", g_numLabels,
6384
        initprintf("%d/%d labels, %d/%d variables, %d/%d arrays\n", g_numLabels,
6322
                   (int32_t)min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)),
6385
                   (int32_t)min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)),
6323
                                MAXSPRITES * sizeof(spritetype)/(1<<6)),
6386
                                MAXSPRITES * sizeof(spritetype)/(1<<6)),
6324
                   g_gameVarCount, MAXGAMEVARS, g_gameArrayCount, MAXGAMEARRAYS);
6387
                   g_gameVarCount, MAXGAMEVARS, g_gameArrayCount, MAXGAMEARRAYS);