2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Functions for sizing segments
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "inferno.h"
|
|
|
|
#include "editor.h"
|
2013-03-16 03:10:55 +00:00
|
|
|
#include "editor/esegment.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "gameseg.h"
|
2012-11-17 06:14:09 +00:00
|
|
|
#include "kdefs.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-08-12 03:09:32 +00:00
|
|
|
#include "compiler-range_for.h"
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
#define XDIM 0
|
|
|
|
#define YDIM 1
|
|
|
|
#define ZDIM 2
|
|
|
|
|
|
|
|
#define MAX_MODIFIED_VERTICES 32
|
2015-08-12 03:11:46 +00:00
|
|
|
static array<int, MAX_MODIFIED_VERTICES> Modified_vertices;
|
2006-03-20 17:12:09 +00:00
|
|
|
int Modified_vertex_index = 0;
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
// ------------------------------------------------------------------------------------------
|
2013-10-27 22:00:14 +00:00
|
|
|
static void validate_modified_segments(void)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2014-09-26 02:42:11 +00:00
|
|
|
int v0;
|
2014-08-12 03:09:32 +00:00
|
|
|
visited_segment_bitarray_t modified_segments;
|
2014-09-26 02:42:11 +00:00
|
|
|
for (int v=0; v<Modified_vertex_index; v++) {
|
2006-03-20 17:12:09 +00:00
|
|
|
v0 = Modified_vertices[v];
|
|
|
|
|
2017-06-10 03:31:02 +00:00
|
|
|
range_for (const auto &&segp, vmsegptridx)
|
2014-10-12 23:10:05 +00:00
|
|
|
{
|
2015-06-13 22:42:17 +00:00
|
|
|
if (segp->segnum != segment_none)
|
2014-08-12 03:09:32 +00:00
|
|
|
{
|
2015-12-22 04:18:51 +00:00
|
|
|
if (modified_segments[segp])
|
2014-08-12 03:09:32 +00:00
|
|
|
continue;
|
2015-06-13 22:42:17 +00:00
|
|
|
range_for (const auto w, segp->verts)
|
2014-08-12 03:09:32 +00:00
|
|
|
if (w == v0)
|
|
|
|
{
|
2015-12-22 04:18:51 +00:00
|
|
|
modified_segments[segp] = true;
|
2018-09-19 02:13:30 +00:00
|
|
|
validate_segment(vcvertptr, segp);
|
2014-08-12 03:09:32 +00:00
|
|
|
for (unsigned s=0; s<MAX_SIDES_PER_SEGMENT; s++) {
|
|
|
|
Num_tilings = 1;
|
2015-06-13 22:42:17 +00:00
|
|
|
assign_default_uvs_to_side(segp, s);
|
2014-08-12 03:09:32 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-12 03:09:32 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
|
|
|
// Scale vertex *vertp by vector *vp, scaled by scale factor scale_factor
|
2017-02-19 19:33:38 +00:00
|
|
|
static void scale_vert_aux(const unsigned vertex_ind, const vms_vector &vp, const fix scale_factor)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2017-08-11 23:43:54 +00:00
|
|
|
auto &vertp = *vmvertptr(vertex_ind);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-11-01 03:14:14 +00:00
|
|
|
vertp.x += fixmul(vp.x,scale_factor)/2;
|
|
|
|
vertp.y += fixmul(vp.y,scale_factor)/2;
|
|
|
|
vertp.z += fixmul(vp.z,scale_factor)/2;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
Assert(Modified_vertex_index < MAX_MODIFIED_VERTICES);
|
|
|
|
Modified_vertices[Modified_vertex_index++] = vertex_ind;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
2018-09-19 02:13:29 +00:00
|
|
|
static void scale_vert(const shared_segment &sp, const unsigned vertex_ind, const vms_vector &vp, const fix scale_factor)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2018-09-19 02:13:29 +00:00
|
|
|
auto &verts = sp.verts;
|
2006-03-20 17:12:09 +00:00
|
|
|
switch (SegSizeMode) {
|
|
|
|
case SEGSIZEMODE_FREE:
|
|
|
|
if (is_free_vertex(vertex_ind))
|
|
|
|
scale_vert_aux(vertex_ind, vp, scale_factor);
|
|
|
|
break;
|
|
|
|
case SEGSIZEMODE_ALL:
|
|
|
|
scale_vert_aux(vertex_ind, vp, scale_factor);
|
|
|
|
break;
|
|
|
|
case SEGSIZEMODE_CURSIDE: {
|
2015-02-14 22:48:27 +00:00
|
|
|
range_for (const auto v, Side_to_verts[Curside])
|
2018-09-19 02:13:29 +00:00
|
|
|
if (verts[v] == vertex_ind)
|
2006-03-20 17:12:09 +00:00
|
|
|
scale_vert_aux(vertex_ind, vp, scale_factor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEGSIZEMODE_EDGE: {
|
2014-09-26 02:42:11 +00:00
|
|
|
for (int v=0; v<2; v++)
|
2018-09-19 02:13:29 +00:00
|
|
|
if (verts[Side_to_verts[Curside][(Curedge+v)%4]] == vertex_ind)
|
2006-03-20 17:12:09 +00:00
|
|
|
scale_vert_aux(vertex_ind, vp, scale_factor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEGSIZEMODE_VERTEX:
|
2018-09-19 02:13:29 +00:00
|
|
|
if (verts[Side_to_verts[Curside][Curvert]] == vertex_ind)
|
2006-03-20 17:12:09 +00:00
|
|
|
scale_vert_aux(vertex_ind, vp, scale_factor);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Error("Unsupported SegSizeMode in ksegsize.c/scale_vert = %i\n", SegSizeMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
2017-06-10 03:31:02 +00:00
|
|
|
static void scale_free_verts(const vmsegptr_t sp, const vms_vector &vp, int side, fix scale_factor)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int vertex_ind;
|
2014-11-01 03:14:14 +00:00
|
|
|
range_for (auto &v, Side_to_verts[side])
|
|
|
|
{
|
|
|
|
vertex_ind = sp->verts[v];
|
2006-03-20 17:12:09 +00:00
|
|
|
if (SegSizeMode || is_free_vertex(vertex_ind))
|
|
|
|
scale_vert(sp, vertex_ind, vp, scale_factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Make segment *sp bigger in dimension dimension by amount amount.
|
2017-06-10 03:31:02 +00:00
|
|
|
static void med_scale_segment_new(const vmsegptr_t sp, int dimension, fix amount)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
vms_matrix mat;
|
|
|
|
|
|
|
|
Modified_vertex_index = 0;
|
|
|
|
|
2018-06-24 05:06:15 +00:00
|
|
|
med_extract_matrix_from_segment(sp, mat);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2017-03-10 01:22:24 +00:00
|
|
|
const vms_vector *vec;
|
|
|
|
unsigned side0, side1;
|
2006-03-20 17:12:09 +00:00
|
|
|
switch (dimension) {
|
|
|
|
case XDIM:
|
2017-03-10 01:22:24 +00:00
|
|
|
side0 = WLEFT;
|
|
|
|
side1 = WRIGHT;
|
|
|
|
vec = &mat.rvec;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case YDIM:
|
2017-03-10 01:22:24 +00:00
|
|
|
side0 = WBOTTOM;
|
|
|
|
side1 = WTOP;
|
|
|
|
vec = &mat.uvec;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case ZDIM:
|
2017-03-10 01:22:24 +00:00
|
|
|
side0 = WFRONT;
|
|
|
|
side1 = WBACK;
|
|
|
|
vec = &mat.fvec;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
2017-03-10 01:22:24 +00:00
|
|
|
default:
|
|
|
|
return;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
2017-03-10 01:22:24 +00:00
|
|
|
scale_free_verts(sp, *vec, side0, -amount);
|
|
|
|
scale_free_verts(sp, *vec, side1, +amount);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
validate_modified_segments();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
|
|
|
// Extract a vector from a segment. The vector goes from the start face to the end face.
|
|
|
|
// The point on each face is the average of the four points forming the face.
|
2017-06-10 03:31:02 +00:00
|
|
|
static void extract_vector_from_segment_side(const vmsegptr_t sp, const unsigned side, vms_vector &vp, const unsigned vla, const unsigned vlb, const unsigned vra, const unsigned vrb)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2017-02-19 19:33:38 +00:00
|
|
|
auto &sv = Side_to_verts[side];
|
2017-08-11 23:43:54 +00:00
|
|
|
auto &verts = sp->verts;
|
|
|
|
const auto v1 = vm_vec_sub(vcvertptr(verts[sv[vra]]), vcvertptr(verts[sv[vla]]));
|
|
|
|
const auto v2 = vm_vec_sub(vcvertptr(verts[sv[vrb]]), vcvertptr(verts[sv[vlb]]));
|
2014-10-02 03:02:37 +00:00
|
|
|
vm_vec_add(vp, v1, v2);
|
|
|
|
vm_vec_scale(vp, F1_0/2);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
|
|
|
// Extract the right vector from segment *sp, return in *vp.
|
|
|
|
// The forward vector is defined to be the vector from the the center of the left face of the segment
|
|
|
|
// to the center of the right face of the segment.
|
2017-06-10 03:31:02 +00:00
|
|
|
void med_extract_right_vector_from_segment_side(const vmsegptr_t sp, int sidenum, vms_vector &vp)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
extract_vector_from_segment_side(sp, sidenum, vp, 3, 2, 0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------
|
|
|
|
// Extract the up vector from segment *sp, return in *vp.
|
|
|
|
// The forward vector is defined to be the vector from the the center of the bottom face of the segment
|
|
|
|
// to the center of the top face of the segment.
|
2017-06-10 03:31:02 +00:00
|
|
|
void med_extract_up_vector_from_segment_side(const vmsegptr_t sp, int sidenum, vms_vector &vp)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
extract_vector_from_segment_side(sp, sidenum, vp, 1, 2, 0, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Increase the size of Cursegp in dimension dimension by amount
|
2013-10-27 22:00:14 +00:00
|
|
|
static int segsize_common(int dimension, fix amount)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
vms_vector uvec, rvec, fvec, scalevec;
|
|
|
|
|
|
|
|
Degenerate_segment_found = 0;
|
|
|
|
|
|
|
|
med_scale_segment_new(Cursegp, dimension, amount);
|
|
|
|
|
2014-10-02 03:02:37 +00:00
|
|
|
med_extract_up_vector_from_segment_side(Cursegp, Curside, uvec);
|
|
|
|
med_extract_right_vector_from_segment_side(Cursegp, Curside, rvec);
|
2018-09-19 02:13:29 +00:00
|
|
|
extract_forward_vector_from_segment(vcvertptr, Cursegp, fvec);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-09-28 21:11:03 +00:00
|
|
|
scalevec.x = vm_vec_mag(rvec);
|
|
|
|
scalevec.y = vm_vec_mag(uvec);
|
|
|
|
scalevec.z = vm_vec_mag(fvec);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
if (Degenerate_segment_found) {
|
|
|
|
Degenerate_segment_found = 0;
|
|
|
|
editor_status("Applying scale would create degenerate segments. Aborting scale.");
|
|
|
|
med_scale_segment_new(Cursegp, dimension, -amount);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-10-26 22:01:13 +00:00
|
|
|
med_create_new_segment(scalevec);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// For all segments to which Cursegp is connected, propagate tmap (uv coordinates) from the connected
|
|
|
|
// segment back to Cursegp. This will meaningfully propagate uv coordinates to all sides which havve
|
|
|
|
// an incident edge. It will also do some sides more than once. And it is probably just not what you want.
|
2015-07-18 21:01:55 +00:00
|
|
|
array<int, MAX_SIDES_PER_SEGMENT> propagated = {};
|
2014-09-26 02:42:11 +00:00
|
|
|
for (int i=0; i<MAX_SIDES_PER_SEGMENT; i++)
|
2015-07-18 21:01:55 +00:00
|
|
|
{
|
|
|
|
const auto c = Cursegp->children[i];
|
|
|
|
if (IS_CHILD(c))
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
int s;
|
|
|
|
for (s=0; s<MAX_SIDES_PER_SEGMENT; s++)
|
|
|
|
propagated[s]++;
|
2016-07-06 01:54:24 +00:00
|
|
|
propagated[static_cast<int>(Side_opposite[i])]--;
|
2017-06-10 03:31:02 +00:00
|
|
|
med_propagate_tmaps_to_segments(vmsegptridx(c), Cursegp, 1);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
2015-07-18 21:01:55 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// Now, for all sides that were not adjacent to another side, and therefore did not get tmaps
|
|
|
|
// propagated to them, treat as a back side.
|
2014-09-26 02:42:11 +00:00
|
|
|
for (int i=0; i<MAX_SIDES_PER_SEGMENT; i++)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!propagated[i]) {
|
|
|
|
med_propagate_tmaps_to_back_side(Cursegp, i, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// New stuff, assign default texture to all affected sides.
|
|
|
|
|
|
|
|
Update_flags |= UF_WORLD_CHANGED;
|
|
|
|
mine_changed = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// ---------- segment size control ----------
|
|
|
|
|
|
|
|
int IncreaseSegLength()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,+F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegLength()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,-F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegWidth()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,-F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegWidth()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,+F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegHeight()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,+F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegHeight()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,-F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int IncreaseSegLengthBig()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,+5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegLengthBig()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,-5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegWidthBig()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,-5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegWidthBig()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,+5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegHeightBig()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,+5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegHeightBig()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,-5 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int IncreaseSegLengthDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,+40 *F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegLengthDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(ZDIM,-40*F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegWidthDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,+40*F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegWidthDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(XDIM,-40*F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int IncreaseSegHeightDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,+40 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DecreaseSegHeightDefault()
|
|
|
|
{
|
|
|
|
return segsize_common(YDIM,-40 * F1_0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
int ToggleSegSizeMode(void)
|
|
|
|
{
|
|
|
|
SegSizeMode++;
|
|
|
|
if (SegSizeMode > SEGSIZEMODE_MAX)
|
|
|
|
SegSizeMode = SEGSIZEMODE_MIN;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2013-10-27 22:00:14 +00:00
|
|
|
static int PerturbCursideCommon(fix amount)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int saveSegSizeMode = SegSizeMode;
|
|
|
|
vms_vector fvec, rvec, uvec;
|
|
|
|
fix fmag, rmag, umag;
|
|
|
|
SegSizeMode = SEGSIZEMODE_CURSIDE;
|
|
|
|
|
|
|
|
Modified_vertex_index = 0;
|
|
|
|
|
2018-09-19 02:13:29 +00:00
|
|
|
extract_forward_vector_from_segment(vcvertptr, Cursegp, fvec);
|
|
|
|
extract_right_vector_from_segment(vcvertptr, Cursegp, rvec);
|
|
|
|
extract_up_vector_from_segment(vcvertptr, Cursegp, uvec);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-09-28 21:11:03 +00:00
|
|
|
fmag = vm_vec_mag(fvec);
|
|
|
|
rmag = vm_vec_mag(rvec);
|
|
|
|
umag = vm_vec_mag(uvec);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-02-14 22:48:27 +00:00
|
|
|
range_for (const auto v, Side_to_verts[Curside])
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
vms_vector perturb_vec;
|
|
|
|
perturb_vec.x = fixmul(rmag, d_rand()*2 - 32767);
|
|
|
|
perturb_vec.y = fixmul(umag, d_rand()*2 - 32767);
|
|
|
|
perturb_vec.z = fixmul(fmag, d_rand()*2 - 32767);
|
2015-02-14 22:48:27 +00:00
|
|
|
scale_vert(Cursegp, Cursegp->verts[v], perturb_vec, amount);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// validate_segment(Cursegp);
|
|
|
|
// if (SegSizeMode) {
|
|
|
|
// for (i=0; i<MAX_SIDES_PER_SEGMENT; i++)
|
|
|
|
// if (Cursegp->children[i] != -1)
|
|
|
|
// validate_segment(&Segments[Cursegp->children[i]]);
|
|
|
|
// }
|
|
|
|
|
|
|
|
validate_modified_segments();
|
|
|
|
SegSizeMode = saveSegSizeMode;
|
|
|
|
|
|
|
|
Update_flags |= UF_WORLD_CHANGED;
|
|
|
|
mine_changed = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
int PerturbCurside(void)
|
|
|
|
{
|
|
|
|
PerturbCursideCommon(F1_0/10);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
int PerturbCursideBig(void)
|
|
|
|
{
|
|
|
|
PerturbCursideCommon(F1_0/2);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2015-12-22 04:18:50 +00:00
|
|
|
|
|
|
|
}
|