Difference between revisions of "Moving platforms limit"

From DoomWiki.org

[checked revision][checked revision]
(correct message)
m (list of relevant line types)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Doom contains a limit on the number of platforms which can be moving simultaneously.  A platform is defined as a sector with a moving floor.  The limit in [[Vanilla Doom]] is 30. If the platform limit is exceeded, the game quits with the message "P_AddActivePlat: No more plats!".
+
Doom contains a limit on the number of platforms which can be moving simultaneously.  A platform is defined as a sector with a moving floor.  The limit in [[vanilla Doom]] is 30. If the platform limit is exceeded, the game quits with the message "P_AddActivePlat: No more plats!".
 +
 
 +
This concerns [[line type]]s 10, 14, 15, 20, 21, 22, 47, 53, 62, 66, 67, 68, 87, 88, 95, 120, 121, 122 and 123 of vanilla Doom: the proper lifts as well as the other generic floor changes (with or without texture changes). Crushers, stairs, donuts and doors do not count against this limit, even if they change the floors.
  
 
A simple way to deliberately trigger this error is to create a [[linedef]] to trigger a [[Linedef types |moving floor]].  If the linedef is given no tag (ie. a tag of 0), triggering it will attempt to cause every untagged sector in the level to start moving.  On any reasonably sized level this will cause the limit to be exceeded.
 
A simple way to deliberately trigger this error is to create a [[linedef]] to trigger a [[Linedef types |moving floor]].  If the linedef is given no tag (ie. a tag of 0), triggering it will attempt to cause every untagged sector in the level to start moving.  On any reasonably sized level this will cause the limit to be exceeded.
Line 9: Line 11:
 
  #define MAXPLATS              30
 
  #define MAXPLATS              30
  
The code responsible for the limit is found in p_plats.c. Specifically, there is an array with a static length array which depends on the limit:
+
The code responsible for the limit is found in p_plats.c. Specifically, there is a static length array which depends on the limit:
  
 
  plat_t*        activeplats[MAXPLATS];
 
  plat_t*        activeplats[MAXPLATS];

Latest revision as of 15:52, 11 January 2019

Doom contains a limit on the number of platforms which can be moving simultaneously. A platform is defined as a sector with a moving floor. The limit in vanilla Doom is 30. If the platform limit is exceeded, the game quits with the message "P_AddActivePlat: No more plats!".

This concerns line types 10, 14, 15, 20, 21, 22, 47, 53, 62, 66, 67, 68, 87, 88, 95, 120, 121, 122 and 123 of vanilla Doom: the proper lifts as well as the other generic floor changes (with or without texture changes). Crushers, stairs, donuts and doors do not count against this limit, even if they change the floors.

A simple way to deliberately trigger this error is to create a linedef to trigger a moving floor. If the linedef is given no tag (ie. a tag of 0), triggering it will attempt to cause every untagged sector in the level to start moving. On any reasonably sized level this will cause the limit to be exceeded.

Technical[edit]

The limit itself is found in p_spec.h:

#define MAXPLATS               30

The code responsible for the limit is found in p_plats.c. Specifically, there is a static length array which depends on the limit:

plat_t*         activeplats[MAXPLATS];

The function P_AddActivePlat searches the array to find a new slot in order to store the information about the new platform. If none is found, the program exits with an error:

void P_AddActivePlat(plat_t* plat)
{
    int         i;

    for (i = 0;i < MAXPLATS;i++)
        if (activeplats[i] == NULL)
        {
            activeplats[i] = plat;
            return;
        }
    I_Error ("P_AddActivePlat: no more plats!");
}