Change bold code snippets to inline code blocks

This commit is contained in:
James Gregory 2013-12-31 17:12:29 +11:00
commit 3c76d884ef
185 changed files with 1772 additions and 1772 deletions

View file

@ -19,21 +19,21 @@ reports what percent of total time is represented by all the areas that
were profiled; if you're profiling all areas, whatever's not explicitly
accounted for seems to be the floating-point emulator time. This quirk
fooled me for a while, leading me to think sine and cosine weren't major
drags on performance, because the **sin()** and **cos()** functions
drags on performance, because the `sin()` and `cos()` functions
spend most of their time in the emulator, and that time doesn't show up
in Turbo Profiler's statistics on those functions. Once I figured out
what was going on, it turned out that not only were **sin()** and
**cos()** major drags, they were taking up over half the total execution
what was going on, it turned out that not only were `sin()` and
`cos()` major drags, they were taking up over half the total execution
time by themselves.
The solution is a lookup table. Listing 53.1 contains a function called
**CosSin()** that calculates both the sine and cosine of an angle, via a
`CosSin()` that calculates both the sine and cosine of an angle, via a
lookup table. The function accepts angles in tenths of degrees; I
decided to use tenths of degrees rather than radians because that way
it's always possible to look up the sine and cosine of the exact angle
requested, rather than approximating, as would be required with radians.
Tenths of degrees should be fine enough control for most purposes; if
not, it's easy to alter **CosSin()** for finer gradations yet. GENCOS.C,
not, it's easy to alter `CosSin()` for finer gradations yet. GENCOS.C,
the program used to generate the lookup table (COSTABLE.INC), included
in Listing 53.1, can be found in the XSHARP22 subdirectory on the
listings diskette. GENCOS.C can generate a cosine table with any
@ -93,11 +93,11 @@ complexity of the screen.
Listing 53.2 shows X-Sharp file OLIST.C, which includes the key routines
for depth sorting. Objects are now stored in a linked list. The initial,
empty list, created by **InitializeObjectList(),** consists of a
empty list, created by `InitializeObjectList()`, consists of a
sentinel entry at either end, one at the farthest possible z coordinate,
and one at the nearest. New entries are inserted by **AddObject()** in
and one at the nearest. New entries are inserted by `AddObject()` in
z-sorted order. Each time the objects are moved, before they're drawn at
their new locations, **SortObjects()** is called to Z-sort the object
their new locations, `SortObjects()` is called to Z-sort the object
list, so that drawing will proceed from back to front. The Z-sorting is
done on the basis of the objects' center points; a center-point field
has been added to the object structure to support this, and the center