Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

struct.c File Reference

Go to the source code of this file.

Data Structures

struct  odd
struct  point
struct  rect

Defines

#define max(a, b)   ((a) > (b) ? (a) : (b))
#define min(a, b)   ((a) < (b) ? (a) : (b))

Typedefs

typedef point point
typedef rect rect

Functions

point addpoint (point p1, point p2)
rect canonrect (rect r)
 main ()
point makepoint (int x, int y)
rect makerect (point p1, point p2)
 odd (struct odd y)
int ptinrect (point p, rect r)

Variables

odd y


Define Documentation

#define max a,
 )     ((a) > (b) ? (a) : (b))
 

Definition at line 11 of file struct.c.

#define min a,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 10 of file struct.c.


Typedef Documentation

typedef struct point point
 

Referenced by AAS_AreaGroundFace(), AAS_DrawPlaneCross(), AAS_InsideFace(), AAS_PointAreaNum(), AAS_PointContents(), AAS_PointInsideFace(), AAS_PointPresenceType(), AAS_ProjectPointOntoVector(), AddWindingPoint(), BotImport_PointContents(), BotValidChatPosition(), CG_AddParticleToScene(), CG_ParticleBloodCloud(), CG_ParticleDust(), CG_PointContents(), CM_ProjectPointOntoVector(), CCamWnd::CullBrush(), DistancePointToLine(), CXYWnd::DropClipPoint(), CXYWnd::DropPathPoint(), FilterMapDrawSurfIntoTree(), FilterTrace(), FindPoint(), FixFaceEdges(), G_Damage(), G_RotatePoint(), glBox(), glLabeledPoint(), InsideFace(), InsideWinding(), CZWnd::OnLButtonDown(), CZView::OnLButtonDown(), CXYWnd::OnLButtonDown(), CCamWnd::OnLButtonDown(), CZWnd::OnLButtonUp(), CZView::OnLButtonUp(), CXYWnd::OnLButtonUp(), CCamWnd::OnLButtonUp(), CZWnd::OnMButtonDown(), CXYWnd::OnMButtonDown(), CCamWnd::OnMButtonDown(), CZWnd::OnMButtonUp(), CXYWnd::OnMButtonUp(), CCamWnd::OnMButtonUp(), CZWnd::OnMouseMove(), CZView::OnMouseMove(), CXYWnd::OnMouseMove(), CCamWnd::OnMouseMove(), CZWnd::OnRButtonDown(), CZView::OnRButtonDown(), CXYWnd::OnRButtonDown(), CCamWnd::OnRButtonDown(), CZWnd::OnRButtonUp(), CZView::OnRButtonUp(), CXYWnd::OnRButtonUp(), CCamWnd::OnRButtonUp(), CXYWnd::OriginalButtonDown(), CXYWnd::OriginalButtonUp(), CCamWnd::OriginalMouseDown(), CCamWnd::OriginalMouseUp(), idSplineList::parse(), PM_CorrectAllSolid(), PM_GroundTrace(), PM_GroundTraceMissed(), PM_SetWaterLevel(), PointInLeaf(), PointInLeafnum(), PointOnWinding(), PointToPolygonFormFactor(), ProjectPointOntoVector(), Q1_PointInLeaf(), R_GridInsertColumn(), R_GridInsertRow(), R_LightForPoint(), RaySphereIntersections(), RB_AddFlare(), RotatePoint(), RotatePointAroundVector(), SetFacetFilter(), CXYWnd::SnapToPoint(), Sys_PreventMouseMovement(), target_laser_think(), TraceAgainstFacet(), trap_AAS_PointAreaNum(), trap_AAS_PointContents(), trap_AAS_PointReachabilityAreaIndex(), trap_PointContents(), trap_R_LightForPoint(), VL_FindAdjacentSurface(), VL_GetFilter(), VL_LightLeafnum(), VL_PointInLeafnum(), VL_PointInLeafnum_r(), VL_SmoothenLightmapEdges(), VS_FindAdjacentSurface(), VS_GetFilter(), VS_LightLeafnum(), VS_PointInLeafnum(), VS_PointInLeafnum_r(), VS_SmoothenLightmapEdges(), Winding_InsertPoint(), Winding_PointInside(), Winding_RemovePoint(), CXYWnd::XY_MouseDown(), CXYWnd::XY_MouseMoved(), CXYWnd::XY_ToGridPoint(), and CXYWnd::XY_ToPoint().

