int main(int argc, char *argv[]) { char *revdb_file = "revdb"; char *verdb_file = "verdb"; char *version_file = "VERSION"; char *output_file = "version.c"; char *build_file = ".build"; int i = 1, r; unsigned long summ = 0, oldsumm; int major, minor; int revsumm, patch; int enable_new_version = 0; int disable_patch_inc = 0; int has_norev = 0; int build; int use_cvs = 0; int do_not_commit_revdb = 0; if (argc == 1) report_usage(); while (1) { if (!strcmp(argv[i], "-r")) { if (++i >= argc) { fprintf(stderr, "option '-r' expects an argument\n"); exit(1); } revdb_file = argv[i++]; } else if (!strcmp(argv[i], "-d")) { if (++i >= argc) { fprintf(stderr, "option '-d' expects an argument\n"); exit(1); } verdb_file = argv[i++]; } else if (!strcmp(argv[i], "-v")) { if (++i >= argc) { fprintf(stderr, "option '-v' expects an argument\n"); exit(1); } version_file = argv[i++]; } else if (!strcmp(argv[i], "-V")) { if (++i >= argc) { fprintf(stderr, "option '-V' expects an argument\n"); exit(1); } version_file = 0; strcpy(major_version, argv[i++]); } else if (!strcmp(argv[i], "-b")) { if (++i >= argc) { fprintf(stderr, "option '-b' expects an argument\n"); exit(1); } build_file = argv[i++]; } else if (!strcmp(argv[i], "-P")) { if (++i >= argc) { fprintf(stderr, "option '-P' expects an argument\n"); exit(1); } variable_prefix = argv[i++]; } else if (!strcmp(argv[i], "-o")) { if (++i >= argc) { fprintf(stderr, "option '-o' expects an argument\n"); exit(1); } output_file = argv[i++]; } else if (!strcmp(argv[i], "-n")) { i++; enable_new_version = 1; } else if (!strcmp(argv[i], "-p")) { i++; disable_patch_inc = 1; } else if (!strcmp(argv[i], "-C")) { i++; use_cvs = 1; } else if (!strcmp(argv[i], "-S")) { i++; svn_mode = 1; } else if (!strcmp(argv[i], "-x")) { i++; do_not_commit_revdb = 1; } else { break; } } if (i >= argc) report_usage(); if (getenv("REVINFO_NO_COMMIT")) do_not_commit_revdb = 1; if (version_file) read_version(version_file); read_revdb(revdb_file); read_verdb(verdb_file); for (; i < argc; i++) { r = scan_file(argv[i], &major, &minor, &summ); if (r < 0) return 1; /* FIXME: is it ok? */ if (r == 0) { /* no revision information */ add_files(argv[i], 0, 0, 1); has_norev = 1; } else { add_files(argv[i], major, minor, 0); r = lookup_revdb(argv[i], major, minor, &oldsumm); if (!r) { fprintf(stderr,"%s,v %d.%d not in database\n", argv[i], major, minor); add_revdb_entry(argv[i], major, minor, summ); revdb_updated = 1; } else { if (summ != oldsumm) { fprintf(stderr,"%s,v %d.%d is modified\n", argv[i], major, minor); has_modified = 1; } } } } /* scan for missing files */ for (i = 0; i < revdb_u; i++) { int j, max_major, max_minor, f_major, f_minor, f_norev; if (revdb[i].flag) continue; /* already seen */ revdb[i].flag = 1; max_major = revdb[i].major; max_minor = revdb[i].minor; for (j = i + 1; j < revdb_u; j++) { if (revdb[j].flag) continue; if (strcmp(revdb[i].file, revdb[j].file)) continue; revdb[j].flag = 1; if (revdb[j].major > max_major) { max_major = revdb[j].major; max_minor = revdb[j].minor; } else if (revdb[j].major == max_major && revdb[j].minor > max_minor) { max_minor = revdb[j].minor; } } if (!lookup_files(revdb[i].file, &f_major, &f_minor, &f_norev)) { fprintf(stderr, "%s,v %d.%d deleted?\n", revdb[i].file, max_major, max_minor); //return 1; /* FIXME */ } else { if (f_norev) { fprintf(stderr, "%s,v %d.%d replaced with new file?\n", revdb[i].file, max_major, max_minor); return 1; /* FIXME */ } if (f_major < max_major || (f_major == max_major && f_minor < max_minor)) { fprintf(stderr, "%s,v %d.%d decreased revision number\n", revdb[i].file, max_major, max_minor); return 1; /* FIXME */ } } } /* calculate revision summ */ if (svn_mode) { revsumm = -1; for (i = 0; i < files_u; i++) { if (!files[i].norev && revsumm < files[i].major) revsumm = files[i].major; } if (revdb_major > revsumm) revsumm = revdb_major; printf("max revision: %d\n", revsumm); } else { revsumm = 0; for (i = 0; i < files_u; i++) { if (files[i].norev) { /*revsumm++;*/ } else revsumm += files[i].major + files[i].minor; } printf("revision summ: %d\n", revsumm); } if (!lookup_verdb(major_version, revsumm, &patch) && patch == -1 && !enable_new_version) { strcat(major_version, "pre"); enable_new_version = 1; } if (!lookup_verdb(major_version, revsumm, &patch)) { /* no version corresponds to the given revsumm */ if (patch == -1) { /* don't even have this major */ if (has_modified || has_norev || disable_patch_inc) { /* probably we're in preparation for new version */ /* delay new version until files are checked in */ read_build(build_file, &build); build++; write_build(build_file, build); sprintf(version_string, "<new version> #%d", build); } else { patch = first_patch(major_version); add_verdb(major_version, patch, revsumm, time(0)); verdb_updated = 1; write_build(build_file, 0); make_full_version(major_version, patch); sprintf(version_string, "%s", full_version); } } else { if (!has_modified && !has_norev && disable_patch_inc && use_cvs && svn_mode) { write_build(build_file, 0); make_full_version(major_version, patch); sprintf(version_string, "%s+ (SVN r%d)", full_version, revsumm); } else if ((has_modified || has_norev) && disable_patch_inc && use_cvs && svn_mode) { read_build(build_file, &build); build++; write_build(build_file, build); make_full_version(major_version, patch); sprintf(version_string, "%s+ (SVN r%d) #%d", full_version, revsumm, build); } else if (has_modified || has_norev || disable_patch_inc) { read_build(build_file, &build); build++; write_build(build_file, build); make_full_version(major_version, patch); sprintf(version_string, "%s #%d", full_version, build); } else { /* increase a minor */ patch++; add_verdb(major_version, patch, revsumm, time(0)); verdb_updated = 1; write_build(build_file, 0); make_full_version(major_version, patch); sprintf(version_string, "%s", full_version); } } } else { if (has_modified || has_norev) { /* a modified version */ read_build(build_file, &build); build++; write_build(build_file, build); make_full_version(major_version, patch); sprintf(version_string, "%s #%d", full_version, build); } else { /* got stock version */ make_full_version(major_version, patch); sprintf(version_string, "%s", full_version); } } write_output(output_file); if (revdb_updated) { write_revdb(revdb_file); if (use_cvs && !do_not_commit_revdb) { if (svn_mode) { sprintf(cmdline, "svn ci -m \"\" %s", revdb_file); } else { sprintf(cmdline, "cvs ci -m \"\" %s", revdb_file); } printf("doing: %s\n", cmdline); system(cmdline); } } if (verdb_updated) { write_verdb(verdb_file); if (use_cvs) { if (svn_mode) { sprintf(cmdline, "svn ci -m \"\" %s", verdb_file); } else { sprintf(cmdline, "cvs ci -m \"\" %s", verdb_file); } printf("doing: %s\n", cmdline); system(cmdline); } } return 0; }
// killough 2/28/98: // // This function, with the help of r_plane.c and r_bsp.c, supports generalized // scrolling floors and walls, with optional mobj-carrying properties, e.g. // conveyor belts, rivers, etc. A linedef with a special type affects all // tagged sectors the same way, by creating scrolling and/or object-carrying // properties. Multiple linedefs may be used on the same sector and are // cumulative, although the special case of scrolling a floor and carrying // things on it, requires only one linedef. The linedef's direction determines // the scrolling direction, and the linedef's length determines the scrolling // speed. This was designed so that an edge around the sector could be used to // control the direction of the sector's scrolling, which is usually what is // desired. // // Process the active scrollers. // // This is the main scrolling code // killough 3/7/98 // void ScrollThinker::Think() { fixed_t dx = this->dx, dy = this->dy; if(this->control != -1) { // compute scroll amounts based on a sector's height changes fixed_t height = sectors[this->control].floorheight + sectors[this->control].ceilingheight; fixed_t delta = height - this->last_height; this->last_height = height; dx = FixedMul(dx, delta); dy = FixedMul(dy, delta); } // killough 3/14/98: Add acceleration if(this->accel) { this->vdx = dx += this->vdx; this->vdy = dy += this->vdy; } if(!(dx | dy)) // no-op if both (x,y) offsets 0 return; side_t *side; sector_t *sec; fixed_t height, waterheight; // killough 4/4/98: add waterheight msecnode_t *node; Mobj *thing; switch(this->type) { case ScrollThinker::sc_side: // killough 3/7/98: Scroll wall texture side = sides + this->affectee; side->textureoffset += dx; side->rowoffset += dy; break; case ScrollThinker::sc_floor: // killough 3/7/98: Scroll floor texture sec = sectors + this->affectee; sec->floor_xoffs += dx; sec->floor_yoffs += dy; break; case ScrollThinker::sc_ceiling: // killough 3/7/98: Scroll ceiling texture sec = sectors + this->affectee; sec->ceiling_xoffs += dx; sec->ceiling_yoffs += dy; break; case ScrollThinker::sc_carry: // killough 3/7/98: Carry things on floor // killough 3/20/98: use new sector list which reflects true members // killough 3/27/98: fix carrier bug // killough 4/4/98: Underwater, carry things even w/o gravity sec = sectors + this->affectee; height = sec->floorheight; waterheight = sec->heightsec != -1 && sectors[sec->heightsec].floorheight > height ? sectors[sec->heightsec].floorheight : D_MININT; // Move objects only if on floor or underwater, // non-floating, and clipped. // haleyjd: added much-needed MF2_NOTHRUST flag to make some // objects unmoveable by sector effects for(node = sec->touching_thinglist; node; node = node->m_snext) { // ioanch 20160115: portal aware if(useportalgroups && full_demo_version >= make_full_version(340, 48) && !P_SectorTouchesThingVertically(sec, node->m_thing)) { continue; } if(!((thing = node->m_thing)->flags & MF_NOCLIP) && !(thing->flags2 & MF2_NOTHRUST) && (!(thing->flags & MF_NOGRAVITY || thing->z > height) || thing->z < waterheight)) { thing->momx += dx; thing->momy += dy; } } break; case ScrollThinker::sc_carry_ceiling: // to be added later break; } }
// // EV_VerticalDoor // // Handle opening a door manually, no tag value // // Passed the line activating the door and the thing activating it // Returns true if a thinker created // // jff 2/12/98 added int return value, fixed all returns // int EV_VerticalDoor(line_t *line, const Mobj *thing, int lockID) { player_t *player = thing ? thing->player : nullptr; sector_t *sec; VerticalDoorThinker *door; SectorThinker *secThinker; // Check for locks if(lockID) { if(!player) return 0; if(!E_PlayerCanUnlock(player, lockID, false)) return 0; } // if the wrong side of door is pushed, give oof sound if(line->sidenum[1] == -1) // killough { if(player) S_StartSound(player->mo, GameModeInfo->playerSounds[sk_oof]); // killough 3/20/98 return 0; } // get the sector on the second side of activating linedef sec = sides[line->sidenum[1]].sector; // haleyjd: adapted cph's prboom fix for demo compatibility and // corruption of thinkers // Two bugs: // 1. DOOM used any thinker that was on a door // 2. DOOM assumed the thinker was a T_VerticalDoor thinker, and // this bug was even still in Eternity -- fixed when not in // demo_compatibility (only VerticalDoorThinker::reTriggerVerticalDoor // will actually do anything outside of demo_compatibility mode) secThinker = thinker_cast<SectorThinker *>(sec->ceilingdata); // exactly only one at most of these pointers is valid during demo_compatibility if(demo_compatibility) { if(!secThinker) secThinker = thinker_cast<SectorThinker *>(sec->floordata); if(!secThinker) secThinker = thinker_cast<SectorThinker *>(sec->lightingdata); } // if door already has a thinker, use it if(secThinker) { switch(line->special) { case 1: // only for "raise" doors, not "open"s case 26: case 27: case 28: case 117: return secThinker->reTriggerVerticalDoor(thing && thing->player); } // haleyjd 01/22/12: never start multiple thinkers on a door sector. // This bug has been here since the beginning, and got especially bad // in Strife. In Vanilla DOOM, door types 31-34 and 118 can fall through // here and cause the sector to become jammed as multiple thinkers fight // for control. if(full_demo_version >= make_full_version(340, 22)) return 0; // sector is busy. } // emit proper sound switch(line->special) { case 117: // blazing door raise case 118: // blazing door open P_DoorSequence(true, true, false, sec); // haleyjd break; default: // normal door sound P_DoorSequence(true, false, false, sec); // haleyjd break; } // new door thinker door = new VerticalDoorThinker; door->addThinker(); sec->ceilingdata = door; //jff 2/22/98 door->sector = sec; door->direction = plat_up; door->speed = VDOORSPEED; door->turbo = false; door->topwait = VDOORWAIT; // killough 10/98: use gradual lighting changes if nonzero tag given door->lighttag = comp[comp_doorlight] ? 0 : line->args[0]; // killough 10/98 // set the type of door from the activating linedef type switch(line->special) { case 1: case 26: case 27: case 28: door->type = doorNormal; break; case 31: case 32: case 33: case 34: door->type = doorOpen; line->special = 0; break; case 117: // blazing door raise door->type = blazeRaise; door->speed = VDOORSPEED*4; door->turbo = true; break; case 118: // blazing door open door->type = blazeOpen; line->special = 0; door->speed = VDOORSPEED*4; door->turbo = true; break; default: door->lighttag = 0; // killough 10/98 break; } // find the top and bottom of the movement range door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; return 1; }