scrlsurf.cpp

来自「一个三维打斗游戏」· C++ 代码 · 共 162 行

CPP
162
字号
// (C) Copyright 1996-1998 by Anthony J. Carin.  All Rights Reserved.

#include "stdafx.h"
#include "scrlsurf.h"

scrollsurf::scrollsurf()
{
    m_bmps = m_curr = NULL;
}

scrollsurf::~scrollsurf()
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        m_curr = tmp->m_next;
        delete tmp;
        tmp = m_curr;
    }
}

void scrollsurf::draw()
{
    if (m_curr)
    {
        m_curr->m_bmp.draw();
        m_curr = m_curr->m_next;
        if (m_curr == NULL)
            m_curr = m_bmps;
    }
}

void scrollsurf::ExemptFromIntersect()
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.ExemptFromIntersect();
        tmp = tmp->m_next;
    }
}

void scrollsurf::OKToIntersect()
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.OKToIntersect();
        tmp = tmp->m_next;
    }
}

char scrollsurf::intersects(coordinate &a, coordinate &b)
{
    if (m_curr)
        return m_curr->m_bmp.intersects(a, b);
    return FALSE;
}

void scrollsurf::xrotate(direction& d)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.xrotate(d);
        tmp = tmp->m_next;
    }
}

void scrollsurf::yrotate(direction& d)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.yrotate(d);
        tmp = tmp->m_next;
    }
}

void scrollsurf::zrotate(direction& d)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.zrotate(d);
        tmp = tmp->m_next;
    }
}

scrollsurf::scrollsurf(surfs& s) : surfs(s)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp = s;
        tmp = tmp->m_next;
    }
}

void scrollsurf::CalcNormals()
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.CalcNormals();
        tmp = tmp->m_next;
    }
}

coordinate& scrollsurf::intersectingpoint()
{
    static coordinate c;
    if (m_curr)
        c = m_curr->m_bmp.intersectingpoint();
    return c;
}

char scrollsurf::iswithin(coordinate& c)
{
    if (m_curr)
        return m_curr->m_bmp.iswithin(c);
    return FALSE;
}

void scrollsurf::addsurf(CString& filename)
{
    m_curr = new bmpsurfholder(filename);
    m_curr->m_next = m_bmps;
    m_bmps = m_curr;
}

void scrollsurf::setto(coordinate& a, coordinate& b, coordinate& c, coordinate& d)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp.setto(a, b, c, d);
        tmp = tmp->m_next;
    }
}

void scrollsurf::operator =(surfs& s)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp = s;
        tmp = tmp->m_next;
    }
}

void scrollsurf::operator +=(coordinate& c)
{
    bmpsurfholder *tmp = m_bmps;
    while (tmp)
    {
        tmp->m_bmp += c;
        tmp = tmp->m_next;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?