typedef struct rect rect
 

Referenced by CG_Draw1stPlace(), CG_Draw2ndPlace(), CG_DrawAreaChat(), CG_DrawAreaPowerUp(), CG_DrawAreaSystemChat(), CG_DrawAreaTeamChat(), CG_DrawBlueFlagHead(), CG_DrawBlueFlagName(), CG_DrawBlueFlagStatus(), CG_DrawBlueName(), CG_DrawBlueScore(), CG_DrawCapFragLimit(), CG_DrawCTFPowerUp(), CG_DrawGameStatus(), CG_DrawGameType(), CG_DrawKiller(), CG_DrawMedal(), CG_DrawNewTeamInfo(), CG_DrawPlayerAmmoIcon(), CG_DrawPlayerAmmoValue(), CG_DrawPlayerArmorIcon(), CG_DrawPlayerArmorValue(), CG_DrawPlayerHasFlag(), CG_DrawPlayerHead(), CG_DrawPlayerHealth(), CG_DrawPlayerItem(), CG_DrawPlayerLocation(), CG_DrawPlayerScore(), CG_DrawPlayerStatus(), CG_DrawRedFlagHead(), CG_DrawRedFlagName(), CG_DrawRedFlagStatus(), CG_DrawRedName(), CG_DrawRedScore(), CG_DrawSelectedPlayerArmor(), CG_DrawSelectedPlayerHead(), CG_DrawSelectedPlayerHealth(), CG_DrawSelectedPlayerLocation(), CG_DrawSelectedPlayerName(), CG_DrawSelectedPlayerPowerup(), CG_DrawSelectedPlayerStatus(), CG_DrawSelectedPlayerWeapon(), CG_DrawTeamColor(), CG_DrawTeamSpectators(), CG_HarvesterSkulls(), CG_OneFlagStatus(), CG_OwnerDraw(), GradientBar_Paint(), Item_CorrectedTextRect(), CMainFrame::OnCreateClient(), CMainFrame::OnDynamicLighting(), CMainFrame::OnHelpCommandlist(), CXYWnd::OnSize(), CCamWnd::OnSize(), Rect_ContainsPoint(), Rect_ToWindowCoords(), Sys_CreateConsole(), Sys_LockMouseInInputRect(), UI_DrawAllMapsSelection(), UI_DrawBotName(), UI_DrawBotSkill(), UI_DrawClanCinematic(), UI_DrawClanLogo(), UI_DrawClanName(), UI_DrawCrosshair(), UI_DrawEffects(), UI_DrawGameType(), UI_DrawGLInfo(), UI_DrawHandicap(), UI_DrawJoinGameType(), UI_DrawKeyBindStatus(), UI_DrawMapCinematic(), UI_DrawMapPreview(), UI_DrawMapTimeToBeat(), UI_DrawNetFilter(), UI_DrawNetGameType(), UI_DrawNetMapCinematic(), UI_DrawNetMapPreview(), UI_DrawNetSource(), UI_DrawOpponent(), UI_DrawOpponentLogo(), UI_DrawOpponentLogoMetal(), UI_DrawOpponentLogoName(), UI_DrawOpponentName(), UI_DrawPlayerLogo(), UI_DrawPlayerLogoMetal(), UI_DrawPlayerLogoName(), UI_DrawPlayerModel(), UI_DrawPreviewCinematic(), UI_DrawRedBlue(), UI_DrawSelectedPlayer(), UI_DrawServerMOTD(), UI_DrawServerRefreshDate(), UI_DrawSkill(), UI_DrawTeamMember(), UI_DrawTeamName(), UI_DrawTier(), UI_DrawTierGameType(), UI_DrawTierMap(), UI_DrawTierMapName(), UI_OwnerDraw(), WCam_WndProc(), WZ_WndProc(), and XYWndProc().


Function Documentation

point addpoint point  p1,
point  p2
 

Definition at line 4 of file struct.c.

References p2, point::x, and point::y.

Referenced by main().

00004                                    {    /* add two points */
00005     p1.x += p2.x;
00006     p1.y += p2.y;
00007     return p1;
00008 }

rect canonrect rect  r  ) 
 

Definition at line 13 of file struct.c.

References max, min, rect::pt1, rect::pt2, r, point::x, and point::y.

Referenced by makerect().

00013                        {        /* canonicalize rectangle coordinates */
00014     rect temp;
00015 
00016     temp.pt1.x = min(r.pt1.x, r.pt2.x);
00017     temp.pt1.y = min(r.pt1.y, r.pt2.y);
00018     temp.pt2.x = max(r.pt1.x, r.pt2.x);
00019     temp.pt2.y = max(r.pt1.y, r.pt2.y);
00020     return temp;
00021 }

main  ) 
 

Definition at line 51 of file struct.c.

References addpoint(), exit(), i, makepoint(), makerect(), odd(), printf(), rect::pt1, rect::pt2, ptinrect(), point::x, x, point::y, and y.

00051        {
00052     int i;
00053     point x, origin = { 0, 0 }, maxpt = { 320, 320 };
00054     point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 };
00055     rect screen = makerect(addpoint(maxpt, makepoint(-10, -10)),
00056         addpoint(origin, makepoint(10, 10)));
00057 
00058     for (i = 0; i < sizeof pts/sizeof pts[0]; i++) {
00059         printf("(%d,%d) is ", pts[i].x,
00060             (x = makepoint(pts[i].x, pts[i].y)).y);
00061         if (ptinrect(x, screen) == 0)
00062             printf("not ");
00063         printf("within [%d,%d; %d,%d]\n", screen.pt1.x, screen.pt1.y,
00064             screen.pt2.x, screen.pt2.y);
00065     }
00066     odd(y);
00067     exit(0);
00068 }

Here is the call graph for this function:

point makepoint int  x,
int  y
 

Definition at line 23 of file struct.c.

References p, point::x, and point::y.

Referenced by main().

00023                               {     /* make a point from x and y components */
00024     point p;
00025 
00026     p.x = x;
00027     p.y = y;
00028     return p;
00029 }

rect makerect point  p1,
point  p2
 

Definition at line 31 of file struct.c.

References canonrect(), p2, rect::pt1, rect::pt2, and r.

Referenced by main().

00031                                   { /* make a rectangle from two points */
00032     rect r;
00033 
00034     r.pt1 = p1;
00035     r.pt2 = p2;
00036     return canonrect(r);
00037 }

Here is the call graph for this function:

odd struct odd  y  ) 
 

Definition at line 46 of file struct.c.

References odd::a, printf(), and x.

Referenced by main().

00046                   {
00047     struct odd x = y;
00048     printf("%s\n", x.a);
00049 }

Here is the call graph for this function:

int ptinrect point  p,
rect  r
 

Definition at line 39 of file struct.c.

References p, rect::pt1, rect::pt2, r, point::x, and point::y.

Referenced by main().

00039                               {     /* is p in r? */
00040     return p.x >= r.pt1.x && p.x < r.pt2.x
00041         && p.y >= r.pt1.y && p.y < r.pt2.y;
00042 }


Variable Documentation

struct odd y
 


Generated on Thu Aug 25 15:57:42 2005 for Quake III Arena by  doxygen 1.3.9.1